Closed pantelis-karamolegkos closed 8 months ago
Hi @pantelis-karamolegkos currnetly I'm unable to reproduce
Full snipped
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/mongodb-forks/digest"
"go.mongodb.org/atlas/mongodbatlas"
)
func main() {
apiKey := os.Getenv("API_KEY")
apiSecret := os.Getenv("API_SECRET")
baseURL := os.Getenv("BASE_URL")
t := digest.NewTransport(apiKey, apiSecret)
tc, err := t.Client()
if err != nil {
log.Fatalf(err.Error())
}
client, _ := mongodbatlas.New(tc, mongodbatlas.SetBaseURL(baseURL))
ctx := context.Background()
projects, _, err := client.Projects.GetAllProjects(ctx, nil)
if err != nil {
log.Fatalf(err.Error())
}
// ppProjects, err := json.MarshalIndent(projects, "", "\t")
// if err != nil {
// log.Fatalf(err.Error())
// }
//fmt.Println(string(ppProjects))
for _, p := range projects.Results {
fmt.Println("projectID", p.ID)
clusters, _, err := client.Clusters.List(ctx, p.ID, nil)
if err != nil {
log.Fatalf(err.Error())
}
for _, c := range clusters {
fmt.Println("clusterName", c.Name)
}
}
}
Are you able to reproduce with the snipped above? if yes, can you share details like the project ID which you expect to have access to clusters? and if you are not able to share here then I would recommend to reach out to mongodb support to share those details?
Also a little reminder this project is now deprecated and probably won't receive further updates so we recommend to migrate to https://github.com/mongodb/atlas-sdk-go/
Hi @gssbzn apologies, this was a typo on my code! Sorry for not closing this promptly and waisted your time 🙏🏻
Describe the bug I am trying to list the clusters for my organization using
ClustersService
.The following code snippet does not retrieve any clusters despite I know I have deployed a couple
(the
*client
instance is valid since I am able to list my projects' names)Expected behavior Clusters should be listed.
Logs If applicable, add logs to help explain your problem.
Desktop (please complete the following information):
v0.36.0
Additional context Add any other context about the problem here.