15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_TOPIC_BUILDER_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_TOPIC_BUILDER_H
18#include "google/cloud/pubsub/schema.h"
19#include "google/cloud/pubsub/topic.h"
20#include "google/cloud/pubsub/version.h"
21#include "google/cloud/internal/time_utils.h"
22#include <google/pubsub/v1/pubsub.pb.h>
29GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
32
33
34
35
36
37
38
39
56 google::protobuf::Map<std::string, std::string>::value_type;
57 proto_.mutable_labels()->insert(value_type(key, value));
58 paths_.insert(
"labels");
62 std::string
const& value) && {
67 proto_.clear_labels();
68 paths_.insert(
"labels");
74 proto_.mutable_message_storage_policy()->add_allowed_persistence_regions(
76 paths_.insert(
"message_storage_policy");
84 proto_.mutable_message_storage_policy()
85 ->clear_allowed_persistence_regions();
86 paths_.insert(
"message_storage_policy");
94 proto_.set_kms_key_name(std::move(key_name));
95 paths_.insert(
"kms_key_name");
103 proto_.mutable_schema_settings()->set_schema(schema
.FullName());
104 paths_.insert(
"schema_settings.schema");
111 proto_.mutable_schema_settings()->set_encoding(encoding);
112 paths_.insert(
"schema_settings.encoding");
119 proto_.mutable_schema_settings()->set_first_revision_id(revision_id);
120 paths_.insert(
"schema_settings.first_revision_id");
127 proto_.mutable_schema_settings()->set_last_revision_id(revision_id);
128 paths_.insert(
"schema_settings.last_revision_id");
135 template <
typename Rep,
typename Period>
137 std::chrono::duration<Rep, Period> d) & {
138 *proto_.mutable_message_retention_duration() =
140 paths_.insert(
"message_retention_duration");
143 template <
typename Rep,
typename Period>
145 std::chrono::duration<Rep, Period> d) && {
146 return std::move(set_message_retention_duration(d));
149 google::protobuf::Duration
const& d) & {
150 *proto_.mutable_message_retention_duration() = d;
151 paths_.insert(
"message_retention_duration");
155 google::protobuf::Duration
const& d) && {
161 google::pubsub::v1::Topic proto_;
162 std::set<std::string> paths_;
165GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Objects of this class identify a Cloud Pub/Sub schema.
Definition: schema.h:38
std::string FullName() const
Returns the fully qualified schema name as a string of the form: "projects/<project-id>/schemas/<sche...
Builds requests to create or update a Cloud Pub/Sub topic.
Definition: topic_builder.h:40
TopicBuilder && add_label(std::string const &key, std::string const &value) &&
Definition: topic_builder.h:61
TopicBuilder && clear_labels() &&
Definition: topic_builder.h:71
TopicBuilder & set_last_revision_id(std::string const &revision_id) &
Definition: topic_builder.h:126
TopicBuilder && add_allowed_persistence_region(std::string region) &&
Definition: topic_builder.h:79
TopicBuilder & set_schema(pubsub::Schema const &schema) &
Definition: topic_builder.h:102
TopicBuilder & add_allowed_persistence_region(std::string region) &
Definition: topic_builder.h:73
TopicBuilder(Topic const &topic)
Definition: topic_builder.h:42
TopicBuilder & set_message_retention_duration(google::protobuf::Duration const &d) &
Definition: topic_builder.h:148
TopicBuilder && set_encoding(google::pubsub::v1::Encoding encoding) &&
Definition: topic_builder.h:115
TopicBuilder & clear_allowed_persistence_regions() &
Definition: topic_builder.h:83
TopicBuilder && set_schema(pubsub::Schema const &schema) &&
Definition: topic_builder.h:107
TopicBuilder && set_message_retention_duration(std::chrono::duration< Rep, Period > d) &&
Definition: topic_builder.h:144
TopicBuilder & set_kms_key_name(std::string key_name) &
Definition: topic_builder.h:93
TopicBuilder & add_label(std::string const &key, std::string const &value) &
Definition: topic_builder.h:54
TopicBuilder & set_encoding(google::pubsub::v1::Encoding encoding) &
Definition: topic_builder.h:110
TopicBuilder & clear_labels() &
Definition: topic_builder.h:66
TopicBuilder && set_first_revision_id(std::string const &revision_id) &&
Definition: topic_builder.h:123
TopicBuilder && set_kms_key_name(std::string key_name) &&
Definition: topic_builder.h:98
TopicBuilder & set_message_retention_duration(std::chrono::duration< Rep, Period > d) &
Definition: topic_builder.h:136
TopicBuilder & set_first_revision_id(std::string const &revision_id) &
Definition: topic_builder.h:118
TopicBuilder && clear_allowed_persistence_regions() &&
Definition: topic_builder.h:89
TopicBuilder && set_message_retention_duration(google::protobuf::Duration const &d) &&
Definition: topic_builder.h:154
TopicBuilder && set_last_revision_id(std::string const &revision_id) &&
Definition: topic_builder.h:131
google::pubsub::v1::UpdateTopicRequest BuildUpdateRequest() &&
Build a protocol buffer message to update an existing topic.
google::pubsub::v1::Topic BuildCreateRequest() &&
Build a protocol buffer message to create a new topic.
Objects of this class identify a Cloud Pub/Sub topic.
Definition: topic.h:37
std::string FullName() const
Returns the fully qualified topic name as a string of the form: "projects/<project-id>/topics/<topic-...
Contains all the Cloud Pub/Sub C++ client types and functions.
Definition: ack_handler.h:25
The namespace Google Cloud Platform C++ client libraries.