google_cloud_apihub_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::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the API hub API.
20///
21/// # Example
22/// ```
23/// # tokio_test::block_on(async {
24/// # use google_cloud_apihub_v1::client::ApiHub;
25/// let client = ApiHub::builder().build().await?;
26/// // use `client` to make requests to the API hub API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// This service provides all methods related to the API hub.
33///
34/// # Configuration
35///
36/// To configure `ApiHub` use the `with_*` methods in the type returned
37/// by [builder()][ApiHub::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://apihub.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::api_hub::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::api_hub::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/// `ApiHub` holds a connection pool internally, it is advised to
57/// create one and the reuse it.  You do not need to wrap `ApiHub` 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 ApiHub {
62    inner: std::sync::Arc<dyn super::stub::dynamic::ApiHub>,
63}
64
65impl ApiHub {
66    /// Returns a builder for [ApiHub].
67    ///
68    /// ```
69    /// # tokio_test::block_on(async {
70    /// # use google_cloud_apihub_v1::client::ApiHub;
71    /// let client = ApiHub::builder().build().await?;
72    /// # gax::client_builder::Result::<()>::Ok(()) });
73    /// ```
74    pub fn builder() -> super::builder::api_hub::ClientBuilder {
75        gax::client_builder::internal::new_builder(super::builder::api_hub::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::ApiHub + '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::ApiHub>> {
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::ApiHub> {
110        super::transport::ApiHub::new(conf).await
111    }
112
113    async fn build_with_tracing(
114        conf: gaxi::options::ClientConfig,
115    ) -> gax::client_builder::Result<impl super::stub::ApiHub> {
116        Self::build_transport(conf)
117            .await
118            .map(super::tracing::ApiHub::new)
119    }
120
121    /// Create an API resource in the API hub.
122    /// Once an API resource is created, versions can be added to it.
123    pub fn create_api(&self) -> super::builder::api_hub::CreateApi {
124        super::builder::api_hub::CreateApi::new(self.inner.clone())
125    }
126
127    /// Get API resource details including the API versions contained in it.
128    pub fn get_api(&self) -> super::builder::api_hub::GetApi {
129        super::builder::api_hub::GetApi::new(self.inner.clone())
130    }
131
132    /// List API resources in the API hub.
133    pub fn list_apis(&self) -> super::builder::api_hub::ListApis {
134        super::builder::api_hub::ListApis::new(self.inner.clone())
135    }
136
137    /// Update an API resource in the API hub. The following fields in the
138    /// [API][google.cloud.apihub.v1.Api] can be updated:
139    ///
140    /// * [display_name][google.cloud.apihub.v1.Api.display_name]
141    /// * [description][google.cloud.apihub.v1.Api.description]
142    /// * [owner][google.cloud.apihub.v1.Api.owner]
143    /// * [documentation][google.cloud.apihub.v1.Api.documentation]
144    /// * [target_user][google.cloud.apihub.v1.Api.target_user]
145    /// * [team][google.cloud.apihub.v1.Api.team]
146    /// * [business_unit][google.cloud.apihub.v1.Api.business_unit]
147    /// * [maturity_level][google.cloud.apihub.v1.Api.maturity_level]
148    /// * [api_style][google.cloud.apihub.v1.Api.api_style]
149    /// * [attributes][google.cloud.apihub.v1.Api.attributes]
150    ///
151    /// The
152    /// [update_mask][google.cloud.apihub.v1.UpdateApiRequest.update_mask]
153    /// should be used to specify the fields being updated.
154    ///
155    /// Updating the owner field requires complete owner message
156    /// and updates both owner and email fields.
157    ///
158    /// [google.cloud.apihub.v1.Api]: crate::model::Api
159    /// [google.cloud.apihub.v1.Api.api_style]: crate::model::Api::api_style
160    /// [google.cloud.apihub.v1.Api.attributes]: crate::model::Api::attributes
161    /// [google.cloud.apihub.v1.Api.business_unit]: crate::model::Api::business_unit
162    /// [google.cloud.apihub.v1.Api.description]: crate::model::Api::description
163    /// [google.cloud.apihub.v1.Api.display_name]: crate::model::Api::display_name
164    /// [google.cloud.apihub.v1.Api.documentation]: crate::model::Api::documentation
165    /// [google.cloud.apihub.v1.Api.maturity_level]: crate::model::Api::maturity_level
166    /// [google.cloud.apihub.v1.Api.owner]: crate::model::Api::owner
167    /// [google.cloud.apihub.v1.Api.target_user]: crate::model::Api::target_user
168    /// [google.cloud.apihub.v1.Api.team]: crate::model::Api::team
169    /// [google.cloud.apihub.v1.UpdateApiRequest.update_mask]: crate::model::UpdateApiRequest::update_mask
170    pub fn update_api(&self) -> super::builder::api_hub::UpdateApi {
171        super::builder::api_hub::UpdateApi::new(self.inner.clone())
172    }
173
174    /// Delete an API resource in the API hub. API can only be deleted if all
175    /// underlying versions are deleted.
176    pub fn delete_api(&self) -> super::builder::api_hub::DeleteApi {
177        super::builder::api_hub::DeleteApi::new(self.inner.clone())
178    }
179
180    /// Create an API version for an API resource in the API hub.
181    pub fn create_version(&self) -> super::builder::api_hub::CreateVersion {
182        super::builder::api_hub::CreateVersion::new(self.inner.clone())
183    }
184
185    /// Get details about the API version of an API resource. This will include
186    /// information about the specs and operations present in the API
187    /// version as well as the deployments linked to it.
188    pub fn get_version(&self) -> super::builder::api_hub::GetVersion {
189        super::builder::api_hub::GetVersion::new(self.inner.clone())
190    }
191
192    /// List API versions of an API resource in the API hub.
193    pub fn list_versions(&self) -> super::builder::api_hub::ListVersions {
194        super::builder::api_hub::ListVersions::new(self.inner.clone())
195    }
196
197    /// Update API version. The following fields in the
198    /// [version][google.cloud.apihub.v1.Version] can be updated currently:
199    ///
200    /// * [display_name][google.cloud.apihub.v1.Version.display_name]
201    /// * [description][google.cloud.apihub.v1.Version.description]
202    /// * [documentation][google.cloud.apihub.v1.Version.documentation]
203    /// * [deployments][google.cloud.apihub.v1.Version.deployments]
204    /// * [lifecycle][google.cloud.apihub.v1.Version.lifecycle]
205    /// * [compliance][google.cloud.apihub.v1.Version.compliance]
206    /// * [accreditation][google.cloud.apihub.v1.Version.accreditation]
207    /// * [attributes][google.cloud.apihub.v1.Version.attributes]
208    ///
209    /// The
210    /// [update_mask][google.cloud.apihub.v1.UpdateVersionRequest.update_mask]
211    /// should be used to specify the fields being updated.
212    ///
213    /// [google.cloud.apihub.v1.UpdateVersionRequest.update_mask]: crate::model::UpdateVersionRequest::update_mask
214    /// [google.cloud.apihub.v1.Version]: crate::model::Version
215    /// [google.cloud.apihub.v1.Version.accreditation]: crate::model::Version::accreditation
216    /// [google.cloud.apihub.v1.Version.attributes]: crate::model::Version::attributes
217    /// [google.cloud.apihub.v1.Version.compliance]: crate::model::Version::compliance
218    /// [google.cloud.apihub.v1.Version.deployments]: crate::model::Version::deployments
219    /// [google.cloud.apihub.v1.Version.description]: crate::model::Version::description
220    /// [google.cloud.apihub.v1.Version.display_name]: crate::model::Version::display_name
221    /// [google.cloud.apihub.v1.Version.documentation]: crate::model::Version::documentation
222    /// [google.cloud.apihub.v1.Version.lifecycle]: crate::model::Version::lifecycle
223    pub fn update_version(&self) -> super::builder::api_hub::UpdateVersion {
224        super::builder::api_hub::UpdateVersion::new(self.inner.clone())
225    }
226
227    /// Delete an API version. Version can only be deleted if all underlying specs,
228    /// operations, definitions and linked deployments are deleted.
229    pub fn delete_version(&self) -> super::builder::api_hub::DeleteVersion {
230        super::builder::api_hub::DeleteVersion::new(self.inner.clone())
231    }
232
233    /// Add a spec to an API version in the API hub.
234    /// Multiple specs can be added to an API version.
235    /// Note, while adding a spec, at least one of `contents` or `source_uri` must
236    /// be provided. If `contents` is provided, then `spec_type` must also be
237    /// provided.
238    ///
239    /// On adding a spec with contents to the version, the operations present in it
240    /// will be added to the version.Note that the file contents in the spec should
241    /// be of the same type as defined in the
242    /// `projects/{project}/locations/{location}/attributes/system-spec-type`
243    /// attribute associated with spec resource. Note that specs of various types
244    /// can be uploaded, however parsing of details is supported for OpenAPI spec
245    /// currently.
246    ///
247    /// In order to access the information parsed from the spec, use the
248    /// [GetSpec][google.cloud.apihub.v1.ApiHub.GetSpec] method.
249    /// In order to access the raw contents for a particular spec, use the
250    /// [GetSpecContents][google.cloud.apihub.v1.ApiHub.GetSpecContents] method.
251    /// In order to access the operations parsed from the spec, use the
252    /// [ListAPIOperations][google.cloud.apihub.v1.ApiHub.ListApiOperations]
253    /// method.
254    ///
255    /// [google.cloud.apihub.v1.ApiHub.GetSpec]: crate::client::ApiHub::get_spec
256    /// [google.cloud.apihub.v1.ApiHub.GetSpecContents]: crate::client::ApiHub::get_spec_contents
257    /// [google.cloud.apihub.v1.ApiHub.ListApiOperations]: crate::client::ApiHub::list_api_operations
258    pub fn create_spec(&self) -> super::builder::api_hub::CreateSpec {
259        super::builder::api_hub::CreateSpec::new(self.inner.clone())
260    }
261
262    /// Get details about the information parsed from a spec.
263    /// Note that this method does not return the raw spec contents.
264    /// Use [GetSpecContents][google.cloud.apihub.v1.ApiHub.GetSpecContents] method
265    /// to retrieve the same.
266    ///
267    /// [google.cloud.apihub.v1.ApiHub.GetSpecContents]: crate::client::ApiHub::get_spec_contents
268    pub fn get_spec(&self) -> super::builder::api_hub::GetSpec {
269        super::builder::api_hub::GetSpec::new(self.inner.clone())
270    }
271
272    /// Get spec contents.
273    pub fn get_spec_contents(&self) -> super::builder::api_hub::GetSpecContents {
274        super::builder::api_hub::GetSpecContents::new(self.inner.clone())
275    }
276
277    /// List specs corresponding to a particular API resource.
278    pub fn list_specs(&self) -> super::builder::api_hub::ListSpecs {
279        super::builder::api_hub::ListSpecs::new(self.inner.clone())
280    }
281
282    /// Update spec. The following fields in the
283    /// [spec][google.cloud.apihub.v1.Spec] can be updated:
284    ///
285    /// * [display_name][google.cloud.apihub.v1.Spec.display_name]
286    /// * [source_uri][google.cloud.apihub.v1.Spec.source_uri]
287    /// * [lint_response][google.cloud.apihub.v1.Spec.lint_response]
288    /// * [attributes][google.cloud.apihub.v1.Spec.attributes]
289    /// * [contents][google.cloud.apihub.v1.Spec.contents]
290    /// * [spec_type][google.cloud.apihub.v1.Spec.spec_type]
291    ///
292    /// In case of an OAS spec, updating spec contents can lead to:
293    ///
294    /// 1. Creation, deletion and update of operations.
295    /// 1. Creation, deletion and update of definitions.
296    /// 1. Update of other info parsed out from the new spec.
297    ///
298    /// In case of contents or source_uri being present in update mask, spec_type
299    /// must also be present. Also, spec_type can not be present in update mask if
300    /// contents or source_uri is not present.
301    ///
302    /// The
303    /// [update_mask][google.cloud.apihub.v1.UpdateSpecRequest.update_mask]
304    /// should be used to specify the fields being updated.
305    ///
306    /// [google.cloud.apihub.v1.Spec]: crate::model::Spec
307    /// [google.cloud.apihub.v1.Spec.attributes]: crate::model::Spec::attributes
308    /// [google.cloud.apihub.v1.Spec.contents]: crate::model::Spec::contents
309    /// [google.cloud.apihub.v1.Spec.display_name]: crate::model::Spec::display_name
310    /// [google.cloud.apihub.v1.Spec.lint_response]: crate::model::Spec::lint_response
311    /// [google.cloud.apihub.v1.Spec.source_uri]: crate::model::Spec::source_uri
312    /// [google.cloud.apihub.v1.Spec.spec_type]: crate::model::Spec::spec_type
313    /// [google.cloud.apihub.v1.UpdateSpecRequest.update_mask]: crate::model::UpdateSpecRequest::update_mask
314    pub fn update_spec(&self) -> super::builder::api_hub::UpdateSpec {
315        super::builder::api_hub::UpdateSpec::new(self.inner.clone())
316    }
317
318    /// Delete a spec.
319    /// Deleting a spec will also delete the associated operations from the
320    /// version.
321    pub fn delete_spec(&self) -> super::builder::api_hub::DeleteSpec {
322        super::builder::api_hub::DeleteSpec::new(self.inner.clone())
323    }
324
325    /// Create an apiOperation in an API version.
326    /// An apiOperation can be created only if the version has no apiOperations
327    /// which were created by parsing a spec.
328    pub fn create_api_operation(&self) -> super::builder::api_hub::CreateApiOperation {
329        super::builder::api_hub::CreateApiOperation::new(self.inner.clone())
330    }
331
332    /// Get details about a particular operation in API version.
333    pub fn get_api_operation(&self) -> super::builder::api_hub::GetApiOperation {
334        super::builder::api_hub::GetApiOperation::new(self.inner.clone())
335    }
336
337    /// List operations in an API version.
338    pub fn list_api_operations(&self) -> super::builder::api_hub::ListApiOperations {
339        super::builder::api_hub::ListApiOperations::new(self.inner.clone())
340    }
341
342    /// Update an operation in an API version. The following fields in the
343    /// [ApiOperation resource][google.cloud.apihub.v1.ApiOperation] can be
344    /// updated:
345    ///
346    /// * [details.description][ApiOperation.details.description]
347    /// * [details.documentation][ApiOperation.details.documentation]
348    /// * [details.http_operation.path][ApiOperation.details.http_operation.path.path]
349    /// * [details.http_operation.method][ApiOperation.details.http_operation.method]
350    /// * [details.deprecated][ApiOperation.details.deprecated]
351    /// * [attributes][google.cloud.apihub.v1.ApiOperation.attributes]
352    ///
353    /// The
354    /// [update_mask][google.cloud.apihub.v1.UpdateApiOperationRequest.update_mask]
355    /// should be used to specify the fields being updated.
356    ///
357    /// An operation can be updated only if the operation was created via
358    /// [CreateApiOperation][google.cloud.apihub.v1.ApiHub.CreateApiOperation] API.
359    /// If the operation was created by parsing the spec, then it can be edited by
360    /// updating the spec.
361    ///
362    /// [google.cloud.apihub.v1.ApiHub.CreateApiOperation]: crate::client::ApiHub::create_api_operation
363    /// [google.cloud.apihub.v1.ApiOperation]: crate::model::ApiOperation
364    /// [google.cloud.apihub.v1.ApiOperation.attributes]: crate::model::ApiOperation::attributes
365    /// [google.cloud.apihub.v1.UpdateApiOperationRequest.update_mask]: crate::model::UpdateApiOperationRequest::update_mask
366    pub fn update_api_operation(&self) -> super::builder::api_hub::UpdateApiOperation {
367        super::builder::api_hub::UpdateApiOperation::new(self.inner.clone())
368    }
369
370    /// Delete an operation in an API version and we can delete only the
371    /// operations created via create API. If the operation was created by parsing
372    /// the spec, then it can be deleted by editing or deleting the spec.
373    pub fn delete_api_operation(&self) -> super::builder::api_hub::DeleteApiOperation {
374        super::builder::api_hub::DeleteApiOperation::new(self.inner.clone())
375    }
376
377    /// Get details about a definition in an API version.
378    pub fn get_definition(&self) -> super::builder::api_hub::GetDefinition {
379        super::builder::api_hub::GetDefinition::new(self.inner.clone())
380    }
381
382    /// Create a deployment resource in the API hub.
383    /// Once a deployment resource is created, it can be associated with API
384    /// versions.
385    pub fn create_deployment(&self) -> super::builder::api_hub::CreateDeployment {
386        super::builder::api_hub::CreateDeployment::new(self.inner.clone())
387    }
388
389    /// Get details about a deployment and the API versions linked to it.
390    pub fn get_deployment(&self) -> super::builder::api_hub::GetDeployment {
391        super::builder::api_hub::GetDeployment::new(self.inner.clone())
392    }
393
394    /// List deployment resources in the API hub.
395    pub fn list_deployments(&self) -> super::builder::api_hub::ListDeployments {
396        super::builder::api_hub::ListDeployments::new(self.inner.clone())
397    }
398
399    /// Update a deployment resource in the API hub. The following fields in the
400    /// [deployment resource][google.cloud.apihub.v1.Deployment] can be
401    /// updated:
402    ///
403    /// * [display_name][google.cloud.apihub.v1.Deployment.display_name]
404    /// * [description][google.cloud.apihub.v1.Deployment.description]
405    /// * [documentation][google.cloud.apihub.v1.Deployment.documentation]
406    /// * [deployment_type][google.cloud.apihub.v1.Deployment.deployment_type]
407    /// * [resource_uri][google.cloud.apihub.v1.Deployment.resource_uri]
408    /// * [endpoints][google.cloud.apihub.v1.Deployment.endpoints]
409    /// * [slo][google.cloud.apihub.v1.Deployment.slo]
410    /// * [environment][google.cloud.apihub.v1.Deployment.environment]
411    /// * [attributes][google.cloud.apihub.v1.Deployment.attributes]
412    /// * [source_project] [google.cloud.apihub.v1.Deployment.source_project]
413    /// * [source_environment]
414    ///   [google.cloud.apihub.v1.Deployment.source_environment]
415    /// * [management_url][google.cloud.apihub.v1.Deployment.management_url]
416    /// * [source_uri][google.cloud.apihub.v1.Deployment.source_uri]
417    ///   The
418    ///   [update_mask][google.cloud.apihub.v1.UpdateDeploymentRequest.update_mask]
419    ///   should be used to specify the fields being updated.
420    ///
421    /// [google.cloud.apihub.v1.Deployment]: crate::model::Deployment
422    /// [google.cloud.apihub.v1.Deployment.attributes]: crate::model::Deployment::attributes
423    /// [google.cloud.apihub.v1.Deployment.deployment_type]: crate::model::Deployment::deployment_type
424    /// [google.cloud.apihub.v1.Deployment.description]: crate::model::Deployment::description
425    /// [google.cloud.apihub.v1.Deployment.display_name]: crate::model::Deployment::display_name
426    /// [google.cloud.apihub.v1.Deployment.documentation]: crate::model::Deployment::documentation
427    /// [google.cloud.apihub.v1.Deployment.endpoints]: crate::model::Deployment::endpoints
428    /// [google.cloud.apihub.v1.Deployment.environment]: crate::model::Deployment::environment
429    /// [google.cloud.apihub.v1.Deployment.management_url]: crate::model::Deployment::management_url
430    /// [google.cloud.apihub.v1.Deployment.resource_uri]: crate::model::Deployment::resource_uri
431    /// [google.cloud.apihub.v1.Deployment.slo]: crate::model::Deployment::slo
432    /// [google.cloud.apihub.v1.Deployment.source_uri]: crate::model::Deployment::source_uri
433    /// [google.cloud.apihub.v1.UpdateDeploymentRequest.update_mask]: crate::model::UpdateDeploymentRequest::update_mask
434    pub fn update_deployment(&self) -> super::builder::api_hub::UpdateDeployment {
435        super::builder::api_hub::UpdateDeployment::new(self.inner.clone())
436    }
437
438    /// Delete a deployment resource in the API hub.
439    pub fn delete_deployment(&self) -> super::builder::api_hub::DeleteDeployment {
440        super::builder::api_hub::DeleteDeployment::new(self.inner.clone())
441    }
442
443    /// Create a user defined attribute.
444    ///
445    /// Certain pre defined attributes are already created by the API hub. These
446    /// attributes will have type as `SYSTEM_DEFINED` and can be listed via
447    /// [ListAttributes][google.cloud.apihub.v1.ApiHub.ListAttributes] method.
448    /// Allowed values for the same can be updated via
449    /// [UpdateAttribute][google.cloud.apihub.v1.ApiHub.UpdateAttribute] method.
450    ///
451    /// [google.cloud.apihub.v1.ApiHub.ListAttributes]: crate::client::ApiHub::list_attributes
452    /// [google.cloud.apihub.v1.ApiHub.UpdateAttribute]: crate::client::ApiHub::update_attribute
453    pub fn create_attribute(&self) -> super::builder::api_hub::CreateAttribute {
454        super::builder::api_hub::CreateAttribute::new(self.inner.clone())
455    }
456
457    /// Get details about the attribute.
458    pub fn get_attribute(&self) -> super::builder::api_hub::GetAttribute {
459        super::builder::api_hub::GetAttribute::new(self.inner.clone())
460    }
461
462    /// Update the attribute.  The following fields in the
463    /// [Attribute resource][google.cloud.apihub.v1.Attribute] can be updated:
464    ///
465    /// * [display_name][google.cloud.apihub.v1.Attribute.display_name]
466    ///   The display name can be updated for user defined attributes only.
467    /// * [description][google.cloud.apihub.v1.Attribute.description]
468    ///   The description can be updated for user defined attributes only.
469    /// * [allowed_values][google.cloud.apihub.v1.Attribute.allowed_values]
470    ///   To update the list of allowed values, clients need to use the fetched list
471    ///   of allowed values and add or remove values to or from the same list.
472    ///   The mutable allowed values can be updated for both user defined and System
473    ///   defined attributes. The immutable allowed values cannot be updated or
474    ///   deleted. The updated list of allowed values cannot be empty. If an allowed
475    ///   value that is already used by some resource's attribute is deleted, then
476    ///   the association between the resource and the attribute value will also be
477    ///   deleted.
478    /// * [cardinality][google.cloud.apihub.v1.Attribute.cardinality]
479    ///   The cardinality can be updated for user defined attributes only.
480    ///   Cardinality can only be increased during an update.
481    ///
482    /// The
483    /// [update_mask][google.cloud.apihub.v1.UpdateAttributeRequest.update_mask]
484    /// should be used to specify the fields being updated.
485    ///
486    /// [google.cloud.apihub.v1.Attribute]: crate::model::Attribute
487    /// [google.cloud.apihub.v1.Attribute.allowed_values]: crate::model::Attribute::allowed_values
488    /// [google.cloud.apihub.v1.Attribute.cardinality]: crate::model::Attribute::cardinality
489    /// [google.cloud.apihub.v1.Attribute.description]: crate::model::Attribute::description
490    /// [google.cloud.apihub.v1.Attribute.display_name]: crate::model::Attribute::display_name
491    /// [google.cloud.apihub.v1.UpdateAttributeRequest.update_mask]: crate::model::UpdateAttributeRequest::update_mask
492    pub fn update_attribute(&self) -> super::builder::api_hub::UpdateAttribute {
493        super::builder::api_hub::UpdateAttribute::new(self.inner.clone())
494    }
495
496    /// Delete an attribute.
497    ///
498    /// Note: System defined attributes cannot be deleted. All
499    /// associations of the attribute being deleted with any API hub resource will
500    /// also get deleted.
501    pub fn delete_attribute(&self) -> super::builder::api_hub::DeleteAttribute {
502        super::builder::api_hub::DeleteAttribute::new(self.inner.clone())
503    }
504
505    /// List all attributes.
506    pub fn list_attributes(&self) -> super::builder::api_hub::ListAttributes {
507        super::builder::api_hub::ListAttributes::new(self.inner.clone())
508    }
509
510    /// Search across API-Hub resources.
511    pub fn search_resources(&self) -> super::builder::api_hub::SearchResources {
512        super::builder::api_hub::SearchResources::new(self.inner.clone())
513    }
514
515    /// Create an External API resource in the API hub.
516    pub fn create_external_api(&self) -> super::builder::api_hub::CreateExternalApi {
517        super::builder::api_hub::CreateExternalApi::new(self.inner.clone())
518    }
519
520    /// Get details about an External API resource in the API hub.
521    pub fn get_external_api(&self) -> super::builder::api_hub::GetExternalApi {
522        super::builder::api_hub::GetExternalApi::new(self.inner.clone())
523    }
524
525    /// Update an External API resource in the API hub. The following fields can be
526    /// updated:
527    ///
528    /// * [display_name][google.cloud.apihub.v1.ExternalApi.display_name]
529    /// * [description][google.cloud.apihub.v1.ExternalApi.description]
530    /// * [documentation][google.cloud.apihub.v1.ExternalApi.documentation]
531    /// * [endpoints][google.cloud.apihub.v1.ExternalApi.endpoints]
532    /// * [paths][google.cloud.apihub.v1.ExternalApi.paths]
533    ///
534    /// The
535    /// [update_mask][google.cloud.apihub.v1.UpdateExternalApiRequest.update_mask]
536    /// should be used to specify the fields being updated.
537    ///
538    /// [google.cloud.apihub.v1.ExternalApi.description]: crate::model::ExternalApi::description
539    /// [google.cloud.apihub.v1.ExternalApi.display_name]: crate::model::ExternalApi::display_name
540    /// [google.cloud.apihub.v1.ExternalApi.documentation]: crate::model::ExternalApi::documentation
541    /// [google.cloud.apihub.v1.ExternalApi.endpoints]: crate::model::ExternalApi::endpoints
542    /// [google.cloud.apihub.v1.ExternalApi.paths]: crate::model::ExternalApi::paths
543    /// [google.cloud.apihub.v1.UpdateExternalApiRequest.update_mask]: crate::model::UpdateExternalApiRequest::update_mask
544    pub fn update_external_api(&self) -> super::builder::api_hub::UpdateExternalApi {
545        super::builder::api_hub::UpdateExternalApi::new(self.inner.clone())
546    }
547
548    /// Delete an External API resource in the API hub.
549    pub fn delete_external_api(&self) -> super::builder::api_hub::DeleteExternalApi {
550        super::builder::api_hub::DeleteExternalApi::new(self.inner.clone())
551    }
552
553    /// List External API resources in the API hub.
554    pub fn list_external_apis(&self) -> super::builder::api_hub::ListExternalApis {
555        super::builder::api_hub::ListExternalApis::new(self.inner.clone())
556    }
557
558    /// Lists information about the supported locations for this service.
559    pub fn list_locations(&self) -> super::builder::api_hub::ListLocations {
560        super::builder::api_hub::ListLocations::new(self.inner.clone())
561    }
562
563    /// Gets information about a location.
564    pub fn get_location(&self) -> super::builder::api_hub::GetLocation {
565        super::builder::api_hub::GetLocation::new(self.inner.clone())
566    }
567
568    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
569    ///
570    /// [google.longrunning.Operations]: longrunning::client::Operations
571    pub fn list_operations(&self) -> super::builder::api_hub::ListOperations {
572        super::builder::api_hub::ListOperations::new(self.inner.clone())
573    }
574
575    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
576    ///
577    /// [google.longrunning.Operations]: longrunning::client::Operations
578    pub fn get_operation(&self) -> super::builder::api_hub::GetOperation {
579        super::builder::api_hub::GetOperation::new(self.inner.clone())
580    }
581
582    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
583    ///
584    /// [google.longrunning.Operations]: longrunning::client::Operations
585    pub fn delete_operation(&self) -> super::builder::api_hub::DeleteOperation {
586        super::builder::api_hub::DeleteOperation::new(self.inner.clone())
587    }
588
589    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
590    ///
591    /// [google.longrunning.Operations]: longrunning::client::Operations
592    pub fn cancel_operation(&self) -> super::builder::api_hub::CancelOperation {
593        super::builder::api_hub::CancelOperation::new(self.inner.clone())
594    }
595}
596
597/// Implements a client for the API hub API.
598///
599/// # Example
600/// ```
601/// # tokio_test::block_on(async {
602/// # use google_cloud_apihub_v1::client::ApiHubDependencies;
603/// let client = ApiHubDependencies::builder().build().await?;
604/// // use `client` to make requests to the API hub API.
605/// # gax::client_builder::Result::<()>::Ok(()) });
606/// ```
607///
608/// # Service Description
609///
610/// This service provides methods for various operations related to a
611/// [Dependency][google.cloud.apihub.v1.Dependency] in the API hub.
612///
613/// [google.cloud.apihub.v1.Dependency]: crate::model::Dependency
614///
615/// # Configuration
616///
617/// To configure `ApiHubDependencies` use the `with_*` methods in the type returned
618/// by [builder()][ApiHubDependencies::builder]. The default configuration should
619/// work for most applications. Common configuration changes include
620///
621/// * [with_endpoint()]: by default this client uses the global default endpoint
622///   (`https://apihub.googleapis.com`). Applications using regional
623///   endpoints or running in restricted networks (e.g. a network configured
624//    with [Private Google Access with VPC Service Controls]) may want to
625///   override this default.
626/// * [with_credentials()]: by default this client uses
627///   [Application Default Credentials]. Applications using custom
628///   authentication may need to override this default.
629///
630/// [with_endpoint()]: super::builder::api_hub_dependencies::ClientBuilder::with_endpoint
631/// [with_credentials()]: super::builder::api_hub_dependencies::ClientBuilder::credentials
632/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
633/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
634///
635/// # Pooling and Cloning
636///
637/// `ApiHubDependencies` holds a connection pool internally, it is advised to
638/// create one and the reuse it.  You do not need to wrap `ApiHubDependencies` in
639/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
640/// already uses an `Arc` internally.
641#[derive(Clone, Debug)]
642pub struct ApiHubDependencies {
643    inner: std::sync::Arc<dyn super::stub::dynamic::ApiHubDependencies>,
644}
645
646impl ApiHubDependencies {
647    /// Returns a builder for [ApiHubDependencies].
648    ///
649    /// ```
650    /// # tokio_test::block_on(async {
651    /// # use google_cloud_apihub_v1::client::ApiHubDependencies;
652    /// let client = ApiHubDependencies::builder().build().await?;
653    /// # gax::client_builder::Result::<()>::Ok(()) });
654    /// ```
655    pub fn builder() -> super::builder::api_hub_dependencies::ClientBuilder {
656        gax::client_builder::internal::new_builder(
657            super::builder::api_hub_dependencies::client::Factory,
658        )
659    }
660
661    /// Creates a new client from the provided stub.
662    ///
663    /// The most common case for calling this function is in tests mocking the
664    /// client's behavior.
665    pub fn from_stub<T>(stub: T) -> Self
666    where
667        T: super::stub::ApiHubDependencies + 'static,
668    {
669        Self {
670            inner: std::sync::Arc::new(stub),
671        }
672    }
673
674    pub(crate) async fn new(
675        config: gaxi::options::ClientConfig,
676    ) -> gax::client_builder::Result<Self> {
677        let inner = Self::build_inner(config).await?;
678        Ok(Self { inner })
679    }
680
681    async fn build_inner(
682        conf: gaxi::options::ClientConfig,
683    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ApiHubDependencies>>
684    {
685        if gaxi::options::tracing_enabled(&conf) {
686            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
687        }
688        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
689    }
690
691    async fn build_transport(
692        conf: gaxi::options::ClientConfig,
693    ) -> gax::client_builder::Result<impl super::stub::ApiHubDependencies> {
694        super::transport::ApiHubDependencies::new(conf).await
695    }
696
697    async fn build_with_tracing(
698        conf: gaxi::options::ClientConfig,
699    ) -> gax::client_builder::Result<impl super::stub::ApiHubDependencies> {
700        Self::build_transport(conf)
701            .await
702            .map(super::tracing::ApiHubDependencies::new)
703    }
704
705    /// Create a dependency between two entities in the API hub.
706    pub fn create_dependency(&self) -> super::builder::api_hub_dependencies::CreateDependency {
707        super::builder::api_hub_dependencies::CreateDependency::new(self.inner.clone())
708    }
709
710    /// Get details about a dependency resource in the API hub.
711    pub fn get_dependency(&self) -> super::builder::api_hub_dependencies::GetDependency {
712        super::builder::api_hub_dependencies::GetDependency::new(self.inner.clone())
713    }
714
715    /// Update a dependency based on the
716    /// [update_mask][google.cloud.apihub.v1.UpdateDependencyRequest.update_mask]
717    /// provided in the request.
718    ///
719    /// The following fields in the [dependency][google.cloud.apihub.v1.Dependency]
720    /// can be updated:
721    ///
722    /// * [description][google.cloud.apihub.v1.Dependency.description]
723    ///
724    /// [google.cloud.apihub.v1.Dependency]: crate::model::Dependency
725    /// [google.cloud.apihub.v1.Dependency.description]: crate::model::Dependency::description
726    /// [google.cloud.apihub.v1.UpdateDependencyRequest.update_mask]: crate::model::UpdateDependencyRequest::update_mask
727    pub fn update_dependency(&self) -> super::builder::api_hub_dependencies::UpdateDependency {
728        super::builder::api_hub_dependencies::UpdateDependency::new(self.inner.clone())
729    }
730
731    /// Delete the dependency resource.
732    pub fn delete_dependency(&self) -> super::builder::api_hub_dependencies::DeleteDependency {
733        super::builder::api_hub_dependencies::DeleteDependency::new(self.inner.clone())
734    }
735
736    /// List dependencies based on the provided filter and pagination parameters.
737    pub fn list_dependencies(&self) -> super::builder::api_hub_dependencies::ListDependencies {
738        super::builder::api_hub_dependencies::ListDependencies::new(self.inner.clone())
739    }
740
741    /// Lists information about the supported locations for this service.
742    pub fn list_locations(&self) -> super::builder::api_hub_dependencies::ListLocations {
743        super::builder::api_hub_dependencies::ListLocations::new(self.inner.clone())
744    }
745
746    /// Gets information about a location.
747    pub fn get_location(&self) -> super::builder::api_hub_dependencies::GetLocation {
748        super::builder::api_hub_dependencies::GetLocation::new(self.inner.clone())
749    }
750
751    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
752    ///
753    /// [google.longrunning.Operations]: longrunning::client::Operations
754    pub fn list_operations(&self) -> super::builder::api_hub_dependencies::ListOperations {
755        super::builder::api_hub_dependencies::ListOperations::new(self.inner.clone())
756    }
757
758    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
759    ///
760    /// [google.longrunning.Operations]: longrunning::client::Operations
761    pub fn get_operation(&self) -> super::builder::api_hub_dependencies::GetOperation {
762        super::builder::api_hub_dependencies::GetOperation::new(self.inner.clone())
763    }
764
765    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
766    ///
767    /// [google.longrunning.Operations]: longrunning::client::Operations
768    pub fn delete_operation(&self) -> super::builder::api_hub_dependencies::DeleteOperation {
769        super::builder::api_hub_dependencies::DeleteOperation::new(self.inner.clone())
770    }
771
772    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
773    ///
774    /// [google.longrunning.Operations]: longrunning::client::Operations
775    pub fn cancel_operation(&self) -> super::builder::api_hub_dependencies::CancelOperation {
776        super::builder::api_hub_dependencies::CancelOperation::new(self.inner.clone())
777    }
778}
779
780/// Implements a client for the API hub API.
781///
782/// # Example
783/// ```
784/// # tokio_test::block_on(async {
785/// # use google_cloud_apihub_v1::client::ApiHubCollect;
786/// let client = ApiHubCollect::builder().build().await?;
787/// // use `client` to make requests to the API hub API.
788/// # gax::client_builder::Result::<()>::Ok(()) });
789/// ```
790///
791/// # Service Description
792///
793/// This service exposes methods used for collecting various types of data from
794/// different first party and third party sources and push it to Hub's collect
795/// layer.
796///
797/// # Configuration
798///
799/// To configure `ApiHubCollect` use the `with_*` methods in the type returned
800/// by [builder()][ApiHubCollect::builder]. The default configuration should
801/// work for most applications. Common configuration changes include
802///
803/// * [with_endpoint()]: by default this client uses the global default endpoint
804///   (`https://apihub.googleapis.com`). Applications using regional
805///   endpoints or running in restricted networks (e.g. a network configured
806//    with [Private Google Access with VPC Service Controls]) may want to
807///   override this default.
808/// * [with_credentials()]: by default this client uses
809///   [Application Default Credentials]. Applications using custom
810///   authentication may need to override this default.
811///
812/// [with_endpoint()]: super::builder::api_hub_collect::ClientBuilder::with_endpoint
813/// [with_credentials()]: super::builder::api_hub_collect::ClientBuilder::credentials
814/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
815/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
816///
817/// # Pooling and Cloning
818///
819/// `ApiHubCollect` holds a connection pool internally, it is advised to
820/// create one and the reuse it.  You do not need to wrap `ApiHubCollect` in
821/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
822/// already uses an `Arc` internally.
823#[derive(Clone, Debug)]
824pub struct ApiHubCollect {
825    inner: std::sync::Arc<dyn super::stub::dynamic::ApiHubCollect>,
826}
827
828impl ApiHubCollect {
829    /// Returns a builder for [ApiHubCollect].
830    ///
831    /// ```
832    /// # tokio_test::block_on(async {
833    /// # use google_cloud_apihub_v1::client::ApiHubCollect;
834    /// let client = ApiHubCollect::builder().build().await?;
835    /// # gax::client_builder::Result::<()>::Ok(()) });
836    /// ```
837    pub fn builder() -> super::builder::api_hub_collect::ClientBuilder {
838        gax::client_builder::internal::new_builder(super::builder::api_hub_collect::client::Factory)
839    }
840
841    /// Creates a new client from the provided stub.
842    ///
843    /// The most common case for calling this function is in tests mocking the
844    /// client's behavior.
845    pub fn from_stub<T>(stub: T) -> Self
846    where
847        T: super::stub::ApiHubCollect + 'static,
848    {
849        Self {
850            inner: std::sync::Arc::new(stub),
851        }
852    }
853
854    pub(crate) async fn new(
855        config: gaxi::options::ClientConfig,
856    ) -> gax::client_builder::Result<Self> {
857        let inner = Self::build_inner(config).await?;
858        Ok(Self { inner })
859    }
860
861    async fn build_inner(
862        conf: gaxi::options::ClientConfig,
863    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ApiHubCollect>> {
864        if gaxi::options::tracing_enabled(&conf) {
865            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
866        }
867        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
868    }
869
870    async fn build_transport(
871        conf: gaxi::options::ClientConfig,
872    ) -> gax::client_builder::Result<impl super::stub::ApiHubCollect> {
873        super::transport::ApiHubCollect::new(conf).await
874    }
875
876    async fn build_with_tracing(
877        conf: gaxi::options::ClientConfig,
878    ) -> gax::client_builder::Result<impl super::stub::ApiHubCollect> {
879        Self::build_transport(conf)
880            .await
881            .map(super::tracing::ApiHubCollect::new)
882    }
883
884    /// Collect API data from a source and push it to Hub's collect layer.
885    ///
886    /// # Long running operations
887    ///
888    /// This method is used to start, and/or poll a [long-running Operation].
889    /// The [Working with long-running operations] chapter in the [user guide]
890    /// covers these operations in detail.
891    ///
892    /// [long-running operation]: https://google.aip.dev/151
893    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
894    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
895    pub fn collect_api_data(&self) -> super::builder::api_hub_collect::CollectApiData {
896        super::builder::api_hub_collect::CollectApiData::new(self.inner.clone())
897    }
898
899    /// Lists information about the supported locations for this service.
900    pub fn list_locations(&self) -> super::builder::api_hub_collect::ListLocations {
901        super::builder::api_hub_collect::ListLocations::new(self.inner.clone())
902    }
903
904    /// Gets information about a location.
905    pub fn get_location(&self) -> super::builder::api_hub_collect::GetLocation {
906        super::builder::api_hub_collect::GetLocation::new(self.inner.clone())
907    }
908
909    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
910    ///
911    /// [google.longrunning.Operations]: longrunning::client::Operations
912    pub fn list_operations(&self) -> super::builder::api_hub_collect::ListOperations {
913        super::builder::api_hub_collect::ListOperations::new(self.inner.clone())
914    }
915
916    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
917    ///
918    /// [google.longrunning.Operations]: longrunning::client::Operations
919    pub fn get_operation(&self) -> super::builder::api_hub_collect::GetOperation {
920        super::builder::api_hub_collect::GetOperation::new(self.inner.clone())
921    }
922
923    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
924    ///
925    /// [google.longrunning.Operations]: longrunning::client::Operations
926    pub fn delete_operation(&self) -> super::builder::api_hub_collect::DeleteOperation {
927        super::builder::api_hub_collect::DeleteOperation::new(self.inner.clone())
928    }
929
930    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
931    ///
932    /// [google.longrunning.Operations]: longrunning::client::Operations
933    pub fn cancel_operation(&self) -> super::builder::api_hub_collect::CancelOperation {
934        super::builder::api_hub_collect::CancelOperation::new(self.inner.clone())
935    }
936}
937
938/// Implements a client for the API hub API.
939///
940/// # Example
941/// ```
942/// # tokio_test::block_on(async {
943/// # use google_cloud_apihub_v1::client::ApiHubCurate;
944/// let client = ApiHubCurate::builder().build().await?;
945/// // use `client` to make requests to the API hub API.
946/// # gax::client_builder::Result::<()>::Ok(()) });
947/// ```
948///
949/// # Service Description
950///
951/// This service is used for managing curations for processing API data consumed
952/// from collect layer.
953///
954/// # Configuration
955///
956/// To configure `ApiHubCurate` use the `with_*` methods in the type returned
957/// by [builder()][ApiHubCurate::builder]. The default configuration should
958/// work for most applications. Common configuration changes include
959///
960/// * [with_endpoint()]: by default this client uses the global default endpoint
961///   (`https://apihub.googleapis.com`). Applications using regional
962///   endpoints or running in restricted networks (e.g. a network configured
963//    with [Private Google Access with VPC Service Controls]) may want to
964///   override this default.
965/// * [with_credentials()]: by default this client uses
966///   [Application Default Credentials]. Applications using custom
967///   authentication may need to override this default.
968///
969/// [with_endpoint()]: super::builder::api_hub_curate::ClientBuilder::with_endpoint
970/// [with_credentials()]: super::builder::api_hub_curate::ClientBuilder::credentials
971/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
972/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
973///
974/// # Pooling and Cloning
975///
976/// `ApiHubCurate` holds a connection pool internally, it is advised to
977/// create one and the reuse it.  You do not need to wrap `ApiHubCurate` in
978/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
979/// already uses an `Arc` internally.
980#[derive(Clone, Debug)]
981pub struct ApiHubCurate {
982    inner: std::sync::Arc<dyn super::stub::dynamic::ApiHubCurate>,
983}
984
985impl ApiHubCurate {
986    /// Returns a builder for [ApiHubCurate].
987    ///
988    /// ```
989    /// # tokio_test::block_on(async {
990    /// # use google_cloud_apihub_v1::client::ApiHubCurate;
991    /// let client = ApiHubCurate::builder().build().await?;
992    /// # gax::client_builder::Result::<()>::Ok(()) });
993    /// ```
994    pub fn builder() -> super::builder::api_hub_curate::ClientBuilder {
995        gax::client_builder::internal::new_builder(super::builder::api_hub_curate::client::Factory)
996    }
997
998    /// Creates a new client from the provided stub.
999    ///
1000    /// The most common case for calling this function is in tests mocking the
1001    /// client's behavior.
1002    pub fn from_stub<T>(stub: T) -> Self
1003    where
1004        T: super::stub::ApiHubCurate + 'static,
1005    {
1006        Self {
1007            inner: std::sync::Arc::new(stub),
1008        }
1009    }
1010
1011    pub(crate) async fn new(
1012        config: gaxi::options::ClientConfig,
1013    ) -> gax::client_builder::Result<Self> {
1014        let inner = Self::build_inner(config).await?;
1015        Ok(Self { inner })
1016    }
1017
1018    async fn build_inner(
1019        conf: gaxi::options::ClientConfig,
1020    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ApiHubCurate>> {
1021        if gaxi::options::tracing_enabled(&conf) {
1022            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1023        }
1024        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1025    }
1026
1027    async fn build_transport(
1028        conf: gaxi::options::ClientConfig,
1029    ) -> gax::client_builder::Result<impl super::stub::ApiHubCurate> {
1030        super::transport::ApiHubCurate::new(conf).await
1031    }
1032
1033    async fn build_with_tracing(
1034        conf: gaxi::options::ClientConfig,
1035    ) -> gax::client_builder::Result<impl super::stub::ApiHubCurate> {
1036        Self::build_transport(conf)
1037            .await
1038            .map(super::tracing::ApiHubCurate::new)
1039    }
1040
1041    /// Create a curation resource in the API hub.
1042    /// Once a curation resource is created, plugin instances can start using it.
1043    pub fn create_curation(&self) -> super::builder::api_hub_curate::CreateCuration {
1044        super::builder::api_hub_curate::CreateCuration::new(self.inner.clone())
1045    }
1046
1047    /// Get curation resource details.
1048    pub fn get_curation(&self) -> super::builder::api_hub_curate::GetCuration {
1049        super::builder::api_hub_curate::GetCuration::new(self.inner.clone())
1050    }
1051
1052    /// List curation resources in the API hub.
1053    pub fn list_curations(&self) -> super::builder::api_hub_curate::ListCurations {
1054        super::builder::api_hub_curate::ListCurations::new(self.inner.clone())
1055    }
1056
1057    /// Update a curation resource in the API hub. The following fields in the
1058    /// [curation][google.cloud.apihub.v1.Curation] can be updated:
1059    ///
1060    /// * [display_name][google.cloud.apihub.v1.Curation.display_name]
1061    /// * [description][google.cloud.apihub.v1.Curation.description]
1062    ///
1063    /// The
1064    /// [update_mask][google.cloud.apihub.v1.UpdateApiRequest.update_mask]
1065    /// should be used to specify the fields being updated.
1066    ///
1067    /// [google.cloud.apihub.v1.Curation]: crate::model::Curation
1068    /// [google.cloud.apihub.v1.Curation.description]: crate::model::Curation::description
1069    /// [google.cloud.apihub.v1.Curation.display_name]: crate::model::Curation::display_name
1070    /// [google.cloud.apihub.v1.UpdateApiRequest.update_mask]: crate::model::UpdateApiRequest::update_mask
1071    pub fn update_curation(&self) -> super::builder::api_hub_curate::UpdateCuration {
1072        super::builder::api_hub_curate::UpdateCuration::new(self.inner.clone())
1073    }
1074
1075    /// Delete a curation resource in the API hub. A curation can only be deleted
1076    /// if it's not being used by any plugin instance.
1077    pub fn delete_curation(&self) -> super::builder::api_hub_curate::DeleteCuration {
1078        super::builder::api_hub_curate::DeleteCuration::new(self.inner.clone())
1079    }
1080
1081    /// Lists information about the supported locations for this service.
1082    pub fn list_locations(&self) -> super::builder::api_hub_curate::ListLocations {
1083        super::builder::api_hub_curate::ListLocations::new(self.inner.clone())
1084    }
1085
1086    /// Gets information about a location.
1087    pub fn get_location(&self) -> super::builder::api_hub_curate::GetLocation {
1088        super::builder::api_hub_curate::GetLocation::new(self.inner.clone())
1089    }
1090
1091    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1092    ///
1093    /// [google.longrunning.Operations]: longrunning::client::Operations
1094    pub fn list_operations(&self) -> super::builder::api_hub_curate::ListOperations {
1095        super::builder::api_hub_curate::ListOperations::new(self.inner.clone())
1096    }
1097
1098    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1099    ///
1100    /// [google.longrunning.Operations]: longrunning::client::Operations
1101    pub fn get_operation(&self) -> super::builder::api_hub_curate::GetOperation {
1102        super::builder::api_hub_curate::GetOperation::new(self.inner.clone())
1103    }
1104
1105    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1106    ///
1107    /// [google.longrunning.Operations]: longrunning::client::Operations
1108    pub fn delete_operation(&self) -> super::builder::api_hub_curate::DeleteOperation {
1109        super::builder::api_hub_curate::DeleteOperation::new(self.inner.clone())
1110    }
1111
1112    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1113    ///
1114    /// [google.longrunning.Operations]: longrunning::client::Operations
1115    pub fn cancel_operation(&self) -> super::builder::api_hub_curate::CancelOperation {
1116        super::builder::api_hub_curate::CancelOperation::new(self.inner.clone())
1117    }
1118}
1119
1120/// Implements a client for the API hub API.
1121///
1122/// # Example
1123/// ```
1124/// # tokio_test::block_on(async {
1125/// # use google_cloud_apihub_v1::client::ApiHubDiscovery;
1126/// let client = ApiHubDiscovery::builder().build().await?;
1127/// // use `client` to make requests to the API hub API.
1128/// # gax::client_builder::Result::<()>::Ok(()) });
1129/// ```
1130///
1131/// # Service Description
1132///
1133/// This service exposes methods used to manage DiscoveredApiObservations
1134/// and DiscoveredApiOperations.
1135///
1136/// # Configuration
1137///
1138/// To configure `ApiHubDiscovery` use the `with_*` methods in the type returned
1139/// by [builder()][ApiHubDiscovery::builder]. The default configuration should
1140/// work for most applications. Common configuration changes include
1141///
1142/// * [with_endpoint()]: by default this client uses the global default endpoint
1143///   (`https://apihub.googleapis.com`). Applications using regional
1144///   endpoints or running in restricted networks (e.g. a network configured
1145//    with [Private Google Access with VPC Service Controls]) may want to
1146///   override this default.
1147/// * [with_credentials()]: by default this client uses
1148///   [Application Default Credentials]. Applications using custom
1149///   authentication may need to override this default.
1150///
1151/// [with_endpoint()]: super::builder::api_hub_discovery::ClientBuilder::with_endpoint
1152/// [with_credentials()]: super::builder::api_hub_discovery::ClientBuilder::credentials
1153/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1154/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1155///
1156/// # Pooling and Cloning
1157///
1158/// `ApiHubDiscovery` holds a connection pool internally, it is advised to
1159/// create one and the reuse it.  You do not need to wrap `ApiHubDiscovery` in
1160/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1161/// already uses an `Arc` internally.
1162#[derive(Clone, Debug)]
1163pub struct ApiHubDiscovery {
1164    inner: std::sync::Arc<dyn super::stub::dynamic::ApiHubDiscovery>,
1165}
1166
1167impl ApiHubDiscovery {
1168    /// Returns a builder for [ApiHubDiscovery].
1169    ///
1170    /// ```
1171    /// # tokio_test::block_on(async {
1172    /// # use google_cloud_apihub_v1::client::ApiHubDiscovery;
1173    /// let client = ApiHubDiscovery::builder().build().await?;
1174    /// # gax::client_builder::Result::<()>::Ok(()) });
1175    /// ```
1176    pub fn builder() -> super::builder::api_hub_discovery::ClientBuilder {
1177        gax::client_builder::internal::new_builder(
1178            super::builder::api_hub_discovery::client::Factory,
1179        )
1180    }
1181
1182    /// Creates a new client from the provided stub.
1183    ///
1184    /// The most common case for calling this function is in tests mocking the
1185    /// client's behavior.
1186    pub fn from_stub<T>(stub: T) -> Self
1187    where
1188        T: super::stub::ApiHubDiscovery + 'static,
1189    {
1190        Self {
1191            inner: std::sync::Arc::new(stub),
1192        }
1193    }
1194
1195    pub(crate) async fn new(
1196        config: gaxi::options::ClientConfig,
1197    ) -> gax::client_builder::Result<Self> {
1198        let inner = Self::build_inner(config).await?;
1199        Ok(Self { inner })
1200    }
1201
1202    async fn build_inner(
1203        conf: gaxi::options::ClientConfig,
1204    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ApiHubDiscovery>>
1205    {
1206        if gaxi::options::tracing_enabled(&conf) {
1207            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1208        }
1209        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1210    }
1211
1212    async fn build_transport(
1213        conf: gaxi::options::ClientConfig,
1214    ) -> gax::client_builder::Result<impl super::stub::ApiHubDiscovery> {
1215        super::transport::ApiHubDiscovery::new(conf).await
1216    }
1217
1218    async fn build_with_tracing(
1219        conf: gaxi::options::ClientConfig,
1220    ) -> gax::client_builder::Result<impl super::stub::ApiHubDiscovery> {
1221        Self::build_transport(conf)
1222            .await
1223            .map(super::tracing::ApiHubDiscovery::new)
1224    }
1225
1226    /// Lists all the DiscoveredAPIObservations in a given project and location.
1227    pub fn list_discovered_api_observations(
1228        &self,
1229    ) -> super::builder::api_hub_discovery::ListDiscoveredApiObservations {
1230        super::builder::api_hub_discovery::ListDiscoveredApiObservations::new(self.inner.clone())
1231    }
1232
1233    /// Gets a DiscoveredAPIObservation in a given project, location and
1234    /// ApiObservation.
1235    pub fn get_discovered_api_observation(
1236        &self,
1237    ) -> super::builder::api_hub_discovery::GetDiscoveredApiObservation {
1238        super::builder::api_hub_discovery::GetDiscoveredApiObservation::new(self.inner.clone())
1239    }
1240
1241    /// Lists all the DiscoveredAPIOperations in a given project, location and
1242    /// ApiObservation.
1243    pub fn list_discovered_api_operations(
1244        &self,
1245    ) -> super::builder::api_hub_discovery::ListDiscoveredApiOperations {
1246        super::builder::api_hub_discovery::ListDiscoveredApiOperations::new(self.inner.clone())
1247    }
1248
1249    /// Gets a DiscoveredAPIOperation in a given project, location,
1250    /// ApiObservation and ApiOperation.
1251    pub fn get_discovered_api_operation(
1252        &self,
1253    ) -> super::builder::api_hub_discovery::GetDiscoveredApiOperation {
1254        super::builder::api_hub_discovery::GetDiscoveredApiOperation::new(self.inner.clone())
1255    }
1256
1257    /// Lists information about the supported locations for this service.
1258    pub fn list_locations(&self) -> super::builder::api_hub_discovery::ListLocations {
1259        super::builder::api_hub_discovery::ListLocations::new(self.inner.clone())
1260    }
1261
1262    /// Gets information about a location.
1263    pub fn get_location(&self) -> super::builder::api_hub_discovery::GetLocation {
1264        super::builder::api_hub_discovery::GetLocation::new(self.inner.clone())
1265    }
1266
1267    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1268    ///
1269    /// [google.longrunning.Operations]: longrunning::client::Operations
1270    pub fn list_operations(&self) -> super::builder::api_hub_discovery::ListOperations {
1271        super::builder::api_hub_discovery::ListOperations::new(self.inner.clone())
1272    }
1273
1274    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1275    ///
1276    /// [google.longrunning.Operations]: longrunning::client::Operations
1277    pub fn get_operation(&self) -> super::builder::api_hub_discovery::GetOperation {
1278        super::builder::api_hub_discovery::GetOperation::new(self.inner.clone())
1279    }
1280
1281    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1282    ///
1283    /// [google.longrunning.Operations]: longrunning::client::Operations
1284    pub fn delete_operation(&self) -> super::builder::api_hub_discovery::DeleteOperation {
1285        super::builder::api_hub_discovery::DeleteOperation::new(self.inner.clone())
1286    }
1287
1288    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1289    ///
1290    /// [google.longrunning.Operations]: longrunning::client::Operations
1291    pub fn cancel_operation(&self) -> super::builder::api_hub_discovery::CancelOperation {
1292        super::builder::api_hub_discovery::CancelOperation::new(self.inner.clone())
1293    }
1294}
1295
1296/// Implements a client for the API hub API.
1297///
1298/// # Example
1299/// ```
1300/// # tokio_test::block_on(async {
1301/// # use google_cloud_apihub_v1::client::HostProjectRegistrationService;
1302/// let client = HostProjectRegistrationService::builder().build().await?;
1303/// // use `client` to make requests to the API hub API.
1304/// # gax::client_builder::Result::<()>::Ok(()) });
1305/// ```
1306///
1307/// # Service Description
1308///
1309/// This service is used for managing the host project registrations.
1310///
1311/// # Configuration
1312///
1313/// To configure `HostProjectRegistrationService` use the `with_*` methods in the type returned
1314/// by [builder()][HostProjectRegistrationService::builder]. The default configuration should
1315/// work for most applications. Common configuration changes include
1316///
1317/// * [with_endpoint()]: by default this client uses the global default endpoint
1318///   (`https://apihub.googleapis.com`). Applications using regional
1319///   endpoints or running in restricted networks (e.g. a network configured
1320//    with [Private Google Access with VPC Service Controls]) may want to
1321///   override this default.
1322/// * [with_credentials()]: by default this client uses
1323///   [Application Default Credentials]. Applications using custom
1324///   authentication may need to override this default.
1325///
1326/// [with_endpoint()]: super::builder::host_project_registration_service::ClientBuilder::with_endpoint
1327/// [with_credentials()]: super::builder::host_project_registration_service::ClientBuilder::credentials
1328/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1329/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1330///
1331/// # Pooling and Cloning
1332///
1333/// `HostProjectRegistrationService` holds a connection pool internally, it is advised to
1334/// create one and the reuse it.  You do not need to wrap `HostProjectRegistrationService` in
1335/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1336/// already uses an `Arc` internally.
1337#[derive(Clone, Debug)]
1338pub struct HostProjectRegistrationService {
1339    inner: std::sync::Arc<dyn super::stub::dynamic::HostProjectRegistrationService>,
1340}
1341
1342impl HostProjectRegistrationService {
1343    /// Returns a builder for [HostProjectRegistrationService].
1344    ///
1345    /// ```
1346    /// # tokio_test::block_on(async {
1347    /// # use google_cloud_apihub_v1::client::HostProjectRegistrationService;
1348    /// let client = HostProjectRegistrationService::builder().build().await?;
1349    /// # gax::client_builder::Result::<()>::Ok(()) });
1350    /// ```
1351    pub fn builder() -> super::builder::host_project_registration_service::ClientBuilder {
1352        gax::client_builder::internal::new_builder(
1353            super::builder::host_project_registration_service::client::Factory,
1354        )
1355    }
1356
1357    /// Creates a new client from the provided stub.
1358    ///
1359    /// The most common case for calling this function is in tests mocking the
1360    /// client's behavior.
1361    pub fn from_stub<T>(stub: T) -> Self
1362    where
1363        T: super::stub::HostProjectRegistrationService + 'static,
1364    {
1365        Self {
1366            inner: std::sync::Arc::new(stub),
1367        }
1368    }
1369
1370    pub(crate) async fn new(
1371        config: gaxi::options::ClientConfig,
1372    ) -> gax::client_builder::Result<Self> {
1373        let inner = Self::build_inner(config).await?;
1374        Ok(Self { inner })
1375    }
1376
1377    async fn build_inner(
1378        conf: gaxi::options::ClientConfig,
1379    ) -> gax::client_builder::Result<
1380        std::sync::Arc<dyn super::stub::dynamic::HostProjectRegistrationService>,
1381    > {
1382        if gaxi::options::tracing_enabled(&conf) {
1383            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1384        }
1385        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1386    }
1387
1388    async fn build_transport(
1389        conf: gaxi::options::ClientConfig,
1390    ) -> gax::client_builder::Result<impl super::stub::HostProjectRegistrationService> {
1391        super::transport::HostProjectRegistrationService::new(conf).await
1392    }
1393
1394    async fn build_with_tracing(
1395        conf: gaxi::options::ClientConfig,
1396    ) -> gax::client_builder::Result<impl super::stub::HostProjectRegistrationService> {
1397        Self::build_transport(conf)
1398            .await
1399            .map(super::tracing::HostProjectRegistrationService::new)
1400    }
1401
1402    /// Create a host project registration.
1403    /// A Google cloud project can be registered as a host project if it is not
1404    /// attached as a runtime project to another host project.
1405    /// A project can be registered as a host project only once. Subsequent
1406    /// register calls for the same project will fail.
1407    pub fn create_host_project_registration(
1408        &self,
1409    ) -> super::builder::host_project_registration_service::CreateHostProjectRegistration {
1410        super::builder::host_project_registration_service::CreateHostProjectRegistration::new(
1411            self.inner.clone(),
1412        )
1413    }
1414
1415    /// Get a host project registration.
1416    pub fn get_host_project_registration(
1417        &self,
1418    ) -> super::builder::host_project_registration_service::GetHostProjectRegistration {
1419        super::builder::host_project_registration_service::GetHostProjectRegistration::new(
1420            self.inner.clone(),
1421        )
1422    }
1423
1424    /// Lists host project registrations.
1425    pub fn list_host_project_registrations(
1426        &self,
1427    ) -> super::builder::host_project_registration_service::ListHostProjectRegistrations {
1428        super::builder::host_project_registration_service::ListHostProjectRegistrations::new(
1429            self.inner.clone(),
1430        )
1431    }
1432
1433    /// Lists information about the supported locations for this service.
1434    pub fn list_locations(
1435        &self,
1436    ) -> super::builder::host_project_registration_service::ListLocations {
1437        super::builder::host_project_registration_service::ListLocations::new(self.inner.clone())
1438    }
1439
1440    /// Gets information about a location.
1441    pub fn get_location(&self) -> super::builder::host_project_registration_service::GetLocation {
1442        super::builder::host_project_registration_service::GetLocation::new(self.inner.clone())
1443    }
1444
1445    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1446    ///
1447    /// [google.longrunning.Operations]: longrunning::client::Operations
1448    pub fn list_operations(
1449        &self,
1450    ) -> super::builder::host_project_registration_service::ListOperations {
1451        super::builder::host_project_registration_service::ListOperations::new(self.inner.clone())
1452    }
1453
1454    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1455    ///
1456    /// [google.longrunning.Operations]: longrunning::client::Operations
1457    pub fn get_operation(&self) -> super::builder::host_project_registration_service::GetOperation {
1458        super::builder::host_project_registration_service::GetOperation::new(self.inner.clone())
1459    }
1460
1461    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1462    ///
1463    /// [google.longrunning.Operations]: longrunning::client::Operations
1464    pub fn delete_operation(
1465        &self,
1466    ) -> super::builder::host_project_registration_service::DeleteOperation {
1467        super::builder::host_project_registration_service::DeleteOperation::new(self.inner.clone())
1468    }
1469
1470    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1471    ///
1472    /// [google.longrunning.Operations]: longrunning::client::Operations
1473    pub fn cancel_operation(
1474        &self,
1475    ) -> super::builder::host_project_registration_service::CancelOperation {
1476        super::builder::host_project_registration_service::CancelOperation::new(self.inner.clone())
1477    }
1478}
1479
1480/// Implements a client for the API hub API.
1481///
1482/// # Example
1483/// ```
1484/// # tokio_test::block_on(async {
1485/// # use google_cloud_apihub_v1::client::LintingService;
1486/// let client = LintingService::builder().build().await?;
1487/// // use `client` to make requests to the API hub API.
1488/// # gax::client_builder::Result::<()>::Ok(()) });
1489/// ```
1490///
1491/// # Service Description
1492///
1493/// This service provides all methods related to the 1p Linter.
1494///
1495/// # Configuration
1496///
1497/// To configure `LintingService` use the `with_*` methods in the type returned
1498/// by [builder()][LintingService::builder]. The default configuration should
1499/// work for most applications. Common configuration changes include
1500///
1501/// * [with_endpoint()]: by default this client uses the global default endpoint
1502///   (`https://apihub.googleapis.com`). Applications using regional
1503///   endpoints or running in restricted networks (e.g. a network configured
1504//    with [Private Google Access with VPC Service Controls]) may want to
1505///   override this default.
1506/// * [with_credentials()]: by default this client uses
1507///   [Application Default Credentials]. Applications using custom
1508///   authentication may need to override this default.
1509///
1510/// [with_endpoint()]: super::builder::linting_service::ClientBuilder::with_endpoint
1511/// [with_credentials()]: super::builder::linting_service::ClientBuilder::credentials
1512/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1513/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1514///
1515/// # Pooling and Cloning
1516///
1517/// `LintingService` holds a connection pool internally, it is advised to
1518/// create one and the reuse it.  You do not need to wrap `LintingService` in
1519/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1520/// already uses an `Arc` internally.
1521#[derive(Clone, Debug)]
1522pub struct LintingService {
1523    inner: std::sync::Arc<dyn super::stub::dynamic::LintingService>,
1524}
1525
1526impl LintingService {
1527    /// Returns a builder for [LintingService].
1528    ///
1529    /// ```
1530    /// # tokio_test::block_on(async {
1531    /// # use google_cloud_apihub_v1::client::LintingService;
1532    /// let client = LintingService::builder().build().await?;
1533    /// # gax::client_builder::Result::<()>::Ok(()) });
1534    /// ```
1535    pub fn builder() -> super::builder::linting_service::ClientBuilder {
1536        gax::client_builder::internal::new_builder(super::builder::linting_service::client::Factory)
1537    }
1538
1539    /// Creates a new client from the provided stub.
1540    ///
1541    /// The most common case for calling this function is in tests mocking the
1542    /// client's behavior.
1543    pub fn from_stub<T>(stub: T) -> Self
1544    where
1545        T: super::stub::LintingService + 'static,
1546    {
1547        Self {
1548            inner: std::sync::Arc::new(stub),
1549        }
1550    }
1551
1552    pub(crate) async fn new(
1553        config: gaxi::options::ClientConfig,
1554    ) -> gax::client_builder::Result<Self> {
1555        let inner = Self::build_inner(config).await?;
1556        Ok(Self { inner })
1557    }
1558
1559    async fn build_inner(
1560        conf: gaxi::options::ClientConfig,
1561    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::LintingService>> {
1562        if gaxi::options::tracing_enabled(&conf) {
1563            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1564        }
1565        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1566    }
1567
1568    async fn build_transport(
1569        conf: gaxi::options::ClientConfig,
1570    ) -> gax::client_builder::Result<impl super::stub::LintingService> {
1571        super::transport::LintingService::new(conf).await
1572    }
1573
1574    async fn build_with_tracing(
1575        conf: gaxi::options::ClientConfig,
1576    ) -> gax::client_builder::Result<impl super::stub::LintingService> {
1577        Self::build_transport(conf)
1578            .await
1579            .map(super::tracing::LintingService::new)
1580    }
1581
1582    /// Get the style guide being used for linting.
1583    pub fn get_style_guide(&self) -> super::builder::linting_service::GetStyleGuide {
1584        super::builder::linting_service::GetStyleGuide::new(self.inner.clone())
1585    }
1586
1587    /// Update the styleGuide to be used for liniting in by API hub.
1588    pub fn update_style_guide(&self) -> super::builder::linting_service::UpdateStyleGuide {
1589        super::builder::linting_service::UpdateStyleGuide::new(self.inner.clone())
1590    }
1591
1592    /// Get the contents of the style guide.
1593    pub fn get_style_guide_contents(
1594        &self,
1595    ) -> super::builder::linting_service::GetStyleGuideContents {
1596        super::builder::linting_service::GetStyleGuideContents::new(self.inner.clone())
1597    }
1598
1599    /// Lints the requested spec and updates the corresponding API Spec with the
1600    /// lint response. This lint response will be available in all subsequent
1601    /// Get and List Spec calls to Core service.
1602    pub fn lint_spec(&self) -> super::builder::linting_service::LintSpec {
1603        super::builder::linting_service::LintSpec::new(self.inner.clone())
1604    }
1605
1606    /// Lists information about the supported locations for this service.
1607    pub fn list_locations(&self) -> super::builder::linting_service::ListLocations {
1608        super::builder::linting_service::ListLocations::new(self.inner.clone())
1609    }
1610
1611    /// Gets information about a location.
1612    pub fn get_location(&self) -> super::builder::linting_service::GetLocation {
1613        super::builder::linting_service::GetLocation::new(self.inner.clone())
1614    }
1615
1616    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1617    ///
1618    /// [google.longrunning.Operations]: longrunning::client::Operations
1619    pub fn list_operations(&self) -> super::builder::linting_service::ListOperations {
1620        super::builder::linting_service::ListOperations::new(self.inner.clone())
1621    }
1622
1623    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1624    ///
1625    /// [google.longrunning.Operations]: longrunning::client::Operations
1626    pub fn get_operation(&self) -> super::builder::linting_service::GetOperation {
1627        super::builder::linting_service::GetOperation::new(self.inner.clone())
1628    }
1629
1630    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1631    ///
1632    /// [google.longrunning.Operations]: longrunning::client::Operations
1633    pub fn delete_operation(&self) -> super::builder::linting_service::DeleteOperation {
1634        super::builder::linting_service::DeleteOperation::new(self.inner.clone())
1635    }
1636
1637    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1638    ///
1639    /// [google.longrunning.Operations]: longrunning::client::Operations
1640    pub fn cancel_operation(&self) -> super::builder::linting_service::CancelOperation {
1641        super::builder::linting_service::CancelOperation::new(self.inner.clone())
1642    }
1643}
1644
1645/// Implements a client for the API hub API.
1646///
1647/// # Example
1648/// ```
1649/// # tokio_test::block_on(async {
1650/// # use google_cloud_apihub_v1::client::ApiHubPlugin;
1651/// let client = ApiHubPlugin::builder().build().await?;
1652/// // use `client` to make requests to the API hub API.
1653/// # gax::client_builder::Result::<()>::Ok(()) });
1654/// ```
1655///
1656/// # Service Description
1657///
1658/// This service is used for managing plugins inside the API Hub.
1659///
1660/// # Configuration
1661///
1662/// To configure `ApiHubPlugin` use the `with_*` methods in the type returned
1663/// by [builder()][ApiHubPlugin::builder]. The default configuration should
1664/// work for most applications. Common configuration changes include
1665///
1666/// * [with_endpoint()]: by default this client uses the global default endpoint
1667///   (`https://apihub.googleapis.com`). Applications using regional
1668///   endpoints or running in restricted networks (e.g. a network configured
1669//    with [Private Google Access with VPC Service Controls]) may want to
1670///   override this default.
1671/// * [with_credentials()]: by default this client uses
1672///   [Application Default Credentials]. Applications using custom
1673///   authentication may need to override this default.
1674///
1675/// [with_endpoint()]: super::builder::api_hub_plugin::ClientBuilder::with_endpoint
1676/// [with_credentials()]: super::builder::api_hub_plugin::ClientBuilder::credentials
1677/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1678/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1679///
1680/// # Pooling and Cloning
1681///
1682/// `ApiHubPlugin` holds a connection pool internally, it is advised to
1683/// create one and the reuse it.  You do not need to wrap `ApiHubPlugin` in
1684/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1685/// already uses an `Arc` internally.
1686#[derive(Clone, Debug)]
1687pub struct ApiHubPlugin {
1688    inner: std::sync::Arc<dyn super::stub::dynamic::ApiHubPlugin>,
1689}
1690
1691impl ApiHubPlugin {
1692    /// Returns a builder for [ApiHubPlugin].
1693    ///
1694    /// ```
1695    /// # tokio_test::block_on(async {
1696    /// # use google_cloud_apihub_v1::client::ApiHubPlugin;
1697    /// let client = ApiHubPlugin::builder().build().await?;
1698    /// # gax::client_builder::Result::<()>::Ok(()) });
1699    /// ```
1700    pub fn builder() -> super::builder::api_hub_plugin::ClientBuilder {
1701        gax::client_builder::internal::new_builder(super::builder::api_hub_plugin::client::Factory)
1702    }
1703
1704    /// Creates a new client from the provided stub.
1705    ///
1706    /// The most common case for calling this function is in tests mocking the
1707    /// client's behavior.
1708    pub fn from_stub<T>(stub: T) -> Self
1709    where
1710        T: super::stub::ApiHubPlugin + 'static,
1711    {
1712        Self {
1713            inner: std::sync::Arc::new(stub),
1714        }
1715    }
1716
1717    pub(crate) async fn new(
1718        config: gaxi::options::ClientConfig,
1719    ) -> gax::client_builder::Result<Self> {
1720        let inner = Self::build_inner(config).await?;
1721        Ok(Self { inner })
1722    }
1723
1724    async fn build_inner(
1725        conf: gaxi::options::ClientConfig,
1726    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ApiHubPlugin>> {
1727        if gaxi::options::tracing_enabled(&conf) {
1728            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1729        }
1730        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1731    }
1732
1733    async fn build_transport(
1734        conf: gaxi::options::ClientConfig,
1735    ) -> gax::client_builder::Result<impl super::stub::ApiHubPlugin> {
1736        super::transport::ApiHubPlugin::new(conf).await
1737    }
1738
1739    async fn build_with_tracing(
1740        conf: gaxi::options::ClientConfig,
1741    ) -> gax::client_builder::Result<impl super::stub::ApiHubPlugin> {
1742        Self::build_transport(conf)
1743            .await
1744            .map(super::tracing::ApiHubPlugin::new)
1745    }
1746
1747    /// Get an API Hub plugin.
1748    pub fn get_plugin(&self) -> super::builder::api_hub_plugin::GetPlugin {
1749        super::builder::api_hub_plugin::GetPlugin::new(self.inner.clone())
1750    }
1751
1752    /// Enables a plugin.
1753    /// The `state` of the plugin after enabling is `ENABLED`
1754    pub fn enable_plugin(&self) -> super::builder::api_hub_plugin::EnablePlugin {
1755        super::builder::api_hub_plugin::EnablePlugin::new(self.inner.clone())
1756    }
1757
1758    /// Disables a plugin.
1759    /// The `state` of the plugin after disabling is `DISABLED`
1760    pub fn disable_plugin(&self) -> super::builder::api_hub_plugin::DisablePlugin {
1761        super::builder::api_hub_plugin::DisablePlugin::new(self.inner.clone())
1762    }
1763
1764    /// Create an API Hub plugin resource in the API hub.
1765    /// Once a plugin is created, it can be used to create plugin instances.
1766    pub fn create_plugin(&self) -> super::builder::api_hub_plugin::CreatePlugin {
1767        super::builder::api_hub_plugin::CreatePlugin::new(self.inner.clone())
1768    }
1769
1770    /// List all the plugins in a given project and location.
1771    pub fn list_plugins(&self) -> super::builder::api_hub_plugin::ListPlugins {
1772        super::builder::api_hub_plugin::ListPlugins::new(self.inner.clone())
1773    }
1774
1775    /// Delete a Plugin in API hub.
1776    /// Note, only user owned plugins can be deleted via this method.
1777    ///
1778    /// # Long running operations
1779    ///
1780    /// This method is used to start, and/or poll a [long-running Operation].
1781    /// The [Working with long-running operations] chapter in the [user guide]
1782    /// covers these operations in detail.
1783    ///
1784    /// [long-running operation]: https://google.aip.dev/151
1785    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1786    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1787    pub fn delete_plugin(&self) -> super::builder::api_hub_plugin::DeletePlugin {
1788        super::builder::api_hub_plugin::DeletePlugin::new(self.inner.clone())
1789    }
1790
1791    /// Creates a Plugin instance in the API hub.
1792    ///
1793    /// # Long running operations
1794    ///
1795    /// This method is used to start, and/or poll a [long-running Operation].
1796    /// The [Working with long-running operations] chapter in the [user guide]
1797    /// covers these operations in detail.
1798    ///
1799    /// [long-running operation]: https://google.aip.dev/151
1800    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1801    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1802    pub fn create_plugin_instance(&self) -> super::builder::api_hub_plugin::CreatePluginInstance {
1803        super::builder::api_hub_plugin::CreatePluginInstance::new(self.inner.clone())
1804    }
1805
1806    /// Executes a plugin instance in the API hub.
1807    ///
1808    /// # Long running operations
1809    ///
1810    /// This method is used to start, and/or poll a [long-running Operation].
1811    /// The [Working with long-running operations] chapter in the [user guide]
1812    /// covers these operations in detail.
1813    ///
1814    /// [long-running operation]: https://google.aip.dev/151
1815    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1816    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1817    pub fn execute_plugin_instance_action(
1818        &self,
1819    ) -> super::builder::api_hub_plugin::ExecutePluginInstanceAction {
1820        super::builder::api_hub_plugin::ExecutePluginInstanceAction::new(self.inner.clone())
1821    }
1822
1823    /// Get an API Hub plugin instance.
1824    pub fn get_plugin_instance(&self) -> super::builder::api_hub_plugin::GetPluginInstance {
1825        super::builder::api_hub_plugin::GetPluginInstance::new(self.inner.clone())
1826    }
1827
1828    /// List all the plugins in a given project and location.
1829    /// `-` can be used as wildcard value for {plugin_id}
1830    pub fn list_plugin_instances(&self) -> super::builder::api_hub_plugin::ListPluginInstances {
1831        super::builder::api_hub_plugin::ListPluginInstances::new(self.inner.clone())
1832    }
1833
1834    /// Enables a plugin instance in the API hub.
1835    ///
1836    /// # Long running operations
1837    ///
1838    /// This method is used to start, and/or poll a [long-running Operation].
1839    /// The [Working with long-running operations] chapter in the [user guide]
1840    /// covers these operations in detail.
1841    ///
1842    /// [long-running operation]: https://google.aip.dev/151
1843    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1844    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1845    pub fn enable_plugin_instance_action(
1846        &self,
1847    ) -> super::builder::api_hub_plugin::EnablePluginInstanceAction {
1848        super::builder::api_hub_plugin::EnablePluginInstanceAction::new(self.inner.clone())
1849    }
1850
1851    /// Disables a plugin instance in the API hub.
1852    ///
1853    /// # Long running operations
1854    ///
1855    /// This method is used to start, and/or poll a [long-running Operation].
1856    /// The [Working with long-running operations] chapter in the [user guide]
1857    /// covers these operations in detail.
1858    ///
1859    /// [long-running operation]: https://google.aip.dev/151
1860    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1861    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1862    pub fn disable_plugin_instance_action(
1863        &self,
1864    ) -> super::builder::api_hub_plugin::DisablePluginInstanceAction {
1865        super::builder::api_hub_plugin::DisablePluginInstanceAction::new(self.inner.clone())
1866    }
1867
1868    /// Updates a plugin instance in the API hub.
1869    /// The following fields in the
1870    /// [plugin_instance][google.cloud.apihub.v1.PluginInstance] can be updated
1871    /// currently:
1872    ///
1873    /// * [display_name][google.cloud.apihub.v1.PluginInstance.display_name]
1874    /// * [schedule_cron_expression][PluginInstance.actions.schedule_cron_expression]
1875    ///
1876    /// The
1877    /// [update_mask][google.cloud.apihub.v1.UpdatePluginInstanceRequest.update_mask]
1878    /// should be used to specify the fields being updated.
1879    ///
1880    /// To update the
1881    /// [auth_config][google.cloud.apihub.v1.PluginInstance.auth_config] and
1882    /// [additional_config][google.cloud.apihub.v1.PluginInstance.additional_config]
1883    /// of the plugin instance, use the
1884    /// [ApplyPluginInstanceConfig][google.cloud.apihub.v1.ApiHubPlugin.ApplyPluginInstanceConfig]
1885    /// method.
1886    ///
1887    /// [google.cloud.apihub.v1.PluginInstance]: crate::model::PluginInstance
1888    /// [google.cloud.apihub.v1.PluginInstance.additional_config]: crate::model::PluginInstance::additional_config
1889    /// [google.cloud.apihub.v1.PluginInstance.auth_config]: crate::model::PluginInstance::auth_config
1890    /// [google.cloud.apihub.v1.PluginInstance.display_name]: crate::model::PluginInstance::display_name
1891    /// [google.cloud.apihub.v1.UpdatePluginInstanceRequest.update_mask]: crate::model::UpdatePluginInstanceRequest::update_mask
1892    pub fn update_plugin_instance(&self) -> super::builder::api_hub_plugin::UpdatePluginInstance {
1893        super::builder::api_hub_plugin::UpdatePluginInstance::new(self.inner.clone())
1894    }
1895
1896    /// Deletes a plugin instance in the API hub.
1897    ///
1898    /// # Long running operations
1899    ///
1900    /// This method is used to start, and/or poll a [long-running Operation].
1901    /// The [Working with long-running operations] chapter in the [user guide]
1902    /// covers these operations in detail.
1903    ///
1904    /// [long-running operation]: https://google.aip.dev/151
1905    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1906    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1907    pub fn delete_plugin_instance(&self) -> super::builder::api_hub_plugin::DeletePluginInstance {
1908        super::builder::api_hub_plugin::DeletePluginInstance::new(self.inner.clone())
1909    }
1910
1911    /// Lists information about the supported locations for this service.
1912    pub fn list_locations(&self) -> super::builder::api_hub_plugin::ListLocations {
1913        super::builder::api_hub_plugin::ListLocations::new(self.inner.clone())
1914    }
1915
1916    /// Gets information about a location.
1917    pub fn get_location(&self) -> super::builder::api_hub_plugin::GetLocation {
1918        super::builder::api_hub_plugin::GetLocation::new(self.inner.clone())
1919    }
1920
1921    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1922    ///
1923    /// [google.longrunning.Operations]: longrunning::client::Operations
1924    pub fn list_operations(&self) -> super::builder::api_hub_plugin::ListOperations {
1925        super::builder::api_hub_plugin::ListOperations::new(self.inner.clone())
1926    }
1927
1928    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1929    ///
1930    /// [google.longrunning.Operations]: longrunning::client::Operations
1931    pub fn get_operation(&self) -> super::builder::api_hub_plugin::GetOperation {
1932        super::builder::api_hub_plugin::GetOperation::new(self.inner.clone())
1933    }
1934
1935    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1936    ///
1937    /// [google.longrunning.Operations]: longrunning::client::Operations
1938    pub fn delete_operation(&self) -> super::builder::api_hub_plugin::DeleteOperation {
1939        super::builder::api_hub_plugin::DeleteOperation::new(self.inner.clone())
1940    }
1941
1942    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1943    ///
1944    /// [google.longrunning.Operations]: longrunning::client::Operations
1945    pub fn cancel_operation(&self) -> super::builder::api_hub_plugin::CancelOperation {
1946        super::builder::api_hub_plugin::CancelOperation::new(self.inner.clone())
1947    }
1948}
1949
1950/// Implements a client for the API hub API.
1951///
1952/// # Example
1953/// ```
1954/// # tokio_test::block_on(async {
1955/// # use google_cloud_apihub_v1::client::Provisioning;
1956/// let client = Provisioning::builder().build().await?;
1957/// // use `client` to make requests to the API hub API.
1958/// # gax::client_builder::Result::<()>::Ok(()) });
1959/// ```
1960///
1961/// # Service Description
1962///
1963/// This service is used for managing the data plane provisioning of the API hub.
1964///
1965/// # Configuration
1966///
1967/// To configure `Provisioning` use the `with_*` methods in the type returned
1968/// by [builder()][Provisioning::builder]. The default configuration should
1969/// work for most applications. Common configuration changes include
1970///
1971/// * [with_endpoint()]: by default this client uses the global default endpoint
1972///   (`https://apihub.googleapis.com`). Applications using regional
1973///   endpoints or running in restricted networks (e.g. a network configured
1974//    with [Private Google Access with VPC Service Controls]) may want to
1975///   override this default.
1976/// * [with_credentials()]: by default this client uses
1977///   [Application Default Credentials]. Applications using custom
1978///   authentication may need to override this default.
1979///
1980/// [with_endpoint()]: super::builder::provisioning::ClientBuilder::with_endpoint
1981/// [with_credentials()]: super::builder::provisioning::ClientBuilder::credentials
1982/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1983/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1984///
1985/// # Pooling and Cloning
1986///
1987/// `Provisioning` holds a connection pool internally, it is advised to
1988/// create one and the reuse it.  You do not need to wrap `Provisioning` in
1989/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1990/// already uses an `Arc` internally.
1991#[derive(Clone, Debug)]
1992pub struct Provisioning {
1993    inner: std::sync::Arc<dyn super::stub::dynamic::Provisioning>,
1994}
1995
1996impl Provisioning {
1997    /// Returns a builder for [Provisioning].
1998    ///
1999    /// ```
2000    /// # tokio_test::block_on(async {
2001    /// # use google_cloud_apihub_v1::client::Provisioning;
2002    /// let client = Provisioning::builder().build().await?;
2003    /// # gax::client_builder::Result::<()>::Ok(()) });
2004    /// ```
2005    pub fn builder() -> super::builder::provisioning::ClientBuilder {
2006        gax::client_builder::internal::new_builder(super::builder::provisioning::client::Factory)
2007    }
2008
2009    /// Creates a new client from the provided stub.
2010    ///
2011    /// The most common case for calling this function is in tests mocking the
2012    /// client's behavior.
2013    pub fn from_stub<T>(stub: T) -> Self
2014    where
2015        T: super::stub::Provisioning + 'static,
2016    {
2017        Self {
2018            inner: std::sync::Arc::new(stub),
2019        }
2020    }
2021
2022    pub(crate) async fn new(
2023        config: gaxi::options::ClientConfig,
2024    ) -> gax::client_builder::Result<Self> {
2025        let inner = Self::build_inner(config).await?;
2026        Ok(Self { inner })
2027    }
2028
2029    async fn build_inner(
2030        conf: gaxi::options::ClientConfig,
2031    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Provisioning>> {
2032        if gaxi::options::tracing_enabled(&conf) {
2033            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2034        }
2035        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2036    }
2037
2038    async fn build_transport(
2039        conf: gaxi::options::ClientConfig,
2040    ) -> gax::client_builder::Result<impl super::stub::Provisioning> {
2041        super::transport::Provisioning::new(conf).await
2042    }
2043
2044    async fn build_with_tracing(
2045        conf: gaxi::options::ClientConfig,
2046    ) -> gax::client_builder::Result<impl super::stub::Provisioning> {
2047        Self::build_transport(conf)
2048            .await
2049            .map(super::tracing::Provisioning::new)
2050    }
2051
2052    /// Provisions instance resources for the API Hub.
2053    ///
2054    /// # Long running operations
2055    ///
2056    /// This method is used to start, and/or poll a [long-running Operation].
2057    /// The [Working with long-running operations] chapter in the [user guide]
2058    /// covers these operations in detail.
2059    ///
2060    /// [long-running operation]: https://google.aip.dev/151
2061    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2062    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2063    pub fn create_api_hub_instance(&self) -> super::builder::provisioning::CreateApiHubInstance {
2064        super::builder::provisioning::CreateApiHubInstance::new(self.inner.clone())
2065    }
2066
2067    /// Deletes the API hub instance.
2068    ///
2069    /// # Long running operations
2070    ///
2071    /// This method is used to start, and/or poll a [long-running Operation].
2072    /// The [Working with long-running operations] chapter in the [user guide]
2073    /// covers these operations in detail.
2074    ///
2075    /// [long-running operation]: https://google.aip.dev/151
2076    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2077    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2078    pub fn delete_api_hub_instance(&self) -> super::builder::provisioning::DeleteApiHubInstance {
2079        super::builder::provisioning::DeleteApiHubInstance::new(self.inner.clone())
2080    }
2081
2082    /// Gets details of a single API Hub instance.
2083    pub fn get_api_hub_instance(&self) -> super::builder::provisioning::GetApiHubInstance {
2084        super::builder::provisioning::GetApiHubInstance::new(self.inner.clone())
2085    }
2086
2087    /// Looks up an Api Hub instance in a given GCP project. There will always be
2088    /// only one Api Hub instance for a GCP project across all locations.
2089    pub fn lookup_api_hub_instance(&self) -> super::builder::provisioning::LookupApiHubInstance {
2090        super::builder::provisioning::LookupApiHubInstance::new(self.inner.clone())
2091    }
2092
2093    /// Lists information about the supported locations for this service.
2094    pub fn list_locations(&self) -> super::builder::provisioning::ListLocations {
2095        super::builder::provisioning::ListLocations::new(self.inner.clone())
2096    }
2097
2098    /// Gets information about a location.
2099    pub fn get_location(&self) -> super::builder::provisioning::GetLocation {
2100        super::builder::provisioning::GetLocation::new(self.inner.clone())
2101    }
2102
2103    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2104    ///
2105    /// [google.longrunning.Operations]: longrunning::client::Operations
2106    pub fn list_operations(&self) -> super::builder::provisioning::ListOperations {
2107        super::builder::provisioning::ListOperations::new(self.inner.clone())
2108    }
2109
2110    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2111    ///
2112    /// [google.longrunning.Operations]: longrunning::client::Operations
2113    pub fn get_operation(&self) -> super::builder::provisioning::GetOperation {
2114        super::builder::provisioning::GetOperation::new(self.inner.clone())
2115    }
2116
2117    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2118    ///
2119    /// [google.longrunning.Operations]: longrunning::client::Operations
2120    pub fn delete_operation(&self) -> super::builder::provisioning::DeleteOperation {
2121        super::builder::provisioning::DeleteOperation::new(self.inner.clone())
2122    }
2123
2124    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2125    ///
2126    /// [google.longrunning.Operations]: longrunning::client::Operations
2127    pub fn cancel_operation(&self) -> super::builder::provisioning::CancelOperation {
2128        super::builder::provisioning::CancelOperation::new(self.inner.clone())
2129    }
2130}
2131
2132/// Implements a client for the API hub API.
2133///
2134/// # Example
2135/// ```
2136/// # tokio_test::block_on(async {
2137/// # use google_cloud_apihub_v1::client::RuntimeProjectAttachmentService;
2138/// let client = RuntimeProjectAttachmentService::builder().build().await?;
2139/// // use `client` to make requests to the API hub API.
2140/// # gax::client_builder::Result::<()>::Ok(()) });
2141/// ```
2142///
2143/// # Service Description
2144///
2145/// This service is used for managing the runtime project attachments.
2146///
2147/// # Configuration
2148///
2149/// To configure `RuntimeProjectAttachmentService` use the `with_*` methods in the type returned
2150/// by [builder()][RuntimeProjectAttachmentService::builder]. The default configuration should
2151/// work for most applications. Common configuration changes include
2152///
2153/// * [with_endpoint()]: by default this client uses the global default endpoint
2154///   (`https://apihub.googleapis.com`). Applications using regional
2155///   endpoints or running in restricted networks (e.g. a network configured
2156//    with [Private Google Access with VPC Service Controls]) may want to
2157///   override this default.
2158/// * [with_credentials()]: by default this client uses
2159///   [Application Default Credentials]. Applications using custom
2160///   authentication may need to override this default.
2161///
2162/// [with_endpoint()]: super::builder::runtime_project_attachment_service::ClientBuilder::with_endpoint
2163/// [with_credentials()]: super::builder::runtime_project_attachment_service::ClientBuilder::credentials
2164/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2165/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2166///
2167/// # Pooling and Cloning
2168///
2169/// `RuntimeProjectAttachmentService` holds a connection pool internally, it is advised to
2170/// create one and the reuse it.  You do not need to wrap `RuntimeProjectAttachmentService` in
2171/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2172/// already uses an `Arc` internally.
2173#[derive(Clone, Debug)]
2174pub struct RuntimeProjectAttachmentService {
2175    inner: std::sync::Arc<dyn super::stub::dynamic::RuntimeProjectAttachmentService>,
2176}
2177
2178impl RuntimeProjectAttachmentService {
2179    /// Returns a builder for [RuntimeProjectAttachmentService].
2180    ///
2181    /// ```
2182    /// # tokio_test::block_on(async {
2183    /// # use google_cloud_apihub_v1::client::RuntimeProjectAttachmentService;
2184    /// let client = RuntimeProjectAttachmentService::builder().build().await?;
2185    /// # gax::client_builder::Result::<()>::Ok(()) });
2186    /// ```
2187    pub fn builder() -> super::builder::runtime_project_attachment_service::ClientBuilder {
2188        gax::client_builder::internal::new_builder(
2189            super::builder::runtime_project_attachment_service::client::Factory,
2190        )
2191    }
2192
2193    /// Creates a new client from the provided stub.
2194    ///
2195    /// The most common case for calling this function is in tests mocking the
2196    /// client's behavior.
2197    pub fn from_stub<T>(stub: T) -> Self
2198    where
2199        T: super::stub::RuntimeProjectAttachmentService + 'static,
2200    {
2201        Self {
2202            inner: std::sync::Arc::new(stub),
2203        }
2204    }
2205
2206    pub(crate) async fn new(
2207        config: gaxi::options::ClientConfig,
2208    ) -> gax::client_builder::Result<Self> {
2209        let inner = Self::build_inner(config).await?;
2210        Ok(Self { inner })
2211    }
2212
2213    async fn build_inner(
2214        conf: gaxi::options::ClientConfig,
2215    ) -> gax::client_builder::Result<
2216        std::sync::Arc<dyn super::stub::dynamic::RuntimeProjectAttachmentService>,
2217    > {
2218        if gaxi::options::tracing_enabled(&conf) {
2219            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2220        }
2221        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2222    }
2223
2224    async fn build_transport(
2225        conf: gaxi::options::ClientConfig,
2226    ) -> gax::client_builder::Result<impl super::stub::RuntimeProjectAttachmentService> {
2227        super::transport::RuntimeProjectAttachmentService::new(conf).await
2228    }
2229
2230    async fn build_with_tracing(
2231        conf: gaxi::options::ClientConfig,
2232    ) -> gax::client_builder::Result<impl super::stub::RuntimeProjectAttachmentService> {
2233        Self::build_transport(conf)
2234            .await
2235            .map(super::tracing::RuntimeProjectAttachmentService::new)
2236    }
2237
2238    /// Attaches a runtime project to the host project.
2239    pub fn create_runtime_project_attachment(
2240        &self,
2241    ) -> super::builder::runtime_project_attachment_service::CreateRuntimeProjectAttachment {
2242        super::builder::runtime_project_attachment_service::CreateRuntimeProjectAttachment::new(
2243            self.inner.clone(),
2244        )
2245    }
2246
2247    /// Gets a runtime project attachment.
2248    pub fn get_runtime_project_attachment(
2249        &self,
2250    ) -> super::builder::runtime_project_attachment_service::GetRuntimeProjectAttachment {
2251        super::builder::runtime_project_attachment_service::GetRuntimeProjectAttachment::new(
2252            self.inner.clone(),
2253        )
2254    }
2255
2256    /// List runtime projects attached to the host project.
2257    pub fn list_runtime_project_attachments(
2258        &self,
2259    ) -> super::builder::runtime_project_attachment_service::ListRuntimeProjectAttachments {
2260        super::builder::runtime_project_attachment_service::ListRuntimeProjectAttachments::new(
2261            self.inner.clone(),
2262        )
2263    }
2264
2265    /// Delete a runtime project attachment in the API Hub. This call will detach
2266    /// the runtime project from the host project.
2267    pub fn delete_runtime_project_attachment(
2268        &self,
2269    ) -> super::builder::runtime_project_attachment_service::DeleteRuntimeProjectAttachment {
2270        super::builder::runtime_project_attachment_service::DeleteRuntimeProjectAttachment::new(
2271            self.inner.clone(),
2272        )
2273    }
2274
2275    /// Look up a runtime project attachment. This API can be called in the context
2276    /// of any project.
2277    pub fn lookup_runtime_project_attachment(
2278        &self,
2279    ) -> super::builder::runtime_project_attachment_service::LookupRuntimeProjectAttachment {
2280        super::builder::runtime_project_attachment_service::LookupRuntimeProjectAttachment::new(
2281            self.inner.clone(),
2282        )
2283    }
2284
2285    /// Lists information about the supported locations for this service.
2286    pub fn list_locations(
2287        &self,
2288    ) -> super::builder::runtime_project_attachment_service::ListLocations {
2289        super::builder::runtime_project_attachment_service::ListLocations::new(self.inner.clone())
2290    }
2291
2292    /// Gets information about a location.
2293    pub fn get_location(&self) -> super::builder::runtime_project_attachment_service::GetLocation {
2294        super::builder::runtime_project_attachment_service::GetLocation::new(self.inner.clone())
2295    }
2296
2297    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2298    ///
2299    /// [google.longrunning.Operations]: longrunning::client::Operations
2300    pub fn list_operations(
2301        &self,
2302    ) -> super::builder::runtime_project_attachment_service::ListOperations {
2303        super::builder::runtime_project_attachment_service::ListOperations::new(self.inner.clone())
2304    }
2305
2306    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2307    ///
2308    /// [google.longrunning.Operations]: longrunning::client::Operations
2309    pub fn get_operation(
2310        &self,
2311    ) -> super::builder::runtime_project_attachment_service::GetOperation {
2312        super::builder::runtime_project_attachment_service::GetOperation::new(self.inner.clone())
2313    }
2314
2315    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2316    ///
2317    /// [google.longrunning.Operations]: longrunning::client::Operations
2318    pub fn delete_operation(
2319        &self,
2320    ) -> super::builder::runtime_project_attachment_service::DeleteOperation {
2321        super::builder::runtime_project_attachment_service::DeleteOperation::new(self.inner.clone())
2322    }
2323
2324    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2325    ///
2326    /// [google.longrunning.Operations]: longrunning::client::Operations
2327    pub fn cancel_operation(
2328        &self,
2329    ) -> super::builder::runtime_project_attachment_service::CancelOperation {
2330        super::builder::runtime_project_attachment_service::CancelOperation::new(self.inner.clone())
2331    }
2332}