Google Cloud Pub/Sub C++ Client 2.13.0
A C++ Client Library for Google Cloud Pub/Sub
Loading...
Searching...
No Matches
snapshot.h
1// Copyright 2020 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#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_SNAPSHOT_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_SNAPSHOT_H
17
18#include "google/cloud/pubsub/version.h"
19#include <grpcpp/grpcpp.h>
20#include <string>
21
22namespace google {
23namespace cloud {
24namespace pubsub {
25GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
26
27/**
28 * Objects of this class identify a Cloud Pub/Sub snapshot.
29 *
30 * @note
31 * This class makes no effort to validate the ids provided. The application
32 * should verify that any ids passed to this application conform to the
33 * Cloud Pub/Sub [resource name][name-link] restrictions.
34 *
35 * [name-link]: https://cloud.google.com/pubsub/docs/admin#resource_names
36 */
37class Snapshot {
38 public:
39 Snapshot(std::string project_id, std::string snapshot_id)
40 : project_id_(std::move(project_id)),
41 snapshot_id_(std::move(snapshot_id)) {}
42
43 /// @name Copy and move
44 ///@{
45 Snapshot(Snapshot const&) = default;
46 Snapshot& operator=(Snapshot const&) = default;
47 Snapshot(Snapshot&&) = default;
48 Snapshot& operator=(Snapshot&&) = default;
49 ///@}
50
51 /// Returns the Project ID
52 std::string const& project_id() const { return project_id_; }
53
54 /// Returns the Snapshot ID
55 std::string const& snapshot_id() const { return snapshot_id_; }
56
57 /**
58 * Returns the fully qualified snapshot name as a string of the form:
59 * "projects/<project-id>/snapshots/<snapshot-id>"
60 */
61 std::string FullName() const;
62
63 ///@{
64 /// @name Equality operators
65 friend bool operator==(Snapshot const& a, Snapshot const& b);
66 friend bool operator!=(Snapshot const& a, Snapshot const& b) {
67 return !(a == b);
68 }
69 ///@}
70
71 /// Output the `FullName()` format.
72 friend std::ostream& operator<<(std::ostream& os, Snapshot const& rhs);
73
74 private:
75 std::string project_id_;
76 std::string snapshot_id_;
77};
78
79GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
80} // namespace pubsub
81} // namespace cloud
82} // namespace google
83
84#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_SNAPSHOT_H
Objects of this class identify a Cloud Pub/Sub snapshot.
Definition: snapshot.h:37
Snapshot(std::string project_id, std::string snapshot_id)
Definition: snapshot.h:39
Snapshot & operator=(Snapshot const &)=default
std::string FullName() const
Returns the fully qualified snapshot name as a string of the form: "projects/<project-id>/snapshots/<...
friend bool operator==(Snapshot const &a, Snapshot const &b)
Snapshot(Snapshot const &)=default
Snapshot(Snapshot &&)=default
Snapshot & operator=(Snapshot &&)=default
friend bool operator!=(Snapshot const &a, Snapshot const &b)
Definition: snapshot.h:66
std::string const & project_id() const
Returns the Project ID.
Definition: snapshot.h:52
std::string const & snapshot_id() const
Returns the Snapshot ID.
Definition: snapshot.h:55
Contains all the Cloud Pub/Sub C++ client types and functions.
Definition: ack_handler.h:25
The namespace Google Cloud Platform C++ client libraries.