Introduction

Hyper Protect DBaaS is the next-level evolution of how data is stored in a highly secured enterprise cloud service. It is ideally suited for workloads with sensitive data and allows you to retain your data in a fully encrypted client database without need for specialized skills. This service provides capabilities to provision, manage, maintain and monitor multiple database types like MongoDB and PostgreSQL through standardized APIs. Hyper Protect DBaaS protects against threats of data breach and data manipulation leveraging the strengths of LinuxONE pervasive encryption, scalability, performance and IBM Secure Service Container technology.

The IBM Cloud® Hyper Protect DBaaS API is a REST-based API for reading and writing objects.

For details about using IBM Cloud Hyper Protect DBaaS, see IBM Cloud Hyper Protect DBaaS for PostgreSQL and IBM Cloud Hyper Protect DBaaS for MongoDB.

Go SDK Installation

If your application uses Go modules for dependency management (recommended), just add an import for each service that you will use in your application. Here is an example:

import (
	"github.com/IBM/hpdb-go-sdk/hpdbv3"
)

GitHub

Authentication

To work with the API, authenticate your app or service by including your IBM Cloud IAM (Identify and Access Management) access token and user ID in API requests.

You can retrieve an access token by first creating an API key, and then exchanging your API key for a IBM Cloud IAM token and IBM Cloud user id. For more information, see API keys and tokens.

To call each method, you'll need to be assigned a role that includes the required IAM actions. For more information about IAM actions and how they map to roles, see Managing access for Hyper Protect DBaaS for PostgreSQL or Managing access for Hyper Protect DBaaS for MongoDB.

Error handling

The IBM Cloud Hyper Protect DBaaS service uses standard HTTP response codes to indicate whether a method completed successfully. A 200 response always indicates success. A 400 type response is some sort of failure, and a 500 type response usually indicates an internal system error.

Pagination

No endpoint currently returns paginated data.

Rate limiting

No endpoint currently implements rate limiting.

Change log

For a list of changes and improvements to this API, see the Hyper Protect DBaaS for MongoDB change log or Hyper Protect DBaaS for PostgreSQL change log.

Methods

Get database cluster details

Get the detailed information of the specific database cluster that is indicated by its ID.

GET /clusters/{cluster_id}

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}"
  • getClusterOptions := hpdbService.NewGetClusterOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    cluster, response, err := hpdbService.GetCluster(getClusterOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(cluster, "", "  ")
    fmt.Println(string(b))

Response

An object which shows detailed information about a cluster which has id, name, state, three replicas and so on.

Status Code

  • The request was successful.

  • Parameter error.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "id": "9cebab98-afeb-4886-9a29-8e741716e7ff",
      "crn": "crn:v1:staging:public:hyperp-dbaas-mongodb:us-east:a/23a24a3e3fe7a115473f07be1c44bdb5:9cebab98-afeb-4886-9a29-8e741716e7ff::",
      "customer_monitoring_status": "enabled",
      "is_cos_backup_enabled": true,
      "region": "us-east",
      "name": "cluster01",
      "state": "PROVISIONED",
      "reason": "",
      "db_type": "mongodb",
      "db_version": "mongodb-enterprise 4.4.6",
      "private_endpoint": "",
      "private_endpoint_type": "",
      "public_endpoint": "dbaas226.hyperp-dbaas.cloud.ibm.com:21089,dbaas227.hyperp-dbaas.cloud.ibm.com:21451,dbaas228.hyperp-dbaas.cloud.ibm.com:20290",
      "plan_id": "1563f33f-874f-4d83-b6de-09384cdfb1ef",
      "last_active": 1647843913002,
      "log_url": "",
      "metric_url": "",
      "replica_count": 3,
      "user_id": "23a24a3e3fe7a115473f07be1c44bdb5",
      "resource": {
        "cpu": 1,
        "memory": "2gib",
        "storage": "5gib",
        "storage_used": "0.9gib"
      },
      "nodes": [
        {
          "id": "c5ff2d841c7e6a11de3cbaa2b992d712",
          "replica_state": "PRIMARY",
          "replication_lag": 0,
          "node_state": "RUNNING",
          "reason": "",
          "stopped_reason": "",
          "name": "dbaas55-29247",
          "created_at": "2021-06-29T07:46:56.000Z",
          "updated_at": "2021-06-29T07:48:11.000Z",
          "is_metric_enabled": false,
          "is_logging_enabled": false,
          "user_id": "23a24a3e3fe7a115473f07be1c44bdb5"
        },
        {
          "id": "edf0b2d0c63ec04f632e2cf649d68903",
          "replica_state": "SECONDARY",
          "replication_lag": 0,
          "node_state": "RUNNING",
          "reason": "",
          "stopped_reason": "",
          "name": "dbaas54-29496",
          "created_at": "2021-06-29T07:46:56.000Z",
          "updated_at": "2021-06-29T07:48:11.000Z",
          "is_metric_enabled": false,
          "is_logging_enabled": false,
          "user_id": "23a24a3e3fe7a115473f07be1c44bdb5"
        },
        {
          "id": "2f23abffa2f0b68cdacff0ba65c4492c",
          "replica_state": "SECONDARY",
          "replication_lag": 0,
          "node_state": "RUNNING",
          "reason": "",
          "stopped_reason": "",
          "name": "dbaas53-29309",
          "created_at": "2021-06-29T07:46:56.000Z",
          "updated_at": "2021-06-29T07:48:11.000Z",
          "is_metric_enabled": false,
          "is_logging_enabled": false,
          "user_id": "23a24a3e3fe7a115473f07be1c44bdb5"
        }
      ],
      "created_at": "2021-06-29T07:46:51.000Z",
      "updated_at": "2021-06-29T07:48:11.000Z"
    }

