You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would like to have a service account with access only to subscribe to a topic and not t to publish or create anything else than create its subscription on one topic if the subscription doesn't exists.
Given the code below what is needed to get it to work without granting access to the actual project?
privatestaticvoidensureTopicAndSubscriptionExist(
PubSubpubsub, Stringtopic, Stringsubscription) {
if (pubsub.getTopic(topic) == null) {
thrownewIllegalStateException("Topic does not exist: " + topic);
}
if (pubsub.getSubscription(subscription) == null) {
LOG.info("creating PubSub subscription={} for topic={}", subscription, topic);
pubsub.create(SubscriptionInfo.of(topic, subscription));
LOG.info("created PubSub subscription={} for topic={}", subscription, topic);
}
}
We only get this to work if the service account user has edit rights on the project
We would like to have a service account with access only to subscribe to a topic and not t to publish or create anything else than create its subscription on one topic if the subscription doesn't exists.
Given the code below what is needed to get it to work without granting access to the actual project?
We only get this to work if the service account user has edit rights on the project