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    #[serde(skip_serializing_if = "wkt::internal::is_default")]
58    pub cancel_requested: bool,
59
60    /// Output only. API version used to start the operation.
61    #[serde(skip_serializing_if = "std::string::String::is_empty")]
62    pub api_version: std::string::String,
63
64    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
65    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
66}
67
68impl OperationMetadata {
69    pub fn new() -> Self {
70        std::default::Default::default()
71    }
72
73    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
74    pub fn set_create_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
75        mut self,
76        v: T,
77    ) -> Self {
78        self.create_time = v.into();
79        self
80    }
81
82    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
83    pub fn set_end_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
84        mut self,
85        v: T,
86    ) -> Self {
87        self.end_time = v.into();
88        self
89    }
90
91    /// Sets the value of [target][crate::model::OperationMetadata::target].
92    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
93        self.target = v.into();
94        self
95    }
96
97    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
98    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
99        self.verb = v.into();
100        self
101    }
102
103    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
104    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
105        self.status_detail = v.into();
106        self
107    }
108
109    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
110    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
111        self.cancel_requested = v.into();
112        self
113    }
114
115    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
116    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
117        self.api_version = v.into();
118        self
119    }
120}
121
122impl wkt::message::Message for OperationMetadata {
123    fn typename() -> &'static str {
124        "type.googleapis.com/google.cloud.common.OperationMetadata"
125    }
126}