Could someone walk me through setting an IAM policy in node.js using gcloud's pubsub?
I've looked through this page: https://developers.google.com/gmail/api/guides/push
And based on what I understood, I've saved this file as a .json:
POST "https://pubsub.googleapis.com/v1beta2/projects/gmail_push_project/topics/gmail_push_topic:setIamPolicy"
Content-type: application/json
{
"policy": {
"bindings": [{
"role": "roles/pubsub.publisher",
"members": ["serviceAccount:gmail-api-push@system.gserviceaccount.com"],
}],
}
}
And then, after creating a topic and subscribing to it, I've made this call in my .js script: pubsub.projects.topics.setIamPolicy('pubsub_policy.json');
, however, I'm getting an error cannot read property "topics" of undefined
.
Thanks for your help!