We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I need to update the IAM policy of a ServiceAccount resource and currently I couldn't find any way to do it using the google-cloud-go.
I could find documentation on how to do it using gcloud client libraries in Python and Java, but not for Go.
The solution I'd like is basically allow using https://pkg.go.dev/cloud.google.com/go/[email protected]/apiv1#example-IamPolicyClient.GetIamPolicy with a Service Account as a resource.
This is an example on how I tried to do so:
package main import ( "context" "log" iam "cloud.google.com/go/iam/apiv1" "cloud.google.com/go/iam/apiv1/iampb" ) func main() { ctx := context.Background() iamClient, err := iam.NewIamPolicyClient(ctx) if err != nil { log.Fatalf("failed to create IAM client: %s", err) } defer iamClient.Close() req := &iampb.GetIamPolicyRequest{ Resource: "projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}", // I also tried the full resource as suggested in https://cloud.google.com/iam/docs/full-resource-names Options: &iampb.GetPolicyOptions{RequestedPolicyVersion: 3} } res, err := c.GetIamPolicy(ctx, req) if err != nil { log.Fatalf("failed to get IAM policy: %s", err) } log.Printf("res: %v", res) }
But I repeatedly get this error::
rpc error: code = Unimplemented desc = unexpected HTTP status code received from server: 404 (Not Found); transport: received unexpected content-type "text/html; charset=UTF-8" exit status 1
I could observe this behavior on the version v1.1.13, that I usually work with, but also in latest (v1.3.0)
Weirdly enough, I could make it work using the library google.golang.org/api, but it's considered complete and it's only on maintenance mode. I followed the exemple here: https://cloud.google.com/iam/docs/reference/rest/v1/projects.serviceAccounts/getIamPolicy#go
Similar issue: #8671
The text was updated successfully, but these errors were encountered:
quartzmo
No branches or pull requests
Is your feature request related to a problem? Please describe.
I need to update the IAM policy of a ServiceAccount resource and currently I couldn't find any way to do it using the google-cloud-go.
I could find documentation on how to do it using gcloud client libraries in Python and Java, but not for Go.
Describe the solution you'd like
The solution I'd like is basically allow using https://pkg.go.dev/cloud.google.com/go/[email protected]/apiv1#example-IamPolicyClient.GetIamPolicy with a Service Account as a resource.
This is an example on how I tried to do so:
But I repeatedly get this error::
I could observe this behavior on the version v1.1.13, that I usually work with, but also in latest (v1.3.0)
Describe alternatives you've considered
Weirdly enough, I could make it work using the library google.golang.org/api, but it's considered complete and it's only on maintenance mode. I followed the exemple here: https://cloud.google.com/iam/docs/reference/rest/v1/projects.serviceAccounts/getIamPolicy#go
Additional context
Similar issue: #8671
The text was updated successfully, but these errors were encountered: