-
Notifications
You must be signed in to change notification settings - Fork 595
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
pubsub: implemented iam methods #767
Conversation
* var topic = pubsub.topic('my-topic'); | ||
* var iam = topic.iam; | ||
*/ | ||
function Iam(pubsub, resource) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Couple of questions around
|
@tmatsuo - any insight you could provide would be greatly appreciated! |
1 sounds good. BTW, the example is using storage permissions. You can use permissions like pubsub.topics.publish and pubsub.subscriptions.consume. Also I would like to see the pubsub specific example, like testing permissions on topics/subscriptions. |
The pubsub specific way is the same, I decided to treat the var topic = pubsub.topic('my-topic');
var tests = ['pubsub.topics.publish'];
topic.iam.testPermissions(tests, function(err, permissions, apiResponse) {}); |
Updated post to include a link for a documentation preview. |
Now that Pub/Sub is out of beta (https://github.com/GoogleCloudPlatform/gcloud-common/issues/15) and IAM has official documentation. I've updated the system tests and documentation/code examples and everything looks good to go! |
* @param {?error} callback.err - An error returned while making this request. | ||
* @param {array} callback.permissions - A subset of permissions that the caller | ||
* @param {object} callback.apiResponse - The full API response. | ||
* is allowed |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
It looks like there are 5 roles currently. Would you want methods for each one? |
Yeah, I think that would be much easier than remembering those values. Maybe: topic.iam.subscribers.add('serviceAccount:[email protected]', callback);
topic.iam.viewers.add('user:[email protected]', callback);
// arrays also:
subscription.iam.owners.add(['...', '...'], callback); Hopefully that example actually makes sense. Not an expert with IAMs yet! |
* | ||
* @example | ||
* //- | ||
* // Test a single permission |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Throughout the examples, can you have the callbacks receive the |
Made some documentation updates to include upstream resource links. |
}; | ||
|
||
iam.getPolicy(assert.ifError); | ||
}); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
updated examples and system tests per official docs tweaked documentation and code style added upstream doc references added error handling unit tests
pubsub: implemented iam methods
We do have matching haircuts!
|
Update npm scripts: add clean, prelint, prefix; make sure that lint and fix are set properly. Use post-process feature of synthtool.
Closes #758
Topic
andSubscription
IAM#getPolicy
IAM#setPolicy
IAM#testPermissions
I'm getting a 503 for my
testPermissions
system test -- not sure if it's a problem upstream or implementation/user error.documentation preview