Skip to main content

gcp_client/google/spanner/admin/database/
v1.rs

1/// Encapsulates progress related information for a Cloud Spanner long
2/// running operation.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct OperationProgress {
5    /// Percent completion of the operation.
6    /// Values are between 0 and 100 inclusive.
7    #[prost(int32, tag="1")]
8    pub progress_percent: i32,
9    /// Time the request was received.
10    #[prost(message, optional, tag="2")]
11    pub start_time: ::std::option::Option<::prost_types::Timestamp>,
12    /// If set, the time at which this operation failed or was completed
13    /// successfully.
14    #[prost(message, optional, tag="3")]
15    pub end_time: ::std::option::Option<::prost_types::Timestamp>,
16}
17/// A backup of a Cloud Spanner database.
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct Backup {
20    /// Required for the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] operation.
21    /// Name of the database from which this backup was
22    /// created. This needs to be in the same instance as the backup.
23    /// Values are of the form
24    /// `projects/<project>/instances/<instance>/databases/<database>`.
25    #[prost(string, tag="2")]
26    pub database: std::string::String,
27    /// Required for the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
28    /// operation. The expiration time of the backup, with microseconds
29    /// granularity that must be at least 6 hours and at most 366 days
30    /// from the time the CreateBackup request is processed. Once the `expire_time`
31    /// has passed, the backup is eligible to be automatically deleted by Cloud
32    /// Spanner to free the resources used by the backup.
33    #[prost(message, optional, tag="3")]
34    pub expire_time: ::std::option::Option<::prost_types::Timestamp>,
35    /// Output only for the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] operation.
36    /// Required for the [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] operation.
37    ///
38    /// A globally unique identifier for the backup which cannot be
39    /// changed. Values are of the form
40    /// `projects/<project>/instances/<instance>/backups/[a-z][a-z0-9_\-]*[a-z0-9]`
41    /// The final segment of the name must be between 2 and 60 characters
42    /// in length.
43    ///
44    /// The backup is stored in the location(s) specified in the instance
45    /// configuration of the instance containing the backup, identified
46    /// by the prefix of the backup name of the form
47    /// `projects/<project>/instances/<instance>`.
48    #[prost(string, tag="1")]
49    pub name: std::string::String,
50    /// Output only. The backup will contain an externally consistent
51    /// copy of the database at the timestamp specified by
52    /// `create_time`. `create_time` is approximately the time the
53    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] request is received.
54    #[prost(message, optional, tag="4")]
55    pub create_time: ::std::option::Option<::prost_types::Timestamp>,
56    /// Output only. Size of the backup in bytes.
57    #[prost(int64, tag="5")]
58    pub size_bytes: i64,
59    /// Output only. The current state of the backup.
60    #[prost(enumeration="backup::State", tag="6")]
61    pub state: i32,
62    /// Output only. The names of the restored databases that reference the backup.
63    /// The database names are of
64    /// the form `projects/<project>/instances/<instance>/databases/<database>`.
65    /// Referencing databases may exist in different instances. The existence of
66    /// any referencing database prevents the backup from being deleted. When a
67    /// restored database from the backup enters the `READY` state, the reference
68    /// to the backup is removed.
69    #[prost(string, repeated, tag="7")]
70    pub referencing_databases: ::std::vec::Vec<std::string::String>,
71}
72pub mod backup {
73    /// Indicates the current state of the backup.
74    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
75    #[repr(i32)]
76    pub enum State {
77        /// Not specified.
78        Unspecified = 0,
79        /// The pending backup is still being created. Operations on the
80        /// backup may fail with `FAILED_PRECONDITION` in this state.
81        Creating = 1,
82        /// The backup is complete and ready for use.
83        Ready = 2,
84    }
85}
86/// The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct CreateBackupRequest {
89    /// Required. The name of the instance in which the backup will be
90    /// created. This must be the same instance that contains the database the
91    /// backup will be created from. The backup will be stored in the
92    /// location(s) specified in the instance configuration of this
93    /// instance. Values are of the form
94    /// `projects/<project>/instances/<instance>`.
95    #[prost(string, tag="1")]
96    pub parent: std::string::String,
97    /// Required. The id of the backup to be created. The `backup_id` appended to
98    /// `parent` forms the full backup name of the form
99    /// `projects/<project>/instances/<instance>/backups/<backup_id>`.
100    #[prost(string, tag="2")]
101    pub backup_id: std::string::String,
102    /// Required. The backup to create.
103    #[prost(message, optional, tag="3")]
104    pub backup: ::std::option::Option<Backup>,
105}
106/// Metadata type for the operation returned by
107/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
108#[derive(Clone, PartialEq, ::prost::Message)]
109pub struct CreateBackupMetadata {
110    /// The name of the backup being created.
111    #[prost(string, tag="1")]
112    pub name: std::string::String,
113    /// The name of the database the backup is created from.
114    #[prost(string, tag="2")]
115    pub database: std::string::String,
116    /// The progress of the
117    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] operation.
118    #[prost(message, optional, tag="3")]
119    pub progress: ::std::option::Option<OperationProgress>,
120    /// The time at which cancellation of this operation was received.
121    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
122    /// starts asynchronous cancellation on a long-running operation. The server
123    /// makes a best effort to cancel the operation, but success is not guaranteed.
124    /// Clients can use
125    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
126    /// other methods to check whether the cancellation succeeded or whether the
127    /// operation completed despite cancellation. On successful cancellation,
128    /// the operation is not deleted; instead, it becomes an operation with
129    /// an [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
130    /// corresponding to `Code.CANCELLED`.
131    #[prost(message, optional, tag="4")]
132    pub cancel_time: ::std::option::Option<::prost_types::Timestamp>,
133}
134/// The request for [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].
135#[derive(Clone, PartialEq, ::prost::Message)]
136pub struct UpdateBackupRequest {
137    /// Required. The backup to update. `backup.name`, and the fields to be updated
138    /// as specified by `update_mask` are required. Other fields are ignored.
139    /// Update is only supported for the following fields:
140    ///  * `backup.expire_time`.
141    #[prost(message, optional, tag="1")]
142    pub backup: ::std::option::Option<Backup>,
143    /// Required. A mask specifying which fields (e.g. `expire_time`) in the
144    /// Backup resource should be updated. This mask is relative to the Backup
145    /// resource, not to the request message. The field mask must always be
146    /// specified; this prevents any future fields from being erased accidentally
147    /// by clients that do not know about them.
148    #[prost(message, optional, tag="2")]
149    pub update_mask: ::std::option::Option<::prost_types::FieldMask>,
150}
151/// The request for [GetBackup][google.spanner.admin.database.v1.DatabaseAdmin.GetBackup].
152#[derive(Clone, PartialEq, ::prost::Message)]
153pub struct GetBackupRequest {
154    /// Required. Name of the backup.
155    /// Values are of the form
156    /// `projects/<project>/instances/<instance>/backups/<backup>`.
157    #[prost(string, tag="1")]
158    pub name: std::string::String,
159}
160/// The request for [DeleteBackup][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup].
161#[derive(Clone, PartialEq, ::prost::Message)]
162pub struct DeleteBackupRequest {
163    /// Required. Name of the backup to delete.
164    /// Values are of the form
165    /// `projects/<project>/instances/<instance>/backups/<backup>`.
166    #[prost(string, tag="1")]
167    pub name: std::string::String,
168}
169/// The request for [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
170#[derive(Clone, PartialEq, ::prost::Message)]
171pub struct ListBackupsRequest {
172    /// Required. The instance to list backups from.  Values are of the
173    /// form `projects/<project>/instances/<instance>`.
174    #[prost(string, tag="1")]
175    pub parent: std::string::String,
176    /// An expression that filters the list of returned backups.
177    ///
178    /// A filter expression consists of a field name, a comparison operator, and a
179    /// value for filtering.
180    /// The value must be a string, a number, or a boolean. The comparison operator
181    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
182    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
183    ///
184    /// The following fields in the [Backup][google.spanner.admin.database.v1.Backup] are eligible for filtering:
185    ///
186    ///   * `name`
187    ///   * `database`
188    ///   * `state`
189    ///   * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
190    ///   * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
191    ///   * `size_bytes`
192    ///
193    /// You can combine multiple expressions by enclosing each expression in
194    /// parentheses. By default, expressions are combined with AND logic, but
195    /// you can specify AND, OR, and NOT logic explicitly.
196    ///
197    /// Here are a few examples:
198    ///
199    ///   * `name:Howl` - The backup's name contains the string "howl".
200    ///   * `database:prod`
201    ///          - The database's name contains the string "prod".
202    ///   * `state:CREATING` - The backup is pending creation.
203    ///   * `state:READY` - The backup is fully created and ready for use.
204    ///   * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
205    ///          - The backup name contains the string "howl" and `create_time`
206    ///              of the backup is before 2018-03-28T14:50:00Z.
207    ///   * `expire_time < \"2018-03-28T14:50:00Z\"`
208    ///          - The backup `expire_time` is before 2018-03-28T14:50:00Z.
209    ///   * `size_bytes > 10000000000` - The backup's size is greater than 10GB
210    #[prost(string, tag="2")]
211    pub filter: std::string::String,
212    /// Number of backups to be returned in the response. If 0 or
213    /// less, defaults to the server's maximum allowed page size.
214    #[prost(int32, tag="3")]
215    pub page_size: i32,
216    /// If non-empty, `page_token` should contain a
217    /// [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] from a
218    /// previous [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] to the same `parent` and with the same
219    /// `filter`.
220    #[prost(string, tag="4")]
221    pub page_token: std::string::String,
222}
223/// The response for [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
224#[derive(Clone, PartialEq, ::prost::Message)]
225pub struct ListBackupsResponse {
226    /// The list of matching backups. Backups returned are ordered by `create_time`
227    /// in descending order, starting from the most recent `create_time`.
228    #[prost(message, repeated, tag="1")]
229    pub backups: ::std::vec::Vec<Backup>,
230    /// `next_page_token` can be sent in a subsequent
231    /// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] call to fetch more
232    /// of the matching backups.
233    #[prost(string, tag="2")]
234    pub next_page_token: std::string::String,
235}
236/// The request for
237/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
238#[derive(Clone, PartialEq, ::prost::Message)]
239pub struct ListBackupOperationsRequest {
240    /// Required. The instance of the backup operations. Values are of
241    /// the form `projects/<project>/instances/<instance>`.
242    #[prost(string, tag="1")]
243    pub parent: std::string::String,
244    /// An expression that filters the list of returned backup operations.
245    ///
246    /// A filter expression consists of a field name, a
247    /// comparison operator, and a value for filtering.
248    /// The value must be a string, a number, or a boolean. The comparison operator
249    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
250    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
251    ///
252    /// The following fields in the [operation][google.longrunning.Operation]
253    /// are eligible for filtering:
254    ///
255    ///   * `name` - The name of the long-running operation
256    ///   * `done` - False if the operation is in progress, else true.
257    ///   * `metadata.@type` - the type of metadata. For example, the type string
258    ///      for [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] is
259    ///      `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
260    ///   * `metadata.<field_name>` - any field in metadata.value.
261    ///   * `error` - Error associated with the long-running operation.
262    ///   * `response.@type` - the type of response.
263    ///   * `response.<field_name>` - any field in response.value.
264    ///
265    /// You can combine multiple expressions by enclosing each expression in
266    /// parentheses. By default, expressions are combined with AND logic, but
267    /// you can specify AND, OR, and NOT logic explicitly.
268    ///
269    /// Here are a few examples:
270    ///
271    ///   * `done:true` - The operation is complete.
272    ///   * `metadata.database:prod` - The database the backup was taken from has
273    ///      a name containing the string "prod".
274    ///   * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` <br/>
275    ///     `(metadata.name:howl) AND` <br/>
276    ///     `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` <br/>
277    ///     `(error:*)` - Returns operations where:
278    ///     * The operation's metadata type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
279    ///     * The backup name contains the string "howl".
280    ///     * The operation started before 2018-03-28T14:50:00Z.
281    ///     * The operation resulted in an error.
282    #[prost(string, tag="2")]
283    pub filter: std::string::String,
284    /// Number of operations to be returned in the response. If 0 or
285    /// less, defaults to the server's maximum allowed page size.
286    #[prost(int32, tag="3")]
287    pub page_size: i32,
288    /// If non-empty, `page_token` should contain a
289    /// [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token]
290    /// from a previous [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] to the
291    /// same `parent` and with the same `filter`.
292    #[prost(string, tag="4")]
293    pub page_token: std::string::String,
294}
295/// The response for
296/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
297#[derive(Clone, PartialEq, ::prost::Message)]
298pub struct ListBackupOperationsResponse {
299    /// The list of matching backup [long-running
300    /// operations][google.longrunning.Operation]. Each operation's name will be
301    /// prefixed by the backup's name and the operation's
302    /// [metadata][google.longrunning.Operation.metadata] will be of type
303    /// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. Operations returned include those that are
304    /// pending or have completed/failed/canceled within the last 7 days.
305    /// Operations returned are ordered by
306    /// `operation.metadata.value.progress.start_time` in descending order starting
307    /// from the most recently started operation.
308    #[prost(message, repeated, tag="1")]
309    pub operations: ::std::vec::Vec<super::super::super::super::longrunning::Operation>,
310    /// `next_page_token` can be sent in a subsequent
311    /// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]
312    /// call to fetch more of the matching metadata.
313    #[prost(string, tag="2")]
314    pub next_page_token: std::string::String,
315}
316/// Information about a backup.
317#[derive(Clone, PartialEq, ::prost::Message)]
318pub struct BackupInfo {
319    /// Name of the backup.
320    #[prost(string, tag="1")]
321    pub backup: std::string::String,
322    /// The backup contains an externally consistent copy of `source_database` at
323    /// the timestamp specified by `create_time`.
324    #[prost(message, optional, tag="2")]
325    pub create_time: ::std::option::Option<::prost_types::Timestamp>,
326    /// Name of the database the backup was created from.
327    #[prost(string, tag="3")]
328    pub source_database: std::string::String,
329}
330/// Information about the database restore.
331#[derive(Clone, PartialEq, ::prost::Message)]
332pub struct RestoreInfo {
333    /// The type of the restore source.
334    #[prost(enumeration="RestoreSourceType", tag="1")]
335    pub source_type: i32,
336    /// Information about the source used to restore the database.
337    #[prost(oneof="restore_info::SourceInfo", tags="2")]
338    pub source_info: ::std::option::Option<restore_info::SourceInfo>,
339}
340pub mod restore_info {
341    /// Information about the source used to restore the database.
342    #[derive(Clone, PartialEq, ::prost::Oneof)]
343    pub enum SourceInfo {
344        /// Information about the backup used to restore the database. The backup
345        /// may no longer exist.
346        #[prost(message, tag="2")]
347        BackupInfo(super::BackupInfo),
348    }
349}
350/// A Cloud Spanner database.
351#[derive(Clone, PartialEq, ::prost::Message)]
352pub struct Database {
353    /// Required. The name of the database. Values are of the form
354    /// `projects/<project>/instances/<instance>/databases/<database>`,
355    /// where `<database>` is as specified in the `CREATE DATABASE`
356    /// statement. This name can be passed to other API methods to
357    /// identify the database.
358    #[prost(string, tag="1")]
359    pub name: std::string::String,
360    /// Output only. The current database state.
361    #[prost(enumeration="database::State", tag="2")]
362    pub state: i32,
363    /// Output only. If exists, the time at which the database creation started.
364    #[prost(message, optional, tag="3")]
365    pub create_time: ::std::option::Option<::prost_types::Timestamp>,
366    /// Output only. Applicable only for restored databases. Contains information
367    /// about the restore source.
368    #[prost(message, optional, tag="4")]
369    pub restore_info: ::std::option::Option<RestoreInfo>,
370}
371pub mod database {
372    /// Indicates the current state of the database.
373    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
374    #[repr(i32)]
375    pub enum State {
376        /// Not specified.
377        Unspecified = 0,
378        /// The database is still being created. Operations on the database may fail
379        /// with `FAILED_PRECONDITION` in this state.
380        Creating = 1,
381        /// The database is fully created and ready for use.
382        Ready = 2,
383        /// The database is fully created and ready for use, but is still
384        /// being optimized for performance and cannot handle full load.
385        ///
386        /// In this state, the database still references the backup
387        /// it was restore from, preventing the backup
388        /// from being deleted. When optimizations are complete, the full performance
389        /// of the database will be restored, and the database will transition to
390        /// `READY` state.
391        ReadyOptimizing = 3,
392    }
393}
394/// The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
395#[derive(Clone, PartialEq, ::prost::Message)]
396pub struct ListDatabasesRequest {
397    /// Required. The instance whose databases should be listed.
398    /// Values are of the form `projects/<project>/instances/<instance>`.
399    #[prost(string, tag="1")]
400    pub parent: std::string::String,
401    /// Number of databases to be returned in the response. If 0 or less,
402    /// defaults to the server's maximum allowed page size.
403    #[prost(int32, tag="3")]
404    pub page_size: i32,
405    /// If non-empty, `page_token` should contain a
406    /// [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] from a
407    /// previous [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].
408    #[prost(string, tag="4")]
409    pub page_token: std::string::String,
410}
411/// The response for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
412#[derive(Clone, PartialEq, ::prost::Message)]
413pub struct ListDatabasesResponse {
414    /// Databases that matched the request.
415    #[prost(message, repeated, tag="1")]
416    pub databases: ::std::vec::Vec<Database>,
417    /// `next_page_token` can be sent in a subsequent
418    /// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] call to fetch more
419    /// of the matching databases.
420    #[prost(string, tag="2")]
421    pub next_page_token: std::string::String,
422}
423/// The request for [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
424#[derive(Clone, PartialEq, ::prost::Message)]
425pub struct CreateDatabaseRequest {
426    /// Required. The name of the instance that will serve the new database.
427    /// Values are of the form `projects/<project>/instances/<instance>`.
428    #[prost(string, tag="1")]
429    pub parent: std::string::String,
430    /// Required. A `CREATE DATABASE` statement, which specifies the ID of the
431    /// new database.  The database ID must conform to the regular expression
432    /// `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length.
433    /// If the database ID is a reserved word or if it contains a hyphen, the
434    /// database ID must be enclosed in backticks (`` ` ``).
435    #[prost(string, tag="2")]
436    pub create_statement: std::string::String,
437    /// Optional. A list of DDL statements to run inside the newly created
438    /// database. Statements can create tables, indexes, etc. These
439    /// statements execute atomically with the creation of the database:
440    /// if there is an error in any statement, the database is not created.
441    #[prost(string, repeated, tag="3")]
442    pub extra_statements: ::std::vec::Vec<std::string::String>,
443}
444/// Metadata type for the operation returned by
445/// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
446#[derive(Clone, PartialEq, ::prost::Message)]
447pub struct CreateDatabaseMetadata {
448    /// The database being created.
449    #[prost(string, tag="1")]
450    pub database: std::string::String,
451}
452/// The request for [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
453#[derive(Clone, PartialEq, ::prost::Message)]
454pub struct GetDatabaseRequest {
455    /// Required. The name of the requested database. Values are of the form
456    /// `projects/<project>/instances/<instance>/databases/<database>`.
457    #[prost(string, tag="1")]
458    pub name: std::string::String,
459}
460/// Enqueues the given DDL statements to be applied, in order but not
461/// necessarily all at once, to the database schema at some point (or
462/// points) in the future. The server checks that the statements
463/// are executable (syntactically valid, name tables that exist, etc.)
464/// before enqueueing them, but they may still fail upon
465/// later execution (e.g., if a statement from another batch of
466/// statements is applied first and it conflicts in some way, or if
467/// there is some data-related problem like a `NULL` value in a column to
468/// which `NOT NULL` would be added). If a statement fails, all
469/// subsequent statements in the batch are automatically cancelled.
470///
471/// Each batch of statements is assigned a name which can be used with
472/// the [Operations][google.longrunning.Operations] API to monitor
473/// progress. See the
474/// [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] field for more
475/// details.
476#[derive(Clone, PartialEq, ::prost::Message)]
477pub struct UpdateDatabaseDdlRequest {
478    /// Required. The database to update.
479    #[prost(string, tag="1")]
480    pub database: std::string::String,
481    /// Required. DDL statements to be applied to the database.
482    #[prost(string, repeated, tag="2")]
483    pub statements: ::std::vec::Vec<std::string::String>,
484    /// If empty, the new update request is assigned an
485    /// automatically-generated operation ID. Otherwise, `operation_id`
486    /// is used to construct the name of the resulting
487    /// [Operation][google.longrunning.Operation].
488    ///
489    /// Specifying an explicit operation ID simplifies determining
490    /// whether the statements were executed in the event that the
491    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] call is replayed,
492    /// or the return value is otherwise lost: the [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] and
493    /// `operation_id` fields can be combined to form the
494    /// [name][google.longrunning.Operation.name] of the resulting
495    /// [longrunning.Operation][google.longrunning.Operation]: `<database>/operations/<operation_id>`.
496    ///
497    /// `operation_id` should be unique within the database, and must be
498    /// a valid identifier: `[a-z][a-z0-9_]*`. Note that
499    /// automatically-generated operation IDs always begin with an
500    /// underscore. If the named operation already exists,
501    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns
502    /// `ALREADY_EXISTS`.
503    #[prost(string, tag="3")]
504    pub operation_id: std::string::String,
505}
506/// Metadata type for the operation returned by
507/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
508#[derive(Clone, PartialEq, ::prost::Message)]
509pub struct UpdateDatabaseDdlMetadata {
510    /// The database being modified.
511    #[prost(string, tag="1")]
512    pub database: std::string::String,
513    /// For an update this list contains all the statements. For an
514    /// individual statement, this list contains only that statement.
515    #[prost(string, repeated, tag="2")]
516    pub statements: ::std::vec::Vec<std::string::String>,
517    /// Reports the commit timestamps of all statements that have
518    /// succeeded so far, where `commit_timestamps[i]` is the commit
519    /// timestamp for the statement `statements[i]`.
520    #[prost(message, repeated, tag="3")]
521    pub commit_timestamps: ::std::vec::Vec<::prost_types::Timestamp>,
522}
523/// The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
524#[derive(Clone, PartialEq, ::prost::Message)]
525pub struct DropDatabaseRequest {
526    /// Required. The database to be dropped.
527    #[prost(string, tag="1")]
528    pub database: std::string::String,
529}
530/// The request for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
531#[derive(Clone, PartialEq, ::prost::Message)]
532pub struct GetDatabaseDdlRequest {
533    /// Required. The database whose schema we wish to get.
534    #[prost(string, tag="1")]
535    pub database: std::string::String,
536}
537/// The response for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
538#[derive(Clone, PartialEq, ::prost::Message)]
539pub struct GetDatabaseDdlResponse {
540    /// A list of formatted DDL statements defining the schema of the database
541    /// specified in the request.
542    #[prost(string, repeated, tag="1")]
543    pub statements: ::std::vec::Vec<std::string::String>,
544}
545/// The request for
546/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
547#[derive(Clone, PartialEq, ::prost::Message)]
548pub struct ListDatabaseOperationsRequest {
549    /// Required. The instance of the database operations.
550    /// Values are of the form `projects/<project>/instances/<instance>`.
551    #[prost(string, tag="1")]
552    pub parent: std::string::String,
553    /// An expression that filters the list of returned operations.
554    ///
555    /// A filter expression consists of a field name, a
556    /// comparison operator, and a value for filtering.
557    /// The value must be a string, a number, or a boolean. The comparison operator
558    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
559    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
560    ///
561    /// The following fields in the [Operation][google.longrunning.Operation]
562    /// are eligible for filtering:
563    ///
564    ///   * `name` - The name of the long-running operation
565    ///   * `done` - False if the operation is in progress, else true.
566    ///   * `metadata.@type` - the type of metadata. For example, the type string
567    ///      for [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] is
568    ///      `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
569    ///   * `metadata.<field_name>` - any field in metadata.value.
570    ///   * `error` - Error associated with the long-running operation.
571    ///   * `response.@type` - the type of response.
572    ///   * `response.<field_name>` - any field in response.value.
573    ///
574    /// You can combine multiple expressions by enclosing each expression in
575    /// parentheses. By default, expressions are combined with AND logic. However,
576    /// you can specify AND, OR, and NOT logic explicitly.
577    ///
578    /// Here are a few examples:
579    ///
580    ///   * `done:true` - The operation is complete.
581    ///   * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` <br/>
582    ///     `(metadata.source_type:BACKUP) AND` <br/>
583    ///     `(metadata.backup_info.backup:backup_howl) AND` <br/>
584    ///     `(metadata.name:restored_howl) AND` <br/>
585    ///     `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` <br/>
586    ///     `(error:*)` - Return operations where:
587    ///     * The operation's metadata type is [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
588    ///     * The database is restored from a backup.
589    ///     * The backup name contains "backup_howl".
590    ///     * The restored database's name contains "restored_howl".
591    ///     * The operation started before 2018-03-28T14:50:00Z.
592    ///     * The operation resulted in an error.
593    #[prost(string, tag="2")]
594    pub filter: std::string::String,
595    /// Number of operations to be returned in the response. If 0 or
596    /// less, defaults to the server's maximum allowed page size.
597    #[prost(int32, tag="3")]
598    pub page_size: i32,
599    /// If non-empty, `page_token` should contain a
600    /// [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]
601    /// from a previous [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] to the
602    /// same `parent` and with the same `filter`.
603    #[prost(string, tag="4")]
604    pub page_token: std::string::String,
605}
606/// The response for
607/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
608#[derive(Clone, PartialEq, ::prost::Message)]
609pub struct ListDatabaseOperationsResponse {
610    /// The list of matching database [long-running
611    /// operations][google.longrunning.Operation]. Each operation's name will be
612    /// prefixed by the database's name. The operation's
613    /// [metadata][google.longrunning.Operation.metadata] field type
614    /// `metadata.type_url` describes the type of the metadata.
615    #[prost(message, repeated, tag="1")]
616    pub operations: ::std::vec::Vec<super::super::super::super::longrunning::Operation>,
617    /// `next_page_token` can be sent in a subsequent
618    /// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]
619    /// call to fetch more of the matching metadata.
620    #[prost(string, tag="2")]
621    pub next_page_token: std::string::String,
622}
623/// The request for
624/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
625#[derive(Clone, PartialEq, ::prost::Message)]
626pub struct RestoreDatabaseRequest {
627    /// Required. The name of the instance in which to create the
628    /// restored database. This instance must be in the same project and
629    /// have the same instance configuration as the instance containing
630    /// the source backup. Values are of the form
631    /// `projects/<project>/instances/<instance>`.
632    #[prost(string, tag="1")]
633    pub parent: std::string::String,
634    /// Required. The id of the database to create and restore to. This
635    /// database must not already exist. The `database_id` appended to
636    /// `parent` forms the full database name of the form
637    /// `projects/<project>/instances/<instance>/databases/<database_id>`.
638    #[prost(string, tag="2")]
639    pub database_id: std::string::String,
640    /// Required. The source from which to restore.
641    #[prost(oneof="restore_database_request::Source", tags="3")]
642    pub source: ::std::option::Option<restore_database_request::Source>,
643}
644pub mod restore_database_request {
645    /// Required. The source from which to restore.
646    #[derive(Clone, PartialEq, ::prost::Oneof)]
647    pub enum Source {
648        /// Name of the backup from which to restore.  Values are of the form
649        /// `projects/<project>/instances/<instance>/backups/<backup>`.
650        #[prost(string, tag="3")]
651        Backup(std::string::String),
652    }
653}
654/// Metadata type for the long-running operation returned by
655/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
656#[derive(Clone, PartialEq, ::prost::Message)]
657pub struct RestoreDatabaseMetadata {
658    /// Name of the database being created and restored to.
659    #[prost(string, tag="1")]
660    pub name: std::string::String,
661    /// The type of the restore source.
662    #[prost(enumeration="RestoreSourceType", tag="2")]
663    pub source_type: i32,
664    /// The progress of the
665    /// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]
666    /// operation.
667    #[prost(message, optional, tag="4")]
668    pub progress: ::std::option::Option<OperationProgress>,
669    /// The time at which cancellation of this operation was received.
670    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
671    /// starts asynchronous cancellation on a long-running operation. The server
672    /// makes a best effort to cancel the operation, but success is not guaranteed.
673    /// Clients can use
674    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
675    /// other methods to check whether the cancellation succeeded or whether the
676    /// operation completed despite cancellation. On successful cancellation,
677    /// the operation is not deleted; instead, it becomes an operation with
678    /// an [Operation.error][google.longrunning.Operation.error] value with a
679    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to `Code.CANCELLED`.
680    #[prost(message, optional, tag="5")]
681    pub cancel_time: ::std::option::Option<::prost_types::Timestamp>,
682    /// If exists, the name of the long-running operation that will be used to
683    /// track the post-restore optimization process to optimize the performance of
684    /// the restored database, and remove the dependency on the restore source.
685    /// The name is of the form
686    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`
687    /// where the <database> is the name of database being created and restored to.
688    /// The metadata type of the  long-running operation is
689    /// [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. This long-running operation will be
690    /// automatically created by the system after the RestoreDatabase long-running
691    /// operation completes successfully. This operation will not be created if the
692    /// restore was not successful.
693    #[prost(string, tag="6")]
694    pub optimize_database_operation_name: std::string::String,
695    /// Information about the source used to restore the database, as specified by
696    /// `source` in [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
697    #[prost(oneof="restore_database_metadata::SourceInfo", tags="3")]
698    pub source_info: ::std::option::Option<restore_database_metadata::SourceInfo>,
699}
700pub mod restore_database_metadata {
701    /// Information about the source used to restore the database, as specified by
702    /// `source` in [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
703    #[derive(Clone, PartialEq, ::prost::Oneof)]
704    pub enum SourceInfo {
705        /// Information about the backup used to restore the database.
706        #[prost(message, tag="3")]
707        BackupInfo(super::BackupInfo),
708    }
709}
710/// Metadata type for the long-running operation used to track the progress
711/// of optimizations performed on a newly restored database. This long-running
712/// operation is automatically created by the system after the successful
713/// completion of a database restore, and cannot be cancelled.
714#[derive(Clone, PartialEq, ::prost::Message)]
715pub struct OptimizeRestoredDatabaseMetadata {
716    /// Name of the restored database being optimized.
717    #[prost(string, tag="1")]
718    pub name: std::string::String,
719    /// The progress of the post-restore optimizations.
720    #[prost(message, optional, tag="2")]
721    pub progress: ::std::option::Option<OperationProgress>,
722}
723/// Indicates the type of the restore source.
724#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
725#[repr(i32)]
726pub enum RestoreSourceType {
727    /// No restore associated.
728    TypeUnspecified = 0,
729    /// A backup was used as the source of the restore.
730    Backup = 1,
731}
732# [ doc = r" Generated client implementations." ] pub mod database_admin_client { # ! [ allow ( unused_variables , dead_code , missing_docs ) ] use tonic :: codegen :: * ; # [ doc = " Cloud Spanner Database Admin API" ] # [ doc = "" ] # [ doc = " The Cloud Spanner Database Admin API can be used to create, drop, and" ] # [ doc = " list databases. It also enables updating the schema of pre-existing" ] # [ doc = " databases. It can be also used to create, delete and list backups for a" ] # [ doc = " database and to restore from an existing backup." ] pub struct DatabaseAdminClient < T > { inner : tonic :: client :: Grpc < T > , } impl < T > DatabaseAdminClient < T > where T : tonic :: client :: GrpcService < tonic :: body :: BoxBody > , T :: ResponseBody : Body + HttpBody + Send + 'static , T :: Error : Into < StdError > , < T :: ResponseBody as HttpBody > :: Error : Into < StdError > + Send , { pub fn new ( inner : T ) -> Self { let inner = tonic :: client :: Grpc :: new ( inner ) ; Self { inner } } pub fn with_interceptor ( inner : T , interceptor : impl Into < tonic :: Interceptor > ) -> Self { let inner = tonic :: client :: Grpc :: with_interceptor ( inner , interceptor ) ; Self { inner } } # [ doc = " Lists Cloud Spanner databases." ] pub async fn list_databases ( & mut self , request : impl tonic :: IntoRequest < super :: ListDatabasesRequest > , ) -> Result < tonic :: Response < super :: ListDatabasesResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Creates a new Cloud Spanner database and starts to prepare it for serving." ] # [ doc = " The returned [long-running operation][google.longrunning.Operation] will" ] # [ doc = " have a name of the format `<database_name>/operations/<operation_id>` and" ] # [ doc = " can be used to track preparation of the database. The" ] # [ doc = " [metadata][google.longrunning.Operation.metadata] field type is" ] # [ doc = " [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The" ] # [ doc = " [response][google.longrunning.Operation.response] field type is" ] # [ doc = " [Database][google.spanner.admin.database.v1.Database], if successful." ] pub async fn create_database ( & mut self , request : impl tonic :: IntoRequest < super :: CreateDatabaseRequest > , ) -> Result < tonic :: Response < super :: super :: super :: super :: super :: longrunning :: Operation > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Gets the state of a Cloud Spanner database." ] pub async fn get_database ( & mut self , request : impl tonic :: IntoRequest < super :: GetDatabaseRequest > , ) -> Result < tonic :: Response < super :: Database > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Updates the schema of a Cloud Spanner database by" ] # [ doc = " creating/altering/dropping tables, columns, indexes, etc. The returned" ] # [ doc = " [long-running operation][google.longrunning.Operation] will have a name of" ] # [ doc = " the format `<database_name>/operations/<operation_id>` and can be used to" ] # [ doc = " track execution of the schema change(s). The" ] # [ doc = " [metadata][google.longrunning.Operation.metadata] field type is" ] # [ doc = " [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata].  The operation has no response." ] pub async fn update_database_ddl ( & mut self , request : impl tonic :: IntoRequest < super :: UpdateDatabaseDdlRequest > , ) -> Result < tonic :: Response < super :: super :: super :: super :: super :: longrunning :: Operation > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Drops (aka deletes) a Cloud Spanner database." ] # [ doc = " Completed backups for the database will be retained according to their" ] # [ doc = " `expire_time`." ] pub async fn drop_database ( & mut self , request : impl tonic :: IntoRequest < super :: DropDatabaseRequest > , ) -> Result < tonic :: Response < ( ) > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Returns the schema of a Cloud Spanner database as a list of formatted" ] # [ doc = " DDL statements. This method does not show pending schema updates, those may" ] # [ doc = " be queried using the [Operations][google.longrunning.Operations] API." ] pub async fn get_database_ddl ( & mut self , request : impl tonic :: IntoRequest < super :: GetDatabaseDdlRequest > , ) -> Result < tonic :: Response < super :: GetDatabaseDdlResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Sets the access control policy on a database or backup resource." ] # [ doc = " Replaces any existing policy." ] # [ doc = "" ] # [ doc = " Authorization requires `spanner.databases.setIamPolicy`" ] # [ doc = " permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]." ] # [ doc = " For backups, authorization requires `spanner.backups.setIamPolicy`" ] # [ doc = " permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]." ] pub async fn set_iam_policy ( & mut self , request : impl tonic :: IntoRequest < super :: super :: super :: super :: super :: iam :: v1 :: SetIamPolicyRequest > , ) -> Result < tonic :: Response < super :: super :: super :: super :: super :: iam :: v1 :: Policy > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Gets the access control policy for a database or backup resource." ] # [ doc = " Returns an empty policy if a database or backup exists but does not have a" ] # [ doc = " policy set." ] # [ doc = "" ] # [ doc = " Authorization requires `spanner.databases.getIamPolicy` permission on" ] # [ doc = " [resource][google.iam.v1.GetIamPolicyRequest.resource]." ] # [ doc = " For backups, authorization requires `spanner.backups.getIamPolicy`" ] # [ doc = " permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]." ] pub async fn get_iam_policy ( & mut self , request : impl tonic :: IntoRequest < super :: super :: super :: super :: super :: iam :: v1 :: GetIamPolicyRequest > , ) -> Result < tonic :: Response < super :: super :: super :: super :: super :: iam :: v1 :: Policy > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Returns permissions that the caller has on the specified database or backup" ] # [ doc = " resource." ] # [ doc = "" ] # [ doc = " Attempting this RPC on a non-existent Cloud Spanner database will" ] # [ doc = " result in a NOT_FOUND error if the user has" ] # [ doc = " `spanner.databases.list` permission on the containing Cloud" ] # [ doc = " Spanner instance. Otherwise returns an empty set of permissions." ] # [ doc = " Calling this method on a backup that does not exist will" ] # [ doc = " result in a NOT_FOUND error if the user has" ] # [ doc = " `spanner.backups.list` permission on the containing instance." ] pub async fn test_iam_permissions ( & mut self , request : impl tonic :: IntoRequest < super :: super :: super :: super :: super :: iam :: v1 :: TestIamPermissionsRequest > , ) -> Result < tonic :: Response < super :: super :: super :: super :: super :: iam :: v1 :: TestIamPermissionsResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Starts creating a new Cloud Spanner Backup." ] # [ doc = " The returned backup [long-running operation][google.longrunning.Operation]" ] # [ doc = " will have a name of the format" ] # [ doc = " `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`" ] # [ doc = " and can be used to track creation of the backup. The" ] # [ doc = " [metadata][google.longrunning.Operation.metadata] field type is" ] # [ doc = " [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The" ] # [ doc = " [response][google.longrunning.Operation.response] field type is" ] # [ doc = " [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the" ] # [ doc = " creation and delete the backup." ] # [ doc = " There can be only one pending backup creation per database. Backup creation" ] # [ doc = " of different databases can run concurrently." ] pub async fn create_backup ( & mut self , request : impl tonic :: IntoRequest < super :: CreateBackupRequest > , ) -> Result < tonic :: Response < super :: super :: super :: super :: super :: longrunning :: Operation > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup]." ] pub async fn get_backup ( & mut self , request : impl tonic :: IntoRequest < super :: GetBackupRequest > , ) -> Result < tonic :: Response < super :: Backup > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup]." ] pub async fn update_backup ( & mut self , request : impl tonic :: IntoRequest < super :: UpdateBackupRequest > , ) -> Result < tonic :: Response < super :: Backup > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup]." ] pub async fn delete_backup ( & mut self , request : impl tonic :: IntoRequest < super :: DeleteBackupRequest > , ) -> Result < tonic :: Response < ( ) > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Lists completed and pending backups." ] # [ doc = " Backups returned are ordered by `create_time` in descending order," ] # [ doc = " starting from the most recent `create_time`." ] pub async fn list_backups ( & mut self , request : impl tonic :: IntoRequest < super :: ListBackupsRequest > , ) -> Result < tonic :: Response < super :: ListBackupsResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Create a new database by restoring from a completed backup. The new" ] # [ doc = " database must be in the same project and in an instance with the same" ] # [ doc = " instance configuration as the instance containing" ] # [ doc = " the backup. The returned database [long-running" ] # [ doc = " operation][google.longrunning.Operation] has a name of the format" ] # [ doc = " `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`," ] # [ doc = " and can be used to track the progress of the operation, and to cancel it." ] # [ doc = " The [metadata][google.longrunning.Operation.metadata] field type is" ] # [ doc = " [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]." ] # [ doc = " The [response][google.longrunning.Operation.response] type" ] # [ doc = " is [Database][google.spanner.admin.database.v1.Database], if" ] # [ doc = " successful. Cancelling the returned operation will stop the restore and" ] # [ doc = " delete the database." ] # [ doc = " There can be only one database being restored into an instance at a time." ] # [ doc = " Once the restore operation completes, a new restore operation can be" ] # [ doc = " initiated, without waiting for the optimize operation associated with the" ] # [ doc = " first restore to complete." ] pub async fn restore_database ( & mut self , request : impl tonic :: IntoRequest < super :: RestoreDatabaseRequest > , ) -> Result < tonic :: Response < super :: super :: super :: super :: super :: longrunning :: Operation > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Lists database [longrunning-operations][google.longrunning.Operation]." ] # [ doc = " A database operation has a name of the form" ] # [ doc = " `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`." ] # [ doc = " The long-running operation" ] # [ doc = " [metadata][google.longrunning.Operation.metadata] field type" ] # [ doc = " `metadata.type_url` describes the type of the metadata. Operations returned" ] # [ doc = " include those that have completed/failed/canceled within the last 7 days," ] # [ doc = " and pending operations." ] pub async fn list_database_operations ( & mut self , request : impl tonic :: IntoRequest < super :: ListDatabaseOperationsRequest > , ) -> Result < tonic :: Response < super :: ListDatabaseOperationsResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Lists the backup [long-running operations][google.longrunning.Operation] in" ] # [ doc = " the given instance. A backup operation has a name of the form" ] # [ doc = " `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`." ] # [ doc = " The long-running operation" ] # [ doc = " [metadata][google.longrunning.Operation.metadata] field type" ] # [ doc = " `metadata.type_url` describes the type of the metadata. Operations returned" ] # [ doc = " include those that have completed/failed/canceled within the last 7 days," ] # [ doc = " and pending operations. Operations returned are ordered by" ] # [ doc = " `operation.metadata.value.progress.start_time` in descending order starting" ] # [ doc = " from the most recently started operation." ] pub async fn list_backup_operations ( & mut self , request : impl tonic :: IntoRequest < super :: ListBackupOperationsRequest > , ) -> Result < tonic :: Response < super :: ListBackupOperationsResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } } impl < T : Clone > Clone for DatabaseAdminClient < T > { fn clone ( & self ) -> Self { Self { inner : self . inner . clone ( ) , } } } impl < T > std :: fmt :: Debug for DatabaseAdminClient < T > { fn fmt ( & self , f : & mut std :: fmt :: Formatter < '_ > ) -> std :: fmt :: Result { write ! ( f , "DatabaseAdminClient {{ ... }}" ) } } }use serde :: { Serialize , Deserialize } ;