-
Notifications
You must be signed in to change notification settings - Fork 5
[STORY-2750] feat(dbng): Add databases endpoints #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
7887f0a
c8037ec
d7c6882
0afba0c
caa5de3
56b62ea
2698a20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| --- | ||
| title: Databases | ||
| layout: default | ||
| --- | ||
|
|
||
| # Databases | ||
|
|
||
| --- row --- | ||
|
|
||
| **Database attributes** | ||
|
|
||
| {:.table} | ||
| | field | type | description | | ||
| | ----------- | ------ | ----------------------------------------------------- | | ||
| | id | string | unique ID | | ||
| | name | string | name of the database | | ||
| | project_id | string | ID of the project the database belongs to | | ||
| | technology | string | database technology (e.g., postgresql-ng)| | ||
| | plan | string | plan name (e.g., postgresql-ng-starter-4096) | | ||
|
|
||
| ||| col ||| | ||
|
|
||
| Example object: | ||
|
|
||
| ```json | ||
| { | ||
| "id": "54100930736f7563d5030000", | ||
| "name": "my-postgres-db", | ||
| "project_id": "pr-82a3cac5-9b25-473e-b33d-6272b87e636f", | ||
| "technology": "postgresql-ng", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: is this the definitive name? (just to be sure technology and plan names are future proof) |
||
| "plan": "postgresql-ng-starter-4096" | ||
| } | ||
| ``` | ||
|
|
||
| --- row --- | ||
|
|
||
| ## Create a Database | ||
|
|
||
| --- row --- | ||
|
|
||
| `POST https://$SCALINGO_API_URL/v1/databases` | ||
|
|
||
| ### Parameters | ||
|
|
||
| * `database.name`: Database name. Should have between 6 and 48 lower case alphanumerical characters and hyphens. | ||
| * `database.technology`: Database technology identifier. Only `postgresql-ng` is supported for now. | ||
| * `database.plan`: Plan identifier (e.g., `postgresql-ng-starter-4096`). Available plans can be retrieved via the [Addon Providers endpoint](/addon_providers). | ||
| * `database.project_id`: (*Optional*) ID of the project to assign the database to. If not provided, the database will be assigned to your default project. | ||
|
|
||
| **Note:** To provision other database types (MySQL, MongoDB, Redis, etc.), please use the [Addons provisioning endpoint](/addons#provision-an-addon). | ||
|
|
||
| ||| col ||| | ||
|
|
||
| Example | ||
|
|
||
| ```sh | ||
| curl -H "Accept: application/json" -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer $BEARER_TOKEN" \ | ||
| -X POST https://$SCALINGO_API_URL/v1/databases -d \ | ||
| '{ | ||
| "database": { | ||
| "name": "my-postgres-db", | ||
| "technology": "postgresql-ng", | ||
| "plan": "postgresql-ng-starter-4096", | ||
| "project_id": "pr-82a3cac5-9b25-473e-b33d-6272b87e636f" | ||
| } | ||
| }' | ||
| ``` | ||
|
|
||
| Returns 201 Created | ||
|
|
||
| ```json | ||
| { | ||
| "database": { | ||
| "id": "54100930736f7563d5030000", | ||
| "name": "my-postgres-db", | ||
| "project_id": "pr-82a3cac5-9b25-473e-b33d-6272b87e636f", | ||
| "technology": "postgresql-ng", | ||
| "plan": "postgresql-ng-starter-4096" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| --- row --- | ||
|
|
||
| ## List Your Databases | ||
|
|
||
| --- row --- | ||
|
|
||
| `GET https://$SCALINGO_API_URL/v1/databases` | ||
|
|
||
| List all your databases. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not list all the databases. Only the "ng" ones. Maybe, until we have more technology, we could have something like "list all databases of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree and set a reminder to raise a TASK ticket when we come to MySQL |
||
|
|
||
| ||| col ||| | ||
|
|
||
| Example | ||
|
|
||
| ```shell | ||
| curl -H "Accept: application/json" -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer $BEARER_TOKEN" \ | ||
| -X GET https://$SCALINGO_API_URL/v1/databases | ||
| ``` | ||
|
|
||
| Returns 200 OK | ||
|
|
||
| ```json | ||
| { | ||
| "databases": [ | ||
| { | ||
| "id": "54100930736f7563d5030000", | ||
| "name": "my-postgres-db", | ||
| "project_id": "pr-82a3cac5-9b25-473e-b33d-6272b87e636f", | ||
| "technology": "postgresql-ng", | ||
| "plan": "postgresql-ng-starter-4096" | ||
| }, | ||
| { | ||
| "id": "54100930736f7563d5030001", | ||
| "name": "backup-db", | ||
| "project_id": "pr-82a3cac5-9b25-473e-b33d-6272b87e636f", | ||
| "technology": "postgresql-ng", | ||
| "plan": "postgresql-ng-starter-4096" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| --- row --- | ||
|
|
||
| ## Get a Precise Database | ||
|
|
||
| --- row --- | ||
|
|
||
| `GET https://$SCALINGO_API_URL/v1/databases/[:database]` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Is it by name, id, both? |
||
|
|
||
| Display a precise database. | ||
|
|
||
| ||| col ||| | ||
|
|
||
| Example request | ||
|
|
||
| ```shell | ||
| curl -H "Accept: application/json" -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer $BEARER_TOKEN" \ | ||
| -X GET https://$SCALINGO_API_URL/v1/databases/my-postgres-db | ||
| ``` | ||
|
|
||
| Returns 200 OK | ||
|
|
||
| ```json | ||
| { | ||
| "database": { | ||
| "id": "54100930736f7563d5030000", | ||
| "name": "my-postgres-db", | ||
| "project_id": "pr-82a3cac5-9b25-473e-b33d-6272b87e636f", | ||
| "technology": "postgresql-ng", | ||
| "plan": "postgresql-ng-starter-4096" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Returns 404 Not Found if the database doesn't exist | ||
|
|
||
| ```json | ||
| { | ||
| "error": "Database not found" | ||
| } | ||
| ``` | ||
|
|
||
| --- row --- | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: shouldn't we mention a small text about the fact these are for dedicated resources?