google_cloud_developerconnect_v1/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::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Developer Connect API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28/// project_id: &str,
29/// location_id: &str,
30/// ) -> anyhow::Result<()> {
31/// let client = DeveloperConnect::builder().build().await?;
32/// let mut list = client.list_connections()
33/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
34/// .by_item();
35/// while let Some(item) = list.next().await.transpose()? {
36/// println!("{:?}", item);
37/// }
38/// Ok(())
39/// }
40/// ```
41///
42/// # Service Description
43///
44/// Service describing handlers for resources
45///
46/// # Configuration
47///
48/// To configure `DeveloperConnect` use the `with_*` methods in the type returned
49/// by [builder()][DeveloperConnect::builder]. The default configuration should
50/// work for most applications. Common configuration changes include
51///
52/// * [with_endpoint()]: by default this client uses the global default endpoint
53/// (`https://developerconnect.googleapis.com`). Applications using regional
54/// endpoints or running in restricted networks (e.g. a network configured
55/// with [Private Google Access with VPC Service Controls]) may want to
56/// override this default.
57/// * [with_credentials()]: by default this client uses
58/// [Application Default Credentials]. Applications using custom
59/// authentication may need to override this default.
60///
61/// [with_endpoint()]: super::builder::developer_connect::ClientBuilder::with_endpoint
62/// [with_credentials()]: super::builder::developer_connect::ClientBuilder::with_credentials
63/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
64/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
65///
66/// # Pooling and Cloning
67///
68/// `DeveloperConnect` holds a connection pool internally, it is advised to
69/// create one and reuse it. You do not need to wrap `DeveloperConnect` in
70/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
71/// already uses an `Arc` internally.
72#[derive(Clone, Debug)]
73pub struct DeveloperConnect {
74 inner: std::sync::Arc<dyn super::stub::dynamic::DeveloperConnect>,
75}
76
77impl DeveloperConnect {
78 /// Returns a builder for [DeveloperConnect].
79 ///
80 /// ```
81 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
82 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
83 /// let client = DeveloperConnect::builder().build().await?;
84 /// # Ok(()) }
85 /// ```
86 pub fn builder() -> super::builder::developer_connect::ClientBuilder {
87 crate::new_client_builder(super::builder::developer_connect::client::Factory)
88 }
89
90 /// Creates a new client from the provided stub.
91 ///
92 /// The most common case for calling this function is in tests mocking the
93 /// client's behavior.
94 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
95 where
96 T: super::stub::DeveloperConnect + 'static,
97 {
98 Self { inner: stub.into() }
99 }
100
101 pub(crate) async fn new(
102 config: gaxi::options::ClientConfig,
103 ) -> crate::ClientBuilderResult<Self> {
104 let inner = Self::build_inner(config).await?;
105 Ok(Self { inner })
106 }
107
108 async fn build_inner(
109 conf: gaxi::options::ClientConfig,
110 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DeveloperConnect>>
111 {
112 if gaxi::options::tracing_enabled(&conf) {
113 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
114 }
115 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
116 }
117
118 async fn build_transport(
119 conf: gaxi::options::ClientConfig,
120 ) -> crate::ClientBuilderResult<impl super::stub::DeveloperConnect> {
121 super::transport::DeveloperConnect::new(conf).await
122 }
123
124 async fn build_with_tracing(
125 conf: gaxi::options::ClientConfig,
126 ) -> crate::ClientBuilderResult<impl super::stub::DeveloperConnect> {
127 Self::build_transport(conf)
128 .await
129 .map(super::tracing::DeveloperConnect::new)
130 }
131
132 /// Lists Connections in a given project and location.
133 ///
134 /// # Example
135 /// ```
136 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
137 /// use google_cloud_gax::paginator::ItemPaginator as _;
138 /// use google_cloud_developerconnect_v1::Result;
139 /// async fn sample(
140 /// client: &DeveloperConnect, project_id: &str, location_id: &str
141 /// ) -> Result<()> {
142 /// let mut list = client.list_connections()
143 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
144 /// .by_item();
145 /// while let Some(item) = list.next().await.transpose()? {
146 /// println!("{:?}", item);
147 /// }
148 /// Ok(())
149 /// }
150 /// ```
151 pub fn list_connections(&self) -> super::builder::developer_connect::ListConnections {
152 super::builder::developer_connect::ListConnections::new(self.inner.clone())
153 }
154
155 /// Gets details of a single Connection.
156 ///
157 /// # Example
158 /// ```
159 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
160 /// use google_cloud_developerconnect_v1::Result;
161 /// async fn sample(
162 /// client: &DeveloperConnect, project_id: &str, location_id: &str, connection_id: &str
163 /// ) -> Result<()> {
164 /// let response = client.get_connection()
165 /// .set_name(format!("projects/{project_id}/locations/{location_id}/connections/{connection_id}"))
166 /// .send().await?;
167 /// println!("response {:?}", response);
168 /// Ok(())
169 /// }
170 /// ```
171 pub fn get_connection(&self) -> super::builder::developer_connect::GetConnection {
172 super::builder::developer_connect::GetConnection::new(self.inner.clone())
173 }
174
175 /// Creates a new Connection in a given project and location.
176 ///
177 /// # Long running operations
178 ///
179 /// This method is used to start, and/or poll a [long-running Operation].
180 /// The [Working with long-running operations] chapter in the [user guide]
181 /// covers these operations in detail.
182 ///
183 /// [long-running operation]: https://google.aip.dev/151
184 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
185 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
186 ///
187 /// # Example
188 /// ```
189 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
190 /// use google_cloud_lro::Poller;
191 /// use google_cloud_developerconnect_v1::model::Connection;
192 /// use google_cloud_developerconnect_v1::Result;
193 /// async fn sample(
194 /// client: &DeveloperConnect, project_id: &str, location_id: &str
195 /// ) -> Result<()> {
196 /// let response = client.create_connection()
197 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
198 /// .set_connection_id("connection_id_value")
199 /// .set_connection(
200 /// Connection::new()/* set fields */
201 /// )
202 /// .poller().until_done().await?;
203 /// println!("response {:?}", response);
204 /// Ok(())
205 /// }
206 /// ```
207 pub fn create_connection(&self) -> super::builder::developer_connect::CreateConnection {
208 super::builder::developer_connect::CreateConnection::new(self.inner.clone())
209 }
210
211 /// Updates the parameters of a single Connection.
212 ///
213 /// # Long running operations
214 ///
215 /// This method is used to start, and/or poll a [long-running Operation].
216 /// The [Working with long-running operations] chapter in the [user guide]
217 /// covers these operations in detail.
218 ///
219 /// [long-running operation]: https://google.aip.dev/151
220 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
221 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
222 ///
223 /// # Example
224 /// ```
225 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
226 /// use google_cloud_lro::Poller;
227 /// # extern crate wkt as google_cloud_wkt;
228 /// use google_cloud_wkt::FieldMask;
229 /// use google_cloud_developerconnect_v1::model::Connection;
230 /// use google_cloud_developerconnect_v1::Result;
231 /// async fn sample(
232 /// client: &DeveloperConnect, project_id: &str, location_id: &str, connection_id: &str
233 /// ) -> Result<()> {
234 /// let response = client.update_connection()
235 /// .set_connection(
236 /// Connection::new().set_name(format!("projects/{project_id}/locations/{location_id}/connections/{connection_id}"))/* set fields */
237 /// )
238 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
239 /// .poller().until_done().await?;
240 /// println!("response {:?}", response);
241 /// Ok(())
242 /// }
243 /// ```
244 pub fn update_connection(&self) -> super::builder::developer_connect::UpdateConnection {
245 super::builder::developer_connect::UpdateConnection::new(self.inner.clone())
246 }
247
248 /// Deletes a single Connection.
249 ///
250 /// # Long running operations
251 ///
252 /// This method is used to start, and/or poll a [long-running Operation].
253 /// The [Working with long-running operations] chapter in the [user guide]
254 /// covers these operations in detail.
255 ///
256 /// [long-running operation]: https://google.aip.dev/151
257 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
258 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
259 ///
260 /// # Example
261 /// ```
262 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
263 /// use google_cloud_lro::Poller;
264 /// use google_cloud_developerconnect_v1::Result;
265 /// async fn sample(
266 /// client: &DeveloperConnect, project_id: &str, location_id: &str, connection_id: &str
267 /// ) -> Result<()> {
268 /// client.delete_connection()
269 /// .set_name(format!("projects/{project_id}/locations/{location_id}/connections/{connection_id}"))
270 /// .poller().until_done().await?;
271 /// Ok(())
272 /// }
273 /// ```
274 pub fn delete_connection(&self) -> super::builder::developer_connect::DeleteConnection {
275 super::builder::developer_connect::DeleteConnection::new(self.inner.clone())
276 }
277
278 /// Creates a GitRepositoryLink. Upon linking a Git Repository, Developer
279 /// Connect will configure the Git Repository to send webhook events to
280 /// Developer Connect. Connections that use Firebase GitHub Application will
281 /// have events forwarded to the Firebase service. Connections that use Gemini
282 /// Code Assist will have events forwarded to Gemini Code Assist service. All
283 /// other Connections will have events forwarded to Cloud Build.
284 ///
285 /// # Long running operations
286 ///
287 /// This method is used to start, and/or poll a [long-running Operation].
288 /// The [Working with long-running operations] chapter in the [user guide]
289 /// covers these operations in detail.
290 ///
291 /// [long-running operation]: https://google.aip.dev/151
292 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
293 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
294 ///
295 /// # Example
296 /// ```
297 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
298 /// use google_cloud_lro::Poller;
299 /// use google_cloud_developerconnect_v1::model::GitRepositoryLink;
300 /// use google_cloud_developerconnect_v1::Result;
301 /// async fn sample(
302 /// client: &DeveloperConnect, project_id: &str, location_id: &str, connection_id: &str
303 /// ) -> Result<()> {
304 /// let response = client.create_git_repository_link()
305 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/connections/{connection_id}"))
306 /// .set_git_repository_link(
307 /// GitRepositoryLink::new()/* set fields */
308 /// )
309 /// .poller().until_done().await?;
310 /// println!("response {:?}", response);
311 /// Ok(())
312 /// }
313 /// ```
314 pub fn create_git_repository_link(
315 &self,
316 ) -> super::builder::developer_connect::CreateGitRepositoryLink {
317 super::builder::developer_connect::CreateGitRepositoryLink::new(self.inner.clone())
318 }
319
320 /// Deletes a single GitRepositoryLink.
321 ///
322 /// # Long running operations
323 ///
324 /// This method is used to start, and/or poll a [long-running Operation].
325 /// The [Working with long-running operations] chapter in the [user guide]
326 /// covers these operations in detail.
327 ///
328 /// [long-running operation]: https://google.aip.dev/151
329 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
330 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
331 ///
332 /// # Example
333 /// ```
334 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
335 /// use google_cloud_lro::Poller;
336 /// use google_cloud_developerconnect_v1::Result;
337 /// async fn sample(
338 /// client: &DeveloperConnect, project_id: &str, location_id: &str, connection_id: &str, git_repository_link_id: &str
339 /// ) -> Result<()> {
340 /// client.delete_git_repository_link()
341 /// .set_name(format!("projects/{project_id}/locations/{location_id}/connections/{connection_id}/gitRepositoryLinks/{git_repository_link_id}"))
342 /// .poller().until_done().await?;
343 /// Ok(())
344 /// }
345 /// ```
346 pub fn delete_git_repository_link(
347 &self,
348 ) -> super::builder::developer_connect::DeleteGitRepositoryLink {
349 super::builder::developer_connect::DeleteGitRepositoryLink::new(self.inner.clone())
350 }
351
352 /// Lists GitRepositoryLinks in a given project, location, and connection.
353 ///
354 /// # Example
355 /// ```
356 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
357 /// use google_cloud_gax::paginator::ItemPaginator as _;
358 /// use google_cloud_developerconnect_v1::Result;
359 /// async fn sample(
360 /// client: &DeveloperConnect, project_id: &str, location_id: &str, connection_id: &str
361 /// ) -> Result<()> {
362 /// let mut list = client.list_git_repository_links()
363 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/connections/{connection_id}"))
364 /// .by_item();
365 /// while let Some(item) = list.next().await.transpose()? {
366 /// println!("{:?}", item);
367 /// }
368 /// Ok(())
369 /// }
370 /// ```
371 pub fn list_git_repository_links(
372 &self,
373 ) -> super::builder::developer_connect::ListGitRepositoryLinks {
374 super::builder::developer_connect::ListGitRepositoryLinks::new(self.inner.clone())
375 }
376
377 /// Gets details of a single GitRepositoryLink.
378 ///
379 /// # Example
380 /// ```
381 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
382 /// use google_cloud_developerconnect_v1::Result;
383 /// async fn sample(
384 /// client: &DeveloperConnect, project_id: &str, location_id: &str, connection_id: &str, git_repository_link_id: &str
385 /// ) -> Result<()> {
386 /// let response = client.get_git_repository_link()
387 /// .set_name(format!("projects/{project_id}/locations/{location_id}/connections/{connection_id}/gitRepositoryLinks/{git_repository_link_id}"))
388 /// .send().await?;
389 /// println!("response {:?}", response);
390 /// Ok(())
391 /// }
392 /// ```
393 pub fn get_git_repository_link(
394 &self,
395 ) -> super::builder::developer_connect::GetGitRepositoryLink {
396 super::builder::developer_connect::GetGitRepositoryLink::new(self.inner.clone())
397 }
398
399 /// Fetches read/write token of a given gitRepositoryLink.
400 ///
401 /// # Example
402 /// ```
403 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
404 /// use google_cloud_developerconnect_v1::Result;
405 /// async fn sample(
406 /// client: &DeveloperConnect
407 /// ) -> Result<()> {
408 /// let response = client.fetch_read_write_token()
409 /// /* set fields */
410 /// .send().await?;
411 /// println!("response {:?}", response);
412 /// Ok(())
413 /// }
414 /// ```
415 pub fn fetch_read_write_token(&self) -> super::builder::developer_connect::FetchReadWriteToken {
416 super::builder::developer_connect::FetchReadWriteToken::new(self.inner.clone())
417 }
418
419 /// Fetches read token of a given gitRepositoryLink.
420 ///
421 /// # Example
422 /// ```
423 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
424 /// use google_cloud_developerconnect_v1::Result;
425 /// async fn sample(
426 /// client: &DeveloperConnect
427 /// ) -> Result<()> {
428 /// let response = client.fetch_read_token()
429 /// /* set fields */
430 /// .send().await?;
431 /// println!("response {:?}", response);
432 /// Ok(())
433 /// }
434 /// ```
435 pub fn fetch_read_token(&self) -> super::builder::developer_connect::FetchReadToken {
436 super::builder::developer_connect::FetchReadToken::new(self.inner.clone())
437 }
438
439 /// Opens a Pull Request in the remote SCM repository associated with a
440 /// GitRepositoryLink.
441 ///
442 /// # Example
443 /// ```
444 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
445 /// use google_cloud_developerconnect_v1::Result;
446 /// async fn sample(
447 /// client: &DeveloperConnect
448 /// ) -> Result<()> {
449 /// let response = client.open_git_repository_link_pull_request()
450 /// /* set fields */
451 /// .send().await?;
452 /// println!("response {:?}", response);
453 /// Ok(())
454 /// }
455 /// ```
456 pub fn open_git_repository_link_pull_request(
457 &self,
458 ) -> super::builder::developer_connect::OpenGitRepositoryLinkPullRequest {
459 super::builder::developer_connect::OpenGitRepositoryLinkPullRequest::new(self.inner.clone())
460 }
461
462 /// FetchLinkableGitRepositories returns a list of git repositories from an SCM
463 /// that are available to be added to a Connection.
464 ///
465 /// # Example
466 /// ```
467 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
468 /// use google_cloud_gax::paginator::ItemPaginator as _;
469 /// use google_cloud_developerconnect_v1::Result;
470 /// async fn sample(
471 /// client: &DeveloperConnect
472 /// ) -> Result<()> {
473 /// let mut list = client.fetch_linkable_git_repositories()
474 /// /* set fields */
475 /// .by_item();
476 /// while let Some(item) = list.next().await.transpose()? {
477 /// println!("{:?}", item);
478 /// }
479 /// Ok(())
480 /// }
481 /// ```
482 pub fn fetch_linkable_git_repositories(
483 &self,
484 ) -> super::builder::developer_connect::FetchLinkableGitRepositories {
485 super::builder::developer_connect::FetchLinkableGitRepositories::new(self.inner.clone())
486 }
487
488 /// FetchGitHubInstallations returns the list of GitHub Installations that
489 /// are available to be added to a Connection.
490 /// For github.com, only installations accessible to the authorizer token
491 /// are returned. For GitHub Enterprise, all installations are returned.
492 ///
493 /// # Example
494 /// ```
495 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
496 /// use google_cloud_developerconnect_v1::Result;
497 /// async fn sample(
498 /// client: &DeveloperConnect
499 /// ) -> Result<()> {
500 /// let response = client.fetch_git_hub_installations()
501 /// /* set fields */
502 /// .send().await?;
503 /// println!("response {:?}", response);
504 /// Ok(())
505 /// }
506 /// ```
507 pub fn fetch_git_hub_installations(
508 &self,
509 ) -> super::builder::developer_connect::FetchGitHubInstallations {
510 super::builder::developer_connect::FetchGitHubInstallations::new(self.inner.clone())
511 }
512
513 /// Fetch the list of branches or tags for a given repository.
514 ///
515 /// # Example
516 /// ```
517 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
518 /// use google_cloud_developerconnect_v1::Result;
519 /// async fn sample(
520 /// client: &DeveloperConnect
521 /// ) -> Result<()> {
522 /// let response = client.fetch_git_refs()
523 /// /* set fields */
524 /// .send().await?;
525 /// println!("response {:?}", response);
526 /// Ok(())
527 /// }
528 /// ```
529 pub fn fetch_git_refs(&self) -> super::builder::developer_connect::FetchGitRefs {
530 super::builder::developer_connect::FetchGitRefs::new(self.inner.clone())
531 }
532
533 /// Diff commits for a GitRepositoryLink.
534 ///
535 /// # Example
536 /// ```
537 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
538 /// use google_cloud_developerconnect_v1::Result;
539 /// async fn sample(
540 /// client: &DeveloperConnect
541 /// ) -> Result<()> {
542 /// let response = client.diff_git_repository_link_commit()
543 /// /* set fields */
544 /// .send().await?;
545 /// println!("response {:?}", response);
546 /// Ok(())
547 /// }
548 /// ```
549 pub fn diff_git_repository_link_commit(
550 &self,
551 ) -> super::builder::developer_connect::DiffGitRepositoryLinkCommit {
552 super::builder::developer_connect::DiffGitRepositoryLinkCommit::new(self.inner.clone())
553 }
554
555 /// Fetch Commit details from a Git repository link.
556 ///
557 /// # Example
558 /// ```
559 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
560 /// use google_cloud_developerconnect_v1::Result;
561 /// async fn sample(
562 /// client: &DeveloperConnect
563 /// ) -> Result<()> {
564 /// let response = client.fetch_git_repository_link_commit()
565 /// /* set fields */
566 /// .send().await?;
567 /// println!("response {:?}", response);
568 /// Ok(())
569 /// }
570 /// ```
571 pub fn fetch_git_repository_link_commit(
572 &self,
573 ) -> super::builder::developer_connect::FetchGitRepositoryLinkCommit {
574 super::builder::developer_connect::FetchGitRepositoryLinkCommit::new(self.inner.clone())
575 }
576
577 /// Fetch a list of Commits from a Git repository link.
578 ///
579 /// # Example
580 /// ```
581 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
582 /// use google_cloud_gax::paginator::ItemPaginator as _;
583 /// use google_cloud_developerconnect_v1::Result;
584 /// async fn sample(
585 /// client: &DeveloperConnect
586 /// ) -> Result<()> {
587 /// let mut list = client.fetch_git_repository_link_commit_list()
588 /// /* set fields */
589 /// .by_item();
590 /// while let Some(item) = list.next().await.transpose()? {
591 /// println!("{:?}", item);
592 /// }
593 /// Ok(())
594 /// }
595 /// ```
596 pub fn fetch_git_repository_link_commit_list(
597 &self,
598 ) -> super::builder::developer_connect::FetchGitRepositoryLinkCommitList {
599 super::builder::developer_connect::FetchGitRepositoryLinkCommitList::new(self.inner.clone())
600 }
601
602 /// Fetches blame information for a file or line range in a file.
603 ///
604 /// # Example
605 /// ```
606 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
607 /// use google_cloud_developerconnect_v1::Result;
608 /// async fn sample(
609 /// client: &DeveloperConnect
610 /// ) -> Result<()> {
611 /// let response = client.fetch_git_repository_link_file_blame()
612 /// /* set fields */
613 /// .send().await?;
614 /// println!("response {:?}", response);
615 /// Ok(())
616 /// }
617 /// ```
618 pub fn fetch_git_repository_link_file_blame(
619 &self,
620 ) -> super::builder::developer_connect::FetchGitRepositoryLinkFileBlame {
621 super::builder::developer_connect::FetchGitRepositoryLinkFileBlame::new(self.inner.clone())
622 }
623
624 /// Fetch Pull Request details from a Git repository link.
625 ///
626 /// # Example
627 /// ```
628 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
629 /// use google_cloud_developerconnect_v1::Result;
630 /// async fn sample(
631 /// client: &DeveloperConnect
632 /// ) -> Result<()> {
633 /// let response = client.fetch_git_repository_link_pull_request()
634 /// /* set fields */
635 /// .send().await?;
636 /// println!("response {:?}", response);
637 /// Ok(())
638 /// }
639 /// ```
640 pub fn fetch_git_repository_link_pull_request(
641 &self,
642 ) -> super::builder::developer_connect::FetchGitRepositoryLinkPullRequest {
643 super::builder::developer_connect::FetchGitRepositoryLinkPullRequest::new(
644 self.inner.clone(),
645 )
646 }
647
648 /// Add a comment to a Pull Request.
649 ///
650 /// # Example
651 /// ```
652 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
653 /// use google_cloud_developerconnect_v1::Result;
654 /// async fn sample(
655 /// client: &DeveloperConnect
656 /// ) -> Result<()> {
657 /// let response = client.add_git_repository_link_pull_request_comment()
658 /// /* set fields */
659 /// .send().await?;
660 /// println!("response {:?}", response);
661 /// Ok(())
662 /// }
663 /// ```
664 pub fn add_git_repository_link_pull_request_comment(
665 &self,
666 ) -> super::builder::developer_connect::AddGitRepositoryLinkPullRequestComment {
667 super::builder::developer_connect::AddGitRepositoryLinkPullRequestComment::new(
668 self.inner.clone(),
669 )
670 }
671
672 /// Add a review comment (inline on diff) to a Pull Request.
673 ///
674 /// # Example
675 /// ```
676 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
677 /// use google_cloud_developerconnect_v1::Result;
678 /// async fn sample(
679 /// client: &DeveloperConnect
680 /// ) -> Result<()> {
681 /// let response = client.add_git_repository_link_pull_request_review_comment()
682 /// /* set fields */
683 /// .send().await?;
684 /// println!("response {:?}", response);
685 /// Ok(())
686 /// }
687 /// ```
688 pub fn add_git_repository_link_pull_request_review_comment(
689 &self,
690 ) -> super::builder::developer_connect::AddGitRepositoryLinkPullRequestReviewComment {
691 super::builder::developer_connect::AddGitRepositoryLinkPullRequestReviewComment::new(
692 self.inner.clone(),
693 )
694 }
695
696 /// Modifies a Pull Request in the remote SCM repository associated with a
697 /// GitRepositoryLink.
698 ///
699 /// # Example
700 /// ```
701 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
702 /// use google_cloud_developerconnect_v1::Result;
703 /// async fn sample(
704 /// client: &DeveloperConnect
705 /// ) -> Result<()> {
706 /// let response = client.modify_git_repository_link_pull_request()
707 /// /* set fields */
708 /// .send().await?;
709 /// println!("response {:?}", response);
710 /// Ok(())
711 /// }
712 /// ```
713 pub fn modify_git_repository_link_pull_request(
714 &self,
715 ) -> super::builder::developer_connect::ModifyGitRepositoryLinkPullRequest {
716 super::builder::developer_connect::ModifyGitRepositoryLinkPullRequest::new(
717 self.inner.clone(),
718 )
719 }
720
721 /// Fetches a list of Pull Requests from the remote repository.
722 ///
723 /// # Example
724 /// ```
725 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
726 /// use google_cloud_gax::paginator::ItemPaginator as _;
727 /// use google_cloud_developerconnect_v1::Result;
728 /// async fn sample(
729 /// client: &DeveloperConnect
730 /// ) -> Result<()> {
731 /// let mut list = client.fetch_git_repository_link_pull_request_list()
732 /// /* set fields */
733 /// .by_item();
734 /// while let Some(item) = list.next().await.transpose()? {
735 /// println!("{:?}", item);
736 /// }
737 /// Ok(())
738 /// }
739 /// ```
740 pub fn fetch_git_repository_link_pull_request_list(
741 &self,
742 ) -> super::builder::developer_connect::FetchGitRepositoryLinkPullRequestList {
743 super::builder::developer_connect::FetchGitRepositoryLinkPullRequestList::new(
744 self.inner.clone(),
745 )
746 }
747
748 /// Lists AccountConnectors in a given project and location.
749 ///
750 /// # Example
751 /// ```
752 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
753 /// use google_cloud_gax::paginator::ItemPaginator as _;
754 /// use google_cloud_developerconnect_v1::Result;
755 /// async fn sample(
756 /// client: &DeveloperConnect, project_id: &str, location_id: &str
757 /// ) -> Result<()> {
758 /// let mut list = client.list_account_connectors()
759 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
760 /// .by_item();
761 /// while let Some(item) = list.next().await.transpose()? {
762 /// println!("{:?}", item);
763 /// }
764 /// Ok(())
765 /// }
766 /// ```
767 pub fn list_account_connectors(
768 &self,
769 ) -> super::builder::developer_connect::ListAccountConnectors {
770 super::builder::developer_connect::ListAccountConnectors::new(self.inner.clone())
771 }
772
773 /// Gets details of a single AccountConnector.
774 ///
775 /// # Example
776 /// ```
777 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
778 /// use google_cloud_developerconnect_v1::Result;
779 /// async fn sample(
780 /// client: &DeveloperConnect, project_id: &str, location_id: &str, account_connector_id: &str
781 /// ) -> Result<()> {
782 /// let response = client.get_account_connector()
783 /// .set_name(format!("projects/{project_id}/locations/{location_id}/accountConnectors/{account_connector_id}"))
784 /// .send().await?;
785 /// println!("response {:?}", response);
786 /// Ok(())
787 /// }
788 /// ```
789 pub fn get_account_connector(&self) -> super::builder::developer_connect::GetAccountConnector {
790 super::builder::developer_connect::GetAccountConnector::new(self.inner.clone())
791 }
792
793 /// Creates a new AccountConnector in a given project and location.
794 ///
795 /// # Long running operations
796 ///
797 /// This method is used to start, and/or poll a [long-running Operation].
798 /// The [Working with long-running operations] chapter in the [user guide]
799 /// covers these operations in detail.
800 ///
801 /// [long-running operation]: https://google.aip.dev/151
802 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
803 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
804 ///
805 /// # Example
806 /// ```
807 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
808 /// use google_cloud_lro::Poller;
809 /// use google_cloud_developerconnect_v1::model::AccountConnector;
810 /// use google_cloud_developerconnect_v1::Result;
811 /// async fn sample(
812 /// client: &DeveloperConnect, project_id: &str, location_id: &str
813 /// ) -> Result<()> {
814 /// let response = client.create_account_connector()
815 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
816 /// .set_account_connector(
817 /// AccountConnector::new()/* set fields */
818 /// )
819 /// .poller().until_done().await?;
820 /// println!("response {:?}", response);
821 /// Ok(())
822 /// }
823 /// ```
824 pub fn create_account_connector(
825 &self,
826 ) -> super::builder::developer_connect::CreateAccountConnector {
827 super::builder::developer_connect::CreateAccountConnector::new(self.inner.clone())
828 }
829
830 /// Updates the parameters of a single AccountConnector.
831 ///
832 /// # Long running operations
833 ///
834 /// This method is used to start, and/or poll a [long-running Operation].
835 /// The [Working with long-running operations] chapter in the [user guide]
836 /// covers these operations in detail.
837 ///
838 /// [long-running operation]: https://google.aip.dev/151
839 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
840 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
841 ///
842 /// # Example
843 /// ```
844 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
845 /// use google_cloud_lro::Poller;
846 /// # extern crate wkt as google_cloud_wkt;
847 /// use google_cloud_wkt::FieldMask;
848 /// use google_cloud_developerconnect_v1::model::AccountConnector;
849 /// use google_cloud_developerconnect_v1::Result;
850 /// async fn sample(
851 /// client: &DeveloperConnect, project_id: &str, location_id: &str, account_connector_id: &str
852 /// ) -> Result<()> {
853 /// let response = client.update_account_connector()
854 /// .set_account_connector(
855 /// AccountConnector::new().set_name(format!("projects/{project_id}/locations/{location_id}/accountConnectors/{account_connector_id}"))/* set fields */
856 /// )
857 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
858 /// .poller().until_done().await?;
859 /// println!("response {:?}", response);
860 /// Ok(())
861 /// }
862 /// ```
863 pub fn update_account_connector(
864 &self,
865 ) -> super::builder::developer_connect::UpdateAccountConnector {
866 super::builder::developer_connect::UpdateAccountConnector::new(self.inner.clone())
867 }
868
869 /// Deletes a single AccountConnector.
870 ///
871 /// # Long running operations
872 ///
873 /// This method is used to start, and/or poll a [long-running Operation].
874 /// The [Working with long-running operations] chapter in the [user guide]
875 /// covers these operations in detail.
876 ///
877 /// [long-running operation]: https://google.aip.dev/151
878 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
879 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
880 ///
881 /// # Example
882 /// ```
883 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
884 /// use google_cloud_lro::Poller;
885 /// use google_cloud_developerconnect_v1::Result;
886 /// async fn sample(
887 /// client: &DeveloperConnect, project_id: &str, location_id: &str, account_connector_id: &str
888 /// ) -> Result<()> {
889 /// client.delete_account_connector()
890 /// .set_name(format!("projects/{project_id}/locations/{location_id}/accountConnectors/{account_connector_id}"))
891 /// .poller().until_done().await?;
892 /// Ok(())
893 /// }
894 /// ```
895 pub fn delete_account_connector(
896 &self,
897 ) -> super::builder::developer_connect::DeleteAccountConnector {
898 super::builder::developer_connect::DeleteAccountConnector::new(self.inner.clone())
899 }
900
901 /// Fetches OAuth access token based on end user credentials.
902 ///
903 /// # Example
904 /// ```
905 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
906 /// use google_cloud_developerconnect_v1::Result;
907 /// async fn sample(
908 /// client: &DeveloperConnect
909 /// ) -> Result<()> {
910 /// let response = client.fetch_access_token()
911 /// /* set fields */
912 /// .send().await?;
913 /// println!("response {:?}", response);
914 /// Ok(())
915 /// }
916 /// ```
917 pub fn fetch_access_token(&self) -> super::builder::developer_connect::FetchAccessToken {
918 super::builder::developer_connect::FetchAccessToken::new(self.inner.clone())
919 }
920
921 /// Lists Users in a given project, location, and account_connector.
922 ///
923 /// # Example
924 /// ```
925 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
926 /// use google_cloud_gax::paginator::ItemPaginator as _;
927 /// use google_cloud_developerconnect_v1::Result;
928 /// async fn sample(
929 /// client: &DeveloperConnect, project_id: &str, location_id: &str, account_connector_id: &str
930 /// ) -> Result<()> {
931 /// let mut list = client.list_users()
932 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/accountConnectors/{account_connector_id}"))
933 /// .by_item();
934 /// while let Some(item) = list.next().await.transpose()? {
935 /// println!("{:?}", item);
936 /// }
937 /// Ok(())
938 /// }
939 /// ```
940 pub fn list_users(&self) -> super::builder::developer_connect::ListUsers {
941 super::builder::developer_connect::ListUsers::new(self.inner.clone())
942 }
943
944 /// Deletes a single User.
945 ///
946 /// # Long running operations
947 ///
948 /// This method is used to start, and/or poll a [long-running Operation].
949 /// The [Working with long-running operations] chapter in the [user guide]
950 /// covers these operations in detail.
951 ///
952 /// [long-running operation]: https://google.aip.dev/151
953 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
954 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
955 ///
956 /// # Example
957 /// ```
958 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
959 /// use google_cloud_lro::Poller;
960 /// use google_cloud_developerconnect_v1::Result;
961 /// async fn sample(
962 /// client: &DeveloperConnect, project_id: &str, location_id: &str, account_connector_id: &str, user_id: &str
963 /// ) -> Result<()> {
964 /// client.delete_user()
965 /// .set_name(format!("projects/{project_id}/locations/{location_id}/accountConnectors/{account_connector_id}/users/{user_id}"))
966 /// .poller().until_done().await?;
967 /// Ok(())
968 /// }
969 /// ```
970 pub fn delete_user(&self) -> super::builder::developer_connect::DeleteUser {
971 super::builder::developer_connect::DeleteUser::new(self.inner.clone())
972 }
973
974 /// Fetch the User based on the user credentials.
975 ///
976 /// # Example
977 /// ```
978 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
979 /// use google_cloud_developerconnect_v1::Result;
980 /// async fn sample(
981 /// client: &DeveloperConnect
982 /// ) -> Result<()> {
983 /// let response = client.fetch_self()
984 /// /* set fields */
985 /// .send().await?;
986 /// println!("response {:?}", response);
987 /// Ok(())
988 /// }
989 /// ```
990 pub fn fetch_self(&self) -> super::builder::developer_connect::FetchSelf {
991 super::builder::developer_connect::FetchSelf::new(self.inner.clone())
992 }
993
994 /// Delete the User based on the user credentials.
995 ///
996 /// # Long running operations
997 ///
998 /// This method is used to start, and/or poll a [long-running Operation].
999 /// The [Working with long-running operations] chapter in the [user guide]
1000 /// covers these operations in detail.
1001 ///
1002 /// [long-running operation]: https://google.aip.dev/151
1003 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1004 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1005 ///
1006 /// # Example
1007 /// ```
1008 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1009 /// use google_cloud_lro::Poller;
1010 /// use google_cloud_developerconnect_v1::Result;
1011 /// async fn sample(
1012 /// client: &DeveloperConnect
1013 /// ) -> Result<()> {
1014 /// client.delete_self()
1015 /// /* set fields */
1016 /// .poller().until_done().await?;
1017 /// Ok(())
1018 /// }
1019 /// ```
1020 pub fn delete_self(&self) -> super::builder::developer_connect::DeleteSelf {
1021 super::builder::developer_connect::DeleteSelf::new(self.inner.clone())
1022 }
1023
1024 /// Starts OAuth flow for an account connector.
1025 ///
1026 /// # Example
1027 /// ```
1028 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1029 /// use google_cloud_developerconnect_v1::Result;
1030 /// async fn sample(
1031 /// client: &DeveloperConnect
1032 /// ) -> Result<()> {
1033 /// let response = client.start_o_auth()
1034 /// /* set fields */
1035 /// .send().await?;
1036 /// println!("response {:?}", response);
1037 /// Ok(())
1038 /// }
1039 /// ```
1040 pub fn start_o_auth(&self) -> super::builder::developer_connect::StartOAuth {
1041 super::builder::developer_connect::StartOAuth::new(self.inner.clone())
1042 }
1043
1044 /// Finishes OAuth flow for an account connector.
1045 ///
1046 /// # Example
1047 /// ```
1048 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1049 /// use google_cloud_developerconnect_v1::Result;
1050 /// async fn sample(
1051 /// client: &DeveloperConnect
1052 /// ) -> Result<()> {
1053 /// let response = client.finish_o_auth()
1054 /// /* set fields */
1055 /// .send().await?;
1056 /// println!("response {:?}", response);
1057 /// Ok(())
1058 /// }
1059 /// ```
1060 pub fn finish_o_auth(&self) -> super::builder::developer_connect::FinishOAuth {
1061 super::builder::developer_connect::FinishOAuth::new(self.inner.clone())
1062 }
1063
1064 /// Lists information about the supported locations for this service.
1065 /// This method can be called in two ways:
1066 ///
1067 /// * **List all public locations:** Use the path `GET /v1/locations`.
1068 /// * **List project-visible locations:** Use the path
1069 /// `GET /v1/projects/{project_id}/locations`. This may include public
1070 /// locations as well as private or other locations specifically visible
1071 /// to the project.
1072 ///
1073 /// # Example
1074 /// ```
1075 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1076 /// use google_cloud_gax::paginator::ItemPaginator as _;
1077 /// use google_cloud_developerconnect_v1::Result;
1078 /// async fn sample(
1079 /// client: &DeveloperConnect
1080 /// ) -> Result<()> {
1081 /// let mut list = client.list_locations()
1082 /// /* set fields */
1083 /// .by_item();
1084 /// while let Some(item) = list.next().await.transpose()? {
1085 /// println!("{:?}", item);
1086 /// }
1087 /// Ok(())
1088 /// }
1089 /// ```
1090 pub fn list_locations(&self) -> super::builder::developer_connect::ListLocations {
1091 super::builder::developer_connect::ListLocations::new(self.inner.clone())
1092 }
1093
1094 /// Gets information about a location.
1095 ///
1096 /// # Example
1097 /// ```
1098 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1099 /// use google_cloud_developerconnect_v1::Result;
1100 /// async fn sample(
1101 /// client: &DeveloperConnect
1102 /// ) -> Result<()> {
1103 /// let response = client.get_location()
1104 /// /* set fields */
1105 /// .send().await?;
1106 /// println!("response {:?}", response);
1107 /// Ok(())
1108 /// }
1109 /// ```
1110 pub fn get_location(&self) -> super::builder::developer_connect::GetLocation {
1111 super::builder::developer_connect::GetLocation::new(self.inner.clone())
1112 }
1113
1114 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1115 ///
1116 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1117 ///
1118 /// # Example
1119 /// ```
1120 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1121 /// use google_cloud_gax::paginator::ItemPaginator as _;
1122 /// use google_cloud_developerconnect_v1::Result;
1123 /// async fn sample(
1124 /// client: &DeveloperConnect
1125 /// ) -> Result<()> {
1126 /// let mut list = client.list_operations()
1127 /// /* set fields */
1128 /// .by_item();
1129 /// while let Some(item) = list.next().await.transpose()? {
1130 /// println!("{:?}", item);
1131 /// }
1132 /// Ok(())
1133 /// }
1134 /// ```
1135 pub fn list_operations(&self) -> super::builder::developer_connect::ListOperations {
1136 super::builder::developer_connect::ListOperations::new(self.inner.clone())
1137 }
1138
1139 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1140 ///
1141 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1142 ///
1143 /// # Example
1144 /// ```
1145 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1146 /// use google_cloud_developerconnect_v1::Result;
1147 /// async fn sample(
1148 /// client: &DeveloperConnect
1149 /// ) -> Result<()> {
1150 /// let response = client.get_operation()
1151 /// /* set fields */
1152 /// .send().await?;
1153 /// println!("response {:?}", response);
1154 /// Ok(())
1155 /// }
1156 /// ```
1157 pub fn get_operation(&self) -> super::builder::developer_connect::GetOperation {
1158 super::builder::developer_connect::GetOperation::new(self.inner.clone())
1159 }
1160
1161 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1162 ///
1163 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1164 ///
1165 /// # Example
1166 /// ```
1167 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1168 /// use google_cloud_developerconnect_v1::Result;
1169 /// async fn sample(
1170 /// client: &DeveloperConnect
1171 /// ) -> Result<()> {
1172 /// client.delete_operation()
1173 /// /* set fields */
1174 /// .send().await?;
1175 /// Ok(())
1176 /// }
1177 /// ```
1178 pub fn delete_operation(&self) -> super::builder::developer_connect::DeleteOperation {
1179 super::builder::developer_connect::DeleteOperation::new(self.inner.clone())
1180 }
1181
1182 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1183 ///
1184 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1185 ///
1186 /// # Example
1187 /// ```
1188 /// # use google_cloud_developerconnect_v1::client::DeveloperConnect;
1189 /// use google_cloud_developerconnect_v1::Result;
1190 /// async fn sample(
1191 /// client: &DeveloperConnect
1192 /// ) -> Result<()> {
1193 /// client.cancel_operation()
1194 /// /* set fields */
1195 /// .send().await?;
1196 /// Ok(())
1197 /// }
1198 /// ```
1199 pub fn cancel_operation(&self) -> super::builder::developer_connect::CancelOperation {
1200 super::builder::developer_connect::CancelOperation::new(self.inner.clone())
1201 }
1202}
1203
1204/// Implements a client for the Developer Connect API.
1205///
1206/// # Example
1207/// ```
1208/// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1209/// use google_cloud_gax::paginator::ItemPaginator as _;
1210/// async fn sample(
1211/// project_id: &str,
1212/// location_id: &str,
1213/// ) -> anyhow::Result<()> {
1214/// let client = InsightsConfigService::builder().build().await?;
1215/// let mut list = client.list_insights_configs()
1216/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1217/// .by_item();
1218/// while let Some(item) = list.next().await.transpose()? {
1219/// println!("{:?}", item);
1220/// }
1221/// Ok(())
1222/// }
1223/// ```
1224///
1225/// # Service Description
1226///
1227/// Creates and manages InsightsConfigs.
1228///
1229/// The InsightsConfig resource is the core configuration object to capture
1230/// events from your Software Development Lifecycle. It acts as the central hub
1231/// for managing how Developer Connect understands your application, its runtime
1232/// environments, and the artifacts deployed within them.
1233/// A user can create an InsightsConfig, list previously-requested
1234/// InsightsConfigs or get InsightsConfigs by their ID to determine the status of
1235/// the InsightsConfig.
1236///
1237/// # Configuration
1238///
1239/// To configure `InsightsConfigService` use the `with_*` methods in the type returned
1240/// by [builder()][InsightsConfigService::builder]. The default configuration should
1241/// work for most applications. Common configuration changes include
1242///
1243/// * [with_endpoint()]: by default this client uses the global default endpoint
1244/// (`https://developerconnect.googleapis.com`). Applications using regional
1245/// endpoints or running in restricted networks (e.g. a network configured
1246/// with [Private Google Access with VPC Service Controls]) may want to
1247/// override this default.
1248/// * [with_credentials()]: by default this client uses
1249/// [Application Default Credentials]. Applications using custom
1250/// authentication may need to override this default.
1251///
1252/// [with_endpoint()]: super::builder::insights_config_service::ClientBuilder::with_endpoint
1253/// [with_credentials()]: super::builder::insights_config_service::ClientBuilder::with_credentials
1254/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1255/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1256///
1257/// # Pooling and Cloning
1258///
1259/// `InsightsConfigService` holds a connection pool internally, it is advised to
1260/// create one and reuse it. You do not need to wrap `InsightsConfigService` in
1261/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1262/// already uses an `Arc` internally.
1263#[derive(Clone, Debug)]
1264pub struct InsightsConfigService {
1265 inner: std::sync::Arc<dyn super::stub::dynamic::InsightsConfigService>,
1266}
1267
1268impl InsightsConfigService {
1269 /// Returns a builder for [InsightsConfigService].
1270 ///
1271 /// ```
1272 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1273 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1274 /// let client = InsightsConfigService::builder().build().await?;
1275 /// # Ok(()) }
1276 /// ```
1277 pub fn builder() -> super::builder::insights_config_service::ClientBuilder {
1278 crate::new_client_builder(super::builder::insights_config_service::client::Factory)
1279 }
1280
1281 /// Creates a new client from the provided stub.
1282 ///
1283 /// The most common case for calling this function is in tests mocking the
1284 /// client's behavior.
1285 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1286 where
1287 T: super::stub::InsightsConfigService + 'static,
1288 {
1289 Self { inner: stub.into() }
1290 }
1291
1292 pub(crate) async fn new(
1293 config: gaxi::options::ClientConfig,
1294 ) -> crate::ClientBuilderResult<Self> {
1295 let inner = Self::build_inner(config).await?;
1296 Ok(Self { inner })
1297 }
1298
1299 async fn build_inner(
1300 conf: gaxi::options::ClientConfig,
1301 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InsightsConfigService>>
1302 {
1303 if gaxi::options::tracing_enabled(&conf) {
1304 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1305 }
1306 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1307 }
1308
1309 async fn build_transport(
1310 conf: gaxi::options::ClientConfig,
1311 ) -> crate::ClientBuilderResult<impl super::stub::InsightsConfigService> {
1312 super::transport::InsightsConfigService::new(conf).await
1313 }
1314
1315 async fn build_with_tracing(
1316 conf: gaxi::options::ClientConfig,
1317 ) -> crate::ClientBuilderResult<impl super::stub::InsightsConfigService> {
1318 Self::build_transport(conf)
1319 .await
1320 .map(super::tracing::InsightsConfigService::new)
1321 }
1322
1323 /// Lists InsightsConfigs in a given project and location.
1324 ///
1325 /// # Example
1326 /// ```
1327 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1328 /// use google_cloud_gax::paginator::ItemPaginator as _;
1329 /// use google_cloud_developerconnect_v1::Result;
1330 /// async fn sample(
1331 /// client: &InsightsConfigService, project_id: &str, location_id: &str
1332 /// ) -> Result<()> {
1333 /// let mut list = client.list_insights_configs()
1334 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1335 /// .by_item();
1336 /// while let Some(item) = list.next().await.transpose()? {
1337 /// println!("{:?}", item);
1338 /// }
1339 /// Ok(())
1340 /// }
1341 /// ```
1342 pub fn list_insights_configs(
1343 &self,
1344 ) -> super::builder::insights_config_service::ListInsightsConfigs {
1345 super::builder::insights_config_service::ListInsightsConfigs::new(self.inner.clone())
1346 }
1347
1348 /// Creates a new InsightsConfig in a given project and location.
1349 ///
1350 /// # Long running operations
1351 ///
1352 /// This method is used to start, and/or poll a [long-running Operation].
1353 /// The [Working with long-running operations] chapter in the [user guide]
1354 /// covers these operations in detail.
1355 ///
1356 /// [long-running operation]: https://google.aip.dev/151
1357 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1358 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1359 ///
1360 /// # Example
1361 /// ```
1362 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1363 /// use google_cloud_lro::Poller;
1364 /// use google_cloud_developerconnect_v1::model::InsightsConfig;
1365 /// use google_cloud_developerconnect_v1::Result;
1366 /// async fn sample(
1367 /// client: &InsightsConfigService, project_id: &str, location_id: &str
1368 /// ) -> Result<()> {
1369 /// let response = client.create_insights_config()
1370 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1371 /// .set_insights_config(
1372 /// InsightsConfig::new()/* set fields */
1373 /// )
1374 /// .poller().until_done().await?;
1375 /// println!("response {:?}", response);
1376 /// Ok(())
1377 /// }
1378 /// ```
1379 pub fn create_insights_config(
1380 &self,
1381 ) -> super::builder::insights_config_service::CreateInsightsConfig {
1382 super::builder::insights_config_service::CreateInsightsConfig::new(self.inner.clone())
1383 }
1384
1385 /// Gets details of a single Insight.
1386 ///
1387 /// # Example
1388 /// ```
1389 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1390 /// use google_cloud_developerconnect_v1::Result;
1391 /// async fn sample(
1392 /// client: &InsightsConfigService, project_id: &str, location_id: &str, insights_config_id: &str
1393 /// ) -> Result<()> {
1394 /// let response = client.get_insights_config()
1395 /// .set_name(format!("projects/{project_id}/locations/{location_id}/insightsConfigs/{insights_config_id}"))
1396 /// .send().await?;
1397 /// println!("response {:?}", response);
1398 /// Ok(())
1399 /// }
1400 /// ```
1401 pub fn get_insights_config(
1402 &self,
1403 ) -> super::builder::insights_config_service::GetInsightsConfig {
1404 super::builder::insights_config_service::GetInsightsConfig::new(self.inner.clone())
1405 }
1406
1407 /// Updates the parameters of a single InsightsConfig.
1408 ///
1409 /// # Long running operations
1410 ///
1411 /// This method is used to start, and/or poll a [long-running Operation].
1412 /// The [Working with long-running operations] chapter in the [user guide]
1413 /// covers these operations in detail.
1414 ///
1415 /// [long-running operation]: https://google.aip.dev/151
1416 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1417 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1418 ///
1419 /// # Example
1420 /// ```
1421 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1422 /// use google_cloud_lro::Poller;
1423 /// use google_cloud_developerconnect_v1::model::InsightsConfig;
1424 /// use google_cloud_developerconnect_v1::Result;
1425 /// async fn sample(
1426 /// client: &InsightsConfigService, project_id: &str, location_id: &str, insights_config_id: &str
1427 /// ) -> Result<()> {
1428 /// let response = client.update_insights_config()
1429 /// .set_insights_config(
1430 /// InsightsConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/insightsConfigs/{insights_config_id}"))/* set fields */
1431 /// )
1432 /// .poller().until_done().await?;
1433 /// println!("response {:?}", response);
1434 /// Ok(())
1435 /// }
1436 /// ```
1437 pub fn update_insights_config(
1438 &self,
1439 ) -> super::builder::insights_config_service::UpdateInsightsConfig {
1440 super::builder::insights_config_service::UpdateInsightsConfig::new(self.inner.clone())
1441 }
1442
1443 /// Deletes a single Insight.
1444 ///
1445 /// # Long running operations
1446 ///
1447 /// This method is used to start, and/or poll a [long-running Operation].
1448 /// The [Working with long-running operations] chapter in the [user guide]
1449 /// covers these operations in detail.
1450 ///
1451 /// [long-running operation]: https://google.aip.dev/151
1452 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1453 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1454 ///
1455 /// # Example
1456 /// ```
1457 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1458 /// use google_cloud_lro::Poller;
1459 /// use google_cloud_developerconnect_v1::Result;
1460 /// async fn sample(
1461 /// client: &InsightsConfigService, project_id: &str, location_id: &str, insights_config_id: &str
1462 /// ) -> Result<()> {
1463 /// client.delete_insights_config()
1464 /// .set_name(format!("projects/{project_id}/locations/{location_id}/insightsConfigs/{insights_config_id}"))
1465 /// .poller().until_done().await?;
1466 /// Ok(())
1467 /// }
1468 /// ```
1469 pub fn delete_insights_config(
1470 &self,
1471 ) -> super::builder::insights_config_service::DeleteInsightsConfig {
1472 super::builder::insights_config_service::DeleteInsightsConfig::new(self.inner.clone())
1473 }
1474
1475 /// Gets a single Deployment Event.
1476 ///
1477 /// # Example
1478 /// ```
1479 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1480 /// use google_cloud_developerconnect_v1::Result;
1481 /// async fn sample(
1482 /// client: &InsightsConfigService, project_id: &str, location_id: &str, insights_config_id: &str, deployment_event_id: &str
1483 /// ) -> Result<()> {
1484 /// let response = client.get_deployment_event()
1485 /// .set_name(format!("projects/{project_id}/locations/{location_id}/insightsConfigs/{insights_config_id}/deploymentEvents/{deployment_event_id}"))
1486 /// .send().await?;
1487 /// println!("response {:?}", response);
1488 /// Ok(())
1489 /// }
1490 /// ```
1491 pub fn get_deployment_event(
1492 &self,
1493 ) -> super::builder::insights_config_service::GetDeploymentEvent {
1494 super::builder::insights_config_service::GetDeploymentEvent::new(self.inner.clone())
1495 }
1496
1497 /// Lists Deployment Events in a given insights config.
1498 ///
1499 /// # Example
1500 /// ```
1501 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1502 /// use google_cloud_gax::paginator::ItemPaginator as _;
1503 /// use google_cloud_developerconnect_v1::Result;
1504 /// async fn sample(
1505 /// client: &InsightsConfigService, project_id: &str, location_id: &str, insights_config_id: &str
1506 /// ) -> Result<()> {
1507 /// let mut list = client.list_deployment_events()
1508 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/insightsConfigs/{insights_config_id}"))
1509 /// .by_item();
1510 /// while let Some(item) = list.next().await.transpose()? {
1511 /// println!("{:?}", item);
1512 /// }
1513 /// Ok(())
1514 /// }
1515 /// ```
1516 pub fn list_deployment_events(
1517 &self,
1518 ) -> super::builder::insights_config_service::ListDeploymentEvents {
1519 super::builder::insights_config_service::ListDeploymentEvents::new(self.inner.clone())
1520 }
1521
1522 /// Lists information about the supported locations for this service.
1523 /// This method can be called in two ways:
1524 ///
1525 /// * **List all public locations:** Use the path `GET /v1/locations`.
1526 /// * **List project-visible locations:** Use the path
1527 /// `GET /v1/projects/{project_id}/locations`. This may include public
1528 /// locations as well as private or other locations specifically visible
1529 /// to the project.
1530 ///
1531 /// # Example
1532 /// ```
1533 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1534 /// use google_cloud_gax::paginator::ItemPaginator as _;
1535 /// use google_cloud_developerconnect_v1::Result;
1536 /// async fn sample(
1537 /// client: &InsightsConfigService
1538 /// ) -> Result<()> {
1539 /// let mut list = client.list_locations()
1540 /// /* set fields */
1541 /// .by_item();
1542 /// while let Some(item) = list.next().await.transpose()? {
1543 /// println!("{:?}", item);
1544 /// }
1545 /// Ok(())
1546 /// }
1547 /// ```
1548 pub fn list_locations(&self) -> super::builder::insights_config_service::ListLocations {
1549 super::builder::insights_config_service::ListLocations::new(self.inner.clone())
1550 }
1551
1552 /// Gets information about a location.
1553 ///
1554 /// # Example
1555 /// ```
1556 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1557 /// use google_cloud_developerconnect_v1::Result;
1558 /// async fn sample(
1559 /// client: &InsightsConfigService
1560 /// ) -> Result<()> {
1561 /// let response = client.get_location()
1562 /// /* set fields */
1563 /// .send().await?;
1564 /// println!("response {:?}", response);
1565 /// Ok(())
1566 /// }
1567 /// ```
1568 pub fn get_location(&self) -> super::builder::insights_config_service::GetLocation {
1569 super::builder::insights_config_service::GetLocation::new(self.inner.clone())
1570 }
1571
1572 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1573 ///
1574 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1575 ///
1576 /// # Example
1577 /// ```
1578 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1579 /// use google_cloud_gax::paginator::ItemPaginator as _;
1580 /// use google_cloud_developerconnect_v1::Result;
1581 /// async fn sample(
1582 /// client: &InsightsConfigService
1583 /// ) -> Result<()> {
1584 /// let mut list = client.list_operations()
1585 /// /* set fields */
1586 /// .by_item();
1587 /// while let Some(item) = list.next().await.transpose()? {
1588 /// println!("{:?}", item);
1589 /// }
1590 /// Ok(())
1591 /// }
1592 /// ```
1593 pub fn list_operations(&self) -> super::builder::insights_config_service::ListOperations {
1594 super::builder::insights_config_service::ListOperations::new(self.inner.clone())
1595 }
1596
1597 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1598 ///
1599 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1600 ///
1601 /// # Example
1602 /// ```
1603 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1604 /// use google_cloud_developerconnect_v1::Result;
1605 /// async fn sample(
1606 /// client: &InsightsConfigService
1607 /// ) -> Result<()> {
1608 /// let response = client.get_operation()
1609 /// /* set fields */
1610 /// .send().await?;
1611 /// println!("response {:?}", response);
1612 /// Ok(())
1613 /// }
1614 /// ```
1615 pub fn get_operation(&self) -> super::builder::insights_config_service::GetOperation {
1616 super::builder::insights_config_service::GetOperation::new(self.inner.clone())
1617 }
1618
1619 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1620 ///
1621 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1622 ///
1623 /// # Example
1624 /// ```
1625 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1626 /// use google_cloud_developerconnect_v1::Result;
1627 /// async fn sample(
1628 /// client: &InsightsConfigService
1629 /// ) -> Result<()> {
1630 /// client.delete_operation()
1631 /// /* set fields */
1632 /// .send().await?;
1633 /// Ok(())
1634 /// }
1635 /// ```
1636 pub fn delete_operation(&self) -> super::builder::insights_config_service::DeleteOperation {
1637 super::builder::insights_config_service::DeleteOperation::new(self.inner.clone())
1638 }
1639
1640 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1641 ///
1642 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1643 ///
1644 /// # Example
1645 /// ```
1646 /// # use google_cloud_developerconnect_v1::client::InsightsConfigService;
1647 /// use google_cloud_developerconnect_v1::Result;
1648 /// async fn sample(
1649 /// client: &InsightsConfigService
1650 /// ) -> Result<()> {
1651 /// client.cancel_operation()
1652 /// /* set fields */
1653 /// .send().await?;
1654 /// Ok(())
1655 /// }
1656 /// ```
1657 pub fn cancel_operation(&self) -> super::builder::insights_config_service::CancelOperation {
1658 super::builder::insights_config_service::CancelOperation::new(self.inner.clone())
1659 }
1660}