GithubHelp home page GithubHelp logo

isabella232 / go-client-mongodb-ops-manager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mongodb/go-client-mongodb-ops-manager

0.0 0.0 0.0 445 KB

An HTTP client for Ops Manager and Cloud Manager Public API endpoints.

Home Page: https://pkg.go.dev/go.mongodb.org/ops-manager

License: Apache License 2.0

Makefile 0.29% Go 99.71%

go-client-mongodb-ops-manager's Introduction

MongoDB Ops Manager Go Client

Go Reference CI Go Report Card

A go client for Ops Manager and Cloud Manager API.

Note that ops-manager only supports the two most recent major versions of Go.

Usage

import "go.mongodb.org/ops-manager/opsmngr"

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

client := opsmngr.NewClient(nil)

The services of a client divide the API into logical chunks and correspond to the structure of the Ops Manager API documentation at https://docs.opsmanager.mongodb.com/v4.2/reference/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 ops-manager 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, you can use it with the digest library using:

import (
    "context"
    "log"

    "github.com/mongodb-forks/digest"
    "go.mongodb.org/ops-manager/opsmngr"
)

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

    client := opsmngr.NewClient(tc)
    orgs, _, err := client.Organizations.List(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.

To get your API Keys please refer to our docs for, Ops Manager, or Cloud Manager.

Roadmap

This library is being initially developed for mongocli, so API methods will likely be implemented in the order that they are needed by that application.

Contributing

See our CONTRIBUTING.md Guide.

License

MongoDB Ops Manager Go Client is released under the Apache 2.0 license. See LICENSE

go-client-mongodb-ops-manager's People

Contributors

andreaangiolillo avatar dependabot[bot] avatar gssbzn avatar mihaibojin avatar robcarlan-mlab avatar sunny-b avatar svagner 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.