The API seems to allow me to create a subscription for a topic in a different project, but when I inspect the newly created subscription, the it is associated with the project where the topic is located.
from google.cloud import pubsub
pubsub_client_publisher = pubsub.Client("publisher-project")
topic = pubsub_client_publisher.topic("topic1")
pubsub_client_receiver = pubsub.Client("receiver-project")
subscription = pubsub.subscription.Subscription("subscription1", topic)
subscription.create(pubsub_client_receiver); # the argument is ignored
print('Subscription {} created on topic {}.'.format(
subscription.full_name, topic.full_name))
This cannot be done via the web console. Is there another API? Or am I missing something?
I am trying to follow this API reference: https://googlecloudplatform.github.io/google-cloud-python/stable/pubsub-subscription.html
I am running this as a locally executed Python script. The default project (gcloud config get-value project) is the receiver-project.