google_cloud_servicedirectory_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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_location;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// An individual endpoint that provides a
40/// [service][google.cloud.servicedirectory.v1.Service]. The service must
41/// already exist to create an endpoint.
42///
43/// [google.cloud.servicedirectory.v1.Service]: crate::model::Service
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct Endpoint {
47 /// Immutable. The resource name for the endpoint in the format
48 /// `projects/*/locations/*/namespaces/*/services/*/endpoints/*`.
49 pub name: std::string::String,
50
51 /// Optional. An IPv4 or IPv6 address. Service Directory rejects bad addresses
52 /// like:
53 ///
54 /// * `8.8.8`
55 /// * `8.8.8.8:53`
56 /// * `test:bad:address`
57 /// * `[::1]`
58 /// * `[::1]:8080`
59 ///
60 /// Limited to 45 characters.
61 pub address: std::string::String,
62
63 /// Optional. Service Directory rejects values outside of `[0, 65535]`.
64 pub port: i32,
65
66 /// Optional. Annotations for the endpoint. This data can be consumed by
67 /// service clients.
68 ///
69 /// Restrictions:
70 ///
71 /// * The entire annotations dictionary may contain up to 512 characters,
72 /// spread accoss all key-value pairs. Annotations that go beyond this
73 /// limit are rejected
74 /// * Valid annotation keys have two segments: an optional prefix and name,
75 /// separated by a slash (/). The name segment is required and must be 63
76 /// characters or less, beginning and ending with an alphanumeric character
77 /// ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and
78 /// alphanumerics between. The prefix is optional. If specified, the prefix
79 /// must be a DNS subdomain: a series of DNS labels separated by dots (.),
80 /// not longer than 253 characters in total, followed by a slash (/)
81 /// Annotations that fails to meet these requirements are rejected.
82 ///
83 /// Note: This field is equivalent to the `metadata` field in the v1beta1 API.
84 /// They have the same syntax and read/write to the same location in Service
85 /// Directory.
86 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
87
88 /// Immutable. The Google Compute Engine network (VPC) of the endpoint in the
89 /// format `projects/<project number>/locations/global/networks/*`.
90 ///
91 /// The project must be specified by project number (project id is rejected).
92 /// Incorrectly formatted networks are rejected, we also check to make sure
93 /// that you have the servicedirectory.networks.attach permission on the
94 /// project specified.
95 pub network: std::string::String,
96
97 /// Output only. The globally unique identifier of the endpoint in the UUID4
98 /// format.
99 pub uid: std::string::String,
100
101 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
102}
103
104impl Endpoint {
105 /// Creates a new default instance.
106 pub fn new() -> Self {
107 std::default::Default::default()
108 }
109
110 /// Sets the value of [name][crate::model::Endpoint::name].
111 ///
112 /// # Example
113 /// ```ignore,no_run
114 /// # use google_cloud_servicedirectory_v1::model::Endpoint;
115 /// # let project_id = "project_id";
116 /// # let location_id = "location_id";
117 /// # let namespace_id = "namespace_id";
118 /// # let service_id = "service_id";
119 /// # let endpoint_id = "endpoint_id";
120 /// let x = Endpoint::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}/endpoints/{endpoint_id}"));
121 /// ```
122 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
123 self.name = v.into();
124 self
125 }
126
127 /// Sets the value of [address][crate::model::Endpoint::address].
128 ///
129 /// # Example
130 /// ```ignore,no_run
131 /// # use google_cloud_servicedirectory_v1::model::Endpoint;
132 /// let x = Endpoint::new().set_address("example");
133 /// ```
134 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
135 self.address = v.into();
136 self
137 }
138
139 /// Sets the value of [port][crate::model::Endpoint::port].
140 ///
141 /// # Example
142 /// ```ignore,no_run
143 /// # use google_cloud_servicedirectory_v1::model::Endpoint;
144 /// let x = Endpoint::new().set_port(42);
145 /// ```
146 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
147 self.port = v.into();
148 self
149 }
150
151 /// Sets the value of [annotations][crate::model::Endpoint::annotations].
152 ///
153 /// # Example
154 /// ```ignore,no_run
155 /// # use google_cloud_servicedirectory_v1::model::Endpoint;
156 /// let x = Endpoint::new().set_annotations([
157 /// ("key0", "abc"),
158 /// ("key1", "xyz"),
159 /// ]);
160 /// ```
161 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
162 where
163 T: std::iter::IntoIterator<Item = (K, V)>,
164 K: std::convert::Into<std::string::String>,
165 V: std::convert::Into<std::string::String>,
166 {
167 use std::iter::Iterator;
168 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
169 self
170 }
171
172 /// Sets the value of [network][crate::model::Endpoint::network].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_servicedirectory_v1::model::Endpoint;
177 /// let x = Endpoint::new().set_network("example");
178 /// ```
179 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
180 self.network = v.into();
181 self
182 }
183
184 /// Sets the value of [uid][crate::model::Endpoint::uid].
185 ///
186 /// # Example
187 /// ```ignore,no_run
188 /// # use google_cloud_servicedirectory_v1::model::Endpoint;
189 /// let x = Endpoint::new().set_uid("example");
190 /// ```
191 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
192 self.uid = v.into();
193 self
194 }
195}
196
197impl wkt::message::Message for Endpoint {
198 fn typename() -> &'static str {
199 "type.googleapis.com/google.cloud.servicedirectory.v1.Endpoint"
200 }
201}
202
203/// The request message for
204/// [LookupService.ResolveService][google.cloud.servicedirectory.v1.LookupService.ResolveService].
205/// Looks up a service by its name, returns the service and its endpoints.
206///
207/// [google.cloud.servicedirectory.v1.LookupService.ResolveService]: crate::client::LookupService::resolve_service
208#[derive(Clone, Default, PartialEq)]
209#[non_exhaustive]
210pub struct ResolveServiceRequest {
211 /// Required. The name of the service to resolve.
212 pub name: std::string::String,
213
214 /// Optional. The maximum number of endpoints to return. Defaults to 25.
215 /// Maximum is 100. If a value less than one is specified, the Default is used.
216 /// If a value greater than the Maximum is specified, the Maximum is used.
217 pub max_endpoints: i32,
218
219 /// Optional. The filter applied to the endpoints of the resolved service.
220 ///
221 /// General `filter` string syntax:
222 /// `<field> <operator> <value> (<logical connector>)`
223 ///
224 /// * `<field>` can be `name`, `address`, `port`, or `annotations.<key>` for
225 /// map field
226 /// * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
227 /// means `HAS`, and is roughly the same as `=`
228 /// * `<value>` must be the same data type as field
229 /// * `<logical connector>` can be `AND`, `OR`, `NOT`
230 ///
231 /// Examples of valid filters:
232 ///
233 /// * `annotations.owner` returns endpoints that have a annotation with the
234 /// key `owner`, this is the same as `annotations:owner`
235 /// * `annotations.protocol=gRPC` returns endpoints that have key/value
236 /// `protocol=gRPC`
237 /// * `address=192.108.1.105` returns endpoints that have this address
238 /// * `port>8080` returns endpoints that have port number larger than 8080
239 ///
240 /// `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
241 /// returns endpoints that have name that is alphabetically later than the
242 /// string, so "endpoint-e" is returned but "endpoint-a" is not
243 /// *
244 /// `name=projects/my-project/locations/us-central1/namespaces/my-namespace/services/my-service/endpoints/ep-1`
245 /// returns the endpoint that has an endpoint_id equal to `ep-1`
246 ///
247 /// * `annotations.owner!=sd AND annotations.foo=bar` returns endpoints that
248 /// have `owner` in annotation key but value is not `sd` AND have
249 /// key/value `foo=bar`
250 /// * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
251 /// doesn't have a field called "doesnotexist". Since the filter does not
252 /// match any endpoint, it returns no results
253 ///
254 /// For more information about filtering, see
255 /// [API Filtering](https://aip.dev/160).
256 pub endpoint_filter: std::string::String,
257
258 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
259}
260
261impl ResolveServiceRequest {
262 /// Creates a new default instance.
263 pub fn new() -> Self {
264 std::default::Default::default()
265 }
266
267 /// Sets the value of [name][crate::model::ResolveServiceRequest::name].
268 ///
269 /// # Example
270 /// ```ignore,no_run
271 /// # use google_cloud_servicedirectory_v1::model::ResolveServiceRequest;
272 /// # let project_id = "project_id";
273 /// # let location_id = "location_id";
274 /// # let namespace_id = "namespace_id";
275 /// # let service_id = "service_id";
276 /// let x = ResolveServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}"));
277 /// ```
278 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
279 self.name = v.into();
280 self
281 }
282
283 /// Sets the value of [max_endpoints][crate::model::ResolveServiceRequest::max_endpoints].
284 ///
285 /// # Example
286 /// ```ignore,no_run
287 /// # use google_cloud_servicedirectory_v1::model::ResolveServiceRequest;
288 /// let x = ResolveServiceRequest::new().set_max_endpoints(42);
289 /// ```
290 pub fn set_max_endpoints<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
291 self.max_endpoints = v.into();
292 self
293 }
294
295 /// Sets the value of [endpoint_filter][crate::model::ResolveServiceRequest::endpoint_filter].
296 ///
297 /// # Example
298 /// ```ignore,no_run
299 /// # use google_cloud_servicedirectory_v1::model::ResolveServiceRequest;
300 /// let x = ResolveServiceRequest::new().set_endpoint_filter("example");
301 /// ```
302 pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
303 self.endpoint_filter = v.into();
304 self
305 }
306}
307
308impl wkt::message::Message for ResolveServiceRequest {
309 fn typename() -> &'static str {
310 "type.googleapis.com/google.cloud.servicedirectory.v1.ResolveServiceRequest"
311 }
312}
313
314/// The response message for
315/// [LookupService.ResolveService][google.cloud.servicedirectory.v1.LookupService.ResolveService].
316///
317/// [google.cloud.servicedirectory.v1.LookupService.ResolveService]: crate::client::LookupService::resolve_service
318#[derive(Clone, Default, PartialEq)]
319#[non_exhaustive]
320pub struct ResolveServiceResponse {
321 #[allow(missing_docs)]
322 pub service: std::option::Option<crate::model::Service>,
323
324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
325}
326
327impl ResolveServiceResponse {
328 /// Creates a new default instance.
329 pub fn new() -> Self {
330 std::default::Default::default()
331 }
332
333 /// Sets the value of [service][crate::model::ResolveServiceResponse::service].
334 ///
335 /// # Example
336 /// ```ignore,no_run
337 /// # use google_cloud_servicedirectory_v1::model::ResolveServiceResponse;
338 /// use google_cloud_servicedirectory_v1::model::Service;
339 /// let x = ResolveServiceResponse::new().set_service(Service::default()/* use setters */);
340 /// ```
341 pub fn set_service<T>(mut self, v: T) -> Self
342 where
343 T: std::convert::Into<crate::model::Service>,
344 {
345 self.service = std::option::Option::Some(v.into());
346 self
347 }
348
349 /// Sets or clears the value of [service][crate::model::ResolveServiceResponse::service].
350 ///
351 /// # Example
352 /// ```ignore,no_run
353 /// # use google_cloud_servicedirectory_v1::model::ResolveServiceResponse;
354 /// use google_cloud_servicedirectory_v1::model::Service;
355 /// let x = ResolveServiceResponse::new().set_or_clear_service(Some(Service::default()/* use setters */));
356 /// let x = ResolveServiceResponse::new().set_or_clear_service(None::<Service>);
357 /// ```
358 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
359 where
360 T: std::convert::Into<crate::model::Service>,
361 {
362 self.service = v.map(|x| x.into());
363 self
364 }
365}
366
367impl wkt::message::Message for ResolveServiceResponse {
368 fn typename() -> &'static str {
369 "type.googleapis.com/google.cloud.servicedirectory.v1.ResolveServiceResponse"
370 }
371}
372
373/// A container for [services][google.cloud.servicedirectory.v1.Service].
374/// Namespaces allow administrators to group services together and define
375/// permissions for a collection of services.
376///
377/// [google.cloud.servicedirectory.v1.Service]: crate::model::Service
378#[derive(Clone, Default, PartialEq)]
379#[non_exhaustive]
380pub struct Namespace {
381 /// Immutable. The resource name for the namespace in the format
382 /// `projects/*/locations/*/namespaces/*`.
383 pub name: std::string::String,
384
385 /// Optional. Resource labels associated with this namespace.
386 /// No more than 64 user labels can be associated with a given resource. Label
387 /// keys and values can be no longer than 63 characters.
388 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
389
390 /// Output only. The globally unique identifier of the namespace in the UUID4
391 /// format.
392 pub uid: std::string::String,
393
394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
395}
396
397impl Namespace {
398 /// Creates a new default instance.
399 pub fn new() -> Self {
400 std::default::Default::default()
401 }
402
403 /// Sets the value of [name][crate::model::Namespace::name].
404 ///
405 /// # Example
406 /// ```ignore,no_run
407 /// # use google_cloud_servicedirectory_v1::model::Namespace;
408 /// # let project_id = "project_id";
409 /// # let location_id = "location_id";
410 /// # let namespace_id = "namespace_id";
411 /// let x = Namespace::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}"));
412 /// ```
413 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
414 self.name = v.into();
415 self
416 }
417
418 /// Sets the value of [labels][crate::model::Namespace::labels].
419 ///
420 /// # Example
421 /// ```ignore,no_run
422 /// # use google_cloud_servicedirectory_v1::model::Namespace;
423 /// let x = Namespace::new().set_labels([
424 /// ("key0", "abc"),
425 /// ("key1", "xyz"),
426 /// ]);
427 /// ```
428 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
429 where
430 T: std::iter::IntoIterator<Item = (K, V)>,
431 K: std::convert::Into<std::string::String>,
432 V: std::convert::Into<std::string::String>,
433 {
434 use std::iter::Iterator;
435 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
436 self
437 }
438
439 /// Sets the value of [uid][crate::model::Namespace::uid].
440 ///
441 /// # Example
442 /// ```ignore,no_run
443 /// # use google_cloud_servicedirectory_v1::model::Namespace;
444 /// let x = Namespace::new().set_uid("example");
445 /// ```
446 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
447 self.uid = v.into();
448 self
449 }
450}
451
452impl wkt::message::Message for Namespace {
453 fn typename() -> &'static str {
454 "type.googleapis.com/google.cloud.servicedirectory.v1.Namespace"
455 }
456}
457
458/// The request message for
459/// [RegistrationService.CreateNamespace][google.cloud.servicedirectory.v1.RegistrationService.CreateNamespace].
460///
461/// [google.cloud.servicedirectory.v1.RegistrationService.CreateNamespace]: crate::client::RegistrationService::create_namespace
462#[derive(Clone, Default, PartialEq)]
463#[non_exhaustive]
464pub struct CreateNamespaceRequest {
465 /// Required. The resource name of the project and location the namespace
466 /// will be created in.
467 pub parent: std::string::String,
468
469 /// Required. The Resource ID must be 1-63 characters long, and comply with
470 /// <a href="https://www.ietf.org/rfc/rfc1035.txt" target="_blank">RFC1035</a>.
471 /// Specifically, the name must be 1-63 characters long and match the regular
472 /// expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
473 /// character must be a lowercase letter, and all following characters must
474 /// be a dash, lowercase letter, or digit, except the last character, which
475 /// cannot be a dash.
476 pub namespace_id: std::string::String,
477
478 /// Required. A namespace with initial fields set.
479 pub namespace: std::option::Option<crate::model::Namespace>,
480
481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
482}
483
484impl CreateNamespaceRequest {
485 /// Creates a new default instance.
486 pub fn new() -> Self {
487 std::default::Default::default()
488 }
489
490 /// Sets the value of [parent][crate::model::CreateNamespaceRequest::parent].
491 ///
492 /// # Example
493 /// ```ignore,no_run
494 /// # use google_cloud_servicedirectory_v1::model::CreateNamespaceRequest;
495 /// let x = CreateNamespaceRequest::new().set_parent("example");
496 /// ```
497 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
498 self.parent = v.into();
499 self
500 }
501
502 /// Sets the value of [namespace_id][crate::model::CreateNamespaceRequest::namespace_id].
503 ///
504 /// # Example
505 /// ```ignore,no_run
506 /// # use google_cloud_servicedirectory_v1::model::CreateNamespaceRequest;
507 /// let x = CreateNamespaceRequest::new().set_namespace_id("example");
508 /// ```
509 pub fn set_namespace_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
510 self.namespace_id = v.into();
511 self
512 }
513
514 /// Sets the value of [namespace][crate::model::CreateNamespaceRequest::namespace].
515 ///
516 /// # Example
517 /// ```ignore,no_run
518 /// # use google_cloud_servicedirectory_v1::model::CreateNamespaceRequest;
519 /// use google_cloud_servicedirectory_v1::model::Namespace;
520 /// let x = CreateNamespaceRequest::new().set_namespace(Namespace::default()/* use setters */);
521 /// ```
522 pub fn set_namespace<T>(mut self, v: T) -> Self
523 where
524 T: std::convert::Into<crate::model::Namespace>,
525 {
526 self.namespace = std::option::Option::Some(v.into());
527 self
528 }
529
530 /// Sets or clears the value of [namespace][crate::model::CreateNamespaceRequest::namespace].
531 ///
532 /// # Example
533 /// ```ignore,no_run
534 /// # use google_cloud_servicedirectory_v1::model::CreateNamespaceRequest;
535 /// use google_cloud_servicedirectory_v1::model::Namespace;
536 /// let x = CreateNamespaceRequest::new().set_or_clear_namespace(Some(Namespace::default()/* use setters */));
537 /// let x = CreateNamespaceRequest::new().set_or_clear_namespace(None::<Namespace>);
538 /// ```
539 pub fn set_or_clear_namespace<T>(mut self, v: std::option::Option<T>) -> Self
540 where
541 T: std::convert::Into<crate::model::Namespace>,
542 {
543 self.namespace = v.map(|x| x.into());
544 self
545 }
546}
547
548impl wkt::message::Message for CreateNamespaceRequest {
549 fn typename() -> &'static str {
550 "type.googleapis.com/google.cloud.servicedirectory.v1.CreateNamespaceRequest"
551 }
552}
553
554/// The request message for
555/// [RegistrationService.ListNamespaces][google.cloud.servicedirectory.v1.RegistrationService.ListNamespaces].
556///
557/// [google.cloud.servicedirectory.v1.RegistrationService.ListNamespaces]: crate::client::RegistrationService::list_namespaces
558#[derive(Clone, Default, PartialEq)]
559#[non_exhaustive]
560pub struct ListNamespacesRequest {
561 /// Required. The resource name of the project and location whose namespaces
562 /// you'd like to list.
563 pub parent: std::string::String,
564
565 /// Optional. The maximum number of items to return.
566 pub page_size: i32,
567
568 /// Optional. The next_page_token value returned from a previous List request,
569 /// if any.
570 pub page_token: std::string::String,
571
572 /// Optional. The filter to list results by.
573 ///
574 /// General `filter` string syntax:
575 /// `<field> <operator> <value> (<logical connector>)`
576 ///
577 /// * `<field>` can be `name` or `labels.<key>` for map field
578 /// * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
579 /// means `HAS`, and is roughly the same as `=`
580 /// * `<value>` must be the same data type as field
581 /// * `<logical connector>` can be `AND`, `OR`, `NOT`
582 ///
583 /// Examples of valid filters:
584 ///
585 /// * `labels.owner` returns namespaces that have a label with the key
586 /// `owner`, this is the same as `labels:owner`
587 /// * `labels.owner=sd` returns namespaces that have key/value
588 /// `owner=sd`
589 /// * `name>projects/my-project/locations/us-east1/namespaces/namespace-c`
590 /// returns namespaces that have name that is alphabetically later than the
591 /// string, so "namespace-e" is returned but "namespace-a" is not
592 /// * `labels.owner!=sd AND labels.foo=bar` returns namespaces that have
593 /// `owner` in label key but value is not `sd` AND have key/value `foo=bar`
594 /// * `doesnotexist.foo=bar` returns an empty list. Note that namespace
595 /// doesn't have a field called "doesnotexist". Since the filter does not
596 /// match any namespaces, it returns no results
597 ///
598 /// For more information about filtering, see
599 /// [API Filtering](https://aip.dev/160).
600 pub filter: std::string::String,
601
602 /// Optional. The order to list results by.
603 ///
604 /// General `order_by` string syntax: `<field> (<asc|desc>) (,)`
605 ///
606 /// * `<field>` allows value: `name`
607 /// * `<asc|desc>` ascending or descending order by `<field>`. If this is
608 /// left blank, `asc` is used
609 ///
610 /// Note that an empty `order_by` string results in default order, which is
611 /// order by `name` in ascending order.
612 pub order_by: std::string::String,
613
614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
615}
616
617impl ListNamespacesRequest {
618 /// Creates a new default instance.
619 pub fn new() -> Self {
620 std::default::Default::default()
621 }
622
623 /// Sets the value of [parent][crate::model::ListNamespacesRequest::parent].
624 ///
625 /// # Example
626 /// ```ignore,no_run
627 /// # use google_cloud_servicedirectory_v1::model::ListNamespacesRequest;
628 /// let x = ListNamespacesRequest::new().set_parent("example");
629 /// ```
630 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
631 self.parent = v.into();
632 self
633 }
634
635 /// Sets the value of [page_size][crate::model::ListNamespacesRequest::page_size].
636 ///
637 /// # Example
638 /// ```ignore,no_run
639 /// # use google_cloud_servicedirectory_v1::model::ListNamespacesRequest;
640 /// let x = ListNamespacesRequest::new().set_page_size(42);
641 /// ```
642 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
643 self.page_size = v.into();
644 self
645 }
646
647 /// Sets the value of [page_token][crate::model::ListNamespacesRequest::page_token].
648 ///
649 /// # Example
650 /// ```ignore,no_run
651 /// # use google_cloud_servicedirectory_v1::model::ListNamespacesRequest;
652 /// let x = ListNamespacesRequest::new().set_page_token("example");
653 /// ```
654 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
655 self.page_token = v.into();
656 self
657 }
658
659 /// Sets the value of [filter][crate::model::ListNamespacesRequest::filter].
660 ///
661 /// # Example
662 /// ```ignore,no_run
663 /// # use google_cloud_servicedirectory_v1::model::ListNamespacesRequest;
664 /// let x = ListNamespacesRequest::new().set_filter("example");
665 /// ```
666 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
667 self.filter = v.into();
668 self
669 }
670
671 /// Sets the value of [order_by][crate::model::ListNamespacesRequest::order_by].
672 ///
673 /// # Example
674 /// ```ignore,no_run
675 /// # use google_cloud_servicedirectory_v1::model::ListNamespacesRequest;
676 /// let x = ListNamespacesRequest::new().set_order_by("example");
677 /// ```
678 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
679 self.order_by = v.into();
680 self
681 }
682}
683
684impl wkt::message::Message for ListNamespacesRequest {
685 fn typename() -> &'static str {
686 "type.googleapis.com/google.cloud.servicedirectory.v1.ListNamespacesRequest"
687 }
688}
689
690/// The response message for
691/// [RegistrationService.ListNamespaces][google.cloud.servicedirectory.v1.RegistrationService.ListNamespaces].
692///
693/// [google.cloud.servicedirectory.v1.RegistrationService.ListNamespaces]: crate::client::RegistrationService::list_namespaces
694#[derive(Clone, Default, PartialEq)]
695#[non_exhaustive]
696pub struct ListNamespacesResponse {
697 /// The list of namespaces.
698 pub namespaces: std::vec::Vec<crate::model::Namespace>,
699
700 /// Token to retrieve the next page of results, or empty if there are no
701 /// more results in the list.
702 pub next_page_token: std::string::String,
703
704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
705}
706
707impl ListNamespacesResponse {
708 /// Creates a new default instance.
709 pub fn new() -> Self {
710 std::default::Default::default()
711 }
712
713 /// Sets the value of [namespaces][crate::model::ListNamespacesResponse::namespaces].
714 ///
715 /// # Example
716 /// ```ignore,no_run
717 /// # use google_cloud_servicedirectory_v1::model::ListNamespacesResponse;
718 /// use google_cloud_servicedirectory_v1::model::Namespace;
719 /// let x = ListNamespacesResponse::new()
720 /// .set_namespaces([
721 /// Namespace::default()/* use setters */,
722 /// Namespace::default()/* use (different) setters */,
723 /// ]);
724 /// ```
725 pub fn set_namespaces<T, V>(mut self, v: T) -> Self
726 where
727 T: std::iter::IntoIterator<Item = V>,
728 V: std::convert::Into<crate::model::Namespace>,
729 {
730 use std::iter::Iterator;
731 self.namespaces = v.into_iter().map(|i| i.into()).collect();
732 self
733 }
734
735 /// Sets the value of [next_page_token][crate::model::ListNamespacesResponse::next_page_token].
736 ///
737 /// # Example
738 /// ```ignore,no_run
739 /// # use google_cloud_servicedirectory_v1::model::ListNamespacesResponse;
740 /// let x = ListNamespacesResponse::new().set_next_page_token("example");
741 /// ```
742 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
743 self.next_page_token = v.into();
744 self
745 }
746}
747
748impl wkt::message::Message for ListNamespacesResponse {
749 fn typename() -> &'static str {
750 "type.googleapis.com/google.cloud.servicedirectory.v1.ListNamespacesResponse"
751 }
752}
753
754#[doc(hidden)]
755impl google_cloud_gax::paginator::internal::PageableResponse for ListNamespacesResponse {
756 type PageItem = crate::model::Namespace;
757
758 fn items(self) -> std::vec::Vec<Self::PageItem> {
759 self.namespaces
760 }
761
762 fn next_page_token(&self) -> std::string::String {
763 use std::clone::Clone;
764 self.next_page_token.clone()
765 }
766}
767
768/// The request message for
769/// [RegistrationService.GetNamespace][google.cloud.servicedirectory.v1.RegistrationService.GetNamespace].
770///
771/// [google.cloud.servicedirectory.v1.RegistrationService.GetNamespace]: crate::client::RegistrationService::get_namespace
772#[derive(Clone, Default, PartialEq)]
773#[non_exhaustive]
774pub struct GetNamespaceRequest {
775 /// Required. The name of the namespace to retrieve.
776 pub name: std::string::String,
777
778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
779}
780
781impl GetNamespaceRequest {
782 /// Creates a new default instance.
783 pub fn new() -> Self {
784 std::default::Default::default()
785 }
786
787 /// Sets the value of [name][crate::model::GetNamespaceRequest::name].
788 ///
789 /// # Example
790 /// ```ignore,no_run
791 /// # use google_cloud_servicedirectory_v1::model::GetNamespaceRequest;
792 /// # let project_id = "project_id";
793 /// # let location_id = "location_id";
794 /// # let namespace_id = "namespace_id";
795 /// let x = GetNamespaceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}"));
796 /// ```
797 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
798 self.name = v.into();
799 self
800 }
801}
802
803impl wkt::message::Message for GetNamespaceRequest {
804 fn typename() -> &'static str {
805 "type.googleapis.com/google.cloud.servicedirectory.v1.GetNamespaceRequest"
806 }
807}
808
809/// The request message for
810/// [RegistrationService.UpdateNamespace][google.cloud.servicedirectory.v1.RegistrationService.UpdateNamespace].
811///
812/// [google.cloud.servicedirectory.v1.RegistrationService.UpdateNamespace]: crate::client::RegistrationService::update_namespace
813#[derive(Clone, Default, PartialEq)]
814#[non_exhaustive]
815pub struct UpdateNamespaceRequest {
816 /// Required. The updated namespace.
817 pub namespace: std::option::Option<crate::model::Namespace>,
818
819 /// Required. List of fields to be updated in this request.
820 pub update_mask: std::option::Option<wkt::FieldMask>,
821
822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
823}
824
825impl UpdateNamespaceRequest {
826 /// Creates a new default instance.
827 pub fn new() -> Self {
828 std::default::Default::default()
829 }
830
831 /// Sets the value of [namespace][crate::model::UpdateNamespaceRequest::namespace].
832 ///
833 /// # Example
834 /// ```ignore,no_run
835 /// # use google_cloud_servicedirectory_v1::model::UpdateNamespaceRequest;
836 /// use google_cloud_servicedirectory_v1::model::Namespace;
837 /// let x = UpdateNamespaceRequest::new().set_namespace(Namespace::default()/* use setters */);
838 /// ```
839 pub fn set_namespace<T>(mut self, v: T) -> Self
840 where
841 T: std::convert::Into<crate::model::Namespace>,
842 {
843 self.namespace = std::option::Option::Some(v.into());
844 self
845 }
846
847 /// Sets or clears the value of [namespace][crate::model::UpdateNamespaceRequest::namespace].
848 ///
849 /// # Example
850 /// ```ignore,no_run
851 /// # use google_cloud_servicedirectory_v1::model::UpdateNamespaceRequest;
852 /// use google_cloud_servicedirectory_v1::model::Namespace;
853 /// let x = UpdateNamespaceRequest::new().set_or_clear_namespace(Some(Namespace::default()/* use setters */));
854 /// let x = UpdateNamespaceRequest::new().set_or_clear_namespace(None::<Namespace>);
855 /// ```
856 pub fn set_or_clear_namespace<T>(mut self, v: std::option::Option<T>) -> Self
857 where
858 T: std::convert::Into<crate::model::Namespace>,
859 {
860 self.namespace = v.map(|x| x.into());
861 self
862 }
863
864 /// Sets the value of [update_mask][crate::model::UpdateNamespaceRequest::update_mask].
865 ///
866 /// # Example
867 /// ```ignore,no_run
868 /// # use google_cloud_servicedirectory_v1::model::UpdateNamespaceRequest;
869 /// use wkt::FieldMask;
870 /// let x = UpdateNamespaceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
871 /// ```
872 pub fn set_update_mask<T>(mut self, v: T) -> Self
873 where
874 T: std::convert::Into<wkt::FieldMask>,
875 {
876 self.update_mask = std::option::Option::Some(v.into());
877 self
878 }
879
880 /// Sets or clears the value of [update_mask][crate::model::UpdateNamespaceRequest::update_mask].
881 ///
882 /// # Example
883 /// ```ignore,no_run
884 /// # use google_cloud_servicedirectory_v1::model::UpdateNamespaceRequest;
885 /// use wkt::FieldMask;
886 /// let x = UpdateNamespaceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
887 /// let x = UpdateNamespaceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
888 /// ```
889 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
890 where
891 T: std::convert::Into<wkt::FieldMask>,
892 {
893 self.update_mask = v.map(|x| x.into());
894 self
895 }
896}
897
898impl wkt::message::Message for UpdateNamespaceRequest {
899 fn typename() -> &'static str {
900 "type.googleapis.com/google.cloud.servicedirectory.v1.UpdateNamespaceRequest"
901 }
902}
903
904/// The request message for
905/// [RegistrationService.DeleteNamespace][google.cloud.servicedirectory.v1.RegistrationService.DeleteNamespace].
906///
907/// [google.cloud.servicedirectory.v1.RegistrationService.DeleteNamespace]: crate::client::RegistrationService::delete_namespace
908#[derive(Clone, Default, PartialEq)]
909#[non_exhaustive]
910pub struct DeleteNamespaceRequest {
911 /// Required. The name of the namespace to delete.
912 pub name: std::string::String,
913
914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
915}
916
917impl DeleteNamespaceRequest {
918 /// Creates a new default instance.
919 pub fn new() -> Self {
920 std::default::Default::default()
921 }
922
923 /// Sets the value of [name][crate::model::DeleteNamespaceRequest::name].
924 ///
925 /// # Example
926 /// ```ignore,no_run
927 /// # use google_cloud_servicedirectory_v1::model::DeleteNamespaceRequest;
928 /// # let project_id = "project_id";
929 /// # let location_id = "location_id";
930 /// # let namespace_id = "namespace_id";
931 /// let x = DeleteNamespaceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}"));
932 /// ```
933 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
934 self.name = v.into();
935 self
936 }
937}
938
939impl wkt::message::Message for DeleteNamespaceRequest {
940 fn typename() -> &'static str {
941 "type.googleapis.com/google.cloud.servicedirectory.v1.DeleteNamespaceRequest"
942 }
943}
944
945/// The request message for
946/// [RegistrationService.CreateService][google.cloud.servicedirectory.v1.RegistrationService.CreateService].
947///
948/// [google.cloud.servicedirectory.v1.RegistrationService.CreateService]: crate::client::RegistrationService::create_service
949#[derive(Clone, Default, PartialEq)]
950#[non_exhaustive]
951pub struct CreateServiceRequest {
952 /// Required. The resource name of the namespace this service will belong to.
953 pub parent: std::string::String,
954
955 /// Required. The Resource ID must be 1-63 characters long, and comply with
956 /// <a href="https://www.ietf.org/rfc/rfc1035.txt" target="_blank">RFC1035</a>.
957 /// Specifically, the name must be 1-63 characters long and match the regular
958 /// expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
959 /// character must be a lowercase letter, and all following characters must
960 /// be a dash, lowercase letter, or digit, except the last character, which
961 /// cannot be a dash.
962 pub service_id: std::string::String,
963
964 /// Required. A service with initial fields set.
965 pub service: std::option::Option<crate::model::Service>,
966
967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
968}
969
970impl CreateServiceRequest {
971 /// Creates a new default instance.
972 pub fn new() -> Self {
973 std::default::Default::default()
974 }
975
976 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
977 ///
978 /// # Example
979 /// ```ignore,no_run
980 /// # use google_cloud_servicedirectory_v1::model::CreateServiceRequest;
981 /// # let project_id = "project_id";
982 /// # let location_id = "location_id";
983 /// # let namespace_id = "namespace_id";
984 /// let x = CreateServiceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}"));
985 /// ```
986 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
987 self.parent = v.into();
988 self
989 }
990
991 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
992 ///
993 /// # Example
994 /// ```ignore,no_run
995 /// # use google_cloud_servicedirectory_v1::model::CreateServiceRequest;
996 /// let x = CreateServiceRequest::new().set_service_id("example");
997 /// ```
998 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
999 self.service_id = v.into();
1000 self
1001 }
1002
1003 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
1004 ///
1005 /// # Example
1006 /// ```ignore,no_run
1007 /// # use google_cloud_servicedirectory_v1::model::CreateServiceRequest;
1008 /// use google_cloud_servicedirectory_v1::model::Service;
1009 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
1010 /// ```
1011 pub fn set_service<T>(mut self, v: T) -> Self
1012 where
1013 T: std::convert::Into<crate::model::Service>,
1014 {
1015 self.service = std::option::Option::Some(v.into());
1016 self
1017 }
1018
1019 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
1020 ///
1021 /// # Example
1022 /// ```ignore,no_run
1023 /// # use google_cloud_servicedirectory_v1::model::CreateServiceRequest;
1024 /// use google_cloud_servicedirectory_v1::model::Service;
1025 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
1026 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
1027 /// ```
1028 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
1029 where
1030 T: std::convert::Into<crate::model::Service>,
1031 {
1032 self.service = v.map(|x| x.into());
1033 self
1034 }
1035}
1036
1037impl wkt::message::Message for CreateServiceRequest {
1038 fn typename() -> &'static str {
1039 "type.googleapis.com/google.cloud.servicedirectory.v1.CreateServiceRequest"
1040 }
1041}
1042
1043/// The request message for
1044/// [RegistrationService.ListServices][google.cloud.servicedirectory.v1.RegistrationService.ListServices].
1045///
1046/// [google.cloud.servicedirectory.v1.RegistrationService.ListServices]: crate::client::RegistrationService::list_services
1047#[derive(Clone, Default, PartialEq)]
1048#[non_exhaustive]
1049pub struct ListServicesRequest {
1050 /// Required. The resource name of the namespace whose services you'd
1051 /// like to list.
1052 pub parent: std::string::String,
1053
1054 /// Optional. The maximum number of items to return.
1055 pub page_size: i32,
1056
1057 /// Optional. The next_page_token value returned from a previous List request,
1058 /// if any.
1059 pub page_token: std::string::String,
1060
1061 /// Optional. The filter to list results by.
1062 ///
1063 /// General `filter` string syntax:
1064 /// `<field> <operator> <value> (<logical connector>)`
1065 ///
1066 /// * `<field>` can be `name` or `annotations.<key>` for map field
1067 /// * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
1068 /// means `HAS`, and is roughly the same as `=`
1069 /// * `<value>` must be the same data type as field
1070 /// * `<logical connector>` can be `AND`, `OR`, `NOT`
1071 ///
1072 /// Examples of valid filters:
1073 ///
1074 /// * `annotations.owner` returns services that have a annotation with the
1075 /// key `owner`, this is the same as `annotations:owner`
1076 /// * `annotations.protocol=gRPC` returns services that have key/value
1077 /// `protocol=gRPC`
1078 ///
1079 /// `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/service-c`
1080 /// returns services that have name that is alphabetically later than the
1081 /// string, so "service-e" is returned but "service-a" is not
1082 ///
1083 /// * `annotations.owner!=sd AND annotations.foo=bar` returns services that
1084 /// have `owner` in annotation key but value is not `sd` AND have
1085 /// key/value `foo=bar`
1086 /// * `doesnotexist.foo=bar` returns an empty list. Note that service
1087 /// doesn't have a field called "doesnotexist". Since the filter does not
1088 /// match any services, it returns no results
1089 ///
1090 /// For more information about filtering, see
1091 /// [API Filtering](https://aip.dev/160).
1092 pub filter: std::string::String,
1093
1094 /// Optional. The order to list results by.
1095 ///
1096 /// General `order_by` string syntax: `<field> (<asc|desc>) (,)`
1097 ///
1098 /// * `<field>` allows value: `name`
1099 /// * `<asc|desc>` ascending or descending order by `<field>`. If this is
1100 /// left blank, `asc` is used
1101 ///
1102 /// Note that an empty `order_by` string results in default order, which is
1103 /// order by `name` in ascending order.
1104 pub order_by: std::string::String,
1105
1106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1107}
1108
1109impl ListServicesRequest {
1110 /// Creates a new default instance.
1111 pub fn new() -> Self {
1112 std::default::Default::default()
1113 }
1114
1115 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
1116 ///
1117 /// # Example
1118 /// ```ignore,no_run
1119 /// # use google_cloud_servicedirectory_v1::model::ListServicesRequest;
1120 /// # let project_id = "project_id";
1121 /// # let location_id = "location_id";
1122 /// # let namespace_id = "namespace_id";
1123 /// let x = ListServicesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}"));
1124 /// ```
1125 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1126 self.parent = v.into();
1127 self
1128 }
1129
1130 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
1131 ///
1132 /// # Example
1133 /// ```ignore,no_run
1134 /// # use google_cloud_servicedirectory_v1::model::ListServicesRequest;
1135 /// let x = ListServicesRequest::new().set_page_size(42);
1136 /// ```
1137 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1138 self.page_size = v.into();
1139 self
1140 }
1141
1142 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
1143 ///
1144 /// # Example
1145 /// ```ignore,no_run
1146 /// # use google_cloud_servicedirectory_v1::model::ListServicesRequest;
1147 /// let x = ListServicesRequest::new().set_page_token("example");
1148 /// ```
1149 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1150 self.page_token = v.into();
1151 self
1152 }
1153
1154 /// Sets the value of [filter][crate::model::ListServicesRequest::filter].
1155 ///
1156 /// # Example
1157 /// ```ignore,no_run
1158 /// # use google_cloud_servicedirectory_v1::model::ListServicesRequest;
1159 /// let x = ListServicesRequest::new().set_filter("example");
1160 /// ```
1161 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1162 self.filter = v.into();
1163 self
1164 }
1165
1166 /// Sets the value of [order_by][crate::model::ListServicesRequest::order_by].
1167 ///
1168 /// # Example
1169 /// ```ignore,no_run
1170 /// # use google_cloud_servicedirectory_v1::model::ListServicesRequest;
1171 /// let x = ListServicesRequest::new().set_order_by("example");
1172 /// ```
1173 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1174 self.order_by = v.into();
1175 self
1176 }
1177}
1178
1179impl wkt::message::Message for ListServicesRequest {
1180 fn typename() -> &'static str {
1181 "type.googleapis.com/google.cloud.servicedirectory.v1.ListServicesRequest"
1182 }
1183}
1184
1185/// The response message for
1186/// [RegistrationService.ListServices][google.cloud.servicedirectory.v1.RegistrationService.ListServices].
1187///
1188/// [google.cloud.servicedirectory.v1.RegistrationService.ListServices]: crate::client::RegistrationService::list_services
1189#[derive(Clone, Default, PartialEq)]
1190#[non_exhaustive]
1191pub struct ListServicesResponse {
1192 /// The list of services.
1193 pub services: std::vec::Vec<crate::model::Service>,
1194
1195 /// Token to retrieve the next page of results, or empty if there are no
1196 /// more results in the list.
1197 pub next_page_token: std::string::String,
1198
1199 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1200}
1201
1202impl ListServicesResponse {
1203 /// Creates a new default instance.
1204 pub fn new() -> Self {
1205 std::default::Default::default()
1206 }
1207
1208 /// Sets the value of [services][crate::model::ListServicesResponse::services].
1209 ///
1210 /// # Example
1211 /// ```ignore,no_run
1212 /// # use google_cloud_servicedirectory_v1::model::ListServicesResponse;
1213 /// use google_cloud_servicedirectory_v1::model::Service;
1214 /// let x = ListServicesResponse::new()
1215 /// .set_services([
1216 /// Service::default()/* use setters */,
1217 /// Service::default()/* use (different) setters */,
1218 /// ]);
1219 /// ```
1220 pub fn set_services<T, V>(mut self, v: T) -> Self
1221 where
1222 T: std::iter::IntoIterator<Item = V>,
1223 V: std::convert::Into<crate::model::Service>,
1224 {
1225 use std::iter::Iterator;
1226 self.services = v.into_iter().map(|i| i.into()).collect();
1227 self
1228 }
1229
1230 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
1231 ///
1232 /// # Example
1233 /// ```ignore,no_run
1234 /// # use google_cloud_servicedirectory_v1::model::ListServicesResponse;
1235 /// let x = ListServicesResponse::new().set_next_page_token("example");
1236 /// ```
1237 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1238 self.next_page_token = v.into();
1239 self
1240 }
1241}
1242
1243impl wkt::message::Message for ListServicesResponse {
1244 fn typename() -> &'static str {
1245 "type.googleapis.com/google.cloud.servicedirectory.v1.ListServicesResponse"
1246 }
1247}
1248
1249#[doc(hidden)]
1250impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
1251 type PageItem = crate::model::Service;
1252
1253 fn items(self) -> std::vec::Vec<Self::PageItem> {
1254 self.services
1255 }
1256
1257 fn next_page_token(&self) -> std::string::String {
1258 use std::clone::Clone;
1259 self.next_page_token.clone()
1260 }
1261}
1262
1263/// The request message for
1264/// [RegistrationService.GetService][google.cloud.servicedirectory.v1.RegistrationService.GetService].
1265/// This should not be used for looking up a service. Instead, use the `resolve`
1266/// method as it contains all endpoints and associated annotations.
1267///
1268/// [google.cloud.servicedirectory.v1.RegistrationService.GetService]: crate::client::RegistrationService::get_service
1269#[derive(Clone, Default, PartialEq)]
1270#[non_exhaustive]
1271pub struct GetServiceRequest {
1272 /// Required. The name of the service to get.
1273 pub name: std::string::String,
1274
1275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1276}
1277
1278impl GetServiceRequest {
1279 /// Creates a new default instance.
1280 pub fn new() -> Self {
1281 std::default::Default::default()
1282 }
1283
1284 /// Sets the value of [name][crate::model::GetServiceRequest::name].
1285 ///
1286 /// # Example
1287 /// ```ignore,no_run
1288 /// # use google_cloud_servicedirectory_v1::model::GetServiceRequest;
1289 /// # let project_id = "project_id";
1290 /// # let location_id = "location_id";
1291 /// # let namespace_id = "namespace_id";
1292 /// # let service_id = "service_id";
1293 /// let x = GetServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}"));
1294 /// ```
1295 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1296 self.name = v.into();
1297 self
1298 }
1299}
1300
1301impl wkt::message::Message for GetServiceRequest {
1302 fn typename() -> &'static str {
1303 "type.googleapis.com/google.cloud.servicedirectory.v1.GetServiceRequest"
1304 }
1305}
1306
1307/// The request message for
1308/// [RegistrationService.UpdateService][google.cloud.servicedirectory.v1.RegistrationService.UpdateService].
1309///
1310/// [google.cloud.servicedirectory.v1.RegistrationService.UpdateService]: crate::client::RegistrationService::update_service
1311#[derive(Clone, Default, PartialEq)]
1312#[non_exhaustive]
1313pub struct UpdateServiceRequest {
1314 /// Required. The updated service.
1315 pub service: std::option::Option<crate::model::Service>,
1316
1317 /// Required. List of fields to be updated in this request.
1318 pub update_mask: std::option::Option<wkt::FieldMask>,
1319
1320 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1321}
1322
1323impl UpdateServiceRequest {
1324 /// Creates a new default instance.
1325 pub fn new() -> Self {
1326 std::default::Default::default()
1327 }
1328
1329 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
1330 ///
1331 /// # Example
1332 /// ```ignore,no_run
1333 /// # use google_cloud_servicedirectory_v1::model::UpdateServiceRequest;
1334 /// use google_cloud_servicedirectory_v1::model::Service;
1335 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
1336 /// ```
1337 pub fn set_service<T>(mut self, v: T) -> Self
1338 where
1339 T: std::convert::Into<crate::model::Service>,
1340 {
1341 self.service = std::option::Option::Some(v.into());
1342 self
1343 }
1344
1345 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
1346 ///
1347 /// # Example
1348 /// ```ignore,no_run
1349 /// # use google_cloud_servicedirectory_v1::model::UpdateServiceRequest;
1350 /// use google_cloud_servicedirectory_v1::model::Service;
1351 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
1352 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
1353 /// ```
1354 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
1355 where
1356 T: std::convert::Into<crate::model::Service>,
1357 {
1358 self.service = v.map(|x| x.into());
1359 self
1360 }
1361
1362 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
1363 ///
1364 /// # Example
1365 /// ```ignore,no_run
1366 /// # use google_cloud_servicedirectory_v1::model::UpdateServiceRequest;
1367 /// use wkt::FieldMask;
1368 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1369 /// ```
1370 pub fn set_update_mask<T>(mut self, v: T) -> Self
1371 where
1372 T: std::convert::Into<wkt::FieldMask>,
1373 {
1374 self.update_mask = std::option::Option::Some(v.into());
1375 self
1376 }
1377
1378 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
1379 ///
1380 /// # Example
1381 /// ```ignore,no_run
1382 /// # use google_cloud_servicedirectory_v1::model::UpdateServiceRequest;
1383 /// use wkt::FieldMask;
1384 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1385 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1386 /// ```
1387 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1388 where
1389 T: std::convert::Into<wkt::FieldMask>,
1390 {
1391 self.update_mask = v.map(|x| x.into());
1392 self
1393 }
1394}
1395
1396impl wkt::message::Message for UpdateServiceRequest {
1397 fn typename() -> &'static str {
1398 "type.googleapis.com/google.cloud.servicedirectory.v1.UpdateServiceRequest"
1399 }
1400}
1401
1402/// The request message for
1403/// [RegistrationService.DeleteService][google.cloud.servicedirectory.v1.RegistrationService.DeleteService].
1404///
1405/// [google.cloud.servicedirectory.v1.RegistrationService.DeleteService]: crate::client::RegistrationService::delete_service
1406#[derive(Clone, Default, PartialEq)]
1407#[non_exhaustive]
1408pub struct DeleteServiceRequest {
1409 /// Required. The name of the service to delete.
1410 pub name: std::string::String,
1411
1412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1413}
1414
1415impl DeleteServiceRequest {
1416 /// Creates a new default instance.
1417 pub fn new() -> Self {
1418 std::default::Default::default()
1419 }
1420
1421 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
1422 ///
1423 /// # Example
1424 /// ```ignore,no_run
1425 /// # use google_cloud_servicedirectory_v1::model::DeleteServiceRequest;
1426 /// # let project_id = "project_id";
1427 /// # let location_id = "location_id";
1428 /// # let namespace_id = "namespace_id";
1429 /// # let service_id = "service_id";
1430 /// let x = DeleteServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}"));
1431 /// ```
1432 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1433 self.name = v.into();
1434 self
1435 }
1436}
1437
1438impl wkt::message::Message for DeleteServiceRequest {
1439 fn typename() -> &'static str {
1440 "type.googleapis.com/google.cloud.servicedirectory.v1.DeleteServiceRequest"
1441 }
1442}
1443
1444/// The request message for
1445/// [RegistrationService.CreateEndpoint][google.cloud.servicedirectory.v1.RegistrationService.CreateEndpoint].
1446///
1447/// [google.cloud.servicedirectory.v1.RegistrationService.CreateEndpoint]: crate::client::RegistrationService::create_endpoint
1448#[derive(Clone, Default, PartialEq)]
1449#[non_exhaustive]
1450pub struct CreateEndpointRequest {
1451 /// Required. The resource name of the service that this endpoint provides.
1452 pub parent: std::string::String,
1453
1454 /// Required. The Resource ID must be 1-63 characters long, and comply with
1455 /// <a href="https://www.ietf.org/rfc/rfc1035.txt" target="_blank">RFC1035</a>.
1456 /// Specifically, the name must be 1-63 characters long and match the regular
1457 /// expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
1458 /// character must be a lowercase letter, and all following characters must
1459 /// be a dash, lowercase letter, or digit, except the last character, which
1460 /// cannot be a dash.
1461 pub endpoint_id: std::string::String,
1462
1463 /// Required. A endpoint with initial fields set.
1464 pub endpoint: std::option::Option<crate::model::Endpoint>,
1465
1466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1467}
1468
1469impl CreateEndpointRequest {
1470 /// Creates a new default instance.
1471 pub fn new() -> Self {
1472 std::default::Default::default()
1473 }
1474
1475 /// Sets the value of [parent][crate::model::CreateEndpointRequest::parent].
1476 ///
1477 /// # Example
1478 /// ```ignore,no_run
1479 /// # use google_cloud_servicedirectory_v1::model::CreateEndpointRequest;
1480 /// # let project_id = "project_id";
1481 /// # let location_id = "location_id";
1482 /// # let namespace_id = "namespace_id";
1483 /// # let service_id = "service_id";
1484 /// let x = CreateEndpointRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}"));
1485 /// ```
1486 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1487 self.parent = v.into();
1488 self
1489 }
1490
1491 /// Sets the value of [endpoint_id][crate::model::CreateEndpointRequest::endpoint_id].
1492 ///
1493 /// # Example
1494 /// ```ignore,no_run
1495 /// # use google_cloud_servicedirectory_v1::model::CreateEndpointRequest;
1496 /// let x = CreateEndpointRequest::new().set_endpoint_id("example");
1497 /// ```
1498 pub fn set_endpoint_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1499 self.endpoint_id = v.into();
1500 self
1501 }
1502
1503 /// Sets the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
1504 ///
1505 /// # Example
1506 /// ```ignore,no_run
1507 /// # use google_cloud_servicedirectory_v1::model::CreateEndpointRequest;
1508 /// use google_cloud_servicedirectory_v1::model::Endpoint;
1509 /// let x = CreateEndpointRequest::new().set_endpoint(Endpoint::default()/* use setters */);
1510 /// ```
1511 pub fn set_endpoint<T>(mut self, v: T) -> Self
1512 where
1513 T: std::convert::Into<crate::model::Endpoint>,
1514 {
1515 self.endpoint = std::option::Option::Some(v.into());
1516 self
1517 }
1518
1519 /// Sets or clears the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
1520 ///
1521 /// # Example
1522 /// ```ignore,no_run
1523 /// # use google_cloud_servicedirectory_v1::model::CreateEndpointRequest;
1524 /// use google_cloud_servicedirectory_v1::model::Endpoint;
1525 /// let x = CreateEndpointRequest::new().set_or_clear_endpoint(Some(Endpoint::default()/* use setters */));
1526 /// let x = CreateEndpointRequest::new().set_or_clear_endpoint(None::<Endpoint>);
1527 /// ```
1528 pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
1529 where
1530 T: std::convert::Into<crate::model::Endpoint>,
1531 {
1532 self.endpoint = v.map(|x| x.into());
1533 self
1534 }
1535}
1536
1537impl wkt::message::Message for CreateEndpointRequest {
1538 fn typename() -> &'static str {
1539 "type.googleapis.com/google.cloud.servicedirectory.v1.CreateEndpointRequest"
1540 }
1541}
1542
1543/// The request message for
1544/// [RegistrationService.ListEndpoints][google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints].
1545///
1546/// [google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints]: crate::client::RegistrationService::list_endpoints
1547#[derive(Clone, Default, PartialEq)]
1548#[non_exhaustive]
1549pub struct ListEndpointsRequest {
1550 /// Required. The resource name of the service whose endpoints you'd like to
1551 /// list.
1552 pub parent: std::string::String,
1553
1554 /// Optional. The maximum number of items to return.
1555 pub page_size: i32,
1556
1557 /// Optional. The next_page_token value returned from a previous List request,
1558 /// if any.
1559 pub page_token: std::string::String,
1560
1561 /// Optional. The filter to list results by.
1562 ///
1563 /// General `filter` string syntax:
1564 /// `<field> <operator> <value> (<logical connector>)`
1565 ///
1566 /// * `<field>` can be `name`, `address`, `port`, or `annotations.<key>` for
1567 /// map field
1568 /// * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
1569 /// means `HAS`, and is roughly the same as `=`
1570 /// * `<value>` must be the same data type as field
1571 /// * `<logical connector>` can be `AND`, `OR`, `NOT`
1572 ///
1573 /// Examples of valid filters:
1574 ///
1575 /// * `annotations.owner` returns endpoints that have a annotation with the
1576 /// key `owner`, this is the same as `annotations:owner`
1577 /// * `annotations.protocol=gRPC` returns endpoints that have key/value
1578 /// `protocol=gRPC`
1579 /// * `address=192.108.1.105` returns endpoints that have this address
1580 /// * `port>8080` returns endpoints that have port number larger than 8080
1581 ///
1582 /// `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
1583 /// returns endpoints that have name that is alphabetically later than the
1584 /// string, so "endpoint-e" is returned but "endpoint-a" is not
1585 ///
1586 /// * `annotations.owner!=sd AND annotations.foo=bar` returns endpoints that
1587 /// have `owner` in annotation key but value is not `sd` AND have
1588 /// key/value `foo=bar`
1589 /// * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
1590 /// doesn't have a field called "doesnotexist". Since the filter does not
1591 /// match any endpoints, it returns no results
1592 ///
1593 /// For more information about filtering, see
1594 /// [API Filtering](https://aip.dev/160).
1595 pub filter: std::string::String,
1596
1597 /// Optional. The order to list results by.
1598 ///
1599 /// General `order_by` string syntax: `<field> (<asc|desc>) (,)`
1600 ///
1601 /// * `<field>` allows values: `name`, `address`, `port`
1602 /// * `<asc|desc>` ascending or descending order by `<field>`. If this is
1603 /// left blank, `asc` is used
1604 ///
1605 /// Note that an empty `order_by` string results in default order, which is
1606 /// order by `name` in ascending order.
1607 pub order_by: std::string::String,
1608
1609 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1610}
1611
1612impl ListEndpointsRequest {
1613 /// Creates a new default instance.
1614 pub fn new() -> Self {
1615 std::default::Default::default()
1616 }
1617
1618 /// Sets the value of [parent][crate::model::ListEndpointsRequest::parent].
1619 ///
1620 /// # Example
1621 /// ```ignore,no_run
1622 /// # use google_cloud_servicedirectory_v1::model::ListEndpointsRequest;
1623 /// # let project_id = "project_id";
1624 /// # let location_id = "location_id";
1625 /// # let namespace_id = "namespace_id";
1626 /// # let service_id = "service_id";
1627 /// let x = ListEndpointsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}"));
1628 /// ```
1629 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1630 self.parent = v.into();
1631 self
1632 }
1633
1634 /// Sets the value of [page_size][crate::model::ListEndpointsRequest::page_size].
1635 ///
1636 /// # Example
1637 /// ```ignore,no_run
1638 /// # use google_cloud_servicedirectory_v1::model::ListEndpointsRequest;
1639 /// let x = ListEndpointsRequest::new().set_page_size(42);
1640 /// ```
1641 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1642 self.page_size = v.into();
1643 self
1644 }
1645
1646 /// Sets the value of [page_token][crate::model::ListEndpointsRequest::page_token].
1647 ///
1648 /// # Example
1649 /// ```ignore,no_run
1650 /// # use google_cloud_servicedirectory_v1::model::ListEndpointsRequest;
1651 /// let x = ListEndpointsRequest::new().set_page_token("example");
1652 /// ```
1653 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.page_token = v.into();
1655 self
1656 }
1657
1658 /// Sets the value of [filter][crate::model::ListEndpointsRequest::filter].
1659 ///
1660 /// # Example
1661 /// ```ignore,no_run
1662 /// # use google_cloud_servicedirectory_v1::model::ListEndpointsRequest;
1663 /// let x = ListEndpointsRequest::new().set_filter("example");
1664 /// ```
1665 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1666 self.filter = v.into();
1667 self
1668 }
1669
1670 /// Sets the value of [order_by][crate::model::ListEndpointsRequest::order_by].
1671 ///
1672 /// # Example
1673 /// ```ignore,no_run
1674 /// # use google_cloud_servicedirectory_v1::model::ListEndpointsRequest;
1675 /// let x = ListEndpointsRequest::new().set_order_by("example");
1676 /// ```
1677 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1678 self.order_by = v.into();
1679 self
1680 }
1681}
1682
1683impl wkt::message::Message for ListEndpointsRequest {
1684 fn typename() -> &'static str {
1685 "type.googleapis.com/google.cloud.servicedirectory.v1.ListEndpointsRequest"
1686 }
1687}
1688
1689/// The response message for
1690/// [RegistrationService.ListEndpoints][google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints].
1691///
1692/// [google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints]: crate::client::RegistrationService::list_endpoints
1693#[derive(Clone, Default, PartialEq)]
1694#[non_exhaustive]
1695pub struct ListEndpointsResponse {
1696 /// The list of endpoints.
1697 pub endpoints: std::vec::Vec<crate::model::Endpoint>,
1698
1699 /// Token to retrieve the next page of results, or empty if there are no
1700 /// more results in the list.
1701 pub next_page_token: std::string::String,
1702
1703 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1704}
1705
1706impl ListEndpointsResponse {
1707 /// Creates a new default instance.
1708 pub fn new() -> Self {
1709 std::default::Default::default()
1710 }
1711
1712 /// Sets the value of [endpoints][crate::model::ListEndpointsResponse::endpoints].
1713 ///
1714 /// # Example
1715 /// ```ignore,no_run
1716 /// # use google_cloud_servicedirectory_v1::model::ListEndpointsResponse;
1717 /// use google_cloud_servicedirectory_v1::model::Endpoint;
1718 /// let x = ListEndpointsResponse::new()
1719 /// .set_endpoints([
1720 /// Endpoint::default()/* use setters */,
1721 /// Endpoint::default()/* use (different) setters */,
1722 /// ]);
1723 /// ```
1724 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
1725 where
1726 T: std::iter::IntoIterator<Item = V>,
1727 V: std::convert::Into<crate::model::Endpoint>,
1728 {
1729 use std::iter::Iterator;
1730 self.endpoints = v.into_iter().map(|i| i.into()).collect();
1731 self
1732 }
1733
1734 /// Sets the value of [next_page_token][crate::model::ListEndpointsResponse::next_page_token].
1735 ///
1736 /// # Example
1737 /// ```ignore,no_run
1738 /// # use google_cloud_servicedirectory_v1::model::ListEndpointsResponse;
1739 /// let x = ListEndpointsResponse::new().set_next_page_token("example");
1740 /// ```
1741 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1742 self.next_page_token = v.into();
1743 self
1744 }
1745}
1746
1747impl wkt::message::Message for ListEndpointsResponse {
1748 fn typename() -> &'static str {
1749 "type.googleapis.com/google.cloud.servicedirectory.v1.ListEndpointsResponse"
1750 }
1751}
1752
1753#[doc(hidden)]
1754impl google_cloud_gax::paginator::internal::PageableResponse for ListEndpointsResponse {
1755 type PageItem = crate::model::Endpoint;
1756
1757 fn items(self) -> std::vec::Vec<Self::PageItem> {
1758 self.endpoints
1759 }
1760
1761 fn next_page_token(&self) -> std::string::String {
1762 use std::clone::Clone;
1763 self.next_page_token.clone()
1764 }
1765}
1766
1767/// The request message for
1768/// [RegistrationService.GetEndpoint][google.cloud.servicedirectory.v1.RegistrationService.GetEndpoint].
1769/// This should not be used to lookup endpoints at runtime. Instead, use
1770/// the `resolve` method.
1771///
1772/// [google.cloud.servicedirectory.v1.RegistrationService.GetEndpoint]: crate::client::RegistrationService::get_endpoint
1773#[derive(Clone, Default, PartialEq)]
1774#[non_exhaustive]
1775pub struct GetEndpointRequest {
1776 /// Required. The name of the endpoint to get.
1777 pub name: std::string::String,
1778
1779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1780}
1781
1782impl GetEndpointRequest {
1783 /// Creates a new default instance.
1784 pub fn new() -> Self {
1785 std::default::Default::default()
1786 }
1787
1788 /// Sets the value of [name][crate::model::GetEndpointRequest::name].
1789 ///
1790 /// # Example
1791 /// ```ignore,no_run
1792 /// # use google_cloud_servicedirectory_v1::model::GetEndpointRequest;
1793 /// # let project_id = "project_id";
1794 /// # let location_id = "location_id";
1795 /// # let namespace_id = "namespace_id";
1796 /// # let service_id = "service_id";
1797 /// # let endpoint_id = "endpoint_id";
1798 /// let x = GetEndpointRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}/endpoints/{endpoint_id}"));
1799 /// ```
1800 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1801 self.name = v.into();
1802 self
1803 }
1804}
1805
1806impl wkt::message::Message for GetEndpointRequest {
1807 fn typename() -> &'static str {
1808 "type.googleapis.com/google.cloud.servicedirectory.v1.GetEndpointRequest"
1809 }
1810}
1811
1812/// The request message for
1813/// [RegistrationService.UpdateEndpoint][google.cloud.servicedirectory.v1.RegistrationService.UpdateEndpoint].
1814///
1815/// [google.cloud.servicedirectory.v1.RegistrationService.UpdateEndpoint]: crate::client::RegistrationService::update_endpoint
1816#[derive(Clone, Default, PartialEq)]
1817#[non_exhaustive]
1818pub struct UpdateEndpointRequest {
1819 /// Required. The updated endpoint.
1820 pub endpoint: std::option::Option<crate::model::Endpoint>,
1821
1822 /// Required. List of fields to be updated in this request.
1823 pub update_mask: std::option::Option<wkt::FieldMask>,
1824
1825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1826}
1827
1828impl UpdateEndpointRequest {
1829 /// Creates a new default instance.
1830 pub fn new() -> Self {
1831 std::default::Default::default()
1832 }
1833
1834 /// Sets the value of [endpoint][crate::model::UpdateEndpointRequest::endpoint].
1835 ///
1836 /// # Example
1837 /// ```ignore,no_run
1838 /// # use google_cloud_servicedirectory_v1::model::UpdateEndpointRequest;
1839 /// use google_cloud_servicedirectory_v1::model::Endpoint;
1840 /// let x = UpdateEndpointRequest::new().set_endpoint(Endpoint::default()/* use setters */);
1841 /// ```
1842 pub fn set_endpoint<T>(mut self, v: T) -> Self
1843 where
1844 T: std::convert::Into<crate::model::Endpoint>,
1845 {
1846 self.endpoint = std::option::Option::Some(v.into());
1847 self
1848 }
1849
1850 /// Sets or clears the value of [endpoint][crate::model::UpdateEndpointRequest::endpoint].
1851 ///
1852 /// # Example
1853 /// ```ignore,no_run
1854 /// # use google_cloud_servicedirectory_v1::model::UpdateEndpointRequest;
1855 /// use google_cloud_servicedirectory_v1::model::Endpoint;
1856 /// let x = UpdateEndpointRequest::new().set_or_clear_endpoint(Some(Endpoint::default()/* use setters */));
1857 /// let x = UpdateEndpointRequest::new().set_or_clear_endpoint(None::<Endpoint>);
1858 /// ```
1859 pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
1860 where
1861 T: std::convert::Into<crate::model::Endpoint>,
1862 {
1863 self.endpoint = v.map(|x| x.into());
1864 self
1865 }
1866
1867 /// Sets the value of [update_mask][crate::model::UpdateEndpointRequest::update_mask].
1868 ///
1869 /// # Example
1870 /// ```ignore,no_run
1871 /// # use google_cloud_servicedirectory_v1::model::UpdateEndpointRequest;
1872 /// use wkt::FieldMask;
1873 /// let x = UpdateEndpointRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1874 /// ```
1875 pub fn set_update_mask<T>(mut self, v: T) -> Self
1876 where
1877 T: std::convert::Into<wkt::FieldMask>,
1878 {
1879 self.update_mask = std::option::Option::Some(v.into());
1880 self
1881 }
1882
1883 /// Sets or clears the value of [update_mask][crate::model::UpdateEndpointRequest::update_mask].
1884 ///
1885 /// # Example
1886 /// ```ignore,no_run
1887 /// # use google_cloud_servicedirectory_v1::model::UpdateEndpointRequest;
1888 /// use wkt::FieldMask;
1889 /// let x = UpdateEndpointRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1890 /// let x = UpdateEndpointRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1891 /// ```
1892 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1893 where
1894 T: std::convert::Into<wkt::FieldMask>,
1895 {
1896 self.update_mask = v.map(|x| x.into());
1897 self
1898 }
1899}
1900
1901impl wkt::message::Message for UpdateEndpointRequest {
1902 fn typename() -> &'static str {
1903 "type.googleapis.com/google.cloud.servicedirectory.v1.UpdateEndpointRequest"
1904 }
1905}
1906
1907/// The request message for
1908/// [RegistrationService.DeleteEndpoint][google.cloud.servicedirectory.v1.RegistrationService.DeleteEndpoint].
1909///
1910/// [google.cloud.servicedirectory.v1.RegistrationService.DeleteEndpoint]: crate::client::RegistrationService::delete_endpoint
1911#[derive(Clone, Default, PartialEq)]
1912#[non_exhaustive]
1913pub struct DeleteEndpointRequest {
1914 /// Required. The name of the endpoint to delete.
1915 pub name: std::string::String,
1916
1917 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1918}
1919
1920impl DeleteEndpointRequest {
1921 /// Creates a new default instance.
1922 pub fn new() -> Self {
1923 std::default::Default::default()
1924 }
1925
1926 /// Sets the value of [name][crate::model::DeleteEndpointRequest::name].
1927 ///
1928 /// # Example
1929 /// ```ignore,no_run
1930 /// # use google_cloud_servicedirectory_v1::model::DeleteEndpointRequest;
1931 /// # let project_id = "project_id";
1932 /// # let location_id = "location_id";
1933 /// # let namespace_id = "namespace_id";
1934 /// # let service_id = "service_id";
1935 /// # let endpoint_id = "endpoint_id";
1936 /// let x = DeleteEndpointRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}/endpoints/{endpoint_id}"));
1937 /// ```
1938 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1939 self.name = v.into();
1940 self
1941 }
1942}
1943
1944impl wkt::message::Message for DeleteEndpointRequest {
1945 fn typename() -> &'static str {
1946 "type.googleapis.com/google.cloud.servicedirectory.v1.DeleteEndpointRequest"
1947 }
1948}
1949
1950/// An individual service. A service contains a name and optional metadata.
1951/// A service must exist before
1952/// [endpoints][google.cloud.servicedirectory.v1.Endpoint] can be
1953/// added to it.
1954///
1955/// [google.cloud.servicedirectory.v1.Endpoint]: crate::model::Endpoint
1956#[derive(Clone, Default, PartialEq)]
1957#[non_exhaustive]
1958pub struct Service {
1959 /// Immutable. The resource name for the service in the format
1960 /// `projects/*/locations/*/namespaces/*/services/*`.
1961 pub name: std::string::String,
1962
1963 /// Optional. Annotations for the service. This data can be consumed by service
1964 /// clients.
1965 ///
1966 /// Restrictions:
1967 ///
1968 /// * The entire annotations dictionary may contain up to 2000 characters,
1969 /// spread accoss all key-value pairs. Annotations that go beyond this
1970 /// limit are rejected
1971 /// * Valid annotation keys have two segments: an optional prefix and name,
1972 /// separated by a slash (/). The name segment is required and must be 63
1973 /// characters or less, beginning and ending with an alphanumeric character
1974 /// ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and
1975 /// alphanumerics between. The prefix is optional. If specified, the prefix
1976 /// must be a DNS subdomain: a series of DNS labels separated by dots (.),
1977 /// not longer than 253 characters in total, followed by a slash (/).
1978 /// Annotations that fails to meet these requirements are rejected
1979 ///
1980 /// Note: This field is equivalent to the `metadata` field in the v1beta1 API.
1981 /// They have the same syntax and read/write to the same location in Service
1982 /// Directory.
1983 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
1984
1985 /// Output only. Endpoints associated with this service. Returned on
1986 /// [LookupService.ResolveService][google.cloud.servicedirectory.v1.LookupService.ResolveService].
1987 /// Control plane clients should use
1988 /// [RegistrationService.ListEndpoints][google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints].
1989 ///
1990 /// [google.cloud.servicedirectory.v1.LookupService.ResolveService]: crate::client::LookupService::resolve_service
1991 /// [google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints]: crate::client::RegistrationService::list_endpoints
1992 pub endpoints: std::vec::Vec<crate::model::Endpoint>,
1993
1994 /// Output only. The globally unique identifier of the service in the UUID4
1995 /// format.
1996 pub uid: std::string::String,
1997
1998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1999}
2000
2001impl Service {
2002 /// Creates a new default instance.
2003 pub fn new() -> Self {
2004 std::default::Default::default()
2005 }
2006
2007 /// Sets the value of [name][crate::model::Service::name].
2008 ///
2009 /// # Example
2010 /// ```ignore,no_run
2011 /// # use google_cloud_servicedirectory_v1::model::Service;
2012 /// # let project_id = "project_id";
2013 /// # let location_id = "location_id";
2014 /// # let namespace_id = "namespace_id";
2015 /// # let service_id = "service_id";
2016 /// let x = Service::new().set_name(format!("projects/{project_id}/locations/{location_id}/namespaces/{namespace_id}/services/{service_id}"));
2017 /// ```
2018 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2019 self.name = v.into();
2020 self
2021 }
2022
2023 /// Sets the value of [annotations][crate::model::Service::annotations].
2024 ///
2025 /// # Example
2026 /// ```ignore,no_run
2027 /// # use google_cloud_servicedirectory_v1::model::Service;
2028 /// let x = Service::new().set_annotations([
2029 /// ("key0", "abc"),
2030 /// ("key1", "xyz"),
2031 /// ]);
2032 /// ```
2033 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2034 where
2035 T: std::iter::IntoIterator<Item = (K, V)>,
2036 K: std::convert::Into<std::string::String>,
2037 V: std::convert::Into<std::string::String>,
2038 {
2039 use std::iter::Iterator;
2040 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2041 self
2042 }
2043
2044 /// Sets the value of [endpoints][crate::model::Service::endpoints].
2045 ///
2046 /// # Example
2047 /// ```ignore,no_run
2048 /// # use google_cloud_servicedirectory_v1::model::Service;
2049 /// use google_cloud_servicedirectory_v1::model::Endpoint;
2050 /// let x = Service::new()
2051 /// .set_endpoints([
2052 /// Endpoint::default()/* use setters */,
2053 /// Endpoint::default()/* use (different) setters */,
2054 /// ]);
2055 /// ```
2056 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
2057 where
2058 T: std::iter::IntoIterator<Item = V>,
2059 V: std::convert::Into<crate::model::Endpoint>,
2060 {
2061 use std::iter::Iterator;
2062 self.endpoints = v.into_iter().map(|i| i.into()).collect();
2063 self
2064 }
2065
2066 /// Sets the value of [uid][crate::model::Service::uid].
2067 ///
2068 /// # Example
2069 /// ```ignore,no_run
2070 /// # use google_cloud_servicedirectory_v1::model::Service;
2071 /// let x = Service::new().set_uid("example");
2072 /// ```
2073 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2074 self.uid = v.into();
2075 self
2076 }
2077}
2078
2079impl wkt::message::Message for Service {
2080 fn typename() -> &'static str {
2081 "type.googleapis.com/google.cloud.servicedirectory.v1.Service"
2082 }
2083}