Git Product home page Git Product logo

astra-client-go's Introduction

Astra Client Go

Golang client sources for Astra.

astra-client-go's People

Contributors

bradfordcp avatar dynajoe avatar emerkle826 avatar pgier avatar phact avatar zzzming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

astra-client-go's Issues

get indexes response is incorrect

The response of get indexes is defined as an array of IndexResponse

responses:
'200':
description: ''
content:
application/json:
schema:
type: array
items:
"$ref": "#/components/schemas/IndexResponse"

while IndexResponse is also of array type,

IndexResponse:
type: array
description: The data returned by the index fetch.
items:

However, the actual response is not in nested array structure.

$ curl -s -H 'Content-Type: application/json' -H "X-Cassandra-Token: ${ASTRA_DB_TOKEN}" \
 https://${ASTRA_DB_ID}-${ASTRA_DB_REGION}.apps.astra.datastax.com/api/rest/v2/schemas/keyspaces/${ASTRA_DB_KEYSPACE}/tables/foo/indexes  \
  | jq .
[
  {
    "keyspace_name": "ghoti",
    "table_name": "foo",
    "index_name": "foo_lastname_idx",
    "kind": "CUSTOM",
    "options": [
      {
        "key": "class_name",
        "value": "org.apache.cassandra.index.sai.StorageAttachedIndex"
      },
      {
        "key": "target",
        "value": "lastname"
      }
    ]
  }
]

TERRA-39 ⁃ OpenAPI spec needs improvement and corrections, primaryly related to `databaseID` and `datacenterID`

A number of elements of the OpenAPI spec are incorrect or incomplete including:

  • Roles should be specified as an array of objects
  • CloudProviders should be specified as a set of enums since they are limited and specific in nature
  • Paths related to databaseID and datacenterID do not use the correct case and should instead be databaseId and datacenterId

┆Issue is synchronized with this Jira Task by Unito
┆fixVersions: v1.1.0
┆friendlyId: TERRA-39
┆priority: Major

response from get table request is not parsed properly

Summary

The response from get table request is not parsed properly

sample code

func tryGetTable(ctx context.Context, client *restapi.ClientWithResponses, keyspaceName string, tableName string) {
    rsp, err := client.GetTableWithResponse(ctx, keyspaceName, tableName, &restapi.GetTableParams{})
    if err != nil {
        panic(err)
    }
    enc := json.NewEncoder(os.Stdout)
    enc.Encode(rsp.JSON200)
}

expected result

{"columnDefinitions":[{"name":"firstname","static":false,"typeDefinition":"text"},{"name":"lastname","static":false,"typeDefinition":"text"}],"keyspace":"ghoti","name":"foo","primaryKey":{"clusteringKey":[],"partitionKey":["firstname"]},"tableOptions":{"clusteringExpression":[],"defaultTimeToLive":0}}

actual result

{"columnDefinitions":null,"name":"","primaryKey":{"partitionKey":null}}

invesitigation

there is a top level data key in the response

$ curl -s -H 'Content-Type: application/json' -H "X-Cassandra-Token: ${ASTRA_DB_TOKEN}" \
 https://${ASTRA_DB_ID}-${ASTRA_DB_REGION}.apps.astra.datastax.com/api/rest/v2/schemas/keyspaces/${ASTRA_DB_KEYSPACE}/tables/foo  \
  | jq .
{
  "data": {
    "name": "foo",
    "keyspace": "ghoti",
    "columnDefinitions": [
      {
        "name": "firstname",
        "typeDefinition": "text",
        "static": false
      },
      {
        "name": "lastname",
        "typeDefinition": "text",
        "static": false
      }
    ],
    "primaryKey": {
      "partitionKey": [
        "firstname"
      ],
      "clusteringKey": []
    },
    "tableOptions": {
      "defaultTimeToLive": 0,
      "clusteringExpression": []
    }
  }
}

It should be included in the specification here

responses:
'200':
description: ''
content:
application/json:
schema:
"$ref": "#/components/schemas/Table"

Streaming support v0

Adding support for streaming via the public bellburnel api in this commit:

782ff23

Added a step to the makefile and a streaming yaml.

docs and examples

I am sure this is on the todo list somewhere but this is something I would be willing to help with.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.