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
27/// Represents the metadata of the long-running operation.
28#[serde_with::serde_as]
29#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
30#[serde(default, rename_all = "camelCase")]
31#[non_exhaustive]
32pub struct OperationMetadata {
33    /// Output only. The time the operation was created.
34    #[serde(skip_serializing_if = "std::option::Option::is_none")]
35    pub create_time: std::option::Option<wkt::Timestamp>,
36
37    /// Output only. The time the operation finished running.
38    #[serde(skip_serializing_if = "std::option::Option::is_none")]
39    pub end_time: std::option::Option<wkt::Timestamp>,
40
41    /// Output only. Server-defined resource path for the target of the operation.
42    #[serde(skip_serializing_if = "std::string::String::is_empty")]
43    pub target: std::string::String,
44
45    /// Output only. Name of the verb executed by the operation.
46    #[serde(skip_serializing_if = "std::string::String::is_empty")]
47    pub verb: std::string::String,
48
49    /// Output only. Human-readable status of the operation, if any.
50    #[serde(skip_serializing_if = "std::string::String::is_empty")]
51    pub status_detail: std::string::String,
52
53    /// Output only. Identifies whether the user has requested cancellation
54    /// of the operation. Operations that have successfully been cancelled
55    /// have [Operation.error][] value with a [google.rpc.Status.code][] of 1,
56    /// corresponding to `Code.CANCELLED`.
57    pub cancel_requested: bool,
58
59    /// Output only. API version used to start the operation.
60    #[serde(skip_serializing_if = "std::string::String::is_empty")]
61    pub api_version: std::string::String,
62
63    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
64    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
65}
66
67impl OperationMetadata {
68    pub fn new() -> Self {
69        std::default::Default::default()
70    }
71
72    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
73    pub fn set_create_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
74        mut self,
75        v: T,
76    ) -> Self {
77        self.create_time = v.into();
78        self
79    }
80
81    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
82    pub fn set_end_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
83        mut self,
84        v: T,
85    ) -> Self {
86        self.end_time = v.into();
87        self
88    }
89
90    /// Sets the value of [target][crate::model::OperationMetadata::target].
91    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
92        self.target = v.into();
93        self
94    }
95
96    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
97    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
98        self.verb = v.into();
99        self
100    }
101
102    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
103    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
104        self.status_detail = v.into();
105        self
106    }
107
108    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
109    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
110        self.cancel_requested = v.into();
111        self
112    }
113
114    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
115    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
116        self.api_version = v.into();
117        self
118    }
119}
120
121impl wkt::message::Message for OperationMetadata {
122    fn typename() -> &'static str {
123        "type.googleapis.com/google.cloud.common.OperationMetadata"
124    }
125}