Git Product home page Git Product logo

calyptia-api's Introduction

Calyptia Cloud API - OpenAPI specification, Golang reference client and types

Go Reference

OpenAPI spec, Golang types and client for the API to Calyptia Core.

Install

go get github.com/calyptia/api

Client usage

Get an API key from Calyptia Cloud under settings.

package main

import "github.com/chronosphereio/calyptia-api/client"

func main() {
    c := client.New()
    c.SetProjectToken("YOUR_API_KEY_HERE")
}

API keys are bound to an specific project. With that API key you cannot list all your other projects, or create more API keys. But you can perform all other actions within a project: manage agents, aggregators and pipelines, invite members, etc.

User authentication

Machines using this client should prefer API key authorization, but if you need user authentication, you must setup Auth0. After you successfully login and get an access token, you can create an authenticated client like so:

tok := &oauth2.Token{
    AccessToken:  "YOUR_AUTH0_ACCESS_TOKEN",
    TokenType:    "Bearer",
    Expiry:       auth0Expiry,
}
tokSrc := oauth2.StaticTokenSource(tok)
c.Client = oauth2.NewClient(ctx, tokSrc)

Refer to client/client_test.go for a testing example.

Spec

The /spec directory contains an OpenAPI specification. You can use it to generate clients for your favorite programming language. Or preview it using SwaggerUI.

Typescript codegen

Example using openapi-typescript-codegen.

npx openapi-typescript-codegen \
    --input ./spec/open-api.yml \
    --output ./ts-client \
    --name Client

calyptia-api's People

Contributors

niedbalski avatar nicolasparada avatar dependabot[bot] avatar patrick-stephens avatar calyptia-ci avatar pwhelan avatar gabrielbussolo avatar edsiper avatar jasmingacic avatar

Stargazers

 avatar  avatar

Watchers

 avatar Hiroshi Hatake avatar José Lecaros avatar Rongdi Huang avatar Kostas Georgiou avatar  avatar

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.