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

CloudSQL Users.Update do not send the body in the update request #2864

Open
matthisholleville opened this issue Nov 7, 2024 · 1 comment
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@matthisholleville
Copy link

Hello,

When I try to perform an update on an existing user in one of my instances, the API returns that the user parameter was not passed. However, it is indeed declared as a parameter in the function.

Is this a known bug, or am I simply missing something?

Environment details

  • Programming language: Go
  • OS: MacOS
  • Language runtime version: 1.22.4
  • Package version: v0.205.0

Steps to reproduce

package main

func main() {

  ctx := context.Background()
  
  client, err := sqladmin.NewService(ctx)

  _, err := client.Users.Update("my-project", "my-instance", &sqladmin.User{
		Name:     "admin",
		Password: "my-secure-password",
  }).Context(ctx).Do()

  if err != nil {
  	fmt.Println(err.Error())
  	os.Exit(1)
  }

}

The code return Error: googleapi: Error 400: Missing parameter: user., required

@matthisholleville matthisholleville added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 7, 2024
@matthisholleville
Copy link
Author

This code seems work :

package main

func main() {

  ctx := context.Background()
  
  client, err := sqladmin.NewService(ctx)

  _, err := client.Users.Update("my-project", "my-instance", &sqladmin.User{
		Name:     "admin",
		Password: "my-secure-password",
  }).Host("%").Name("admin").Do()

  if err != nil {
  	fmt.Println(err.Error())
  	os.Exit(1)
  }

}

@codyoss codyoss assigned quartzmo and unassigned codyoss Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants