Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

pubsub permission question regarding getTopic and getSubscription #1376

Copy link
Copy link

Description

@fondberg
Issue body actions

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?

  private static void ensureTopicAndSubscriptionExist(
      PubSub pubsub, String topic, String subscription) {
   
    if (pubsub.getTopic(topic) == null) {
      throw new IllegalStateException("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

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.