Using the DevOps v2 API

How to use the DevOps API to do:

You need to set the bearer token with the Astra token from the Astra control panel, under Security setting, before running any commands:

export BEARER_TOKEN=<replace-me>

Note that the Create DB permission is required when the Astra token is generated, or permission is defined.

Get Pulsar clusters

To get all the Pulsar clusters that currently exist, execute the command:

  • cURL command

  • Result

curl --location --request GET 'https://api.astra.datastax.com/v2/streaming/clusters' \
--header "Authorization: Bearer $BEARER_TOKEN"
[
    {
        "clusterName": "astradev-aws",
        "cloudProvider": "aws",
        "cloudRegion": "useast2",
        "clusterType": "cloud",
        "webServiceUrl": "https://pulsar-aws-useast2.astra.datastax.com:8443",
        "brokerServiceUrl": "pulsar+ssl://pulsar-aws-useast2.astra.datastax.com:6651",
        "websocketUrl": "wss://pulsar-aws-useast2.astra.datastax.com:8001/ws/v2"
    },
    {
        "clusterName": "pulsar-azure-us-west-2",
        "cloudProvider": "azure",
        "cloudRegion": "uswest2",
        "clusterType": "cloud",
        "webServiceUrl": "https://pulsar-azure-us-west-2.astra.datastax.com:8443",
        "brokerServiceUrl": "pulsar+ssl://pulsar-azure-us-west-2.astra.datastax.com:6651",
        "websocketUrl": "wss://pulsar-azure-us-west-2.astra.datastax.com:8001/ws/v2"
    },
    {
        "clusterName": "pulsar-gke-useast4",
        "cloudProvider": "gcp",
        "cloudRegion": "useast4",
        "clusterType": "cloud",
        "webServiceUrl": "https://pulsar-gke-useast4.astra.datastax.com:8443",
        "brokerServiceUrl": "pulsar+ssl://pulsar-gke-useast4.astra.datastax.com:6651",
        "websocketUrl": "wss://pulsar-gke-useast4.astra.datastax.com:8001/ws/v2"
    }
]

Get Astra Streaming providers

To get all the providers that currently exist, execute the command:

  • cURL command

  • Result

curl --location --request GET 'https://api.astra.datastax.com/v2/streaming/providers' \
--header "Authorization: Bearer $BEARER_TOKEN"
{"aws":["useast2"],"azure":["uswest2"],"gcp":["useast4"]}

Check tenant existence

To check that a tenant currently exists, execute the command:

  • cURL command

  • Result

curl --location --head 'https://api.astra.datastax.com/v2/streaming/tenants/test-llp' \
--header "Authorization: Bearer $BEARER_TOKEN"
200 OK if it exists
404 Not Found if not exists

Get all tenants

To get a list of all the tenants that currently exist, execute the command:

  • cURL command

  • Result

curl --location --request GET 'https://api.astra.datastax.com/v2/streaming/tenants' \
--header "Authorization: Bearer $BEARER_TOKEN"
result:
[
  {
    "tenantName":"test-mine",
    "clusterName":"astradev-aws",
    "webServiceUrl":"https://pulsar-aws-useast2.api.astra.datastax.com",
    "brokerServiceUrl":"pulsar+ssl://pulsar-aws-useast2.astra.datastax.com:6651",
    "websocketUrl":"wss://pulsar-aws-useast2.astra.datastax.com:8001/ws/v2",
    "websocketQueryParamUrl":"wss://pulsar-aws-useast2.astra.datastax.com:8964/ws/v2",
    "pulsarToken":"eyJhbGciOiJSUzI1NiIsInR5xxxxxxkpXVCJ9.eyJzdWIiOiJjbGllbnQ7YjgzMTY2NzQtNmExMi00MDE0LWE1NmUtZjQ2OWU5MmRlNGFkOzE2MjMwOTI4OTAifQ.U6a7q0GujzjREa6fYxYjrccwrLnnXmoUdy32rdohEwMKvoBw-KvwNG-Ko2nNSCq7LgR71Zx9SzExsorO2KBIM9j1v_Lr_meBa9hRy8YU10Bsr4e5-Re6_yYLz9Ww2JxnptYqRLBOUgCUG03kzmmsiWvyaVjGGi3oD5AXQMbP_liYnfFbSxZM8ULjy0opkko-61d3MjGfj0BYSy9wIQ_qbYKFr-EhIXrUUXF_9KK4YRo8DSfnrJ3ZJ-50ePfVb-wcN1sOFFUJ7-6UzZa4p0TcbUHupFZzANJxxUPbssGAO0yO-qOu8Ka4COJJ9o58eCVQt3bjY7xuJgSYAiQ7lJfBow",
    "plan":"free",
    "planCode":"1",
    "astraOrgGUID":"b8316674-6a12-5014-a56e-f469e92de4ad",
    "cloudProvider":"aws",
    "cloudProviderCode":"1",
    "cloudRegion":"useast2",
    "status":"active",
    "jvmVersion":"JDK11",
    "pulsarVersion":"2.7.2"
  },
  {
    "tenantName":"tester",
    "clusterName":"astradev-aws",
    "webServiceUrl":"https://pulsar-aws-useast2.api.astra.datastax.com",
    "brokerServiceUrl":"pulsar+ssl://pulsar-aws-useast2.astra.datastax.com:6651",
    "websocketUrl":"wss://pulsar-aws-useast2.astra.datastax.com:8001/ws/v2",
    "websocketQueryParamUrl":"wss://pulsar-aws-useast2.astra.datastax.com:8964/ws/v2",
    "pulsarToken":"eyJhbGciOiJSUzI1xxxxxxR5cCI6IkpXVCJ9.eyJzdWIiOiJjbGllbnQ7YjgzMTY2NzQtNmExMi00MDE0LWE1NmUtZjQ2OWU5MmRlNGFkOzE2MjMxMDU1ODAifQ.BNLpkqSd5RojvnUxqX9vFqb7y0I8UHHteLZ13i_GdXDEHG_bkQSU06hR73XBErciFAPG1xTPyiixfeFTk-1_VGYkQuv9MNd1kOjZ4n-plUJo8oPnHAnWEowiq2Czq5BDpskcPfYQ0azrF7n3DivVtfe72UWyrIKfX8ZwdrjycXz78QaFUt6tWYHIvdr4lq5KX3IMT9t8zP2GxxFfgKoNAFcUJO4wCdGH63qXzOebEdXenmmshg5g49uD2OI4vwPB8DFtyNNXKUPTFF9FVdvBq1sjJOlmeug1MGt1Y-NNkryMKZCs2u8OwuMqercGLCUDfP3WmF5x99zYcQ60Wad7XA",
    "plan":"free",
    "planCode":"1",
    "astraOrgGUID":"b8316674-6a12-5014-a56e-f469e92de4ad",
    "cloudProvider":"aws",
    "cloudProviderCode":"1",
    "cloudRegion":"useast2",
    "status":"active",
    "jvmVersion":"JDK11",
    "pulsarVersion":"2.7.2"
  }
]

