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

Include DBaaS metrics credential endpoint operations #667

Merged

Conversation

dwilsondo
Copy link
Contributor

@dwilsondo dwilsondo commented Feb 6, 2024

Adds support for:

  • GET on /v2/databases/metrics/credentials via Databases.GetMetricsCredentials - Gets the credentials required to access a user's metrics endpoints
  • PUT on /v2/databases/metrics/credentials via Databases.UpdateMetricsCredentials - Updates the credentials required to access a user's metrics endpoints
  • Includes metrics_endpoints on response to Databases.Get

Example Usage:

func main() {
	
	cl := godo.NewFromToken(os.Getenv("DIGITALOCEAN_RW_TOKEN"))
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	db, _, _ := cl.Databases.GetMetricsCredentials(ctx)
	fmt.Printf("Current State: %+v\n", db)

	_, _ = cl.Databases.UpdateMetricsCredentials(ctx, &godo.DatabaseUpdateMetricsCredentialsRequest{
		Credentials: &godo.DatabaseMetricsCredentials{
			BasicAuthPassword: "a_new_password",
			BasicAuthUsername: "a_new_username",
		},
	})
	
	db, _, _ = cl.Databases.GetMetricsCredentials(ctx)
	fmt.Printf("Current State: %+v\n", db)
}
Current State: &{BasicAuthUsername:a_old_username BasicAuthPassword:a_old_password}
Current State: &{BasicAuthUsername:a_new_username BasicAuthPassword:a_new_password}

@dwilsondo dwilsondo marked this pull request as draft February 7, 2024 01:18
@dwilsondo dwilsondo marked this pull request as ready for review March 11, 2024 20:05
@dwilsondo dwilsondo marked this pull request as draft March 11, 2024 20:05
@dwilsondo dwilsondo marked this pull request as ready for review March 14, 2024 16:49
Copy link
Member

@danaelhe danaelhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@danaelhe danaelhe merged commit 05bc366 into digitalocean:main Mar 14, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants