google_cloud_vpcaccess_v1/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 async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate location;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Definition of a Serverless VPC Access connector.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct Connector {
44 /// The resource name in the format `projects/*/locations/*/connectors/*`.
45 pub name: std::string::String,
46
47 /// Name of a VPC network.
48 pub network: std::string::String,
49
50 /// The range of internal addresses that follows RFC 4632 notation.
51 /// Example: `10.132.0.0/28`.
52 pub ip_cidr_range: std::string::String,
53
54 /// Output only. State of the VPC access connector.
55 pub state: crate::model::connector::State,
56
57 /// Minimum throughput of the connector in Mbps. Default and min is 200.
58 pub min_throughput: i32,
59
60 /// Maximum throughput of the connector in Mbps. Default is 300, max is 1000.
61 pub max_throughput: i32,
62
63 /// Output only. List of projects using the connector.
64 pub connected_projects: std::vec::Vec<std::string::String>,
65
66 /// The subnet in which to house the VPC Access Connector.
67 pub subnet: std::option::Option<crate::model::connector::Subnet>,
68
69 /// Machine type of VM Instance underlying connector. Default is e2-micro
70 pub machine_type: std::string::String,
71
72 /// Minimum value of instances in autoscaling group underlying the connector.
73 pub min_instances: i32,
74
75 /// Maximum value of instances in autoscaling group underlying the connector.
76 pub max_instances: i32,
77
78 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
79}
80
81impl Connector {
82 pub fn new() -> Self {
83 std::default::Default::default()
84 }
85
86 /// Sets the value of [name][crate::model::Connector::name].
87 ///
88 /// # Example
89 /// ```ignore,no_run
90 /// # use google_cloud_vpcaccess_v1::model::Connector;
91 /// let x = Connector::new().set_name("example");
92 /// ```
93 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94 self.name = v.into();
95 self
96 }
97
98 /// Sets the value of [network][crate::model::Connector::network].
99 ///
100 /// # Example
101 /// ```ignore,no_run
102 /// # use google_cloud_vpcaccess_v1::model::Connector;
103 /// let x = Connector::new().set_network("example");
104 /// ```
105 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
106 self.network = v.into();
107 self
108 }
109
110 /// Sets the value of [ip_cidr_range][crate::model::Connector::ip_cidr_range].
111 ///
112 /// # Example
113 /// ```ignore,no_run
114 /// # use google_cloud_vpcaccess_v1::model::Connector;
115 /// let x = Connector::new().set_ip_cidr_range("example");
116 /// ```
117 pub fn set_ip_cidr_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
118 self.ip_cidr_range = v.into();
119 self
120 }
121
122 /// Sets the value of [state][crate::model::Connector::state].
123 ///
124 /// # Example
125 /// ```ignore,no_run
126 /// # use google_cloud_vpcaccess_v1::model::Connector;
127 /// use google_cloud_vpcaccess_v1::model::connector::State;
128 /// let x0 = Connector::new().set_state(State::Ready);
129 /// let x1 = Connector::new().set_state(State::Creating);
130 /// let x2 = Connector::new().set_state(State::Deleting);
131 /// ```
132 pub fn set_state<T: std::convert::Into<crate::model::connector::State>>(
133 mut self,
134 v: T,
135 ) -> Self {
136 self.state = v.into();
137 self
138 }
139
140 /// Sets the value of [min_throughput][crate::model::Connector::min_throughput].
141 ///
142 /// # Example
143 /// ```ignore,no_run
144 /// # use google_cloud_vpcaccess_v1::model::Connector;
145 /// let x = Connector::new().set_min_throughput(42);
146 /// ```
147 pub fn set_min_throughput<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
148 self.min_throughput = v.into();
149 self
150 }
151
152 /// Sets the value of [max_throughput][crate::model::Connector::max_throughput].
153 ///
154 /// # Example
155 /// ```ignore,no_run
156 /// # use google_cloud_vpcaccess_v1::model::Connector;
157 /// let x = Connector::new().set_max_throughput(42);
158 /// ```
159 pub fn set_max_throughput<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
160 self.max_throughput = v.into();
161 self
162 }
163
164 /// Sets the value of [connected_projects][crate::model::Connector::connected_projects].
165 ///
166 /// # Example
167 /// ```ignore,no_run
168 /// # use google_cloud_vpcaccess_v1::model::Connector;
169 /// let x = Connector::new().set_connected_projects(["a", "b", "c"]);
170 /// ```
171 pub fn set_connected_projects<T, V>(mut self, v: T) -> Self
172 where
173 T: std::iter::IntoIterator<Item = V>,
174 V: std::convert::Into<std::string::String>,
175 {
176 use std::iter::Iterator;
177 self.connected_projects = v.into_iter().map(|i| i.into()).collect();
178 self
179 }
180
181 /// Sets the value of [subnet][crate::model::Connector::subnet].
182 ///
183 /// # Example
184 /// ```ignore,no_run
185 /// # use google_cloud_vpcaccess_v1::model::Connector;
186 /// use google_cloud_vpcaccess_v1::model::connector::Subnet;
187 /// let x = Connector::new().set_subnet(Subnet::default()/* use setters */);
188 /// ```
189 pub fn set_subnet<T>(mut self, v: T) -> Self
190 where
191 T: std::convert::Into<crate::model::connector::Subnet>,
192 {
193 self.subnet = std::option::Option::Some(v.into());
194 self
195 }
196
197 /// Sets or clears the value of [subnet][crate::model::Connector::subnet].
198 ///
199 /// # Example
200 /// ```ignore,no_run
201 /// # use google_cloud_vpcaccess_v1::model::Connector;
202 /// use google_cloud_vpcaccess_v1::model::connector::Subnet;
203 /// let x = Connector::new().set_or_clear_subnet(Some(Subnet::default()/* use setters */));
204 /// let x = Connector::new().set_or_clear_subnet(None::<Subnet>);
205 /// ```
206 pub fn set_or_clear_subnet<T>(mut self, v: std::option::Option<T>) -> Self
207 where
208 T: std::convert::Into<crate::model::connector::Subnet>,
209 {
210 self.subnet = v.map(|x| x.into());
211 self
212 }
213
214 /// Sets the value of [machine_type][crate::model::Connector::machine_type].
215 ///
216 /// # Example
217 /// ```ignore,no_run
218 /// # use google_cloud_vpcaccess_v1::model::Connector;
219 /// let x = Connector::new().set_machine_type("example");
220 /// ```
221 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
222 self.machine_type = v.into();
223 self
224 }
225
226 /// Sets the value of [min_instances][crate::model::Connector::min_instances].
227 ///
228 /// # Example
229 /// ```ignore,no_run
230 /// # use google_cloud_vpcaccess_v1::model::Connector;
231 /// let x = Connector::new().set_min_instances(42);
232 /// ```
233 pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
234 self.min_instances = v.into();
235 self
236 }
237
238 /// Sets the value of [max_instances][crate::model::Connector::max_instances].
239 ///
240 /// # Example
241 /// ```ignore,no_run
242 /// # use google_cloud_vpcaccess_v1::model::Connector;
243 /// let x = Connector::new().set_max_instances(42);
244 /// ```
245 pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
246 self.max_instances = v.into();
247 self
248 }
249}
250
251impl wkt::message::Message for Connector {
252 fn typename() -> &'static str {
253 "type.googleapis.com/google.cloud.vpcaccess.v1.Connector"
254 }
255}
256
257/// Defines additional types related to [Connector].
258pub mod connector {
259 #[allow(unused_imports)]
260 use super::*;
261
262 /// The subnet in which to house the connector
263 #[derive(Clone, Default, PartialEq)]
264 #[non_exhaustive]
265 pub struct Subnet {
266 /// Subnet name (relative, not fully qualified).
267 /// E.g. if the full subnet selfLink is
268 /// <https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName}>
269 /// the correct input for this field would be {subnetName}
270 pub name: std::string::String,
271
272 /// Project in which the subnet exists.
273 /// If not set, this project is assumed to be the project for which
274 /// the connector create request was issued.
275 pub project_id: std::string::String,
276
277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
278 }
279
280 impl Subnet {
281 pub fn new() -> Self {
282 std::default::Default::default()
283 }
284
285 /// Sets the value of [name][crate::model::connector::Subnet::name].
286 ///
287 /// # Example
288 /// ```ignore,no_run
289 /// # use google_cloud_vpcaccess_v1::model::connector::Subnet;
290 /// let x = Subnet::new().set_name("example");
291 /// ```
292 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
293 self.name = v.into();
294 self
295 }
296
297 /// Sets the value of [project_id][crate::model::connector::Subnet::project_id].
298 ///
299 /// # Example
300 /// ```ignore,no_run
301 /// # use google_cloud_vpcaccess_v1::model::connector::Subnet;
302 /// let x = Subnet::new().set_project_id("example");
303 /// ```
304 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
305 self.project_id = v.into();
306 self
307 }
308 }
309
310 impl wkt::message::Message for Subnet {
311 fn typename() -> &'static str {
312 "type.googleapis.com/google.cloud.vpcaccess.v1.Connector.Subnet"
313 }
314 }
315
316 /// State of a connector.
317 ///
318 /// # Working with unknown values
319 ///
320 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
321 /// additional enum variants at any time. Adding new variants is not considered
322 /// a breaking change. Applications should write their code in anticipation of:
323 ///
324 /// - New values appearing in future releases of the client library, **and**
325 /// - New values received dynamically, without application changes.
326 ///
327 /// Please consult the [Working with enums] section in the user guide for some
328 /// guidelines.
329 ///
330 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
331 #[derive(Clone, Debug, PartialEq)]
332 #[non_exhaustive]
333 pub enum State {
334 /// Invalid state.
335 Unspecified,
336 /// Connector is deployed and ready to receive traffic.
337 Ready,
338 /// An Insert operation is in progress. Transient condition.
339 Creating,
340 /// A Delete operation is in progress. Transient condition.
341 Deleting,
342 /// Connector is in a bad state, manual deletion recommended.
343 Error,
344 /// The connector is being updated.
345 Updating,
346 /// If set, the enum was initialized with an unknown value.
347 ///
348 /// Applications can examine the value using [State::value] or
349 /// [State::name].
350 UnknownValue(state::UnknownValue),
351 }
352
353 #[doc(hidden)]
354 pub mod state {
355 #[allow(unused_imports)]
356 use super::*;
357 #[derive(Clone, Debug, PartialEq)]
358 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
359 }
360
361 impl State {
362 /// Gets the enum value.
363 ///
364 /// Returns `None` if the enum contains an unknown value deserialized from
365 /// the string representation of enums.
366 pub fn value(&self) -> std::option::Option<i32> {
367 match self {
368 Self::Unspecified => std::option::Option::Some(0),
369 Self::Ready => std::option::Option::Some(1),
370 Self::Creating => std::option::Option::Some(2),
371 Self::Deleting => std::option::Option::Some(3),
372 Self::Error => std::option::Option::Some(4),
373 Self::Updating => std::option::Option::Some(5),
374 Self::UnknownValue(u) => u.0.value(),
375 }
376 }
377
378 /// Gets the enum value as a string.
379 ///
380 /// Returns `None` if the enum contains an unknown value deserialized from
381 /// the integer representation of enums.
382 pub fn name(&self) -> std::option::Option<&str> {
383 match self {
384 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
385 Self::Ready => std::option::Option::Some("READY"),
386 Self::Creating => std::option::Option::Some("CREATING"),
387 Self::Deleting => std::option::Option::Some("DELETING"),
388 Self::Error => std::option::Option::Some("ERROR"),
389 Self::Updating => std::option::Option::Some("UPDATING"),
390 Self::UnknownValue(u) => u.0.name(),
391 }
392 }
393 }
394
395 impl std::default::Default for State {
396 fn default() -> Self {
397 use std::convert::From;
398 Self::from(0)
399 }
400 }
401
402 impl std::fmt::Display for State {
403 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
404 wkt::internal::display_enum(f, self.name(), self.value())
405 }
406 }
407
408 impl std::convert::From<i32> for State {
409 fn from(value: i32) -> Self {
410 match value {
411 0 => Self::Unspecified,
412 1 => Self::Ready,
413 2 => Self::Creating,
414 3 => Self::Deleting,
415 4 => Self::Error,
416 5 => Self::Updating,
417 _ => Self::UnknownValue(state::UnknownValue(
418 wkt::internal::UnknownEnumValue::Integer(value),
419 )),
420 }
421 }
422 }
423
424 impl std::convert::From<&str> for State {
425 fn from(value: &str) -> Self {
426 use std::string::ToString;
427 match value {
428 "STATE_UNSPECIFIED" => Self::Unspecified,
429 "READY" => Self::Ready,
430 "CREATING" => Self::Creating,
431 "DELETING" => Self::Deleting,
432 "ERROR" => Self::Error,
433 "UPDATING" => Self::Updating,
434 _ => Self::UnknownValue(state::UnknownValue(
435 wkt::internal::UnknownEnumValue::String(value.to_string()),
436 )),
437 }
438 }
439 }
440
441 impl serde::ser::Serialize for State {
442 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
443 where
444 S: serde::Serializer,
445 {
446 match self {
447 Self::Unspecified => serializer.serialize_i32(0),
448 Self::Ready => serializer.serialize_i32(1),
449 Self::Creating => serializer.serialize_i32(2),
450 Self::Deleting => serializer.serialize_i32(3),
451 Self::Error => serializer.serialize_i32(4),
452 Self::Updating => serializer.serialize_i32(5),
453 Self::UnknownValue(u) => u.0.serialize(serializer),
454 }
455 }
456 }
457
458 impl<'de> serde::de::Deserialize<'de> for State {
459 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
460 where
461 D: serde::Deserializer<'de>,
462 {
463 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
464 ".google.cloud.vpcaccess.v1.Connector.State",
465 ))
466 }
467 }
468}
469
470/// Request for creating a Serverless VPC Access connector.
471#[derive(Clone, Default, PartialEq)]
472#[non_exhaustive]
473pub struct CreateConnectorRequest {
474 /// Required. The project and location in which the configuration should be created,
475 /// specified in the format `projects/*/locations/*`.
476 pub parent: std::string::String,
477
478 /// Required. The ID to use for this connector.
479 pub connector_id: std::string::String,
480
481 /// Required. Resource to create.
482 pub connector: std::option::Option<crate::model::Connector>,
483
484 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
485}
486
487impl CreateConnectorRequest {
488 pub fn new() -> Self {
489 std::default::Default::default()
490 }
491
492 /// Sets the value of [parent][crate::model::CreateConnectorRequest::parent].
493 ///
494 /// # Example
495 /// ```ignore,no_run
496 /// # use google_cloud_vpcaccess_v1::model::CreateConnectorRequest;
497 /// let x = CreateConnectorRequest::new().set_parent("example");
498 /// ```
499 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
500 self.parent = v.into();
501 self
502 }
503
504 /// Sets the value of [connector_id][crate::model::CreateConnectorRequest::connector_id].
505 ///
506 /// # Example
507 /// ```ignore,no_run
508 /// # use google_cloud_vpcaccess_v1::model::CreateConnectorRequest;
509 /// let x = CreateConnectorRequest::new().set_connector_id("example");
510 /// ```
511 pub fn set_connector_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
512 self.connector_id = v.into();
513 self
514 }
515
516 /// Sets the value of [connector][crate::model::CreateConnectorRequest::connector].
517 ///
518 /// # Example
519 /// ```ignore,no_run
520 /// # use google_cloud_vpcaccess_v1::model::CreateConnectorRequest;
521 /// use google_cloud_vpcaccess_v1::model::Connector;
522 /// let x = CreateConnectorRequest::new().set_connector(Connector::default()/* use setters */);
523 /// ```
524 pub fn set_connector<T>(mut self, v: T) -> Self
525 where
526 T: std::convert::Into<crate::model::Connector>,
527 {
528 self.connector = std::option::Option::Some(v.into());
529 self
530 }
531
532 /// Sets or clears the value of [connector][crate::model::CreateConnectorRequest::connector].
533 ///
534 /// # Example
535 /// ```ignore,no_run
536 /// # use google_cloud_vpcaccess_v1::model::CreateConnectorRequest;
537 /// use google_cloud_vpcaccess_v1::model::Connector;
538 /// let x = CreateConnectorRequest::new().set_or_clear_connector(Some(Connector::default()/* use setters */));
539 /// let x = CreateConnectorRequest::new().set_or_clear_connector(None::<Connector>);
540 /// ```
541 pub fn set_or_clear_connector<T>(mut self, v: std::option::Option<T>) -> Self
542 where
543 T: std::convert::Into<crate::model::Connector>,
544 {
545 self.connector = v.map(|x| x.into());
546 self
547 }
548}
549
550impl wkt::message::Message for CreateConnectorRequest {
551 fn typename() -> &'static str {
552 "type.googleapis.com/google.cloud.vpcaccess.v1.CreateConnectorRequest"
553 }
554}
555
556/// Request for getting a Serverless VPC Access connector.
557#[derive(Clone, Default, PartialEq)]
558#[non_exhaustive]
559pub struct GetConnectorRequest {
560 /// Required. Name of a Serverless VPC Access connector to get.
561 pub name: std::string::String,
562
563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
564}
565
566impl GetConnectorRequest {
567 pub fn new() -> Self {
568 std::default::Default::default()
569 }
570
571 /// Sets the value of [name][crate::model::GetConnectorRequest::name].
572 ///
573 /// # Example
574 /// ```ignore,no_run
575 /// # use google_cloud_vpcaccess_v1::model::GetConnectorRequest;
576 /// let x = GetConnectorRequest::new().set_name("example");
577 /// ```
578 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
579 self.name = v.into();
580 self
581 }
582}
583
584impl wkt::message::Message for GetConnectorRequest {
585 fn typename() -> &'static str {
586 "type.googleapis.com/google.cloud.vpcaccess.v1.GetConnectorRequest"
587 }
588}
589
590/// Request for listing Serverless VPC Access connectors in a location.
591#[derive(Clone, Default, PartialEq)]
592#[non_exhaustive]
593pub struct ListConnectorsRequest {
594 /// Required. The project and location from which the routes should be listed.
595 pub parent: std::string::String,
596
597 /// Maximum number of functions to return per call.
598 pub page_size: i32,
599
600 /// Continuation token.
601 pub page_token: std::string::String,
602
603 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
604}
605
606impl ListConnectorsRequest {
607 pub fn new() -> Self {
608 std::default::Default::default()
609 }
610
611 /// Sets the value of [parent][crate::model::ListConnectorsRequest::parent].
612 ///
613 /// # Example
614 /// ```ignore,no_run
615 /// # use google_cloud_vpcaccess_v1::model::ListConnectorsRequest;
616 /// let x = ListConnectorsRequest::new().set_parent("example");
617 /// ```
618 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
619 self.parent = v.into();
620 self
621 }
622
623 /// Sets the value of [page_size][crate::model::ListConnectorsRequest::page_size].
624 ///
625 /// # Example
626 /// ```ignore,no_run
627 /// # use google_cloud_vpcaccess_v1::model::ListConnectorsRequest;
628 /// let x = ListConnectorsRequest::new().set_page_size(42);
629 /// ```
630 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
631 self.page_size = v.into();
632 self
633 }
634
635 /// Sets the value of [page_token][crate::model::ListConnectorsRequest::page_token].
636 ///
637 /// # Example
638 /// ```ignore,no_run
639 /// # use google_cloud_vpcaccess_v1::model::ListConnectorsRequest;
640 /// let x = ListConnectorsRequest::new().set_page_token("example");
641 /// ```
642 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
643 self.page_token = v.into();
644 self
645 }
646}
647
648impl wkt::message::Message for ListConnectorsRequest {
649 fn typename() -> &'static str {
650 "type.googleapis.com/google.cloud.vpcaccess.v1.ListConnectorsRequest"
651 }
652}
653
654/// Response for listing Serverless VPC Access connectors.
655#[derive(Clone, Default, PartialEq)]
656#[non_exhaustive]
657pub struct ListConnectorsResponse {
658 /// List of Serverless VPC Access connectors.
659 pub connectors: std::vec::Vec<crate::model::Connector>,
660
661 /// Continuation token.
662 pub next_page_token: std::string::String,
663
664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
665}
666
667impl ListConnectorsResponse {
668 pub fn new() -> Self {
669 std::default::Default::default()
670 }
671
672 /// Sets the value of [connectors][crate::model::ListConnectorsResponse::connectors].
673 ///
674 /// # Example
675 /// ```ignore,no_run
676 /// # use google_cloud_vpcaccess_v1::model::ListConnectorsResponse;
677 /// use google_cloud_vpcaccess_v1::model::Connector;
678 /// let x = ListConnectorsResponse::new()
679 /// .set_connectors([
680 /// Connector::default()/* use setters */,
681 /// Connector::default()/* use (different) setters */,
682 /// ]);
683 /// ```
684 pub fn set_connectors<T, V>(mut self, v: T) -> Self
685 where
686 T: std::iter::IntoIterator<Item = V>,
687 V: std::convert::Into<crate::model::Connector>,
688 {
689 use std::iter::Iterator;
690 self.connectors = v.into_iter().map(|i| i.into()).collect();
691 self
692 }
693
694 /// Sets the value of [next_page_token][crate::model::ListConnectorsResponse::next_page_token].
695 ///
696 /// # Example
697 /// ```ignore,no_run
698 /// # use google_cloud_vpcaccess_v1::model::ListConnectorsResponse;
699 /// let x = ListConnectorsResponse::new().set_next_page_token("example");
700 /// ```
701 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
702 self.next_page_token = v.into();
703 self
704 }
705}
706
707impl wkt::message::Message for ListConnectorsResponse {
708 fn typename() -> &'static str {
709 "type.googleapis.com/google.cloud.vpcaccess.v1.ListConnectorsResponse"
710 }
711}
712
713#[doc(hidden)]
714impl gax::paginator::internal::PageableResponse for ListConnectorsResponse {
715 type PageItem = crate::model::Connector;
716
717 fn items(self) -> std::vec::Vec<Self::PageItem> {
718 self.connectors
719 }
720
721 fn next_page_token(&self) -> std::string::String {
722 use std::clone::Clone;
723 self.next_page_token.clone()
724 }
725}
726
727/// Request for deleting a Serverless VPC Access connector.
728#[derive(Clone, Default, PartialEq)]
729#[non_exhaustive]
730pub struct DeleteConnectorRequest {
731 /// Required. Name of a Serverless VPC Access connector to delete.
732 pub name: std::string::String,
733
734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
735}
736
737impl DeleteConnectorRequest {
738 pub fn new() -> Self {
739 std::default::Default::default()
740 }
741
742 /// Sets the value of [name][crate::model::DeleteConnectorRequest::name].
743 ///
744 /// # Example
745 /// ```ignore,no_run
746 /// # use google_cloud_vpcaccess_v1::model::DeleteConnectorRequest;
747 /// let x = DeleteConnectorRequest::new().set_name("example");
748 /// ```
749 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
750 self.name = v.into();
751 self
752 }
753}
754
755impl wkt::message::Message for DeleteConnectorRequest {
756 fn typename() -> &'static str {
757 "type.googleapis.com/google.cloud.vpcaccess.v1.DeleteConnectorRequest"
758 }
759}
760
761/// Metadata for google.longrunning.Operation.
762#[derive(Clone, Default, PartialEq)]
763#[non_exhaustive]
764pub struct OperationMetadata {
765 /// Output only. Method that initiated the operation e.g.
766 /// google.cloud.vpcaccess.v1.Connectors.CreateConnector.
767 pub method: std::string::String,
768
769 /// Output only. Time when the operation was created.
770 pub create_time: std::option::Option<wkt::Timestamp>,
771
772 /// Output only. Time when the operation completed.
773 pub end_time: std::option::Option<wkt::Timestamp>,
774
775 /// Output only. Name of the resource that this operation is acting on e.g.
776 /// projects/my-project/locations/us-central1/connectors/v1.
777 pub target: std::string::String,
778
779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
780}
781
782impl OperationMetadata {
783 pub fn new() -> Self {
784 std::default::Default::default()
785 }
786
787 /// Sets the value of [method][crate::model::OperationMetadata::method].
788 ///
789 /// # Example
790 /// ```ignore,no_run
791 /// # use google_cloud_vpcaccess_v1::model::OperationMetadata;
792 /// let x = OperationMetadata::new().set_method("example");
793 /// ```
794 pub fn set_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
795 self.method = v.into();
796 self
797 }
798
799 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
800 ///
801 /// # Example
802 /// ```ignore,no_run
803 /// # use google_cloud_vpcaccess_v1::model::OperationMetadata;
804 /// use wkt::Timestamp;
805 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
806 /// ```
807 pub fn set_create_time<T>(mut self, v: T) -> Self
808 where
809 T: std::convert::Into<wkt::Timestamp>,
810 {
811 self.create_time = std::option::Option::Some(v.into());
812 self
813 }
814
815 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
816 ///
817 /// # Example
818 /// ```ignore,no_run
819 /// # use google_cloud_vpcaccess_v1::model::OperationMetadata;
820 /// use wkt::Timestamp;
821 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
822 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
823 /// ```
824 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
825 where
826 T: std::convert::Into<wkt::Timestamp>,
827 {
828 self.create_time = v.map(|x| x.into());
829 self
830 }
831
832 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
833 ///
834 /// # Example
835 /// ```ignore,no_run
836 /// # use google_cloud_vpcaccess_v1::model::OperationMetadata;
837 /// use wkt::Timestamp;
838 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
839 /// ```
840 pub fn set_end_time<T>(mut self, v: T) -> Self
841 where
842 T: std::convert::Into<wkt::Timestamp>,
843 {
844 self.end_time = std::option::Option::Some(v.into());
845 self
846 }
847
848 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
849 ///
850 /// # Example
851 /// ```ignore,no_run
852 /// # use google_cloud_vpcaccess_v1::model::OperationMetadata;
853 /// use wkt::Timestamp;
854 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
855 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
856 /// ```
857 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
858 where
859 T: std::convert::Into<wkt::Timestamp>,
860 {
861 self.end_time = v.map(|x| x.into());
862 self
863 }
864
865 /// Sets the value of [target][crate::model::OperationMetadata::target].
866 ///
867 /// # Example
868 /// ```ignore,no_run
869 /// # use google_cloud_vpcaccess_v1::model::OperationMetadata;
870 /// let x = OperationMetadata::new().set_target("example");
871 /// ```
872 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
873 self.target = v.into();
874 self
875 }
876}
877
878impl wkt::message::Message for OperationMetadata {
879 fn typename() -> &'static str {
880 "type.googleapis.com/google.cloud.vpcaccess.v1.OperationMetadata"
881 }
882}