List database users

List the information about all the users in the specified database cluster that is indicated by its ID.

GET /clusters/{cluster_id}/users

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/users"
  • listUsersOptions := hpdbService.NewListUsersOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    users, response, err := hpdbService.ListUsers(listUsersOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(users, "", "  ")
    fmt.Println(string(b))

Response

Object of information about users.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "users": [
        {
          "name": "admin",
          "role_attributes": [
            "INHERIT",
            "CREATEDB",
            "CREATEROLE",
            "LOGIN"
          ]
        }
      ]
    }

Get database user details

Get the detailed information about the user of a specified database cluster that is indicated by its ID.

GET /clusters/{cluster_id}/users/{db_user_id}

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • The ID of the user about which you want to get information. For MongoDB, it should be 'authentication_database.username'; for example: 'mydb.syrena'. For PostgreSQL, it should be only 'username'; for example: 'syrena'.

    Example: admin.admin

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/users/{db_user_id}"
  • getUserOptions := hpdbService.NewGetUserOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
      "admin.admin",
    )
    
    userDetails, response, err := hpdbService.GetUser(getUserOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(userDetails, "", "  ")
    fmt.Println(string(b))

Response

A user information object received.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable, or the user ID not found.

  • Internal error.

Example responses
  • {
      "name": "admin",
      "auth_db": "admin",
      "db_access": [
        {
          "db": "admin",
          "privileges": [
            "CREATE",
            "CONNECT",
            "TEMP"
          ]
        }
      ],
      "role_attributes": [
        "INHERIT",
        "CREATEROLE",
        "CREATEDB",
        "LOGIN"
      ]
    }

List databases

Get a list of all databases in a specified database cluster that is indicated by its ID.

GET /clusters/{cluster_id}/databases

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/databases"
  • listDatabasesOptions := hpdbService.NewListDatabasesOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    databases, response, err := hpdbService.ListDatabases(listDatabasesOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(databases, "", "  ")
    fmt.Println(string(b))

Response

Information about all databases in a cluster.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "total_size": 8084615,
      "databases": [
        {
          "name": "admin",
          "size_on_disk": 8084615
        }
      ]
    }

Scale resources

Scale resources in a specified cluster that is indicated by its ID.

PATCH /clusters/{cluster_id}/resource

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

Information about the resources you want to scale.

Examples:
View
  • curl -X PATCH --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   --header "Content-Type: application/json"   --data '{"resource": {"cpu":1}}'   "{base_url}/clusters/{cluster_id}/resource"
  • scaleResourcesOptions := hpdbService.NewScaleResourcesOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    cpuNumber := 2
    memory := "2gib"
    storage := "5gib"
    
    var resource hpdbv3.Resources
    resource.Cpu = &cpuNumber
    resource.Memory = &memory
    resource.Storage = &storage
    scaleResourcesOptions.SetResource(&resource)
    
    taskID, response, err := hpdbService.ScaleResources(scaleResourcesOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(taskID, "", "  ")
    fmt.Println(string(b))

Response

The ID of a task.

Status Code

  • The request was accepted.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "task_id": "1e902f30-da1b-11eb-9433-755fe141f81f"
    }

Get configuration

Get database configuration in a specified cluster that is indicated by its ID.

GET /clusters/{cluster_id}/configuration

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/configuration"
  • getConfigurationOptions := hpdbService.NewGetConfigurationOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    configuration, response, err := hpdbService.GetConfiguration(getConfigurationOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(configuration, "", "  ")
    fmt.Println(string(b))

Response

Database configuration.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "deadlock_timeout": 10000,
      "max_locks_per_transaction": 100,
      "shared_buffers": 256,
      "max_connections": 150
    }

Update configuration

Update database configuration in a specified cluster that is indicated by its ID.

PATCH /clusters/{cluster_id}/configuration

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

Parameter information to be updated.

Examples:
View
  • curl -X PATCH --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   --header "Content-Type: application/json"   --data '{"configuration":{"deadlock_timeout":10002,"max_locks_per_transaction":100,"shared_buffers":256,"max_connections":150}}'   "{base_url}/clusters/{cluster_id}/configuration"
  • updateConfigurationOptions := hpdbService.NewUpdateConfigurationOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    timeout := 1001
    var config hpdbv3.Configurations
    config.DeadlockTimeout = &timeout
    updateConfigurationOptions.SetConfiguration(&config)
    
    taskID, response, err := hpdbService.UpdateConfiguration(updateConfigurationOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(taskID, "", "  ")
    fmt.Println(string(b))

Response

The ID of a task.

Status Code

  • A task is running.

  • One or more parameter errors.

  • The IAM access token specified by "Authorization" is invalid.

  • Internal error.

Example responses
  • {
      "task_id": "1e902f30-da1b-11eb-9433-755fe141f81f"
    }

List tasks

List tasks running or recently run on a specified cluster that is indicated by its ID.

GET /clusters/{cluster_id}/tasks

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/tasks"
  • listTasksOptions := hpdbService.NewListTasksOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    tasks, response, err := hpdbService.ListTasks(listTasksOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(tasks, "", "  ")
    fmt.Println(string(b))

Response

List of tasks running or recently run on a specified cluster.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "tasks": [
        {
          "id": "1e902f30-da1b-11eb-9433-755fe141f81f",
          "type": "resource_scale",
          "state": "RUNNING",
          "reason": "",
          "started_at": "2021-07-01T03:19:17.000Z",
          "finished_at": ""
        }
      ]
    }

Show task

Show task information of a specified task id in a cluster.

GET /clusters/{cluster_id}/tasks/{task_id}

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • The ID of a task object.

    Example: c1a15760-a4f2-11ec-b00a-7f684d1dd53

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/tasks/{task_id}"
  • getTaskOptions := hpdbService.NewGetTaskOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
      "c1a15760-a4f2-11ec-b00a-7f684d1dd53",
    )
    
    task, response, err := hpdbService.GetTask(getTaskOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(task, "", "  ")
    fmt.Println(string(b))

Response

The task details object.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable or task ID non-existent.

  • Internal error.

Example responses
  • {
      "id": "1e902f30-da1b-11eb-9433-755fe141f81f",
      "type": "resource_scale",
      "state": "SUCCEEDED",
      "reason": "",
      "started_at": "2021-07-01T03:19:17.000Z",
      "finished_at": "2021-07-01T03:21:13.000Z",
      "spec": {
        "cpu": 2,
        "memory": "2gib",
        "storage": "5gib"
      },
      "nodes": [
        {
          "id": "2f23abffa2f0b68cdacff0ba65c4492c",
          "state": "SUCCEEDED",
          "reason": "",
          "started_at": "2021-07-01T03:19:51.000Z",
          "finished_at": "2021-07-01T03:20:06.000Z"
        },
        {
          "id": "edf0b2d0c63ec04f632e2cf649d68903",
          "state": "SUCCEEDED",
          "reason": "",
          "started_at": "2021-07-01T03:19:17.000Z",
          "finished_at": "2021-07-01T03:19:33.000Z"
        },
        {
          "id": "c5ff2d841c7e6a11de3cbaa2b992d712",
          "state": "SUCCEEDED",
          "reason": "",
          "started_at": "2021-07-01T03:20:36.000Z",
          "finished_at": "2021-07-01T03:20:52.000Z"
        }
      ]
    }

Enable backup to COS

Enable backup to COS.

POST /clusters/{cluster_id}/backups/cos/enable

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

Backup configuration.

Examples:
View
  • curl -X POST --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   --header "Content-Type: application/json"   --data '{"cos_hmac_keys":{"access_key_id": "xxxb80bc699246ec9355bc1136ba2278","secret_access_key":"xxxeb1ada7d36249d90a640431371325cd7892800885d68d"},"cos_endpoint":"s3.us-west.cloud-object-storage.test.appdomain.cloud","bucket_instance_crn":"crn:v1:staging:public:cloud-object-storage:global:a/23a24a3e3fe7a115473f07be1c44bdb5:3ac008bb-16a8-48b2-b8f7-25a990c14b41:bucket:cloud-object-storage-gc-cos-standard-luu"}'   "{base_url}/clusters/{cluster_id}/backups/cos/enable"
  • enableCosBackupOptions := hpdbService.NewEnableCosBackupOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    enableCosBackupOptions.SetBucketInstanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/23a24a3e3fe7a115473f07be1c44bdb5:3ac008bb-16a8-48b2-b8f7-25a990c14b41:bucket:cloud-object-storage-gc-cos-standard-luu")
    enableCosBackupOptions.SetCosEndpoint("s3.us-west.cloud-object-storage.test.appdomain.cloud")
    
    var cosKey hpdbv3.CosHmacKeys
    keyId := "e4465d50a56f401a81d275f55c57bc2f"
    key := "0c29c8299dbba1d6xx7191d6xx5ce3e7eb601fa4bd9f5a"
    cosKey.AccessKeyID = &keyId
    cosKey.SecretAccessKey = &key
    enableCosBackupOptions.SetCosHmacKeys(&cosKey)
    
    taskID, response, err := hpdbService.EnableCosBackup(enableCosBackupOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(taskID, "", "  ")
    fmt.Println(string(b))

Response

The ID of a task.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "task_id": "1e902f30-da1b-11eb-9433-755fe141f81f"
    }

Disable backup to COS

Disable backup to COS.

POST /clusters/{cluster_id}/backups/cos/disable

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • curl -X POST --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/backups/cos/disable"
  • disableCosBackupOptions := hpdbService.NewDisableCosBackupOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    taskID, response, err := hpdbService.DisableCosBackup(disableCosBackupOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(taskID, "", "  ")
    fmt.Println(string(b))

Response

The ID of a task.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "task_id": "1e902f30-da1b-11eb-9433-755fe141f81f"
    }

Get backup configuration

Get backup configuration.

GET /clusters/{cluster_id}/backups/cos/configuration

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/clusters/{cluster_id}/backups/cos/configuration"
  • getCosBackupConfigOptions := hpdbService.NewGetCosBackupConfigOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    getBackupConfigResponse, response, err := hpdbService.GetCosBackupConfig(getCosBackupConfigOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(getBackupConfigResponse, "", "  ")
    fmt.Println(string(b))

Response

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "cos_endpoint": "s3.us-west.cloud-object-storage.test.appdomain.cloud",
      "bucket_instance_crn": "crn:v1:staging:public:cloud-object-storage:global:a/23a24a3e3fe7a115473f07be1c44bdb5:3ac008bb-16a8-48b2-b8f7-25a990c14b41:bucket:cloud-object-storage-gc-cos-standard-luu"
    }

Restore from backup

Restore from a backup file.

POST /clusters/{cluster_id}/restore

Request

Path Parameters

  • The ID of a cluster object.

    Example: 9cebab98-afeb-4886-9a29-8e741716e7ff

Restore configuration.

Examples:
View
  • curl -X POST --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   --header "Content-Type: application/json"   --data '{"source_type":"cos","cos_hmac_keys":{"access_key_id":"e4465d50a56f401a81d275f55c57bc2f","secret_access_key":"0c29c8299dbba1d6xx7191d6xx5ce3e7eb601fa4bd9f5a"},"cos_endpoint":"s3.us-west.cloud-object-storage.test.appdomain.cloud","bucket_instance_crn":"crn:v1:staging:public:cloud-object-storage:global:a/23a24a3e3fe7a115473f07be1c44bdb5:3ac008bb-16a8-48b2-b8f7-25a990c14b41:bucket:cloud-object-storage-gc-cos-standard-luu","backup_file":"archive-2022-03-16-140004Z.tar"}'   "{base_url}/clusters/{cluster_id}/restore"
  • restoreOptions := hpdbService.NewRestoreOptions(
      "9cebab98-afeb-4886-9a29-8e741716e7ff",
    )
    
    restoreOptions.SetSourceType("cos")
    var cosKey hpdbv3.CosHmacKeys
    keyId := "e4465d50a56f401a81d275f55c57bc2f"
    key := "0c29c8299dbba1d6xx7191d6xx5ce3e7eb601fa4bd9f5a"
    cosKey.AccessKeyID = &keyId
    cosKey.SecretAccessKey = &key
    restoreOptions.SetCosHmacKeys(&cosKey)
    restoreOptions.SetBucketInstanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/23a24a3e3fe7a115473f07be1c44bdb5:3ac008bb-16a8-48b2-b8f7-25a990c14b41:bucket:cloud-object-storage-gc-cos-standard-luu")
    restoreOptions.SetCosEndpoint("s3.us-west.cloud-object-storage.test.appdomain.cloud")
    restoreOptions.SetBackupFile("archive-2022-03-16-140004Z.tar")
    
    taskID, response, err := hpdbService.Restore(restoreOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(taskID, "", "  ")
    fmt.Println(string(b))

Response

The ID of a task.

Status Code

  • The request was successful.

  • Unauthorized.

  • Cluster unavailable.

  • Internal error.

Example responses
  • {
      "task_id": "1e902f30-da1b-11eb-9433-755fe141f81f"
    }

List database log files of a node

List the latest log files of the node that is indicated by its ID.

GET /nodes/{node_id}/logs

Request

Path Parameters

  • The ID of an node object.

    Example: 452ebc6007955ba275cfbbe0f2a78e40

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/nodes/{node_id}/logs"
  • listNodeLogsOptions := hpdbService.NewListNodeLogsOptions(
      "452ebc6007955ba275cfbbe0f2a78e40",
    )
    
    logList, response, err := hpdbService.ListNodeLogs(listNodeLogsOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(logList, "", "  ")
    fmt.Println(string(b))

Response

Logs object.

Status Code

  • The request was successful.

  • Unauthorized.

  • Required resource does not exist; this is usually caused by passing an invalid node ID.

  • Internal error.

Example responses
  • {
      "logs": [
        {
          "filename": "postgresql.log",
          "size": 26369,
          "last_modified": "2021-06-29T07:55:19.000Z"
        },
        {
          "filename": "audit.log",
          "size": 34203,
          "last_modified": "2021-06-29T07:48:16.000Z"
        }
      ]
    }

Get log details

Get the content of the specified log file of the node that is indicated by its ID.

GET /nodes/{node_id}/logs/{log_name}

Request

Custom Headers

  • Allowable values: [application/json,application/x-download]

Path Parameters

  • The ID of an node object.

    Example: 452ebc6007955ba275cfbbe0f2a78e40

  • The name of the log file.

    Example: audit.log

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/nodes/{node_id}/logs/{log_name}"
  • getLogOptions := hpdbService.NewGetLogOptions(
      "452ebc6007955ba275cfbbe0f2a78e40",
      "audit.log",
    )
    
    file, response, err := hpdbService.GetLog(getLogOptions)
    if err != nil {
      panic(err)
    }
    if file != nil {
      defer file.Close()
      outFile, err := os.Create("file.out")
      if err != nil { panic(err) }
      defer outFile.Close()
      _, err = io.Copy(outFile, file)
      if err != nil { panic(err) }
    }

Response

File downloaded.

Status Code

  • The request was successful. A log file stream will be returned.

  • Unauthorized.

  • Required resource does not exist; this is usually caused by passing an invalid node ID.

  • Internal error.

No Sample Response

This method does not specify any sample responses.