#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Topic {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PubsubMessage {
#[prost(bytes = "vec", tag = "1")]
pub data: ::prost::alloc::vec::Vec<u8>,
#[prost(map = "string, string", tag = "2")]
pub attributes:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(string, tag = "3")]
pub message_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTopicRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub messages: ::prost::alloc::vec::Vec<PubsubMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishResponse {
#[prost(string, repeated, tag = "1")]
pub message_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicsRequest {
#[prost(string, tag = "1")]
pub project: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicsResponse {
#[prost(message, repeated, tag = "1")]
pub topics: ::prost::alloc::vec::Vec<Topic>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicSubscriptionsRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicSubscriptionsResponse {
#[prost(string, repeated, tag = "1")]
pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteTopicRequest {
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subscription {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub topic: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub push_config: ::core::option::Option<PushConfig>,
#[prost(int32, tag = "5")]
pub ack_deadline_seconds: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PushConfig {
#[prost(string, tag = "1")]
pub push_endpoint: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "2")]
pub attributes:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReceivedMessage {
#[prost(string, tag = "1")]
pub ack_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub message: ::core::option::Option<PubsubMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSubscriptionRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSubscriptionsRequest {
#[prost(string, tag = "1")]
pub project: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSubscriptionsResponse {
#[prost(message, repeated, tag = "1")]
pub subscriptions: ::prost::alloc::vec::Vec<Subscription>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteSubscriptionRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyPushConfigRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub push_config: ::core::option::Option<PushConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PullRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub return_immediately: bool,
#[prost(int32, tag = "3")]
pub max_messages: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PullResponse {
#[prost(message, repeated, tag = "1")]
pub received_messages: ::prost::alloc::vec::Vec<ReceivedMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyAckDeadlineRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub ack_id: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub ack_deadline_seconds: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AcknowledgeRequest {
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub ack_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[doc = r" Generated client implementations."]
pub mod subscriber_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The service that an application uses to manipulate subscriptions and to"]
#[doc = " consume messages from a subscription via the Pull method."]
#[derive(Debug, Clone)]
pub struct SubscriberClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> SubscriberClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SubscriberClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
SubscriberClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Creates a subscription to a given topic for a given subscriber."]
#[doc = " If the subscription already exists, returns ALREADY_EXISTS."]
#[doc = " If the corresponding topic doesn't exist, returns NOT_FOUND."]
#[doc = ""]
#[doc = " If the name is not provided in the request, the server will assign a random"]
#[doc = " name for this subscription on the same project as the topic."]
pub async fn create_subscription(
&mut self,
request: impl tonic::IntoRequest<super::Subscription>,
) -> Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Subscriber/CreateSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the configuration details of a subscription."]
pub async fn get_subscription(
&mut self,
request: impl tonic::IntoRequest<super::GetSubscriptionRequest>,
) -> Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Subscriber/GetSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists matching subscriptions."]
pub async fn list_subscriptions(
&mut self,
request: impl tonic::IntoRequest<super::ListSubscriptionsRequest>,
) -> Result<tonic::Response<super::ListSubscriptionsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Subscriber/ListSubscriptions",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes an existing subscription. All pending messages in the subscription"]
#[doc = " are immediately dropped. Calls to Pull after deletion will return"]
#[doc = " NOT_FOUND. After a subscription is deleted, a new one may be created with"]
#[doc = " the same name, but the new one has no association with the old"]
#[doc = " subscription, or its topic unless the same topic is specified."]
pub async fn delete_subscription(
&mut self,
request: impl tonic::IntoRequest<super::DeleteSubscriptionRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Subscriber/DeleteSubscription",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Modifies the ack deadline for a specific message. This method is useful to"]
#[doc = " indicate that more time is needed to process a message by the subscriber,"]
#[doc = " or to make the message available for redelivery if the processing was"]
#[doc = " interrupted."]
pub async fn modify_ack_deadline(
&mut self,
request: impl tonic::IntoRequest<super::ModifyAckDeadlineRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Subscriber/ModifyAckDeadline",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Acknowledges the messages associated with the ack tokens in the"]
#[doc = " AcknowledgeRequest. The Pub/Sub system can remove the relevant messages"]
#[doc = " from the subscription."]
#[doc = ""]
#[doc = " Acknowledging a message whose ack deadline has expired may succeed,"]
#[doc = " but such a message may be redelivered later. Acknowledging a message more"]
#[doc = " than once will not result in an error."]
pub async fn acknowledge(
&mut self,
request: impl tonic::IntoRequest<super::AcknowledgeRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Subscriber/Acknowledge",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Pulls messages from the server. Returns an empty list if there are no"]
#[doc = " messages available in the backlog. The server may return UNAVAILABLE if"]
#[doc = " there are too many concurrent pull requests pending for the given"]
#[doc = " subscription."]
pub async fn pull(
&mut self,
request: impl tonic::IntoRequest<super::PullRequest>,
) -> Result<tonic::Response<super::PullResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/google.pubsub.v1beta2.Subscriber/Pull");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Modifies the PushConfig for a specified subscription."]
#[doc = ""]
#[doc = " This may be used to change a push subscription to a pull one (signified"]
#[doc = " by an empty PushConfig) or vice versa, or change the endpoint URL and other"]
#[doc = " attributes of a push subscription. Messages will accumulate for"]
#[doc = " delivery continuously through the call regardless of changes to the"]
#[doc = " PushConfig."]
pub async fn modify_push_config(
&mut self,
request: impl tonic::IntoRequest<super::ModifyPushConfigRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Subscriber/ModifyPushConfig",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[doc = r" Generated client implementations."]
pub mod publisher_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The service that an application uses to manipulate topics, and to send"]
#[doc = " messages to a topic."]
#[derive(Debug, Clone)]
pub struct PublisherClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> PublisherClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> PublisherClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
PublisherClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Creates the given topic with the given name."]
pub async fn create_topic(
&mut self,
request: impl tonic::IntoRequest<super::Topic>,
) -> Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Publisher/CreateTopic",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Adds one or more messages to the topic. Returns NOT_FOUND if the topic does"]
#[doc = " not exist."]
pub async fn publish(
&mut self,
request: impl tonic::IntoRequest<super::PublishRequest>,
) -> Result<tonic::Response<super::PublishResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/google.pubsub.v1beta2.Publisher/Publish");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the configuration of a topic."]
pub async fn get_topic(
&mut self,
request: impl tonic::IntoRequest<super::GetTopicRequest>,
) -> Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/google.pubsub.v1beta2.Publisher/GetTopic");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists matching topics."]
pub async fn list_topics(
&mut self,
request: impl tonic::IntoRequest<super::ListTopicsRequest>,
) -> Result<tonic::Response<super::ListTopicsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/google.pubsub.v1beta2.Publisher/ListTopics");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists the name of the subscriptions for this topic."]
pub async fn list_topic_subscriptions(
&mut self,
request: impl tonic::IntoRequest<super::ListTopicSubscriptionsRequest>,
) -> Result<tonic::Response<super::ListTopicSubscriptionsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Publisher/ListTopicSubscriptions",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes the topic with the given name. Returns NOT_FOUND if the topic does"]
#[doc = " not exist. After a topic is deleted, a new topic may be created with the"]
#[doc = " same name; this is an entirely new topic with none of the old"]
#[doc = " configuration or subscriptions. Existing subscriptions to this topic are"]
#[doc = " not deleted."]
pub async fn delete_topic(
&mut self,
request: impl tonic::IntoRequest<super::DeleteTopicRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.pubsub.v1beta2.Publisher/DeleteTopic",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}