google_cloud_common/
model.rs

1// Copyright 2025 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// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate bytes;
21extern crate serde;
22extern crate serde_json;
23extern crate serde_with;
24extern crate std;
25extern crate wkt;
26
27mod debug;
28mod deserialize;
29mod serialize;
30
31/// Represents the metadata of the long-running operation.
32#[derive(Clone, Default, PartialEq)]
33#[non_exhaustive]
34pub struct OperationMetadata {
35    /// Output only. The time the operation was created.
36    pub create_time: std::option::Option<wkt::Timestamp>,
37
38    /// Output only. The time the operation finished running.
39    pub end_time: std::option::Option<wkt::Timestamp>,
40
41    /// Output only. Server-defined resource path for the target of the operation.
42    pub target: std::string::String,
43
44    /// Output only. Name of the verb executed by the operation.
45    pub verb: std::string::String,
46
47    /// Output only. Human-readable status of the operation, if any.
48    pub status_detail: std::string::String,
49
50    /// Output only. Identifies whether the user has requested cancellation
51    /// of the operation. Operations that have successfully been cancelled
52    /// have [Operation.error][] value with a [google.rpc.Status.code][] of 1,
53    /// corresponding to `Code.CANCELLED`.
54    pub cancel_requested: bool,
55
56    /// Output only. API version used to start the operation.
57    pub api_version: std::string::String,
58
59    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
60}
61
62impl OperationMetadata {
63    pub fn new() -> Self {
64        std::default::Default::default()
65    }
66
67    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
68    pub fn set_create_time<T>(mut self, v: T) -> Self
69    where
70        T: std::convert::Into<wkt::Timestamp>,
71    {
72        self.create_time = std::option::Option::Some(v.into());
73        self
74    }
75
76    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
77    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
78    where
79        T: std::convert::Into<wkt::Timestamp>,
80    {
81        self.create_time = v.map(|x| x.into());
82        self
83    }
84
85    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
86    pub fn set_end_time<T>(mut self, v: T) -> Self
87    where
88        T: std::convert::Into<wkt::Timestamp>,
89    {
90        self.end_time = std::option::Option::Some(v.into());
91        self
92    }
93
94    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
95    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
96    where
97        T: std::convert::Into<wkt::Timestamp>,
98    {
99        self.end_time = v.map(|x| x.into());
100        self
101    }
102
103    /// Sets the value of [target][crate::model::OperationMetadata::target].
104    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
105        self.target = v.into();
106        self
107    }
108
109    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
110    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
111        self.verb = v.into();
112        self
113    }
114
115    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
116    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
117        self.status_detail = v.into();
118        self
119    }
120
121    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
122    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
123        self.cancel_requested = v.into();
124        self
125    }
126
127    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
128    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
129        self.api_version = v.into();
130        self
131    }
132}
133
134impl wkt::message::Message for OperationMetadata {
135    fn typename() -> &'static str {
136        "type.googleapis.com/google.cloud.common.OperationMetadata"
137    }
138}