Create a tenant

To create a new tenant, execute the command:

  • cURL command

  • Result

curl --location --request POST 'https://api.astra.datastax.com/v2/streaming/tenants?topic=blah' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $BEARER_TOKEN" \
--data-raw '{
    "cloudProvider": "aws",
    "cloudRegion": "useast2",
    "tenantName": "testcreate",
    "userEmail": "joshua@example.com"
}'
{
    "namespace": "default",
    "topic": "",
    "tenantName": "testcreate",
    "clusterName": "astradev-aws",
    "webServiceUrl": "https://pulsar-aws-useast2.api.astra.datastax.com",
    "brokerServiceUrl": "pulsar+ssl://pulsar-aws-useast2.astra.datastax.com:6651",
    "websocketUrl": "wss://pulsar-aws-useast2.astra.datastax.com:8001/ws/v2",
    "websocketQueryParamUrl": "wss://pulsar-aws-useast2.astra.datastax.com:8964/ws/v2",
    "pulsarToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjbGllbnQ7YjgzMTY2NzQtNmExMi00MDE0LWE1NmUtZjQ2OWU5MmRlNGFkO2RHVnpkR055WldGMFpRPT0ifQ.GpuQHK0KNUDmWxhHkZMRLgyGtw5bNp6WNjxPic0nfg3ps3-Ayq5VjLUKGLReHQ5KtOtaPfVsUh2oEagKi06uLVzcX8t4fXBooy88a1Q5muNicF-pWPUBzMeYzU9OAb3Mh9LOXcl8jsQb5Mhkz5crkWG0AO_7Cee1G2hsAwSTLquGd6M7LvVroE4wR9xwtvXrszm1m01g22WDbcpxJ9QV9hwjzE1XeJ8aLV-kzYuZRWryb5qSF5OdXBNeDBBRKw3nijWXEzvyfF8OebO_SfXYT72Wsy6kxyYKQAKbZQNJUFa1N0RZIZaztEvuSNEh2E1L9wWOaMwzpybmyAHNfzZAoA",
    "plan": "payg",
    "planCode": "",
    "astraOrgGUID": "b8316674-6a12-4014-a56e-f469e92de4ad",
    "cloudProvider": "aws",
    "cloudProviderCode": "",
    "cloudRegion": "useast2",
    "status": "active",
    "jvmVersion": "JDK11",
    "pulsarVersion": "2.7.2"
}

Get tenant limits

To get a tenant’s limits and topics, execute the command:

  • cURL command

  • Result

curl --location --request GET 'https://api.astra.datastax.com/v2/streaming/tenants/llp-test/limits' \
--header 'X-DataStax-Pulsar-Cluster: astradev-aws' \
--header "Authorization: Bearer $BEARER_TOKEN"
{"namespace_limit":2,"topic_per_namespace_limit":5,"usage":[{"namespace":"tester/default","topics":["persistent://tester/default/example-topic"]}]}

Delete a tenant

To delete an existing tenant, execute the command:

  • cURL command

  • Result

curl --location --request DELETE 'https://api.astra.datastax.com/v2/streaming/tenants/testcreate/clusters/astradev-aws' \
--header "Authorization: Bearer $BEARER_TOKEN"
202 Accepted if successful
404 Not found if not successful