Skip to content

mongodb/atlas-sdk-go

Folders and files

NameName
Last commit message
Last commit date
May 2, 2025
Apr 3, 2025
Apr 3, 2025
May 29, 2023
Apr 3, 2025
May 2, 2025
Jun 4, 2024
Apr 3, 2025
Apr 3, 2025
May 2, 2025
Jul 27, 2023
Apr 3, 2025
May 2, 2025
May 9, 2023
Oct 29, 2024
Mar 28, 2025
Apr 3, 2025
Oct 1, 2024
May 9, 2023
May 9, 2023
Jun 26, 2024
May 9, 2023
Oct 18, 2024
Mar 28, 2025
Apr 3, 2025
May 9, 2023
May 2, 2025
May 2, 2025

atlas-sdk-go

PkgGoDev CI Go

A Go SDK for the MongoDB Atlas API.

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

Getting started

Adding Dependency

go get go.mongodb.org/atlas-sdk/v20250312002

Using in the code

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

import "go.mongodb.org/atlas-sdk/v20250312002/admin"

func example() {
	ctx := context.Background()

	apiKey := os.Getenv("MONGODB_ATLAS_PUBLIC_KEY")
	apiSecret := os.Getenv("MONGODB_ATLAS_PRIVATE_KEY")

	sdk, err := admin.NewClient(admin.UseDigestAuth(apiKey, apiSecret))
	if err != nil {
		log.Fatalf("Error when instantiating new client: %v", err)
	}
	projects, response, err := sdk.ProjectsApi.ListProjects(ctx).Execute()
	if err != nil {
		log.Fatalf("Could not fetch projects: %v", err)
	}
	fmt.Printf("Response status: %v\n", response.Status)
}

For documentation about obtaining apiKey and apiSecret go to https://docs.atlas.mongodb.com/configure-api-access.

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

Documentation

Please refer to the docs

Examples

See examples

Test Support

Testify Mock files are generated using Mockery to help to unit test clients using Atlas Go SDK.

See test example with mocks

Contributing

See our CONTRIBUTING.md Guide.

License

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