google_cloud_pubsub/generated/gapic/client.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#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Cloud Pub/Sub API.
20///
21/// # Example
22/// ```
23/// # async fn sample() -> gax::client_builder::Result<()> {
24/// # use google_cloud_pubsub::client::TopicAdmin;
25/// let client = TopicAdmin::builder().build().await?;
26/// // use `client` to make requests to the Cloud Pub/Sub API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// The service that an application uses to manipulate topics.
33///
34/// # Configuration
35///
36/// To configure `TopicAdmin` use the `with_*` methods in the type returned
37/// by [builder()][TopicAdmin::builder]. The default configuration should
38/// work for most applications. Common configuration changes include
39///
40/// * [with_endpoint()]: by default this client uses the global default endpoint
41/// (`https://pubsub.googleapis.com`). Applications using regional
42/// endpoints or running in restricted networks (e.g. a network configured
43// with [Private Google Access with VPC Service Controls]) may want to
44/// override this default.
45/// * [with_credentials()]: by default this client uses
46/// [Application Default Credentials]. Applications using custom
47/// authentication may need to override this default.
48///
49/// [with_endpoint()]: super::builder::topic_admin::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::topic_admin::ClientBuilder::credentials
51/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
52/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
53///
54/// # Pooling and Cloning
55///
56/// `TopicAdmin` holds a connection pool internally, it is advised to
57/// create one and the reuse it. You do not need to wrap `TopicAdmin` in
58/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
59/// already uses an `Arc` internally.
60#[derive(Clone, Debug)]
61pub struct TopicAdmin {
62 inner: std::sync::Arc<dyn super::stub::dynamic::TopicAdmin>,
63}
64
65impl TopicAdmin {
66 /// Returns a builder for [TopicAdmin].
67 ///
68 /// ```
69 /// # async fn sample() -> gax::client_builder::Result<()> {
70 /// # use google_cloud_pubsub::client::TopicAdmin;
71 /// let client = TopicAdmin::builder().build().await?;
72 /// # Ok(()) }
73 /// ```
74 pub fn builder() -> super::builder::topic_admin::ClientBuilder {
75 gax::client_builder::internal::new_builder(super::builder::topic_admin::client::Factory)
76 }
77
78 /// Creates a new client from the provided stub.
79 ///
80 /// The most common case for calling this function is in tests mocking the
81 /// client's behavior.
82 pub fn from_stub<T>(stub: T) -> Self
83 where
84 T: super::stub::TopicAdmin + 'static,
85 {
86 Self {
87 inner: std::sync::Arc::new(stub),
88 }
89 }
90
91 pub(crate) async fn new(
92 config: gaxi::options::ClientConfig,
93 ) -> gax::client_builder::Result<Self> {
94 let inner = Self::build_inner(config).await?;
95 Ok(Self { inner })
96 }
97
98 async fn build_inner(
99 conf: gaxi::options::ClientConfig,
100 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TopicAdmin>> {
101 if gaxi::options::tracing_enabled(&conf) {
102 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
103 }
104 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
105 }
106
107 async fn build_transport(
108 conf: gaxi::options::ClientConfig,
109 ) -> gax::client_builder::Result<impl super::stub::TopicAdmin> {
110 super::transport::TopicAdmin::new(conf).await
111 }
112
113 async fn build_with_tracing(
114 conf: gaxi::options::ClientConfig,
115 ) -> gax::client_builder::Result<impl super::stub::TopicAdmin> {
116 Self::build_transport(conf)
117 .await
118 .map(super::tracing::TopicAdmin::new)
119 }
120
121 /// Creates the given topic with the given name. See the [resource name rules]
122 /// (<https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names>).
123 pub fn create_topic(&self) -> super::builder::topic_admin::CreateTopic {
124 super::builder::topic_admin::CreateTopic::new(self.inner.clone())
125 }
126
127 /// Updates an existing topic by updating the fields specified in the update
128 /// mask. Note that certain properties of a topic are not modifiable.
129 pub fn update_topic(&self) -> super::builder::topic_admin::UpdateTopic {
130 super::builder::topic_admin::UpdateTopic::new(self.inner.clone())
131 }
132
133 /// Gets the configuration of a topic.
134 pub fn get_topic(&self) -> super::builder::topic_admin::GetTopic {
135 super::builder::topic_admin::GetTopic::new(self.inner.clone())
136 }
137
138 /// Lists matching topics.
139 pub fn list_topics(&self) -> super::builder::topic_admin::ListTopics {
140 super::builder::topic_admin::ListTopics::new(self.inner.clone())
141 }
142
143 /// Lists the names of the attached subscriptions on this topic.
144 pub fn list_topic_subscriptions(&self) -> super::builder::topic_admin::ListTopicSubscriptions {
145 super::builder::topic_admin::ListTopicSubscriptions::new(self.inner.clone())
146 }
147
148 /// Lists the names of the snapshots on this topic. Snapshots are used in
149 /// [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
150 /// which allow you to manage message acknowledgments in bulk. That is, you can
151 /// set the acknowledgment state of messages in an existing subscription to the
152 /// state captured by a snapshot.
153 pub fn list_topic_snapshots(&self) -> super::builder::topic_admin::ListTopicSnapshots {
154 super::builder::topic_admin::ListTopicSnapshots::new(self.inner.clone())
155 }
156
157 /// Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
158 /// does not exist. After a topic is deleted, a new topic may be created with
159 /// the same name; this is an entirely new topic with none of the old
160 /// configuration or subscriptions. Existing subscriptions to this topic are
161 /// not deleted, but their `topic` field is set to `_deleted-topic_`.
162 pub fn delete_topic(&self) -> super::builder::topic_admin::DeleteTopic {
163 super::builder::topic_admin::DeleteTopic::new(self.inner.clone())
164 }
165
166 /// Detaches a subscription from this topic. All messages retained in the
167 /// subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
168 /// will return FAILED_PRECONDITION. If the subscription is a push
169 /// subscription, pushes to the endpoint will stop.
170 pub fn detach_subscription(&self) -> super::builder::topic_admin::DetachSubscription {
171 super::builder::topic_admin::DetachSubscription::new(self.inner.clone())
172 }
173}
174
175/// Implements a client for the Cloud Pub/Sub API.
176///
177/// # Example
178/// ```
179/// # async fn sample() -> gax::client_builder::Result<()> {
180/// # use google_cloud_pubsub::client::SubscriptionAdmin;
181/// let client = SubscriptionAdmin::builder().build().await?;
182/// // use `client` to make requests to the Cloud Pub/Sub API.
183/// # Ok(()) }
184/// ```
185///
186/// # Service Description
187///
188/// The service that an application uses to manipulate subscriptions.
189///
190/// # Configuration
191///
192/// To configure `SubscriptionAdmin` use the `with_*` methods in the type returned
193/// by [builder()][SubscriptionAdmin::builder]. The default configuration should
194/// work for most applications. Common configuration changes include
195///
196/// * [with_endpoint()]: by default this client uses the global default endpoint
197/// (`https://pubsub.googleapis.com`). Applications using regional
198/// endpoints or running in restricted networks (e.g. a network configured
199// with [Private Google Access with VPC Service Controls]) may want to
200/// override this default.
201/// * [with_credentials()]: by default this client uses
202/// [Application Default Credentials]. Applications using custom
203/// authentication may need to override this default.
204///
205/// [with_endpoint()]: super::builder::subscription_admin::ClientBuilder::with_endpoint
206/// [with_credentials()]: super::builder::subscription_admin::ClientBuilder::credentials
207/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
208/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
209///
210/// # Pooling and Cloning
211///
212/// `SubscriptionAdmin` holds a connection pool internally, it is advised to
213/// create one and the reuse it. You do not need to wrap `SubscriptionAdmin` in
214/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
215/// already uses an `Arc` internally.
216#[derive(Clone, Debug)]
217pub struct SubscriptionAdmin {
218 inner: std::sync::Arc<dyn super::stub::dynamic::SubscriptionAdmin>,
219}
220
221impl SubscriptionAdmin {
222 /// Returns a builder for [SubscriptionAdmin].
223 ///
224 /// ```
225 /// # async fn sample() -> gax::client_builder::Result<()> {
226 /// # use google_cloud_pubsub::client::SubscriptionAdmin;
227 /// let client = SubscriptionAdmin::builder().build().await?;
228 /// # Ok(()) }
229 /// ```
230 pub fn builder() -> super::builder::subscription_admin::ClientBuilder {
231 gax::client_builder::internal::new_builder(
232 super::builder::subscription_admin::client::Factory,
233 )
234 }
235
236 /// Creates a new client from the provided stub.
237 ///
238 /// The most common case for calling this function is in tests mocking the
239 /// client's behavior.
240 pub fn from_stub<T>(stub: T) -> Self
241 where
242 T: super::stub::SubscriptionAdmin + 'static,
243 {
244 Self {
245 inner: std::sync::Arc::new(stub),
246 }
247 }
248
249 pub(crate) async fn new(
250 config: gaxi::options::ClientConfig,
251 ) -> gax::client_builder::Result<Self> {
252 let inner = Self::build_inner(config).await?;
253 Ok(Self { inner })
254 }
255
256 async fn build_inner(
257 conf: gaxi::options::ClientConfig,
258 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SubscriptionAdmin>>
259 {
260 if gaxi::options::tracing_enabled(&conf) {
261 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
262 }
263 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
264 }
265
266 async fn build_transport(
267 conf: gaxi::options::ClientConfig,
268 ) -> gax::client_builder::Result<impl super::stub::SubscriptionAdmin> {
269 super::transport::SubscriptionAdmin::new(conf).await
270 }
271
272 async fn build_with_tracing(
273 conf: gaxi::options::ClientConfig,
274 ) -> gax::client_builder::Result<impl super::stub::SubscriptionAdmin> {
275 Self::build_transport(conf)
276 .await
277 .map(super::tracing::SubscriptionAdmin::new)
278 }
279
280 /// Creates a subscription to a given topic. See the [resource name rules]
281 /// (<https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names>).
282 /// If the subscription already exists, returns `ALREADY_EXISTS`.
283 /// If the corresponding topic doesn't exist, returns `NOT_FOUND`.
284 ///
285 /// If the name is not provided in the request, the server will assign a random
286 /// name for this subscription on the same project as the topic, conforming
287 /// to the [resource name format]
288 /// (<https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names>). The
289 /// generated name is populated in the returned Subscription object. Note that
290 /// for REST API requests, you must specify a name in the request.
291 pub fn create_subscription(&self) -> super::builder::subscription_admin::CreateSubscription {
292 super::builder::subscription_admin::CreateSubscription::new(self.inner.clone())
293 }
294
295 /// Gets the configuration details of a subscription.
296 pub fn get_subscription(&self) -> super::builder::subscription_admin::GetSubscription {
297 super::builder::subscription_admin::GetSubscription::new(self.inner.clone())
298 }
299
300 /// Updates an existing subscription by updating the fields specified in the
301 /// update mask. Note that certain properties of a subscription, such as its
302 /// topic, are not modifiable.
303 pub fn update_subscription(&self) -> super::builder::subscription_admin::UpdateSubscription {
304 super::builder::subscription_admin::UpdateSubscription::new(self.inner.clone())
305 }
306
307 /// Lists matching subscriptions.
308 pub fn list_subscriptions(&self) -> super::builder::subscription_admin::ListSubscriptions {
309 super::builder::subscription_admin::ListSubscriptions::new(self.inner.clone())
310 }
311
312 /// Deletes an existing subscription. All messages retained in the subscription
313 /// are immediately dropped. Calls to `Pull` after deletion will return
314 /// `NOT_FOUND`. After a subscription is deleted, a new one may be created with
315 /// the same name, but the new one has no association with the old
316 /// subscription or its topic unless the same topic is specified.
317 pub fn delete_subscription(&self) -> super::builder::subscription_admin::DeleteSubscription {
318 super::builder::subscription_admin::DeleteSubscription::new(self.inner.clone())
319 }
320
321 /// Modifies the `PushConfig` for a specified subscription.
322 ///
323 /// This may be used to change a push subscription to a pull one (signified by
324 /// an empty `PushConfig`) or vice versa, or change the endpoint URL and other
325 /// attributes of a push subscription. Messages will accumulate for delivery
326 /// continuously through the call regardless of changes to the `PushConfig`.
327 pub fn modify_push_config(&self) -> super::builder::subscription_admin::ModifyPushConfig {
328 super::builder::subscription_admin::ModifyPushConfig::new(self.inner.clone())
329 }
330
331 /// Gets the configuration details of a snapshot. Snapshots are used in
332 /// [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
333 /// which allow you to manage message acknowledgments in bulk. That is, you can
334 /// set the acknowledgment state of messages in an existing subscription to the
335 /// state captured by a snapshot.
336 pub fn get_snapshot(&self) -> super::builder::subscription_admin::GetSnapshot {
337 super::builder::subscription_admin::GetSnapshot::new(self.inner.clone())
338 }
339
340 /// Lists the existing snapshots. Snapshots are used in [Seek](
341 /// <https://cloud.google.com/pubsub/docs/replay-overview>) operations, which
342 /// allow you to manage message acknowledgments in bulk. That is, you can set
343 /// the acknowledgment state of messages in an existing subscription to the
344 /// state captured by a snapshot.
345 pub fn list_snapshots(&self) -> super::builder::subscription_admin::ListSnapshots {
346 super::builder::subscription_admin::ListSnapshots::new(self.inner.clone())
347 }
348
349 /// Creates a snapshot from the requested subscription. Snapshots are used in
350 /// [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
351 /// which allow you to manage message acknowledgments in bulk. That is, you can
352 /// set the acknowledgment state of messages in an existing subscription to the
353 /// state captured by a snapshot.
354 /// If the snapshot already exists, returns `ALREADY_EXISTS`.
355 /// If the requested subscription doesn't exist, returns `NOT_FOUND`.
356 /// If the backlog in the subscription is too old -- and the resulting snapshot
357 /// would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
358 /// See also the `Snapshot.expire_time` field. If the name is not provided in
359 /// the request, the server will assign a random
360 /// name for this snapshot on the same project as the subscription, conforming
361 /// to the [resource name format]
362 /// (<https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names>). The
363 /// generated name is populated in the returned Snapshot object. Note that for
364 /// REST API requests, you must specify a name in the request.
365 pub fn create_snapshot(&self) -> super::builder::subscription_admin::CreateSnapshot {
366 super::builder::subscription_admin::CreateSnapshot::new(self.inner.clone())
367 }
368
369 /// Updates an existing snapshot by updating the fields specified in the update
370 /// mask. Snapshots are used in
371 /// [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
372 /// which allow you to manage message acknowledgments in bulk. That is, you can
373 /// set the acknowledgment state of messages in an existing subscription to the
374 /// state captured by a snapshot.
375 pub fn update_snapshot(&self) -> super::builder::subscription_admin::UpdateSnapshot {
376 super::builder::subscription_admin::UpdateSnapshot::new(self.inner.clone())
377 }
378
379 /// Removes an existing snapshot. Snapshots are used in [Seek]
380 /// (<https://cloud.google.com/pubsub/docs/replay-overview>) operations, which
381 /// allow you to manage message acknowledgments in bulk. That is, you can set
382 /// the acknowledgment state of messages in an existing subscription to the
383 /// state captured by a snapshot.
384 /// When the snapshot is deleted, all messages retained in the snapshot
385 /// are immediately dropped. After a snapshot is deleted, a new one may be
386 /// created with the same name, but the new one has no association with the old
387 /// snapshot or its subscription, unless the same subscription is specified.
388 pub fn delete_snapshot(&self) -> super::builder::subscription_admin::DeleteSnapshot {
389 super::builder::subscription_admin::DeleteSnapshot::new(self.inner.clone())
390 }
391
392 /// Seeks an existing subscription to a point in time or to a given snapshot,
393 /// whichever is provided in the request. Snapshots are used in [Seek]
394 /// (<https://cloud.google.com/pubsub/docs/replay-overview>) operations, which
395 /// allow you to manage message acknowledgments in bulk. That is, you can set
396 /// the acknowledgment state of messages in an existing subscription to the
397 /// state captured by a snapshot. Note that both the subscription and the
398 /// snapshot must be on the same topic.
399 pub fn seek(&self) -> super::builder::subscription_admin::Seek {
400 super::builder::subscription_admin::Seek::new(self.inner.clone())
401 }
402}
403
404/// Implements a client for the Cloud Pub/Sub API.
405///
406/// # Example
407/// ```
408/// # async fn sample() -> gax::client_builder::Result<()> {
409/// # use google_cloud_pubsub::client::SchemaService;
410/// let client = SchemaService::builder().build().await?;
411/// // use `client` to make requests to the Cloud Pub/Sub API.
412/// # Ok(()) }
413/// ```
414///
415/// # Service Description
416///
417/// Service for doing schema-related operations.
418///
419/// # Configuration
420///
421/// To configure `SchemaService` use the `with_*` methods in the type returned
422/// by [builder()][SchemaService::builder]. The default configuration should
423/// work for most applications. Common configuration changes include
424///
425/// * [with_endpoint()]: by default this client uses the global default endpoint
426/// (`https://pubsub.googleapis.com`). Applications using regional
427/// endpoints or running in restricted networks (e.g. a network configured
428// with [Private Google Access with VPC Service Controls]) may want to
429/// override this default.
430/// * [with_credentials()]: by default this client uses
431/// [Application Default Credentials]. Applications using custom
432/// authentication may need to override this default.
433///
434/// [with_endpoint()]: super::builder::schema_service::ClientBuilder::with_endpoint
435/// [with_credentials()]: super::builder::schema_service::ClientBuilder::credentials
436/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
437/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
438///
439/// # Pooling and Cloning
440///
441/// `SchemaService` holds a connection pool internally, it is advised to
442/// create one and the reuse it. You do not need to wrap `SchemaService` in
443/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
444/// already uses an `Arc` internally.
445#[derive(Clone, Debug)]
446pub struct SchemaService {
447 inner: std::sync::Arc<dyn super::stub::dynamic::SchemaService>,
448}
449
450impl SchemaService {
451 /// Returns a builder for [SchemaService].
452 ///
453 /// ```
454 /// # async fn sample() -> gax::client_builder::Result<()> {
455 /// # use google_cloud_pubsub::client::SchemaService;
456 /// let client = SchemaService::builder().build().await?;
457 /// # Ok(()) }
458 /// ```
459 pub fn builder() -> super::builder::schema_service::ClientBuilder {
460 gax::client_builder::internal::new_builder(super::builder::schema_service::client::Factory)
461 }
462
463 /// Creates a new client from the provided stub.
464 ///
465 /// The most common case for calling this function is in tests mocking the
466 /// client's behavior.
467 pub fn from_stub<T>(stub: T) -> Self
468 where
469 T: super::stub::SchemaService + 'static,
470 {
471 Self {
472 inner: std::sync::Arc::new(stub),
473 }
474 }
475
476 pub(crate) async fn new(
477 config: gaxi::options::ClientConfig,
478 ) -> gax::client_builder::Result<Self> {
479 let inner = Self::build_inner(config).await?;
480 Ok(Self { inner })
481 }
482
483 async fn build_inner(
484 conf: gaxi::options::ClientConfig,
485 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SchemaService>> {
486 if gaxi::options::tracing_enabled(&conf) {
487 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
488 }
489 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
490 }
491
492 async fn build_transport(
493 conf: gaxi::options::ClientConfig,
494 ) -> gax::client_builder::Result<impl super::stub::SchemaService> {
495 super::transport::SchemaService::new(conf).await
496 }
497
498 async fn build_with_tracing(
499 conf: gaxi::options::ClientConfig,
500 ) -> gax::client_builder::Result<impl super::stub::SchemaService> {
501 Self::build_transport(conf)
502 .await
503 .map(super::tracing::SchemaService::new)
504 }
505
506 /// Creates a schema.
507 pub fn create_schema(&self) -> super::builder::schema_service::CreateSchema {
508 super::builder::schema_service::CreateSchema::new(self.inner.clone())
509 }
510
511 /// Gets a schema.
512 pub fn get_schema(&self) -> super::builder::schema_service::GetSchema {
513 super::builder::schema_service::GetSchema::new(self.inner.clone())
514 }
515
516 /// Lists schemas in a project.
517 pub fn list_schemas(&self) -> super::builder::schema_service::ListSchemas {
518 super::builder::schema_service::ListSchemas::new(self.inner.clone())
519 }
520
521 /// Lists all schema revisions for the named schema.
522 pub fn list_schema_revisions(&self) -> super::builder::schema_service::ListSchemaRevisions {
523 super::builder::schema_service::ListSchemaRevisions::new(self.inner.clone())
524 }
525
526 /// Commits a new schema revision to an existing schema.
527 pub fn commit_schema(&self) -> super::builder::schema_service::CommitSchema {
528 super::builder::schema_service::CommitSchema::new(self.inner.clone())
529 }
530
531 /// Creates a new schema revision that is a copy of the provided revision_id.
532 pub fn rollback_schema(&self) -> super::builder::schema_service::RollbackSchema {
533 super::builder::schema_service::RollbackSchema::new(self.inner.clone())
534 }
535
536 /// Deletes a specific schema revision.
537 pub fn delete_schema_revision(&self) -> super::builder::schema_service::DeleteSchemaRevision {
538 super::builder::schema_service::DeleteSchemaRevision::new(self.inner.clone())
539 }
540
541 /// Deletes a schema.
542 pub fn delete_schema(&self) -> super::builder::schema_service::DeleteSchema {
543 super::builder::schema_service::DeleteSchema::new(self.inner.clone())
544 }
545
546 /// Validates a schema.
547 pub fn validate_schema(&self) -> super::builder::schema_service::ValidateSchema {
548 super::builder::schema_service::ValidateSchema::new(self.inner.clone())
549 }
550
551 /// Validates a message against a schema.
552 pub fn validate_message(&self) -> super::builder::schema_service::ValidateMessage {
553 super::builder::schema_service::ValidateMessage::new(self.inner.clone())
554 }
555
556 /// Sets the access control policy on the specified resource. Replaces
557 /// any existing policy.
558 ///
559 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
560 /// errors.
561 pub fn set_iam_policy(&self) -> super::builder::schema_service::SetIamPolicy {
562 super::builder::schema_service::SetIamPolicy::new(self.inner.clone())
563 }
564
565 /// Gets the access control policy for a resource. Returns an empty policy
566 /// if the resource exists and does not have a policy set.
567 pub fn get_iam_policy(&self) -> super::builder::schema_service::GetIamPolicy {
568 super::builder::schema_service::GetIamPolicy::new(self.inner.clone())
569 }
570
571 /// Returns permissions that a caller has on the specified resource. If the
572 /// resource does not exist, this will return an empty set of
573 /// permissions, not a `NOT_FOUND` error.
574 ///
575 /// Note: This operation is designed to be used for building
576 /// permission-aware UIs and command-line tools, not for authorization
577 /// checking. This operation may "fail open" without warning.
578 pub fn test_iam_permissions(&self) -> super::builder::schema_service::TestIamPermissions {
579 super::builder::schema_service::TestIamPermissions::new(self.inner.clone())
580 }
581}