Google Cloud Spanner C++ Client
1.32.0
A C++ Client Library for Google Cloud Spanner
backup.h
Go to the documentation of this file.
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
// http://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_SPANNER_BACKUP_H
16
#
define
GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_BACKUP_H
17
18
#
include
"google/cloud/spanner/instance.h"
19
#
include
"google/cloud/spanner/version.h"
20
#
include
"google/cloud/status_or.h"
21
#
include
<
iosfwd
>
22
#
include
<
string
>
23
24
namespace
google
{
25
namespace
cloud
{
26
namespace
spanner
{
27
inline
namespace
SPANNER_CLIENT_NS
{
28
29
/**
30
* This class identifies a Cloud Spanner Backup.
31
*
32
* A Cloud Spanner backup is identified by an `Instance` and a `backup_id`.
33
*
34
* @note This class makes no effort to validate the components of the
35
* backup name. It is the application's responsibility to provide valid
36
* project, instance, and backup ids. Passing invalid values will not be
37
* checked until the backup name is used in a RPC to spanner.
38
*/
39
class
Backup
{
40
public
:
41
/*
42
* Constructs a Backup object identified by the given @p instance and
43
* @p backup_id.
44
*/
45
Backup
(
Instance
instance, std::string backup_id);
46
47
/// @name Copy and move
48
//@{
49
Backup
(
Backup
const
&) =
default
;
50
Backup
&
operator
=(
Backup
const
&) =
default
;
51
Backup
(
Backup
&&) =
default
;
52
Backup
&
operator
=(
Backup
&&) =
default
;
53
//@}
54
55
/// Returns the `Instance` containing this backup.
56
Instance
const
&
instance
()
const
{
return
instance_; }
57
58
/// Returns the Backup ID.
59
std::string
const
&
backup_id
()
const
{
return
backup_id_; }
60
61
/**
62
* Returns the fully qualified backup name as a string of the form:
63
* "projects/<project-id>/instances/<instance-id>/backups/<backup-id>"
64
*/
65
std::string
FullName
()
const
;
66
67
/// @name Equality operators
68
//@{
69
friend
bool
operator
==(
Backup
const
& a,
Backup
const
& b);
70
friend
bool
operator
!=(
Backup
const
& a,
Backup
const
& b);
71
//@}
72
73
/// Output the `FullName()` format.
74
friend
std::ostream& operator<<(std::ostream&,
Backup
const
&);
75
76
private
:
77
Instance
instance_;
78
std::string backup_id_;
79
};
80
81
/**
82
* Constructs a `Backup` from the given @p full_name.
83
* Returns a non-OK Status if `full_name` is improperly formed.
84
*/
85
StatusOr<
Backup
>
MakeBackup
(std::string
const
& full_name);
86
87
}
// namespace SPANNER_CLIENT_NS
88
}
// namespace spanner
89
}
// namespace cloud
90
}
// namespace google
91
92
#
endif
// GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_BACKUP_H
Generated on Wed Oct 6 2021 01:08:34 for Google Cloud Spanner C++ Client by
1.9.1