Send feedback
Class TopicBuilder (2.36.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.36.0 keyboard_arrow_down
Builds requests to create or update a Cloud Pub/Sub topic.
Makes it easier to create the protobuf messages consumed by TopicAdminClient
. The main advantages are:
Use a fluent API to set multiple values when constructing complex objects.
Automatically compute the set of paths for update requests.
Constructors
TopicBuilder(Topic const &)
Parameter
Name
Description
topic
Topic const &
Functions
add_label(std::string const &, std::string const &) &
Setters for each protocol buffer field.
Parameters
Name
Description
key
std::string const &
value
std::string const &
Returns
Type
Description
TopicBuilder &
add_label(std::string const &, std::string const &) &&
Setters for each protocol buffer field.
Parameters
Name
Description
key
std::string const &
value
std::string const &
Returns
Type
Description
TopicBuilder &&
clear_labels() &
Setters for each protocol buffer field.
Returns
Type
Description
TopicBuilder &
clear_labels() &&
Setters for each protocol buffer field.
Returns
Type
Description
TopicBuilder &&
add_allowed_persistence_region(std::string) &
Setters for each protocol buffer field.
Parameter
Name
Description
region
std::string
Returns
Type
Description
TopicBuilder &
add_allowed_persistence_region(std::string) &&
Setters for each protocol buffer field.
Parameter
Name
Description
region
std::string
Returns
Type
Description
TopicBuilder &&
clear_allowed_persistence_regions() &
Setters for each protocol buffer field.
Returns
Type
Description
TopicBuilder &
clear_allowed_persistence_regions() &&
Setters for each protocol buffer field.
Returns
Type
Description
TopicBuilder &&
set_kms_key_name(std::string) &
Setters for each protocol buffer field.
Parameter
Name
Description
key_name
std::string
Returns
Type
Description
TopicBuilder &
set_kms_key_name(std::string) &&
Setters for each protocol buffer field.
Parameter
Name
Description
key_name
std::string
Returns
Type
Description
TopicBuilder &&
set_schema(pubsub::Schema const &) &
Setters for each protocol buffer field.
Parameter
Name
Description
schema
pubsub::Schema const &
Returns
Type
Description
TopicBuilder &
set_schema(pubsub::Schema const &) &&
Setters for each protocol buffer field.
Parameter
Name
Description
schema
pubsub::Schema const &
Returns
Type
Description
TopicBuilder &&
set_encoding(google::pubsub::v1::Encoding) &
Setters for each protocol buffer field.
Parameter
Name
Description
encoding
google::pubsub::v1::Encoding
Returns
Type
Description
TopicBuilder &
set_encoding(google::pubsub::v1::Encoding) &&
Setters for each protocol buffer field.
Parameter
Name
Description
encoding
google::pubsub::v1::Encoding
Returns
Type
Description
TopicBuilder &&
set_first_revision_id(std::string const &) &
Setters for each protocol buffer field.
Parameter
Name
Description
revision_id
std::string const &
Returns
Type
Description
TopicBuilder &
set_first_revision_id(std::string const &) &&
Setters for each protocol buffer field.
Parameter
Name
Description
revision_id
std::string const &
Returns
Type
Description
TopicBuilder &&
set_last_revision_id(std::string const &) &
Setters for each protocol buffer field.
Parameter
Name
Description
revision_id
std::string const &
Returns
Type
Description
TopicBuilder &
set_last_revision_id(std::string const &) &&
Setters for each protocol buffer field.
Parameter
Name
Description
revision_id
std::string const &
Returns
Type
Description
TopicBuilder &&
set_message_retention_duration(std::chrono::duration< Rep, Period >) &
Setters for each protocol buffer field.
Parameters
Name
Description
d
std::chrono::duration< Rep, Period >
typename Rep
typename Period
Returns
Type
Description
TopicBuilder &
set_message_retention_duration(std::chrono::duration< Rep, Period >) &&
Setters for each protocol buffer field.
Parameters
Name
Description
d
std::chrono::duration< Rep, Period >
typename Rep
typename Period
Returns
Type
Description
TopicBuilder &&
set_message_retention_duration(google::protobuf::Duration const &) &
Setters for each protocol buffer field.
Parameter
Name
Description
d
google::protobuf::Duration const &
Returns
Type
Description
TopicBuilder &
set_message_retention_duration(google::protobuf::Duration const &) &&
Setters for each protocol buffer field.
Parameter
Name
Description
d
google::protobuf::Duration const &
Returns
Type
Description
TopicBuilder &&
BuildCreateRequest() &&
Build a protocol buffer message to create a new topic.
Returns
Type
Description
google::pubsub::v1::Topic
BuildUpdateRequest() &&
Build a protocol buffer message to update an existing topic.
Returns
Type
Description
google::pubsub::v1::UpdateTopicRequest
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-17 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-17 UTC."],[[["This document outlines the `TopicBuilder` class within the Google Cloud Pub/Sub C++ library, detailing its functionality for constructing and updating Pub/Sub topics, with the most recent version at 2.37.0-rc."],["`TopicBuilder` simplifies the creation of complex Pub/Sub topic objects by providing a fluent API for setting multiple values and automatically calculating the required paths for update requests."],["The class includes various setter functions that map directly to protocol buffer fields, allowing for configuration of labels, allowed persistence regions, KMS key names, schemas, encoding, revision IDs, and message retention duration."],["The `TopicBuilder` class supports building both `Create` and `Update` requests, as it provides functions for creating `google::pubsub::v1::Topic` and `google::pubsub::v1::UpdateTopicRequest` protocol buffer messages, respectively."],["The documentation also includes the historical versions of the `TopicBuilder` class going back to version 2.11.0, allowing one to easily access past documentation."]]],[]]