GithubHelp home page GithubHelp logo

classicvalues / go-client-mongodb-atlas Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mongodb/go-client-mongodb-atlas

1.0 1.0 0.0 858 KB

Go Client for MongoDB Atlas

License: Apache License 2.0

Go 99.46% Makefile 0.11% Shell 0.42%

go-client-mongodb-atlas's Introduction

go-client-mongodb-atlas

PkgGoDev CI

A Go HTTP client for the MongoDB Atlas API.

Note that go-client-mongodb-atlas only supports the two most recent major versions of Go.

Usage

import "go.mongodb.org/atlas/mongodbatlas"

Construct a new Atlas client, then use the various services on the client to access different parts of the Atlas API. For example:

client := mongodbatlas.NewClient(nil)

The services of a client divide the API into logical chunks and correspond to the structure of the Atlas API documentation at https://docs.atlas.mongodb.com/api/.

NOTE: Using the context package, one can easily pass cancellation signals and deadlines to various services of the client for handling a request. In case there is no context available, then context.Background() can be used as a starting point.

Authentication

The go-client-mongodb-atlas library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle Digest Access authentication for you. The easiest way to do this is using the digest library, but you can always use any other library that provides an http.Client. If you have a private and public API token pair (https://docs.atlas.mongodb.com/configure-api-access), you can use it with the digest library like:

import (
    "context"
    "log"

    "github.com/mongodb-forks/digest"
    "go.mongodb.org/atlas/mongodbatlas"
)

func main() {
    t := digest.NewTransport("your public key", "your private key")
    tc, err := t.Client()
    if err != nil {
        log.Fatalf(err.Error())
    }

    client := mongodbatlas.NewClient(tc)
    projects, _, err := client.Projects.GetAllProjects(context.Background(), nil)
}

Note that when using an authenticated Client, all calls made by the client will include the specified tokens. Therefore, authenticated clients should almost never be shared between different users.

Versioning

Each version of the client is tagged and the version is updated accordingly.

To see the list of past versions, run git tag.

To release a new version, first ensure that Version is updated (i.e., before running git push origin vx.y.z, verify that Version=x.y.z should match the tag being pushed to GitHub)

Roadmap

This library is being initially developed for mongocli, Atlas Terraform Provider, Atlas Vault Plugin, and Atlas Cloudformation Provider so API methods will likely be implemented in the order that they are needed by those projects.

Contributing

See our CONTRIBUTING.md Guide.

License

go-client-mongodb-atlas is released under the Apache 2.0 license. See LICENSE

go-client-mongodb-atlas's People

Contributors

marinsalinas avatar gssbzn avatar andreaangiolillo avatar pacodw avatar codergo93 avatar thetonymaster avatar mihaibojin avatar dependabot[bot] avatar themantissa avatar fmenezes avatar robcarlan-mlab avatar abner-dou avatar suzuki-shunsuke avatar 10genola avatar stovoy avatar leofigy avatar gmlp avatar acroca avatar mmb avatar svagner avatar sunny-b avatar howdoicomputer avatar vgarcia-te avatar

Stargazers

Classic Values avatar

Watchers

 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.