Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some sample bootstrapping code would be helpful #34

Open
pantelis-karamolegkos opened this issue Mar 12, 2024 · 3 comments
Open

Some sample bootstrapping code would be helpful #34

pantelis-karamolegkos opened this issue Mar 12, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@pantelis-karamolegkos
Copy link

What can we help you with?

I just want to bootstrap my client and make a request to list project details.

I have exported the AIVEN_TOKEN as environment variable so the following code works as expected

const userAgent = "just-me"
 
aivenClient, err := aiven.NewClient(aiven.DebugOpt(true), aiven.UserAgentOpt(userAgent))
	if err != nil {
		log.Fatal(err)
	}
	aivenProjectsListOut, err := aivenClient.ProjectList(ctx)
	if err != nil {
		log.Fatal(err)
	}

Now I want to list projects' details.

From what I understand, I must create a new (project) Handler via this function.

I was not able to find a way to create and/or initialize a doer (given that in the *client returned the field is unexported).

Where would you expect to find this information?

Either in README.md or within an examples folder.

@Serpentiel Serpentiel self-assigned this Mar 13, 2024
@Serpentiel Serpentiel added question Further information is requested documentation Improvements or additions to documentation labels Mar 13, 2024
@Serpentiel
Copy link
Contributor

Serpentiel commented Mar 13, 2024

Hey, @pantelis-karamolegkos! 👋

Thank you for bringing this up!

I do agree that some additional examples could benefit the project and expand its influence to other developers that might be interested in using it—I will introduce this topic to the relevant stakeholders.

For now, I can recommend taking a look at the following resources which are already available:


From what I understand, I must create a new (project) Handler via this function.

No, this isn't needed. You can simply call the relevant method directly via the aivenClient that you have instantiated, because its type has all the possible handlers embedded to it. Here's an example to retrieve the information on a specific project:

const userAgent = "just-me"

aivenClient, err := aiven.NewClient(aiven.DebugOpt(true), aiven.UserAgentOpt(userAgent))
if err != nil {
	log.Fatal(err)
}

aivenProjectGetOut, err := aivenClient.ProjectGet(ctx, "some-project-name")
if err != nil {
	log.Fatal(err)
}

log.Println(fmt.Sprintf("Organization ID: %s", aivenProjectGetOut.OrganizationId))

I hope my answer provides you with the information that you were looking for 🙂.

I will not be closing the issue and will update you once I have more information to share in regards to adding some examples to the project.

@Serpentiel Serpentiel removed the question Further information is requested label Mar 13, 2024
@pantelis-karamolegkos
Copy link
Author

Thanks @Serpentiel 💪🏻
From my side I am good to go for closing this but overall yes, I agree it would be better if the project's docs/examples get enriched.

@Serpentiel
Copy link
Contributor

Hey again, @pantelis-karamolegkos! 👋

That's great to hear. I've just received some information from the relevant stakeholders in regards to expanding the Go client further as a product.

We will be working on more public documentation in the near future, including examples.

Thank you once again for your input, I will close the issue once we have some examples in place 🙌.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants