From e589e29e32ee340bc4239742f4ac25d1b85e86fa Mon Sep 17 00:00:00 2001 From: Cameron Bates Date: Tue, 17 Dec 2024 14:55:52 -0800 Subject: [PATCH 1/6] stash commit --- .../rc/api/examples/create-database.md | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/content/operate/rc/api/examples/create-database.md b/content/operate/rc/api/examples/create-database.md index f0c82f28f..041037995 100644 --- a/content/operate/rc/api/examples/create-database.md +++ b/content/operate/rc/api/examples/create-database.md @@ -7,30 +7,28 @@ categories: - rc description: This article describes how to create and manage a database using `cURL` commands. -linkTitle: Create databases +linkTitle: Create and manage databases weight: 20 --- -You can use the Redis Cloud REST API to create databases. +You can use the Redis Cloud REST API to create and manage databases. -These examples use the [`cURL` utility]({{< relref "/operate/rc/api/get-started/use-rest-api#use-the-curl-http-client" >}}). You can use any REST client to work with the Redis Cloud REST API. The examples in this article refer to Redis Cloud Pro databases. +## Redis Cloud Essentials -## Create a database +## Redis Cloud Pro -To create a database, use `POST /subscriptions/{subscription-id}/databases` +### Create a Redis Cloud Pro database -The database is created in an existing or a newly created subscription. +To create a Redis Cloud Pro database, use `POST /subscriptions/{subscriptionId}/databases`. -When a subscription is created, it is created with at least one database. - -You can add databases to the subscription; you can also update or delete existing databases. +This call creates a database in the specified subscription. Use `GET /subscriptions` to get a list of subscriptions and their IDs. Creating a database is an [asynchronous operation]({{< relref "/operate/rc/api/get-started/process-lifecycle" >}}). The following API call creates a database. ```shell -POST "https://[host]/v1/subscriptions/$SUBSCRIPTION_ID/databases" +POST "https://[host]/v1/subscriptions/{subscriptionId}/databases" { "name": "Database-example-basic", "memoryLimitInGb": 10, @@ -38,12 +36,10 @@ POST "https://[host]/v1/subscriptions/$SUBSCRIPTION_ID/databases" } ``` -The JSON body contains only the most basic, required parameters in order to create a database: +The example JSON body contains only the most basic, required parameters in order to create a database: - Database name - A unique name per subscription that can contain only alphanumeric characters and hyphens - Maximum database size in GB - Database password -### Additional database parameters - There are many additional parameters and settings that can be defined on database creation. Review the database parameters and options in the [Full API documentation]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/createDatabase" >}}). \ No newline at end of file From 6447235ad4ef211eabae1a495dd8ec58fee4ffcc Mon Sep 17 00:00:00 2001 From: Cameron Bates Date: Tue, 17 Dec 2024 16:39:35 -0800 Subject: [PATCH 2/6] Remove update database and consolidate --- content/operate/rc/api/_index.md | 3 +- .../rc/api/examples/create-database.md | 29 ++++--- .../rc/api/examples/update-database.md | 86 ------------------- 3 files changed, 16 insertions(+), 102 deletions(-) delete mode 100644 content/operate/rc/api/examples/update-database.md diff --git a/content/operate/rc/api/_index.md b/content/operate/rc/api/_index.md index 0fd559870..5a0fa59e0 100644 --- a/content/operate/rc/api/_index.md +++ b/content/operate/rc/api/_index.md @@ -33,8 +33,7 @@ You can use the API to: 1. [Manage subscriptions]({{< relref "/operate/rc/api/examples/manage-subscriptions.md" >}}) 1. Database examples - - [Create database]({{< relref "/operate/rc/api/examples/create-database" >}}) - - [Update database]({{< relref "/operate/rc/api/examples/update-database.md" >}}) + - [Create and manage databases]({{< relref "/operate/rc/api/examples/create-database" >}}) - [Back up and import data]({{< relref "/operate/rc/api/examples/back-up-and-import-data.md" >}}) 1. [Manage cloud accounts]({{< relref "/operate/rc/api/examples/manage-cloud-accounts.md" >}}) 1. [Estimate costs]({{< relref "/operate/rc/api/examples/dryrun-cost-estimates.md" >}}) diff --git a/content/operate/rc/api/examples/create-database.md b/content/operate/rc/api/examples/create-database.md index 041037995..3c25009c9 100644 --- a/content/operate/rc/api/examples/create-database.md +++ b/content/operate/rc/api/examples/create-database.md @@ -5,8 +5,7 @@ categories: - docs - operate - rc -description: This article describes how to create and manage a database using `cURL` - commands. +description: This article describes how to create and manage a database using the Redis Cloud API. linkTitle: Create and manage databases weight: 20 --- @@ -15,6 +14,8 @@ You can use the Redis Cloud REST API to create and manage databases. ## Redis Cloud Essentials +To create a Redis Cloud Essentials database, use + ## Redis Cloud Pro ### Create a Redis Cloud Pro database @@ -23,23 +24,23 @@ To create a Redis Cloud Pro database, use `POST /subscriptions/{subscriptionId}/ This call creates a database in the specified subscription. Use `GET /subscriptions` to get a list of subscriptions and their IDs. -Creating a database is an [asynchronous operation]({{< relref "/operate/rc/api/get-started/process-lifecycle" >}}). - -The following API call creates a database. - ```shell POST "https://[host]/v1/subscriptions/{subscriptionId}/databases" { - "name": "Database-example-basic", - "memoryLimitInGb": 10, - "password": "P@ssw0rd" + "name": "Basic-database-example", + "datasetSizeInGb": 1 } ``` -The example JSON body contains only the most basic, required parameters in order to create a database: +This example JSON body contains only the most basic, required parameters in order to create a database: + +- `name`: The database name. A unique name per subscription that can contain only alphanumeric characters and hyphens +- `datasetSizeInGb`: Maximum dataset size in GB + +There are many additional parameters and settings that can be defined on database creation. Review the database parameters and options in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/createDatabase" >}}). + +### Update a Redis Cloud Pro database -- Database name - A unique name per subscription that can contain only alphanumeric characters and hyphens -- Maximum database size in GB -- Database password +To update a Redis Cloud Pro database, use `PUT /subscriptions/{subscriptionId}/databases/{databaseId}`. -There are many additional parameters and settings that can be defined on database creation. Review the database parameters and options in the [Full API documentation]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/createDatabase" >}}). \ No newline at end of file +The primary component of a database update request is the JSON request body that contains the details of the requested database changes. You can see the full set of changes you can make in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/updateDatabase" >}}). \ No newline at end of file diff --git a/content/operate/rc/api/examples/update-database.md b/content/operate/rc/api/examples/update-database.md deleted file mode 100644 index 7e5a2e796..000000000 --- a/content/operate/rc/api/examples/update-database.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -Title: Update databases -alwaysopen: false -categories: -- docs -- operate -- rc -description: How to construct requests that update an existing database. -weight: 30 ---- - -The API operation that updates an existing database is: `PUT /subscriptions/{subscription-id}/databases/{database-id}` - -This API operation uses the same [provisioning lifecycle]({{< relref "/operate/rc/api/get-started/process-lifecycle.md" >}}) as the [create database]({{< relref "/operate/rc/api/examples/create-database" >}}) operation. The examples in this article refer to Redis Cloud Pro databases. - -## Database update request JSON body - -The primary component of a database update request is the JSON request body that contains the details of the requested database changes. - -You can see [the complete set of JSON elements]({{< relref "/operate/rc/api/get-started/use-rest-api#inputs-for-operations-in-swagger" >}}) accepted by the database update API operation in the [Swagger UI](https://api.redislabs.com/v1/swagger-ui.html). -To see the JSON elements, expand the specific API operation and, in the request section, click **Model**. - -Here are several examples of JSON requests to update a database: - -### Add or remove Replica Of - -Setting one or more source Redis databases configures the updated database as a Replica Of destination database for the specified Redis databases. - -#### Add a source database - -The following JSON request specifies two source databases for the updated database: - -```json -{ - "replicaOf": [ - "redis://redis-12345.c9876.us-east-1-mz.ec2.cloud.rlrcp.com:12345" - , "redis://redis-54321.internal.c9876.us-east-1-mz.ec2.cloud.rlrcp.com:54321" - ] -} -``` - -- The `replicaOf` array contains one or more URIs with the format: `redis://user:password@host:port` -- If the URI provided belongs to the same account, you can provide just the host and port (example: `["redis://endpoint1:6379', "redis://endpoint2:6380"]`) - -{{< warning >}} -If a source database is already defined for a specific database, and the goal is to add an additional source database, the source databases URI for the existing source must be included in the database updates JSON request. -{{< /warning >}} - -#### Remove a source database - -To remove a source database from the `replicaOf` list, submit a JSON request that does not include the specific source database URI. - -##### Example: - -Given a database that has two defined source databases: - -```json -{ - "replicaOf": [ - "redis://redis-12345.c9876.us-east-1-mz.ec2.cloud.rlrcp.com:12345" - , "redis://redis-54321.internal.c9876.us-east-1-mz.ec2.cloud.rlrcp.com:54321" - ] -} -``` - -- You can use this JSON request to remove one of the two source databases: - -```json -{ - "replicaOf": [ - "redis://redis-12345.c9876.us-east-1-mz.ec2.cloud.rlrcp.com:12345" - ] -} -``` - -- You can use this JSON request to remove all source databases: - -```json -{ - "replicaOf": [] -} -``` - -#### Viewing database Replica Of information - -The API operation `GET /subscriptions/{subscription-id}/databases/{database-id}` returns information on a specific database, including the Replica Of endpoints defined for the specific database. From cc0ec732b01f922be27a6396aa6b50bef939a7a2 Mon Sep 17 00:00:00 2001 From: Cameron Bates Date: Tue, 17 Dec 2024 16:42:30 -0800 Subject: [PATCH 3/6] Finish Pro section --- content/operate/rc/api/examples/create-database.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/operate/rc/api/examples/create-database.md b/content/operate/rc/api/examples/create-database.md index 3c25009c9..b32c1cb70 100644 --- a/content/operate/rc/api/examples/create-database.md +++ b/content/operate/rc/api/examples/create-database.md @@ -39,8 +39,12 @@ This example JSON body contains only the most basic, required parameters in orde There are many additional parameters and settings that can be defined on database creation. Review the database parameters and options in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/createDatabase" >}}). +The response body contains the `taskId` for the task that creates the database. You can use [`GET /v1/tasks/{taskId}`]({{< relref "/operate/rc/api/api-reference#tag/Tasks/operation/getTaskById" >}}) to track the task's status. + ### Update a Redis Cloud Pro database To update a Redis Cloud Pro database, use `PUT /subscriptions/{subscriptionId}/databases/{databaseId}`. -The primary component of a database update request is the JSON request body that contains the details of the requested database changes. You can see the full set of changes you can make in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/updateDatabase" >}}). \ No newline at end of file +The primary component of a database update request is the JSON request body that contains the details of the requested database changes. You can see the full set of changes you can make in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/updateDatabase" >}}). + +The response body contains the `taskId` for the task that updates the database. You can use [`GET /v1/tasks/{taskId}`]({{< relref "/operate/rc/api/api-reference#tag/Tasks/operation/getTaskById" >}}) to track the task's status. \ No newline at end of file From 0965c7a4a140ac930d0f083789d29a6e23938381 Mon Sep 17 00:00:00 2001 From: Cameron Bates Date: Wed, 18 Dec 2024 10:49:10 -0800 Subject: [PATCH 4/6] add links part 1 --- .../rc/api/examples/create-database.md | 43 ++++++++++++++++--- .../rc/api/examples/manage-subscriptions.md | 2 +- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/content/operate/rc/api/examples/create-database.md b/content/operate/rc/api/examples/create-database.md index b32c1cb70..7c04345e8 100644 --- a/content/operate/rc/api/examples/create-database.md +++ b/content/operate/rc/api/examples/create-database.md @@ -14,15 +14,48 @@ You can use the Redis Cloud REST API to create and manage databases. ## Redis Cloud Essentials -To create a Redis Cloud Essentials database, use +### Create an Essentials database + +To create a Redis Cloud Essentials database, use [`POST /fixed/subscriptions/{subscriptionId}/databases`]({{< relref "/operate/rc/api/api-reference#tag/Databases-Essentials/operation/createFixedDatabase" >}}). + +This call creates a database in the specified subscription. Use [`GET /fixed/subscriptions`]({{< relref "/operate/rc/api/api-reference#tag/Subscriptions-Essentials/operation/getAllSubscriptions_1" >}}) to get a list of Essentials subscriptions and their IDs. + +```shell +POST "https://[host]/v1/fixed/subscriptions/{subscriptionId}/databases" +{ + "name": "Basic-essentials-database-example" +} +``` + +This example JSON body contains only the most basic, required parameters in order to create a database: + +- `name`: The database name. A unique name per subscription that can contain only alphanumeric characters and hyphens + +There are other additional parameters and settings that can be defined on database creation. Review the database parameters and options in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Essentials/operation/createFixedDatabase" >}}). + +Some options may not be compatible with your selected plan. Use [`GET /fixed/subscriptions/{subscriptionId}`]({{< relref "/operate/rc/api/api-reference#tag/Subscriptions-Essentials/operation/getFixedSubscriptionsPlansBySubscriptionId" >}}) to view the plan you have selected and what options it supports. + +The response body contains the `taskId` for the task that creates the database. You can use [`GET /v1/tasks/{taskId}`]({{< relref "/operate/rc/api/api-reference#tag/Tasks/operation/getTaskById" >}}) to track the task's status. + +### Update an Essentials database + +To update a Redis Cloud Essentials database, use [`PUT /fixed/subscriptions/{subscriptionId}/databases/{databaseId}`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}). + +The primary component of a database update request is the JSON request body that contains the details of the requested database changes. You can see the full set of changes you can make in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Essentials/operation/deleteFixedDatabaseByID" >}}). + +Some options may not be compatible with your selected plan. Use [`GET /fixed/subscriptions/{subscriptionId}`]({{< relref "/operate/rc/api/api-reference#tag/Subscriptions-Essentials/operation/getFixedSubscriptionsPlansBySubscriptionId" >}}) to view the plan you have selected and what options it supports. + +The response body contains the `taskId` for the task that updates the database. You can use [`GET /v1/tasks/{taskId}`]({{< relref "/operate/rc/api/api-reference#tag/Tasks/operation/getTaskById" >}}) to track the task's status. ## Redis Cloud Pro -### Create a Redis Cloud Pro database +### Create a Pro database + +If you want to create a Pro database in a new subscription, see [Create a Pro subscription]({{< relref "/operate/rc/api/examples/manage-subscriptions#create-a-pro-subscription" >}}). -To create a Redis Cloud Pro database, use `POST /subscriptions/{subscriptionId}/databases`. +To create a Redis Cloud Pro database in an existing subscription, use [`POST /subscriptions/{subscriptionId}/databases`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}). -This call creates a database in the specified subscription. Use `GET /subscriptions` to get a list of subscriptions and their IDs. +This call creates a database in the specified subscription. Use [`GET /subscriptions`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}) to get a list of subscriptions and their IDs. ```shell POST "https://[host]/v1/subscriptions/{subscriptionId}/databases" @@ -43,7 +76,7 @@ The response body contains the `taskId` for the task that creates the database. ### Update a Redis Cloud Pro database -To update a Redis Cloud Pro database, use `PUT /subscriptions/{subscriptionId}/databases/{databaseId}`. +To update a Redis Cloud Pro database, use [`PUT /subscriptions/{subscriptionId}/databases/{databaseId}`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}). The primary component of a database update request is the JSON request body that contains the details of the requested database changes. You can see the full set of changes you can make in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/updateDatabase" >}}). diff --git a/content/operate/rc/api/examples/manage-subscriptions.md b/content/operate/rc/api/examples/manage-subscriptions.md index f470fc738..662c2da07 100644 --- a/content/operate/rc/api/examples/manage-subscriptions.md +++ b/content/operate/rc/api/examples/manage-subscriptions.md @@ -38,7 +38,7 @@ Modify the following parameters in the sample JSON document to create a subscrip Use [`GET /v1/fixed/plans`]({{< relref "/operate/rc/api/api-reference#tag/Subscriptions-Essentials/operation/getAllFixedSubscriptionsPlans" >}}) to get a list of plan IDs. -After you create an Essentials subscription, you must use the [`POST /v1/fixed/subscriptions/{subscriptionId}/databases`]({{< relref "/operate/rc/api/api-reference#tag/Databases-Essentials/operation/createFixedDatabase" >}}) endpoint to create the database. +After you create an Essentials subscription, you must use the [`POST /v1/fixed/subscriptions/{subscriptionId}/databases`]({{< relref "/operate/rc/api/api-reference#tag/Databases-Essentials/operation/createFixedDatabase" >}}) endpoint to [create the database]({{< relref "/operate/rc/api/examples/create-database#redis-cloud-essentials" >}}). You can include the contents of the JSON document in the `POST /v1/fixed/subscriptions` operation in the [Swagger UI](https://api.redislabs.com/v1/swagger-ui.html). See [Swagger user interface]({{< relref "/operate/rc/api/get-started/use-rest-api#swagger-user-interface" >}}) for more details. From 1866a888015bb6b1b0f6d95730815234ebc9ba49 Mon Sep 17 00:00:00 2001 From: Cameron Bates Date: Wed, 18 Dec 2024 14:55:48 -0800 Subject: [PATCH 5/6] Finish links --- content/operate/rc/api/examples/create-database.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/operate/rc/api/examples/create-database.md b/content/operate/rc/api/examples/create-database.md index 7c04345e8..e09fef57e 100644 --- a/content/operate/rc/api/examples/create-database.md +++ b/content/operate/rc/api/examples/create-database.md @@ -39,7 +39,7 @@ The response body contains the `taskId` for the task that creates the database. ### Update an Essentials database -To update a Redis Cloud Essentials database, use [`PUT /fixed/subscriptions/{subscriptionId}/databases/{databaseId}`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}). +To update a Redis Cloud Essentials database, use [`PUT /fixed/subscriptions/{subscriptionId}/databases/{databaseId}`]({{< relref "/operate/rc/api/api-reference#tag/Databases-Essentials/operation/deleteFixedDatabaseByID" >}}). The primary component of a database update request is the JSON request body that contains the details of the requested database changes. You can see the full set of changes you can make in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Essentials/operation/deleteFixedDatabaseByID" >}}). @@ -53,9 +53,9 @@ The response body contains the `taskId` for the task that updates the database. If you want to create a Pro database in a new subscription, see [Create a Pro subscription]({{< relref "/operate/rc/api/examples/manage-subscriptions#create-a-pro-subscription" >}}). -To create a Redis Cloud Pro database in an existing subscription, use [`POST /subscriptions/{subscriptionId}/databases`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}). +To create a Redis Cloud Pro database in an existing subscription, use [`POST /subscriptions/{subscriptionId}/databases`]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/createDatabase" >}}). -This call creates a database in the specified subscription. Use [`GET /subscriptions`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}) to get a list of subscriptions and their IDs. +This call creates a database in the specified subscription. Use [`GET /subscriptions`]({{< relref "/operate/rc/api/api-reference#tag/Subscriptions-Pro/operation/getAllSubscriptions" >}}) to get a list of subscriptions and their IDs. ```shell POST "https://[host]/v1/subscriptions/{subscriptionId}/databases" @@ -76,7 +76,7 @@ The response body contains the `taskId` for the task that creates the database. ### Update a Redis Cloud Pro database -To update a Redis Cloud Pro database, use [`PUT /subscriptions/{subscriptionId}/databases/{databaseId}`]({{< relref "/operate/rc/api/api-reference#ADD-TAG" >}}). +To update a Redis Cloud Pro database, use [`PUT /subscriptions/{subscriptionId}/databases/{databaseId}`]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/updateDatabase" >}}). The primary component of a database update request is the JSON request body that contains the details of the requested database changes. You can see the full set of changes you can make in the [full API reference]({{< relref "/operate/rc/api/api-reference#tag/Databases-Pro/operation/updateDatabase" >}}). From 8a368ca202227f6d64c46b650d309516427f0872 Mon Sep 17 00:00:00 2001 From: Cameron Bates <102550101+cmilesb@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:33:04 -0800 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: David Dougherty --- content/operate/rc/api/examples/create-database.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/operate/rc/api/examples/create-database.md b/content/operate/rc/api/examples/create-database.md index e09fef57e..afb011f46 100644 --- a/content/operate/rc/api/examples/create-database.md +++ b/content/operate/rc/api/examples/create-database.md @@ -27,7 +27,7 @@ POST "https://[host]/v1/fixed/subscriptions/{subscriptionId}/databases" } ``` -This example JSON body contains only the most basic, required parameters in order to create a database: +This example JSON body contains only the most basic, required parameters to create a database: - `name`: The database name. A unique name per subscription that can contain only alphanumeric characters and hyphens @@ -65,7 +65,7 @@ POST "https://[host]/v1/subscriptions/{subscriptionId}/databases" } ``` -This example JSON body contains only the most basic, required parameters in order to create a database: +This example JSON body contains only the most basic, required parameters to create a database: - `name`: The database name. A unique name per subscription that can contain only alphanumeric characters and hyphens - `datasetSizeInGb`: Maximum dataset size in GB