Skip to content
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

Use Cloud API for RBAC #211

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ EOF
. Use the Cloud API to create the network and retrieve the network ID:
+
```bash
export REDPANDA_NETWORK_ID=$(curl -X POST "https://api.redpanda.com/v1beta2/networks" \
export REDPANDA_NETWORK_ID=$(curl -X POST "https://api.redpanda.com/v1/networks" \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
Expand All @@ -170,7 +170,7 @@ The Create Network request returns a `resource_id`. For example:
"operation":{
"id":"cpas8k6r4up5li18auh0",
"metadata":{
"@type":"type.googleapis.com/redpanda.api.controlplane.v1beta2.CreateNetworkMetadata",
"@type":"type.googleapis.com/redpanda.api.controlplane.v1.CreateNetworkMetadata",
"network_id":"cpb338gekjj5i1cpj3t0"
},
"state":"STATE_IN_PROGRESS",
Expand Down Expand Up @@ -261,7 +261,7 @@ EOF
. Use the Cloud API to deploy the cluster and retrieve its ID:
+
```bash
export REDPANDA_ID=$(curl -X POST "https://api.redpanda.com/v1beta2/clusters" \
export REDPANDA_ID=$(curl -X POST "https://api.redpanda.com/v1/clusters" \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
Expand All @@ -276,7 +276,7 @@ The create cluster request returns a `resource_id`, which is required in the nex
"operation":{
"id":"cpas8k6r4up5li18auhg",
"metadata":{
"@type":"type.googleapis.com/redpanda.api.controlplane.v1beta2.CreateClusterMetadata",
"@type":"type.googleapis.com/redpanda.api.controlplane.v1.CreateClusterMetadata",
"cluster_id":"cpb33c8ekjj5i1cpj3v0"
},
"state":"STATE_IN_PROGRESS",
Expand Down Expand Up @@ -356,7 +356,7 @@ Cluster creation is an example of an operation that can take a longer period of
Example using the operation ID returned from your create cluster command:

```bash
curl -X GET "https://api.redpanda.com/v1beta2/operations/${REDPANDA_ID}" \
curl -X GET "https://api.redpanda.com/v1/operations/${REDPANDA_ID}" \
-H "accept: application/json"\
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}"
Expand All @@ -365,7 +365,7 @@ curl -X GET "https://api.redpanda.com/v1beta2/operations/${REDPANDA_ID}" \
Example retrieving cluster:

```bash
curl -X GET "https://api.redpanda.com/v1beta2/clusters/${REDPANDA_ID}" \
curl -X GET "https://api.redpanda.com/v1/clusters/${REDPANDA_ID}" \
-H "accept: application/json"\
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}"
Expand All @@ -376,7 +376,7 @@ curl -X GET "https://api.redpanda.com/v1beta2/clusters/${REDPANDA_ID}" \
To delete the cluster, first send a DELETE request to the Cloud API, and retrieve the `resource_id` of the DELETE operation. Then run the `rpk` command to destroy the cluster identified by the `resource_id`.

```bash
export REDPANDA_ID=$(curl -X DELETE "https://api.redpanda.com/v1beta2/clusters/${REDPANDA_ID}" \
export REDPANDA_ID=$(curl -X DELETE "https://api.redpanda.com/v1/clusters/${REDPANDA_ID}" \
-H "accept: application/json"\
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}" | jq -r '.operation.resource_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ To enable xref:develop:managed-connectors/index.adoc[Kafka Connect] for clusters

. Authenticate to the Redpanda Cloud API. Follow the steps in xref:manage:api/cloud-api-authentication.adoc[].

. Enable Kafka Connect by making a xref:api:ROOT:cloud-controlplane-api.adoc#patch-/v1beta2/clusters/-cluster.id-[`PATCH /v1beta2/clusters`] request:
. Enable Kafka Connect by making a xref:api:ROOT:cloud-controlplane-api.adoc#patch-/v1/clusters/-cluster.id-[`PATCH /v1/clusters`] request:
+
[,bash]
----
curl -X PATCH "https://api.redpanda.com/v1beta2/clusters/<cluster-id>" \
curl -X PATCH "https://api.redpanda.com/v1/clusters/<cluster-id>" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ EOF
. Use the Cloud API to create the network and retrieve the network ID:
+
```bash
export REDPANDA_NETWORK_ID=$(curl -X POST "https://api.redpanda.com/v1beta2/networks" \
export REDPANDA_NETWORK_ID=$(curl -X POST "https://api.redpanda.com/v1/networks" \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
Expand Down Expand Up @@ -396,7 +396,7 @@ TIP: See the full list of zones and tiers available with each provider in the xr
. Make a Cloud API call to create a Redpanda network and get the network ID from the response in JSON `.operation.metadata.network_id`.
+
```bash
export REDPANDA_ID=$(curl -X POST "https://api.redpanda.com/v1beta2/clusters" \
export REDPANDA_ID=$(curl -X POST "https://api.redpanda.com/v1/clusters" \
-H "accept: application/json"\
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
Expand Down Expand Up @@ -428,7 +428,7 @@ Cluster creation is an example of an operation that can take a longer period of
Example using the returned `operation_id`:

```bash
curl -X GET "https://api.redpanda.com/v1beta2/operations/<operation_id of operation from previous step>" \
curl -X GET "https://api.redpanda.com/v1/operations/<operation-id>" \
-H "accept: application/json"\
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}"
Expand All @@ -437,7 +437,7 @@ curl -X GET "https://api.redpanda.com/v1beta2/operations/<operation_id of operat
Example retrieving cluster:

```bash
curl -X GET "https://api.redpanda.com/v1beta2/clusters/<resource_id of cluster from previous step>" \
curl -X GET "https://api.redpanda.com/v1/clusters/<resource-id>" \
-H "accept: application/json"\
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}"
Expand All @@ -448,7 +448,7 @@ curl -X GET "https://api.redpanda.com/v1beta2/clusters/<resource_id of cluster f
To delete the cluster, first send a DELETE request to the Cloud API, and retrieve the `resource_id` of the DELETE operation. Then run the `rpk` command to destroy the cluster identified by the `resource_id`.

```bash
export REDPANDA_ID=$(curl -X DELETE "https://api.redpanda.com/v1beta2/clusters/${REDPANDA_ID}" \
export REDPANDA_ID=$(curl -X DELETE "https://api.redpanda.com/v1/clusters/${REDPANDA_ID}" \
-H "accept: application/json"\
-H "content-type: application/json" \
-H "authorization: Bearer ${BEARER_TOKEN}" | jq -r '.operation.resource_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ This should be done in the Terraform of the reader cluster.

Add or remove reader clusters to a source cluster in Redpanda Cloud with the xref:redpanda-cloud:manage:api/controlplane/index.adoc[Cloud Control Plane API]. For information on accessing the Cloud API, see xref:manage:api/cloud-api-authentication.adoc[].

. To update your source cluster to add one or more reader cluster IDs, make a xref:api:ROOT:cloud-controlplane-api.adoc#patch-/v1beta2/clusters/-cluster.id-[`PATCH /v1beta2/clusters/{cluster.id}`] request. The full list of clusters is expected on every call. If an ID is removed from the list, it is removed as a reader cluster.
. To update your source cluster to add one or more reader cluster IDs, make a xref:api:ROOT:cloud-controlplane-api.adoc#patch-/v1/clusters/-cluster.id-[`PATCH /v1/clusters/{cluster.id}`] request. The full list of clusters is expected on every call. If an ID is removed from the list, it is removed as a reader cluster.
+
```bash
export SOURCE_CLUSTER_ID=.......
export READER_CLUSTER_ID=.......

curl -X PATCH $API_HOST/v1beta2/clusters/$SOURCE_CLUSTER_ID \
curl -X PATCH $API_HOST/v1/clusters/$SOURCE_CLUSTER_ID \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d @- << EOF
Expand All @@ -69,12 +69,12 @@ curl -X PATCH $API_HOST/v1beta2/clusters/$SOURCE_CLUSTER_ID \
EOF
```

. Optional: To see the list of reader clusters on a given source cluster, make a xref:api:ROOT:cloud-controlplane-api.adoc#get-/v1beta2/clusters/-id-[`GET /v1beta2/clusters/\{id}`] request:
. Optional: To see the list of reader clusters on a given source cluster, make a xref:api:ROOT:cloud-controlplane-api.adoc#get-/v1/clusters/-id-[`GET /v1/clusters/\{id}`] request:
+
```bash
export SOURCE_CLUSTER_ID=.......

curl -X GET $API_HOST/v1beta2/clusters/$SOURCE_CLUSTER_ID \
curl -X GET $API_HOST/v1/clusters/$SOURCE_CLUSTER_ID \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN"
```
Expand Down
1 change: 0 additions & 1 deletion modules/manage/pages/api/cloud-api-authentication.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
:page-aliases: deploy:deployment-option/cloud/api/cloud-api-authentication.adoc
:page-api: cloud
:page-api-slot: auth
:page-beta: true

The Cloud API uses the Client Credentials Flow as defined in https://datatracker.ietf.org/doc/html/rfc6749#section-4.4O[Auth 2.0 RFC 6749, section 4.4^]. In Redpanda Cloud, you must first create a *service account* through which you can authenticate requests to the Cloud API. The service account is associated with your Redpanda Cloud organization. The service account acts as an OAuth 2.0 client that provides its credentials (client ID and client secret) to the API authentication server. The authentication server grants an access token in return. You can then include the access token in each request to the API.

Expand Down
3 changes: 1 addition & 2 deletions modules/manage/pages/api/cloud-api-errors.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
:description: Error and status codes you might encounter when using the Cloud API.
:page-aliases: deploy:deployment-option/cloud/api/cloud-api-errors.adoc
:page-api: cloud
:page-beta: true

The Redpanda Cloud API uses HTTP codes to indicate the status of a request. The response payload also includes <<error-codes-and-details,additional error codes and descriptions>> that provide more detail about why an operation failed.

Example request:

```
curl https://api.redpanda.com/clusters/v1beta2 | jq
curl https://api.redpanda.com/v1/clusters | jq
```

Example response:
Expand Down
5 changes: 2 additions & 3 deletions modules/manage/pages/api/cloud-api-overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
:page-aliases: deploy:deployment-option/cloud/api/cloud-api-overview.adoc
:page-api: cloud
:page-api-slot: overview
:page-beta: true

The Redpanda Cloud API is a collection of REST APIs that allow you to interact with different parts of Redpanda Cloud. You can call the API endpoints directly, or use tools like Terraform or Python scripts to automate cluster management and manage Redpanda Cloud resources.

Expand Down Expand Up @@ -45,10 +44,10 @@ When making requests to the Control Plane API endpoints, the request URL is the

[,bash]
----
https://api.redpanda.com/v1beta2/clusters
https://api.redpanda.com/v1/clusters
----

The current Control Plane API version is *v1beta2*.
The current Control Plane API version is *v1*.

=== Data Plane APIs URL

Expand Down
19 changes: 9 additions & 10 deletions modules/manage/pages/api/cloud-api-quickstart.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
:description: Learn how to quickly start using the Cloud API to manage clusters and other resources.
:page-aliases: deploy:deployment-option/cloud/api/cloud-api-quickstart.adoc
:page-api: cloud
:page-beta: true

The following steps describe how to authenticate with the Cloud API and create a new Redpanda cluster. For more information on the Cloud API, see the xref:manage:api/cloud-api-overview.adoc[Redpanda Cloud API Overview].

Expand All @@ -14,9 +13,9 @@ BYOC or Dedicated::
+
--
. In the Redpanda Cloud UI, create a https://cloud.redpanda.com/organization-iam?tab=service-accounts[service account (client)] and use the client ID and secret to request an API token. Use the token to xref:manage:api/cloud-api-authentication.adoc[authenticate to the API].
. Create a resource group by making a xref:api:ROOT:cloud-controlplane-api.adoc#post-/v1beta2/resource-groups[`POST /v1beta2/resource-groups`] request.
. Create a network by making a xref:api:ROOT:cloud-controlplane-api.adoc#post-/v1beta2/networks[`POST /v1beta2/networks`] request. Note that this operation may be long-running.
. Create a cluster by making a xref:api:ROOT:cloud-controlplane-api.adoc#post-/v1beta2/clusters[`POST /v1beta2/clusters`] request.
. Create a resource group by making a xref:api:ROOT:cloud-controlplane-api.adoc#post-/v1/resource-groups[`POST /v1/resource-groups`] request.
. Create a network by making a xref:api:ROOT:cloud-controlplane-api.adoc#post-/v1/networks[`POST /v1/networks`] request. Note that this operation may be long-running.
. Create a cluster by making a xref:api:ROOT:cloud-controlplane-api.adoc#post-/v1/clusters[`POST /v1/clusters`] request.
. For BYOC, run `rpk cloud byoc`, passing the `metadata.cluster_id` from the Create Cluster response as a flag:
+
AWS:
Expand All @@ -42,19 +41,19 @@ Serverless::
+
--
. In the Redpanda Cloud UI, create a https://cloud.redpanda.com/organization-iam?tab=service-accounts[service account (client)] and use the client ID and secret to request an API token. Use the token to xref:manage:api/cloud-api-authentication.adoc[authenticate to the API].
. Make a GET request to the `/v1beta2/resource-groups` endpoint to retrieve the default resource group ID.
. Make a GET request to the `/v1/resource-groups` endpoint to retrieve the default resource group ID.
+
[,bash]
----
curl -H "Authorization: Bearer <token>" https://api.redpanda.com/v1beta2/resource-groups
curl -H "Authorization: Bearer <token>" https://api.redpanda.com/v1/resource-groups
----
. Make a GET request to the `/v1beta2/serverless/regions` endpoint to see available regions.
. Make a GET request to the `/v1/serverless/regions` endpoint to see available regions.
+
[,bash]
----
curl -H "Authorization: Bearer <token>" 'https://api.redpanda.com/v1beta2/serverless/regions?cloud_provider=CLOUD_PROVIDER_AWS'
curl -H "Authorization: Bearer <token>" 'https://api.redpanda.com/v1/serverless/regions?cloud_provider=CLOUD_PROVIDER_AWS'
----
. Create a cluster by making a POST request to the `/v1beta2/serverless/clusters` endpoint.
. Create a cluster by making a POST request to the `/v1/serverless/clusters` endpoint.
+
[,bash]
----
Expand All @@ -64,7 +63,7 @@ curl -H 'Content-Type: application/json' \
"name": <serverless-cluster-name>,
"resource_group_id": <resource-group-id>,
"serverless_region": "pro-us-east-1"
}' -X POST https://api.redpanda.com/v1beta2/serverless/clusters
}' -X POST https://api.redpanda.com/v1/serverless/clusters
----
--
======
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
:description: Use the Control Plane API to manage resources in your Redpanda Cloud BYOC environment.
:page-aliases: deploy:deployment-option/cloud/api/cloud-controlplane-api.adoc
:page-context-links: [{"name": "BYOC", "to": "manage:api/cloud-byoc-controlplane-api.adoc" },{"name": "Dedicated", "to": "manage:api/cloud-dedicated-controlplane-api.adoc" },{"name": "Serverless", "to": "manage:api/cloud-serverless-controlplane-api.adoc" } ]
:page-beta: true
:env-byoc: true

include::manage:partial$controlplane-api.adoc[]
5 changes: 2 additions & 3 deletions modules/manage/pages/api/cloud-dataplane-api.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
= Use the Data Plane APIs
:description: Use the Data Plane APIs to manage your Redpanda Cloud clusters.
:page-aliases: deploy:deployment-option/cloud/api/cloud-dataplane-api.adoc
:page-beta: true

The Redpanda Cloud API is a collection of REST APIs that allow you to interact with different parts of Redpanda Cloud. The Data Plane APIs enable you to programmatically manage the resources within your clusters, including topics, users, access control lists (ACLs), and connectors. You can call the API endpoints directly, or use tools like Terraform or Python scripts to automate resource management.

Expand All @@ -16,13 +15,13 @@ The xref:manage:api/cloud-api-overview.adoc#cloud-api-architecture[data plane] c
BYOC or Dedicated::
+
--
To retrieve the Data Plane API URL of a cluster, make a request to xref:api:ROOT:cloud-controlplane-api.adoc#get-/v1beta2/clusters/-id-[`GET /v1beta2/clusters/\{id}`].
To retrieve the Data Plane API URL of a cluster, make a request to xref:api:ROOT:cloud-controlplane-api.adoc#get-/v1/clusters/-id-[`GET /v1/clusters/\{id}`].
--

Serverless::
+
--
To retrieve the Data Plane API URL of a cluster, make a request to xref:api:ROOT:cloud-controlplane-api.adoc#get-/v1beta2/serverless/clusters/-id-[`GET /v1beta2/serverless/clusters/\{id}`].
To retrieve the Data Plane API URL of a cluster, make a request to xref:api:ROOT:cloud-controlplane-api.adoc#get-/v1/serverless/clusters/-id-[`GET /v1/serverless/clusters/\{id}`].
--
======

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
= Use the Control Plane API with Dedicated Cloud
:description: Use the Control Plane API to manage resources in your Redpanda Cloud Dedicated environment.
:page-context-links: [{"name": "BYOC", "to": "manage:api/cloud-byoc-controlplane-api.adoc" },{"name": "Dedicated", "to": "manage:api/cloud-dedicated-controlplane-api.adoc" },{"name": "Serverless", "to": "manage:api/cloud-serverless-controlplane-api.adoc" } ]
:page-beta: true
:page-aliases: deploy:deployment-option/cloud/api/cloud-dedicated-controlplane-api.adoc
:env-dedicated: true

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
= Use the Control Plane API with Serverless
:description: Use the Control Plane API to manage resources in your Redpanda Serverless environment.
:page-context-links: [{"name": "BYOC", "to": "manage:api/cloud-byoc-controlplane-api.adoc" },{"name": "Dedicated", "to": "manage:api/cloud-dedicated-controlplane-api.adoc" },{"name": "Serverless", "to": "manage:api/cloud-serverless-controlplane-api.adoc" } ]
:page-beta: true
:env-serverless: true
:page-aliases: deploy:deployment-option/cloud/api/cloud-serverless-controlplane-api.adoc

Expand Down
1 change: 0 additions & 1 deletion modules/manage/pages/api/controlplane/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
:description: Use the Control Plane API to manage resources in your Redpanda Cloud organization.
:page-layout: index
:page-aliases: deploy:deployment-option/cloud/api/controlplane/index.adoc
:page-beta: true
Loading