Google Cloud Pub/Sub C++ Client 2.13.0
A C++ Client Library for Google Cloud Pub/Sub
Loading...
Searching...
No Matches
schema_client.h
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Generated by the Codegen C++ plugin.
16// If you make any local changes, they will be lost.
17// source: google/pubsub/v1/schema.proto
18
19#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_SCHEMA_CLIENT_H
20#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_SCHEMA_CLIENT_H
21
22#include "google/cloud/pubsub/schema_connection.h"
23#include "google/cloud/future.h"
24#include "google/cloud/options.h"
25#include "google/cloud/polling_policy.h"
26#include "google/cloud/status_or.h"
27#include "google/cloud/version.h"
28#include <memory>
29
30namespace google {
31namespace cloud {
32namespace pubsub {
33GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
34
35///
36/// Service for doing schema-related operations.
37///
38/// @par Equality
39///
40/// Instances of this class created via copy-construction or copy-assignment
41/// always compare equal. Instances created with equal
42/// `std::shared_ptr<*Connection>` objects compare equal. Objects that compare
43/// equal share the same underlying resources.
44///
45/// @par Performance
46///
47/// Creating a new instance of this class is a relatively expensive operation,
48/// new objects establish new connections to the service. In contrast,
49/// copy-construction, move-construction, and the corresponding assignment
50/// operations are relatively efficient as the copies share all underlying
51/// resources.
52///
53/// @par Thread Safety
54///
55/// Concurrent access to different instances of this class, even if they compare
56/// equal, is guaranteed to work. Two or more threads operating on the same
57/// instance of this class is not guaranteed to work. Since copy-construction
58/// and move-construction is a relatively efficient operation, consider using
59/// such a copy when using this class from multiple threads.
60///
62 public:
63 explicit SchemaServiceClient(
64 std::shared_ptr<SchemaServiceConnection> connection, Options opts = {});
66
67 ///@{
68 /// @name Copy and move support
73 ///@}
74
75 ///@{
76 /// @name Equality
77 friend bool operator==(SchemaServiceClient const& a,
78 SchemaServiceClient const& b) {
79 return a.connection_ == b.connection_;
80 }
81 friend bool operator!=(SchemaServiceClient const& a,
82 SchemaServiceClient const& b) {
83 return !(a == b);
84 }
85 ///@}
86
87 // clang-format off
88 ///
89 /// Creates a schema.
90 ///
91 /// @param parent Required. The name of the project in which to create the schema.
92 /// Format is `projects/{project-id}`.
93 /// @param schema Required. The schema object to create.
94 /// @n
95 /// This schema's `name` parameter is ignored. The schema object returned
96 /// by CreateSchema will have a `name` made using the given `parent` and
97 /// `schema_id`.
98 /// @param schema_id The ID to use for the schema, which will become the final component of
99 /// the schema's resource name.
100 /// @n
101 /// See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
102 /// name constraints.
103 /// @param opts Optional. Override the class-level options, such as retry and
104 /// backoff policies.
105 /// @return the result of the RPC. The response message type
106 /// ([google.pubsub.v1.Schema])
107 /// is mapped to a C++ class using the [Protobuf mapping rules].
108 /// If the request fails, the [`StatusOr`] contains the error details.
109 ///
110 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
111 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
112 /// [Long Running Operation]: https://google.aip.dev/151
113 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
114 /// [`future`]: @ref google::cloud::future
115 /// [`StatusOr`]: @ref google::cloud::StatusOr
116 /// [`Status`]: @ref google::cloud::Status
117 /// [google.pubsub.v1.CreateSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L185}
118 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
119 ///
120 // clang-format on
121 StatusOr<google::pubsub::v1::Schema> CreateSchema(
122 std::string const& parent, google::pubsub::v1::Schema const& schema,
123 std::string const& schema_id, Options opts = {});
124
125 // clang-format off
126 ///
127 /// Creates a schema.
128 ///
129 /// @param request Unary RPCs, such as the one wrapped by this
130 /// function, receive a single `request` proto message which includes all
131 /// the inputs for the RPC. In this case, the proto message is a
132 /// [google.pubsub.v1.CreateSchemaRequest].
133 /// Proto messages are converted to C++ classes by Protobuf, using the
134 /// [Protobuf mapping rules].
135 /// @param opts Optional. Override the class-level options, such as retry and
136 /// backoff policies.
137 /// @return the result of the RPC. The response message type
138 /// ([google.pubsub.v1.Schema])
139 /// is mapped to a C++ class using the [Protobuf mapping rules].
140 /// If the request fails, the [`StatusOr`] contains the error details.
141 ///
142 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
143 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
144 /// [Long Running Operation]: https://google.aip.dev/151
145 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
146 /// [`future`]: @ref google::cloud::future
147 /// [`StatusOr`]: @ref google::cloud::StatusOr
148 /// [`Status`]: @ref google::cloud::Status
149 /// [google.pubsub.v1.CreateSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L185}
150 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
151 ///
152 // clang-format on
153 StatusOr<google::pubsub::v1::Schema> CreateSchema(
154 google::pubsub::v1::CreateSchemaRequest const& request,
155 Options opts = {});
156
157 // clang-format off
158 ///
159 /// Gets a schema.
160 ///
161 /// @param name Required. The name of the schema to get.
162 /// Format is `projects/{project}/schemas/{schema}`.
163 /// @param opts Optional. Override the class-level options, such as retry and
164 /// backoff policies.
165 /// @return the result of the RPC. The response message type
166 /// ([google.pubsub.v1.Schema])
167 /// is mapped to a C++ class using the [Protobuf mapping rules].
168 /// If the request fails, the [`StatusOr`] contains the error details.
169 ///
170 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
171 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
172 /// [Long Running Operation]: https://google.aip.dev/151
173 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
174 /// [`future`]: @ref google::cloud::future
175 /// [`StatusOr`]: @ref google::cloud::StatusOr
176 /// [`Status`]: @ref google::cloud::Status
177 /// [google.pubsub.v1.GetSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L211}
178 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
179 ///
180 // clang-format on
181 StatusOr<google::pubsub::v1::Schema> GetSchema(std::string const& name,
182 Options opts = {});
183
184 // clang-format off
185 ///
186 /// Gets a schema.
187 ///
188 /// @param request Unary RPCs, such as the one wrapped by this
189 /// function, receive a single `request` proto message which includes all
190 /// the inputs for the RPC. In this case, the proto message is a
191 /// [google.pubsub.v1.GetSchemaRequest].
192 /// Proto messages are converted to C++ classes by Protobuf, using the
193 /// [Protobuf mapping rules].
194 /// @param opts Optional. Override the class-level options, such as retry and
195 /// backoff policies.
196 /// @return the result of the RPC. The response message type
197 /// ([google.pubsub.v1.Schema])
198 /// is mapped to a C++ class using the [Protobuf mapping rules].
199 /// If the request fails, the [`StatusOr`] contains the error details.
200 ///
201 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
202 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
203 /// [Long Running Operation]: https://google.aip.dev/151
204 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
205 /// [`future`]: @ref google::cloud::future
206 /// [`StatusOr`]: @ref google::cloud::StatusOr
207 /// [`Status`]: @ref google::cloud::Status
208 /// [google.pubsub.v1.GetSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L211}
209 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
210 ///
211 // clang-format on
212 StatusOr<google::pubsub::v1::Schema> GetSchema(
213 google::pubsub::v1::GetSchemaRequest const& request, Options opts = {});
214
215 // clang-format off
216 ///
217 /// Lists schemas in a project.
218 ///
219 /// @param parent Required. The name of the project in which to list schemas.
220 /// Format is `projects/{project-id}`.
221 /// @param opts Optional. Override the class-level options, such as retry and
222 /// backoff policies.
223 /// @return a [StreamRange](@ref google::cloud::StreamRange)
224 /// to iterate of the results. See the documentation of this type for
225 /// details. In brief, this class has `begin()` and `end()` member
226 /// functions returning a iterator class meeting the
227 /// [input iterator requirements]. The value type for this iterator is a
228 /// [`StatusOr`] as the iteration may fail even after some values are
229 /// retrieved successfully, for example, if there is a network disconnect.
230 /// An empty set of results does not indicate an error, it indicates
231 /// that there are no resources meeting the request criteria.
232 /// On a successful iteration the `StatusOr<T>` contains elements of type
233 /// [google.pubsub.v1.Schema], or rather,
234 /// the C++ class generated by Protobuf from that type. Please consult the
235 /// Protobuf documentation for details on the [Protobuf mapping rules].
236 ///
237 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
238 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
239 /// [Long Running Operation]: https://google.aip.dev/151
240 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
241 /// [`future`]: @ref google::cloud::future
242 /// [`StatusOr`]: @ref google::cloud::StatusOr
243 /// [`Status`]: @ref google::cloud::Status
244 /// [google.pubsub.v1.ListSchemasRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L225}
245 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
246 ///
247 // clang-format on
248 StreamRange<google::pubsub::v1::Schema> ListSchemas(std::string const& parent,
249 Options opts = {});
250
251 // clang-format off
252 ///
253 /// Lists schemas in a project.
254 ///
255 /// @param request Unary RPCs, such as the one wrapped by this
256 /// function, receive a single `request` proto message which includes all
257 /// the inputs for the RPC. In this case, the proto message is a
258 /// [google.pubsub.v1.ListSchemasRequest].
259 /// Proto messages are converted to C++ classes by Protobuf, using the
260 /// [Protobuf mapping rules].
261 /// @param opts Optional. Override the class-level options, such as retry and
262 /// backoff policies.
263 /// @return a [StreamRange](@ref google::cloud::StreamRange)
264 /// to iterate of the results. See the documentation of this type for
265 /// details. In brief, this class has `begin()` and `end()` member
266 /// functions returning a iterator class meeting the
267 /// [input iterator requirements]. The value type for this iterator is a
268 /// [`StatusOr`] as the iteration may fail even after some values are
269 /// retrieved successfully, for example, if there is a network disconnect.
270 /// An empty set of results does not indicate an error, it indicates
271 /// that there are no resources meeting the request criteria.
272 /// On a successful iteration the `StatusOr<T>` contains elements of type
273 /// [google.pubsub.v1.Schema], or rather,
274 /// the C++ class generated by Protobuf from that type. Please consult the
275 /// Protobuf documentation for details on the [Protobuf mapping rules].
276 ///
277 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
278 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
279 /// [Long Running Operation]: https://google.aip.dev/151
280 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
281 /// [`future`]: @ref google::cloud::future
282 /// [`StatusOr`]: @ref google::cloud::StatusOr
283 /// [`Status`]: @ref google::cloud::Status
284 /// [google.pubsub.v1.ListSchemasRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L225}
285 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
286 ///
287 // clang-format on
288 StreamRange<google::pubsub::v1::Schema> ListSchemas(
289 google::pubsub::v1::ListSchemasRequest request, Options opts = {});
290
291 // clang-format off
292 ///
293 /// Lists all schema revisions for the named schema.
294 ///
295 /// @param name Required. The name of the schema to list revisions for.
296 /// @param opts Optional. Override the class-level options, such as retry and
297 /// backoff policies.
298 /// @return a [StreamRange](@ref google::cloud::StreamRange)
299 /// to iterate of the results. See the documentation of this type for
300 /// details. In brief, this class has `begin()` and `end()` member
301 /// functions returning a iterator class meeting the
302 /// [input iterator requirements]. The value type for this iterator is a
303 /// [`StatusOr`] as the iteration may fail even after some values are
304 /// retrieved successfully, for example, if there is a network disconnect.
305 /// An empty set of results does not indicate an error, it indicates
306 /// that there are no resources meeting the request criteria.
307 /// On a successful iteration the `StatusOr<T>` contains elements of type
308 /// [google.pubsub.v1.Schema], or rather,
309 /// the C++ class generated by Protobuf from that type. Please consult the
310 /// Protobuf documentation for details on the [Protobuf mapping rules].
311 ///
312 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
313 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
314 /// [Long Running Operation]: https://google.aip.dev/151
315 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
316 /// [`future`]: @ref google::cloud::future
317 /// [`StatusOr`]: @ref google::cloud::StatusOr
318 /// [`Status`]: @ref google::cloud::Status
319 /// [google.pubsub.v1.ListSchemaRevisionsRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L260}
320 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
321 ///
322 // clang-format on
323 StreamRange<google::pubsub::v1::Schema> ListSchemaRevisions(
324 std::string const& name, Options opts = {});
325
326 // clang-format off
327 ///
328 /// Lists all schema revisions for the named schema.
329 ///
330 /// @param request Unary RPCs, such as the one wrapped by this
331 /// function, receive a single `request` proto message which includes all
332 /// the inputs for the RPC. In this case, the proto message is a
333 /// [google.pubsub.v1.ListSchemaRevisionsRequest].
334 /// Proto messages are converted to C++ classes by Protobuf, using the
335 /// [Protobuf mapping rules].
336 /// @param opts Optional. Override the class-level options, such as retry and
337 /// backoff policies.
338 /// @return a [StreamRange](@ref google::cloud::StreamRange)
339 /// to iterate of the results. See the documentation of this type for
340 /// details. In brief, this class has `begin()` and `end()` member
341 /// functions returning a iterator class meeting the
342 /// [input iterator requirements]. The value type for this iterator is a
343 /// [`StatusOr`] as the iteration may fail even after some values are
344 /// retrieved successfully, for example, if there is a network disconnect.
345 /// An empty set of results does not indicate an error, it indicates
346 /// that there are no resources meeting the request criteria.
347 /// On a successful iteration the `StatusOr<T>` contains elements of type
348 /// [google.pubsub.v1.Schema], or rather,
349 /// the C++ class generated by Protobuf from that type. Please consult the
350 /// Protobuf documentation for details on the [Protobuf mapping rules].
351 ///
352 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
353 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
354 /// [Long Running Operation]: https://google.aip.dev/151
355 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
356 /// [`future`]: @ref google::cloud::future
357 /// [`StatusOr`]: @ref google::cloud::StatusOr
358 /// [`Status`]: @ref google::cloud::Status
359 /// [google.pubsub.v1.ListSchemaRevisionsRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L260}
360 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
361 ///
362 // clang-format on
363 StreamRange<google::pubsub::v1::Schema> ListSchemaRevisions(
364 google::pubsub::v1::ListSchemaRevisionsRequest request,
365 Options opts = {});
366
367 // clang-format off
368 ///
369 /// Commits a new schema revision to an existing schema.
370 ///
371 /// @param name Required. The name of the schema we are revising.
372 /// Format is `projects/{project}/schemas/{schema}`.
373 /// @param schema Required. The schema revision to commit.
374 /// @param opts Optional. Override the class-level options, such as retry and
375 /// backoff policies.
376 /// @return the result of the RPC. The response message type
377 /// ([google.pubsub.v1.Schema])
378 /// is mapped to a C++ class using the [Protobuf mapping rules].
379 /// If the request fails, the [`StatusOr`] contains the error details.
380 ///
381 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
382 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
383 /// [Long Running Operation]: https://google.aip.dev/151
384 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
385 /// [`future`]: @ref google::cloud::future
386 /// [`StatusOr`]: @ref google::cloud::StatusOr
387 /// [`Status`]: @ref google::cloud::Status
388 /// [google.pubsub.v1.CommitSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L291}
389 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
390 ///
391 // clang-format on
392 StatusOr<google::pubsub::v1::Schema> CommitSchema(
393 std::string const& name, google::pubsub::v1::Schema const& schema,
394 Options opts = {});
395
396 // clang-format off
397 ///
398 /// Commits a new schema revision to an existing schema.
399 ///
400 /// @param request Unary RPCs, such as the one wrapped by this
401 /// function, receive a single `request` proto message which includes all
402 /// the inputs for the RPC. In this case, the proto message is a
403 /// [google.pubsub.v1.CommitSchemaRequest].
404 /// Proto messages are converted to C++ classes by Protobuf, using the
405 /// [Protobuf mapping rules].
406 /// @param opts Optional. Override the class-level options, such as retry and
407 /// backoff policies.
408 /// @return the result of the RPC. The response message type
409 /// ([google.pubsub.v1.Schema])
410 /// is mapped to a C++ class using the [Protobuf mapping rules].
411 /// If the request fails, the [`StatusOr`] contains the error details.
412 ///
413 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
414 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
415 /// [Long Running Operation]: https://google.aip.dev/151
416 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
417 /// [`future`]: @ref google::cloud::future
418 /// [`StatusOr`]: @ref google::cloud::StatusOr
419 /// [`Status`]: @ref google::cloud::Status
420 /// [google.pubsub.v1.CommitSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L291}
421 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
422 ///
423 // clang-format on
424 StatusOr<google::pubsub::v1::Schema> CommitSchema(
425 google::pubsub::v1::CommitSchemaRequest const& request,
426 Options opts = {});
427
428 // clang-format off
429 ///
430 /// Creates a new schema revision that is a copy of the provided revision_id.
431 ///
432 /// @param name Required. The schema being rolled back with revision id.
433 /// @param revision_id Required. The revision ID to roll back to.
434 /// It must be a revision of the same schema.
435 /// @n
436 /// Example: c7cfa2a8
437 /// @param opts Optional. Override the class-level options, such as retry and
438 /// backoff policies.
439 /// @return the result of the RPC. The response message type
440 /// ([google.pubsub.v1.Schema])
441 /// is mapped to a C++ class using the [Protobuf mapping rules].
442 /// If the request fails, the [`StatusOr`] contains the error details.
443 ///
444 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
445 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
446 /// [Long Running Operation]: https://google.aip.dev/151
447 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
448 /// [`future`]: @ref google::cloud::future
449 /// [`StatusOr`]: @ref google::cloud::StatusOr
450 /// [`Status`]: @ref google::cloud::Status
451 /// [google.pubsub.v1.RollbackSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L304}
452 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
453 ///
454 // clang-format on
455 StatusOr<google::pubsub::v1::Schema> RollbackSchema(
456 std::string const& name, std::string const& revision_id,
457 Options opts = {});
458
459 // clang-format off
460 ///
461 /// Creates a new schema revision that is a copy of the provided revision_id.
462 ///
463 /// @param request Unary RPCs, such as the one wrapped by this
464 /// function, receive a single `request` proto message which includes all
465 /// the inputs for the RPC. In this case, the proto message is a
466 /// [google.pubsub.v1.RollbackSchemaRequest].
467 /// Proto messages are converted to C++ classes by Protobuf, using the
468 /// [Protobuf mapping rules].
469 /// @param opts Optional. Override the class-level options, such as retry and
470 /// backoff policies.
471 /// @return the result of the RPC. The response message type
472 /// ([google.pubsub.v1.Schema])
473 /// is mapped to a C++ class using the [Protobuf mapping rules].
474 /// If the request fails, the [`StatusOr`] contains the error details.
475 ///
476 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
477 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
478 /// [Long Running Operation]: https://google.aip.dev/151
479 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
480 /// [`future`]: @ref google::cloud::future
481 /// [`StatusOr`]: @ref google::cloud::StatusOr
482 /// [`Status`]: @ref google::cloud::Status
483 /// [google.pubsub.v1.RollbackSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L304}
484 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
485 ///
486 // clang-format on
487 StatusOr<google::pubsub::v1::Schema> RollbackSchema(
488 google::pubsub::v1::RollbackSchemaRequest const& request,
489 Options opts = {});
490
491 // clang-format off
492 ///
493 /// Deletes a specific schema revision.
494 ///
495 /// @param name Required. The name of the schema revision to be deleted, with a revision ID
496 /// explicitly included.
497 /// @n
498 /// Example: `projects/123/schemas/my-schema@c7cfa2a8`
499 /// @param revision_id Optional. This field is deprecated and should not be used for specifying
500 /// the revision ID. The revision ID should be specified via the `name`
501 /// parameter.
502 /// @param opts Optional. Override the class-level options, such as retry and
503 /// backoff policies.
504 /// @return the result of the RPC. The response message type
505 /// ([google.pubsub.v1.Schema])
506 /// is mapped to a C++ class using the [Protobuf mapping rules].
507 /// If the request fails, the [`StatusOr`] contains the error details.
508 ///
509 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
510 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
511 /// [Long Running Operation]: https://google.aip.dev/151
512 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
513 /// [`future`]: @ref google::cloud::future
514 /// [`StatusOr`]: @ref google::cloud::StatusOr
515 /// [`Status`]: @ref google::cloud::Status
516 /// [google.pubsub.v1.DeleteSchemaRevisionRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L319}
517 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
518 ///
519 // clang-format on
520 StatusOr<google::pubsub::v1::Schema> DeleteSchemaRevision(
521 std::string const& name, std::string const& revision_id,
522 Options opts = {});
523
524 // clang-format off
525 ///
526 /// Deletes a specific schema revision.
527 ///
528 /// @param request Unary RPCs, such as the one wrapped by this
529 /// function, receive a single `request` proto message which includes all
530 /// the inputs for the RPC. In this case, the proto message is a
531 /// [google.pubsub.v1.DeleteSchemaRevisionRequest].
532 /// Proto messages are converted to C++ classes by Protobuf, using the
533 /// [Protobuf mapping rules].
534 /// @param opts Optional. Override the class-level options, such as retry and
535 /// backoff policies.
536 /// @return the result of the RPC. The response message type
537 /// ([google.pubsub.v1.Schema])
538 /// is mapped to a C++ class using the [Protobuf mapping rules].
539 /// If the request fails, the [`StatusOr`] contains the error details.
540 ///
541 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
542 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
543 /// [Long Running Operation]: https://google.aip.dev/151
544 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
545 /// [`future`]: @ref google::cloud::future
546 /// [`StatusOr`]: @ref google::cloud::StatusOr
547 /// [`Status`]: @ref google::cloud::Status
548 /// [google.pubsub.v1.DeleteSchemaRevisionRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L319}
549 /// [google.pubsub.v1.Schema]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L130}
550 ///
551 // clang-format on
552 StatusOr<google::pubsub::v1::Schema> DeleteSchemaRevision(
553 google::pubsub::v1::DeleteSchemaRevisionRequest const& request,
554 Options opts = {});
555
556 // clang-format off
557 ///
558 /// Deletes a schema.
559 ///
560 /// @param name Required. Name of the schema to delete.
561 /// Format is `projects/{project}/schemas/{schema}`.
562 /// @param opts Optional. Override the class-level options, such as retry and
563 /// backoff policies.
564 /// @return a [`Status`] object. If the request failed, the
565 /// status contains the details of the failure.
566 ///
567 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
568 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
569 /// [Long Running Operation]: https://google.aip.dev/151
570 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
571 /// [`future`]: @ref google::cloud::future
572 /// [`StatusOr`]: @ref google::cloud::StatusOr
573 /// [`Status`]: @ref google::cloud::Status
574 /// [google.pubsub.v1.DeleteSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L337}
575 ///
576 // clang-format on
577 Status DeleteSchema(std::string const& name, Options opts = {});
578
579 // clang-format off
580 ///
581 /// Deletes a schema.
582 ///
583 /// @param request Unary RPCs, such as the one wrapped by this
584 /// function, receive a single `request` proto message which includes all
585 /// the inputs for the RPC. In this case, the proto message is a
586 /// [google.pubsub.v1.DeleteSchemaRequest].
587 /// Proto messages are converted to C++ classes by Protobuf, using the
588 /// [Protobuf mapping rules].
589 /// @param opts Optional. Override the class-level options, such as retry and
590 /// backoff policies.
591 /// @return a [`Status`] object. If the request failed, the
592 /// status contains the details of the failure.
593 ///
594 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
595 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
596 /// [Long Running Operation]: https://google.aip.dev/151
597 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
598 /// [`future`]: @ref google::cloud::future
599 /// [`StatusOr`]: @ref google::cloud::StatusOr
600 /// [`Status`]: @ref google::cloud::Status
601 /// [google.pubsub.v1.DeleteSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L337}
602 ///
603 // clang-format on
604 Status DeleteSchema(google::pubsub::v1::DeleteSchemaRequest const& request,
605 Options opts = {});
606
607 // clang-format off
608 ///
609 /// Validates a schema.
610 ///
611 /// @param parent Required. The name of the project in which to validate schemas.
612 /// Format is `projects/{project-id}`.
613 /// @param schema Required. The schema object to validate.
614 /// @param opts Optional. Override the class-level options, such as retry and
615 /// backoff policies.
616 /// @return the result of the RPC. The response message type
617 /// ([google.pubsub.v1.ValidateSchemaResponse])
618 /// is mapped to a C++ class using the [Protobuf mapping rules].
619 /// If the request fails, the [`StatusOr`] contains the error details.
620 ///
621 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
622 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
623 /// [Long Running Operation]: https://google.aip.dev/151
624 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
625 /// [`future`]: @ref google::cloud::future
626 /// [`StatusOr`]: @ref google::cloud::StatusOr
627 /// [`Status`]: @ref google::cloud::Status
628 /// [google.pubsub.v1.ValidateSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L347}
629 /// [google.pubsub.v1.ValidateSchemaResponse]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L363}
630 ///
631 // clang-format on
632 StatusOr<google::pubsub::v1::ValidateSchemaResponse> ValidateSchema(
633 std::string const& parent, google::pubsub::v1::Schema const& schema,
634 Options opts = {});
635
636 // clang-format off
637 ///
638 /// Validates a schema.
639 ///
640 /// @param request Unary RPCs, such as the one wrapped by this
641 /// function, receive a single `request` proto message which includes all
642 /// the inputs for the RPC. In this case, the proto message is a
643 /// [google.pubsub.v1.ValidateSchemaRequest].
644 /// Proto messages are converted to C++ classes by Protobuf, using the
645 /// [Protobuf mapping rules].
646 /// @param opts Optional. Override the class-level options, such as retry and
647 /// backoff policies.
648 /// @return the result of the RPC. The response message type
649 /// ([google.pubsub.v1.ValidateSchemaResponse])
650 /// is mapped to a C++ class using the [Protobuf mapping rules].
651 /// If the request fails, the [`StatusOr`] contains the error details.
652 ///
653 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
654 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
655 /// [Long Running Operation]: https://google.aip.dev/151
656 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
657 /// [`future`]: @ref google::cloud::future
658 /// [`StatusOr`]: @ref google::cloud::StatusOr
659 /// [`Status`]: @ref google::cloud::Status
660 /// [google.pubsub.v1.ValidateSchemaRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L347}
661 /// [google.pubsub.v1.ValidateSchemaResponse]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L363}
662 ///
663 // clang-format on
664 StatusOr<google::pubsub::v1::ValidateSchemaResponse> ValidateSchema(
665 google::pubsub::v1::ValidateSchemaRequest const& request,
666 Options opts = {});
667
668 // clang-format off
669 ///
670 /// Validates a message against a schema.
671 ///
672 /// @param request Unary RPCs, such as the one wrapped by this
673 /// function, receive a single `request` proto message which includes all
674 /// the inputs for the RPC. In this case, the proto message is a
675 /// [google.pubsub.v1.ValidateMessageRequest].
676 /// Proto messages are converted to C++ classes by Protobuf, using the
677 /// [Protobuf mapping rules].
678 /// @param opts Optional. Override the class-level options, such as retry and
679 /// backoff policies.
680 /// @return the result of the RPC. The response message type
681 /// ([google.pubsub.v1.ValidateMessageResponse])
682 /// is mapped to a C++ class using the [Protobuf mapping rules].
683 /// If the request fails, the [`StatusOr`] contains the error details.
684 ///
685 /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
686 /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
687 /// [Long Running Operation]: https://google.aip.dev/151
688 /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
689 /// [`future`]: @ref google::cloud::future
690 /// [`StatusOr`]: @ref google::cloud::StatusOr
691 /// [`Status`]: @ref google::cloud::Status
692 /// [google.pubsub.v1.ValidateMessageRequest]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L366}
693 /// [google.pubsub.v1.ValidateMessageResponse]: @googleapis_reference_link{google/pubsub/v1/schema.proto#L397}
694 ///
695 // clang-format on
696 StatusOr<google::pubsub::v1::ValidateMessageResponse> ValidateMessage(
697 google::pubsub::v1::ValidateMessageRequest const& request,
698 Options opts = {});
699
700 private:
701 std::shared_ptr<SchemaServiceConnection> connection_;
702 Options options_;
703};
704
705GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
706} // namespace pubsub
707} // namespace cloud
708} // namespace google
709
710#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_SCHEMA_CLIENT_H
Service for doing schema-related operations.
Definition: schema_client.h:61
StatusOr< google::pubsub::v1::Schema > CommitSchema(std::string const &name, google::pubsub::v1::Schema const &schema, Options opts={})
Commits a new schema revision to an existing schema.
StatusOr< google::pubsub::v1::Schema > RollbackSchema(std::string const &name, std::string const &revision_id, Options opts={})
Creates a new schema revision that is a copy of the provided revision_id.
StatusOr< google::pubsub::v1::Schema > DeleteSchemaRevision(std::string const &name, std::string const &revision_id, Options opts={})
Deletes a specific schema revision.
StreamRange< google::pubsub::v1::Schema > ListSchemaRevisions(std::string const &name, Options opts={})
Lists all schema revisions for the named schema.
StatusOr< google::pubsub::v1::Schema > GetSchema(std::string const &name, Options opts={})
Gets a schema.
StatusOr< google::pubsub::v1::ValidateSchemaResponse > ValidateSchema(std::string const &parent, google::pubsub::v1::Schema const &schema, Options opts={})
Validates a schema.
StreamRange< google::pubsub::v1::Schema > ListSchemaRevisions(google::pubsub::v1::ListSchemaRevisionsRequest request, Options opts={})
Lists all schema revisions for the named schema.
StatusOr< google::pubsub::v1::Schema > DeleteSchemaRevision(google::pubsub::v1::DeleteSchemaRevisionRequest const &request, Options opts={})
Deletes a specific schema revision.
StatusOr< google::pubsub::v1::ValidateMessageResponse > ValidateMessage(google::pubsub::v1::ValidateMessageRequest const &request, Options opts={})
Validates a message against a schema.
Status DeleteSchema(google::pubsub::v1::DeleteSchemaRequest const &request, Options opts={})
Deletes a schema.
StreamRange< google::pubsub::v1::Schema > ListSchemas(std::string const &parent, Options opts={})
Lists schemas in a project.
SchemaServiceClient(SchemaServiceClient &&)=default
StatusOr< google::pubsub::v1::Schema > CreateSchema(google::pubsub::v1::CreateSchemaRequest const &request, Options opts={})
Creates a schema.
StatusOr< google::pubsub::v1::ValidateSchemaResponse > ValidateSchema(google::pubsub::v1::ValidateSchemaRequest const &request, Options opts={})
Validates a schema.
SchemaServiceClient & operator=(SchemaServiceClient const &)=default
StatusOr< google::pubsub::v1::Schema > GetSchema(google::pubsub::v1::GetSchemaRequest const &request, Options opts={})
Gets a schema.
friend bool operator!=(SchemaServiceClient const &a, SchemaServiceClient const &b)
Definition: schema_client.h:81
StatusOr< google::pubsub::v1::Schema > CreateSchema(std::string const &parent, google::pubsub::v1::Schema const &schema, std::string const &schema_id, Options opts={})
Creates a schema.
SchemaServiceClient(std::shared_ptr< SchemaServiceConnection > connection, Options opts={})
SchemaServiceClient(SchemaServiceClient const &)=default
SchemaServiceClient & operator=(SchemaServiceClient &&)=default
StatusOr< google::pubsub::v1::Schema > RollbackSchema(google::pubsub::v1::RollbackSchemaRequest const &request, Options opts={})
Creates a new schema revision that is a copy of the provided revision_id.
StatusOr< google::pubsub::v1::Schema > CommitSchema(google::pubsub::v1::CommitSchemaRequest const &request, Options opts={})
Commits a new schema revision to an existing schema.
Status DeleteSchema(std::string const &name, Options opts={})
Deletes a schema.
friend bool operator==(SchemaServiceClient const &a, SchemaServiceClient const &b)
Definition: schema_client.h:77
StreamRange< google::pubsub::v1::Schema > ListSchemas(google::pubsub::v1::ListSchemasRequest request, Options opts={})
Lists schemas in a project.
The SchemaServiceConnection object for SchemaServiceClient.
Definition: schema_connection.h:61
Contains all the Cloud Pub/Sub C++ client types and functions.
Definition: ack_handler.h:25
The namespace Google Cloud Platform C++ client libraries.