Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mongodb/go-client-mongodb-ops-manager
An HTTP client for Ops Manager and Cloud Manager Public API endpoints.
https://github.com/mongodb/go-client-mongodb-ops-manager
golang hacktoberfest mongodb mongodb-cloud-manager mongodb-ops-manager
Last synced: about 1 month ago
JSON representation
An HTTP client for Ops Manager and Cloud Manager Public API endpoints.
- Host: GitHub
- URL: https://github.com/mongodb/go-client-mongodb-ops-manager
- Owner: mongodb
- License: apache-2.0
- Created: 2020-02-27T10:12:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-19T10:10:50.000Z (about 2 months ago)
- Last Synced: 2024-09-27T17:02:30.495Z (about 2 months ago)
- Topics: golang, hacktoberfest, mongodb, mongodb-cloud-manager, mongodb-ops-manager
- Language: Go
- Homepage: https://pkg.go.dev/go.mongodb.org/ops-manager
- Size: 797 KB
- Stars: 15
- Watchers: 19
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# MongoDB Ops Manager Go Client
[![Go Reference](https://pkg.go.dev/badge/go.mongodb.org/ops-manager.svg)](https://pkg.go.dev/go.mongodb.org/ops-manager)
![CI](https://github.com/mongodb/go-client-mongodb-ops-manager/workflows/CI/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/go.mongodb.org/ops-manager)](https://goreportcard.com/report/go.mongodb.org/ops-manager)A go client for [Ops Manager](https://docs.opsmanager.mongodb.com/master/reference/api/)
and [Cloud Manager](https://docs.cloudmanager.mongodb.com/reference/api/) API.Note that ops-manager only supports the two most recent major versions of Go.
## Usage
```go
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:```go
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](https://docs.opsmanager.mongodb.com/v4.4/reference/api/).**NOTE:** Using the [context](https://godoc.org/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](https://github.com/mongodb-forks/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:
```go
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())
}// Note: If no Base URL is set the client is set to work with Cloud Manager by default
clientops := opsmngr.SetBaseURL("https://opsmanagerurl/" + opsmngr.APIPublicV1Path)
client, err := opsmngr.New(tc, clientops)
if err != nil {
log.Fatalf(err.Error())
}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](https://docs.opsmanager.mongodb.com/current/tutorial/configure-public-api-access/),
or [Cloud Manager](https://docs.cloudmanager.mongodb.com/tutorial/manage-programmatic-api-keys/).## Roadmap
This library is being initially developed for [mongocli](https://github.com/mongodb/mongocli),
so API methods will likely be implemented in the order that they are
needed by that application.## Contributing
See our [CONTRIBUTING.md](CONTRIBUTING.md) Guide.
## License
MongoDB Ops Manager Go Client is released under the Apache 2.0 license. See [LICENSE](LICENSE)