Class: Google::Cloud::PubSub::Project
- Inherits:
-
Object
- Object
- Google::Cloud::PubSub::Project
- Defined in:
- lib/google/cloud/pubsub/project.rb
Overview
Project
Represents the project that pubsub messages are pushed to and pulled from.
V1::Topic is a named resource to which messages are sent by using Publisher. V1::Subscription is a named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application via Subscriber. Message is a combination of data and attributes that a publisher sends to a topic and is eventually delivered to subscribers.
Instance Method Summary collapse
-
#iam ⇒ Google::Iam::V1::IAMPolicy::Client
Retrieve a client specific for Iam Policy related functions.
-
#project_id ⇒ Object
(also: #project)
The Pub/Sub project connected to.
-
#project_path(project_name: nil) ⇒ Object
Returns a fully-qualified project path in the form of
projects/{project_id}. -
#publisher(topic_name, project: nil, async: nil, skip_lookup: nil) ⇒ Google::Cloud::PubSub::Publisher
Retrieves a Publisher by topic name or full project path.
-
#schema_path(schema_name, project_name: nil) ⇒ Object
Returns a fully-qualified schema path in the form of
projects/{project_id}/schemas/{schema_name}. -
#schemas ⇒ Google::Cloud::PubSub::V1::SchemaService::Client
Retrieve a client for managing schemas.
-
#snapshot_path(snapshot_name, project_name: nil) ⇒ Object
Returns a fully-qualified snapshot path in the form of
projects/{project_id}/snapshots/{snapshot_name}. -
#subscriber(subscription_name, project: nil, skip_lookup: nil) ⇒ Google::Cloud::PubSub::Subscriber?
Retrieves a Subscriber by subscription name or full project path.
-
#subscription_admin ⇒ Google::Cloud::PubSub::SubscriptionAdmin::Client
Retrieve a client for managing subscriptions.
-
#subscription_path(subscription_name, project_name: nil) ⇒ Object
Returns a fully-qualified subscription path in the form of
projects/{project_id}/subscriptions/{subscription_name}. -
#topic_admin ⇒ Google::Cloud::PubSub::TopicAdmin::Client
Retrieve a client for managing topics.
-
#topic_path(topic_name, project_name: nil) ⇒ Object
Returns a fully-qualified topic path in the form of
projects/{project_id}/topics/{topic_name}. -
#universe_domain ⇒ String
The universe domain the client is connected to.
Instance Method Details
#iam ⇒ Google::Iam::V1::IAMPolicy::Client
Retrieve a client specific for Iam Policy related functions.
121 122 123 |
# File 'lib/google/cloud/pubsub/project.rb', line 121 def iam service.iam end |
#project_id ⇒ Object Also known as: project
The Pub/Sub project connected to.
75 76 77 |
# File 'lib/google/cloud/pubsub/project.rb', line 75 def project_id service.project end |
#project_path(project_name: nil) ⇒ Object
Returns a fully-qualified project path in the form of
projects/{project_id}
182 183 184 |
# File 'lib/google/cloud/pubsub/project.rb', line 182 def project_path project_name: nil service.project_path options: { "project" => project_name }.compact end |
#publisher(topic_name, project: nil, async: nil, skip_lookup: nil) ⇒ Google::Cloud::PubSub::Publisher
Retrieves a Publisher by topic name or full project path.
143 144 145 146 147 148 149 |
# File 'lib/google/cloud/pubsub/project.rb', line 143 def publisher topic_name, project: nil, async: nil, skip_lookup: nil ensure_service! = { project: project, async: async } return Publisher.from_name topic_name, service, if skip_lookup grpc = topic_admin.get_topic topic: service.topic_path(topic_name, ) Publisher.from_grpc grpc, service, async: async end |
#schema_path(schema_name, project_name: nil) ⇒ Object
Returns a fully-qualified schema path in the form of
projects/{project_id}/schemas/{schema_name}
226 227 228 |
# File 'lib/google/cloud/pubsub/project.rb', line 226 def schema_path schema_name, project_name: nil service.schema_path schema_name, options: { "project" => project_name }.compact end |
#schemas ⇒ Google::Cloud::PubSub::V1::SchemaService::Client
Retrieve a client for managing schemas.
112 113 114 |
# File 'lib/google/cloud/pubsub/project.rb', line 112 def schemas service.schemas end |
#snapshot_path(snapshot_name, project_name: nil) ⇒ Object
Returns a fully-qualified snapshot path in the form of
projects/{project_id}/snapshots/{snapshot_name}
215 216 217 |
# File 'lib/google/cloud/pubsub/project.rb', line 215 def snapshot_path snapshot_name, project_name: nil service.snapshot_path snapshot_name, options: { "project" => project_name }.compact end |
#subscriber(subscription_name, project: nil, skip_lookup: nil) ⇒ Google::Cloud::PubSub::Subscriber?
Retrieves a Subscriber by subscription name or full project path.
168 169 170 171 172 173 174 |
# File 'lib/google/cloud/pubsub/project.rb', line 168 def subscriber subscription_name, project: nil, skip_lookup: nil ensure_service! = { project: project } return Subscriber.from_name subscription_name, service, if skip_lookup grpc = subscription_admin.get_subscription subscription: service.subscription_path(subscription_name, ) Subscriber.from_grpc grpc, service end |
#subscription_admin ⇒ Google::Cloud::PubSub::SubscriptionAdmin::Client
Retrieve a client for managing subscriptions.
94 95 96 |
# File 'lib/google/cloud/pubsub/project.rb', line 94 def subscription_admin service.subscription_admin end |
#subscription_path(subscription_name, project_name: nil) ⇒ Object
Returns a fully-qualified subscription path in the form of
projects/{project_id}/subscriptions/{subscription_name}
204 205 206 |
# File 'lib/google/cloud/pubsub/project.rb', line 204 def subscription_path subscription_name, project_name: nil service.subscription_path subscription_name, options: { "project" => project_name }.compact end |
#topic_admin ⇒ Google::Cloud::PubSub::TopicAdmin::Client
Retrieve a client for managing topics.
103 104 105 |
# File 'lib/google/cloud/pubsub/project.rb', line 103 def topic_admin service.topic_admin end |
#topic_path(topic_name, project_name: nil) ⇒ Object
Returns a fully-qualified topic path in the form of
projects/{project_id}/topics/{topic_name}
193 194 195 |
# File 'lib/google/cloud/pubsub/project.rb', line 193 def topic_path topic_name, project_name: nil service.topic_path topic_name, options: { "project" => project_name }.compact end |
#universe_domain ⇒ String
The universe domain the client is connected to
85 86 87 |
# File 'lib/google/cloud/pubsub/project.rb', line 85 def universe_domain service.universe_domain end |