google_datacatalog1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all DataCatalog related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_datacatalog1 as datacatalog1;
49/// use datacatalog1::{Result, Error};
50/// # async fn dox() {
51/// use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62/// .with_native_roots()
63/// .unwrap()
64/// .https_only()
65/// .enable_http2()
66/// .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70/// secret,
71/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// yup_oauth2::client::CustomHyperClientBuilder::from(
73/// hyper_util::client::legacy::Client::builder(executor).build(connector),
74/// ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http2()
86/// .build()
87/// );
88/// let mut hub = DataCatalog::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.projects().locations_entry_groups_delete("name")
93/// .force(true)
94/// .doit().await;
95///
96/// match result {
97/// Err(e) => match e {
98/// // The Error enum provides details about what exactly happened.
99/// // You can also just use its `Debug`, `Display` or `Error` traits
100/// Error::HttpError(_)
101/// |Error::Io(_)
102/// |Error::MissingAPIKey
103/// |Error::MissingToken(_)
104/// |Error::Cancelled
105/// |Error::UploadSizeLimitExceeded(_, _)
106/// |Error::Failure(_)
107/// |Error::BadRequest(_)
108/// |Error::FieldClash(_)
109/// |Error::JsonDecodeError(_, _) => println!("{}", e),
110/// },
111/// Ok(res) => println!("Success: {:?}", res),
112/// }
113/// # }
114/// ```
115#[derive(Clone)]
116pub struct DataCatalog<C> {
117 pub client: common::Client<C>,
118 pub auth: Box<dyn common::GetToken>,
119 _user_agent: String,
120 _base_url: String,
121 _root_url: String,
122}
123
124impl<C> common::Hub for DataCatalog<C> {}
125
126impl<'a, C> DataCatalog<C> {
127 pub fn new<A: 'static + common::GetToken>(
128 client: common::Client<C>,
129 auth: A,
130 ) -> DataCatalog<C> {
131 DataCatalog {
132 client,
133 auth: Box::new(auth),
134 _user_agent: "google-api-rust-client/7.0.0".to_string(),
135 _base_url: "https://datacatalog.googleapis.com/".to_string(),
136 _root_url: "https://datacatalog.googleapis.com/".to_string(),
137 }
138 }
139
140 pub fn catalog(&'a self) -> CatalogMethods<'a, C> {
141 CatalogMethods { hub: self }
142 }
143 pub fn entries(&'a self) -> EntryMethods<'a, C> {
144 EntryMethods { hub: self }
145 }
146 pub fn organizations(&'a self) -> OrganizationMethods<'a, C> {
147 OrganizationMethods { hub: self }
148 }
149 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
150 ProjectMethods { hub: self }
151 }
152
153 /// Set the user-agent header field to use in all requests to the server.
154 /// It defaults to `google-api-rust-client/7.0.0`.
155 ///
156 /// Returns the previously set user-agent.
157 pub fn user_agent(&mut self, agent_name: String) -> String {
158 std::mem::replace(&mut self._user_agent, agent_name)
159 }
160
161 /// Set the base url to use in all requests to the server.
162 /// It defaults to `https://datacatalog.googleapis.com/`.
163 ///
164 /// Returns the previously set base url.
165 pub fn base_url(&mut self, new_base_url: String) -> String {
166 std::mem::replace(&mut self._base_url, new_base_url)
167 }
168
169 /// Set the root url to use in all requests to the server.
170 /// It defaults to `https://datacatalog.googleapis.com/`.
171 ///
172 /// Returns the previously set root url.
173 pub fn root_url(&mut self, new_root_url: String) -> String {
174 std::mem::replace(&mut self._root_url, new_root_url)
175 }
176}
177
178// ############
179// SCHEMAS ###
180// ##########
181/// Associates `members`, or principals, with a `role`.
182///
183/// This type is not used in any activity, and only used as *part* of another schema.
184///
185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
186#[serde_with::serde_as]
187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
188pub struct Binding {
189 /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
190 pub condition: Option<Expr>,
191 /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
192 pub members: Option<Vec<String>>,
193 /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
194 pub role: Option<String>,
195}
196
197impl common::Part for Binding {}
198
199/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
200///
201/// # Activities
202///
203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
205///
206/// * [locations entry groups entries tags delete projects](ProjectLocationEntryGroupEntryTagDeleteCall) (response)
207/// * [locations entry groups entries delete projects](ProjectLocationEntryGroupEntryDeleteCall) (response)
208/// * [locations entry groups tags delete projects](ProjectLocationEntryGroupTagDeleteCall) (response)
209/// * [locations entry groups delete projects](ProjectLocationEntryGroupDeleteCall) (response)
210/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
211/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
212/// * [locations tag templates fields delete projects](ProjectLocationTagTemplateFieldDeleteCall) (response)
213/// * [locations tag templates delete projects](ProjectLocationTagTemplateDeleteCall) (response)
214/// * [locations taxonomies policy tags delete projects](ProjectLocationTaxonomyPolicyTagDeleteCall) (response)
215/// * [locations taxonomies delete projects](ProjectLocationTaxonomyDeleteCall) (response)
216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
217#[serde_with::serde_as]
218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
219pub struct Empty {
220 _never_set: Option<bool>,
221}
222
223impl common::ResponseResult for Empty {}
224
225/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
226///
227/// This type is not used in any activity, and only used as *part* of another schema.
228///
229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
230#[serde_with::serde_as]
231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
232pub struct Expr {
233 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
234 pub description: Option<String>,
235 /// Textual representation of an expression in Common Expression Language syntax.
236 pub expression: Option<String>,
237 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
238 pub location: Option<String>,
239 /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
240 pub title: Option<String>,
241}
242
243impl common::Part for Expr {}
244
245/// Request message for `GetIamPolicy` method.
246///
247/// # Activities
248///
249/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
250/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
251///
252/// * [locations entry groups entries get iam policy projects](ProjectLocationEntryGroupEntryGetIamPolicyCall) (request)
253/// * [locations entry groups get iam policy projects](ProjectLocationEntryGroupGetIamPolicyCall) (request)
254/// * [locations tag templates get iam policy projects](ProjectLocationTagTemplateGetIamPolicyCall) (request)
255/// * [locations taxonomies policy tags get iam policy projects](ProjectLocationTaxonomyPolicyTagGetIamPolicyCall) (request)
256/// * [locations taxonomies get iam policy projects](ProjectLocationTaxonomyGetIamPolicyCall) (request)
257#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
258#[serde_with::serde_as]
259#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
260pub struct GetIamPolicyRequest {
261 /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
262 pub options: Option<GetPolicyOptions>,
263}
264
265impl common::RequestValue for GetIamPolicyRequest {}
266
267/// Encapsulates settings provided to GetIamPolicy.
268///
269/// This type is not used in any activity, and only used as *part* of another schema.
270///
271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
272#[serde_with::serde_as]
273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
274pub struct GetPolicyOptions {
275 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
276 #[serde(rename = "requestedPolicyVersion")]
277 pub requested_policy_version: Option<i32>,
278}
279
280impl common::Part for GetPolicyOptions {}
281
282/// Specification for the BigQuery connection.
283///
284/// This type is not used in any activity, and only used as *part* of another schema.
285///
286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
287#[serde_with::serde_as]
288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
289pub struct GoogleCloudDatacatalogV1BigQueryConnectionSpec {
290 /// Specification for the BigQuery connection to a Cloud SQL instance.
291 #[serde(rename = "cloudSql")]
292 pub cloud_sql: Option<GoogleCloudDatacatalogV1CloudSqlBigQueryConnectionSpec>,
293 /// The type of the BigQuery connection.
294 #[serde(rename = "connectionType")]
295 pub connection_type: Option<String>,
296 /// True if there are credentials attached to the BigQuery connection; false otherwise.
297 #[serde(rename = "hasCredential")]
298 pub has_credential: Option<bool>,
299}
300
301impl common::Part for GoogleCloudDatacatalogV1BigQueryConnectionSpec {}
302
303/// Specification for a group of BigQuery tables with the `[prefix]YYYYMMDD` name pattern. For more information, see [Introduction to partitioned tables] (https://cloud.google.com/bigquery/docs/partitioned-tables#partitioning_versus_sharding).
304///
305/// This type is not used in any activity, and only used as *part* of another schema.
306///
307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
308#[serde_with::serde_as]
309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
310pub struct GoogleCloudDatacatalogV1BigQueryDateShardedSpec {
311 /// Output only. The Data Catalog resource name of the dataset entry the current table belongs to. For example: `projects/{PROJECT_ID}/locations/{LOCATION}/entrygroups/{ENTRY_GROUP_ID}/entries/{ENTRY_ID}`.
312 pub dataset: Option<String>,
313 /// Output only. BigQuery resource name of the latest shard.
314 #[serde(rename = "latestShardResource")]
315 pub latest_shard_resource: Option<String>,
316 /// Output only. Total number of shards.
317 #[serde(rename = "shardCount")]
318 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
319 pub shard_count: Option<i64>,
320 /// Output only. The table name prefix of the shards. The name of any given shard is `[table_prefix]YYYYMMDD`. For example, for the `MyTable20180101` shard, the `table_prefix` is `MyTable`.
321 #[serde(rename = "tablePrefix")]
322 pub table_prefix: Option<String>,
323}
324
325impl common::Part for GoogleCloudDatacatalogV1BigQueryDateShardedSpec {}
326
327/// Fields specific for BigQuery routines.
328///
329/// This type is not used in any activity, and only used as *part* of another schema.
330///
331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
332#[serde_with::serde_as]
333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
334pub struct GoogleCloudDatacatalogV1BigQueryRoutineSpec {
335 /// Paths of the imported libraries.
336 #[serde(rename = "importedLibraries")]
337 pub imported_libraries: Option<Vec<String>>,
338}
339
340impl common::Part for GoogleCloudDatacatalogV1BigQueryRoutineSpec {}
341
342/// Describes a BigQuery table.
343///
344/// This type is not used in any activity, and only used as *part* of another schema.
345///
346#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
347#[serde_with::serde_as]
348#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
349pub struct GoogleCloudDatacatalogV1BigQueryTableSpec {
350 /// Output only. The table source type.
351 #[serde(rename = "tableSourceType")]
352 pub table_source_type: Option<String>,
353 /// Specification of a BigQuery table. Populated only if the `table_source_type` is `BIGQUERY_TABLE`.
354 #[serde(rename = "tableSpec")]
355 pub table_spec: Option<GoogleCloudDatacatalogV1TableSpec>,
356 /// Table view specification. Populated only if the `table_source_type` is `BIGQUERY_VIEW`.
357 #[serde(rename = "viewSpec")]
358 pub view_spec: Option<GoogleCloudDatacatalogV1ViewSpec>,
359}
360
361impl common::Part for GoogleCloudDatacatalogV1BigQueryTableSpec {}
362
363/// Business Context of the entry.
364///
365/// This type is not used in any activity, and only used as *part* of another schema.
366///
367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
368#[serde_with::serde_as]
369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
370pub struct GoogleCloudDatacatalogV1BusinessContext {
371 /// Contact people for the entry.
372 pub contacts: Option<GoogleCloudDatacatalogV1Contacts>,
373 /// Entry overview fields for rich text descriptions of entries.
374 #[serde(rename = "entryOverview")]
375 pub entry_overview: Option<GoogleCloudDatacatalogV1EntryOverview>,
376}
377
378impl common::Part for GoogleCloudDatacatalogV1BusinessContext {}
379
380/// Specification that applies to Instance entries that are part of `CLOUD_BIGTABLE` system. (user_specified_type)
381///
382/// This type is not used in any activity, and only used as *part* of another schema.
383///
384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
385#[serde_with::serde_as]
386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
387pub struct GoogleCloudDatacatalogV1CloudBigtableInstanceSpec {
388 /// The list of clusters for the Instance.
389 #[serde(rename = "cloudBigtableClusterSpecs")]
390 pub cloud_bigtable_cluster_specs:
391 Option<Vec<GoogleCloudDatacatalogV1CloudBigtableInstanceSpecCloudBigtableClusterSpec>>,
392}
393
394impl common::Part for GoogleCloudDatacatalogV1CloudBigtableInstanceSpec {}
395
396/// Spec that applies to clusters of an Instance of Cloud Bigtable.
397///
398/// This type is not used in any activity, and only used as *part* of another schema.
399///
400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
401#[serde_with::serde_as]
402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
403pub struct GoogleCloudDatacatalogV1CloudBigtableInstanceSpecCloudBigtableClusterSpec {
404 /// Name of the cluster.
405 #[serde(rename = "displayName")]
406 pub display_name: Option<String>,
407 /// A link back to the parent resource, in this case Instance.
408 #[serde(rename = "linkedResource")]
409 pub linked_resource: Option<String>,
410 /// Location of the cluster, typically a Cloud zone.
411 pub location: Option<String>,
412 /// Type of the resource. For a cluster this would be "CLUSTER".
413 #[serde(rename = "type")]
414 pub type_: Option<String>,
415}
416
417impl common::Part for GoogleCloudDatacatalogV1CloudBigtableInstanceSpecCloudBigtableClusterSpec {}
418
419/// Specification that applies to all entries that are part of `CLOUD_BIGTABLE` system (user_specified_type)
420///
421/// This type is not used in any activity, and only used as *part* of another schema.
422///
423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
424#[serde_with::serde_as]
425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
426pub struct GoogleCloudDatacatalogV1CloudBigtableSystemSpec {
427 /// Display name of the Instance. This is user specified and different from the resource name.
428 #[serde(rename = "instanceDisplayName")]
429 pub instance_display_name: Option<String>,
430}
431
432impl common::Part for GoogleCloudDatacatalogV1CloudBigtableSystemSpec {}
433
434/// Specification for the BigQuery connection to a Cloud SQL instance.
435///
436/// This type is not used in any activity, and only used as *part* of another schema.
437///
438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
439#[serde_with::serde_as]
440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
441pub struct GoogleCloudDatacatalogV1CloudSqlBigQueryConnectionSpec {
442 /// Database name.
443 pub database: Option<String>,
444 /// Cloud SQL instance ID in the format of `project:location:instance`.
445 #[serde(rename = "instanceId")]
446 pub instance_id: Option<String>,
447 /// Type of the Cloud SQL database.
448 #[serde(rename = "type")]
449 pub type_: Option<String>,
450}
451
452impl common::Part for GoogleCloudDatacatalogV1CloudSqlBigQueryConnectionSpec {}
453
454/// A column within a schema. Columns can be nested inside other columns.
455///
456/// This type is not used in any activity, and only used as *part* of another schema.
457///
458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
459#[serde_with::serde_as]
460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
461pub struct GoogleCloudDatacatalogV1ColumnSchema {
462 /// Required. Name of the column. Must be a UTF-8 string without dots (.). The maximum size is 64 bytes.
463 pub column: Option<String>,
464 /// Optional. Default value for the column.
465 #[serde(rename = "defaultValue")]
466 pub default_value: Option<String>,
467 /// Optional. Description of the column. Default value is an empty string. The description must be a UTF-8 string with the maximum size of 2000 bytes.
468 pub description: Option<String>,
469 /// Optional. Garbage collection policy for the column or column family. Applies to systems like Cloud Bigtable.
470 #[serde(rename = "gcRule")]
471 pub gc_rule: Option<String>,
472 /// Optional. Most important inclusion of this column.
473 #[serde(rename = "highestIndexingType")]
474 pub highest_indexing_type: Option<String>,
475 /// Looker specific column info of this column.
476 #[serde(rename = "lookerColumnSpec")]
477 pub looker_column_spec: Option<GoogleCloudDatacatalogV1ColumnSchemaLookerColumnSpec>,
478 /// Optional. A column's mode indicates whether values in this column are required, nullable, or repeated. Only `NULLABLE`, `REQUIRED`, and `REPEATED` values are supported. Default mode is `NULLABLE`.
479 pub mode: Option<String>,
480 /// Optional. Ordinal position
481 #[serde(rename = "ordinalPosition")]
482 pub ordinal_position: Option<i32>,
483 /// Optional. The subtype of the RANGE, if the type of this field is RANGE. If the type is RANGE, this field is required. Possible values for the field element type of a RANGE include: * DATE * DATETIME * TIMESTAMP
484 #[serde(rename = "rangeElementType")]
485 pub range_element_type: Option<GoogleCloudDatacatalogV1ColumnSchemaFieldElementType>,
486 /// Optional. Schema of sub-columns. A column can have zero or more sub-columns.
487 pub subcolumns: Option<Vec<GoogleCloudDatacatalogV1ColumnSchema>>,
488 /// Required. Type of the column. Must be a UTF-8 string with the maximum size of 128 bytes.
489 #[serde(rename = "type")]
490 pub type_: Option<String>,
491}
492
493impl common::Part for GoogleCloudDatacatalogV1ColumnSchema {}
494
495/// Represents the type of a field element.
496///
497/// This type is not used in any activity, and only used as *part* of another schema.
498///
499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
500#[serde_with::serde_as]
501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct GoogleCloudDatacatalogV1ColumnSchemaFieldElementType {
503 /// Required. The type of a field element. See ColumnSchema.type.
504 #[serde(rename = "type")]
505 pub type_: Option<String>,
506}
507
508impl common::Part for GoogleCloudDatacatalogV1ColumnSchemaFieldElementType {}
509
510/// Column info specific to Looker System.
511///
512/// This type is not used in any activity, and only used as *part* of another schema.
513///
514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
515#[serde_with::serde_as]
516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
517pub struct GoogleCloudDatacatalogV1ColumnSchemaLookerColumnSpec {
518 /// Looker specific column type of this column.
519 #[serde(rename = "type")]
520 pub type_: Option<String>,
521}
522
523impl common::Part for GoogleCloudDatacatalogV1ColumnSchemaLookerColumnSpec {}
524
525/// Common statistics on the entry's usage. They can be set on any system.
526///
527/// This type is not used in any activity, and only used as *part* of another schema.
528///
529#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
530#[serde_with::serde_as]
531#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
532pub struct GoogleCloudDatacatalogV1CommonUsageStats {
533 /// View count in source system.
534 #[serde(rename = "viewCount")]
535 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
536 pub view_count: Option<i64>,
537}
538
539impl common::Part for GoogleCloudDatacatalogV1CommonUsageStats {}
540
541/// Contact people for the entry.
542///
543/// # Activities
544///
545/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
546/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
547///
548/// * [locations entry groups entries modify entry contacts projects](ProjectLocationEntryGroupEntryModifyEntryContactCall) (response)
549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
550#[serde_with::serde_as]
551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
552pub struct GoogleCloudDatacatalogV1Contacts {
553 /// The list of contact people for the entry.
554 pub people: Option<Vec<GoogleCloudDatacatalogV1ContactsPerson>>,
555}
556
557impl common::ResponseResult for GoogleCloudDatacatalogV1Contacts {}
558
559/// A contact person for the entry.
560///
561/// This type is not used in any activity, and only used as *part* of another schema.
562///
563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
564#[serde_with::serde_as]
565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
566pub struct GoogleCloudDatacatalogV1ContactsPerson {
567 /// Designation of the person, for example, Data Steward.
568 pub designation: Option<String>,
569 /// Email of the person in the format of `john.doe@xyz`, ``, or `John Doe`.
570 pub email: Option<String>,
571}
572
573impl common::Part for GoogleCloudDatacatalogV1ContactsPerson {}
574
575/// Cross-regional source used to import an existing taxonomy into a different region.
576///
577/// This type is not used in any activity, and only used as *part* of another schema.
578///
579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
580#[serde_with::serde_as]
581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
582pub struct GoogleCloudDatacatalogV1CrossRegionalSource {
583 /// Required. The resource name of the source taxonomy to import.
584 pub taxonomy: Option<String>,
585}
586
587impl common::Part for GoogleCloudDatacatalogV1CrossRegionalSource {}
588
589/// Physical location of an entry.
590///
591/// This type is not used in any activity, and only used as *part* of another schema.
592///
593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
594#[serde_with::serde_as]
595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
596pub struct GoogleCloudDatacatalogV1DataSource {
597 /// Full name of a resource as defined by the service. For example: `//bigquery.googleapis.com/projects/{PROJECT_ID}/locations/{LOCATION}/datasets/{DATASET_ID}/tables/{TABLE_ID}`
598 pub resource: Option<String>,
599 /// Service that physically stores the data.
600 pub service: Option<String>,
601 /// Output only. Data Catalog entry name, if applicable.
602 #[serde(rename = "sourceEntry")]
603 pub source_entry: Option<String>,
604 /// Detailed properties of the underlying storage.
605 #[serde(rename = "storageProperties")]
606 pub storage_properties: Option<GoogleCloudDatacatalogV1StorageProperties>,
607}
608
609impl common::Part for GoogleCloudDatacatalogV1DataSource {}
610
611/// Specification that applies to a data source connection. Valid only for entries with the `DATA_SOURCE_CONNECTION` type. Only one of internal specs can be set at the time, and cannot be changed later.
612///
613/// This type is not used in any activity, and only used as *part* of another schema.
614///
615#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
616#[serde_with::serde_as]
617#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
618pub struct GoogleCloudDatacatalogV1DataSourceConnectionSpec {
619 /// Output only. Fields specific to BigQuery connections.
620 #[serde(rename = "bigqueryConnectionSpec")]
621 pub bigquery_connection_spec: Option<GoogleCloudDatacatalogV1BigQueryConnectionSpec>,
622}
623
624impl common::Part for GoogleCloudDatacatalogV1DataSourceConnectionSpec {}
625
626/// Specification that applies to a table resource. Valid only for entries with the `TABLE` type.
627///
628/// This type is not used in any activity, and only used as *part* of another schema.
629///
630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
631#[serde_with::serde_as]
632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
633pub struct GoogleCloudDatacatalogV1DatabaseTableSpec {
634 /// Spec what applies to tables that are actually views. Not set for "real" tables.
635 #[serde(rename = "databaseViewSpec")]
636 pub database_view_spec: Option<GoogleCloudDatacatalogV1DatabaseTableSpecDatabaseViewSpec>,
637 /// Output only. Fields specific to a Dataplex Universal Catalog table and present only in the Dataplex Universal Catalog table entries.
638 #[serde(rename = "dataplexTable")]
639 pub dataplex_table: Option<GoogleCloudDatacatalogV1DataplexTableSpec>,
640 /// Type of this table.
641 #[serde(rename = "type")]
642 pub type_: Option<String>,
643}
644
645impl common::Part for GoogleCloudDatacatalogV1DatabaseTableSpec {}
646
647/// Specification that applies to database view.
648///
649/// This type is not used in any activity, and only used as *part* of another schema.
650///
651#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
652#[serde_with::serde_as]
653#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
654pub struct GoogleCloudDatacatalogV1DatabaseTableSpecDatabaseViewSpec {
655 /// Name of a singular table this view reflects one to one.
656 #[serde(rename = "baseTable")]
657 pub base_table: Option<String>,
658 /// SQL query used to generate this view.
659 #[serde(rename = "sqlQuery")]
660 pub sql_query: Option<String>,
661 /// Type of this view.
662 #[serde(rename = "viewType")]
663 pub view_type: Option<String>,
664}
665
666impl common::Part for GoogleCloudDatacatalogV1DatabaseTableSpecDatabaseViewSpec {}
667
668/// External table registered by Dataplex Universal Catalog. Dataplex Universal Catalog publishes data discovered from an asset into multiple other systems (BigQuery, DPMS) in form of tables. We call them "external tables". External tables are also synced into the Data Catalog. This message contains pointers to those external tables (fully qualified name, resource name et cetera) within the Data Catalog.
669///
670/// This type is not used in any activity, and only used as *part* of another schema.
671///
672#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
673#[serde_with::serde_as]
674#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
675pub struct GoogleCloudDatacatalogV1DataplexExternalTable {
676 /// Name of the Data Catalog entry representing the external table.
677 #[serde(rename = "dataCatalogEntry")]
678 pub data_catalog_entry: Option<String>,
679 /// Fully qualified name (FQN) of the external table.
680 #[serde(rename = "fullyQualifiedName")]
681 pub fully_qualified_name: Option<String>,
682 /// Google Cloud resource name of the external table.
683 #[serde(rename = "googleCloudResource")]
684 pub google_cloud_resource: Option<String>,
685 /// Service in which the external table is registered.
686 pub system: Option<String>,
687}
688
689impl common::Part for GoogleCloudDatacatalogV1DataplexExternalTable {}
690
691/// Entry specification for a Dataplex Universal Catalog fileset.
692///
693/// This type is not used in any activity, and only used as *part* of another schema.
694///
695#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
696#[serde_with::serde_as]
697#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
698pub struct GoogleCloudDatacatalogV1DataplexFilesetSpec {
699 /// Common Dataplex Universal Catalog fields.
700 #[serde(rename = "dataplexSpec")]
701 pub dataplex_spec: Option<GoogleCloudDatacatalogV1DataplexSpec>,
702}
703
704impl common::Part for GoogleCloudDatacatalogV1DataplexFilesetSpec {}
705
706/// Common Dataplex Universal Catalog fields.
707///
708/// This type is not used in any activity, and only used as *part* of another schema.
709///
710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
711#[serde_with::serde_as]
712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
713pub struct GoogleCloudDatacatalogV1DataplexSpec {
714 /// Fully qualified resource name of an asset in Dataplex Universal Catalog, to which the underlying data source (Cloud Storage bucket or BigQuery dataset) of the entity is attached.
715 pub asset: Option<String>,
716 /// Compression format of the data, e.g., zip, gzip etc.
717 #[serde(rename = "compressionFormat")]
718 pub compression_format: Option<String>,
719 /// Format of the data.
720 #[serde(rename = "dataFormat")]
721 pub data_format: Option<GoogleCloudDatacatalogV1PhysicalSchema>,
722 /// Project ID of the underlying Cloud Storage or BigQuery data. Note that this may not be the same project as the corresponding Dataplex Universal Catalog lake / zone / asset.
723 #[serde(rename = "projectId")]
724 pub project_id: Option<String>,
725}
726
727impl common::Part for GoogleCloudDatacatalogV1DataplexSpec {}
728
729/// Entry specification for a Dataplex Universal Catalog table.
730///
731/// This type is not used in any activity, and only used as *part* of another schema.
732///
733#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
734#[serde_with::serde_as]
735#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
736pub struct GoogleCloudDatacatalogV1DataplexTableSpec {
737 /// Common Dataplex Universal Catalog fields.
738 #[serde(rename = "dataplexSpec")]
739 pub dataplex_spec: Option<GoogleCloudDatacatalogV1DataplexSpec>,
740 /// List of external tables registered by Dataplex Universal Catalog in other systems based on the same underlying data. External tables allow to query this data in those systems.
741 #[serde(rename = "externalTables")]
742 pub external_tables: Option<Vec<GoogleCloudDatacatalogV1DataplexExternalTable>>,
743 /// Indicates if the table schema is managed by the user or not.
744 #[serde(rename = "userManaged")]
745 pub user_managed: Option<bool>,
746}
747
748impl common::Part for GoogleCloudDatacatalogV1DataplexTableSpec {}
749
750/// Specification that applies to a dataset. Valid only for entries with the `DATASET` type.
751///
752/// This type is not used in any activity, and only used as *part* of another schema.
753///
754#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
755#[serde_with::serde_as]
756#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
757pub struct GoogleCloudDatacatalogV1DatasetSpec {
758 /// Vertex AI Dataset specific fields
759 #[serde(rename = "vertexDatasetSpec")]
760 pub vertex_dataset_spec: Option<GoogleCloudDatacatalogV1VertexDatasetSpec>,
761}
762
763impl common::Part for GoogleCloudDatacatalogV1DatasetSpec {}
764
765/// Entry metadata. A Data Catalog entry represents another resource in Google Cloud Platform (such as a BigQuery dataset or a Pub/Sub topic) or outside of it. You can use the `linked_resource` field in the entry resource to refer to the original resource ID of the source system. An entry resource contains resource details, for example, its schema. Additionally, you can attach flexible metadata to an entry in the form of a Tag.
766///
767/// # Activities
768///
769/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
770/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
771///
772/// * [lookup entries](EntryLookupCall) (response)
773/// * [locations entry groups entries create projects](ProjectLocationEntryGroupEntryCreateCall) (request|response)
774/// * [locations entry groups entries get projects](ProjectLocationEntryGroupEntryGetCall) (response)
775/// * [locations entry groups entries patch projects](ProjectLocationEntryGroupEntryPatchCall) (request|response)
776#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
777#[serde_with::serde_as]
778#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
779pub struct GoogleCloudDatacatalogV1Entry {
780 /// Output only. Specification for a group of BigQuery tables with the `[prefix]YYYYMMDD` name pattern. For more information, see [Introduction to partitioned tables] (https://cloud.google.com/bigquery/docs/partitioned-tables#partitioning_versus_sharding).
781 #[serde(rename = "bigqueryDateShardedSpec")]
782 pub bigquery_date_sharded_spec: Option<GoogleCloudDatacatalogV1BigQueryDateShardedSpec>,
783 /// Output only. Specification that applies to a BigQuery table. Valid only for entries with the `TABLE` type.
784 #[serde(rename = "bigqueryTableSpec")]
785 pub bigquery_table_spec: Option<GoogleCloudDatacatalogV1BigQueryTableSpec>,
786 /// Business Context of the entry. Not supported for BigQuery datasets
787 #[serde(rename = "businessContext")]
788 pub business_context: Option<GoogleCloudDatacatalogV1BusinessContext>,
789 /// Specification that applies to Cloud Bigtable system. Only settable when `integrated_system` is equal to `CLOUD_BIGTABLE`
790 #[serde(rename = "cloudBigtableSystemSpec")]
791 pub cloud_bigtable_system_spec: Option<GoogleCloudDatacatalogV1CloudBigtableSystemSpec>,
792 /// Output only. Physical location of the entry.
793 #[serde(rename = "dataSource")]
794 pub data_source: Option<GoogleCloudDatacatalogV1DataSource>,
795 /// Specification that applies to a data source connection. Valid only for entries with the `DATA_SOURCE_CONNECTION` type.
796 #[serde(rename = "dataSourceConnectionSpec")]
797 pub data_source_connection_spec: Option<GoogleCloudDatacatalogV1DataSourceConnectionSpec>,
798 /// Specification that applies to a table resource. Valid only for entries with the `TABLE` or `EXPLORE` type.
799 #[serde(rename = "databaseTableSpec")]
800 pub database_table_spec: Option<GoogleCloudDatacatalogV1DatabaseTableSpec>,
801 /// Specification that applies to a dataset.
802 #[serde(rename = "datasetSpec")]
803 pub dataset_spec: Option<GoogleCloudDatacatalogV1DatasetSpec>,
804 /// Entry description that can consist of several sentences or paragraphs that describe entry contents. The description must not contain Unicode non-characters as well as C0 and C1 control codes except tabs (HT), new lines (LF), carriage returns (CR), and page breaks (FF). The maximum size is 2000 bytes when encoded in UTF-8. Default value is an empty string.
805 pub description: Option<String>,
806 /// Display name of an entry. The maximum size is 500 bytes when encoded in UTF-8. Default value is an empty string.
807 #[serde(rename = "displayName")]
808 pub display_name: Option<String>,
809 /// FeatureonlineStore spec for Vertex AI Feature Store.
810 #[serde(rename = "featureOnlineStoreSpec")]
811 pub feature_online_store_spec: Option<GoogleCloudDatacatalogV1FeatureOnlineStoreSpec>,
812 /// Specification that applies to a fileset resource. Valid only for entries with the `FILESET` type.
813 #[serde(rename = "filesetSpec")]
814 pub fileset_spec: Option<GoogleCloudDatacatalogV1FilesetSpec>,
815 /// [Fully Qualified Name (FQN)](https://cloud.google.com//data-catalog/docs/fully-qualified-names) of the resource. Set automatically for entries representing resources from synced systems. Settable only during creation, and read-only later. Can be used for search and lookup of the entries.
816 #[serde(rename = "fullyQualifiedName")]
817 pub fully_qualified_name: Option<String>,
818 /// Specification that applies to a Cloud Storage fileset. Valid only for entries with the `FILESET` type.
819 #[serde(rename = "gcsFilesetSpec")]
820 pub gcs_fileset_spec: Option<GoogleCloudDatacatalogV1GcsFilesetSpec>,
821 /// Spec for graph.
822 #[serde(rename = "graphSpec")]
823 pub graph_spec: Option<GoogleCloudDatacatalogV1GraphSpec>,
824 /// Output only. Indicates the entry's source system that Data Catalog integrates with, such as BigQuery, Pub/Sub, or Dataproc Metastore.
825 #[serde(rename = "integratedSystem")]
826 pub integrated_system: Option<String>,
827 /// Cloud labels attached to the entry. In Data Catalog, you can create and modify labels attached only to custom entries. Synced entries have unmodifiable labels that come from the source system.
828 pub labels: Option<HashMap<String, String>>,
829 /// The resource this metadata entry refers to. For Google Cloud Platform resources, `linked_resource` is the [Full Resource Name] (https://cloud.google.com/apis/design/resource_names#full_resource_name). For example, the `linked_resource` for a table resource from BigQuery is: `//bigquery.googleapis.com/projects/{PROJECT_ID}/datasets/{DATASET_ID}/tables/{TABLE_ID}` Output only when the entry is one of the types in the `EntryType` enum. For entries with a `user_specified_type`, this field is optional and defaults to an empty string. The resource string must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), periods (.), colons (:), slashes (/), dashes (-), and hashes (#). The maximum size is 200 bytes when encoded in UTF-8.
830 #[serde(rename = "linkedResource")]
831 pub linked_resource: Option<String>,
832 /// Specification that applies to Looker sysstem. Only settable when `user_specified_system` is equal to `LOOKER`
833 #[serde(rename = "lookerSystemSpec")]
834 pub looker_system_spec: Option<GoogleCloudDatacatalogV1LookerSystemSpec>,
835 /// Model specification.
836 #[serde(rename = "modelSpec")]
837 pub model_spec: Option<GoogleCloudDatacatalogV1ModelSpec>,
838 /// Output only. Identifier. The resource name of an entry in URL format. Note: The entry itself and its child resources might not be stored in the location specified in its name.
839 pub name: Option<String>,
840 /// Output only. Additional information related to the entry. Private to the current user.
841 #[serde(rename = "personalDetails")]
842 pub personal_details: Option<GoogleCloudDatacatalogV1PersonalDetails>,
843 /// Specification that applies to a user-defined function or procedure. Valid only for entries with the `ROUTINE` type.
844 #[serde(rename = "routineSpec")]
845 pub routine_spec: Option<GoogleCloudDatacatalogV1RoutineSpec>,
846 /// Schema of the entry. An entry might not have any schema attached to it.
847 pub schema: Option<GoogleCloudDatacatalogV1Schema>,
848 /// Specification that applies to a Service resource.
849 #[serde(rename = "serviceSpec")]
850 pub service_spec: Option<GoogleCloudDatacatalogV1ServiceSpec>,
851 /// Timestamps from the underlying resource, not from the Data Catalog entry. Output only when the entry has a system listed in the `IntegratedSystem` enum. For entries with `user_specified_system`, this field is optional and defaults to an empty timestamp.
852 #[serde(rename = "sourceSystemTimestamps")]
853 pub source_system_timestamps: Option<GoogleCloudDatacatalogV1SystemTimestamps>,
854 /// Specification that applies to a relational database system. Only settable when `user_specified_system` is equal to `SQL_DATABASE`
855 #[serde(rename = "sqlDatabaseSystemSpec")]
856 pub sql_database_system_spec: Option<GoogleCloudDatacatalogV1SqlDatabaseSystemSpec>,
857 /// The type of the entry. For details, see [`EntryType`](#entrytype).
858 #[serde(rename = "type")]
859 pub type_: Option<String>,
860 /// Resource usage statistics.
861 #[serde(rename = "usageSignal")]
862 pub usage_signal: Option<GoogleCloudDatacatalogV1UsageSignal>,
863 /// Indicates the entry's source system that Data Catalog doesn't automatically integrate with. The `user_specified_system` string has the following limitations: * Is case insensitive. * Must begin with a letter or underscore. * Can only contain letters, numbers, and underscores. * Must be at least 1 character and at most 64 characters long.
864 #[serde(rename = "userSpecifiedSystem")]
865 pub user_specified_system: Option<String>,
866 /// Custom entry type that doesn't match any of the values allowed for input and listed in the `EntryType` enum. When creating an entry, first check the type values in the enum. If there are no appropriate types for the new entry, provide a custom value, for example, `my_special_type`. The `user_specified_type` string has the following limitations: * Is case insensitive. * Must begin with a letter or underscore. * Can only contain letters, numbers, and underscores. * Must be at least 1 character and at most 64 characters long.
867 #[serde(rename = "userSpecifiedType")]
868 pub user_specified_type: Option<String>,
869}
870
871impl common::RequestValue for GoogleCloudDatacatalogV1Entry {}
872impl common::ResponseResult for GoogleCloudDatacatalogV1Entry {}
873
874/// Entry group metadata. An `EntryGroup` resource represents a logical grouping of zero or more Data Catalog Entry resources.
875///
876/// # Activities
877///
878/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
879/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
880///
881/// * [locations entry groups create projects](ProjectLocationEntryGroupCreateCall) (request|response)
882/// * [locations entry groups get projects](ProjectLocationEntryGroupGetCall) (response)
883/// * [locations entry groups patch projects](ProjectLocationEntryGroupPatchCall) (request|response)
884#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
885#[serde_with::serde_as]
886#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
887pub struct GoogleCloudDatacatalogV1EntryGroup {
888 /// Output only. Timestamps of the entry group. Default value is empty.
889 #[serde(rename = "dataCatalogTimestamps")]
890 pub data_catalog_timestamps: Option<GoogleCloudDatacatalogV1SystemTimestamps>,
891 /// Entry group description. Can consist of several sentences or paragraphs that describe the entry group contents. Default value is an empty string.
892 pub description: Option<String>,
893 /// A short name to identify the entry group, for example, "analytics data - jan 2011". Default value is an empty string.
894 #[serde(rename = "displayName")]
895 pub display_name: Option<String>,
896 /// Identifier. The resource name of the entry group in URL format. Note: The entry group itself and its child resources might not be stored in the location specified in its name.
897 pub name: Option<String>,
898 /// Optional. When set to [true], it means DataCatalog EntryGroup was transferred to Dataplex Universal Catalog. It makes EntryGroup and its Entries to be read-only in DataCatalog. However, new Tags on EntryGroup and its Entries can be created. After setting the flag to [true] it cannot be unset.
899 #[serde(rename = "transferredToDataplex")]
900 pub transferred_to_dataplex: Option<bool>,
901}
902
903impl common::RequestValue for GoogleCloudDatacatalogV1EntryGroup {}
904impl common::ResponseResult for GoogleCloudDatacatalogV1EntryGroup {}
905
906/// Entry overview fields for rich text descriptions of entries.
907///
908/// # Activities
909///
910/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
911/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
912///
913/// * [locations entry groups entries modify entry overview projects](ProjectLocationEntryGroupEntryModifyEntryOverviewCall) (response)
914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
915#[serde_with::serde_as]
916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
917pub struct GoogleCloudDatacatalogV1EntryOverview {
918 /// Entry overview with support for rich text. The overview must only contain Unicode characters, and should be formatted using HTML. The maximum length is 10 MiB as this value holds HTML descriptions including encoded images. The maximum length of the text without images is 100 KiB.
919 pub overview: Option<String>,
920}
921
922impl common::ResponseResult for GoogleCloudDatacatalogV1EntryOverview {}
923
924/// Response message for ExportTaxonomies.
925///
926/// # Activities
927///
928/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
929/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
930///
931/// * [locations taxonomies export projects](ProjectLocationTaxonomyExportCall) (response)
932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
933#[serde_with::serde_as]
934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
935pub struct GoogleCloudDatacatalogV1ExportTaxonomiesResponse {
936 /// List of taxonomies and policy tags as nested protocol buffers.
937 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1SerializedTaxonomy>>,
938}
939
940impl common::ResponseResult for GoogleCloudDatacatalogV1ExportTaxonomiesResponse {}
941
942/// Detail description of the source information of a Vertex Feature Online Store.
943///
944/// This type is not used in any activity, and only used as *part* of another schema.
945///
946#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
947#[serde_with::serde_as]
948#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
949pub struct GoogleCloudDatacatalogV1FeatureOnlineStoreSpec {
950 /// Output only. Type of underlying storage for the FeatureOnlineStore.
951 #[serde(rename = "storageType")]
952 pub storage_type: Option<String>,
953}
954
955impl common::Part for GoogleCloudDatacatalogV1FeatureOnlineStoreSpec {}
956
957/// There is no detailed description.
958///
959/// This type is not used in any activity, and only used as *part* of another schema.
960///
961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
962#[serde_with::serde_as]
963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
964pub struct GoogleCloudDatacatalogV1FieldType {
965 /// An enum type.
966 #[serde(rename = "enumType")]
967 pub enum_type: Option<GoogleCloudDatacatalogV1FieldTypeEnumType>,
968 /// Primitive types, such as string, boolean, etc.
969 #[serde(rename = "primitiveType")]
970 pub primitive_type: Option<String>,
971}
972
973impl common::Part for GoogleCloudDatacatalogV1FieldType {}
974
975/// There is no detailed description.
976///
977/// This type is not used in any activity, and only used as *part* of another schema.
978///
979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
980#[serde_with::serde_as]
981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
982pub struct GoogleCloudDatacatalogV1FieldTypeEnumType {
983 /// The set of allowed values for this enum. This set must not be empty and can include up to 100 allowed values. The display names of the values in this set must not be empty and must be case-insensitively unique within this set. The order of items in this set is preserved. This field can be used to create, remove, and reorder enum values. To rename enum values, use the `RenameTagTemplateFieldEnumValue` method.
984 #[serde(rename = "allowedValues")]
985 pub allowed_values: Option<Vec<GoogleCloudDatacatalogV1FieldTypeEnumTypeEnumValue>>,
986}
987
988impl common::Part for GoogleCloudDatacatalogV1FieldTypeEnumType {}
989
990/// There is no detailed description.
991///
992/// This type is not used in any activity, and only used as *part* of another schema.
993///
994#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
995#[serde_with::serde_as]
996#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
997pub struct GoogleCloudDatacatalogV1FieldTypeEnumTypeEnumValue {
998 /// Required. The display name of the enum value. Must not be an empty string. The name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), and can't start or end with spaces. The maximum length is 200 characters.
999 #[serde(rename = "displayName")]
1000 pub display_name: Option<String>,
1001}
1002
1003impl common::Part for GoogleCloudDatacatalogV1FieldTypeEnumTypeEnumValue {}
1004
1005/// Specification that applies to a fileset. Valid only for entries with the 'FILESET' type.
1006///
1007/// This type is not used in any activity, and only used as *part* of another schema.
1008///
1009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1010#[serde_with::serde_as]
1011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1012pub struct GoogleCloudDatacatalogV1FilesetSpec {
1013 /// Fields specific to a Dataplex Universal Catalog fileset and present only in the Dataplex Universal Catalog fileset entries.
1014 #[serde(rename = "dataplexFileset")]
1015 pub dataplex_fileset: Option<GoogleCloudDatacatalogV1DataplexFilesetSpec>,
1016}
1017
1018impl common::Part for GoogleCloudDatacatalogV1FilesetSpec {}
1019
1020/// Specification of a single file in Cloud Storage.
1021///
1022/// This type is not used in any activity, and only used as *part* of another schema.
1023///
1024#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1025#[serde_with::serde_as]
1026#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1027pub struct GoogleCloudDatacatalogV1GcsFileSpec {
1028 /// Required. Full file path. Example: `gs://bucket_name/a/b.txt`.
1029 #[serde(rename = "filePath")]
1030 pub file_path: Option<String>,
1031 /// Output only. Creation, modification, and expiration timestamps of a Cloud Storage file.
1032 #[serde(rename = "gcsTimestamps")]
1033 pub gcs_timestamps: Option<GoogleCloudDatacatalogV1SystemTimestamps>,
1034 /// Output only. File size in bytes.
1035 #[serde(rename = "sizeBytes")]
1036 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1037 pub size_bytes: Option<i64>,
1038}
1039
1040impl common::Part for GoogleCloudDatacatalogV1GcsFileSpec {}
1041
1042/// Describes a Cloud Storage fileset entry.
1043///
1044/// This type is not used in any activity, and only used as *part* of another schema.
1045///
1046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1047#[serde_with::serde_as]
1048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1049pub struct GoogleCloudDatacatalogV1GcsFilesetSpec {
1050 /// Required. Patterns to identify a set of files in Google Cloud Storage. For more information, see [Wildcard Names] (https://cloud.google.com/storage/docs/wildcards). Note: Currently, bucket wildcards are not supported. Examples of valid `file_patterns`: * `gs://bucket_name/dir/*`: matches all files in `bucket_name/dir` directory * `gs://bucket_name/dir/**`: matches all files in `bucket_name/dir` and all subdirectories * `gs://bucket_name/file*`: matches files prefixed by `file` in `bucket_name` * `gs://bucket_name/??.txt`: matches files with two characters followed by `.txt` in `bucket_name` * `gs://bucket_name/[aeiou].txt`: matches files that contain a single vowel character followed by `.txt` in `bucket_name` * `gs://bucket_name/[a-m].txt`: matches files that contain `a`, `b`, ... or `m` followed by `.txt` in `bucket_name` * `gs://bucket_name/a/*/b`: matches all files in `bucket_name` that match the `a/*/b` pattern, such as `a/c/b`, `a/d/b` * `gs://another_bucket/a.txt`: matches `gs://another_bucket/a.txt` You can combine wildcards to match complex sets of files, for example: `gs://bucket_name/[a-m]??.j*g`
1051 #[serde(rename = "filePatterns")]
1052 pub file_patterns: Option<Vec<String>>,
1053 /// Output only. Sample files contained in this fileset, not all files contained in this fileset are represented here.
1054 #[serde(rename = "sampleGcsFileSpecs")]
1055 pub sample_gcs_file_specs: Option<Vec<GoogleCloudDatacatalogV1GcsFileSpec>>,
1056}
1057
1058impl common::Part for GoogleCloudDatacatalogV1GcsFilesetSpec {}
1059
1060/// Specification that applies to a graph.
1061///
1062/// This type is not used in any activity, and only used as *part* of another schema.
1063///
1064#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1065#[serde_with::serde_as]
1066#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1067pub struct GoogleCloudDatacatalogV1GraphSpec {
1068 /// Optional. Edge tables of the graph.
1069 #[serde(rename = "edgeTables")]
1070 pub edge_tables: Option<Vec<GoogleCloudDatacatalogV1GraphSpecGraphElementTable>>,
1071 /// Output only. Fully qualified graph name. e.g. `named_catalog.MyGraph`
1072 pub name: Option<String>,
1073 /// Required. Node tables of the graph.
1074 #[serde(rename = "nodeTables")]
1075 pub node_tables: Option<Vec<GoogleCloudDatacatalogV1GraphSpecGraphElementTable>>,
1076}
1077
1078impl common::Part for GoogleCloudDatacatalogV1GraphSpec {}
1079
1080/// Element table definition.
1081///
1082/// This type is not used in any activity, and only used as *part* of another schema.
1083///
1084#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1085#[serde_with::serde_as]
1086#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1087pub struct GoogleCloudDatacatalogV1GraphSpecGraphElementTable {
1088 /// Required. The alias name of the graph element.
1089 pub alias: Option<String>,
1090 /// Required. The name of the data source. This is either a table name or a view name that is used for graph element input source. E.g. `Person` table or `PersonView` view.
1091 #[serde(rename = "dataSource")]
1092 pub data_source: Option<String>,
1093 /// Optional. The destination node reference of the edge.
1094 #[serde(rename = "destinationNodeReference")]
1095 pub destination_node_reference:
1096 Option<GoogleCloudDatacatalogV1GraphSpecGraphElementTableGraphNodeReference>,
1097 /// Optional. If set, this is the input column for dynamic label in schemaless data model.
1098 #[serde(rename = "dynamicLabelColumn")]
1099 pub dynamic_label_column: Option<String>,
1100 /// Optional. If set, this is the input column for dynamic properties in schemaless data model.
1101 #[serde(rename = "dynamicPropertiesColumn")]
1102 pub dynamic_properties_column: Option<String>,
1103 /// Required. The name of the keys of the elements in the table.
1104 #[serde(rename = "elementKeys")]
1105 pub element_keys: Option<Vec<String>>,
1106 /// Required. The input source of the graph element.
1107 #[serde(rename = "inputSource")]
1108 pub input_source: Option<String>,
1109 /// Required. The kind of the graph element.
1110 pub kind: Option<String>,
1111 /// Required. The labels and their properties for the graph element.
1112 #[serde(rename = "labelAndProperties")]
1113 pub label_and_properties:
1114 Option<Vec<GoogleCloudDatacatalogV1GraphSpecGraphElementTableLabelAndProperties>>,
1115 /// Optional. The source node reference of the edge.
1116 #[serde(rename = "sourceNodeReference")]
1117 pub source_node_reference:
1118 Option<GoogleCloudDatacatalogV1GraphSpecGraphElementTableGraphNodeReference>,
1119}
1120
1121impl common::Part for GoogleCloudDatacatalogV1GraphSpecGraphElementTable {}
1122
1123/// A reference to a source or destination node in a graph edge.
1124///
1125/// This type is not used in any activity, and only used as *part* of another schema.
1126///
1127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1128#[serde_with::serde_as]
1129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1130pub struct GoogleCloudDatacatalogV1GraphSpecGraphElementTableGraphNodeReference {
1131 /// Required. The referencing columns in the edge table. The size of `edge_table_columns` must be equal to the size of `node_table_columns`.
1132 #[serde(rename = "edgeTableColumns")]
1133 pub edge_table_columns: Option<Vec<String>>,
1134 /// Required. The reference to the source/destination node of the edge. This name must be a valid `alias` of a node element in the same graph. Example, `Person` node can be a source node name of an edge element `Person_to_Address`.
1135 #[serde(rename = "nodeAlias")]
1136 pub node_alias: Option<String>,
1137 /// Required. The referenced columns of the source node table.
1138 #[serde(rename = "nodeTableColumns")]
1139 pub node_table_columns: Option<Vec<String>>,
1140}
1141
1142impl common::Part for GoogleCloudDatacatalogV1GraphSpecGraphElementTableGraphNodeReference {}
1143
1144/// The label and its properties. Each label is associated with a set of properties.
1145///
1146/// This type is not used in any activity, and only used as *part* of another schema.
1147///
1148#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1149#[serde_with::serde_as]
1150#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1151pub struct GoogleCloudDatacatalogV1GraphSpecGraphElementTableLabelAndProperties {
1152 /// Required. The name of the label.
1153 pub label: Option<String>,
1154 /// Optional. The properties associated with the label.
1155 pub properties: Option<Vec<GoogleCloudDatacatalogV1GraphSpecGraphElementTableProperty>>,
1156}
1157
1158impl common::Part for GoogleCloudDatacatalogV1GraphSpecGraphElementTableLabelAndProperties {}
1159
1160/// A property declaration.
1161///
1162/// This type is not used in any activity, and only used as *part* of another schema.
1163///
1164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1165#[serde_with::serde_as]
1166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1167pub struct GoogleCloudDatacatalogV1GraphSpecGraphElementTableProperty {
1168 /// Required. Property name.
1169 pub name: Option<String>,
1170 /// Required. Property data type.
1171 #[serde(rename = "type")]
1172 pub type_: Option<String>,
1173}
1174
1175impl common::Part for GoogleCloudDatacatalogV1GraphSpecGraphElementTableProperty {}
1176
1177/// Request message for ImportEntries method.
1178///
1179/// # Activities
1180///
1181/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1182/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1183///
1184/// * [locations entry groups entries import projects](ProjectLocationEntryGroupEntryImportCall) (request)
1185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1186#[serde_with::serde_as]
1187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1188pub struct GoogleCloudDatacatalogV1ImportEntriesRequest {
1189 /// Path to a Cloud Storage bucket that contains a dump ready for ingestion.
1190 #[serde(rename = "gcsBucketPath")]
1191 pub gcs_bucket_path: Option<String>,
1192 /// Optional. (Optional) Dataplex Universal Catalog task job id, if specified will be used as part of ImportEntries LRO ID
1193 #[serde(rename = "jobId")]
1194 pub job_id: Option<String>,
1195}
1196
1197impl common::RequestValue for GoogleCloudDatacatalogV1ImportEntriesRequest {}
1198
1199/// Request message for ImportTaxonomies.
1200///
1201/// # Activities
1202///
1203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1205///
1206/// * [locations taxonomies import projects](ProjectLocationTaxonomyImportCall) (request)
1207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1208#[serde_with::serde_as]
1209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1210pub struct GoogleCloudDatacatalogV1ImportTaxonomiesRequest {
1211 /// Cross-regional source taxonomy to import.
1212 #[serde(rename = "crossRegionalSource")]
1213 pub cross_regional_source: Option<GoogleCloudDatacatalogV1CrossRegionalSource>,
1214 /// Inline source taxonomy to import.
1215 #[serde(rename = "inlineSource")]
1216 pub inline_source: Option<GoogleCloudDatacatalogV1InlineSource>,
1217}
1218
1219impl common::RequestValue for GoogleCloudDatacatalogV1ImportTaxonomiesRequest {}
1220
1221/// Response message for ImportTaxonomies.
1222///
1223/// # Activities
1224///
1225/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1226/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1227///
1228/// * [locations taxonomies import projects](ProjectLocationTaxonomyImportCall) (response)
1229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1230#[serde_with::serde_as]
1231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1232pub struct GoogleCloudDatacatalogV1ImportTaxonomiesResponse {
1233 /// Imported taxonomies.
1234 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1Taxonomy>>,
1235}
1236
1237impl common::ResponseResult for GoogleCloudDatacatalogV1ImportTaxonomiesResponse {}
1238
1239/// Inline source containing taxonomies to import.
1240///
1241/// This type is not used in any activity, and only used as *part* of another schema.
1242///
1243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1244#[serde_with::serde_as]
1245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1246pub struct GoogleCloudDatacatalogV1InlineSource {
1247 /// Required. Taxonomies to import.
1248 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1SerializedTaxonomy>>,
1249}
1250
1251impl common::Part for GoogleCloudDatacatalogV1InlineSource {}
1252
1253/// Response message for ListEntries.
1254///
1255/// # Activities
1256///
1257/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1258/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1259///
1260/// * [locations entry groups entries list projects](ProjectLocationEntryGroupEntryListCall) (response)
1261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1262#[serde_with::serde_as]
1263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1264pub struct GoogleCloudDatacatalogV1ListEntriesResponse {
1265 /// Entry details.
1266 pub entries: Option<Vec<GoogleCloudDatacatalogV1Entry>>,
1267 /// Pagination token of the next results page. Empty if there are no more items in results.
1268 #[serde(rename = "nextPageToken")]
1269 pub next_page_token: Option<String>,
1270}
1271
1272impl common::ResponseResult for GoogleCloudDatacatalogV1ListEntriesResponse {}
1273
1274/// Response message for ListEntryGroups.
1275///
1276/// # Activities
1277///
1278/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1279/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1280///
1281/// * [locations entry groups list projects](ProjectLocationEntryGroupListCall) (response)
1282#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1283#[serde_with::serde_as]
1284#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1285pub struct GoogleCloudDatacatalogV1ListEntryGroupsResponse {
1286 /// Entry group details.
1287 #[serde(rename = "entryGroups")]
1288 pub entry_groups: Option<Vec<GoogleCloudDatacatalogV1EntryGroup>>,
1289 /// Pagination token to specify in the next call to retrieve the next page of results. Empty if there are no more items.
1290 #[serde(rename = "nextPageToken")]
1291 pub next_page_token: Option<String>,
1292}
1293
1294impl common::ResponseResult for GoogleCloudDatacatalogV1ListEntryGroupsResponse {}
1295
1296/// Response message for ListPolicyTags.
1297///
1298/// # Activities
1299///
1300/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1301/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1302///
1303/// * [locations taxonomies policy tags list projects](ProjectLocationTaxonomyPolicyTagListCall) (response)
1304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1305#[serde_with::serde_as]
1306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1307pub struct GoogleCloudDatacatalogV1ListPolicyTagsResponse {
1308 /// Pagination token of the next results page. Empty if there are no more results in the list.
1309 #[serde(rename = "nextPageToken")]
1310 pub next_page_token: Option<String>,
1311 /// The policy tags that belong to the taxonomy.
1312 #[serde(rename = "policyTags")]
1313 pub policy_tags: Option<Vec<GoogleCloudDatacatalogV1PolicyTag>>,
1314}
1315
1316impl common::ResponseResult for GoogleCloudDatacatalogV1ListPolicyTagsResponse {}
1317
1318/// Response message for ListTags.
1319///
1320/// # Activities
1321///
1322/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1323/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1324///
1325/// * [locations entry groups entries tags list projects](ProjectLocationEntryGroupEntryTagListCall) (response)
1326/// * [locations entry groups tags list projects](ProjectLocationEntryGroupTagListCall) (response)
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct GoogleCloudDatacatalogV1ListTagsResponse {
1331 /// Pagination token of the next results page. Empty if there are no more items in results.
1332 #[serde(rename = "nextPageToken")]
1333 pub next_page_token: Option<String>,
1334 /// Tag details.
1335 pub tags: Option<Vec<GoogleCloudDatacatalogV1Tag>>,
1336}
1337
1338impl common::ResponseResult for GoogleCloudDatacatalogV1ListTagsResponse {}
1339
1340/// Response message for ListTaxonomies.
1341///
1342/// # Activities
1343///
1344/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1345/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1346///
1347/// * [locations taxonomies list projects](ProjectLocationTaxonomyListCall) (response)
1348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1349#[serde_with::serde_as]
1350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1351pub struct GoogleCloudDatacatalogV1ListTaxonomiesResponse {
1352 /// Pagination token of the next results page. Empty if there are no more results in the list.
1353 #[serde(rename = "nextPageToken")]
1354 pub next_page_token: Option<String>,
1355 /// Taxonomies that the project contains.
1356 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1Taxonomy>>,
1357}
1358
1359impl common::ResponseResult for GoogleCloudDatacatalogV1ListTaxonomiesResponse {}
1360
1361/// Specification that applies to entries that are part `LOOKER` system (user_specified_type)
1362///
1363/// This type is not used in any activity, and only used as *part* of another schema.
1364///
1365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1366#[serde_with::serde_as]
1367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1368pub struct GoogleCloudDatacatalogV1LookerSystemSpec {
1369 /// Name of the parent Looker Instance. Empty if it does not exist.
1370 #[serde(rename = "parentInstanceDisplayName")]
1371 pub parent_instance_display_name: Option<String>,
1372 /// ID of the parent Looker Instance. Empty if it does not exist. Example value: `someinstance.looker.com`
1373 #[serde(rename = "parentInstanceId")]
1374 pub parent_instance_id: Option<String>,
1375 /// Name of the parent Model. Empty if it does not exist.
1376 #[serde(rename = "parentModelDisplayName")]
1377 pub parent_model_display_name: Option<String>,
1378 /// ID of the parent Model. Empty if it does not exist.
1379 #[serde(rename = "parentModelId")]
1380 pub parent_model_id: Option<String>,
1381 /// Name of the parent View. Empty if it does not exist.
1382 #[serde(rename = "parentViewDisplayName")]
1383 pub parent_view_display_name: Option<String>,
1384 /// ID of the parent View. Empty if it does not exist.
1385 #[serde(rename = "parentViewId")]
1386 pub parent_view_id: Option<String>,
1387}
1388
1389impl common::Part for GoogleCloudDatacatalogV1LookerSystemSpec {}
1390
1391/// The configuration related to the migration to Dataplex Universal Catalog applied to an organization or project. It is the response message for SetConfig and RetrieveEffectiveConfig.
1392///
1393/// # Activities
1394///
1395/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1396/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1397///
1398/// * [locations retrieve effective config organizations](OrganizationLocationRetrieveEffectiveConfigCall) (response)
1399/// * [locations set config organizations](OrganizationLocationSetConfigCall) (response)
1400/// * [locations retrieve effective config projects](ProjectLocationRetrieveEffectiveConfigCall) (response)
1401/// * [locations set config projects](ProjectLocationSetConfigCall) (response)
1402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1403#[serde_with::serde_as]
1404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1405pub struct GoogleCloudDatacatalogV1MigrationConfig {
1406 /// Opt-in status for the UI switch to Dataplex Universal Catalog.
1407 #[serde(rename = "catalogUiExperience")]
1408 pub catalog_ui_experience: Option<String>,
1409 /// Opt-in status for the migration of Tag Templates to Dataplex Universal Catalog.
1410 #[serde(rename = "tagTemplateMigration")]
1411 pub tag_template_migration: Option<String>,
1412 /// The time when the Tag Template migration was enabled. If the Tag Template migration is not enabled, this field is not set.
1413 #[serde(rename = "templateMigrationEnabledTime")]
1414 pub template_migration_enabled_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1415}
1416
1417impl common::ResponseResult for GoogleCloudDatacatalogV1MigrationConfig {}
1418
1419/// Specification that applies to a model. Valid only for entries with the `MODEL` type.
1420///
1421/// This type is not used in any activity, and only used as *part* of another schema.
1422///
1423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1424#[serde_with::serde_as]
1425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1426pub struct GoogleCloudDatacatalogV1ModelSpec {
1427 /// Specification for vertex model resources.
1428 #[serde(rename = "vertexModelSpec")]
1429 pub vertex_model_spec: Option<GoogleCloudDatacatalogV1VertexModelSpec>,
1430}
1431
1432impl common::Part for GoogleCloudDatacatalogV1ModelSpec {}
1433
1434/// Request message for ModifyEntryContacts.
1435///
1436/// # Activities
1437///
1438/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1439/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1440///
1441/// * [locations entry groups entries modify entry contacts projects](ProjectLocationEntryGroupEntryModifyEntryContactCall) (request)
1442#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1443#[serde_with::serde_as]
1444#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1445pub struct GoogleCloudDatacatalogV1ModifyEntryContactsRequest {
1446 /// Required. The new value for the Contacts.
1447 pub contacts: Option<GoogleCloudDatacatalogV1Contacts>,
1448}
1449
1450impl common::RequestValue for GoogleCloudDatacatalogV1ModifyEntryContactsRequest {}
1451
1452/// Request message for ModifyEntryOverview.
1453///
1454/// # Activities
1455///
1456/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1457/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1458///
1459/// * [locations entry groups entries modify entry overview projects](ProjectLocationEntryGroupEntryModifyEntryOverviewCall) (request)
1460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1461#[serde_with::serde_as]
1462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1463pub struct GoogleCloudDatacatalogV1ModifyEntryOverviewRequest {
1464 /// Required. The new value for the Entry Overview.
1465 #[serde(rename = "entryOverview")]
1466 pub entry_overview: Option<GoogleCloudDatacatalogV1EntryOverview>,
1467}
1468
1469impl common::RequestValue for GoogleCloudDatacatalogV1ModifyEntryOverviewRequest {}
1470
1471/// The configuration related to the migration from Data Catalog to Dataplex Universal Catalog that has been applied to an organization and any projects under it. It is the response message for RetrieveConfig.
1472///
1473/// # Activities
1474///
1475/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1476/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1477///
1478/// * [locations retrieve config organizations](OrganizationLocationRetrieveConfigCall) (response)
1479#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1480#[serde_with::serde_as]
1481#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1482pub struct GoogleCloudDatacatalogV1OrganizationConfig {
1483 /// Map of organizations and project resource names and their configuration. The format for the map keys is `organizations/{organizationId}` or `projects/{projectId}`.
1484 pub config: Option<HashMap<String, GoogleCloudDatacatalogV1MigrationConfig>>,
1485}
1486
1487impl common::ResponseResult for GoogleCloudDatacatalogV1OrganizationConfig {}
1488
1489/// Entry metadata relevant only to the user and private to them.
1490///
1491/// This type is not used in any activity, and only used as *part* of another schema.
1492///
1493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1494#[serde_with::serde_as]
1495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1496pub struct GoogleCloudDatacatalogV1PersonalDetails {
1497 /// Set if the entry is starred; unset otherwise.
1498 #[serde(rename = "starTime")]
1499 pub star_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1500 /// True if the entry is starred by the user; false otherwise.
1501 pub starred: Option<bool>,
1502}
1503
1504impl common::Part for GoogleCloudDatacatalogV1PersonalDetails {}
1505
1506/// Native schema used by a resource represented as an entry. Used by query engines for deserializing and parsing source data.
1507///
1508/// This type is not used in any activity, and only used as *part* of another schema.
1509///
1510#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1511#[serde_with::serde_as]
1512#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1513pub struct GoogleCloudDatacatalogV1PhysicalSchema {
1514 /// Schema in Avro JSON format.
1515 pub avro: Option<GoogleCloudDatacatalogV1PhysicalSchemaAvroSchema>,
1516 /// Marks a CSV-encoded data source.
1517 pub csv: Option<GoogleCloudDatacatalogV1PhysicalSchemaCsvSchema>,
1518 /// Marks an ORC-encoded data source.
1519 pub orc: Option<GoogleCloudDatacatalogV1PhysicalSchemaOrcSchema>,
1520 /// Marks a Parquet-encoded data source.
1521 pub parquet: Option<GoogleCloudDatacatalogV1PhysicalSchemaParquetSchema>,
1522 /// Schema in protocol buffer format.
1523 pub protobuf: Option<GoogleCloudDatacatalogV1PhysicalSchemaProtobufSchema>,
1524 /// Schema in Thrift format.
1525 pub thrift: Option<GoogleCloudDatacatalogV1PhysicalSchemaThriftSchema>,
1526}
1527
1528impl common::Part for GoogleCloudDatacatalogV1PhysicalSchema {}
1529
1530/// Schema in Avro JSON format.
1531///
1532/// This type is not used in any activity, and only used as *part* of another schema.
1533///
1534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1535#[serde_with::serde_as]
1536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1537pub struct GoogleCloudDatacatalogV1PhysicalSchemaAvroSchema {
1538 /// JSON source of the Avro schema.
1539 pub text: Option<String>,
1540}
1541
1542impl common::Part for GoogleCloudDatacatalogV1PhysicalSchemaAvroSchema {}
1543
1544/// Marks a CSV-encoded data source.
1545///
1546/// This type is not used in any activity, and only used as *part* of another schema.
1547///
1548#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1549#[serde_with::serde_as]
1550#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1551pub struct GoogleCloudDatacatalogV1PhysicalSchemaCsvSchema {
1552 _never_set: Option<bool>,
1553}
1554
1555impl common::Part for GoogleCloudDatacatalogV1PhysicalSchemaCsvSchema {}
1556
1557/// Marks an ORC-encoded data source.
1558///
1559/// This type is not used in any activity, and only used as *part* of another schema.
1560///
1561#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1562#[serde_with::serde_as]
1563#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1564pub struct GoogleCloudDatacatalogV1PhysicalSchemaOrcSchema {
1565 _never_set: Option<bool>,
1566}
1567
1568impl common::Part for GoogleCloudDatacatalogV1PhysicalSchemaOrcSchema {}
1569
1570/// Marks a Parquet-encoded data source.
1571///
1572/// This type is not used in any activity, and only used as *part* of another schema.
1573///
1574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1575#[serde_with::serde_as]
1576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1577pub struct GoogleCloudDatacatalogV1PhysicalSchemaParquetSchema {
1578 _never_set: Option<bool>,
1579}
1580
1581impl common::Part for GoogleCloudDatacatalogV1PhysicalSchemaParquetSchema {}
1582
1583/// Schema in protocol buffer format.
1584///
1585/// This type is not used in any activity, and only used as *part* of another schema.
1586///
1587#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1588#[serde_with::serde_as]
1589#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1590pub struct GoogleCloudDatacatalogV1PhysicalSchemaProtobufSchema {
1591 /// Protocol buffer source of the schema.
1592 pub text: Option<String>,
1593}
1594
1595impl common::Part for GoogleCloudDatacatalogV1PhysicalSchemaProtobufSchema {}
1596
1597/// Schema in Thrift format.
1598///
1599/// This type is not used in any activity, and only used as *part* of another schema.
1600///
1601#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1602#[serde_with::serde_as]
1603#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1604pub struct GoogleCloudDatacatalogV1PhysicalSchemaThriftSchema {
1605 /// Thrift IDL source of the schema.
1606 pub text: Option<String>,
1607}
1608
1609impl common::Part for GoogleCloudDatacatalogV1PhysicalSchemaThriftSchema {}
1610
1611/// Denotes one policy tag in a taxonomy, for example, SSN. Policy tags can be defined in a hierarchy. For example: `+ Geolocation + LatLong + City + ZipCode` Where the “Geolocation” policy tag contains three children.
1612///
1613/// # Activities
1614///
1615/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1616/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1617///
1618/// * [locations taxonomies policy tags create projects](ProjectLocationTaxonomyPolicyTagCreateCall) (request|response)
1619/// * [locations taxonomies policy tags get projects](ProjectLocationTaxonomyPolicyTagGetCall) (response)
1620/// * [locations taxonomies policy tags patch projects](ProjectLocationTaxonomyPolicyTagPatchCall) (request|response)
1621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1622#[serde_with::serde_as]
1623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1624pub struct GoogleCloudDatacatalogV1PolicyTag {
1625 /// Output only. Resource names of child policy tags of this policy tag.
1626 #[serde(rename = "childPolicyTags")]
1627 pub child_policy_tags: Option<Vec<String>>,
1628 /// Description of this policy tag. If not set, defaults to empty. The description must contain only Unicode characters, tabs, newlines, carriage returns and page breaks, and be at most 2000 bytes long when encoded in UTF-8.
1629 pub description: Option<String>,
1630 /// Required. User-defined name of this policy tag. The name can't start or end with spaces and must be unique within the parent taxonomy, contain only Unicode letters, numbers, underscores, dashes and spaces, and be at most 200 bytes long when encoded in UTF-8.
1631 #[serde(rename = "displayName")]
1632 pub display_name: Option<String>,
1633 /// Identifier. Resource name of this policy tag in the URL format. The policy tag manager generates unique taxonomy IDs and policy tag IDs.
1634 pub name: Option<String>,
1635 /// Resource name of this policy tag's parent policy tag. If empty, this is a top level tag. If not set, defaults to an empty string. For example, for the "LatLong" policy tag in the example above, this field contains the resource name of the "Geolocation" policy tag, and, for "Geolocation", this field is empty.
1636 #[serde(rename = "parentPolicyTag")]
1637 pub parent_policy_tag: Option<String>,
1638}
1639
1640impl common::RequestValue for GoogleCloudDatacatalogV1PolicyTag {}
1641impl common::ResponseResult for GoogleCloudDatacatalogV1PolicyTag {}
1642
1643/// Request message for ReconcileTags.
1644///
1645/// # Activities
1646///
1647/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1648/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1649///
1650/// * [locations entry groups entries tags reconcile projects](ProjectLocationEntryGroupEntryTagReconcileCall) (request)
1651#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1652#[serde_with::serde_as]
1653#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1654pub struct GoogleCloudDatacatalogV1ReconcileTagsRequest {
1655 /// no description provided
1656 #[serde(rename = "forceDeleteMissing")]
1657 pub force_delete_missing: Option<bool>,
1658 /// Required. The name of the tag template, which is used for reconciliation.
1659 #[serde(rename = "tagTemplate")]
1660 pub tag_template: Option<String>,
1661 /// A list of tags to apply to an entry. A tag can specify a tag template, which must be the template specified in the `ReconcileTagsRequest`. The sole entry and each of its columns must be mentioned at most once.
1662 pub tags: Option<Vec<GoogleCloudDatacatalogV1Tag>>,
1663}
1664
1665impl common::RequestValue for GoogleCloudDatacatalogV1ReconcileTagsRequest {}
1666
1667/// Request message for RenameTagTemplateFieldEnumValue.
1668///
1669/// # Activities
1670///
1671/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1672/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1673///
1674/// * [locations tag templates fields enum values rename projects](ProjectLocationTagTemplateFieldEnumValueRenameCall) (request)
1675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1676#[serde_with::serde_as]
1677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1678pub struct GoogleCloudDatacatalogV1RenameTagTemplateFieldEnumValueRequest {
1679 /// Required. The new display name of the enum value. For example, `my_new_enum_value`.
1680 #[serde(rename = "newEnumValueDisplayName")]
1681 pub new_enum_value_display_name: Option<String>,
1682}
1683
1684impl common::RequestValue for GoogleCloudDatacatalogV1RenameTagTemplateFieldEnumValueRequest {}
1685
1686/// Request message for RenameTagTemplateField.
1687///
1688/// # Activities
1689///
1690/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1691/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1692///
1693/// * [locations tag templates fields rename projects](ProjectLocationTagTemplateFieldRenameCall) (request)
1694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1695#[serde_with::serde_as]
1696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1697pub struct GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest {
1698 /// Required. The new ID of this tag template field. For example, `my_new_field`.
1699 #[serde(rename = "newTagTemplateFieldId")]
1700 pub new_tag_template_field_id: Option<String>,
1701}
1702
1703impl common::RequestValue for GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest {}
1704
1705/// Request message for ReplaceTaxonomy.
1706///
1707/// # Activities
1708///
1709/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1710/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1711///
1712/// * [locations taxonomies replace projects](ProjectLocationTaxonomyReplaceCall) (request)
1713#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1714#[serde_with::serde_as]
1715#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1716pub struct GoogleCloudDatacatalogV1ReplaceTaxonomyRequest {
1717 /// Required. Taxonomy to update along with its child policy tags.
1718 #[serde(rename = "serializedTaxonomy")]
1719 pub serialized_taxonomy: Option<GoogleCloudDatacatalogV1SerializedTaxonomy>,
1720}
1721
1722impl common::RequestValue for GoogleCloudDatacatalogV1ReplaceTaxonomyRequest {}
1723
1724/// Specification that applies to a routine. Valid only for entries with the `ROUTINE` type.
1725///
1726/// This type is not used in any activity, and only used as *part* of another schema.
1727///
1728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1729#[serde_with::serde_as]
1730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1731pub struct GoogleCloudDatacatalogV1RoutineSpec {
1732 /// Fields specific for BigQuery routines.
1733 #[serde(rename = "bigqueryRoutineSpec")]
1734 pub bigquery_routine_spec: Option<GoogleCloudDatacatalogV1BigQueryRoutineSpec>,
1735 /// The body of the routine.
1736 #[serde(rename = "definitionBody")]
1737 pub definition_body: Option<String>,
1738 /// The language the routine is written in. The exact value depends on the source system. For BigQuery routines, possible values are: * `SQL` * `JAVASCRIPT`
1739 pub language: Option<String>,
1740 /// Return type of the argument. The exact value depends on the source system and the language.
1741 #[serde(rename = "returnType")]
1742 pub return_type: Option<String>,
1743 /// Arguments of the routine.
1744 #[serde(rename = "routineArguments")]
1745 pub routine_arguments: Option<Vec<GoogleCloudDatacatalogV1RoutineSpecArgument>>,
1746 /// The type of the routine.
1747 #[serde(rename = "routineType")]
1748 pub routine_type: Option<String>,
1749}
1750
1751impl common::Part for GoogleCloudDatacatalogV1RoutineSpec {}
1752
1753/// Input or output argument of a function or stored procedure.
1754///
1755/// This type is not used in any activity, and only used as *part* of another schema.
1756///
1757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1758#[serde_with::serde_as]
1759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1760pub struct GoogleCloudDatacatalogV1RoutineSpecArgument {
1761 /// Specifies whether the argument is input or output.
1762 pub mode: Option<String>,
1763 /// The name of the argument. A return argument of a function might not have a name.
1764 pub name: Option<String>,
1765 /// Type of the argument. The exact value depends on the source system and the language.
1766 #[serde(rename = "type")]
1767 pub type_: Option<String>,
1768}
1769
1770impl common::Part for GoogleCloudDatacatalogV1RoutineSpecArgument {}
1771
1772/// Represents a schema, for example, a BigQuery, GoogleSQL, or Avro schema.
1773///
1774/// This type is not used in any activity, and only used as *part* of another schema.
1775///
1776#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1777#[serde_with::serde_as]
1778#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1779pub struct GoogleCloudDatacatalogV1Schema {
1780 /// The unified GoogleSQL-like schema of columns. The overall maximum number of columns and nested columns is 10,000. The maximum nested depth is 15 levels.
1781 pub columns: Option<Vec<GoogleCloudDatacatalogV1ColumnSchema>>,
1782}
1783
1784impl common::Part for GoogleCloudDatacatalogV1Schema {}
1785
1786/// Request message for SearchCatalog.
1787///
1788/// # Activities
1789///
1790/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1791/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1792///
1793/// * [search catalog](CatalogSearchCall) (request)
1794#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1795#[serde_with::serde_as]
1796#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1797pub struct GoogleCloudDatacatalogV1SearchCatalogRequest {
1798 /// Optional. If set, use searchAll permission granted on organizations from `include_org_ids` and projects from `include_project_ids` instead of the fine grained per resource permissions when filtering the search results. The only allowed `order_by` criteria for admin_search mode is `default`. Using this flags guarantees a full recall of the search results.
1799 #[serde(rename = "adminSearch")]
1800 pub admin_search: Option<bool>,
1801 /// Specifies the order of results. Currently supported case-sensitive values are: * `relevance` that can only be descending * `last_modified_timestamp [asc|desc]` with descending (`desc`) as default * `default` that can only be descending Search queries don't guarantee full recall. Results that match your query might not be returned, even in subsequent result pages. Additionally, returned (and not returned) results can vary if you repeat search queries. If you are experiencing recall issues and you don't have to fetch the results in any specific order, consider setting this parameter to `default`. If this parameter is omitted, it defaults to the descending `relevance`.
1802 #[serde(rename = "orderBy")]
1803 pub order_by: Option<String>,
1804 /// Upper bound on the number of results you can get in a single response. Can't be negative or 0, defaults to 10 in this case. The maximum number is 1000. If exceeded, throws an "invalid argument" exception.
1805 #[serde(rename = "pageSize")]
1806 pub page_size: Option<i32>,
1807 /// Optional. Pagination token that, if specified, returns the next page of search results. If empty, returns the first page. This token is returned in the SearchCatalogResponse.next_page_token field of the response to a previous SearchCatalogRequest call.
1808 #[serde(rename = "pageToken")]
1809 pub page_token: Option<String>,
1810 /// Optional. The query string with a minimum of 3 characters and specific syntax. For more information, see [Data Catalog search syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference). An empty query string returns all data assets (in the specified scope) that you have access to. A query string can be a simple `xyz` or qualified by predicates: * `name:x` * `column:y` * `description:z`
1811 pub query: Option<String>,
1812 /// Required. The scope of this search request. The `scope` is invalid if `include_org_ids`, `include_project_ids` are empty AND `include_gcp_public_datasets` is set to `false`. In this case, the request returns an error.
1813 pub scope: Option<GoogleCloudDatacatalogV1SearchCatalogRequestScope>,
1814}
1815
1816impl common::RequestValue for GoogleCloudDatacatalogV1SearchCatalogRequest {}
1817
1818/// The criteria that select the subspace used for query matching.
1819///
1820/// This type is not used in any activity, and only used as *part* of another schema.
1821///
1822#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1823#[serde_with::serde_as]
1824#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1825pub struct GoogleCloudDatacatalogV1SearchCatalogRequestScope {
1826 /// If `true`, include Google Cloud public datasets in search results. By default, they are excluded. See [Google Cloud Public Datasets](https://cloud.google.com/public-datasets) for more information.
1827 #[serde(rename = "includeGcpPublicDatasets")]
1828 pub include_gcp_public_datasets: Option<bool>,
1829 /// The list of organization IDs to search within. To find your organization ID, follow the steps from \[Creating and managing organizations\] (/resource-manager/docs/creating-managing-organization).
1830 #[serde(rename = "includeOrgIds")]
1831 pub include_org_ids: Option<Vec<String>>,
1832 /// The list of project IDs to search within. For more information on the distinction between project names, IDs, and numbers, see [Projects](https://cloud.google.com/docs/overview/#projects).
1833 #[serde(rename = "includeProjectIds")]
1834 pub include_project_ids: Option<Vec<String>>,
1835 /// Optional. This field is deprecated. The search mechanism for public and private tag templates is the same.
1836 #[serde(rename = "includePublicTagTemplates")]
1837 pub include_public_tag_templates: Option<bool>,
1838 /// Optional. The list of locations to search within. If empty, all locations are searched. Returns an error if any location in the list isn't one of the [Supported regions](https://cloud.google.com/data-catalog/docs/concepts/regions#supported_regions). If a location is unreachable, its name is returned in the `SearchCatalogResponse.unreachable` field. To get additional information on the error, repeat the search request and set the location name as the value of this parameter.
1839 #[serde(rename = "restrictedLocations")]
1840 pub restricted_locations: Option<Vec<String>>,
1841 /// Optional. If `true`, search only among starred entries. By default, all results are returned, starred or not.
1842 #[serde(rename = "starredOnly")]
1843 pub starred_only: Option<bool>,
1844}
1845
1846impl common::Part for GoogleCloudDatacatalogV1SearchCatalogRequestScope {}
1847
1848/// Response message for SearchCatalog.
1849///
1850/// # Activities
1851///
1852/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1853/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1854///
1855/// * [search catalog](CatalogSearchCall) (response)
1856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1857#[serde_with::serde_as]
1858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1859pub struct GoogleCloudDatacatalogV1SearchCatalogResponse {
1860 /// Pagination token that can be used in subsequent calls to retrieve the next page of results.
1861 #[serde(rename = "nextPageToken")]
1862 pub next_page_token: Option<String>,
1863 /// Search results.
1864 pub results: Option<Vec<GoogleCloudDatacatalogV1SearchCatalogResult>>,
1865 /// The approximate total number of entries matched by the query.
1866 #[serde(rename = "totalSize")]
1867 pub total_size: Option<i32>,
1868 /// Unreachable locations. Search results don't include data from those locations. To get additional information on an error, repeat the search request and restrict it to specific locations by setting the `SearchCatalogRequest.scope.restricted_locations` parameter.
1869 pub unreachable: Option<Vec<String>>,
1870}
1871
1872impl common::ResponseResult for GoogleCloudDatacatalogV1SearchCatalogResponse {}
1873
1874/// Result in the response to a search request. Each result captures details of one entry that matches the search.
1875///
1876/// This type is not used in any activity, and only used as *part* of another schema.
1877///
1878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1879#[serde_with::serde_as]
1880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1881pub struct GoogleCloudDatacatalogV1SearchCatalogResult {
1882 /// Entry description that can consist of several sentences or paragraphs that describe entry contents.
1883 pub description: Option<String>,
1884 /// The display name of the result.
1885 #[serde(rename = "displayName")]
1886 pub display_name: Option<String>,
1887 /// Fully qualified name (FQN) of the resource. FQNs take two forms: * For non-regionalized resources: `{SYSTEM}:{PROJECT}.{PATH_TO_RESOURCE_SEPARATED_WITH_DOTS}` * For regionalized resources: `{SYSTEM}:{PROJECT}.{LOCATION_ID}.{PATH_TO_RESOURCE_SEPARATED_WITH_DOTS}` Example for a DPMS table: `dataproc_metastore:PROJECT_ID.LOCATION_ID.INSTANCE_ID.DATABASE_ID.TABLE_ID`
1888 #[serde(rename = "fullyQualifiedName")]
1889 pub fully_qualified_name: Option<String>,
1890 /// Output only. The source system that Data Catalog automatically integrates with, such as BigQuery, Cloud Pub/Sub, or Dataproc Metastore.
1891 #[serde(rename = "integratedSystem")]
1892 pub integrated_system: Option<String>,
1893 /// The full name of the Google Cloud resource the entry belongs to. For more information, see \[Full Resource Name\] (/apis/design/resource_names#full_resource_name). Example: `//bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID`
1894 #[serde(rename = "linkedResource")]
1895 pub linked_resource: Option<String>,
1896 /// The last modification timestamp of the entry in the source system.
1897 #[serde(rename = "modifyTime")]
1898 pub modify_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1899 /// The relative name of the resource in URL format. Examples: * `projects/{PROJECT_ID}/locations/{LOCATION_ID}/entryGroups/{ENTRY_GROUP_ID}/entries/{ENTRY_ID}` * `projects/{PROJECT_ID}/tagTemplates/{TAG_TEMPLATE_ID}`
1900 #[serde(rename = "relativeResourceName")]
1901 pub relative_resource_name: Option<String>,
1902 /// Sub-type of the search result. A dot-delimited full type of the resource. The same type you specify in the `type` search predicate. Examples: `entry.table`, `entry.dataStream`, `tagTemplate`.
1903 #[serde(rename = "searchResultSubtype")]
1904 pub search_result_subtype: Option<String>,
1905 /// Type of the search result. You can use this field to determine which get method to call to fetch the full resource.
1906 #[serde(rename = "searchResultType")]
1907 pub search_result_type: Option<String>,
1908 /// Custom source system that you can manually integrate Data Catalog with.
1909 #[serde(rename = "userSpecifiedSystem")]
1910 pub user_specified_system: Option<String>,
1911}
1912
1913impl common::Part for GoogleCloudDatacatalogV1SearchCatalogResult {}
1914
1915/// A nested protocol buffer that represents a policy tag and all its descendants.
1916///
1917/// This type is not used in any activity, and only used as *part* of another schema.
1918///
1919#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1920#[serde_with::serde_as]
1921#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1922pub struct GoogleCloudDatacatalogV1SerializedPolicyTag {
1923 /// Children of the policy tag, if any.
1924 #[serde(rename = "childPolicyTags")]
1925 pub child_policy_tags: Option<Vec<GoogleCloudDatacatalogV1SerializedPolicyTag>>,
1926 /// Description of the serialized policy tag. At most 2000 bytes when encoded in UTF-8. If not set, defaults to an empty description.
1927 pub description: Option<String>,
1928 /// Required. Display name of the policy tag. At most 200 bytes when encoded in UTF-8.
1929 #[serde(rename = "displayName")]
1930 pub display_name: Option<String>,
1931 /// Resource name of the policy tag. This field is ignored when calling `ImportTaxonomies`.
1932 #[serde(rename = "policyTag")]
1933 pub policy_tag: Option<String>,
1934}
1935
1936impl common::Part for GoogleCloudDatacatalogV1SerializedPolicyTag {}
1937
1938/// A nested protocol buffer that represents a taxonomy and the hierarchy of its policy tags. Used for taxonomy replacement, import, and export.
1939///
1940/// This type is not used in any activity, and only used as *part* of another schema.
1941///
1942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1943#[serde_with::serde_as]
1944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1945pub struct GoogleCloudDatacatalogV1SerializedTaxonomy {
1946 /// A list of policy types that are activated per taxonomy.
1947 #[serde(rename = "activatedPolicyTypes")]
1948 pub activated_policy_types: Option<Vec<String>>,
1949 /// Description of the serialized taxonomy. At most 2000 bytes when encoded in UTF-8. If not set, defaults to an empty description.
1950 pub description: Option<String>,
1951 /// Required. Display name of the taxonomy. At most 200 bytes when encoded in UTF-8.
1952 #[serde(rename = "displayName")]
1953 pub display_name: Option<String>,
1954 /// Top level policy tags associated with the taxonomy, if any.
1955 #[serde(rename = "policyTags")]
1956 pub policy_tags: Option<Vec<GoogleCloudDatacatalogV1SerializedPolicyTag>>,
1957}
1958
1959impl common::Part for GoogleCloudDatacatalogV1SerializedTaxonomy {}
1960
1961/// Specification that applies to a Service resource. Valid only for entries with the `SERVICE` type.
1962///
1963/// This type is not used in any activity, and only used as *part* of another schema.
1964///
1965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1966#[serde_with::serde_as]
1967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1968pub struct GoogleCloudDatacatalogV1ServiceSpec {
1969 /// Specification that applies to Instance entries of `CLOUD_BIGTABLE` system.
1970 #[serde(rename = "cloudBigtableInstanceSpec")]
1971 pub cloud_bigtable_instance_spec: Option<GoogleCloudDatacatalogV1CloudBigtableInstanceSpec>,
1972}
1973
1974impl common::Part for GoogleCloudDatacatalogV1ServiceSpec {}
1975
1976/// Request message for SetConfig.
1977///
1978/// # Activities
1979///
1980/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1981/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1982///
1983/// * [locations set config organizations](OrganizationLocationSetConfigCall) (request)
1984/// * [locations set config projects](ProjectLocationSetConfigCall) (request)
1985#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1986#[serde_with::serde_as]
1987#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1988pub struct GoogleCloudDatacatalogV1SetConfigRequest {
1989 /// Opt-in status for the UI switch to Dataplex Universal Catalog.
1990 #[serde(rename = "catalogUiExperience")]
1991 pub catalog_ui_experience: Option<String>,
1992 /// Opt-in status for the migration of Tag Templates to Dataplex Universal Catalog.
1993 #[serde(rename = "tagTemplateMigration")]
1994 pub tag_template_migration: Option<String>,
1995}
1996
1997impl common::RequestValue for GoogleCloudDatacatalogV1SetConfigRequest {}
1998
1999/// Specification that applies to entries that are part `SQL_DATABASE` system (user_specified_type)
2000///
2001/// This type is not used in any activity, and only used as *part* of another schema.
2002///
2003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2004#[serde_with::serde_as]
2005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2006pub struct GoogleCloudDatacatalogV1SqlDatabaseSystemSpec {
2007 /// Version of the database engine.
2008 #[serde(rename = "databaseVersion")]
2009 pub database_version: Option<String>,
2010 /// Host of the SQL database enum InstanceHost { UNDEFINED = 0; SELF_HOSTED = 1; CLOUD_SQL = 2; AMAZON_RDS = 3; AZURE_SQL = 4; } Host of the enclousing database instance.
2011 #[serde(rename = "instanceHost")]
2012 pub instance_host: Option<String>,
2013 /// SQL Database Engine. enum SqlEngine { UNDEFINED = 0; MY_SQL = 1; POSTGRE_SQL = 2; SQL_SERVER = 3; } Engine of the enclosing database instance.
2014 #[serde(rename = "sqlEngine")]
2015 pub sql_engine: Option<String>,
2016}
2017
2018impl common::Part for GoogleCloudDatacatalogV1SqlDatabaseSystemSpec {}
2019
2020/// Request message for StarEntry.
2021///
2022/// # Activities
2023///
2024/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2025/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2026///
2027/// * [locations entry groups entries star projects](ProjectLocationEntryGroupEntryStarCall) (request)
2028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2029#[serde_with::serde_as]
2030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2031pub struct GoogleCloudDatacatalogV1StarEntryRequest {
2032 _never_set: Option<bool>,
2033}
2034
2035impl common::RequestValue for GoogleCloudDatacatalogV1StarEntryRequest {}
2036
2037/// Response message for StarEntry. Empty for now
2038///
2039/// # Activities
2040///
2041/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2042/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2043///
2044/// * [locations entry groups entries star projects](ProjectLocationEntryGroupEntryStarCall) (response)
2045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2046#[serde_with::serde_as]
2047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2048pub struct GoogleCloudDatacatalogV1StarEntryResponse {
2049 _never_set: Option<bool>,
2050}
2051
2052impl common::ResponseResult for GoogleCloudDatacatalogV1StarEntryResponse {}
2053
2054/// Details the properties of the underlying storage.
2055///
2056/// This type is not used in any activity, and only used as *part* of another schema.
2057///
2058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2059#[serde_with::serde_as]
2060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2061pub struct GoogleCloudDatacatalogV1StorageProperties {
2062 /// Patterns to identify a set of files for this fileset. Examples of a valid `file_pattern`: * `gs://bucket_name/dir/*`: matches all files in the `bucket_name/dir` directory * `gs://bucket_name/dir/**`: matches all files in the `bucket_name/dir` and all subdirectories recursively * `gs://bucket_name/file*`: matches files prefixed by `file` in `bucket_name` * `gs://bucket_name/??.txt`: matches files with two characters followed by `.txt` in `bucket_name` * `gs://bucket_name/[aeiou].txt`: matches files that contain a single vowel character followed by `.txt` in `bucket_name` * `gs://bucket_name/[a-m].txt`: matches files that contain `a`, `b`, ... or `m` followed by `.txt` in `bucket_name` * `gs://bucket_name/a/*/b`: matches all files in `bucket_name` that match the `a/*/b` pattern, such as `a/c/b`, `a/d/b` * `gs://another_bucket/a.txt`: matches `gs://another_bucket/a.txt`
2063 #[serde(rename = "filePattern")]
2064 pub file_pattern: Option<Vec<String>>,
2065 /// File type in MIME format, for example, `text/plain`.
2066 #[serde(rename = "fileType")]
2067 pub file_type: Option<String>,
2068}
2069
2070impl common::Part for GoogleCloudDatacatalogV1StorageProperties {}
2071
2072/// Timestamps associated with this resource in a particular system.
2073///
2074/// This type is not used in any activity, and only used as *part* of another schema.
2075///
2076#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2077#[serde_with::serde_as]
2078#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2079pub struct GoogleCloudDatacatalogV1SystemTimestamps {
2080 /// Creation timestamp of the resource within the given system.
2081 #[serde(rename = "createTime")]
2082 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2083 /// Output only. Expiration timestamp of the resource within the given system. Currently only applicable to BigQuery resources.
2084 #[serde(rename = "expireTime")]
2085 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2086 /// Timestamp of the last modification of the resource or its metadata within a given system. Note: Depending on the source system, not every modification updates this timestamp. For example, BigQuery timestamps every metadata modification but not data or permission changes.
2087 #[serde(rename = "updateTime")]
2088 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2089}
2090
2091impl common::Part for GoogleCloudDatacatalogV1SystemTimestamps {}
2092
2093/// Normal BigQuery table specification.
2094///
2095/// This type is not used in any activity, and only used as *part* of another schema.
2096///
2097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2098#[serde_with::serde_as]
2099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2100pub struct GoogleCloudDatacatalogV1TableSpec {
2101 /// Output only. If the table is date-sharded, that is, it matches the `[prefix]YYYYMMDD` name pattern, this field is the Data Catalog resource name of the date-sharded grouped entry. For example: `projects/{PROJECT_ID}/locations/{LOCATION}/entrygroups/{ENTRY_GROUP_ID}/entries/{ENTRY_ID}`. Otherwise, `grouped_entry` is empty.
2102 #[serde(rename = "groupedEntry")]
2103 pub grouped_entry: Option<String>,
2104}
2105
2106impl common::Part for GoogleCloudDatacatalogV1TableSpec {}
2107
2108/// Tags contain custom metadata and are attached to Data Catalog resources. Tags conform with the specification of their tag template. See [Data Catalog IAM](https://cloud.google.com/data-catalog/docs/concepts/iam) for information on the permissions needed to create or view tags.
2109///
2110/// # Activities
2111///
2112/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2113/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2114///
2115/// * [locations entry groups entries tags create projects](ProjectLocationEntryGroupEntryTagCreateCall) (request|response)
2116/// * [locations entry groups entries tags patch projects](ProjectLocationEntryGroupEntryTagPatchCall) (request|response)
2117/// * [locations entry groups tags create projects](ProjectLocationEntryGroupTagCreateCall) (request|response)
2118/// * [locations entry groups tags patch projects](ProjectLocationEntryGroupTagPatchCall) (request|response)
2119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2120#[serde_with::serde_as]
2121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2122pub struct GoogleCloudDatacatalogV1Tag {
2123 /// Resources like entry can have schemas associated with them. This scope allows you to attach tags to an individual column based on that schema. To attach a tag to a nested column, separate column names with a dot (`.`). Example: `column.nested_column`.
2124 pub column: Option<String>,
2125 /// Output only. Denotes the transfer status of the Tag Template.
2126 #[serde(rename = "dataplexTransferStatus")]
2127 pub dataplex_transfer_status: Option<String>,
2128 /// Required. Maps the ID of a tag field to its value and additional information about that field. Tag template defines valid field IDs. A tag must have at least 1 field and at most 500 fields.
2129 pub fields: Option<HashMap<String, GoogleCloudDatacatalogV1TagField>>,
2130 /// Identifier. The resource name of the tag in URL format where tag ID is a system-generated identifier. Note: The tag itself might not be stored in the location specified in its name.
2131 pub name: Option<String>,
2132 /// Required. The resource name of the tag template this tag uses. Example: `projects/{PROJECT_ID}/locations/{LOCATION}/tagTemplates/{TAG_TEMPLATE_ID}` This field cannot be modified after creation.
2133 pub template: Option<String>,
2134 /// Output only. The display name of the tag template.
2135 #[serde(rename = "templateDisplayName")]
2136 pub template_display_name: Option<String>,
2137}
2138
2139impl common::RequestValue for GoogleCloudDatacatalogV1Tag {}
2140impl common::ResponseResult for GoogleCloudDatacatalogV1Tag {}
2141
2142/// Contains the value and additional information on a field within a Tag.
2143///
2144/// This type is not used in any activity, and only used as *part* of another schema.
2145///
2146#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2147#[serde_with::serde_as]
2148#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2149pub struct GoogleCloudDatacatalogV1TagField {
2150 /// The value of a tag field with a boolean type.
2151 #[serde(rename = "boolValue")]
2152 pub bool_value: Option<bool>,
2153 /// Output only. The display name of this field.
2154 #[serde(rename = "displayName")]
2155 pub display_name: Option<String>,
2156 /// The value of a tag field with a double type.
2157 #[serde(rename = "doubleValue")]
2158 pub double_value: Option<f64>,
2159 /// The value of a tag field with an enum type. This value must be one of the allowed values listed in this enum.
2160 #[serde(rename = "enumValue")]
2161 pub enum_value: Option<GoogleCloudDatacatalogV1TagFieldEnumValue>,
2162 /// Output only. The order of this field with respect to other fields in this tag. Can be set by Tag. For example, a higher value can indicate a more important field. The value can be negative. Multiple fields can have the same order, and field orders within a tag don't have to be sequential.
2163 pub order: Option<i32>,
2164 /// The value of a tag field with a rich text type. The maximum length is 10 MiB as this value holds HTML descriptions including encoded images. The maximum length of the text without images is 100 KiB.
2165 #[serde(rename = "richtextValue")]
2166 pub richtext_value: Option<String>,
2167 /// The value of a tag field with a string type. The maximum length is 2000 UTF-8 characters.
2168 #[serde(rename = "stringValue")]
2169 pub string_value: Option<String>,
2170 /// The value of a tag field with a timestamp type.
2171 #[serde(rename = "timestampValue")]
2172 pub timestamp_value: Option<chrono::DateTime<chrono::offset::Utc>>,
2173}
2174
2175impl common::Part for GoogleCloudDatacatalogV1TagField {}
2176
2177/// An enum value.
2178///
2179/// This type is not used in any activity, and only used as *part* of another schema.
2180///
2181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2182#[serde_with::serde_as]
2183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2184pub struct GoogleCloudDatacatalogV1TagFieldEnumValue {
2185 /// The display name of the enum value.
2186 #[serde(rename = "displayName")]
2187 pub display_name: Option<String>,
2188}
2189
2190impl common::Part for GoogleCloudDatacatalogV1TagFieldEnumValue {}
2191
2192/// A tag template defines a tag that can have one or more typed fields. The template is used to create tags that are attached to Google Cloud resources. \[Tag template roles\] (https://cloud.google.com/iam/docs/understanding-roles#data-catalog-roles) provide permissions to create, edit, and use the template. For example, see the \[TagTemplate User\] (https://cloud.google.com/data-catalog/docs/how-to/template-user) role that includes a permission to use the tag template to tag resources.
2193///
2194/// # Activities
2195///
2196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2198///
2199/// * [locations tag templates create projects](ProjectLocationTagTemplateCreateCall) (request|response)
2200/// * [locations tag templates get projects](ProjectLocationTagTemplateGetCall) (response)
2201/// * [locations tag templates patch projects](ProjectLocationTagTemplatePatchCall) (request|response)
2202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2203#[serde_with::serde_as]
2204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2205pub struct GoogleCloudDatacatalogV1TagTemplate {
2206 /// Optional. Transfer status of the TagTemplate
2207 #[serde(rename = "dataplexTransferStatus")]
2208 pub dataplex_transfer_status: Option<String>,
2209 /// Display name for this template. Defaults to an empty string. The name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), and can't start or end with spaces. The maximum length is 200 characters.
2210 #[serde(rename = "displayName")]
2211 pub display_name: Option<String>,
2212 /// Required. Map of tag template field IDs to the settings for the field. This map is an exhaustive list of the allowed fields. The map must contain at least one field and at most 500 fields. The keys to this map are tag template field IDs. The IDs have the following limitations: * Can contain uppercase and lowercase letters, numbers (0-9) and underscores (_). * Must be at least 1 character and at most 64 characters long. * Must start with a letter or underscore.
2213 pub fields: Option<HashMap<String, GoogleCloudDatacatalogV1TagTemplateField>>,
2214 /// Indicates whether tags created with this template are public. Public tags do not require tag template access to appear in ListTags API response. Additionally, you can search for a public tag by value with a simple search query in addition to using a ``tag:`` predicate.
2215 #[serde(rename = "isPubliclyReadable")]
2216 pub is_publicly_readable: Option<bool>,
2217 /// Identifier. The resource name of the tag template in URL format. Note: The tag template itself and its child resources might not be stored in the location specified in its name.
2218 pub name: Option<String>,
2219}
2220
2221impl common::RequestValue for GoogleCloudDatacatalogV1TagTemplate {}
2222impl common::ResponseResult for GoogleCloudDatacatalogV1TagTemplate {}
2223
2224/// The template for an individual field within a tag template.
2225///
2226/// # Activities
2227///
2228/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2229/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2230///
2231/// * [locations tag templates fields enum values rename projects](ProjectLocationTagTemplateFieldEnumValueRenameCall) (response)
2232/// * [locations tag templates fields create projects](ProjectLocationTagTemplateFieldCreateCall) (request|response)
2233/// * [locations tag templates fields patch projects](ProjectLocationTagTemplateFieldPatchCall) (request|response)
2234/// * [locations tag templates fields rename projects](ProjectLocationTagTemplateFieldRenameCall) (response)
2235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2236#[serde_with::serde_as]
2237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2238pub struct GoogleCloudDatacatalogV1TagTemplateField {
2239 /// The description for this field. Defaults to an empty string.
2240 pub description: Option<String>,
2241 /// The display name for this field. Defaults to an empty string. The name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), and can't start or end with spaces. The maximum length is 200 characters.
2242 #[serde(rename = "displayName")]
2243 pub display_name: Option<String>,
2244 /// If true, this field is required. Defaults to false.
2245 #[serde(rename = "isRequired")]
2246 pub is_required: Option<bool>,
2247 /// Identifier. The resource name of the tag template field in URL format. Example: `projects/{PROJECT_ID}/locations/{LOCATION}/tagTemplates/{TAG_TEMPLATE}/fields/{FIELD}` Note: The tag template field itself might not be stored in the location specified in its name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 64 characters.
2248 pub name: Option<String>,
2249 /// The order of this field with respect to other fields in this tag template. For example, a higher value can indicate a more important field. The value can be negative. Multiple fields can have the same order and field orders within a tag don't have to be sequential.
2250 pub order: Option<i32>,
2251 /// Required. The type of value this tag field can contain.
2252 #[serde(rename = "type")]
2253 pub type_: Option<GoogleCloudDatacatalogV1FieldType>,
2254}
2255
2256impl common::RequestValue for GoogleCloudDatacatalogV1TagTemplateField {}
2257impl common::ResponseResult for GoogleCloudDatacatalogV1TagTemplateField {}
2258
2259/// A taxonomy is a collection of hierarchical policy tags that classify data along a common axis. For example, a “data sensitivity” taxonomy might contain the following policy tags: `+ PII + Account number + Age + SSN + Zipcode + Financials + Revenue` A “data origin” taxonomy might contain the following policy tags: `+ User data + Employee data + Partner data + Public data`
2260///
2261/// # Activities
2262///
2263/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2264/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2265///
2266/// * [locations taxonomies create projects](ProjectLocationTaxonomyCreateCall) (request|response)
2267/// * [locations taxonomies get projects](ProjectLocationTaxonomyGetCall) (response)
2268/// * [locations taxonomies patch projects](ProjectLocationTaxonomyPatchCall) (request|response)
2269/// * [locations taxonomies replace projects](ProjectLocationTaxonomyReplaceCall) (response)
2270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2271#[serde_with::serde_as]
2272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2273pub struct GoogleCloudDatacatalogV1Taxonomy {
2274 /// Optional. A list of policy types that are activated for this taxonomy. If not set, defaults to an empty list.
2275 #[serde(rename = "activatedPolicyTypes")]
2276 pub activated_policy_types: Option<Vec<String>>,
2277 /// Optional. Description of this taxonomy. If not set, defaults to empty. The description must contain only Unicode characters, tabs, newlines, carriage returns, and page breaks, and be at most 2000 bytes long when encoded in UTF-8.
2278 pub description: Option<String>,
2279 /// Required. User-defined name of this taxonomy. The name can't start or end with spaces, must contain only Unicode letters, numbers, underscores, dashes, and spaces, and be at most 200 bytes long when encoded in UTF-8. The taxonomy display name must be unique within an organization.
2280 #[serde(rename = "displayName")]
2281 pub display_name: Option<String>,
2282 /// Identifier. Resource name of this taxonomy in URL format. Note: Policy tag manager generates unique taxonomy IDs.
2283 pub name: Option<String>,
2284 /// Output only. Number of policy tags in this taxonomy.
2285 #[serde(rename = "policyTagCount")]
2286 pub policy_tag_count: Option<i32>,
2287 /// Output only. Identity of the service which owns the Taxonomy. This field is only populated when the taxonomy is created by a Google Cloud service. Currently only 'DATAPLEX' is supported.
2288 pub service: Option<GoogleCloudDatacatalogV1TaxonomyService>,
2289 /// Output only. Creation and modification timestamps of this taxonomy.
2290 #[serde(rename = "taxonomyTimestamps")]
2291 pub taxonomy_timestamps: Option<GoogleCloudDatacatalogV1SystemTimestamps>,
2292}
2293
2294impl common::RequestValue for GoogleCloudDatacatalogV1Taxonomy {}
2295impl common::ResponseResult for GoogleCloudDatacatalogV1Taxonomy {}
2296
2297/// The source system of the Taxonomy.
2298///
2299/// This type is not used in any activity, and only used as *part* of another schema.
2300///
2301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2302#[serde_with::serde_as]
2303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2304pub struct GoogleCloudDatacatalogV1TaxonomyService {
2305 /// The service agent for the service.
2306 pub identity: Option<String>,
2307 /// The Google Cloud service name.
2308 pub name: Option<String>,
2309}
2310
2311impl common::Part for GoogleCloudDatacatalogV1TaxonomyService {}
2312
2313/// Request message for UnstarEntry.
2314///
2315/// # Activities
2316///
2317/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2318/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2319///
2320/// * [locations entry groups entries unstar projects](ProjectLocationEntryGroupEntryUnstarCall) (request)
2321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2322#[serde_with::serde_as]
2323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2324pub struct GoogleCloudDatacatalogV1UnstarEntryRequest {
2325 _never_set: Option<bool>,
2326}
2327
2328impl common::RequestValue for GoogleCloudDatacatalogV1UnstarEntryRequest {}
2329
2330/// Response message for UnstarEntry. Empty for now
2331///
2332/// # Activities
2333///
2334/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2335/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2336///
2337/// * [locations entry groups entries unstar projects](ProjectLocationEntryGroupEntryUnstarCall) (response)
2338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2339#[serde_with::serde_as]
2340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2341pub struct GoogleCloudDatacatalogV1UnstarEntryResponse {
2342 _never_set: Option<bool>,
2343}
2344
2345impl common::ResponseResult for GoogleCloudDatacatalogV1UnstarEntryResponse {}
2346
2347/// The set of all usage signals that Data Catalog stores. Note: Usually, these signals are updated daily. In rare cases, an update may fail but will be performed again on the next day.
2348///
2349/// This type is not used in any activity, and only used as *part* of another schema.
2350///
2351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2352#[serde_with::serde_as]
2353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2354pub struct GoogleCloudDatacatalogV1UsageSignal {
2355 /// Common usage statistics over each of the predefined time ranges. Supported time ranges are `{"24H", "7D", "30D", "Lifetime"}`.
2356 #[serde(rename = "commonUsageWithinTimeRange")]
2357 pub common_usage_within_time_range:
2358 Option<HashMap<String, GoogleCloudDatacatalogV1CommonUsageStats>>,
2359 /// Favorite count in the source system.
2360 #[serde(rename = "favoriteCount")]
2361 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2362 pub favorite_count: Option<i64>,
2363 /// The end timestamp of the duration of usage statistics.
2364 #[serde(rename = "updateTime")]
2365 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2366 /// Output only. BigQuery usage statistics over each of the predefined time ranges. Supported time ranges are `{"24H", "7D", "30D"}`.
2367 #[serde(rename = "usageWithinTimeRange")]
2368 pub usage_within_time_range: Option<HashMap<String, GoogleCloudDatacatalogV1UsageStats>>,
2369}
2370
2371impl common::Part for GoogleCloudDatacatalogV1UsageSignal {}
2372
2373/// Detailed statistics on the entry's usage. Usage statistics have the following limitations: - Only BigQuery tables have them. - They only include BigQuery query jobs. - They might be underestimated because wildcard table references are not yet counted. For more information, see [Querying multiple tables using a wildcard table] (https://cloud.google.com/bigquery/docs/querying-wildcard-tables)
2374///
2375/// This type is not used in any activity, and only used as *part* of another schema.
2376///
2377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2378#[serde_with::serde_as]
2379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2380pub struct GoogleCloudDatacatalogV1UsageStats {
2381 /// The number of cancelled attempts to use the underlying entry.
2382 #[serde(rename = "totalCancellations")]
2383 pub total_cancellations: Option<f32>,
2384 /// The number of successful uses of the underlying entry.
2385 #[serde(rename = "totalCompletions")]
2386 pub total_completions: Option<f32>,
2387 /// Total time spent only on successful uses, in milliseconds.
2388 #[serde(rename = "totalExecutionTimeForCompletionsMillis")]
2389 pub total_execution_time_for_completions_millis: Option<f32>,
2390 /// The number of failed attempts to use the underlying entry.
2391 #[serde(rename = "totalFailures")]
2392 pub total_failures: Option<f32>,
2393}
2394
2395impl common::Part for GoogleCloudDatacatalogV1UsageStats {}
2396
2397/// Specification for vertex dataset resources.
2398///
2399/// This type is not used in any activity, and only used as *part* of another schema.
2400///
2401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2402#[serde_with::serde_as]
2403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2404pub struct GoogleCloudDatacatalogV1VertexDatasetSpec {
2405 /// The number of DataItems in this Dataset. Only apply for non-structured Dataset.
2406 #[serde(rename = "dataItemCount")]
2407 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2408 pub data_item_count: Option<i64>,
2409 /// Type of the dataset.
2410 #[serde(rename = "dataType")]
2411 pub data_type: Option<String>,
2412}
2413
2414impl common::Part for GoogleCloudDatacatalogV1VertexDatasetSpec {}
2415
2416/// Detail description of the source information of a Vertex model.
2417///
2418/// This type is not used in any activity, and only used as *part* of another schema.
2419///
2420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2421#[serde_with::serde_as]
2422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2423pub struct GoogleCloudDatacatalogV1VertexModelSourceInfo {
2424 /// If this Model is copy of another Model. If true then source_type pertains to the original.
2425 pub copy: Option<bool>,
2426 /// Type of the model source.
2427 #[serde(rename = "sourceType")]
2428 pub source_type: Option<String>,
2429}
2430
2431impl common::Part for GoogleCloudDatacatalogV1VertexModelSourceInfo {}
2432
2433/// Specification for vertex model resources.
2434///
2435/// This type is not used in any activity, and only used as *part* of another schema.
2436///
2437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2438#[serde_with::serde_as]
2439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2440pub struct GoogleCloudDatacatalogV1VertexModelSpec {
2441 /// URI of the Docker image to be used as the custom container for serving predictions.
2442 #[serde(rename = "containerImageUri")]
2443 pub container_image_uri: Option<String>,
2444 /// User provided version aliases so that a model version can be referenced via alias
2445 #[serde(rename = "versionAliases")]
2446 pub version_aliases: Option<Vec<String>>,
2447 /// The description of this version.
2448 #[serde(rename = "versionDescription")]
2449 pub version_description: Option<String>,
2450 /// The version ID of the model.
2451 #[serde(rename = "versionId")]
2452 pub version_id: Option<String>,
2453 /// Source of a Vertex model.
2454 #[serde(rename = "vertexModelSourceInfo")]
2455 pub vertex_model_source_info: Option<GoogleCloudDatacatalogV1VertexModelSourceInfo>,
2456}
2457
2458impl common::Part for GoogleCloudDatacatalogV1VertexModelSpec {}
2459
2460/// Table view specification.
2461///
2462/// This type is not used in any activity, and only used as *part* of another schema.
2463///
2464#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2465#[serde_with::serde_as]
2466#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2467pub struct GoogleCloudDatacatalogV1ViewSpec {
2468 /// Output only. The query that defines the table view.
2469 #[serde(rename = "viewQuery")]
2470 pub view_query: Option<String>,
2471}
2472
2473impl common::Part for GoogleCloudDatacatalogV1ViewSpec {}
2474
2475/// The response message for Operations.ListOperations.
2476///
2477/// # Activities
2478///
2479/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2480/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2481///
2482/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
2483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2484#[serde_with::serde_as]
2485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2486pub struct ListOperationsResponse {
2487 /// The standard List next-page token.
2488 #[serde(rename = "nextPageToken")]
2489 pub next_page_token: Option<String>,
2490 /// A list of operations that matches the specified filter in the request.
2491 pub operations: Option<Vec<Operation>>,
2492 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
2493 pub unreachable: Option<Vec<String>>,
2494}
2495
2496impl common::ResponseResult for ListOperationsResponse {}
2497
2498/// This resource represents a long-running operation that is the result of a network API call.
2499///
2500/// # Activities
2501///
2502/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2503/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2504///
2505/// * [locations entry groups entries tags reconcile projects](ProjectLocationEntryGroupEntryTagReconcileCall) (response)
2506/// * [locations entry groups entries import projects](ProjectLocationEntryGroupEntryImportCall) (response)
2507/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
2508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2509#[serde_with::serde_as]
2510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2511pub struct Operation {
2512 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
2513 pub done: Option<bool>,
2514 /// The error result of the operation in case of failure or cancellation.
2515 pub error: Option<Status>,
2516 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
2517 pub metadata: Option<HashMap<String, serde_json::Value>>,
2518 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
2519 pub name: Option<String>,
2520 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
2521 pub response: Option<HashMap<String, serde_json::Value>>,
2522}
2523
2524impl common::ResponseResult for Operation {}
2525
2526/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
2527///
2528/// # Activities
2529///
2530/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2531/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2532///
2533/// * [locations entry groups entries get iam policy projects](ProjectLocationEntryGroupEntryGetIamPolicyCall) (response)
2534/// * [locations entry groups get iam policy projects](ProjectLocationEntryGroupGetIamPolicyCall) (response)
2535/// * [locations entry groups set iam policy projects](ProjectLocationEntryGroupSetIamPolicyCall) (response)
2536/// * [locations tag templates get iam policy projects](ProjectLocationTagTemplateGetIamPolicyCall) (response)
2537/// * [locations tag templates set iam policy projects](ProjectLocationTagTemplateSetIamPolicyCall) (response)
2538/// * [locations taxonomies policy tags get iam policy projects](ProjectLocationTaxonomyPolicyTagGetIamPolicyCall) (response)
2539/// * [locations taxonomies policy tags set iam policy projects](ProjectLocationTaxonomyPolicyTagSetIamPolicyCall) (response)
2540/// * [locations taxonomies get iam policy projects](ProjectLocationTaxonomyGetIamPolicyCall) (response)
2541/// * [locations taxonomies set iam policy projects](ProjectLocationTaxonomySetIamPolicyCall) (response)
2542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2543#[serde_with::serde_as]
2544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2545pub struct Policy {
2546 /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
2547 pub bindings: Option<Vec<Binding>>,
2548 /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
2549 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2550 pub etag: Option<Vec<u8>>,
2551 /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
2552 pub version: Option<i32>,
2553}
2554
2555impl common::ResponseResult for Policy {}
2556
2557/// Request message for `SetIamPolicy` method.
2558///
2559/// # Activities
2560///
2561/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2562/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2563///
2564/// * [locations entry groups set iam policy projects](ProjectLocationEntryGroupSetIamPolicyCall) (request)
2565/// * [locations tag templates set iam policy projects](ProjectLocationTagTemplateSetIamPolicyCall) (request)
2566/// * [locations taxonomies policy tags set iam policy projects](ProjectLocationTaxonomyPolicyTagSetIamPolicyCall) (request)
2567/// * [locations taxonomies set iam policy projects](ProjectLocationTaxonomySetIamPolicyCall) (request)
2568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2569#[serde_with::serde_as]
2570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2571pub struct SetIamPolicyRequest {
2572 /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
2573 pub policy: Option<Policy>,
2574}
2575
2576impl common::RequestValue for SetIamPolicyRequest {}
2577
2578/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
2579///
2580/// This type is not used in any activity, and only used as *part* of another schema.
2581///
2582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2583#[serde_with::serde_as]
2584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2585pub struct Status {
2586 /// The status code, which should be an enum value of google.rpc.Code.
2587 pub code: Option<i32>,
2588 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2589 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2590 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
2591 pub message: Option<String>,
2592}
2593
2594impl common::Part for Status {}
2595
2596/// Request message for `TestIamPermissions` method.
2597///
2598/// # Activities
2599///
2600/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2601/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2602///
2603/// * [locations entry groups entries test iam permissions projects](ProjectLocationEntryGroupEntryTestIamPermissionCall) (request)
2604/// * [locations entry groups test iam permissions projects](ProjectLocationEntryGroupTestIamPermissionCall) (request)
2605/// * [locations tag templates test iam permissions projects](ProjectLocationTagTemplateTestIamPermissionCall) (request)
2606/// * [locations taxonomies policy tags test iam permissions projects](ProjectLocationTaxonomyPolicyTagTestIamPermissionCall) (request)
2607/// * [locations taxonomies test iam permissions projects](ProjectLocationTaxonomyTestIamPermissionCall) (request)
2608#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2609#[serde_with::serde_as]
2610#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2611pub struct TestIamPermissionsRequest {
2612 /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
2613 pub permissions: Option<Vec<String>>,
2614}
2615
2616impl common::RequestValue for TestIamPermissionsRequest {}
2617
2618/// Response message for `TestIamPermissions` method.
2619///
2620/// # Activities
2621///
2622/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2623/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2624///
2625/// * [locations entry groups entries test iam permissions projects](ProjectLocationEntryGroupEntryTestIamPermissionCall) (response)
2626/// * [locations entry groups test iam permissions projects](ProjectLocationEntryGroupTestIamPermissionCall) (response)
2627/// * [locations tag templates test iam permissions projects](ProjectLocationTagTemplateTestIamPermissionCall) (response)
2628/// * [locations taxonomies policy tags test iam permissions projects](ProjectLocationTaxonomyPolicyTagTestIamPermissionCall) (response)
2629/// * [locations taxonomies test iam permissions projects](ProjectLocationTaxonomyTestIamPermissionCall) (response)
2630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2631#[serde_with::serde_as]
2632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2633pub struct TestIamPermissionsResponse {
2634 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2635 pub permissions: Option<Vec<String>>,
2636}
2637
2638impl common::ResponseResult for TestIamPermissionsResponse {}
2639
2640// ###################
2641// MethodBuilders ###
2642// #################
2643
2644/// A builder providing access to all methods supported on *catalog* resources.
2645/// It is not used directly, but through the [`DataCatalog`] hub.
2646///
2647/// # Example
2648///
2649/// Instantiate a resource builder
2650///
2651/// ```test_harness,no_run
2652/// extern crate hyper;
2653/// extern crate hyper_rustls;
2654/// extern crate google_datacatalog1 as datacatalog1;
2655///
2656/// # async fn dox() {
2657/// use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2658///
2659/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2660/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2661/// .with_native_roots()
2662/// .unwrap()
2663/// .https_only()
2664/// .enable_http2()
2665/// .build();
2666///
2667/// let executor = hyper_util::rt::TokioExecutor::new();
2668/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2669/// secret,
2670/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2671/// yup_oauth2::client::CustomHyperClientBuilder::from(
2672/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2673/// ),
2674/// ).build().await.unwrap();
2675///
2676/// let client = hyper_util::client::legacy::Client::builder(
2677/// hyper_util::rt::TokioExecutor::new()
2678/// )
2679/// .build(
2680/// hyper_rustls::HttpsConnectorBuilder::new()
2681/// .with_native_roots()
2682/// .unwrap()
2683/// .https_or_http()
2684/// .enable_http2()
2685/// .build()
2686/// );
2687/// let mut hub = DataCatalog::new(client, auth);
2688/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2689/// // like `search(...)`
2690/// // to build up your call.
2691/// let rb = hub.catalog();
2692/// # }
2693/// ```
2694pub struct CatalogMethods<'a, C>
2695where
2696 C: 'a,
2697{
2698 hub: &'a DataCatalog<C>,
2699}
2700
2701impl<'a, C> common::MethodsBuilder for CatalogMethods<'a, C> {}
2702
2703impl<'a, C> CatalogMethods<'a, C> {
2704 /// Create a builder to help you perform the following task:
2705 ///
2706 /// Searches Data Catalog for multiple resources like entries and tags that match a query. This is a [Custom Method] (https://cloud.google.com/apis/design/custom_methods) that doesn't return all information on a resource, only its ID and high level fields. To get more information, you can subsequently call specific get methods. Note: Data Catalog search queries don't guarantee full recall. Results that match your query might not be returned, even in subsequent result pages. Additionally, returned (and not returned) results can vary if you repeat search queries. For more information, see [Data Catalog search syntax] (https://cloud.google.com/data-catalog/docs/how-to/search-reference).
2707 ///
2708 /// # Arguments
2709 ///
2710 /// * `request` - No description provided.
2711 pub fn search(
2712 &self,
2713 request: GoogleCloudDatacatalogV1SearchCatalogRequest,
2714 ) -> CatalogSearchCall<'a, C> {
2715 CatalogSearchCall {
2716 hub: self.hub,
2717 _request: request,
2718 _delegate: Default::default(),
2719 _additional_params: Default::default(),
2720 _scopes: Default::default(),
2721 }
2722 }
2723}
2724
2725/// A builder providing access to all methods supported on *entry* resources.
2726/// It is not used directly, but through the [`DataCatalog`] hub.
2727///
2728/// # Example
2729///
2730/// Instantiate a resource builder
2731///
2732/// ```test_harness,no_run
2733/// extern crate hyper;
2734/// extern crate hyper_rustls;
2735/// extern crate google_datacatalog1 as datacatalog1;
2736///
2737/// # async fn dox() {
2738/// use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2739///
2740/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2741/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2742/// .with_native_roots()
2743/// .unwrap()
2744/// .https_only()
2745/// .enable_http2()
2746/// .build();
2747///
2748/// let executor = hyper_util::rt::TokioExecutor::new();
2749/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2750/// secret,
2751/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2752/// yup_oauth2::client::CustomHyperClientBuilder::from(
2753/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2754/// ),
2755/// ).build().await.unwrap();
2756///
2757/// let client = hyper_util::client::legacy::Client::builder(
2758/// hyper_util::rt::TokioExecutor::new()
2759/// )
2760/// .build(
2761/// hyper_rustls::HttpsConnectorBuilder::new()
2762/// .with_native_roots()
2763/// .unwrap()
2764/// .https_or_http()
2765/// .enable_http2()
2766/// .build()
2767/// );
2768/// let mut hub = DataCatalog::new(client, auth);
2769/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2770/// // like `lookup(...)`
2771/// // to build up your call.
2772/// let rb = hub.entries();
2773/// # }
2774/// ```
2775pub struct EntryMethods<'a, C>
2776where
2777 C: 'a,
2778{
2779 hub: &'a DataCatalog<C>,
2780}
2781
2782impl<'a, C> common::MethodsBuilder for EntryMethods<'a, C> {}
2783
2784impl<'a, C> EntryMethods<'a, C> {
2785 /// Create a builder to help you perform the following task:
2786 ///
2787 /// Gets an entry by its target resource name. The resource name comes from the source Google Cloud Platform service.
2788 pub fn lookup(&self) -> EntryLookupCall<'a, C> {
2789 EntryLookupCall {
2790 hub: self.hub,
2791 _sql_resource: Default::default(),
2792 _project: Default::default(),
2793 _location: Default::default(),
2794 _linked_resource: Default::default(),
2795 _fully_qualified_name: Default::default(),
2796 _delegate: Default::default(),
2797 _additional_params: Default::default(),
2798 _scopes: Default::default(),
2799 }
2800 }
2801}
2802
2803/// A builder providing access to all methods supported on *organization* resources.
2804/// It is not used directly, but through the [`DataCatalog`] hub.
2805///
2806/// # Example
2807///
2808/// Instantiate a resource builder
2809///
2810/// ```test_harness,no_run
2811/// extern crate hyper;
2812/// extern crate hyper_rustls;
2813/// extern crate google_datacatalog1 as datacatalog1;
2814///
2815/// # async fn dox() {
2816/// use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2817///
2818/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2819/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2820/// .with_native_roots()
2821/// .unwrap()
2822/// .https_only()
2823/// .enable_http2()
2824/// .build();
2825///
2826/// let executor = hyper_util::rt::TokioExecutor::new();
2827/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2828/// secret,
2829/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2830/// yup_oauth2::client::CustomHyperClientBuilder::from(
2831/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2832/// ),
2833/// ).build().await.unwrap();
2834///
2835/// let client = hyper_util::client::legacy::Client::builder(
2836/// hyper_util::rt::TokioExecutor::new()
2837/// )
2838/// .build(
2839/// hyper_rustls::HttpsConnectorBuilder::new()
2840/// .with_native_roots()
2841/// .unwrap()
2842/// .https_or_http()
2843/// .enable_http2()
2844/// .build()
2845/// );
2846/// let mut hub = DataCatalog::new(client, auth);
2847/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2848/// // like `locations_retrieve_config(...)`, `locations_retrieve_effective_config(...)` and `locations_set_config(...)`
2849/// // to build up your call.
2850/// let rb = hub.organizations();
2851/// # }
2852/// ```
2853pub struct OrganizationMethods<'a, C>
2854where
2855 C: 'a,
2856{
2857 hub: &'a DataCatalog<C>,
2858}
2859
2860impl<'a, C> common::MethodsBuilder for OrganizationMethods<'a, C> {}
2861
2862impl<'a, C> OrganizationMethods<'a, C> {
2863 /// Create a builder to help you perform the following task:
2864 ///
2865 /// Retrieves the configuration related to the migration from Data Catalog to Dataplex Universal Catalog for a specific organization, including all the projects under it which have a separate configuration set.
2866 ///
2867 /// # Arguments
2868 ///
2869 /// * `name` - Required. The organization whose config is being retrieved.
2870 pub fn locations_retrieve_config(
2871 &self,
2872 name: &str,
2873 ) -> OrganizationLocationRetrieveConfigCall<'a, C> {
2874 OrganizationLocationRetrieveConfigCall {
2875 hub: self.hub,
2876 _name: name.to_string(),
2877 _delegate: Default::default(),
2878 _additional_params: Default::default(),
2879 _scopes: Default::default(),
2880 }
2881 }
2882
2883 /// Create a builder to help you perform the following task:
2884 ///
2885 /// Retrieves the effective configuration related to the migration from Data Catalog to Dataplex Universal Catalog for a specific organization or project. If there is no specific configuration set for the resource, the setting is checked hierarchicahlly through the ancestors of the resource, starting from the resource itself.
2886 ///
2887 /// # Arguments
2888 ///
2889 /// * `name` - Required. The resource whose effective config is being retrieved.
2890 pub fn locations_retrieve_effective_config(
2891 &self,
2892 name: &str,
2893 ) -> OrganizationLocationRetrieveEffectiveConfigCall<'a, C> {
2894 OrganizationLocationRetrieveEffectiveConfigCall {
2895 hub: self.hub,
2896 _name: name.to_string(),
2897 _delegate: Default::default(),
2898 _additional_params: Default::default(),
2899 _scopes: Default::default(),
2900 }
2901 }
2902
2903 /// Create a builder to help you perform the following task:
2904 ///
2905 /// Sets the configuration related to the migration to Dataplex Universal Catalog for an organization or project.
2906 ///
2907 /// # Arguments
2908 ///
2909 /// * `request` - No description provided.
2910 /// * `name` - Required. The organization or project whose config is being specified.
2911 pub fn locations_set_config(
2912 &self,
2913 request: GoogleCloudDatacatalogV1SetConfigRequest,
2914 name: &str,
2915 ) -> OrganizationLocationSetConfigCall<'a, C> {
2916 OrganizationLocationSetConfigCall {
2917 hub: self.hub,
2918 _request: request,
2919 _name: name.to_string(),
2920 _delegate: Default::default(),
2921 _additional_params: Default::default(),
2922 _scopes: Default::default(),
2923 }
2924 }
2925}
2926
2927/// A builder providing access to all methods supported on *project* resources.
2928/// It is not used directly, but through the [`DataCatalog`] hub.
2929///
2930/// # Example
2931///
2932/// Instantiate a resource builder
2933///
2934/// ```test_harness,no_run
2935/// extern crate hyper;
2936/// extern crate hyper_rustls;
2937/// extern crate google_datacatalog1 as datacatalog1;
2938///
2939/// # async fn dox() {
2940/// use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2941///
2942/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2943/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2944/// .with_native_roots()
2945/// .unwrap()
2946/// .https_only()
2947/// .enable_http2()
2948/// .build();
2949///
2950/// let executor = hyper_util::rt::TokioExecutor::new();
2951/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2952/// secret,
2953/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2954/// yup_oauth2::client::CustomHyperClientBuilder::from(
2955/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2956/// ),
2957/// ).build().await.unwrap();
2958///
2959/// let client = hyper_util::client::legacy::Client::builder(
2960/// hyper_util::rt::TokioExecutor::new()
2961/// )
2962/// .build(
2963/// hyper_rustls::HttpsConnectorBuilder::new()
2964/// .with_native_roots()
2965/// .unwrap()
2966/// .https_or_http()
2967/// .enable_http2()
2968/// .build()
2969/// );
2970/// let mut hub = DataCatalog::new(client, auth);
2971/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2972/// // like `locations_entry_groups_create(...)`, `locations_entry_groups_delete(...)`, `locations_entry_groups_entries_create(...)`, `locations_entry_groups_entries_delete(...)`, `locations_entry_groups_entries_get(...)`, `locations_entry_groups_entries_get_iam_policy(...)`, `locations_entry_groups_entries_import(...)`, `locations_entry_groups_entries_list(...)`, `locations_entry_groups_entries_modify_entry_contacts(...)`, `locations_entry_groups_entries_modify_entry_overview(...)`, `locations_entry_groups_entries_patch(...)`, `locations_entry_groups_entries_star(...)`, `locations_entry_groups_entries_tags_create(...)`, `locations_entry_groups_entries_tags_delete(...)`, `locations_entry_groups_entries_tags_list(...)`, `locations_entry_groups_entries_tags_patch(...)`, `locations_entry_groups_entries_tags_reconcile(...)`, `locations_entry_groups_entries_test_iam_permissions(...)`, `locations_entry_groups_entries_unstar(...)`, `locations_entry_groups_get(...)`, `locations_entry_groups_get_iam_policy(...)`, `locations_entry_groups_list(...)`, `locations_entry_groups_patch(...)`, `locations_entry_groups_set_iam_policy(...)`, `locations_entry_groups_tags_create(...)`, `locations_entry_groups_tags_delete(...)`, `locations_entry_groups_tags_list(...)`, `locations_entry_groups_tags_patch(...)`, `locations_entry_groups_test_iam_permissions(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_retrieve_effective_config(...)`, `locations_set_config(...)`, `locations_tag_templates_create(...)`, `locations_tag_templates_delete(...)`, `locations_tag_templates_fields_create(...)`, `locations_tag_templates_fields_delete(...)`, `locations_tag_templates_fields_enum_values_rename(...)`, `locations_tag_templates_fields_patch(...)`, `locations_tag_templates_fields_rename(...)`, `locations_tag_templates_get(...)`, `locations_tag_templates_get_iam_policy(...)`, `locations_tag_templates_patch(...)`, `locations_tag_templates_set_iam_policy(...)`, `locations_tag_templates_test_iam_permissions(...)`, `locations_taxonomies_create(...)`, `locations_taxonomies_delete(...)`, `locations_taxonomies_export(...)`, `locations_taxonomies_get(...)`, `locations_taxonomies_get_iam_policy(...)`, `locations_taxonomies_import(...)`, `locations_taxonomies_list(...)`, `locations_taxonomies_patch(...)`, `locations_taxonomies_policy_tags_create(...)`, `locations_taxonomies_policy_tags_delete(...)`, `locations_taxonomies_policy_tags_get(...)`, `locations_taxonomies_policy_tags_get_iam_policy(...)`, `locations_taxonomies_policy_tags_list(...)`, `locations_taxonomies_policy_tags_patch(...)`, `locations_taxonomies_policy_tags_set_iam_policy(...)`, `locations_taxonomies_policy_tags_test_iam_permissions(...)`, `locations_taxonomies_replace(...)`, `locations_taxonomies_set_iam_policy(...)` and `locations_taxonomies_test_iam_permissions(...)`
2973/// // to build up your call.
2974/// let rb = hub.projects();
2975/// # }
2976/// ```
2977pub struct ProjectMethods<'a, C>
2978where
2979 C: 'a,
2980{
2981 hub: &'a DataCatalog<C>,
2982}
2983
2984impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2985
2986impl<'a, C> ProjectMethods<'a, C> {
2987 /// Create a builder to help you perform the following task:
2988 ///
2989 /// Creates a tag and assigns it to: * An Entry if the method name is `projects.locations.entryGroups.entries.tags.create`. * Or EntryGroupif the method name is `projects.locations.entryGroups.tags.create`. Note: The project identified by the `parent` parameter for the [tag] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be in the same organization.
2990 ///
2991 /// # Arguments
2992 ///
2993 /// * `request` - No description provided.
2994 /// * `parent` - Required. The name of the resource to attach this tag to. Tags can be attached to entries or entry groups. An entry can have up to 1000 attached tags. Note: The tag and its child resources might not be stored in the location specified in its name.
2995 pub fn locations_entry_groups_entries_tags_create(
2996 &self,
2997 request: GoogleCloudDatacatalogV1Tag,
2998 parent: &str,
2999 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
3000 ProjectLocationEntryGroupEntryTagCreateCall {
3001 hub: self.hub,
3002 _request: request,
3003 _parent: parent.to_string(),
3004 _delegate: Default::default(),
3005 _additional_params: Default::default(),
3006 _scopes: Default::default(),
3007 }
3008 }
3009
3010 /// Create a builder to help you perform the following task:
3011 ///
3012 /// Deletes a tag.
3013 ///
3014 /// # Arguments
3015 ///
3016 /// * `name` - Required. The name of the tag to delete.
3017 pub fn locations_entry_groups_entries_tags_delete(
3018 &self,
3019 name: &str,
3020 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
3021 ProjectLocationEntryGroupEntryTagDeleteCall {
3022 hub: self.hub,
3023 _name: name.to_string(),
3024 _delegate: Default::default(),
3025 _additional_params: Default::default(),
3026 _scopes: Default::default(),
3027 }
3028 }
3029
3030 /// Create a builder to help you perform the following task:
3031 ///
3032 /// Lists tags assigned to an Entry. The columns in the response are lowercased.
3033 ///
3034 /// # Arguments
3035 ///
3036 /// * `parent` - Required. The name of the Data Catalog resource to list the tags of. The resource can be an Entry or an EntryGroup (without `/entries/{entries}` at the end).
3037 pub fn locations_entry_groups_entries_tags_list(
3038 &self,
3039 parent: &str,
3040 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
3041 ProjectLocationEntryGroupEntryTagListCall {
3042 hub: self.hub,
3043 _parent: parent.to_string(),
3044 _page_token: Default::default(),
3045 _page_size: Default::default(),
3046 _delegate: Default::default(),
3047 _additional_params: Default::default(),
3048 _scopes: Default::default(),
3049 }
3050 }
3051
3052 /// Create a builder to help you perform the following task:
3053 ///
3054 /// Updates an existing tag.
3055 ///
3056 /// # Arguments
3057 ///
3058 /// * `request` - No description provided.
3059 /// * `name` - Identifier. The resource name of the tag in URL format where tag ID is a system-generated identifier. Note: The tag itself might not be stored in the location specified in its name.
3060 pub fn locations_entry_groups_entries_tags_patch(
3061 &self,
3062 request: GoogleCloudDatacatalogV1Tag,
3063 name: &str,
3064 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
3065 ProjectLocationEntryGroupEntryTagPatchCall {
3066 hub: self.hub,
3067 _request: request,
3068 _name: name.to_string(),
3069 _update_mask: Default::default(),
3070 _delegate: Default::default(),
3071 _additional_params: Default::default(),
3072 _scopes: Default::default(),
3073 }
3074 }
3075
3076 /// Create a builder to help you perform the following task:
3077 ///
3078 /// `ReconcileTags` creates or updates a list of tags on the entry. If the ReconcileTagsRequest.force_delete_missing parameter is set, the operation deletes tags not included in the input tag list. `ReconcileTags` returns a long-running operation resource that can be queried with Operations.GetOperation to return ReconcileTagsMetadata and a ReconcileTagsResponse message. Note: SearchCatalog might return stale search results for up to 24 hours after the `ReconcileTags` operation completes.
3079 ///
3080 /// # Arguments
3081 ///
3082 /// * `request` - No description provided.
3083 /// * `parent` - Required. Name of Entry to be tagged.
3084 pub fn locations_entry_groups_entries_tags_reconcile(
3085 &self,
3086 request: GoogleCloudDatacatalogV1ReconcileTagsRequest,
3087 parent: &str,
3088 ) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C> {
3089 ProjectLocationEntryGroupEntryTagReconcileCall {
3090 hub: self.hub,
3091 _request: request,
3092 _parent: parent.to_string(),
3093 _delegate: Default::default(),
3094 _additional_params: Default::default(),
3095 _scopes: Default::default(),
3096 }
3097 }
3098
3099 /// Create a builder to help you perform the following task:
3100 ///
3101 /// Creates an entry. You can create entries only with 'FILESET', 'CLUSTER', 'DATA_STREAM', or custom types. Data Catalog automatically creates entries with other types during metadata ingestion from integrated systems. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project). An entry group can have a maximum of 100,000 entries.
3102 ///
3103 /// # Arguments
3104 ///
3105 /// * `request` - No description provided.
3106 /// * `parent` - Required. The name of the entry group this entry belongs to. Note: The entry itself and its child resources might not be stored in the location specified in its name.
3107 pub fn locations_entry_groups_entries_create(
3108 &self,
3109 request: GoogleCloudDatacatalogV1Entry,
3110 parent: &str,
3111 ) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
3112 ProjectLocationEntryGroupEntryCreateCall {
3113 hub: self.hub,
3114 _request: request,
3115 _parent: parent.to_string(),
3116 _entry_id: Default::default(),
3117 _delegate: Default::default(),
3118 _additional_params: Default::default(),
3119 _scopes: Default::default(),
3120 }
3121 }
3122
3123 /// Create a builder to help you perform the following task:
3124 ///
3125 /// Deletes an existing entry. You can delete only the entries created by the CreateEntry method. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3126 ///
3127 /// # Arguments
3128 ///
3129 /// * `name` - Required. The name of the entry to delete.
3130 pub fn locations_entry_groups_entries_delete(
3131 &self,
3132 name: &str,
3133 ) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
3134 ProjectLocationEntryGroupEntryDeleteCall {
3135 hub: self.hub,
3136 _name: name.to_string(),
3137 _delegate: Default::default(),
3138 _additional_params: Default::default(),
3139 _scopes: Default::default(),
3140 }
3141 }
3142
3143 /// Create a builder to help you perform the following task:
3144 ///
3145 /// Gets an entry.
3146 ///
3147 /// # Arguments
3148 ///
3149 /// * `name` - Required. The name of the entry to get.
3150 pub fn locations_entry_groups_entries_get(
3151 &self,
3152 name: &str,
3153 ) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
3154 ProjectLocationEntryGroupEntryGetCall {
3155 hub: self.hub,
3156 _name: name.to_string(),
3157 _delegate: Default::default(),
3158 _additional_params: Default::default(),
3159 _scopes: Default::default(),
3160 }
3161 }
3162
3163 /// Create a builder to help you perform the following task:
3164 ///
3165 /// Gets the access control policy for a resource. May return: * A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it. * An empty policy if the resource exists but doesn't have a set policy. Supported resources are: - Tag templates - Entry groups Note: This method doesn't get policies from Google Cloud Platform resources ingested into Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
3166 ///
3167 /// # Arguments
3168 ///
3169 /// * `request` - No description provided.
3170 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3171 pub fn locations_entry_groups_entries_get_iam_policy(
3172 &self,
3173 request: GetIamPolicyRequest,
3174 resource: &str,
3175 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
3176 ProjectLocationEntryGroupEntryGetIamPolicyCall {
3177 hub: self.hub,
3178 _request: request,
3179 _resource: resource.to_string(),
3180 _delegate: Default::default(),
3181 _additional_params: Default::default(),
3182 _scopes: Default::default(),
3183 }
3184 }
3185
3186 /// Create a builder to help you perform the following task:
3187 ///
3188 /// Imports entries from a source, such as data previously dumped into a Cloud Storage bucket, into Data Catalog. Import of entries is a sync operation that reconciles the state of the third-party system with the Data Catalog. `ImportEntries` accepts source data snapshots of a third-party system. Snapshot should be delivered as a .wire or base65-encoded .txt file containing a sequence of Protocol Buffer messages of DumpItem type. `ImportEntries` returns a long-running operation resource that can be queried with Operations.GetOperation to return ImportEntriesMetadata and an ImportEntriesResponse message.
3189 ///
3190 /// # Arguments
3191 ///
3192 /// * `request` - No description provided.
3193 /// * `parent` - Required. Target entry group for ingested entries.
3194 pub fn locations_entry_groups_entries_import(
3195 &self,
3196 request: GoogleCloudDatacatalogV1ImportEntriesRequest,
3197 parent: &str,
3198 ) -> ProjectLocationEntryGroupEntryImportCall<'a, C> {
3199 ProjectLocationEntryGroupEntryImportCall {
3200 hub: self.hub,
3201 _request: request,
3202 _parent: parent.to_string(),
3203 _delegate: Default::default(),
3204 _additional_params: Default::default(),
3205 _scopes: Default::default(),
3206 }
3207 }
3208
3209 /// Create a builder to help you perform the following task:
3210 ///
3211 /// Lists entries. Note: Currently, this method can list only custom entries. To get a list of both custom and automatically created entries, use SearchCatalog.
3212 ///
3213 /// # Arguments
3214 ///
3215 /// * `parent` - Required. The name of the entry group that contains the entries to list. Can be provided in URL format.
3216 pub fn locations_entry_groups_entries_list(
3217 &self,
3218 parent: &str,
3219 ) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
3220 ProjectLocationEntryGroupEntryListCall {
3221 hub: self.hub,
3222 _parent: parent.to_string(),
3223 _read_mask: Default::default(),
3224 _page_token: Default::default(),
3225 _page_size: Default::default(),
3226 _delegate: Default::default(),
3227 _additional_params: Default::default(),
3228 _scopes: Default::default(),
3229 }
3230 }
3231
3232 /// Create a builder to help you perform the following task:
3233 ///
3234 /// Modifies contacts, part of the business context of an Entry. To call this method, you must have the `datacatalog.entries.updateContacts` IAM permission on the corresponding project.
3235 ///
3236 /// # Arguments
3237 ///
3238 /// * `request` - No description provided.
3239 /// * `name` - Required. The full resource name of the entry.
3240 pub fn locations_entry_groups_entries_modify_entry_contacts(
3241 &self,
3242 request: GoogleCloudDatacatalogV1ModifyEntryContactsRequest,
3243 name: &str,
3244 ) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C> {
3245 ProjectLocationEntryGroupEntryModifyEntryContactCall {
3246 hub: self.hub,
3247 _request: request,
3248 _name: name.to_string(),
3249 _delegate: Default::default(),
3250 _additional_params: Default::default(),
3251 _scopes: Default::default(),
3252 }
3253 }
3254
3255 /// Create a builder to help you perform the following task:
3256 ///
3257 /// Modifies entry overview, part of the business context of an Entry. To call this method, you must have the `datacatalog.entries.updateOverview` IAM permission on the corresponding project.
3258 ///
3259 /// # Arguments
3260 ///
3261 /// * `request` - No description provided.
3262 /// * `name` - Required. The full resource name of the entry.
3263 pub fn locations_entry_groups_entries_modify_entry_overview(
3264 &self,
3265 request: GoogleCloudDatacatalogV1ModifyEntryOverviewRequest,
3266 name: &str,
3267 ) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C> {
3268 ProjectLocationEntryGroupEntryModifyEntryOverviewCall {
3269 hub: self.hub,
3270 _request: request,
3271 _name: name.to_string(),
3272 _delegate: Default::default(),
3273 _additional_params: Default::default(),
3274 _scopes: Default::default(),
3275 }
3276 }
3277
3278 /// Create a builder to help you perform the following task:
3279 ///
3280 /// Updates an existing entry. You must enable the Data Catalog API in the project identified by the `entry.name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3281 ///
3282 /// # Arguments
3283 ///
3284 /// * `request` - No description provided.
3285 /// * `name` - Output only. Identifier. The resource name of an entry in URL format. Note: The entry itself and its child resources might not be stored in the location specified in its name.
3286 pub fn locations_entry_groups_entries_patch(
3287 &self,
3288 request: GoogleCloudDatacatalogV1Entry,
3289 name: &str,
3290 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
3291 ProjectLocationEntryGroupEntryPatchCall {
3292 hub: self.hub,
3293 _request: request,
3294 _name: name.to_string(),
3295 _update_mask: Default::default(),
3296 _delegate: Default::default(),
3297 _additional_params: Default::default(),
3298 _scopes: Default::default(),
3299 }
3300 }
3301
3302 /// Create a builder to help you perform the following task:
3303 ///
3304 /// Marks an Entry as starred by the current user. Starring information is private to each user.
3305 ///
3306 /// # Arguments
3307 ///
3308 /// * `request` - No description provided.
3309 /// * `name` - Required. The name of the entry to mark as starred.
3310 pub fn locations_entry_groups_entries_star(
3311 &self,
3312 request: GoogleCloudDatacatalogV1StarEntryRequest,
3313 name: &str,
3314 ) -> ProjectLocationEntryGroupEntryStarCall<'a, C> {
3315 ProjectLocationEntryGroupEntryStarCall {
3316 hub: self.hub,
3317 _request: request,
3318 _name: name.to_string(),
3319 _delegate: Default::default(),
3320 _additional_params: Default::default(),
3321 _scopes: Default::default(),
3322 }
3323 }
3324
3325 /// Create a builder to help you perform the following task:
3326 ///
3327 /// Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist. Supported resources are: - Tag templates - Entry groups Note: This method gets policies only within Data Catalog and can't be used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources ingested into Data Catalog. No Google IAM permissions are required to call this method.
3328 ///
3329 /// # Arguments
3330 ///
3331 /// * `request` - No description provided.
3332 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3333 pub fn locations_entry_groups_entries_test_iam_permissions(
3334 &self,
3335 request: TestIamPermissionsRequest,
3336 resource: &str,
3337 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
3338 ProjectLocationEntryGroupEntryTestIamPermissionCall {
3339 hub: self.hub,
3340 _request: request,
3341 _resource: resource.to_string(),
3342 _delegate: Default::default(),
3343 _additional_params: Default::default(),
3344 _scopes: Default::default(),
3345 }
3346 }
3347
3348 /// Create a builder to help you perform the following task:
3349 ///
3350 /// Marks an Entry as NOT starred by the current user. Starring information is private to each user.
3351 ///
3352 /// # Arguments
3353 ///
3354 /// * `request` - No description provided.
3355 /// * `name` - Required. The name of the entry to mark as **not** starred.
3356 pub fn locations_entry_groups_entries_unstar(
3357 &self,
3358 request: GoogleCloudDatacatalogV1UnstarEntryRequest,
3359 name: &str,
3360 ) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C> {
3361 ProjectLocationEntryGroupEntryUnstarCall {
3362 hub: self.hub,
3363 _request: request,
3364 _name: name.to_string(),
3365 _delegate: Default::default(),
3366 _additional_params: Default::default(),
3367 _scopes: Default::default(),
3368 }
3369 }
3370
3371 /// Create a builder to help you perform the following task:
3372 ///
3373 /// Creates a tag and assigns it to: * An Entry if the method name is `projects.locations.entryGroups.entries.tags.create`. * Or EntryGroupif the method name is `projects.locations.entryGroups.tags.create`. Note: The project identified by the `parent` parameter for the [tag] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be in the same organization.
3374 ///
3375 /// # Arguments
3376 ///
3377 /// * `request` - No description provided.
3378 /// * `parent` - Required. The name of the resource to attach this tag to. Tags can be attached to entries or entry groups. An entry can have up to 1000 attached tags. Note: The tag and its child resources might not be stored in the location specified in its name.
3379 pub fn locations_entry_groups_tags_create(
3380 &self,
3381 request: GoogleCloudDatacatalogV1Tag,
3382 parent: &str,
3383 ) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
3384 ProjectLocationEntryGroupTagCreateCall {
3385 hub: self.hub,
3386 _request: request,
3387 _parent: parent.to_string(),
3388 _delegate: Default::default(),
3389 _additional_params: Default::default(),
3390 _scopes: Default::default(),
3391 }
3392 }
3393
3394 /// Create a builder to help you perform the following task:
3395 ///
3396 /// Deletes a tag.
3397 ///
3398 /// # Arguments
3399 ///
3400 /// * `name` - Required. The name of the tag to delete.
3401 pub fn locations_entry_groups_tags_delete(
3402 &self,
3403 name: &str,
3404 ) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
3405 ProjectLocationEntryGroupTagDeleteCall {
3406 hub: self.hub,
3407 _name: name.to_string(),
3408 _delegate: Default::default(),
3409 _additional_params: Default::default(),
3410 _scopes: Default::default(),
3411 }
3412 }
3413
3414 /// Create a builder to help you perform the following task:
3415 ///
3416 /// Lists tags assigned to an Entry. The columns in the response are lowercased.
3417 ///
3418 /// # Arguments
3419 ///
3420 /// * `parent` - Required. The name of the Data Catalog resource to list the tags of. The resource can be an Entry or an EntryGroup (without `/entries/{entries}` at the end).
3421 pub fn locations_entry_groups_tags_list(
3422 &self,
3423 parent: &str,
3424 ) -> ProjectLocationEntryGroupTagListCall<'a, C> {
3425 ProjectLocationEntryGroupTagListCall {
3426 hub: self.hub,
3427 _parent: parent.to_string(),
3428 _page_token: Default::default(),
3429 _page_size: Default::default(),
3430 _delegate: Default::default(),
3431 _additional_params: Default::default(),
3432 _scopes: Default::default(),
3433 }
3434 }
3435
3436 /// Create a builder to help you perform the following task:
3437 ///
3438 /// Updates an existing tag.
3439 ///
3440 /// # Arguments
3441 ///
3442 /// * `request` - No description provided.
3443 /// * `name` - Identifier. The resource name of the tag in URL format where tag ID is a system-generated identifier. Note: The tag itself might not be stored in the location specified in its name.
3444 pub fn locations_entry_groups_tags_patch(
3445 &self,
3446 request: GoogleCloudDatacatalogV1Tag,
3447 name: &str,
3448 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
3449 ProjectLocationEntryGroupTagPatchCall {
3450 hub: self.hub,
3451 _request: request,
3452 _name: name.to_string(),
3453 _update_mask: Default::default(),
3454 _delegate: Default::default(),
3455 _additional_params: Default::default(),
3456 _scopes: Default::default(),
3457 }
3458 }
3459
3460 /// Create a builder to help you perform the following task:
3461 ///
3462 /// Creates an entry group. An entry group contains logically related entries together with [Cloud Identity and Access Management](https://cloud.google.com/data-catalog/docs/concepts/iam) policies. These policies specify users who can create, edit, and view entries within entry groups. Data Catalog automatically creates entry groups with names that start with the `@` symbol for the following resources: * BigQuery entries (`@bigquery`) * Pub/Sub topics (`@pubsub`) * Dataproc Metastore services (`@dataproc_metastore_{SERVICE_NAME_HASH}`) You can create your own entry groups for Cloud Storage fileset entries and custom entries together with the corresponding IAM policies. User-created entry groups can’t contain the `@` symbol, it is reserved for automatically created groups. Entry groups, like entries, can be searched. A maximum of 10,000 entry groups may be created per organization across all locations. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3463 ///
3464 /// # Arguments
3465 ///
3466 /// * `request` - No description provided.
3467 /// * `parent` - Required. The names of the project and location that the new entry group belongs to. Note: The entry group itself and its child resources might not be stored in the location specified in its name.
3468 pub fn locations_entry_groups_create(
3469 &self,
3470 request: GoogleCloudDatacatalogV1EntryGroup,
3471 parent: &str,
3472 ) -> ProjectLocationEntryGroupCreateCall<'a, C> {
3473 ProjectLocationEntryGroupCreateCall {
3474 hub: self.hub,
3475 _request: request,
3476 _parent: parent.to_string(),
3477 _entry_group_id: Default::default(),
3478 _delegate: Default::default(),
3479 _additional_params: Default::default(),
3480 _scopes: Default::default(),
3481 }
3482 }
3483
3484 /// Create a builder to help you perform the following task:
3485 ///
3486 /// Deletes an entry group. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3487 ///
3488 /// # Arguments
3489 ///
3490 /// * `name` - Required. The name of the entry group to delete.
3491 pub fn locations_entry_groups_delete(
3492 &self,
3493 name: &str,
3494 ) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
3495 ProjectLocationEntryGroupDeleteCall {
3496 hub: self.hub,
3497 _name: name.to_string(),
3498 _force: Default::default(),
3499 _delegate: Default::default(),
3500 _additional_params: Default::default(),
3501 _scopes: Default::default(),
3502 }
3503 }
3504
3505 /// Create a builder to help you perform the following task:
3506 ///
3507 /// Gets an entry group.
3508 ///
3509 /// # Arguments
3510 ///
3511 /// * `name` - Required. The name of the entry group to get.
3512 pub fn locations_entry_groups_get(
3513 &self,
3514 name: &str,
3515 ) -> ProjectLocationEntryGroupGetCall<'a, C> {
3516 ProjectLocationEntryGroupGetCall {
3517 hub: self.hub,
3518 _name: name.to_string(),
3519 _read_mask: Default::default(),
3520 _delegate: Default::default(),
3521 _additional_params: Default::default(),
3522 _scopes: Default::default(),
3523 }
3524 }
3525
3526 /// Create a builder to help you perform the following task:
3527 ///
3528 /// Gets the access control policy for a resource. May return: * A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it. * An empty policy if the resource exists but doesn't have a set policy. Supported resources are: - Tag templates - Entry groups Note: This method doesn't get policies from Google Cloud Platform resources ingested into Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
3529 ///
3530 /// # Arguments
3531 ///
3532 /// * `request` - No description provided.
3533 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3534 pub fn locations_entry_groups_get_iam_policy(
3535 &self,
3536 request: GetIamPolicyRequest,
3537 resource: &str,
3538 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
3539 ProjectLocationEntryGroupGetIamPolicyCall {
3540 hub: self.hub,
3541 _request: request,
3542 _resource: resource.to_string(),
3543 _delegate: Default::default(),
3544 _additional_params: Default::default(),
3545 _scopes: Default::default(),
3546 }
3547 }
3548
3549 /// Create a builder to help you perform the following task:
3550 ///
3551 /// Lists entry groups.
3552 ///
3553 /// # Arguments
3554 ///
3555 /// * `parent` - Required. The name of the location that contains the entry groups to list. Can be provided as a URL.
3556 pub fn locations_entry_groups_list(
3557 &self,
3558 parent: &str,
3559 ) -> ProjectLocationEntryGroupListCall<'a, C> {
3560 ProjectLocationEntryGroupListCall {
3561 hub: self.hub,
3562 _parent: parent.to_string(),
3563 _page_token: Default::default(),
3564 _page_size: Default::default(),
3565 _delegate: Default::default(),
3566 _additional_params: Default::default(),
3567 _scopes: Default::default(),
3568 }
3569 }
3570
3571 /// Create a builder to help you perform the following task:
3572 ///
3573 /// Updates an entry group. You must enable the Data Catalog API in the project identified by the `entry_group.name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3574 ///
3575 /// # Arguments
3576 ///
3577 /// * `request` - No description provided.
3578 /// * `name` - Identifier. The resource name of the entry group in URL format. Note: The entry group itself and its child resources might not be stored in the location specified in its name.
3579 pub fn locations_entry_groups_patch(
3580 &self,
3581 request: GoogleCloudDatacatalogV1EntryGroup,
3582 name: &str,
3583 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
3584 ProjectLocationEntryGroupPatchCall {
3585 hub: self.hub,
3586 _request: request,
3587 _name: name.to_string(),
3588 _update_mask: Default::default(),
3589 _delegate: Default::default(),
3590 _additional_params: Default::default(),
3591 _scopes: Default::default(),
3592 }
3593 }
3594
3595 /// Create a builder to help you perform the following task:
3596 ///
3597 /// Sets an access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates - Entry groups Note: This method sets policies only within Data Catalog and can't be used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources synced with the Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
3598 ///
3599 /// # Arguments
3600 ///
3601 /// * `request` - No description provided.
3602 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3603 pub fn locations_entry_groups_set_iam_policy(
3604 &self,
3605 request: SetIamPolicyRequest,
3606 resource: &str,
3607 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
3608 ProjectLocationEntryGroupSetIamPolicyCall {
3609 hub: self.hub,
3610 _request: request,
3611 _resource: resource.to_string(),
3612 _delegate: Default::default(),
3613 _additional_params: Default::default(),
3614 _scopes: Default::default(),
3615 }
3616 }
3617
3618 /// Create a builder to help you perform the following task:
3619 ///
3620 /// Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist. Supported resources are: - Tag templates - Entry groups Note: This method gets policies only within Data Catalog and can't be used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources ingested into Data Catalog. No Google IAM permissions are required to call this method.
3621 ///
3622 /// # Arguments
3623 ///
3624 /// * `request` - No description provided.
3625 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3626 pub fn locations_entry_groups_test_iam_permissions(
3627 &self,
3628 request: TestIamPermissionsRequest,
3629 resource: &str,
3630 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
3631 ProjectLocationEntryGroupTestIamPermissionCall {
3632 hub: self.hub,
3633 _request: request,
3634 _resource: resource.to_string(),
3635 _delegate: Default::default(),
3636 _additional_params: Default::default(),
3637 _scopes: Default::default(),
3638 }
3639 }
3640
3641 /// Create a builder to help you perform the following task:
3642 ///
3643 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
3644 ///
3645 /// # Arguments
3646 ///
3647 /// * `name` - The name of the operation resource to be cancelled.
3648 pub fn locations_operations_cancel(
3649 &self,
3650 name: &str,
3651 ) -> ProjectLocationOperationCancelCall<'a, C> {
3652 ProjectLocationOperationCancelCall {
3653 hub: self.hub,
3654 _name: name.to_string(),
3655 _delegate: Default::default(),
3656 _additional_params: Default::default(),
3657 _scopes: Default::default(),
3658 }
3659 }
3660
3661 /// Create a builder to help you perform the following task:
3662 ///
3663 /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
3664 ///
3665 /// # Arguments
3666 ///
3667 /// * `name` - The name of the operation resource to be deleted.
3668 pub fn locations_operations_delete(
3669 &self,
3670 name: &str,
3671 ) -> ProjectLocationOperationDeleteCall<'a, C> {
3672 ProjectLocationOperationDeleteCall {
3673 hub: self.hub,
3674 _name: name.to_string(),
3675 _delegate: Default::default(),
3676 _additional_params: Default::default(),
3677 _scopes: Default::default(),
3678 }
3679 }
3680
3681 /// Create a builder to help you perform the following task:
3682 ///
3683 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3684 ///
3685 /// # Arguments
3686 ///
3687 /// * `name` - The name of the operation resource.
3688 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
3689 ProjectLocationOperationGetCall {
3690 hub: self.hub,
3691 _name: name.to_string(),
3692 _delegate: Default::default(),
3693 _additional_params: Default::default(),
3694 _scopes: Default::default(),
3695 }
3696 }
3697
3698 /// Create a builder to help you perform the following task:
3699 ///
3700 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3701 ///
3702 /// # Arguments
3703 ///
3704 /// * `name` - The name of the operation's parent resource.
3705 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
3706 ProjectLocationOperationListCall {
3707 hub: self.hub,
3708 _name: name.to_string(),
3709 _return_partial_success: Default::default(),
3710 _page_token: Default::default(),
3711 _page_size: Default::default(),
3712 _filter: Default::default(),
3713 _delegate: Default::default(),
3714 _additional_params: Default::default(),
3715 _scopes: Default::default(),
3716 }
3717 }
3718
3719 /// Create a builder to help you perform the following task:
3720 ///
3721 /// Renames an enum value in a tag template. Within a single enum field, enum values must be unique.
3722 ///
3723 /// # Arguments
3724 ///
3725 /// * `request` - No description provided.
3726 /// * `name` - Required. The name of the enum field value.
3727 pub fn locations_tag_templates_fields_enum_values_rename(
3728 &self,
3729 request: GoogleCloudDatacatalogV1RenameTagTemplateFieldEnumValueRequest,
3730 name: &str,
3731 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
3732 ProjectLocationTagTemplateFieldEnumValueRenameCall {
3733 hub: self.hub,
3734 _request: request,
3735 _name: name.to_string(),
3736 _delegate: Default::default(),
3737 _additional_params: Default::default(),
3738 _scopes: Default::default(),
3739 }
3740 }
3741
3742 /// Create a builder to help you perform the following task:
3743 ///
3744 /// Creates a field in a tag template. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3745 ///
3746 /// # Arguments
3747 ///
3748 /// * `request` - No description provided.
3749 /// * `parent` - Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions).
3750 pub fn locations_tag_templates_fields_create(
3751 &self,
3752 request: GoogleCloudDatacatalogV1TagTemplateField,
3753 parent: &str,
3754 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
3755 ProjectLocationTagTemplateFieldCreateCall {
3756 hub: self.hub,
3757 _request: request,
3758 _parent: parent.to_string(),
3759 _tag_template_field_id: Default::default(),
3760 _delegate: Default::default(),
3761 _additional_params: Default::default(),
3762 _scopes: Default::default(),
3763 }
3764 }
3765
3766 /// Create a builder to help you perform the following task:
3767 ///
3768 /// Deletes a field in a tag template and all uses of this field from the tags based on this template. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3769 ///
3770 /// # Arguments
3771 ///
3772 /// * `name` - Required. The name of the tag template field to delete.
3773 pub fn locations_tag_templates_fields_delete(
3774 &self,
3775 name: &str,
3776 ) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
3777 ProjectLocationTagTemplateFieldDeleteCall {
3778 hub: self.hub,
3779 _name: name.to_string(),
3780 _force: Default::default(),
3781 _delegate: Default::default(),
3782 _additional_params: Default::default(),
3783 _scopes: Default::default(),
3784 }
3785 }
3786
3787 /// Create a builder to help you perform the following task:
3788 ///
3789 /// Updates a field in a tag template. You can't update the field type with this method. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3790 ///
3791 /// # Arguments
3792 ///
3793 /// * `request` - No description provided.
3794 /// * `name` - Required. The name of the tag template field.
3795 pub fn locations_tag_templates_fields_patch(
3796 &self,
3797 request: GoogleCloudDatacatalogV1TagTemplateField,
3798 name: &str,
3799 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
3800 ProjectLocationTagTemplateFieldPatchCall {
3801 hub: self.hub,
3802 _request: request,
3803 _name: name.to_string(),
3804 _update_mask: Default::default(),
3805 _delegate: Default::default(),
3806 _additional_params: Default::default(),
3807 _scopes: Default::default(),
3808 }
3809 }
3810
3811 /// Create a builder to help you perform the following task:
3812 ///
3813 /// Renames a field in a tag template. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3814 ///
3815 /// # Arguments
3816 ///
3817 /// * `request` - No description provided.
3818 /// * `name` - Required. The name of the tag template field.
3819 pub fn locations_tag_templates_fields_rename(
3820 &self,
3821 request: GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest,
3822 name: &str,
3823 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
3824 ProjectLocationTagTemplateFieldRenameCall {
3825 hub: self.hub,
3826 _request: request,
3827 _name: name.to_string(),
3828 _delegate: Default::default(),
3829 _additional_params: Default::default(),
3830 _scopes: Default::default(),
3831 }
3832 }
3833
3834 /// Create a builder to help you perform the following task:
3835 ///
3836 /// Creates a tag template. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3837 ///
3838 /// # Arguments
3839 ///
3840 /// * `request` - No description provided.
3841 /// * `parent` - Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions).
3842 pub fn locations_tag_templates_create(
3843 &self,
3844 request: GoogleCloudDatacatalogV1TagTemplate,
3845 parent: &str,
3846 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
3847 ProjectLocationTagTemplateCreateCall {
3848 hub: self.hub,
3849 _request: request,
3850 _parent: parent.to_string(),
3851 _tag_template_id: Default::default(),
3852 _delegate: Default::default(),
3853 _additional_params: Default::default(),
3854 _scopes: Default::default(),
3855 }
3856 }
3857
3858 /// Create a builder to help you perform the following task:
3859 ///
3860 /// Deletes a tag template and all tags that use it. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3861 ///
3862 /// # Arguments
3863 ///
3864 /// * `name` - Required. The name of the tag template to delete.
3865 pub fn locations_tag_templates_delete(
3866 &self,
3867 name: &str,
3868 ) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
3869 ProjectLocationTagTemplateDeleteCall {
3870 hub: self.hub,
3871 _name: name.to_string(),
3872 _force: Default::default(),
3873 _delegate: Default::default(),
3874 _additional_params: Default::default(),
3875 _scopes: Default::default(),
3876 }
3877 }
3878
3879 /// Create a builder to help you perform the following task:
3880 ///
3881 /// Gets a tag template.
3882 ///
3883 /// # Arguments
3884 ///
3885 /// * `name` - Required. The name of the tag template to get.
3886 pub fn locations_tag_templates_get(
3887 &self,
3888 name: &str,
3889 ) -> ProjectLocationTagTemplateGetCall<'a, C> {
3890 ProjectLocationTagTemplateGetCall {
3891 hub: self.hub,
3892 _name: name.to_string(),
3893 _delegate: Default::default(),
3894 _additional_params: Default::default(),
3895 _scopes: Default::default(),
3896 }
3897 }
3898
3899 /// Create a builder to help you perform the following task:
3900 ///
3901 /// Gets the access control policy for a resource. May return: * A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it. * An empty policy if the resource exists but doesn't have a set policy. Supported resources are: - Tag templates - Entry groups Note: This method doesn't get policies from Google Cloud Platform resources ingested into Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
3902 ///
3903 /// # Arguments
3904 ///
3905 /// * `request` - No description provided.
3906 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3907 pub fn locations_tag_templates_get_iam_policy(
3908 &self,
3909 request: GetIamPolicyRequest,
3910 resource: &str,
3911 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
3912 ProjectLocationTagTemplateGetIamPolicyCall {
3913 hub: self.hub,
3914 _request: request,
3915 _resource: resource.to_string(),
3916 _delegate: Default::default(),
3917 _additional_params: Default::default(),
3918 _scopes: Default::default(),
3919 }
3920 }
3921
3922 /// Create a builder to help you perform the following task:
3923 ///
3924 /// Updates a tag template. You can't update template fields with this method. These fields are separate resources with their own create, update, and delete methods. You must enable the Data Catalog API in the project identified by the `tag_template.name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
3925 ///
3926 /// # Arguments
3927 ///
3928 /// * `request` - No description provided.
3929 /// * `name` - Identifier. The resource name of the tag template in URL format. Note: The tag template itself and its child resources might not be stored in the location specified in its name.
3930 pub fn locations_tag_templates_patch(
3931 &self,
3932 request: GoogleCloudDatacatalogV1TagTemplate,
3933 name: &str,
3934 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
3935 ProjectLocationTagTemplatePatchCall {
3936 hub: self.hub,
3937 _request: request,
3938 _name: name.to_string(),
3939 _update_mask: Default::default(),
3940 _delegate: Default::default(),
3941 _additional_params: Default::default(),
3942 _scopes: Default::default(),
3943 }
3944 }
3945
3946 /// Create a builder to help you perform the following task:
3947 ///
3948 /// Sets an access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates - Entry groups Note: This method sets policies only within Data Catalog and can't be used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources synced with the Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
3949 ///
3950 /// # Arguments
3951 ///
3952 /// * `request` - No description provided.
3953 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3954 pub fn locations_tag_templates_set_iam_policy(
3955 &self,
3956 request: SetIamPolicyRequest,
3957 resource: &str,
3958 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
3959 ProjectLocationTagTemplateSetIamPolicyCall {
3960 hub: self.hub,
3961 _request: request,
3962 _resource: resource.to_string(),
3963 _delegate: Default::default(),
3964 _additional_params: Default::default(),
3965 _scopes: Default::default(),
3966 }
3967 }
3968
3969 /// Create a builder to help you perform the following task:
3970 ///
3971 /// Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist. Supported resources are: - Tag templates - Entry groups Note: This method gets policies only within Data Catalog and can't be used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources ingested into Data Catalog. No Google IAM permissions are required to call this method.
3972 ///
3973 /// # Arguments
3974 ///
3975 /// * `request` - No description provided.
3976 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3977 pub fn locations_tag_templates_test_iam_permissions(
3978 &self,
3979 request: TestIamPermissionsRequest,
3980 resource: &str,
3981 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
3982 ProjectLocationTagTemplateTestIamPermissionCall {
3983 hub: self.hub,
3984 _request: request,
3985 _resource: resource.to_string(),
3986 _delegate: Default::default(),
3987 _additional_params: Default::default(),
3988 _scopes: Default::default(),
3989 }
3990 }
3991
3992 /// Create a builder to help you perform the following task:
3993 ///
3994 /// Creates a policy tag in a taxonomy.
3995 ///
3996 /// # Arguments
3997 ///
3998 /// * `request` - No description provided.
3999 /// * `parent` - Required. Resource name of the taxonomy that the policy tag will belong to.
4000 pub fn locations_taxonomies_policy_tags_create(
4001 &self,
4002 request: GoogleCloudDatacatalogV1PolicyTag,
4003 parent: &str,
4004 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
4005 ProjectLocationTaxonomyPolicyTagCreateCall {
4006 hub: self.hub,
4007 _request: request,
4008 _parent: parent.to_string(),
4009 _delegate: Default::default(),
4010 _additional_params: Default::default(),
4011 _scopes: Default::default(),
4012 }
4013 }
4014
4015 /// Create a builder to help you perform the following task:
4016 ///
4017 /// Deletes a policy tag together with the following: * All of its descendant policy tags, if any * Policies associated with the policy tag and its descendants * References from BigQuery table schema of the policy tag and its descendants
4018 ///
4019 /// # Arguments
4020 ///
4021 /// * `name` - Required. Resource name of the policy tag to delete. Note: All of its descendant policy tags are also deleted.
4022 pub fn locations_taxonomies_policy_tags_delete(
4023 &self,
4024 name: &str,
4025 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
4026 ProjectLocationTaxonomyPolicyTagDeleteCall {
4027 hub: self.hub,
4028 _name: name.to_string(),
4029 _delegate: Default::default(),
4030 _additional_params: Default::default(),
4031 _scopes: Default::default(),
4032 }
4033 }
4034
4035 /// Create a builder to help you perform the following task:
4036 ///
4037 /// Gets a policy tag.
4038 ///
4039 /// # Arguments
4040 ///
4041 /// * `name` - Required. Resource name of the policy tag.
4042 pub fn locations_taxonomies_policy_tags_get(
4043 &self,
4044 name: &str,
4045 ) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
4046 ProjectLocationTaxonomyPolicyTagGetCall {
4047 hub: self.hub,
4048 _name: name.to_string(),
4049 _delegate: Default::default(),
4050 _additional_params: Default::default(),
4051 _scopes: Default::default(),
4052 }
4053 }
4054
4055 /// Create a builder to help you perform the following task:
4056 ///
4057 /// Gets the IAM policy for a policy tag or a taxonomy.
4058 ///
4059 /// # Arguments
4060 ///
4061 /// * `request` - No description provided.
4062 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4063 pub fn locations_taxonomies_policy_tags_get_iam_policy(
4064 &self,
4065 request: GetIamPolicyRequest,
4066 resource: &str,
4067 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
4068 ProjectLocationTaxonomyPolicyTagGetIamPolicyCall {
4069 hub: self.hub,
4070 _request: request,
4071 _resource: resource.to_string(),
4072 _delegate: Default::default(),
4073 _additional_params: Default::default(),
4074 _scopes: Default::default(),
4075 }
4076 }
4077
4078 /// Create a builder to help you perform the following task:
4079 ///
4080 /// Lists all policy tags in a taxonomy.
4081 ///
4082 /// # Arguments
4083 ///
4084 /// * `parent` - Required. Resource name of the taxonomy to list the policy tags of.
4085 pub fn locations_taxonomies_policy_tags_list(
4086 &self,
4087 parent: &str,
4088 ) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
4089 ProjectLocationTaxonomyPolicyTagListCall {
4090 hub: self.hub,
4091 _parent: parent.to_string(),
4092 _page_token: Default::default(),
4093 _page_size: Default::default(),
4094 _delegate: Default::default(),
4095 _additional_params: Default::default(),
4096 _scopes: Default::default(),
4097 }
4098 }
4099
4100 /// Create a builder to help you perform the following task:
4101 ///
4102 /// Updates a policy tag, including its display name, description, and parent policy tag.
4103 ///
4104 /// # Arguments
4105 ///
4106 /// * `request` - No description provided.
4107 /// * `name` - Identifier. Resource name of this policy tag in the URL format. The policy tag manager generates unique taxonomy IDs and policy tag IDs.
4108 pub fn locations_taxonomies_policy_tags_patch(
4109 &self,
4110 request: GoogleCloudDatacatalogV1PolicyTag,
4111 name: &str,
4112 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
4113 ProjectLocationTaxonomyPolicyTagPatchCall {
4114 hub: self.hub,
4115 _request: request,
4116 _name: name.to_string(),
4117 _update_mask: Default::default(),
4118 _delegate: Default::default(),
4119 _additional_params: Default::default(),
4120 _scopes: Default::default(),
4121 }
4122 }
4123
4124 /// Create a builder to help you perform the following task:
4125 ///
4126 /// Sets the IAM policy for a policy tag or a taxonomy.
4127 ///
4128 /// # Arguments
4129 ///
4130 /// * `request` - No description provided.
4131 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4132 pub fn locations_taxonomies_policy_tags_set_iam_policy(
4133 &self,
4134 request: SetIamPolicyRequest,
4135 resource: &str,
4136 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
4137 ProjectLocationTaxonomyPolicyTagSetIamPolicyCall {
4138 hub: self.hub,
4139 _request: request,
4140 _resource: resource.to_string(),
4141 _delegate: Default::default(),
4142 _additional_params: Default::default(),
4143 _scopes: Default::default(),
4144 }
4145 }
4146
4147 /// Create a builder to help you perform the following task:
4148 ///
4149 /// Returns your permissions on a specified policy tag or taxonomy.
4150 ///
4151 /// # Arguments
4152 ///
4153 /// * `request` - No description provided.
4154 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4155 pub fn locations_taxonomies_policy_tags_test_iam_permissions(
4156 &self,
4157 request: TestIamPermissionsRequest,
4158 resource: &str,
4159 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
4160 ProjectLocationTaxonomyPolicyTagTestIamPermissionCall {
4161 hub: self.hub,
4162 _request: request,
4163 _resource: resource.to_string(),
4164 _delegate: Default::default(),
4165 _additional_params: Default::default(),
4166 _scopes: Default::default(),
4167 }
4168 }
4169
4170 /// Create a builder to help you perform the following task:
4171 ///
4172 /// Creates a taxonomy in a specified project. The taxonomy is initially empty, that is, it doesn't contain policy tags.
4173 ///
4174 /// # Arguments
4175 ///
4176 /// * `request` - No description provided.
4177 /// * `parent` - Required. Resource name of the project that the taxonomy will belong to.
4178 pub fn locations_taxonomies_create(
4179 &self,
4180 request: GoogleCloudDatacatalogV1Taxonomy,
4181 parent: &str,
4182 ) -> ProjectLocationTaxonomyCreateCall<'a, C> {
4183 ProjectLocationTaxonomyCreateCall {
4184 hub: self.hub,
4185 _request: request,
4186 _parent: parent.to_string(),
4187 _delegate: Default::default(),
4188 _additional_params: Default::default(),
4189 _scopes: Default::default(),
4190 }
4191 }
4192
4193 /// Create a builder to help you perform the following task:
4194 ///
4195 /// Deletes a taxonomy, including all policy tags in this taxonomy, their associated policies, and the policy tags references from BigQuery columns.
4196 ///
4197 /// # Arguments
4198 ///
4199 /// * `name` - Required. Resource name of the taxonomy to delete. Note: All policy tags in this taxonomy are also deleted.
4200 pub fn locations_taxonomies_delete(
4201 &self,
4202 name: &str,
4203 ) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
4204 ProjectLocationTaxonomyDeleteCall {
4205 hub: self.hub,
4206 _name: name.to_string(),
4207 _delegate: Default::default(),
4208 _additional_params: Default::default(),
4209 _scopes: Default::default(),
4210 }
4211 }
4212
4213 /// Create a builder to help you perform the following task:
4214 ///
4215 /// Exports taxonomies in the requested type and returns them, including their policy tags. The requested taxonomies must belong to the same project. This method generates `SerializedTaxonomy` protocol buffers with nested policy tags that can be used as input for `ImportTaxonomies` calls.
4216 ///
4217 /// # Arguments
4218 ///
4219 /// * `parent` - Required. Resource name of the project that the exported taxonomies belong to.
4220 pub fn locations_taxonomies_export(
4221 &self,
4222 parent: &str,
4223 ) -> ProjectLocationTaxonomyExportCall<'a, C> {
4224 ProjectLocationTaxonomyExportCall {
4225 hub: self.hub,
4226 _parent: parent.to_string(),
4227 _taxonomies: Default::default(),
4228 _serialized_taxonomies: Default::default(),
4229 _delegate: Default::default(),
4230 _additional_params: Default::default(),
4231 _scopes: Default::default(),
4232 }
4233 }
4234
4235 /// Create a builder to help you perform the following task:
4236 ///
4237 /// Gets a taxonomy.
4238 ///
4239 /// # Arguments
4240 ///
4241 /// * `name` - Required. Resource name of the taxonomy to get.
4242 pub fn locations_taxonomies_get(&self, name: &str) -> ProjectLocationTaxonomyGetCall<'a, C> {
4243 ProjectLocationTaxonomyGetCall {
4244 hub: self.hub,
4245 _name: name.to_string(),
4246 _delegate: Default::default(),
4247 _additional_params: Default::default(),
4248 _scopes: Default::default(),
4249 }
4250 }
4251
4252 /// Create a builder to help you perform the following task:
4253 ///
4254 /// Gets the IAM policy for a policy tag or a taxonomy.
4255 ///
4256 /// # Arguments
4257 ///
4258 /// * `request` - No description provided.
4259 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4260 pub fn locations_taxonomies_get_iam_policy(
4261 &self,
4262 request: GetIamPolicyRequest,
4263 resource: &str,
4264 ) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
4265 ProjectLocationTaxonomyGetIamPolicyCall {
4266 hub: self.hub,
4267 _request: request,
4268 _resource: resource.to_string(),
4269 _delegate: Default::default(),
4270 _additional_params: Default::default(),
4271 _scopes: Default::default(),
4272 }
4273 }
4274
4275 /// Create a builder to help you perform the following task:
4276 ///
4277 /// Creates new taxonomies (including their policy tags) in a given project by importing from inlined or cross-regional sources. For a cross-regional source, new taxonomies are created by copying from a source in another region. For an inlined source, taxonomies and policy tags are created in bulk using nested protocol buffer structures.
4278 ///
4279 /// # Arguments
4280 ///
4281 /// * `request` - No description provided.
4282 /// * `parent` - Required. Resource name of project that the imported taxonomies will belong to.
4283 pub fn locations_taxonomies_import(
4284 &self,
4285 request: GoogleCloudDatacatalogV1ImportTaxonomiesRequest,
4286 parent: &str,
4287 ) -> ProjectLocationTaxonomyImportCall<'a, C> {
4288 ProjectLocationTaxonomyImportCall {
4289 hub: self.hub,
4290 _request: request,
4291 _parent: parent.to_string(),
4292 _delegate: Default::default(),
4293 _additional_params: Default::default(),
4294 _scopes: Default::default(),
4295 }
4296 }
4297
4298 /// Create a builder to help you perform the following task:
4299 ///
4300 /// Lists all taxonomies in a project in a particular location that you have a permission to view.
4301 ///
4302 /// # Arguments
4303 ///
4304 /// * `parent` - Required. Resource name of the project to list the taxonomies of.
4305 pub fn locations_taxonomies_list(
4306 &self,
4307 parent: &str,
4308 ) -> ProjectLocationTaxonomyListCall<'a, C> {
4309 ProjectLocationTaxonomyListCall {
4310 hub: self.hub,
4311 _parent: parent.to_string(),
4312 _page_token: Default::default(),
4313 _page_size: Default::default(),
4314 _filter: Default::default(),
4315 _delegate: Default::default(),
4316 _additional_params: Default::default(),
4317 _scopes: Default::default(),
4318 }
4319 }
4320
4321 /// Create a builder to help you perform the following task:
4322 ///
4323 /// Updates a taxonomy, including its display name, description, and activated policy types.
4324 ///
4325 /// # Arguments
4326 ///
4327 /// * `request` - No description provided.
4328 /// * `name` - Identifier. Resource name of this taxonomy in URL format. Note: Policy tag manager generates unique taxonomy IDs.
4329 pub fn locations_taxonomies_patch(
4330 &self,
4331 request: GoogleCloudDatacatalogV1Taxonomy,
4332 name: &str,
4333 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
4334 ProjectLocationTaxonomyPatchCall {
4335 hub: self.hub,
4336 _request: request,
4337 _name: name.to_string(),
4338 _update_mask: Default::default(),
4339 _delegate: Default::default(),
4340 _additional_params: Default::default(),
4341 _scopes: Default::default(),
4342 }
4343 }
4344
4345 /// Create a builder to help you perform the following task:
4346 ///
4347 /// Replaces (updates) a taxonomy and all its policy tags. The taxonomy and its entire hierarchy of policy tags must be represented literally by `SerializedTaxonomy` and the nested `SerializedPolicyTag` messages. This operation automatically does the following: - Deletes the existing policy tags that are missing from the `SerializedPolicyTag`. - Creates policy tags that don't have resource names. They are considered new. - Updates policy tags with valid resources names accordingly.
4348 ///
4349 /// # Arguments
4350 ///
4351 /// * `request` - No description provided.
4352 /// * `name` - Required. Resource name of the taxonomy to update.
4353 pub fn locations_taxonomies_replace(
4354 &self,
4355 request: GoogleCloudDatacatalogV1ReplaceTaxonomyRequest,
4356 name: &str,
4357 ) -> ProjectLocationTaxonomyReplaceCall<'a, C> {
4358 ProjectLocationTaxonomyReplaceCall {
4359 hub: self.hub,
4360 _request: request,
4361 _name: name.to_string(),
4362 _delegate: Default::default(),
4363 _additional_params: Default::default(),
4364 _scopes: Default::default(),
4365 }
4366 }
4367
4368 /// Create a builder to help you perform the following task:
4369 ///
4370 /// Sets the IAM policy for a policy tag or a taxonomy.
4371 ///
4372 /// # Arguments
4373 ///
4374 /// * `request` - No description provided.
4375 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4376 pub fn locations_taxonomies_set_iam_policy(
4377 &self,
4378 request: SetIamPolicyRequest,
4379 resource: &str,
4380 ) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
4381 ProjectLocationTaxonomySetIamPolicyCall {
4382 hub: self.hub,
4383 _request: request,
4384 _resource: resource.to_string(),
4385 _delegate: Default::default(),
4386 _additional_params: Default::default(),
4387 _scopes: Default::default(),
4388 }
4389 }
4390
4391 /// Create a builder to help you perform the following task:
4392 ///
4393 /// Returns your permissions on a specified policy tag or taxonomy.
4394 ///
4395 /// # Arguments
4396 ///
4397 /// * `request` - No description provided.
4398 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4399 pub fn locations_taxonomies_test_iam_permissions(
4400 &self,
4401 request: TestIamPermissionsRequest,
4402 resource: &str,
4403 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
4404 ProjectLocationTaxonomyTestIamPermissionCall {
4405 hub: self.hub,
4406 _request: request,
4407 _resource: resource.to_string(),
4408 _delegate: Default::default(),
4409 _additional_params: Default::default(),
4410 _scopes: Default::default(),
4411 }
4412 }
4413
4414 /// Create a builder to help you perform the following task:
4415 ///
4416 /// Retrieves the effective configuration related to the migration from Data Catalog to Dataplex Universal Catalog for a specific organization or project. If there is no specific configuration set for the resource, the setting is checked hierarchicahlly through the ancestors of the resource, starting from the resource itself.
4417 ///
4418 /// # Arguments
4419 ///
4420 /// * `name` - Required. The resource whose effective config is being retrieved.
4421 pub fn locations_retrieve_effective_config(
4422 &self,
4423 name: &str,
4424 ) -> ProjectLocationRetrieveEffectiveConfigCall<'a, C> {
4425 ProjectLocationRetrieveEffectiveConfigCall {
4426 hub: self.hub,
4427 _name: name.to_string(),
4428 _delegate: Default::default(),
4429 _additional_params: Default::default(),
4430 _scopes: Default::default(),
4431 }
4432 }
4433
4434 /// Create a builder to help you perform the following task:
4435 ///
4436 /// Sets the configuration related to the migration to Dataplex Universal Catalog for an organization or project.
4437 ///
4438 /// # Arguments
4439 ///
4440 /// * `request` - No description provided.
4441 /// * `name` - Required. The organization or project whose config is being specified.
4442 pub fn locations_set_config(
4443 &self,
4444 request: GoogleCloudDatacatalogV1SetConfigRequest,
4445 name: &str,
4446 ) -> ProjectLocationSetConfigCall<'a, C> {
4447 ProjectLocationSetConfigCall {
4448 hub: self.hub,
4449 _request: request,
4450 _name: name.to_string(),
4451 _delegate: Default::default(),
4452 _additional_params: Default::default(),
4453 _scopes: Default::default(),
4454 }
4455 }
4456}
4457
4458// ###################
4459// CallBuilders ###
4460// #################
4461
4462/// Searches Data Catalog for multiple resources like entries and tags that match a query. This is a [Custom Method] (https://cloud.google.com/apis/design/custom_methods) that doesn't return all information on a resource, only its ID and high level fields. To get more information, you can subsequently call specific get methods. Note: Data Catalog search queries don't guarantee full recall. Results that match your query might not be returned, even in subsequent result pages. Additionally, returned (and not returned) results can vary if you repeat search queries. For more information, see [Data Catalog search syntax] (https://cloud.google.com/data-catalog/docs/how-to/search-reference).
4463///
4464/// A builder for the *search* method supported by a *catalog* resource.
4465/// It is not used directly, but through a [`CatalogMethods`] instance.
4466///
4467/// # Example
4468///
4469/// Instantiate a resource method builder
4470///
4471/// ```test_harness,no_run
4472/// # extern crate hyper;
4473/// # extern crate hyper_rustls;
4474/// # extern crate google_datacatalog1 as datacatalog1;
4475/// use datacatalog1::api::GoogleCloudDatacatalogV1SearchCatalogRequest;
4476/// # async fn dox() {
4477/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4478///
4479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4480/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4481/// # .with_native_roots()
4482/// # .unwrap()
4483/// # .https_only()
4484/// # .enable_http2()
4485/// # .build();
4486///
4487/// # let executor = hyper_util::rt::TokioExecutor::new();
4488/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4489/// # secret,
4490/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4491/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4492/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4493/// # ),
4494/// # ).build().await.unwrap();
4495///
4496/// # let client = hyper_util::client::legacy::Client::builder(
4497/// # hyper_util::rt::TokioExecutor::new()
4498/// # )
4499/// # .build(
4500/// # hyper_rustls::HttpsConnectorBuilder::new()
4501/// # .with_native_roots()
4502/// # .unwrap()
4503/// # .https_or_http()
4504/// # .enable_http2()
4505/// # .build()
4506/// # );
4507/// # let mut hub = DataCatalog::new(client, auth);
4508/// // As the method needs a request, you would usually fill it with the desired information
4509/// // into the respective structure. Some of the parts shown here might not be applicable !
4510/// // Values shown here are possibly random and not representative !
4511/// let mut req = GoogleCloudDatacatalogV1SearchCatalogRequest::default();
4512///
4513/// // You can configure optional parameters by calling the respective setters at will, and
4514/// // execute the final call using `doit()`.
4515/// // Values shown here are possibly random and not representative !
4516/// let result = hub.catalog().search(req)
4517/// .doit().await;
4518/// # }
4519/// ```
4520pub struct CatalogSearchCall<'a, C>
4521where
4522 C: 'a,
4523{
4524 hub: &'a DataCatalog<C>,
4525 _request: GoogleCloudDatacatalogV1SearchCatalogRequest,
4526 _delegate: Option<&'a mut dyn common::Delegate>,
4527 _additional_params: HashMap<String, String>,
4528 _scopes: BTreeSet<String>,
4529}
4530
4531impl<'a, C> common::CallBuilder for CatalogSearchCall<'a, C> {}
4532
4533impl<'a, C> CatalogSearchCall<'a, C>
4534where
4535 C: common::Connector,
4536{
4537 /// Perform the operation you have build so far.
4538 pub async fn doit(
4539 mut self,
4540 ) -> common::Result<(
4541 common::Response,
4542 GoogleCloudDatacatalogV1SearchCatalogResponse,
4543 )> {
4544 use std::borrow::Cow;
4545 use std::io::{Read, Seek};
4546
4547 use common::{url::Params, ToParts};
4548 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4549
4550 let mut dd = common::DefaultDelegate;
4551 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4552 dlg.begin(common::MethodInfo {
4553 id: "datacatalog.catalog.search",
4554 http_method: hyper::Method::POST,
4555 });
4556
4557 for &field in ["alt"].iter() {
4558 if self._additional_params.contains_key(field) {
4559 dlg.finished(false);
4560 return Err(common::Error::FieldClash(field));
4561 }
4562 }
4563
4564 let mut params = Params::with_capacity(3 + self._additional_params.len());
4565
4566 params.extend(self._additional_params.iter());
4567
4568 params.push("alt", "json");
4569 let mut url = self.hub._base_url.clone() + "v1/catalog:search";
4570 if self._scopes.is_empty() {
4571 self._scopes
4572 .insert(Scope::CloudPlatform.as_ref().to_string());
4573 }
4574
4575 let url = params.parse_with_url(&url);
4576
4577 let mut json_mime_type = mime::APPLICATION_JSON;
4578 let mut request_value_reader = {
4579 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4580 common::remove_json_null_values(&mut value);
4581 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4582 serde_json::to_writer(&mut dst, &value).unwrap();
4583 dst
4584 };
4585 let request_size = request_value_reader
4586 .seek(std::io::SeekFrom::End(0))
4587 .unwrap();
4588 request_value_reader
4589 .seek(std::io::SeekFrom::Start(0))
4590 .unwrap();
4591
4592 loop {
4593 let token = match self
4594 .hub
4595 .auth
4596 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4597 .await
4598 {
4599 Ok(token) => token,
4600 Err(e) => match dlg.token(e) {
4601 Ok(token) => token,
4602 Err(e) => {
4603 dlg.finished(false);
4604 return Err(common::Error::MissingToken(e));
4605 }
4606 },
4607 };
4608 request_value_reader
4609 .seek(std::io::SeekFrom::Start(0))
4610 .unwrap();
4611 let mut req_result = {
4612 let client = &self.hub.client;
4613 dlg.pre_request();
4614 let mut req_builder = hyper::Request::builder()
4615 .method(hyper::Method::POST)
4616 .uri(url.as_str())
4617 .header(USER_AGENT, self.hub._user_agent.clone());
4618
4619 if let Some(token) = token.as_ref() {
4620 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4621 }
4622
4623 let request = req_builder
4624 .header(CONTENT_TYPE, json_mime_type.to_string())
4625 .header(CONTENT_LENGTH, request_size as u64)
4626 .body(common::to_body(
4627 request_value_reader.get_ref().clone().into(),
4628 ));
4629
4630 client.request(request.unwrap()).await
4631 };
4632
4633 match req_result {
4634 Err(err) => {
4635 if let common::Retry::After(d) = dlg.http_error(&err) {
4636 sleep(d).await;
4637 continue;
4638 }
4639 dlg.finished(false);
4640 return Err(common::Error::HttpError(err));
4641 }
4642 Ok(res) => {
4643 let (mut parts, body) = res.into_parts();
4644 let mut body = common::Body::new(body);
4645 if !parts.status.is_success() {
4646 let bytes = common::to_bytes(body).await.unwrap_or_default();
4647 let error = serde_json::from_str(&common::to_string(&bytes));
4648 let response = common::to_response(parts, bytes.into());
4649
4650 if let common::Retry::After(d) =
4651 dlg.http_failure(&response, error.as_ref().ok())
4652 {
4653 sleep(d).await;
4654 continue;
4655 }
4656
4657 dlg.finished(false);
4658
4659 return Err(match error {
4660 Ok(value) => common::Error::BadRequest(value),
4661 _ => common::Error::Failure(response),
4662 });
4663 }
4664 let response = {
4665 let bytes = common::to_bytes(body).await.unwrap_or_default();
4666 let encoded = common::to_string(&bytes);
4667 match serde_json::from_str(&encoded) {
4668 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4669 Err(error) => {
4670 dlg.response_json_decode_error(&encoded, &error);
4671 return Err(common::Error::JsonDecodeError(
4672 encoded.to_string(),
4673 error,
4674 ));
4675 }
4676 }
4677 };
4678
4679 dlg.finished(true);
4680 return Ok(response);
4681 }
4682 }
4683 }
4684 }
4685
4686 ///
4687 /// Sets the *request* property to the given value.
4688 ///
4689 /// Even though the property as already been set when instantiating this call,
4690 /// we provide this method for API completeness.
4691 pub fn request(
4692 mut self,
4693 new_value: GoogleCloudDatacatalogV1SearchCatalogRequest,
4694 ) -> CatalogSearchCall<'a, C> {
4695 self._request = new_value;
4696 self
4697 }
4698 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4699 /// while executing the actual API request.
4700 ///
4701 /// ````text
4702 /// It should be used to handle progress information, and to implement a certain level of resilience.
4703 /// ````
4704 ///
4705 /// Sets the *delegate* property to the given value.
4706 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CatalogSearchCall<'a, C> {
4707 self._delegate = Some(new_value);
4708 self
4709 }
4710
4711 /// Set any additional parameter of the query string used in the request.
4712 /// It should be used to set parameters which are not yet available through their own
4713 /// setters.
4714 ///
4715 /// Please note that this method must not be used to set any of the known parameters
4716 /// which have their own setter method. If done anyway, the request will fail.
4717 ///
4718 /// # Additional Parameters
4719 ///
4720 /// * *$.xgafv* (query-string) - V1 error format.
4721 /// * *access_token* (query-string) - OAuth access token.
4722 /// * *alt* (query-string) - Data format for response.
4723 /// * *callback* (query-string) - JSONP
4724 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4725 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4726 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4727 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4728 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4729 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4730 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4731 pub fn param<T>(mut self, name: T, value: T) -> CatalogSearchCall<'a, C>
4732 where
4733 T: AsRef<str>,
4734 {
4735 self._additional_params
4736 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4737 self
4738 }
4739
4740 /// Identifies the authorization scope for the method you are building.
4741 ///
4742 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4743 /// [`Scope::CloudPlatform`].
4744 ///
4745 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4746 /// tokens for more than one scope.
4747 ///
4748 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4749 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4750 /// sufficient, a read-write scope will do as well.
4751 pub fn add_scope<St>(mut self, scope: St) -> CatalogSearchCall<'a, C>
4752 where
4753 St: AsRef<str>,
4754 {
4755 self._scopes.insert(String::from(scope.as_ref()));
4756 self
4757 }
4758 /// Identifies the authorization scope(s) for the method you are building.
4759 ///
4760 /// See [`Self::add_scope()`] for details.
4761 pub fn add_scopes<I, St>(mut self, scopes: I) -> CatalogSearchCall<'a, C>
4762 where
4763 I: IntoIterator<Item = St>,
4764 St: AsRef<str>,
4765 {
4766 self._scopes
4767 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4768 self
4769 }
4770
4771 /// Removes all scopes, and no default scope will be used either.
4772 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4773 /// for details).
4774 pub fn clear_scopes(mut self) -> CatalogSearchCall<'a, C> {
4775 self._scopes.clear();
4776 self
4777 }
4778}
4779
4780/// Gets an entry by its target resource name. The resource name comes from the source Google Cloud Platform service.
4781///
4782/// A builder for the *lookup* method supported by a *entry* resource.
4783/// It is not used directly, but through a [`EntryMethods`] instance.
4784///
4785/// # Example
4786///
4787/// Instantiate a resource method builder
4788///
4789/// ```test_harness,no_run
4790/// # extern crate hyper;
4791/// # extern crate hyper_rustls;
4792/// # extern crate google_datacatalog1 as datacatalog1;
4793/// # async fn dox() {
4794/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4795///
4796/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4797/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4798/// # .with_native_roots()
4799/// # .unwrap()
4800/// # .https_only()
4801/// # .enable_http2()
4802/// # .build();
4803///
4804/// # let executor = hyper_util::rt::TokioExecutor::new();
4805/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4806/// # secret,
4807/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4808/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4809/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4810/// # ),
4811/// # ).build().await.unwrap();
4812///
4813/// # let client = hyper_util::client::legacy::Client::builder(
4814/// # hyper_util::rt::TokioExecutor::new()
4815/// # )
4816/// # .build(
4817/// # hyper_rustls::HttpsConnectorBuilder::new()
4818/// # .with_native_roots()
4819/// # .unwrap()
4820/// # .https_or_http()
4821/// # .enable_http2()
4822/// # .build()
4823/// # );
4824/// # let mut hub = DataCatalog::new(client, auth);
4825/// // You can configure optional parameters by calling the respective setters at will, and
4826/// // execute the final call using `doit()`.
4827/// // Values shown here are possibly random and not representative !
4828/// let result = hub.entries().lookup()
4829/// .sql_resource("amet.")
4830/// .project("duo")
4831/// .location("ipsum")
4832/// .linked_resource("gubergren")
4833/// .fully_qualified_name("Lorem")
4834/// .doit().await;
4835/// # }
4836/// ```
4837pub struct EntryLookupCall<'a, C>
4838where
4839 C: 'a,
4840{
4841 hub: &'a DataCatalog<C>,
4842 _sql_resource: Option<String>,
4843 _project: Option<String>,
4844 _location: Option<String>,
4845 _linked_resource: Option<String>,
4846 _fully_qualified_name: Option<String>,
4847 _delegate: Option<&'a mut dyn common::Delegate>,
4848 _additional_params: HashMap<String, String>,
4849 _scopes: BTreeSet<String>,
4850}
4851
4852impl<'a, C> common::CallBuilder for EntryLookupCall<'a, C> {}
4853
4854impl<'a, C> EntryLookupCall<'a, C>
4855where
4856 C: common::Connector,
4857{
4858 /// Perform the operation you have build so far.
4859 pub async fn doit(
4860 mut self,
4861 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Entry)> {
4862 use std::borrow::Cow;
4863 use std::io::{Read, Seek};
4864
4865 use common::{url::Params, ToParts};
4866 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4867
4868 let mut dd = common::DefaultDelegate;
4869 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4870 dlg.begin(common::MethodInfo {
4871 id: "datacatalog.entries.lookup",
4872 http_method: hyper::Method::GET,
4873 });
4874
4875 for &field in [
4876 "alt",
4877 "sqlResource",
4878 "project",
4879 "location",
4880 "linkedResource",
4881 "fullyQualifiedName",
4882 ]
4883 .iter()
4884 {
4885 if self._additional_params.contains_key(field) {
4886 dlg.finished(false);
4887 return Err(common::Error::FieldClash(field));
4888 }
4889 }
4890
4891 let mut params = Params::with_capacity(7 + self._additional_params.len());
4892 if let Some(value) = self._sql_resource.as_ref() {
4893 params.push("sqlResource", value);
4894 }
4895 if let Some(value) = self._project.as_ref() {
4896 params.push("project", value);
4897 }
4898 if let Some(value) = self._location.as_ref() {
4899 params.push("location", value);
4900 }
4901 if let Some(value) = self._linked_resource.as_ref() {
4902 params.push("linkedResource", value);
4903 }
4904 if let Some(value) = self._fully_qualified_name.as_ref() {
4905 params.push("fullyQualifiedName", value);
4906 }
4907
4908 params.extend(self._additional_params.iter());
4909
4910 params.push("alt", "json");
4911 let mut url = self.hub._base_url.clone() + "v1/entries:lookup";
4912 if self._scopes.is_empty() {
4913 self._scopes
4914 .insert(Scope::CloudPlatform.as_ref().to_string());
4915 }
4916
4917 let url = params.parse_with_url(&url);
4918
4919 loop {
4920 let token = match self
4921 .hub
4922 .auth
4923 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4924 .await
4925 {
4926 Ok(token) => token,
4927 Err(e) => match dlg.token(e) {
4928 Ok(token) => token,
4929 Err(e) => {
4930 dlg.finished(false);
4931 return Err(common::Error::MissingToken(e));
4932 }
4933 },
4934 };
4935 let mut req_result = {
4936 let client = &self.hub.client;
4937 dlg.pre_request();
4938 let mut req_builder = hyper::Request::builder()
4939 .method(hyper::Method::GET)
4940 .uri(url.as_str())
4941 .header(USER_AGENT, self.hub._user_agent.clone());
4942
4943 if let Some(token) = token.as_ref() {
4944 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4945 }
4946
4947 let request = req_builder
4948 .header(CONTENT_LENGTH, 0_u64)
4949 .body(common::to_body::<String>(None));
4950
4951 client.request(request.unwrap()).await
4952 };
4953
4954 match req_result {
4955 Err(err) => {
4956 if let common::Retry::After(d) = dlg.http_error(&err) {
4957 sleep(d).await;
4958 continue;
4959 }
4960 dlg.finished(false);
4961 return Err(common::Error::HttpError(err));
4962 }
4963 Ok(res) => {
4964 let (mut parts, body) = res.into_parts();
4965 let mut body = common::Body::new(body);
4966 if !parts.status.is_success() {
4967 let bytes = common::to_bytes(body).await.unwrap_or_default();
4968 let error = serde_json::from_str(&common::to_string(&bytes));
4969 let response = common::to_response(parts, bytes.into());
4970
4971 if let common::Retry::After(d) =
4972 dlg.http_failure(&response, error.as_ref().ok())
4973 {
4974 sleep(d).await;
4975 continue;
4976 }
4977
4978 dlg.finished(false);
4979
4980 return Err(match error {
4981 Ok(value) => common::Error::BadRequest(value),
4982 _ => common::Error::Failure(response),
4983 });
4984 }
4985 let response = {
4986 let bytes = common::to_bytes(body).await.unwrap_or_default();
4987 let encoded = common::to_string(&bytes);
4988 match serde_json::from_str(&encoded) {
4989 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4990 Err(error) => {
4991 dlg.response_json_decode_error(&encoded, &error);
4992 return Err(common::Error::JsonDecodeError(
4993 encoded.to_string(),
4994 error,
4995 ));
4996 }
4997 }
4998 };
4999
5000 dlg.finished(true);
5001 return Ok(response);
5002 }
5003 }
5004 }
5005 }
5006
5007 /// The SQL name of the entry. SQL names are case-sensitive. Examples: * `pubsub.topic.{PROJECT_ID}.{TOPIC_ID}` * `pubsub.topic.{PROJECT_ID}.`\``{TOPIC.ID.SEPARATED.WITH.DOTS}`\` * `bigquery.table.{PROJECT_ID}.{DATASET_ID}.{TABLE_ID}` * `bigquery.dataset.{PROJECT_ID}.{DATASET_ID}` * `datacatalog.entry.{PROJECT_ID}.{LOCATION_ID}.{ENTRY_GROUP_ID}.{ENTRY_ID}` Identifiers (`*_ID`) should comply with the [Lexical structure in GoogleSQL] (https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical).
5008 ///
5009 /// Sets the *sql resource* query property to the given value.
5010 pub fn sql_resource(mut self, new_value: &str) -> EntryLookupCall<'a, C> {
5011 self._sql_resource = Some(new_value.to_string());
5012 self
5013 }
5014 /// Project where the lookup should be performed. Required to lookup entry that is not a part of `DPMS` or `DATAPLEX` `integrated_system` using its `fully_qualified_name`. Ignored in other cases.
5015 ///
5016 /// Sets the *project* query property to the given value.
5017 pub fn project(mut self, new_value: &str) -> EntryLookupCall<'a, C> {
5018 self._project = Some(new_value.to_string());
5019 self
5020 }
5021 /// Location where the lookup should be performed. Required to lookup entry that is not a part of `DPMS` or `DATAPLEX` `integrated_system` using its `fully_qualified_name`. Ignored in other cases.
5022 ///
5023 /// Sets the *location* query property to the given value.
5024 pub fn location(mut self, new_value: &str) -> EntryLookupCall<'a, C> {
5025 self._location = Some(new_value.to_string());
5026 self
5027 }
5028 /// The full name of the Google Cloud Platform resource the Data Catalog entry represents. For more information, see [Full Resource Name] (https://cloud.google.com/apis/design/resource_names#full_resource_name). Full names are case-sensitive. For example: * `//bigquery.googleapis.com/projects/{PROJECT_ID}/datasets/{DATASET_ID}/tables/{TABLE_ID}` * `//pubsub.googleapis.com/projects/{PROJECT_ID}/topics/{TOPIC_ID}`
5029 ///
5030 /// Sets the *linked resource* query property to the given value.
5031 pub fn linked_resource(mut self, new_value: &str) -> EntryLookupCall<'a, C> {
5032 self._linked_resource = Some(new_value.to_string());
5033 self
5034 }
5035 /// [Fully Qualified Name (FQN)](https://cloud.google.com//data-catalog/docs/fully-qualified-names) of the resource. FQNs take two forms: * For non-regionalized resources: `{SYSTEM}:{PROJECT}.{PATH_TO_RESOURCE_SEPARATED_WITH_DOTS}` * For regionalized resources: `{SYSTEM}:{PROJECT}.{LOCATION_ID}.{PATH_TO_RESOURCE_SEPARATED_WITH_DOTS}` Example for a DPMS table: `dataproc_metastore:{PROJECT_ID}.{LOCATION_ID}.{INSTANCE_ID}.{DATABASE_ID}.{TABLE_ID}`
5036 ///
5037 /// Sets the *fully qualified name* query property to the given value.
5038 pub fn fully_qualified_name(mut self, new_value: &str) -> EntryLookupCall<'a, C> {
5039 self._fully_qualified_name = Some(new_value.to_string());
5040 self
5041 }
5042 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5043 /// while executing the actual API request.
5044 ///
5045 /// ````text
5046 /// It should be used to handle progress information, and to implement a certain level of resilience.
5047 /// ````
5048 ///
5049 /// Sets the *delegate* property to the given value.
5050 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EntryLookupCall<'a, C> {
5051 self._delegate = Some(new_value);
5052 self
5053 }
5054
5055 /// Set any additional parameter of the query string used in the request.
5056 /// It should be used to set parameters which are not yet available through their own
5057 /// setters.
5058 ///
5059 /// Please note that this method must not be used to set any of the known parameters
5060 /// which have their own setter method. If done anyway, the request will fail.
5061 ///
5062 /// # Additional Parameters
5063 ///
5064 /// * *$.xgafv* (query-string) - V1 error format.
5065 /// * *access_token* (query-string) - OAuth access token.
5066 /// * *alt* (query-string) - Data format for response.
5067 /// * *callback* (query-string) - JSONP
5068 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5069 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5070 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5071 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5072 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5073 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5074 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5075 pub fn param<T>(mut self, name: T, value: T) -> EntryLookupCall<'a, C>
5076 where
5077 T: AsRef<str>,
5078 {
5079 self._additional_params
5080 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5081 self
5082 }
5083
5084 /// Identifies the authorization scope for the method you are building.
5085 ///
5086 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5087 /// [`Scope::CloudPlatform`].
5088 ///
5089 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5090 /// tokens for more than one scope.
5091 ///
5092 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5093 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5094 /// sufficient, a read-write scope will do as well.
5095 pub fn add_scope<St>(mut self, scope: St) -> EntryLookupCall<'a, C>
5096 where
5097 St: AsRef<str>,
5098 {
5099 self._scopes.insert(String::from(scope.as_ref()));
5100 self
5101 }
5102 /// Identifies the authorization scope(s) for the method you are building.
5103 ///
5104 /// See [`Self::add_scope()`] for details.
5105 pub fn add_scopes<I, St>(mut self, scopes: I) -> EntryLookupCall<'a, C>
5106 where
5107 I: IntoIterator<Item = St>,
5108 St: AsRef<str>,
5109 {
5110 self._scopes
5111 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5112 self
5113 }
5114
5115 /// Removes all scopes, and no default scope will be used either.
5116 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5117 /// for details).
5118 pub fn clear_scopes(mut self) -> EntryLookupCall<'a, C> {
5119 self._scopes.clear();
5120 self
5121 }
5122}
5123
5124/// Retrieves the configuration related to the migration from Data Catalog to Dataplex Universal Catalog for a specific organization, including all the projects under it which have a separate configuration set.
5125///
5126/// A builder for the *locations.retrieveConfig* method supported by a *organization* resource.
5127/// It is not used directly, but through a [`OrganizationMethods`] instance.
5128///
5129/// # Example
5130///
5131/// Instantiate a resource method builder
5132///
5133/// ```test_harness,no_run
5134/// # extern crate hyper;
5135/// # extern crate hyper_rustls;
5136/// # extern crate google_datacatalog1 as datacatalog1;
5137/// # async fn dox() {
5138/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5139///
5140/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5141/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5142/// # .with_native_roots()
5143/// # .unwrap()
5144/// # .https_only()
5145/// # .enable_http2()
5146/// # .build();
5147///
5148/// # let executor = hyper_util::rt::TokioExecutor::new();
5149/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5150/// # secret,
5151/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5152/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5153/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5154/// # ),
5155/// # ).build().await.unwrap();
5156///
5157/// # let client = hyper_util::client::legacy::Client::builder(
5158/// # hyper_util::rt::TokioExecutor::new()
5159/// # )
5160/// # .build(
5161/// # hyper_rustls::HttpsConnectorBuilder::new()
5162/// # .with_native_roots()
5163/// # .unwrap()
5164/// # .https_or_http()
5165/// # .enable_http2()
5166/// # .build()
5167/// # );
5168/// # let mut hub = DataCatalog::new(client, auth);
5169/// // You can configure optional parameters by calling the respective setters at will, and
5170/// // execute the final call using `doit()`.
5171/// // Values shown here are possibly random and not representative !
5172/// let result = hub.organizations().locations_retrieve_config("name")
5173/// .doit().await;
5174/// # }
5175/// ```
5176pub struct OrganizationLocationRetrieveConfigCall<'a, C>
5177where
5178 C: 'a,
5179{
5180 hub: &'a DataCatalog<C>,
5181 _name: String,
5182 _delegate: Option<&'a mut dyn common::Delegate>,
5183 _additional_params: HashMap<String, String>,
5184 _scopes: BTreeSet<String>,
5185}
5186
5187impl<'a, C> common::CallBuilder for OrganizationLocationRetrieveConfigCall<'a, C> {}
5188
5189impl<'a, C> OrganizationLocationRetrieveConfigCall<'a, C>
5190where
5191 C: common::Connector,
5192{
5193 /// Perform the operation you have build so far.
5194 pub async fn doit(
5195 mut self,
5196 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1OrganizationConfig)> {
5197 use std::borrow::Cow;
5198 use std::io::{Read, Seek};
5199
5200 use common::{url::Params, ToParts};
5201 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5202
5203 let mut dd = common::DefaultDelegate;
5204 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5205 dlg.begin(common::MethodInfo {
5206 id: "datacatalog.organizations.locations.retrieveConfig",
5207 http_method: hyper::Method::GET,
5208 });
5209
5210 for &field in ["alt", "name"].iter() {
5211 if self._additional_params.contains_key(field) {
5212 dlg.finished(false);
5213 return Err(common::Error::FieldClash(field));
5214 }
5215 }
5216
5217 let mut params = Params::with_capacity(3 + self._additional_params.len());
5218 params.push("name", self._name);
5219
5220 params.extend(self._additional_params.iter());
5221
5222 params.push("alt", "json");
5223 let mut url = self.hub._base_url.clone() + "v1/{+name}:retrieveConfig";
5224 if self._scopes.is_empty() {
5225 self._scopes
5226 .insert(Scope::CloudPlatform.as_ref().to_string());
5227 }
5228
5229 #[allow(clippy::single_element_loop)]
5230 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5231 url = params.uri_replacement(url, param_name, find_this, true);
5232 }
5233 {
5234 let to_remove = ["name"];
5235 params.remove_params(&to_remove);
5236 }
5237
5238 let url = params.parse_with_url(&url);
5239
5240 loop {
5241 let token = match self
5242 .hub
5243 .auth
5244 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5245 .await
5246 {
5247 Ok(token) => token,
5248 Err(e) => match dlg.token(e) {
5249 Ok(token) => token,
5250 Err(e) => {
5251 dlg.finished(false);
5252 return Err(common::Error::MissingToken(e));
5253 }
5254 },
5255 };
5256 let mut req_result = {
5257 let client = &self.hub.client;
5258 dlg.pre_request();
5259 let mut req_builder = hyper::Request::builder()
5260 .method(hyper::Method::GET)
5261 .uri(url.as_str())
5262 .header(USER_AGENT, self.hub._user_agent.clone());
5263
5264 if let Some(token) = token.as_ref() {
5265 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5266 }
5267
5268 let request = req_builder
5269 .header(CONTENT_LENGTH, 0_u64)
5270 .body(common::to_body::<String>(None));
5271
5272 client.request(request.unwrap()).await
5273 };
5274
5275 match req_result {
5276 Err(err) => {
5277 if let common::Retry::After(d) = dlg.http_error(&err) {
5278 sleep(d).await;
5279 continue;
5280 }
5281 dlg.finished(false);
5282 return Err(common::Error::HttpError(err));
5283 }
5284 Ok(res) => {
5285 let (mut parts, body) = res.into_parts();
5286 let mut body = common::Body::new(body);
5287 if !parts.status.is_success() {
5288 let bytes = common::to_bytes(body).await.unwrap_or_default();
5289 let error = serde_json::from_str(&common::to_string(&bytes));
5290 let response = common::to_response(parts, bytes.into());
5291
5292 if let common::Retry::After(d) =
5293 dlg.http_failure(&response, error.as_ref().ok())
5294 {
5295 sleep(d).await;
5296 continue;
5297 }
5298
5299 dlg.finished(false);
5300
5301 return Err(match error {
5302 Ok(value) => common::Error::BadRequest(value),
5303 _ => common::Error::Failure(response),
5304 });
5305 }
5306 let response = {
5307 let bytes = common::to_bytes(body).await.unwrap_or_default();
5308 let encoded = common::to_string(&bytes);
5309 match serde_json::from_str(&encoded) {
5310 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5311 Err(error) => {
5312 dlg.response_json_decode_error(&encoded, &error);
5313 return Err(common::Error::JsonDecodeError(
5314 encoded.to_string(),
5315 error,
5316 ));
5317 }
5318 }
5319 };
5320
5321 dlg.finished(true);
5322 return Ok(response);
5323 }
5324 }
5325 }
5326 }
5327
5328 /// Required. The organization whose config is being retrieved.
5329 ///
5330 /// Sets the *name* path property to the given value.
5331 ///
5332 /// Even though the property as already been set when instantiating this call,
5333 /// we provide this method for API completeness.
5334 pub fn name(mut self, new_value: &str) -> OrganizationLocationRetrieveConfigCall<'a, C> {
5335 self._name = new_value.to_string();
5336 self
5337 }
5338 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5339 /// while executing the actual API request.
5340 ///
5341 /// ````text
5342 /// It should be used to handle progress information, and to implement a certain level of resilience.
5343 /// ````
5344 ///
5345 /// Sets the *delegate* property to the given value.
5346 pub fn delegate(
5347 mut self,
5348 new_value: &'a mut dyn common::Delegate,
5349 ) -> OrganizationLocationRetrieveConfigCall<'a, C> {
5350 self._delegate = Some(new_value);
5351 self
5352 }
5353
5354 /// Set any additional parameter of the query string used in the request.
5355 /// It should be used to set parameters which are not yet available through their own
5356 /// setters.
5357 ///
5358 /// Please note that this method must not be used to set any of the known parameters
5359 /// which have their own setter method. If done anyway, the request will fail.
5360 ///
5361 /// # Additional Parameters
5362 ///
5363 /// * *$.xgafv* (query-string) - V1 error format.
5364 /// * *access_token* (query-string) - OAuth access token.
5365 /// * *alt* (query-string) - Data format for response.
5366 /// * *callback* (query-string) - JSONP
5367 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5368 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5369 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5370 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5371 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5372 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5373 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5374 pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationRetrieveConfigCall<'a, C>
5375 where
5376 T: AsRef<str>,
5377 {
5378 self._additional_params
5379 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5380 self
5381 }
5382
5383 /// Identifies the authorization scope for the method you are building.
5384 ///
5385 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5386 /// [`Scope::CloudPlatform`].
5387 ///
5388 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5389 /// tokens for more than one scope.
5390 ///
5391 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5392 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5393 /// sufficient, a read-write scope will do as well.
5394 pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationRetrieveConfigCall<'a, C>
5395 where
5396 St: AsRef<str>,
5397 {
5398 self._scopes.insert(String::from(scope.as_ref()));
5399 self
5400 }
5401 /// Identifies the authorization scope(s) for the method you are building.
5402 ///
5403 /// See [`Self::add_scope()`] for details.
5404 pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationRetrieveConfigCall<'a, C>
5405 where
5406 I: IntoIterator<Item = St>,
5407 St: AsRef<str>,
5408 {
5409 self._scopes
5410 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5411 self
5412 }
5413
5414 /// Removes all scopes, and no default scope will be used either.
5415 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5416 /// for details).
5417 pub fn clear_scopes(mut self) -> OrganizationLocationRetrieveConfigCall<'a, C> {
5418 self._scopes.clear();
5419 self
5420 }
5421}
5422
5423/// Retrieves the effective configuration related to the migration from Data Catalog to Dataplex Universal Catalog for a specific organization or project. If there is no specific configuration set for the resource, the setting is checked hierarchicahlly through the ancestors of the resource, starting from the resource itself.
5424///
5425/// A builder for the *locations.retrieveEffectiveConfig* method supported by a *organization* resource.
5426/// It is not used directly, but through a [`OrganizationMethods`] instance.
5427///
5428/// # Example
5429///
5430/// Instantiate a resource method builder
5431///
5432/// ```test_harness,no_run
5433/// # extern crate hyper;
5434/// # extern crate hyper_rustls;
5435/// # extern crate google_datacatalog1 as datacatalog1;
5436/// # async fn dox() {
5437/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5438///
5439/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5440/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5441/// # .with_native_roots()
5442/// # .unwrap()
5443/// # .https_only()
5444/// # .enable_http2()
5445/// # .build();
5446///
5447/// # let executor = hyper_util::rt::TokioExecutor::new();
5448/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5449/// # secret,
5450/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5451/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5452/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5453/// # ),
5454/// # ).build().await.unwrap();
5455///
5456/// # let client = hyper_util::client::legacy::Client::builder(
5457/// # hyper_util::rt::TokioExecutor::new()
5458/// # )
5459/// # .build(
5460/// # hyper_rustls::HttpsConnectorBuilder::new()
5461/// # .with_native_roots()
5462/// # .unwrap()
5463/// # .https_or_http()
5464/// # .enable_http2()
5465/// # .build()
5466/// # );
5467/// # let mut hub = DataCatalog::new(client, auth);
5468/// // You can configure optional parameters by calling the respective setters at will, and
5469/// // execute the final call using `doit()`.
5470/// // Values shown here are possibly random and not representative !
5471/// let result = hub.organizations().locations_retrieve_effective_config("name")
5472/// .doit().await;
5473/// # }
5474/// ```
5475pub struct OrganizationLocationRetrieveEffectiveConfigCall<'a, C>
5476where
5477 C: 'a,
5478{
5479 hub: &'a DataCatalog<C>,
5480 _name: String,
5481 _delegate: Option<&'a mut dyn common::Delegate>,
5482 _additional_params: HashMap<String, String>,
5483 _scopes: BTreeSet<String>,
5484}
5485
5486impl<'a, C> common::CallBuilder for OrganizationLocationRetrieveEffectiveConfigCall<'a, C> {}
5487
5488impl<'a, C> OrganizationLocationRetrieveEffectiveConfigCall<'a, C>
5489where
5490 C: common::Connector,
5491{
5492 /// Perform the operation you have build so far.
5493 pub async fn doit(
5494 mut self,
5495 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1MigrationConfig)> {
5496 use std::borrow::Cow;
5497 use std::io::{Read, Seek};
5498
5499 use common::{url::Params, ToParts};
5500 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5501
5502 let mut dd = common::DefaultDelegate;
5503 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5504 dlg.begin(common::MethodInfo {
5505 id: "datacatalog.organizations.locations.retrieveEffectiveConfig",
5506 http_method: hyper::Method::GET,
5507 });
5508
5509 for &field in ["alt", "name"].iter() {
5510 if self._additional_params.contains_key(field) {
5511 dlg.finished(false);
5512 return Err(common::Error::FieldClash(field));
5513 }
5514 }
5515
5516 let mut params = Params::with_capacity(3 + self._additional_params.len());
5517 params.push("name", self._name);
5518
5519 params.extend(self._additional_params.iter());
5520
5521 params.push("alt", "json");
5522 let mut url = self.hub._base_url.clone() + "v1/{+name}:retrieveEffectiveConfig";
5523 if self._scopes.is_empty() {
5524 self._scopes
5525 .insert(Scope::CloudPlatform.as_ref().to_string());
5526 }
5527
5528 #[allow(clippy::single_element_loop)]
5529 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5530 url = params.uri_replacement(url, param_name, find_this, true);
5531 }
5532 {
5533 let to_remove = ["name"];
5534 params.remove_params(&to_remove);
5535 }
5536
5537 let url = params.parse_with_url(&url);
5538
5539 loop {
5540 let token = match self
5541 .hub
5542 .auth
5543 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5544 .await
5545 {
5546 Ok(token) => token,
5547 Err(e) => match dlg.token(e) {
5548 Ok(token) => token,
5549 Err(e) => {
5550 dlg.finished(false);
5551 return Err(common::Error::MissingToken(e));
5552 }
5553 },
5554 };
5555 let mut req_result = {
5556 let client = &self.hub.client;
5557 dlg.pre_request();
5558 let mut req_builder = hyper::Request::builder()
5559 .method(hyper::Method::GET)
5560 .uri(url.as_str())
5561 .header(USER_AGENT, self.hub._user_agent.clone());
5562
5563 if let Some(token) = token.as_ref() {
5564 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5565 }
5566
5567 let request = req_builder
5568 .header(CONTENT_LENGTH, 0_u64)
5569 .body(common::to_body::<String>(None));
5570
5571 client.request(request.unwrap()).await
5572 };
5573
5574 match req_result {
5575 Err(err) => {
5576 if let common::Retry::After(d) = dlg.http_error(&err) {
5577 sleep(d).await;
5578 continue;
5579 }
5580 dlg.finished(false);
5581 return Err(common::Error::HttpError(err));
5582 }
5583 Ok(res) => {
5584 let (mut parts, body) = res.into_parts();
5585 let mut body = common::Body::new(body);
5586 if !parts.status.is_success() {
5587 let bytes = common::to_bytes(body).await.unwrap_or_default();
5588 let error = serde_json::from_str(&common::to_string(&bytes));
5589 let response = common::to_response(parts, bytes.into());
5590
5591 if let common::Retry::After(d) =
5592 dlg.http_failure(&response, error.as_ref().ok())
5593 {
5594 sleep(d).await;
5595 continue;
5596 }
5597
5598 dlg.finished(false);
5599
5600 return Err(match error {
5601 Ok(value) => common::Error::BadRequest(value),
5602 _ => common::Error::Failure(response),
5603 });
5604 }
5605 let response = {
5606 let bytes = common::to_bytes(body).await.unwrap_or_default();
5607 let encoded = common::to_string(&bytes);
5608 match serde_json::from_str(&encoded) {
5609 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5610 Err(error) => {
5611 dlg.response_json_decode_error(&encoded, &error);
5612 return Err(common::Error::JsonDecodeError(
5613 encoded.to_string(),
5614 error,
5615 ));
5616 }
5617 }
5618 };
5619
5620 dlg.finished(true);
5621 return Ok(response);
5622 }
5623 }
5624 }
5625 }
5626
5627 /// Required. The resource whose effective config is being retrieved.
5628 ///
5629 /// Sets the *name* path property to the given value.
5630 ///
5631 /// Even though the property as already been set when instantiating this call,
5632 /// we provide this method for API completeness.
5633 pub fn name(
5634 mut self,
5635 new_value: &str,
5636 ) -> OrganizationLocationRetrieveEffectiveConfigCall<'a, C> {
5637 self._name = new_value.to_string();
5638 self
5639 }
5640 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5641 /// while executing the actual API request.
5642 ///
5643 /// ````text
5644 /// It should be used to handle progress information, and to implement a certain level of resilience.
5645 /// ````
5646 ///
5647 /// Sets the *delegate* property to the given value.
5648 pub fn delegate(
5649 mut self,
5650 new_value: &'a mut dyn common::Delegate,
5651 ) -> OrganizationLocationRetrieveEffectiveConfigCall<'a, C> {
5652 self._delegate = Some(new_value);
5653 self
5654 }
5655
5656 /// Set any additional parameter of the query string used in the request.
5657 /// It should be used to set parameters which are not yet available through their own
5658 /// setters.
5659 ///
5660 /// Please note that this method must not be used to set any of the known parameters
5661 /// which have their own setter method. If done anyway, the request will fail.
5662 ///
5663 /// # Additional Parameters
5664 ///
5665 /// * *$.xgafv* (query-string) - V1 error format.
5666 /// * *access_token* (query-string) - OAuth access token.
5667 /// * *alt* (query-string) - Data format for response.
5668 /// * *callback* (query-string) - JSONP
5669 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5670 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5671 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5672 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5673 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5674 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5675 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5676 pub fn param<T>(
5677 mut self,
5678 name: T,
5679 value: T,
5680 ) -> OrganizationLocationRetrieveEffectiveConfigCall<'a, C>
5681 where
5682 T: AsRef<str>,
5683 {
5684 self._additional_params
5685 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5686 self
5687 }
5688
5689 /// Identifies the authorization scope for the method you are building.
5690 ///
5691 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5692 /// [`Scope::CloudPlatform`].
5693 ///
5694 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5695 /// tokens for more than one scope.
5696 ///
5697 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5698 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5699 /// sufficient, a read-write scope will do as well.
5700 pub fn add_scope<St>(
5701 mut self,
5702 scope: St,
5703 ) -> OrganizationLocationRetrieveEffectiveConfigCall<'a, C>
5704 where
5705 St: AsRef<str>,
5706 {
5707 self._scopes.insert(String::from(scope.as_ref()));
5708 self
5709 }
5710 /// Identifies the authorization scope(s) for the method you are building.
5711 ///
5712 /// See [`Self::add_scope()`] for details.
5713 pub fn add_scopes<I, St>(
5714 mut self,
5715 scopes: I,
5716 ) -> OrganizationLocationRetrieveEffectiveConfigCall<'a, C>
5717 where
5718 I: IntoIterator<Item = St>,
5719 St: AsRef<str>,
5720 {
5721 self._scopes
5722 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5723 self
5724 }
5725
5726 /// Removes all scopes, and no default scope will be used either.
5727 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5728 /// for details).
5729 pub fn clear_scopes(mut self) -> OrganizationLocationRetrieveEffectiveConfigCall<'a, C> {
5730 self._scopes.clear();
5731 self
5732 }
5733}
5734
5735/// Sets the configuration related to the migration to Dataplex Universal Catalog for an organization or project.
5736///
5737/// A builder for the *locations.setConfig* method supported by a *organization* resource.
5738/// It is not used directly, but through a [`OrganizationMethods`] instance.
5739///
5740/// # Example
5741///
5742/// Instantiate a resource method builder
5743///
5744/// ```test_harness,no_run
5745/// # extern crate hyper;
5746/// # extern crate hyper_rustls;
5747/// # extern crate google_datacatalog1 as datacatalog1;
5748/// use datacatalog1::api::GoogleCloudDatacatalogV1SetConfigRequest;
5749/// # async fn dox() {
5750/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5751///
5752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5753/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5754/// # .with_native_roots()
5755/// # .unwrap()
5756/// # .https_only()
5757/// # .enable_http2()
5758/// # .build();
5759///
5760/// # let executor = hyper_util::rt::TokioExecutor::new();
5761/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5762/// # secret,
5763/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5764/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5765/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5766/// # ),
5767/// # ).build().await.unwrap();
5768///
5769/// # let client = hyper_util::client::legacy::Client::builder(
5770/// # hyper_util::rt::TokioExecutor::new()
5771/// # )
5772/// # .build(
5773/// # hyper_rustls::HttpsConnectorBuilder::new()
5774/// # .with_native_roots()
5775/// # .unwrap()
5776/// # .https_or_http()
5777/// # .enable_http2()
5778/// # .build()
5779/// # );
5780/// # let mut hub = DataCatalog::new(client, auth);
5781/// // As the method needs a request, you would usually fill it with the desired information
5782/// // into the respective structure. Some of the parts shown here might not be applicable !
5783/// // Values shown here are possibly random and not representative !
5784/// let mut req = GoogleCloudDatacatalogV1SetConfigRequest::default();
5785///
5786/// // You can configure optional parameters by calling the respective setters at will, and
5787/// // execute the final call using `doit()`.
5788/// // Values shown here are possibly random and not representative !
5789/// let result = hub.organizations().locations_set_config(req, "name")
5790/// .doit().await;
5791/// # }
5792/// ```
5793pub struct OrganizationLocationSetConfigCall<'a, C>
5794where
5795 C: 'a,
5796{
5797 hub: &'a DataCatalog<C>,
5798 _request: GoogleCloudDatacatalogV1SetConfigRequest,
5799 _name: String,
5800 _delegate: Option<&'a mut dyn common::Delegate>,
5801 _additional_params: HashMap<String, String>,
5802 _scopes: BTreeSet<String>,
5803}
5804
5805impl<'a, C> common::CallBuilder for OrganizationLocationSetConfigCall<'a, C> {}
5806
5807impl<'a, C> OrganizationLocationSetConfigCall<'a, C>
5808where
5809 C: common::Connector,
5810{
5811 /// Perform the operation you have build so far.
5812 pub async fn doit(
5813 mut self,
5814 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1MigrationConfig)> {
5815 use std::borrow::Cow;
5816 use std::io::{Read, Seek};
5817
5818 use common::{url::Params, ToParts};
5819 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5820
5821 let mut dd = common::DefaultDelegate;
5822 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5823 dlg.begin(common::MethodInfo {
5824 id: "datacatalog.organizations.locations.setConfig",
5825 http_method: hyper::Method::POST,
5826 });
5827
5828 for &field in ["alt", "name"].iter() {
5829 if self._additional_params.contains_key(field) {
5830 dlg.finished(false);
5831 return Err(common::Error::FieldClash(field));
5832 }
5833 }
5834
5835 let mut params = Params::with_capacity(4 + self._additional_params.len());
5836 params.push("name", self._name);
5837
5838 params.extend(self._additional_params.iter());
5839
5840 params.push("alt", "json");
5841 let mut url = self.hub._base_url.clone() + "v1/{+name}:setConfig";
5842 if self._scopes.is_empty() {
5843 self._scopes
5844 .insert(Scope::CloudPlatform.as_ref().to_string());
5845 }
5846
5847 #[allow(clippy::single_element_loop)]
5848 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5849 url = params.uri_replacement(url, param_name, find_this, true);
5850 }
5851 {
5852 let to_remove = ["name"];
5853 params.remove_params(&to_remove);
5854 }
5855
5856 let url = params.parse_with_url(&url);
5857
5858 let mut json_mime_type = mime::APPLICATION_JSON;
5859 let mut request_value_reader = {
5860 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5861 common::remove_json_null_values(&mut value);
5862 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5863 serde_json::to_writer(&mut dst, &value).unwrap();
5864 dst
5865 };
5866 let request_size = request_value_reader
5867 .seek(std::io::SeekFrom::End(0))
5868 .unwrap();
5869 request_value_reader
5870 .seek(std::io::SeekFrom::Start(0))
5871 .unwrap();
5872
5873 loop {
5874 let token = match self
5875 .hub
5876 .auth
5877 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5878 .await
5879 {
5880 Ok(token) => token,
5881 Err(e) => match dlg.token(e) {
5882 Ok(token) => token,
5883 Err(e) => {
5884 dlg.finished(false);
5885 return Err(common::Error::MissingToken(e));
5886 }
5887 },
5888 };
5889 request_value_reader
5890 .seek(std::io::SeekFrom::Start(0))
5891 .unwrap();
5892 let mut req_result = {
5893 let client = &self.hub.client;
5894 dlg.pre_request();
5895 let mut req_builder = hyper::Request::builder()
5896 .method(hyper::Method::POST)
5897 .uri(url.as_str())
5898 .header(USER_AGENT, self.hub._user_agent.clone());
5899
5900 if let Some(token) = token.as_ref() {
5901 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5902 }
5903
5904 let request = req_builder
5905 .header(CONTENT_TYPE, json_mime_type.to_string())
5906 .header(CONTENT_LENGTH, request_size as u64)
5907 .body(common::to_body(
5908 request_value_reader.get_ref().clone().into(),
5909 ));
5910
5911 client.request(request.unwrap()).await
5912 };
5913
5914 match req_result {
5915 Err(err) => {
5916 if let common::Retry::After(d) = dlg.http_error(&err) {
5917 sleep(d).await;
5918 continue;
5919 }
5920 dlg.finished(false);
5921 return Err(common::Error::HttpError(err));
5922 }
5923 Ok(res) => {
5924 let (mut parts, body) = res.into_parts();
5925 let mut body = common::Body::new(body);
5926 if !parts.status.is_success() {
5927 let bytes = common::to_bytes(body).await.unwrap_or_default();
5928 let error = serde_json::from_str(&common::to_string(&bytes));
5929 let response = common::to_response(parts, bytes.into());
5930
5931 if let common::Retry::After(d) =
5932 dlg.http_failure(&response, error.as_ref().ok())
5933 {
5934 sleep(d).await;
5935 continue;
5936 }
5937
5938 dlg.finished(false);
5939
5940 return Err(match error {
5941 Ok(value) => common::Error::BadRequest(value),
5942 _ => common::Error::Failure(response),
5943 });
5944 }
5945 let response = {
5946 let bytes = common::to_bytes(body).await.unwrap_or_default();
5947 let encoded = common::to_string(&bytes);
5948 match serde_json::from_str(&encoded) {
5949 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5950 Err(error) => {
5951 dlg.response_json_decode_error(&encoded, &error);
5952 return Err(common::Error::JsonDecodeError(
5953 encoded.to_string(),
5954 error,
5955 ));
5956 }
5957 }
5958 };
5959
5960 dlg.finished(true);
5961 return Ok(response);
5962 }
5963 }
5964 }
5965 }
5966
5967 ///
5968 /// Sets the *request* property to the given value.
5969 ///
5970 /// Even though the property as already been set when instantiating this call,
5971 /// we provide this method for API completeness.
5972 pub fn request(
5973 mut self,
5974 new_value: GoogleCloudDatacatalogV1SetConfigRequest,
5975 ) -> OrganizationLocationSetConfigCall<'a, C> {
5976 self._request = new_value;
5977 self
5978 }
5979 /// Required. The organization or project whose config is being specified.
5980 ///
5981 /// Sets the *name* path property to the given value.
5982 ///
5983 /// Even though the property as already been set when instantiating this call,
5984 /// we provide this method for API completeness.
5985 pub fn name(mut self, new_value: &str) -> OrganizationLocationSetConfigCall<'a, C> {
5986 self._name = new_value.to_string();
5987 self
5988 }
5989 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5990 /// while executing the actual API request.
5991 ///
5992 /// ````text
5993 /// It should be used to handle progress information, and to implement a certain level of resilience.
5994 /// ````
5995 ///
5996 /// Sets the *delegate* property to the given value.
5997 pub fn delegate(
5998 mut self,
5999 new_value: &'a mut dyn common::Delegate,
6000 ) -> OrganizationLocationSetConfigCall<'a, C> {
6001 self._delegate = Some(new_value);
6002 self
6003 }
6004
6005 /// Set any additional parameter of the query string used in the request.
6006 /// It should be used to set parameters which are not yet available through their own
6007 /// setters.
6008 ///
6009 /// Please note that this method must not be used to set any of the known parameters
6010 /// which have their own setter method. If done anyway, the request will fail.
6011 ///
6012 /// # Additional Parameters
6013 ///
6014 /// * *$.xgafv* (query-string) - V1 error format.
6015 /// * *access_token* (query-string) - OAuth access token.
6016 /// * *alt* (query-string) - Data format for response.
6017 /// * *callback* (query-string) - JSONP
6018 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6019 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6020 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6021 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6022 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6023 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6024 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6025 pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationSetConfigCall<'a, C>
6026 where
6027 T: AsRef<str>,
6028 {
6029 self._additional_params
6030 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6031 self
6032 }
6033
6034 /// Identifies the authorization scope for the method you are building.
6035 ///
6036 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6037 /// [`Scope::CloudPlatform`].
6038 ///
6039 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6040 /// tokens for more than one scope.
6041 ///
6042 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6043 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6044 /// sufficient, a read-write scope will do as well.
6045 pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationSetConfigCall<'a, C>
6046 where
6047 St: AsRef<str>,
6048 {
6049 self._scopes.insert(String::from(scope.as_ref()));
6050 self
6051 }
6052 /// Identifies the authorization scope(s) for the method you are building.
6053 ///
6054 /// See [`Self::add_scope()`] for details.
6055 pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationSetConfigCall<'a, C>
6056 where
6057 I: IntoIterator<Item = St>,
6058 St: AsRef<str>,
6059 {
6060 self._scopes
6061 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6062 self
6063 }
6064
6065 /// Removes all scopes, and no default scope will be used either.
6066 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6067 /// for details).
6068 pub fn clear_scopes(mut self) -> OrganizationLocationSetConfigCall<'a, C> {
6069 self._scopes.clear();
6070 self
6071 }
6072}
6073
6074/// Creates a tag and assigns it to: * An Entry if the method name is `projects.locations.entryGroups.entries.tags.create`. * Or EntryGroupif the method name is `projects.locations.entryGroups.tags.create`. Note: The project identified by the `parent` parameter for the [tag] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be in the same organization.
6075///
6076/// A builder for the *locations.entryGroups.entries.tags.create* method supported by a *project* resource.
6077/// It is not used directly, but through a [`ProjectMethods`] instance.
6078///
6079/// # Example
6080///
6081/// Instantiate a resource method builder
6082///
6083/// ```test_harness,no_run
6084/// # extern crate hyper;
6085/// # extern crate hyper_rustls;
6086/// # extern crate google_datacatalog1 as datacatalog1;
6087/// use datacatalog1::api::GoogleCloudDatacatalogV1Tag;
6088/// # async fn dox() {
6089/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6090///
6091/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6092/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6093/// # .with_native_roots()
6094/// # .unwrap()
6095/// # .https_only()
6096/// # .enable_http2()
6097/// # .build();
6098///
6099/// # let executor = hyper_util::rt::TokioExecutor::new();
6100/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6101/// # secret,
6102/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6103/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6104/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6105/// # ),
6106/// # ).build().await.unwrap();
6107///
6108/// # let client = hyper_util::client::legacy::Client::builder(
6109/// # hyper_util::rt::TokioExecutor::new()
6110/// # )
6111/// # .build(
6112/// # hyper_rustls::HttpsConnectorBuilder::new()
6113/// # .with_native_roots()
6114/// # .unwrap()
6115/// # .https_or_http()
6116/// # .enable_http2()
6117/// # .build()
6118/// # );
6119/// # let mut hub = DataCatalog::new(client, auth);
6120/// // As the method needs a request, you would usually fill it with the desired information
6121/// // into the respective structure. Some of the parts shown here might not be applicable !
6122/// // Values shown here are possibly random and not representative !
6123/// let mut req = GoogleCloudDatacatalogV1Tag::default();
6124///
6125/// // You can configure optional parameters by calling the respective setters at will, and
6126/// // execute the final call using `doit()`.
6127/// // Values shown here are possibly random and not representative !
6128/// let result = hub.projects().locations_entry_groups_entries_tags_create(req, "parent")
6129/// .doit().await;
6130/// # }
6131/// ```
6132pub struct ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
6133where
6134 C: 'a,
6135{
6136 hub: &'a DataCatalog<C>,
6137 _request: GoogleCloudDatacatalogV1Tag,
6138 _parent: String,
6139 _delegate: Option<&'a mut dyn common::Delegate>,
6140 _additional_params: HashMap<String, String>,
6141 _scopes: BTreeSet<String>,
6142}
6143
6144impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {}
6145
6146impl<'a, C> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
6147where
6148 C: common::Connector,
6149{
6150 /// Perform the operation you have build so far.
6151 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Tag)> {
6152 use std::borrow::Cow;
6153 use std::io::{Read, Seek};
6154
6155 use common::{url::Params, ToParts};
6156 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6157
6158 let mut dd = common::DefaultDelegate;
6159 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6160 dlg.begin(common::MethodInfo {
6161 id: "datacatalog.projects.locations.entryGroups.entries.tags.create",
6162 http_method: hyper::Method::POST,
6163 });
6164
6165 for &field in ["alt", "parent"].iter() {
6166 if self._additional_params.contains_key(field) {
6167 dlg.finished(false);
6168 return Err(common::Error::FieldClash(field));
6169 }
6170 }
6171
6172 let mut params = Params::with_capacity(4 + self._additional_params.len());
6173 params.push("parent", self._parent);
6174
6175 params.extend(self._additional_params.iter());
6176
6177 params.push("alt", "json");
6178 let mut url = self.hub._base_url.clone() + "v1/{+parent}/tags";
6179 if self._scopes.is_empty() {
6180 self._scopes
6181 .insert(Scope::CloudPlatform.as_ref().to_string());
6182 }
6183
6184 #[allow(clippy::single_element_loop)]
6185 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6186 url = params.uri_replacement(url, param_name, find_this, true);
6187 }
6188 {
6189 let to_remove = ["parent"];
6190 params.remove_params(&to_remove);
6191 }
6192
6193 let url = params.parse_with_url(&url);
6194
6195 let mut json_mime_type = mime::APPLICATION_JSON;
6196 let mut request_value_reader = {
6197 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6198 common::remove_json_null_values(&mut value);
6199 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6200 serde_json::to_writer(&mut dst, &value).unwrap();
6201 dst
6202 };
6203 let request_size = request_value_reader
6204 .seek(std::io::SeekFrom::End(0))
6205 .unwrap();
6206 request_value_reader
6207 .seek(std::io::SeekFrom::Start(0))
6208 .unwrap();
6209
6210 loop {
6211 let token = match self
6212 .hub
6213 .auth
6214 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6215 .await
6216 {
6217 Ok(token) => token,
6218 Err(e) => match dlg.token(e) {
6219 Ok(token) => token,
6220 Err(e) => {
6221 dlg.finished(false);
6222 return Err(common::Error::MissingToken(e));
6223 }
6224 },
6225 };
6226 request_value_reader
6227 .seek(std::io::SeekFrom::Start(0))
6228 .unwrap();
6229 let mut req_result = {
6230 let client = &self.hub.client;
6231 dlg.pre_request();
6232 let mut req_builder = hyper::Request::builder()
6233 .method(hyper::Method::POST)
6234 .uri(url.as_str())
6235 .header(USER_AGENT, self.hub._user_agent.clone());
6236
6237 if let Some(token) = token.as_ref() {
6238 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6239 }
6240
6241 let request = req_builder
6242 .header(CONTENT_TYPE, json_mime_type.to_string())
6243 .header(CONTENT_LENGTH, request_size as u64)
6244 .body(common::to_body(
6245 request_value_reader.get_ref().clone().into(),
6246 ));
6247
6248 client.request(request.unwrap()).await
6249 };
6250
6251 match req_result {
6252 Err(err) => {
6253 if let common::Retry::After(d) = dlg.http_error(&err) {
6254 sleep(d).await;
6255 continue;
6256 }
6257 dlg.finished(false);
6258 return Err(common::Error::HttpError(err));
6259 }
6260 Ok(res) => {
6261 let (mut parts, body) = res.into_parts();
6262 let mut body = common::Body::new(body);
6263 if !parts.status.is_success() {
6264 let bytes = common::to_bytes(body).await.unwrap_or_default();
6265 let error = serde_json::from_str(&common::to_string(&bytes));
6266 let response = common::to_response(parts, bytes.into());
6267
6268 if let common::Retry::After(d) =
6269 dlg.http_failure(&response, error.as_ref().ok())
6270 {
6271 sleep(d).await;
6272 continue;
6273 }
6274
6275 dlg.finished(false);
6276
6277 return Err(match error {
6278 Ok(value) => common::Error::BadRequest(value),
6279 _ => common::Error::Failure(response),
6280 });
6281 }
6282 let response = {
6283 let bytes = common::to_bytes(body).await.unwrap_or_default();
6284 let encoded = common::to_string(&bytes);
6285 match serde_json::from_str(&encoded) {
6286 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6287 Err(error) => {
6288 dlg.response_json_decode_error(&encoded, &error);
6289 return Err(common::Error::JsonDecodeError(
6290 encoded.to_string(),
6291 error,
6292 ));
6293 }
6294 }
6295 };
6296
6297 dlg.finished(true);
6298 return Ok(response);
6299 }
6300 }
6301 }
6302 }
6303
6304 ///
6305 /// Sets the *request* property to the given value.
6306 ///
6307 /// Even though the property as already been set when instantiating this call,
6308 /// we provide this method for API completeness.
6309 pub fn request(
6310 mut self,
6311 new_value: GoogleCloudDatacatalogV1Tag,
6312 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
6313 self._request = new_value;
6314 self
6315 }
6316 /// Required. The name of the resource to attach this tag to. Tags can be attached to entries or entry groups. An entry can have up to 1000 attached tags. Note: The tag and its child resources might not be stored in the location specified in its name.
6317 ///
6318 /// Sets the *parent* path property to the given value.
6319 ///
6320 /// Even though the property as already been set when instantiating this call,
6321 /// we provide this method for API completeness.
6322 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
6323 self._parent = new_value.to_string();
6324 self
6325 }
6326 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6327 /// while executing the actual API request.
6328 ///
6329 /// ````text
6330 /// It should be used to handle progress information, and to implement a certain level of resilience.
6331 /// ````
6332 ///
6333 /// Sets the *delegate* property to the given value.
6334 pub fn delegate(
6335 mut self,
6336 new_value: &'a mut dyn common::Delegate,
6337 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
6338 self._delegate = Some(new_value);
6339 self
6340 }
6341
6342 /// Set any additional parameter of the query string used in the request.
6343 /// It should be used to set parameters which are not yet available through their own
6344 /// setters.
6345 ///
6346 /// Please note that this method must not be used to set any of the known parameters
6347 /// which have their own setter method. If done anyway, the request will fail.
6348 ///
6349 /// # Additional Parameters
6350 ///
6351 /// * *$.xgafv* (query-string) - V1 error format.
6352 /// * *access_token* (query-string) - OAuth access token.
6353 /// * *alt* (query-string) - Data format for response.
6354 /// * *callback* (query-string) - JSONP
6355 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6356 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6357 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6358 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6359 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6360 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6361 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6362 pub fn param<T>(
6363 mut self,
6364 name: T,
6365 value: T,
6366 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
6367 where
6368 T: AsRef<str>,
6369 {
6370 self._additional_params
6371 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6372 self
6373 }
6374
6375 /// Identifies the authorization scope for the method you are building.
6376 ///
6377 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6378 /// [`Scope::CloudPlatform`].
6379 ///
6380 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6381 /// tokens for more than one scope.
6382 ///
6383 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6384 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6385 /// sufficient, a read-write scope will do as well.
6386 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
6387 where
6388 St: AsRef<str>,
6389 {
6390 self._scopes.insert(String::from(scope.as_ref()));
6391 self
6392 }
6393 /// Identifies the authorization scope(s) for the method you are building.
6394 ///
6395 /// See [`Self::add_scope()`] for details.
6396 pub fn add_scopes<I, St>(
6397 mut self,
6398 scopes: I,
6399 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
6400 where
6401 I: IntoIterator<Item = St>,
6402 St: AsRef<str>,
6403 {
6404 self._scopes
6405 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6406 self
6407 }
6408
6409 /// Removes all scopes, and no default scope will be used either.
6410 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6411 /// for details).
6412 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
6413 self._scopes.clear();
6414 self
6415 }
6416}
6417
6418/// Deletes a tag.
6419///
6420/// A builder for the *locations.entryGroups.entries.tags.delete* method supported by a *project* resource.
6421/// It is not used directly, but through a [`ProjectMethods`] instance.
6422///
6423/// # Example
6424///
6425/// Instantiate a resource method builder
6426///
6427/// ```test_harness,no_run
6428/// # extern crate hyper;
6429/// # extern crate hyper_rustls;
6430/// # extern crate google_datacatalog1 as datacatalog1;
6431/// # async fn dox() {
6432/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6433///
6434/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6435/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6436/// # .with_native_roots()
6437/// # .unwrap()
6438/// # .https_only()
6439/// # .enable_http2()
6440/// # .build();
6441///
6442/// # let executor = hyper_util::rt::TokioExecutor::new();
6443/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6444/// # secret,
6445/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6446/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6447/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6448/// # ),
6449/// # ).build().await.unwrap();
6450///
6451/// # let client = hyper_util::client::legacy::Client::builder(
6452/// # hyper_util::rt::TokioExecutor::new()
6453/// # )
6454/// # .build(
6455/// # hyper_rustls::HttpsConnectorBuilder::new()
6456/// # .with_native_roots()
6457/// # .unwrap()
6458/// # .https_or_http()
6459/// # .enable_http2()
6460/// # .build()
6461/// # );
6462/// # let mut hub = DataCatalog::new(client, auth);
6463/// // You can configure optional parameters by calling the respective setters at will, and
6464/// // execute the final call using `doit()`.
6465/// // Values shown here are possibly random and not representative !
6466/// let result = hub.projects().locations_entry_groups_entries_tags_delete("name")
6467/// .doit().await;
6468/// # }
6469/// ```
6470pub struct ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
6471where
6472 C: 'a,
6473{
6474 hub: &'a DataCatalog<C>,
6475 _name: String,
6476 _delegate: Option<&'a mut dyn common::Delegate>,
6477 _additional_params: HashMap<String, String>,
6478 _scopes: BTreeSet<String>,
6479}
6480
6481impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {}
6482
6483impl<'a, C> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
6484where
6485 C: common::Connector,
6486{
6487 /// Perform the operation you have build so far.
6488 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6489 use std::borrow::Cow;
6490 use std::io::{Read, Seek};
6491
6492 use common::{url::Params, ToParts};
6493 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6494
6495 let mut dd = common::DefaultDelegate;
6496 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6497 dlg.begin(common::MethodInfo {
6498 id: "datacatalog.projects.locations.entryGroups.entries.tags.delete",
6499 http_method: hyper::Method::DELETE,
6500 });
6501
6502 for &field in ["alt", "name"].iter() {
6503 if self._additional_params.contains_key(field) {
6504 dlg.finished(false);
6505 return Err(common::Error::FieldClash(field));
6506 }
6507 }
6508
6509 let mut params = Params::with_capacity(3 + self._additional_params.len());
6510 params.push("name", self._name);
6511
6512 params.extend(self._additional_params.iter());
6513
6514 params.push("alt", "json");
6515 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6516 if self._scopes.is_empty() {
6517 self._scopes
6518 .insert(Scope::CloudPlatform.as_ref().to_string());
6519 }
6520
6521 #[allow(clippy::single_element_loop)]
6522 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6523 url = params.uri_replacement(url, param_name, find_this, true);
6524 }
6525 {
6526 let to_remove = ["name"];
6527 params.remove_params(&to_remove);
6528 }
6529
6530 let url = params.parse_with_url(&url);
6531
6532 loop {
6533 let token = match self
6534 .hub
6535 .auth
6536 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6537 .await
6538 {
6539 Ok(token) => token,
6540 Err(e) => match dlg.token(e) {
6541 Ok(token) => token,
6542 Err(e) => {
6543 dlg.finished(false);
6544 return Err(common::Error::MissingToken(e));
6545 }
6546 },
6547 };
6548 let mut req_result = {
6549 let client = &self.hub.client;
6550 dlg.pre_request();
6551 let mut req_builder = hyper::Request::builder()
6552 .method(hyper::Method::DELETE)
6553 .uri(url.as_str())
6554 .header(USER_AGENT, self.hub._user_agent.clone());
6555
6556 if let Some(token) = token.as_ref() {
6557 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6558 }
6559
6560 let request = req_builder
6561 .header(CONTENT_LENGTH, 0_u64)
6562 .body(common::to_body::<String>(None));
6563
6564 client.request(request.unwrap()).await
6565 };
6566
6567 match req_result {
6568 Err(err) => {
6569 if let common::Retry::After(d) = dlg.http_error(&err) {
6570 sleep(d).await;
6571 continue;
6572 }
6573 dlg.finished(false);
6574 return Err(common::Error::HttpError(err));
6575 }
6576 Ok(res) => {
6577 let (mut parts, body) = res.into_parts();
6578 let mut body = common::Body::new(body);
6579 if !parts.status.is_success() {
6580 let bytes = common::to_bytes(body).await.unwrap_or_default();
6581 let error = serde_json::from_str(&common::to_string(&bytes));
6582 let response = common::to_response(parts, bytes.into());
6583
6584 if let common::Retry::After(d) =
6585 dlg.http_failure(&response, error.as_ref().ok())
6586 {
6587 sleep(d).await;
6588 continue;
6589 }
6590
6591 dlg.finished(false);
6592
6593 return Err(match error {
6594 Ok(value) => common::Error::BadRequest(value),
6595 _ => common::Error::Failure(response),
6596 });
6597 }
6598 let response = {
6599 let bytes = common::to_bytes(body).await.unwrap_or_default();
6600 let encoded = common::to_string(&bytes);
6601 match serde_json::from_str(&encoded) {
6602 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6603 Err(error) => {
6604 dlg.response_json_decode_error(&encoded, &error);
6605 return Err(common::Error::JsonDecodeError(
6606 encoded.to_string(),
6607 error,
6608 ));
6609 }
6610 }
6611 };
6612
6613 dlg.finished(true);
6614 return Ok(response);
6615 }
6616 }
6617 }
6618 }
6619
6620 /// Required. The name of the tag to delete.
6621 ///
6622 /// Sets the *name* path property to the given value.
6623 ///
6624 /// Even though the property as already been set when instantiating this call,
6625 /// we provide this method for API completeness.
6626 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
6627 self._name = new_value.to_string();
6628 self
6629 }
6630 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6631 /// while executing the actual API request.
6632 ///
6633 /// ````text
6634 /// It should be used to handle progress information, and to implement a certain level of resilience.
6635 /// ````
6636 ///
6637 /// Sets the *delegate* property to the given value.
6638 pub fn delegate(
6639 mut self,
6640 new_value: &'a mut dyn common::Delegate,
6641 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
6642 self._delegate = Some(new_value);
6643 self
6644 }
6645
6646 /// Set any additional parameter of the query string used in the request.
6647 /// It should be used to set parameters which are not yet available through their own
6648 /// setters.
6649 ///
6650 /// Please note that this method must not be used to set any of the known parameters
6651 /// which have their own setter method. If done anyway, the request will fail.
6652 ///
6653 /// # Additional Parameters
6654 ///
6655 /// * *$.xgafv* (query-string) - V1 error format.
6656 /// * *access_token* (query-string) - OAuth access token.
6657 /// * *alt* (query-string) - Data format for response.
6658 /// * *callback* (query-string) - JSONP
6659 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6660 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6661 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6662 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6663 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6664 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6665 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6666 pub fn param<T>(
6667 mut self,
6668 name: T,
6669 value: T,
6670 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
6671 where
6672 T: AsRef<str>,
6673 {
6674 self._additional_params
6675 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6676 self
6677 }
6678
6679 /// Identifies the authorization scope for the method you are building.
6680 ///
6681 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6682 /// [`Scope::CloudPlatform`].
6683 ///
6684 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6685 /// tokens for more than one scope.
6686 ///
6687 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6688 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6689 /// sufficient, a read-write scope will do as well.
6690 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
6691 where
6692 St: AsRef<str>,
6693 {
6694 self._scopes.insert(String::from(scope.as_ref()));
6695 self
6696 }
6697 /// Identifies the authorization scope(s) for the method you are building.
6698 ///
6699 /// See [`Self::add_scope()`] for details.
6700 pub fn add_scopes<I, St>(
6701 mut self,
6702 scopes: I,
6703 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
6704 where
6705 I: IntoIterator<Item = St>,
6706 St: AsRef<str>,
6707 {
6708 self._scopes
6709 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6710 self
6711 }
6712
6713 /// Removes all scopes, and no default scope will be used either.
6714 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6715 /// for details).
6716 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
6717 self._scopes.clear();
6718 self
6719 }
6720}
6721
6722/// Lists tags assigned to an Entry. The columns in the response are lowercased.
6723///
6724/// A builder for the *locations.entryGroups.entries.tags.list* method supported by a *project* resource.
6725/// It is not used directly, but through a [`ProjectMethods`] instance.
6726///
6727/// # Example
6728///
6729/// Instantiate a resource method builder
6730///
6731/// ```test_harness,no_run
6732/// # extern crate hyper;
6733/// # extern crate hyper_rustls;
6734/// # extern crate google_datacatalog1 as datacatalog1;
6735/// # async fn dox() {
6736/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6737///
6738/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6739/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6740/// # .with_native_roots()
6741/// # .unwrap()
6742/// # .https_only()
6743/// # .enable_http2()
6744/// # .build();
6745///
6746/// # let executor = hyper_util::rt::TokioExecutor::new();
6747/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6748/// # secret,
6749/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6750/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6751/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6752/// # ),
6753/// # ).build().await.unwrap();
6754///
6755/// # let client = hyper_util::client::legacy::Client::builder(
6756/// # hyper_util::rt::TokioExecutor::new()
6757/// # )
6758/// # .build(
6759/// # hyper_rustls::HttpsConnectorBuilder::new()
6760/// # .with_native_roots()
6761/// # .unwrap()
6762/// # .https_or_http()
6763/// # .enable_http2()
6764/// # .build()
6765/// # );
6766/// # let mut hub = DataCatalog::new(client, auth);
6767/// // You can configure optional parameters by calling the respective setters at will, and
6768/// // execute the final call using `doit()`.
6769/// // Values shown here are possibly random and not representative !
6770/// let result = hub.projects().locations_entry_groups_entries_tags_list("parent")
6771/// .page_token("amet")
6772/// .page_size(-20)
6773/// .doit().await;
6774/// # }
6775/// ```
6776pub struct ProjectLocationEntryGroupEntryTagListCall<'a, C>
6777where
6778 C: 'a,
6779{
6780 hub: &'a DataCatalog<C>,
6781 _parent: String,
6782 _page_token: Option<String>,
6783 _page_size: Option<i32>,
6784 _delegate: Option<&'a mut dyn common::Delegate>,
6785 _additional_params: HashMap<String, String>,
6786 _scopes: BTreeSet<String>,
6787}
6788
6789impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagListCall<'a, C> {}
6790
6791impl<'a, C> ProjectLocationEntryGroupEntryTagListCall<'a, C>
6792where
6793 C: common::Connector,
6794{
6795 /// Perform the operation you have build so far.
6796 pub async fn doit(
6797 mut self,
6798 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1ListTagsResponse)> {
6799 use std::borrow::Cow;
6800 use std::io::{Read, Seek};
6801
6802 use common::{url::Params, ToParts};
6803 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6804
6805 let mut dd = common::DefaultDelegate;
6806 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6807 dlg.begin(common::MethodInfo {
6808 id: "datacatalog.projects.locations.entryGroups.entries.tags.list",
6809 http_method: hyper::Method::GET,
6810 });
6811
6812 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6813 if self._additional_params.contains_key(field) {
6814 dlg.finished(false);
6815 return Err(common::Error::FieldClash(field));
6816 }
6817 }
6818
6819 let mut params = Params::with_capacity(5 + self._additional_params.len());
6820 params.push("parent", self._parent);
6821 if let Some(value) = self._page_token.as_ref() {
6822 params.push("pageToken", value);
6823 }
6824 if let Some(value) = self._page_size.as_ref() {
6825 params.push("pageSize", value.to_string());
6826 }
6827
6828 params.extend(self._additional_params.iter());
6829
6830 params.push("alt", "json");
6831 let mut url = self.hub._base_url.clone() + "v1/{+parent}/tags";
6832 if self._scopes.is_empty() {
6833 self._scopes
6834 .insert(Scope::CloudPlatform.as_ref().to_string());
6835 }
6836
6837 #[allow(clippy::single_element_loop)]
6838 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6839 url = params.uri_replacement(url, param_name, find_this, true);
6840 }
6841 {
6842 let to_remove = ["parent"];
6843 params.remove_params(&to_remove);
6844 }
6845
6846 let url = params.parse_with_url(&url);
6847
6848 loop {
6849 let token = match self
6850 .hub
6851 .auth
6852 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6853 .await
6854 {
6855 Ok(token) => token,
6856 Err(e) => match dlg.token(e) {
6857 Ok(token) => token,
6858 Err(e) => {
6859 dlg.finished(false);
6860 return Err(common::Error::MissingToken(e));
6861 }
6862 },
6863 };
6864 let mut req_result = {
6865 let client = &self.hub.client;
6866 dlg.pre_request();
6867 let mut req_builder = hyper::Request::builder()
6868 .method(hyper::Method::GET)
6869 .uri(url.as_str())
6870 .header(USER_AGENT, self.hub._user_agent.clone());
6871
6872 if let Some(token) = token.as_ref() {
6873 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6874 }
6875
6876 let request = req_builder
6877 .header(CONTENT_LENGTH, 0_u64)
6878 .body(common::to_body::<String>(None));
6879
6880 client.request(request.unwrap()).await
6881 };
6882
6883 match req_result {
6884 Err(err) => {
6885 if let common::Retry::After(d) = dlg.http_error(&err) {
6886 sleep(d).await;
6887 continue;
6888 }
6889 dlg.finished(false);
6890 return Err(common::Error::HttpError(err));
6891 }
6892 Ok(res) => {
6893 let (mut parts, body) = res.into_parts();
6894 let mut body = common::Body::new(body);
6895 if !parts.status.is_success() {
6896 let bytes = common::to_bytes(body).await.unwrap_or_default();
6897 let error = serde_json::from_str(&common::to_string(&bytes));
6898 let response = common::to_response(parts, bytes.into());
6899
6900 if let common::Retry::After(d) =
6901 dlg.http_failure(&response, error.as_ref().ok())
6902 {
6903 sleep(d).await;
6904 continue;
6905 }
6906
6907 dlg.finished(false);
6908
6909 return Err(match error {
6910 Ok(value) => common::Error::BadRequest(value),
6911 _ => common::Error::Failure(response),
6912 });
6913 }
6914 let response = {
6915 let bytes = common::to_bytes(body).await.unwrap_or_default();
6916 let encoded = common::to_string(&bytes);
6917 match serde_json::from_str(&encoded) {
6918 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6919 Err(error) => {
6920 dlg.response_json_decode_error(&encoded, &error);
6921 return Err(common::Error::JsonDecodeError(
6922 encoded.to_string(),
6923 error,
6924 ));
6925 }
6926 }
6927 };
6928
6929 dlg.finished(true);
6930 return Ok(response);
6931 }
6932 }
6933 }
6934 }
6935
6936 /// Required. The name of the Data Catalog resource to list the tags of. The resource can be an Entry or an EntryGroup (without `/entries/{entries}` at the end).
6937 ///
6938 /// Sets the *parent* path property to the given value.
6939 ///
6940 /// Even though the property as already been set when instantiating this call,
6941 /// we provide this method for API completeness.
6942 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
6943 self._parent = new_value.to_string();
6944 self
6945 }
6946 /// Pagination token that specifies the next page to return. If empty, the first page is returned.
6947 ///
6948 /// Sets the *page token* query property to the given value.
6949 pub fn page_token(
6950 mut self,
6951 new_value: &str,
6952 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
6953 self._page_token = Some(new_value.to_string());
6954 self
6955 }
6956 /// The maximum number of tags to return. Default is 10. Maximum limit is 1000.
6957 ///
6958 /// Sets the *page size* query property to the given value.
6959 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
6960 self._page_size = Some(new_value);
6961 self
6962 }
6963 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6964 /// while executing the actual API request.
6965 ///
6966 /// ````text
6967 /// It should be used to handle progress information, and to implement a certain level of resilience.
6968 /// ````
6969 ///
6970 /// Sets the *delegate* property to the given value.
6971 pub fn delegate(
6972 mut self,
6973 new_value: &'a mut dyn common::Delegate,
6974 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
6975 self._delegate = Some(new_value);
6976 self
6977 }
6978
6979 /// Set any additional parameter of the query string used in the request.
6980 /// It should be used to set parameters which are not yet available through their own
6981 /// setters.
6982 ///
6983 /// Please note that this method must not be used to set any of the known parameters
6984 /// which have their own setter method. If done anyway, the request will fail.
6985 ///
6986 /// # Additional Parameters
6987 ///
6988 /// * *$.xgafv* (query-string) - V1 error format.
6989 /// * *access_token* (query-string) - OAuth access token.
6990 /// * *alt* (query-string) - Data format for response.
6991 /// * *callback* (query-string) - JSONP
6992 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6993 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6994 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6995 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6996 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6997 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6998 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6999 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryTagListCall<'a, C>
7000 where
7001 T: AsRef<str>,
7002 {
7003 self._additional_params
7004 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7005 self
7006 }
7007
7008 /// Identifies the authorization scope for the method you are building.
7009 ///
7010 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7011 /// [`Scope::CloudPlatform`].
7012 ///
7013 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7014 /// tokens for more than one scope.
7015 ///
7016 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7017 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7018 /// sufficient, a read-write scope will do as well.
7019 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagListCall<'a, C>
7020 where
7021 St: AsRef<str>,
7022 {
7023 self._scopes.insert(String::from(scope.as_ref()));
7024 self
7025 }
7026 /// Identifies the authorization scope(s) for the method you are building.
7027 ///
7028 /// See [`Self::add_scope()`] for details.
7029 pub fn add_scopes<I, St>(
7030 mut self,
7031 scopes: I,
7032 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C>
7033 where
7034 I: IntoIterator<Item = St>,
7035 St: AsRef<str>,
7036 {
7037 self._scopes
7038 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7039 self
7040 }
7041
7042 /// Removes all scopes, and no default scope will be used either.
7043 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7044 /// for details).
7045 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
7046 self._scopes.clear();
7047 self
7048 }
7049}
7050
7051/// Updates an existing tag.
7052///
7053/// A builder for the *locations.entryGroups.entries.tags.patch* method supported by a *project* resource.
7054/// It is not used directly, but through a [`ProjectMethods`] instance.
7055///
7056/// # Example
7057///
7058/// Instantiate a resource method builder
7059///
7060/// ```test_harness,no_run
7061/// # extern crate hyper;
7062/// # extern crate hyper_rustls;
7063/// # extern crate google_datacatalog1 as datacatalog1;
7064/// use datacatalog1::api::GoogleCloudDatacatalogV1Tag;
7065/// # async fn dox() {
7066/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7067///
7068/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7069/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7070/// # .with_native_roots()
7071/// # .unwrap()
7072/// # .https_only()
7073/// # .enable_http2()
7074/// # .build();
7075///
7076/// # let executor = hyper_util::rt::TokioExecutor::new();
7077/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7078/// # secret,
7079/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7080/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7081/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7082/// # ),
7083/// # ).build().await.unwrap();
7084///
7085/// # let client = hyper_util::client::legacy::Client::builder(
7086/// # hyper_util::rt::TokioExecutor::new()
7087/// # )
7088/// # .build(
7089/// # hyper_rustls::HttpsConnectorBuilder::new()
7090/// # .with_native_roots()
7091/// # .unwrap()
7092/// # .https_or_http()
7093/// # .enable_http2()
7094/// # .build()
7095/// # );
7096/// # let mut hub = DataCatalog::new(client, auth);
7097/// // As the method needs a request, you would usually fill it with the desired information
7098/// // into the respective structure. Some of the parts shown here might not be applicable !
7099/// // Values shown here are possibly random and not representative !
7100/// let mut req = GoogleCloudDatacatalogV1Tag::default();
7101///
7102/// // You can configure optional parameters by calling the respective setters at will, and
7103/// // execute the final call using `doit()`.
7104/// // Values shown here are possibly random and not representative !
7105/// let result = hub.projects().locations_entry_groups_entries_tags_patch(req, "name")
7106/// .update_mask(FieldMask::new::<&str>(&[]))
7107/// .doit().await;
7108/// # }
7109/// ```
7110pub struct ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
7111where
7112 C: 'a,
7113{
7114 hub: &'a DataCatalog<C>,
7115 _request: GoogleCloudDatacatalogV1Tag,
7116 _name: String,
7117 _update_mask: Option<common::FieldMask>,
7118 _delegate: Option<&'a mut dyn common::Delegate>,
7119 _additional_params: HashMap<String, String>,
7120 _scopes: BTreeSet<String>,
7121}
7122
7123impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {}
7124
7125impl<'a, C> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
7126where
7127 C: common::Connector,
7128{
7129 /// Perform the operation you have build so far.
7130 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Tag)> {
7131 use std::borrow::Cow;
7132 use std::io::{Read, Seek};
7133
7134 use common::{url::Params, ToParts};
7135 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7136
7137 let mut dd = common::DefaultDelegate;
7138 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7139 dlg.begin(common::MethodInfo {
7140 id: "datacatalog.projects.locations.entryGroups.entries.tags.patch",
7141 http_method: hyper::Method::PATCH,
7142 });
7143
7144 for &field in ["alt", "name", "updateMask"].iter() {
7145 if self._additional_params.contains_key(field) {
7146 dlg.finished(false);
7147 return Err(common::Error::FieldClash(field));
7148 }
7149 }
7150
7151 let mut params = Params::with_capacity(5 + self._additional_params.len());
7152 params.push("name", self._name);
7153 if let Some(value) = self._update_mask.as_ref() {
7154 params.push("updateMask", value.to_string());
7155 }
7156
7157 params.extend(self._additional_params.iter());
7158
7159 params.push("alt", "json");
7160 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7161 if self._scopes.is_empty() {
7162 self._scopes
7163 .insert(Scope::CloudPlatform.as_ref().to_string());
7164 }
7165
7166 #[allow(clippy::single_element_loop)]
7167 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7168 url = params.uri_replacement(url, param_name, find_this, true);
7169 }
7170 {
7171 let to_remove = ["name"];
7172 params.remove_params(&to_remove);
7173 }
7174
7175 let url = params.parse_with_url(&url);
7176
7177 let mut json_mime_type = mime::APPLICATION_JSON;
7178 let mut request_value_reader = {
7179 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7180 common::remove_json_null_values(&mut value);
7181 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7182 serde_json::to_writer(&mut dst, &value).unwrap();
7183 dst
7184 };
7185 let request_size = request_value_reader
7186 .seek(std::io::SeekFrom::End(0))
7187 .unwrap();
7188 request_value_reader
7189 .seek(std::io::SeekFrom::Start(0))
7190 .unwrap();
7191
7192 loop {
7193 let token = match self
7194 .hub
7195 .auth
7196 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7197 .await
7198 {
7199 Ok(token) => token,
7200 Err(e) => match dlg.token(e) {
7201 Ok(token) => token,
7202 Err(e) => {
7203 dlg.finished(false);
7204 return Err(common::Error::MissingToken(e));
7205 }
7206 },
7207 };
7208 request_value_reader
7209 .seek(std::io::SeekFrom::Start(0))
7210 .unwrap();
7211 let mut req_result = {
7212 let client = &self.hub.client;
7213 dlg.pre_request();
7214 let mut req_builder = hyper::Request::builder()
7215 .method(hyper::Method::PATCH)
7216 .uri(url.as_str())
7217 .header(USER_AGENT, self.hub._user_agent.clone());
7218
7219 if let Some(token) = token.as_ref() {
7220 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7221 }
7222
7223 let request = req_builder
7224 .header(CONTENT_TYPE, json_mime_type.to_string())
7225 .header(CONTENT_LENGTH, request_size as u64)
7226 .body(common::to_body(
7227 request_value_reader.get_ref().clone().into(),
7228 ));
7229
7230 client.request(request.unwrap()).await
7231 };
7232
7233 match req_result {
7234 Err(err) => {
7235 if let common::Retry::After(d) = dlg.http_error(&err) {
7236 sleep(d).await;
7237 continue;
7238 }
7239 dlg.finished(false);
7240 return Err(common::Error::HttpError(err));
7241 }
7242 Ok(res) => {
7243 let (mut parts, body) = res.into_parts();
7244 let mut body = common::Body::new(body);
7245 if !parts.status.is_success() {
7246 let bytes = common::to_bytes(body).await.unwrap_or_default();
7247 let error = serde_json::from_str(&common::to_string(&bytes));
7248 let response = common::to_response(parts, bytes.into());
7249
7250 if let common::Retry::After(d) =
7251 dlg.http_failure(&response, error.as_ref().ok())
7252 {
7253 sleep(d).await;
7254 continue;
7255 }
7256
7257 dlg.finished(false);
7258
7259 return Err(match error {
7260 Ok(value) => common::Error::BadRequest(value),
7261 _ => common::Error::Failure(response),
7262 });
7263 }
7264 let response = {
7265 let bytes = common::to_bytes(body).await.unwrap_or_default();
7266 let encoded = common::to_string(&bytes);
7267 match serde_json::from_str(&encoded) {
7268 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7269 Err(error) => {
7270 dlg.response_json_decode_error(&encoded, &error);
7271 return Err(common::Error::JsonDecodeError(
7272 encoded.to_string(),
7273 error,
7274 ));
7275 }
7276 }
7277 };
7278
7279 dlg.finished(true);
7280 return Ok(response);
7281 }
7282 }
7283 }
7284 }
7285
7286 ///
7287 /// Sets the *request* property to the given value.
7288 ///
7289 /// Even though the property as already been set when instantiating this call,
7290 /// we provide this method for API completeness.
7291 pub fn request(
7292 mut self,
7293 new_value: GoogleCloudDatacatalogV1Tag,
7294 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
7295 self._request = new_value;
7296 self
7297 }
7298 /// Identifier. The resource name of the tag in URL format where tag ID is a system-generated identifier. Note: The tag itself might not be stored in the location specified in its name.
7299 ///
7300 /// Sets the *name* path property to the given value.
7301 ///
7302 /// Even though the property as already been set when instantiating this call,
7303 /// we provide this method for API completeness.
7304 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
7305 self._name = new_value.to_string();
7306 self
7307 }
7308 /// Names of fields whose values to overwrite on a tag. Currently, a tag has the only modifiable field with the name `fields`. In general, if this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied.
7309 ///
7310 /// Sets the *update mask* query property to the given value.
7311 pub fn update_mask(
7312 mut self,
7313 new_value: common::FieldMask,
7314 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
7315 self._update_mask = Some(new_value);
7316 self
7317 }
7318 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7319 /// while executing the actual API request.
7320 ///
7321 /// ````text
7322 /// It should be used to handle progress information, and to implement a certain level of resilience.
7323 /// ````
7324 ///
7325 /// Sets the *delegate* property to the given value.
7326 pub fn delegate(
7327 mut self,
7328 new_value: &'a mut dyn common::Delegate,
7329 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
7330 self._delegate = Some(new_value);
7331 self
7332 }
7333
7334 /// Set any additional parameter of the query string used in the request.
7335 /// It should be used to set parameters which are not yet available through their own
7336 /// setters.
7337 ///
7338 /// Please note that this method must not be used to set any of the known parameters
7339 /// which have their own setter method. If done anyway, the request will fail.
7340 ///
7341 /// # Additional Parameters
7342 ///
7343 /// * *$.xgafv* (query-string) - V1 error format.
7344 /// * *access_token* (query-string) - OAuth access token.
7345 /// * *alt* (query-string) - Data format for response.
7346 /// * *callback* (query-string) - JSONP
7347 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7348 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7349 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7350 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7351 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7352 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7353 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7354 pub fn param<T>(
7355 mut self,
7356 name: T,
7357 value: T,
7358 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
7359 where
7360 T: AsRef<str>,
7361 {
7362 self._additional_params
7363 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7364 self
7365 }
7366
7367 /// Identifies the authorization scope for the method you are building.
7368 ///
7369 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7370 /// [`Scope::CloudPlatform`].
7371 ///
7372 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7373 /// tokens for more than one scope.
7374 ///
7375 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7376 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7377 /// sufficient, a read-write scope will do as well.
7378 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
7379 where
7380 St: AsRef<str>,
7381 {
7382 self._scopes.insert(String::from(scope.as_ref()));
7383 self
7384 }
7385 /// Identifies the authorization scope(s) for the method you are building.
7386 ///
7387 /// See [`Self::add_scope()`] for details.
7388 pub fn add_scopes<I, St>(
7389 mut self,
7390 scopes: I,
7391 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
7392 where
7393 I: IntoIterator<Item = St>,
7394 St: AsRef<str>,
7395 {
7396 self._scopes
7397 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7398 self
7399 }
7400
7401 /// Removes all scopes, and no default scope will be used either.
7402 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7403 /// for details).
7404 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
7405 self._scopes.clear();
7406 self
7407 }
7408}
7409
7410/// `ReconcileTags` creates or updates a list of tags on the entry. If the ReconcileTagsRequest.force_delete_missing parameter is set, the operation deletes tags not included in the input tag list. `ReconcileTags` returns a long-running operation resource that can be queried with Operations.GetOperation to return ReconcileTagsMetadata and a ReconcileTagsResponse message. Note: SearchCatalog might return stale search results for up to 24 hours after the `ReconcileTags` operation completes.
7411///
7412/// A builder for the *locations.entryGroups.entries.tags.reconcile* method supported by a *project* resource.
7413/// It is not used directly, but through a [`ProjectMethods`] instance.
7414///
7415/// # Example
7416///
7417/// Instantiate a resource method builder
7418///
7419/// ```test_harness,no_run
7420/// # extern crate hyper;
7421/// # extern crate hyper_rustls;
7422/// # extern crate google_datacatalog1 as datacatalog1;
7423/// use datacatalog1::api::GoogleCloudDatacatalogV1ReconcileTagsRequest;
7424/// # async fn dox() {
7425/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7426///
7427/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7428/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7429/// # .with_native_roots()
7430/// # .unwrap()
7431/// # .https_only()
7432/// # .enable_http2()
7433/// # .build();
7434///
7435/// # let executor = hyper_util::rt::TokioExecutor::new();
7436/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7437/// # secret,
7438/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7439/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7440/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7441/// # ),
7442/// # ).build().await.unwrap();
7443///
7444/// # let client = hyper_util::client::legacy::Client::builder(
7445/// # hyper_util::rt::TokioExecutor::new()
7446/// # )
7447/// # .build(
7448/// # hyper_rustls::HttpsConnectorBuilder::new()
7449/// # .with_native_roots()
7450/// # .unwrap()
7451/// # .https_or_http()
7452/// # .enable_http2()
7453/// # .build()
7454/// # );
7455/// # let mut hub = DataCatalog::new(client, auth);
7456/// // As the method needs a request, you would usually fill it with the desired information
7457/// // into the respective structure. Some of the parts shown here might not be applicable !
7458/// // Values shown here are possibly random and not representative !
7459/// let mut req = GoogleCloudDatacatalogV1ReconcileTagsRequest::default();
7460///
7461/// // You can configure optional parameters by calling the respective setters at will, and
7462/// // execute the final call using `doit()`.
7463/// // Values shown here are possibly random and not representative !
7464/// let result = hub.projects().locations_entry_groups_entries_tags_reconcile(req, "parent")
7465/// .doit().await;
7466/// # }
7467/// ```
7468pub struct ProjectLocationEntryGroupEntryTagReconcileCall<'a, C>
7469where
7470 C: 'a,
7471{
7472 hub: &'a DataCatalog<C>,
7473 _request: GoogleCloudDatacatalogV1ReconcileTagsRequest,
7474 _parent: String,
7475 _delegate: Option<&'a mut dyn common::Delegate>,
7476 _additional_params: HashMap<String, String>,
7477 _scopes: BTreeSet<String>,
7478}
7479
7480impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagReconcileCall<'a, C> {}
7481
7482impl<'a, C> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C>
7483where
7484 C: common::Connector,
7485{
7486 /// Perform the operation you have build so far.
7487 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7488 use std::borrow::Cow;
7489 use std::io::{Read, Seek};
7490
7491 use common::{url::Params, ToParts};
7492 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7493
7494 let mut dd = common::DefaultDelegate;
7495 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7496 dlg.begin(common::MethodInfo {
7497 id: "datacatalog.projects.locations.entryGroups.entries.tags.reconcile",
7498 http_method: hyper::Method::POST,
7499 });
7500
7501 for &field in ["alt", "parent"].iter() {
7502 if self._additional_params.contains_key(field) {
7503 dlg.finished(false);
7504 return Err(common::Error::FieldClash(field));
7505 }
7506 }
7507
7508 let mut params = Params::with_capacity(4 + self._additional_params.len());
7509 params.push("parent", self._parent);
7510
7511 params.extend(self._additional_params.iter());
7512
7513 params.push("alt", "json");
7514 let mut url = self.hub._base_url.clone() + "v1/{+parent}/tags:reconcile";
7515 if self._scopes.is_empty() {
7516 self._scopes
7517 .insert(Scope::CloudPlatform.as_ref().to_string());
7518 }
7519
7520 #[allow(clippy::single_element_loop)]
7521 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7522 url = params.uri_replacement(url, param_name, find_this, true);
7523 }
7524 {
7525 let to_remove = ["parent"];
7526 params.remove_params(&to_remove);
7527 }
7528
7529 let url = params.parse_with_url(&url);
7530
7531 let mut json_mime_type = mime::APPLICATION_JSON;
7532 let mut request_value_reader = {
7533 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7534 common::remove_json_null_values(&mut value);
7535 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7536 serde_json::to_writer(&mut dst, &value).unwrap();
7537 dst
7538 };
7539 let request_size = request_value_reader
7540 .seek(std::io::SeekFrom::End(0))
7541 .unwrap();
7542 request_value_reader
7543 .seek(std::io::SeekFrom::Start(0))
7544 .unwrap();
7545
7546 loop {
7547 let token = match self
7548 .hub
7549 .auth
7550 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7551 .await
7552 {
7553 Ok(token) => token,
7554 Err(e) => match dlg.token(e) {
7555 Ok(token) => token,
7556 Err(e) => {
7557 dlg.finished(false);
7558 return Err(common::Error::MissingToken(e));
7559 }
7560 },
7561 };
7562 request_value_reader
7563 .seek(std::io::SeekFrom::Start(0))
7564 .unwrap();
7565 let mut req_result = {
7566 let client = &self.hub.client;
7567 dlg.pre_request();
7568 let mut req_builder = hyper::Request::builder()
7569 .method(hyper::Method::POST)
7570 .uri(url.as_str())
7571 .header(USER_AGENT, self.hub._user_agent.clone());
7572
7573 if let Some(token) = token.as_ref() {
7574 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7575 }
7576
7577 let request = req_builder
7578 .header(CONTENT_TYPE, json_mime_type.to_string())
7579 .header(CONTENT_LENGTH, request_size as u64)
7580 .body(common::to_body(
7581 request_value_reader.get_ref().clone().into(),
7582 ));
7583
7584 client.request(request.unwrap()).await
7585 };
7586
7587 match req_result {
7588 Err(err) => {
7589 if let common::Retry::After(d) = dlg.http_error(&err) {
7590 sleep(d).await;
7591 continue;
7592 }
7593 dlg.finished(false);
7594 return Err(common::Error::HttpError(err));
7595 }
7596 Ok(res) => {
7597 let (mut parts, body) = res.into_parts();
7598 let mut body = common::Body::new(body);
7599 if !parts.status.is_success() {
7600 let bytes = common::to_bytes(body).await.unwrap_or_default();
7601 let error = serde_json::from_str(&common::to_string(&bytes));
7602 let response = common::to_response(parts, bytes.into());
7603
7604 if let common::Retry::After(d) =
7605 dlg.http_failure(&response, error.as_ref().ok())
7606 {
7607 sleep(d).await;
7608 continue;
7609 }
7610
7611 dlg.finished(false);
7612
7613 return Err(match error {
7614 Ok(value) => common::Error::BadRequest(value),
7615 _ => common::Error::Failure(response),
7616 });
7617 }
7618 let response = {
7619 let bytes = common::to_bytes(body).await.unwrap_or_default();
7620 let encoded = common::to_string(&bytes);
7621 match serde_json::from_str(&encoded) {
7622 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7623 Err(error) => {
7624 dlg.response_json_decode_error(&encoded, &error);
7625 return Err(common::Error::JsonDecodeError(
7626 encoded.to_string(),
7627 error,
7628 ));
7629 }
7630 }
7631 };
7632
7633 dlg.finished(true);
7634 return Ok(response);
7635 }
7636 }
7637 }
7638 }
7639
7640 ///
7641 /// Sets the *request* property to the given value.
7642 ///
7643 /// Even though the property as already been set when instantiating this call,
7644 /// we provide this method for API completeness.
7645 pub fn request(
7646 mut self,
7647 new_value: GoogleCloudDatacatalogV1ReconcileTagsRequest,
7648 ) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C> {
7649 self._request = new_value;
7650 self
7651 }
7652 /// Required. Name of Entry to be tagged.
7653 ///
7654 /// Sets the *parent* path property to the given value.
7655 ///
7656 /// Even though the property as already been set when instantiating this call,
7657 /// we provide this method for API completeness.
7658 pub fn parent(
7659 mut self,
7660 new_value: &str,
7661 ) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C> {
7662 self._parent = new_value.to_string();
7663 self
7664 }
7665 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7666 /// while executing the actual API request.
7667 ///
7668 /// ````text
7669 /// It should be used to handle progress information, and to implement a certain level of resilience.
7670 /// ````
7671 ///
7672 /// Sets the *delegate* property to the given value.
7673 pub fn delegate(
7674 mut self,
7675 new_value: &'a mut dyn common::Delegate,
7676 ) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C> {
7677 self._delegate = Some(new_value);
7678 self
7679 }
7680
7681 /// Set any additional parameter of the query string used in the request.
7682 /// It should be used to set parameters which are not yet available through their own
7683 /// setters.
7684 ///
7685 /// Please note that this method must not be used to set any of the known parameters
7686 /// which have their own setter method. If done anyway, the request will fail.
7687 ///
7688 /// # Additional Parameters
7689 ///
7690 /// * *$.xgafv* (query-string) - V1 error format.
7691 /// * *access_token* (query-string) - OAuth access token.
7692 /// * *alt* (query-string) - Data format for response.
7693 /// * *callback* (query-string) - JSONP
7694 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7695 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7696 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7697 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7698 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7699 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7700 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7701 pub fn param<T>(
7702 mut self,
7703 name: T,
7704 value: T,
7705 ) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C>
7706 where
7707 T: AsRef<str>,
7708 {
7709 self._additional_params
7710 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7711 self
7712 }
7713
7714 /// Identifies the authorization scope for the method you are building.
7715 ///
7716 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7717 /// [`Scope::CloudPlatform`].
7718 ///
7719 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7720 /// tokens for more than one scope.
7721 ///
7722 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7723 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7724 /// sufficient, a read-write scope will do as well.
7725 pub fn add_scope<St>(
7726 mut self,
7727 scope: St,
7728 ) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C>
7729 where
7730 St: AsRef<str>,
7731 {
7732 self._scopes.insert(String::from(scope.as_ref()));
7733 self
7734 }
7735 /// Identifies the authorization scope(s) for the method you are building.
7736 ///
7737 /// See [`Self::add_scope()`] for details.
7738 pub fn add_scopes<I, St>(
7739 mut self,
7740 scopes: I,
7741 ) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C>
7742 where
7743 I: IntoIterator<Item = St>,
7744 St: AsRef<str>,
7745 {
7746 self._scopes
7747 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7748 self
7749 }
7750
7751 /// Removes all scopes, and no default scope will be used either.
7752 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7753 /// for details).
7754 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagReconcileCall<'a, C> {
7755 self._scopes.clear();
7756 self
7757 }
7758}
7759
7760/// Creates an entry. You can create entries only with 'FILESET', 'CLUSTER', 'DATA_STREAM', or custom types. Data Catalog automatically creates entries with other types during metadata ingestion from integrated systems. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project). An entry group can have a maximum of 100,000 entries.
7761///
7762/// A builder for the *locations.entryGroups.entries.create* method supported by a *project* resource.
7763/// It is not used directly, but through a [`ProjectMethods`] instance.
7764///
7765/// # Example
7766///
7767/// Instantiate a resource method builder
7768///
7769/// ```test_harness,no_run
7770/// # extern crate hyper;
7771/// # extern crate hyper_rustls;
7772/// # extern crate google_datacatalog1 as datacatalog1;
7773/// use datacatalog1::api::GoogleCloudDatacatalogV1Entry;
7774/// # async fn dox() {
7775/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7776///
7777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7778/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7779/// # .with_native_roots()
7780/// # .unwrap()
7781/// # .https_only()
7782/// # .enable_http2()
7783/// # .build();
7784///
7785/// # let executor = hyper_util::rt::TokioExecutor::new();
7786/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7787/// # secret,
7788/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7789/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7790/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7791/// # ),
7792/// # ).build().await.unwrap();
7793///
7794/// # let client = hyper_util::client::legacy::Client::builder(
7795/// # hyper_util::rt::TokioExecutor::new()
7796/// # )
7797/// # .build(
7798/// # hyper_rustls::HttpsConnectorBuilder::new()
7799/// # .with_native_roots()
7800/// # .unwrap()
7801/// # .https_or_http()
7802/// # .enable_http2()
7803/// # .build()
7804/// # );
7805/// # let mut hub = DataCatalog::new(client, auth);
7806/// // As the method needs a request, you would usually fill it with the desired information
7807/// // into the respective structure. Some of the parts shown here might not be applicable !
7808/// // Values shown here are possibly random and not representative !
7809/// let mut req = GoogleCloudDatacatalogV1Entry::default();
7810///
7811/// // You can configure optional parameters by calling the respective setters at will, and
7812/// // execute the final call using `doit()`.
7813/// // Values shown here are possibly random and not representative !
7814/// let result = hub.projects().locations_entry_groups_entries_create(req, "parent")
7815/// .entry_id("gubergren")
7816/// .doit().await;
7817/// # }
7818/// ```
7819pub struct ProjectLocationEntryGroupEntryCreateCall<'a, C>
7820where
7821 C: 'a,
7822{
7823 hub: &'a DataCatalog<C>,
7824 _request: GoogleCloudDatacatalogV1Entry,
7825 _parent: String,
7826 _entry_id: Option<String>,
7827 _delegate: Option<&'a mut dyn common::Delegate>,
7828 _additional_params: HashMap<String, String>,
7829 _scopes: BTreeSet<String>,
7830}
7831
7832impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryCreateCall<'a, C> {}
7833
7834impl<'a, C> ProjectLocationEntryGroupEntryCreateCall<'a, C>
7835where
7836 C: common::Connector,
7837{
7838 /// Perform the operation you have build so far.
7839 pub async fn doit(
7840 mut self,
7841 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Entry)> {
7842 use std::borrow::Cow;
7843 use std::io::{Read, Seek};
7844
7845 use common::{url::Params, ToParts};
7846 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7847
7848 let mut dd = common::DefaultDelegate;
7849 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7850 dlg.begin(common::MethodInfo {
7851 id: "datacatalog.projects.locations.entryGroups.entries.create",
7852 http_method: hyper::Method::POST,
7853 });
7854
7855 for &field in ["alt", "parent", "entryId"].iter() {
7856 if self._additional_params.contains_key(field) {
7857 dlg.finished(false);
7858 return Err(common::Error::FieldClash(field));
7859 }
7860 }
7861
7862 let mut params = Params::with_capacity(5 + self._additional_params.len());
7863 params.push("parent", self._parent);
7864 if let Some(value) = self._entry_id.as_ref() {
7865 params.push("entryId", value);
7866 }
7867
7868 params.extend(self._additional_params.iter());
7869
7870 params.push("alt", "json");
7871 let mut url = self.hub._base_url.clone() + "v1/{+parent}/entries";
7872 if self._scopes.is_empty() {
7873 self._scopes
7874 .insert(Scope::CloudPlatform.as_ref().to_string());
7875 }
7876
7877 #[allow(clippy::single_element_loop)]
7878 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7879 url = params.uri_replacement(url, param_name, find_this, true);
7880 }
7881 {
7882 let to_remove = ["parent"];
7883 params.remove_params(&to_remove);
7884 }
7885
7886 let url = params.parse_with_url(&url);
7887
7888 let mut json_mime_type = mime::APPLICATION_JSON;
7889 let mut request_value_reader = {
7890 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7891 common::remove_json_null_values(&mut value);
7892 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7893 serde_json::to_writer(&mut dst, &value).unwrap();
7894 dst
7895 };
7896 let request_size = request_value_reader
7897 .seek(std::io::SeekFrom::End(0))
7898 .unwrap();
7899 request_value_reader
7900 .seek(std::io::SeekFrom::Start(0))
7901 .unwrap();
7902
7903 loop {
7904 let token = match self
7905 .hub
7906 .auth
7907 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7908 .await
7909 {
7910 Ok(token) => token,
7911 Err(e) => match dlg.token(e) {
7912 Ok(token) => token,
7913 Err(e) => {
7914 dlg.finished(false);
7915 return Err(common::Error::MissingToken(e));
7916 }
7917 },
7918 };
7919 request_value_reader
7920 .seek(std::io::SeekFrom::Start(0))
7921 .unwrap();
7922 let mut req_result = {
7923 let client = &self.hub.client;
7924 dlg.pre_request();
7925 let mut req_builder = hyper::Request::builder()
7926 .method(hyper::Method::POST)
7927 .uri(url.as_str())
7928 .header(USER_AGENT, self.hub._user_agent.clone());
7929
7930 if let Some(token) = token.as_ref() {
7931 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7932 }
7933
7934 let request = req_builder
7935 .header(CONTENT_TYPE, json_mime_type.to_string())
7936 .header(CONTENT_LENGTH, request_size as u64)
7937 .body(common::to_body(
7938 request_value_reader.get_ref().clone().into(),
7939 ));
7940
7941 client.request(request.unwrap()).await
7942 };
7943
7944 match req_result {
7945 Err(err) => {
7946 if let common::Retry::After(d) = dlg.http_error(&err) {
7947 sleep(d).await;
7948 continue;
7949 }
7950 dlg.finished(false);
7951 return Err(common::Error::HttpError(err));
7952 }
7953 Ok(res) => {
7954 let (mut parts, body) = res.into_parts();
7955 let mut body = common::Body::new(body);
7956 if !parts.status.is_success() {
7957 let bytes = common::to_bytes(body).await.unwrap_or_default();
7958 let error = serde_json::from_str(&common::to_string(&bytes));
7959 let response = common::to_response(parts, bytes.into());
7960
7961 if let common::Retry::After(d) =
7962 dlg.http_failure(&response, error.as_ref().ok())
7963 {
7964 sleep(d).await;
7965 continue;
7966 }
7967
7968 dlg.finished(false);
7969
7970 return Err(match error {
7971 Ok(value) => common::Error::BadRequest(value),
7972 _ => common::Error::Failure(response),
7973 });
7974 }
7975 let response = {
7976 let bytes = common::to_bytes(body).await.unwrap_or_default();
7977 let encoded = common::to_string(&bytes);
7978 match serde_json::from_str(&encoded) {
7979 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7980 Err(error) => {
7981 dlg.response_json_decode_error(&encoded, &error);
7982 return Err(common::Error::JsonDecodeError(
7983 encoded.to_string(),
7984 error,
7985 ));
7986 }
7987 }
7988 };
7989
7990 dlg.finished(true);
7991 return Ok(response);
7992 }
7993 }
7994 }
7995 }
7996
7997 ///
7998 /// Sets the *request* property to the given value.
7999 ///
8000 /// Even though the property as already been set when instantiating this call,
8001 /// we provide this method for API completeness.
8002 pub fn request(
8003 mut self,
8004 new_value: GoogleCloudDatacatalogV1Entry,
8005 ) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
8006 self._request = new_value;
8007 self
8008 }
8009 /// Required. The name of the entry group this entry belongs to. Note: The entry itself and its child resources might not be stored in the location specified in its name.
8010 ///
8011 /// Sets the *parent* path property to the given value.
8012 ///
8013 /// Even though the property as already been set when instantiating this call,
8014 /// we provide this method for API completeness.
8015 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
8016 self._parent = new_value.to_string();
8017 self
8018 }
8019 /// Required. The ID of the entry to create. The ID must contain only letters (a-z, A-Z), numbers (0-9), and underscores (_). The maximum size is 64 bytes when encoded in UTF-8.
8020 ///
8021 /// Sets the *entry id* query property to the given value.
8022 pub fn entry_id(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
8023 self._entry_id = Some(new_value.to_string());
8024 self
8025 }
8026 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8027 /// while executing the actual API request.
8028 ///
8029 /// ````text
8030 /// It should be used to handle progress information, and to implement a certain level of resilience.
8031 /// ````
8032 ///
8033 /// Sets the *delegate* property to the given value.
8034 pub fn delegate(
8035 mut self,
8036 new_value: &'a mut dyn common::Delegate,
8037 ) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
8038 self._delegate = Some(new_value);
8039 self
8040 }
8041
8042 /// Set any additional parameter of the query string used in the request.
8043 /// It should be used to set parameters which are not yet available through their own
8044 /// setters.
8045 ///
8046 /// Please note that this method must not be used to set any of the known parameters
8047 /// which have their own setter method. If done anyway, the request will fail.
8048 ///
8049 /// # Additional Parameters
8050 ///
8051 /// * *$.xgafv* (query-string) - V1 error format.
8052 /// * *access_token* (query-string) - OAuth access token.
8053 /// * *alt* (query-string) - Data format for response.
8054 /// * *callback* (query-string) - JSONP
8055 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8056 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8057 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8058 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8059 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8060 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8061 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8062 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryCreateCall<'a, C>
8063 where
8064 T: AsRef<str>,
8065 {
8066 self._additional_params
8067 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8068 self
8069 }
8070
8071 /// Identifies the authorization scope for the method you are building.
8072 ///
8073 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8074 /// [`Scope::CloudPlatform`].
8075 ///
8076 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8077 /// tokens for more than one scope.
8078 ///
8079 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8080 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8081 /// sufficient, a read-write scope will do as well.
8082 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryCreateCall<'a, C>
8083 where
8084 St: AsRef<str>,
8085 {
8086 self._scopes.insert(String::from(scope.as_ref()));
8087 self
8088 }
8089 /// Identifies the authorization scope(s) for the method you are building.
8090 ///
8091 /// See [`Self::add_scope()`] for details.
8092 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryCreateCall<'a, C>
8093 where
8094 I: IntoIterator<Item = St>,
8095 St: AsRef<str>,
8096 {
8097 self._scopes
8098 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8099 self
8100 }
8101
8102 /// Removes all scopes, and no default scope will be used either.
8103 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8104 /// for details).
8105 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
8106 self._scopes.clear();
8107 self
8108 }
8109}
8110
8111/// Deletes an existing entry. You can delete only the entries created by the CreateEntry method. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
8112///
8113/// A builder for the *locations.entryGroups.entries.delete* method supported by a *project* resource.
8114/// It is not used directly, but through a [`ProjectMethods`] instance.
8115///
8116/// # Example
8117///
8118/// Instantiate a resource method builder
8119///
8120/// ```test_harness,no_run
8121/// # extern crate hyper;
8122/// # extern crate hyper_rustls;
8123/// # extern crate google_datacatalog1 as datacatalog1;
8124/// # async fn dox() {
8125/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8126///
8127/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8128/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8129/// # .with_native_roots()
8130/// # .unwrap()
8131/// # .https_only()
8132/// # .enable_http2()
8133/// # .build();
8134///
8135/// # let executor = hyper_util::rt::TokioExecutor::new();
8136/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8137/// # secret,
8138/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8139/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8140/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8141/// # ),
8142/// # ).build().await.unwrap();
8143///
8144/// # let client = hyper_util::client::legacy::Client::builder(
8145/// # hyper_util::rt::TokioExecutor::new()
8146/// # )
8147/// # .build(
8148/// # hyper_rustls::HttpsConnectorBuilder::new()
8149/// # .with_native_roots()
8150/// # .unwrap()
8151/// # .https_or_http()
8152/// # .enable_http2()
8153/// # .build()
8154/// # );
8155/// # let mut hub = DataCatalog::new(client, auth);
8156/// // You can configure optional parameters by calling the respective setters at will, and
8157/// // execute the final call using `doit()`.
8158/// // Values shown here are possibly random and not representative !
8159/// let result = hub.projects().locations_entry_groups_entries_delete("name")
8160/// .doit().await;
8161/// # }
8162/// ```
8163pub struct ProjectLocationEntryGroupEntryDeleteCall<'a, C>
8164where
8165 C: 'a,
8166{
8167 hub: &'a DataCatalog<C>,
8168 _name: String,
8169 _delegate: Option<&'a mut dyn common::Delegate>,
8170 _additional_params: HashMap<String, String>,
8171 _scopes: BTreeSet<String>,
8172}
8173
8174impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryDeleteCall<'a, C> {}
8175
8176impl<'a, C> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
8177where
8178 C: common::Connector,
8179{
8180 /// Perform the operation you have build so far.
8181 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8182 use std::borrow::Cow;
8183 use std::io::{Read, Seek};
8184
8185 use common::{url::Params, ToParts};
8186 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8187
8188 let mut dd = common::DefaultDelegate;
8189 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8190 dlg.begin(common::MethodInfo {
8191 id: "datacatalog.projects.locations.entryGroups.entries.delete",
8192 http_method: hyper::Method::DELETE,
8193 });
8194
8195 for &field in ["alt", "name"].iter() {
8196 if self._additional_params.contains_key(field) {
8197 dlg.finished(false);
8198 return Err(common::Error::FieldClash(field));
8199 }
8200 }
8201
8202 let mut params = Params::with_capacity(3 + self._additional_params.len());
8203 params.push("name", self._name);
8204
8205 params.extend(self._additional_params.iter());
8206
8207 params.push("alt", "json");
8208 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8209 if self._scopes.is_empty() {
8210 self._scopes
8211 .insert(Scope::CloudPlatform.as_ref().to_string());
8212 }
8213
8214 #[allow(clippy::single_element_loop)]
8215 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8216 url = params.uri_replacement(url, param_name, find_this, true);
8217 }
8218 {
8219 let to_remove = ["name"];
8220 params.remove_params(&to_remove);
8221 }
8222
8223 let url = params.parse_with_url(&url);
8224
8225 loop {
8226 let token = match self
8227 .hub
8228 .auth
8229 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8230 .await
8231 {
8232 Ok(token) => token,
8233 Err(e) => match dlg.token(e) {
8234 Ok(token) => token,
8235 Err(e) => {
8236 dlg.finished(false);
8237 return Err(common::Error::MissingToken(e));
8238 }
8239 },
8240 };
8241 let mut req_result = {
8242 let client = &self.hub.client;
8243 dlg.pre_request();
8244 let mut req_builder = hyper::Request::builder()
8245 .method(hyper::Method::DELETE)
8246 .uri(url.as_str())
8247 .header(USER_AGENT, self.hub._user_agent.clone());
8248
8249 if let Some(token) = token.as_ref() {
8250 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8251 }
8252
8253 let request = req_builder
8254 .header(CONTENT_LENGTH, 0_u64)
8255 .body(common::to_body::<String>(None));
8256
8257 client.request(request.unwrap()).await
8258 };
8259
8260 match req_result {
8261 Err(err) => {
8262 if let common::Retry::After(d) = dlg.http_error(&err) {
8263 sleep(d).await;
8264 continue;
8265 }
8266 dlg.finished(false);
8267 return Err(common::Error::HttpError(err));
8268 }
8269 Ok(res) => {
8270 let (mut parts, body) = res.into_parts();
8271 let mut body = common::Body::new(body);
8272 if !parts.status.is_success() {
8273 let bytes = common::to_bytes(body).await.unwrap_or_default();
8274 let error = serde_json::from_str(&common::to_string(&bytes));
8275 let response = common::to_response(parts, bytes.into());
8276
8277 if let common::Retry::After(d) =
8278 dlg.http_failure(&response, error.as_ref().ok())
8279 {
8280 sleep(d).await;
8281 continue;
8282 }
8283
8284 dlg.finished(false);
8285
8286 return Err(match error {
8287 Ok(value) => common::Error::BadRequest(value),
8288 _ => common::Error::Failure(response),
8289 });
8290 }
8291 let response = {
8292 let bytes = common::to_bytes(body).await.unwrap_or_default();
8293 let encoded = common::to_string(&bytes);
8294 match serde_json::from_str(&encoded) {
8295 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8296 Err(error) => {
8297 dlg.response_json_decode_error(&encoded, &error);
8298 return Err(common::Error::JsonDecodeError(
8299 encoded.to_string(),
8300 error,
8301 ));
8302 }
8303 }
8304 };
8305
8306 dlg.finished(true);
8307 return Ok(response);
8308 }
8309 }
8310 }
8311 }
8312
8313 /// Required. The name of the entry to delete.
8314 ///
8315 /// Sets the *name* path property to the given value.
8316 ///
8317 /// Even though the property as already been set when instantiating this call,
8318 /// we provide this method for API completeness.
8319 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
8320 self._name = new_value.to_string();
8321 self
8322 }
8323 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8324 /// while executing the actual API request.
8325 ///
8326 /// ````text
8327 /// It should be used to handle progress information, and to implement a certain level of resilience.
8328 /// ````
8329 ///
8330 /// Sets the *delegate* property to the given value.
8331 pub fn delegate(
8332 mut self,
8333 new_value: &'a mut dyn common::Delegate,
8334 ) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
8335 self._delegate = Some(new_value);
8336 self
8337 }
8338
8339 /// Set any additional parameter of the query string used in the request.
8340 /// It should be used to set parameters which are not yet available through their own
8341 /// setters.
8342 ///
8343 /// Please note that this method must not be used to set any of the known parameters
8344 /// which have their own setter method. If done anyway, the request will fail.
8345 ///
8346 /// # Additional Parameters
8347 ///
8348 /// * *$.xgafv* (query-string) - V1 error format.
8349 /// * *access_token* (query-string) - OAuth access token.
8350 /// * *alt* (query-string) - Data format for response.
8351 /// * *callback* (query-string) - JSONP
8352 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8353 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8354 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8355 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8356 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8357 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8358 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8359 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
8360 where
8361 T: AsRef<str>,
8362 {
8363 self._additional_params
8364 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8365 self
8366 }
8367
8368 /// Identifies the authorization scope for the method you are building.
8369 ///
8370 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8371 /// [`Scope::CloudPlatform`].
8372 ///
8373 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8374 /// tokens for more than one scope.
8375 ///
8376 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8377 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8378 /// sufficient, a read-write scope will do as well.
8379 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
8380 where
8381 St: AsRef<str>,
8382 {
8383 self._scopes.insert(String::from(scope.as_ref()));
8384 self
8385 }
8386 /// Identifies the authorization scope(s) for the method you are building.
8387 ///
8388 /// See [`Self::add_scope()`] for details.
8389 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
8390 where
8391 I: IntoIterator<Item = St>,
8392 St: AsRef<str>,
8393 {
8394 self._scopes
8395 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8396 self
8397 }
8398
8399 /// Removes all scopes, and no default scope will be used either.
8400 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8401 /// for details).
8402 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
8403 self._scopes.clear();
8404 self
8405 }
8406}
8407
8408/// Gets an entry.
8409///
8410/// A builder for the *locations.entryGroups.entries.get* method supported by a *project* resource.
8411/// It is not used directly, but through a [`ProjectMethods`] instance.
8412///
8413/// # Example
8414///
8415/// Instantiate a resource method builder
8416///
8417/// ```test_harness,no_run
8418/// # extern crate hyper;
8419/// # extern crate hyper_rustls;
8420/// # extern crate google_datacatalog1 as datacatalog1;
8421/// # async fn dox() {
8422/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8423///
8424/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8425/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8426/// # .with_native_roots()
8427/// # .unwrap()
8428/// # .https_only()
8429/// # .enable_http2()
8430/// # .build();
8431///
8432/// # let executor = hyper_util::rt::TokioExecutor::new();
8433/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8434/// # secret,
8435/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8436/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8437/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8438/// # ),
8439/// # ).build().await.unwrap();
8440///
8441/// # let client = hyper_util::client::legacy::Client::builder(
8442/// # hyper_util::rt::TokioExecutor::new()
8443/// # )
8444/// # .build(
8445/// # hyper_rustls::HttpsConnectorBuilder::new()
8446/// # .with_native_roots()
8447/// # .unwrap()
8448/// # .https_or_http()
8449/// # .enable_http2()
8450/// # .build()
8451/// # );
8452/// # let mut hub = DataCatalog::new(client, auth);
8453/// // You can configure optional parameters by calling the respective setters at will, and
8454/// // execute the final call using `doit()`.
8455/// // Values shown here are possibly random and not representative !
8456/// let result = hub.projects().locations_entry_groups_entries_get("name")
8457/// .doit().await;
8458/// # }
8459/// ```
8460pub struct ProjectLocationEntryGroupEntryGetCall<'a, C>
8461where
8462 C: 'a,
8463{
8464 hub: &'a DataCatalog<C>,
8465 _name: String,
8466 _delegate: Option<&'a mut dyn common::Delegate>,
8467 _additional_params: HashMap<String, String>,
8468 _scopes: BTreeSet<String>,
8469}
8470
8471impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryGetCall<'a, C> {}
8472
8473impl<'a, C> ProjectLocationEntryGroupEntryGetCall<'a, C>
8474where
8475 C: common::Connector,
8476{
8477 /// Perform the operation you have build so far.
8478 pub async fn doit(
8479 mut self,
8480 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Entry)> {
8481 use std::borrow::Cow;
8482 use std::io::{Read, Seek};
8483
8484 use common::{url::Params, ToParts};
8485 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8486
8487 let mut dd = common::DefaultDelegate;
8488 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8489 dlg.begin(common::MethodInfo {
8490 id: "datacatalog.projects.locations.entryGroups.entries.get",
8491 http_method: hyper::Method::GET,
8492 });
8493
8494 for &field in ["alt", "name"].iter() {
8495 if self._additional_params.contains_key(field) {
8496 dlg.finished(false);
8497 return Err(common::Error::FieldClash(field));
8498 }
8499 }
8500
8501 let mut params = Params::with_capacity(3 + self._additional_params.len());
8502 params.push("name", self._name);
8503
8504 params.extend(self._additional_params.iter());
8505
8506 params.push("alt", "json");
8507 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8508 if self._scopes.is_empty() {
8509 self._scopes
8510 .insert(Scope::CloudPlatform.as_ref().to_string());
8511 }
8512
8513 #[allow(clippy::single_element_loop)]
8514 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8515 url = params.uri_replacement(url, param_name, find_this, true);
8516 }
8517 {
8518 let to_remove = ["name"];
8519 params.remove_params(&to_remove);
8520 }
8521
8522 let url = params.parse_with_url(&url);
8523
8524 loop {
8525 let token = match self
8526 .hub
8527 .auth
8528 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8529 .await
8530 {
8531 Ok(token) => token,
8532 Err(e) => match dlg.token(e) {
8533 Ok(token) => token,
8534 Err(e) => {
8535 dlg.finished(false);
8536 return Err(common::Error::MissingToken(e));
8537 }
8538 },
8539 };
8540 let mut req_result = {
8541 let client = &self.hub.client;
8542 dlg.pre_request();
8543 let mut req_builder = hyper::Request::builder()
8544 .method(hyper::Method::GET)
8545 .uri(url.as_str())
8546 .header(USER_AGENT, self.hub._user_agent.clone());
8547
8548 if let Some(token) = token.as_ref() {
8549 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8550 }
8551
8552 let request = req_builder
8553 .header(CONTENT_LENGTH, 0_u64)
8554 .body(common::to_body::<String>(None));
8555
8556 client.request(request.unwrap()).await
8557 };
8558
8559 match req_result {
8560 Err(err) => {
8561 if let common::Retry::After(d) = dlg.http_error(&err) {
8562 sleep(d).await;
8563 continue;
8564 }
8565 dlg.finished(false);
8566 return Err(common::Error::HttpError(err));
8567 }
8568 Ok(res) => {
8569 let (mut parts, body) = res.into_parts();
8570 let mut body = common::Body::new(body);
8571 if !parts.status.is_success() {
8572 let bytes = common::to_bytes(body).await.unwrap_or_default();
8573 let error = serde_json::from_str(&common::to_string(&bytes));
8574 let response = common::to_response(parts, bytes.into());
8575
8576 if let common::Retry::After(d) =
8577 dlg.http_failure(&response, error.as_ref().ok())
8578 {
8579 sleep(d).await;
8580 continue;
8581 }
8582
8583 dlg.finished(false);
8584
8585 return Err(match error {
8586 Ok(value) => common::Error::BadRequest(value),
8587 _ => common::Error::Failure(response),
8588 });
8589 }
8590 let response = {
8591 let bytes = common::to_bytes(body).await.unwrap_or_default();
8592 let encoded = common::to_string(&bytes);
8593 match serde_json::from_str(&encoded) {
8594 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8595 Err(error) => {
8596 dlg.response_json_decode_error(&encoded, &error);
8597 return Err(common::Error::JsonDecodeError(
8598 encoded.to_string(),
8599 error,
8600 ));
8601 }
8602 }
8603 };
8604
8605 dlg.finished(true);
8606 return Ok(response);
8607 }
8608 }
8609 }
8610 }
8611
8612 /// Required. The name of the entry to get.
8613 ///
8614 /// Sets the *name* path property to the given value.
8615 ///
8616 /// Even though the property as already been set when instantiating this call,
8617 /// we provide this method for API completeness.
8618 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
8619 self._name = new_value.to_string();
8620 self
8621 }
8622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8623 /// while executing the actual API request.
8624 ///
8625 /// ````text
8626 /// It should be used to handle progress information, and to implement a certain level of resilience.
8627 /// ````
8628 ///
8629 /// Sets the *delegate* property to the given value.
8630 pub fn delegate(
8631 mut self,
8632 new_value: &'a mut dyn common::Delegate,
8633 ) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
8634 self._delegate = Some(new_value);
8635 self
8636 }
8637
8638 /// Set any additional parameter of the query string used in the request.
8639 /// It should be used to set parameters which are not yet available through their own
8640 /// setters.
8641 ///
8642 /// Please note that this method must not be used to set any of the known parameters
8643 /// which have their own setter method. If done anyway, the request will fail.
8644 ///
8645 /// # Additional Parameters
8646 ///
8647 /// * *$.xgafv* (query-string) - V1 error format.
8648 /// * *access_token* (query-string) - OAuth access token.
8649 /// * *alt* (query-string) - Data format for response.
8650 /// * *callback* (query-string) - JSONP
8651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8652 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8655 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8658 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryGetCall<'a, C>
8659 where
8660 T: AsRef<str>,
8661 {
8662 self._additional_params
8663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8664 self
8665 }
8666
8667 /// Identifies the authorization scope for the method you are building.
8668 ///
8669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8670 /// [`Scope::CloudPlatform`].
8671 ///
8672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8673 /// tokens for more than one scope.
8674 ///
8675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8677 /// sufficient, a read-write scope will do as well.
8678 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryGetCall<'a, C>
8679 where
8680 St: AsRef<str>,
8681 {
8682 self._scopes.insert(String::from(scope.as_ref()));
8683 self
8684 }
8685 /// Identifies the authorization scope(s) for the method you are building.
8686 ///
8687 /// See [`Self::add_scope()`] for details.
8688 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryGetCall<'a, C>
8689 where
8690 I: IntoIterator<Item = St>,
8691 St: AsRef<str>,
8692 {
8693 self._scopes
8694 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8695 self
8696 }
8697
8698 /// Removes all scopes, and no default scope will be used either.
8699 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8700 /// for details).
8701 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
8702 self._scopes.clear();
8703 self
8704 }
8705}
8706
8707/// Gets the access control policy for a resource. May return: * A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it. * An empty policy if the resource exists but doesn't have a set policy. Supported resources are: - Tag templates - Entry groups Note: This method doesn't get policies from Google Cloud Platform resources ingested into Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
8708///
8709/// A builder for the *locations.entryGroups.entries.getIamPolicy* method supported by a *project* resource.
8710/// It is not used directly, but through a [`ProjectMethods`] instance.
8711///
8712/// # Example
8713///
8714/// Instantiate a resource method builder
8715///
8716/// ```test_harness,no_run
8717/// # extern crate hyper;
8718/// # extern crate hyper_rustls;
8719/// # extern crate google_datacatalog1 as datacatalog1;
8720/// use datacatalog1::api::GetIamPolicyRequest;
8721/// # async fn dox() {
8722/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8723///
8724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8725/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8726/// # .with_native_roots()
8727/// # .unwrap()
8728/// # .https_only()
8729/// # .enable_http2()
8730/// # .build();
8731///
8732/// # let executor = hyper_util::rt::TokioExecutor::new();
8733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8734/// # secret,
8735/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8736/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8737/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8738/// # ),
8739/// # ).build().await.unwrap();
8740///
8741/// # let client = hyper_util::client::legacy::Client::builder(
8742/// # hyper_util::rt::TokioExecutor::new()
8743/// # )
8744/// # .build(
8745/// # hyper_rustls::HttpsConnectorBuilder::new()
8746/// # .with_native_roots()
8747/// # .unwrap()
8748/// # .https_or_http()
8749/// # .enable_http2()
8750/// # .build()
8751/// # );
8752/// # let mut hub = DataCatalog::new(client, auth);
8753/// // As the method needs a request, you would usually fill it with the desired information
8754/// // into the respective structure. Some of the parts shown here might not be applicable !
8755/// // Values shown here are possibly random and not representative !
8756/// let mut req = GetIamPolicyRequest::default();
8757///
8758/// // You can configure optional parameters by calling the respective setters at will, and
8759/// // execute the final call using `doit()`.
8760/// // Values shown here are possibly random and not representative !
8761/// let result = hub.projects().locations_entry_groups_entries_get_iam_policy(req, "resource")
8762/// .doit().await;
8763/// # }
8764/// ```
8765pub struct ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
8766where
8767 C: 'a,
8768{
8769 hub: &'a DataCatalog<C>,
8770 _request: GetIamPolicyRequest,
8771 _resource: String,
8772 _delegate: Option<&'a mut dyn common::Delegate>,
8773 _additional_params: HashMap<String, String>,
8774 _scopes: BTreeSet<String>,
8775}
8776
8777impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {}
8778
8779impl<'a, C> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
8780where
8781 C: common::Connector,
8782{
8783 /// Perform the operation you have build so far.
8784 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
8785 use std::borrow::Cow;
8786 use std::io::{Read, Seek};
8787
8788 use common::{url::Params, ToParts};
8789 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8790
8791 let mut dd = common::DefaultDelegate;
8792 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8793 dlg.begin(common::MethodInfo {
8794 id: "datacatalog.projects.locations.entryGroups.entries.getIamPolicy",
8795 http_method: hyper::Method::POST,
8796 });
8797
8798 for &field in ["alt", "resource"].iter() {
8799 if self._additional_params.contains_key(field) {
8800 dlg.finished(false);
8801 return Err(common::Error::FieldClash(field));
8802 }
8803 }
8804
8805 let mut params = Params::with_capacity(4 + self._additional_params.len());
8806 params.push("resource", self._resource);
8807
8808 params.extend(self._additional_params.iter());
8809
8810 params.push("alt", "json");
8811 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
8812 if self._scopes.is_empty() {
8813 self._scopes
8814 .insert(Scope::CloudPlatform.as_ref().to_string());
8815 }
8816
8817 #[allow(clippy::single_element_loop)]
8818 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8819 url = params.uri_replacement(url, param_name, find_this, true);
8820 }
8821 {
8822 let to_remove = ["resource"];
8823 params.remove_params(&to_remove);
8824 }
8825
8826 let url = params.parse_with_url(&url);
8827
8828 let mut json_mime_type = mime::APPLICATION_JSON;
8829 let mut request_value_reader = {
8830 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8831 common::remove_json_null_values(&mut value);
8832 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8833 serde_json::to_writer(&mut dst, &value).unwrap();
8834 dst
8835 };
8836 let request_size = request_value_reader
8837 .seek(std::io::SeekFrom::End(0))
8838 .unwrap();
8839 request_value_reader
8840 .seek(std::io::SeekFrom::Start(0))
8841 .unwrap();
8842
8843 loop {
8844 let token = match self
8845 .hub
8846 .auth
8847 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8848 .await
8849 {
8850 Ok(token) => token,
8851 Err(e) => match dlg.token(e) {
8852 Ok(token) => token,
8853 Err(e) => {
8854 dlg.finished(false);
8855 return Err(common::Error::MissingToken(e));
8856 }
8857 },
8858 };
8859 request_value_reader
8860 .seek(std::io::SeekFrom::Start(0))
8861 .unwrap();
8862 let mut req_result = {
8863 let client = &self.hub.client;
8864 dlg.pre_request();
8865 let mut req_builder = hyper::Request::builder()
8866 .method(hyper::Method::POST)
8867 .uri(url.as_str())
8868 .header(USER_AGENT, self.hub._user_agent.clone());
8869
8870 if let Some(token) = token.as_ref() {
8871 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8872 }
8873
8874 let request = req_builder
8875 .header(CONTENT_TYPE, json_mime_type.to_string())
8876 .header(CONTENT_LENGTH, request_size as u64)
8877 .body(common::to_body(
8878 request_value_reader.get_ref().clone().into(),
8879 ));
8880
8881 client.request(request.unwrap()).await
8882 };
8883
8884 match req_result {
8885 Err(err) => {
8886 if let common::Retry::After(d) = dlg.http_error(&err) {
8887 sleep(d).await;
8888 continue;
8889 }
8890 dlg.finished(false);
8891 return Err(common::Error::HttpError(err));
8892 }
8893 Ok(res) => {
8894 let (mut parts, body) = res.into_parts();
8895 let mut body = common::Body::new(body);
8896 if !parts.status.is_success() {
8897 let bytes = common::to_bytes(body).await.unwrap_or_default();
8898 let error = serde_json::from_str(&common::to_string(&bytes));
8899 let response = common::to_response(parts, bytes.into());
8900
8901 if let common::Retry::After(d) =
8902 dlg.http_failure(&response, error.as_ref().ok())
8903 {
8904 sleep(d).await;
8905 continue;
8906 }
8907
8908 dlg.finished(false);
8909
8910 return Err(match error {
8911 Ok(value) => common::Error::BadRequest(value),
8912 _ => common::Error::Failure(response),
8913 });
8914 }
8915 let response = {
8916 let bytes = common::to_bytes(body).await.unwrap_or_default();
8917 let encoded = common::to_string(&bytes);
8918 match serde_json::from_str(&encoded) {
8919 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8920 Err(error) => {
8921 dlg.response_json_decode_error(&encoded, &error);
8922 return Err(common::Error::JsonDecodeError(
8923 encoded.to_string(),
8924 error,
8925 ));
8926 }
8927 }
8928 };
8929
8930 dlg.finished(true);
8931 return Ok(response);
8932 }
8933 }
8934 }
8935 }
8936
8937 ///
8938 /// Sets the *request* property to the given value.
8939 ///
8940 /// Even though the property as already been set when instantiating this call,
8941 /// we provide this method for API completeness.
8942 pub fn request(
8943 mut self,
8944 new_value: GetIamPolicyRequest,
8945 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
8946 self._request = new_value;
8947 self
8948 }
8949 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
8950 ///
8951 /// Sets the *resource* path property to the given value.
8952 ///
8953 /// Even though the property as already been set when instantiating this call,
8954 /// we provide this method for API completeness.
8955 pub fn resource(
8956 mut self,
8957 new_value: &str,
8958 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
8959 self._resource = new_value.to_string();
8960 self
8961 }
8962 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8963 /// while executing the actual API request.
8964 ///
8965 /// ````text
8966 /// It should be used to handle progress information, and to implement a certain level of resilience.
8967 /// ````
8968 ///
8969 /// Sets the *delegate* property to the given value.
8970 pub fn delegate(
8971 mut self,
8972 new_value: &'a mut dyn common::Delegate,
8973 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
8974 self._delegate = Some(new_value);
8975 self
8976 }
8977
8978 /// Set any additional parameter of the query string used in the request.
8979 /// It should be used to set parameters which are not yet available through their own
8980 /// setters.
8981 ///
8982 /// Please note that this method must not be used to set any of the known parameters
8983 /// which have their own setter method. If done anyway, the request will fail.
8984 ///
8985 /// # Additional Parameters
8986 ///
8987 /// * *$.xgafv* (query-string) - V1 error format.
8988 /// * *access_token* (query-string) - OAuth access token.
8989 /// * *alt* (query-string) - Data format for response.
8990 /// * *callback* (query-string) - JSONP
8991 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8992 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8993 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8994 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8995 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8996 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8997 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8998 pub fn param<T>(
8999 mut self,
9000 name: T,
9001 value: T,
9002 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
9003 where
9004 T: AsRef<str>,
9005 {
9006 self._additional_params
9007 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9008 self
9009 }
9010
9011 /// Identifies the authorization scope for the method you are building.
9012 ///
9013 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9014 /// [`Scope::CloudPlatform`].
9015 ///
9016 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9017 /// tokens for more than one scope.
9018 ///
9019 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9020 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9021 /// sufficient, a read-write scope will do as well.
9022 pub fn add_scope<St>(
9023 mut self,
9024 scope: St,
9025 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
9026 where
9027 St: AsRef<str>,
9028 {
9029 self._scopes.insert(String::from(scope.as_ref()));
9030 self
9031 }
9032 /// Identifies the authorization scope(s) for the method you are building.
9033 ///
9034 /// See [`Self::add_scope()`] for details.
9035 pub fn add_scopes<I, St>(
9036 mut self,
9037 scopes: I,
9038 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
9039 where
9040 I: IntoIterator<Item = St>,
9041 St: AsRef<str>,
9042 {
9043 self._scopes
9044 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9045 self
9046 }
9047
9048 /// Removes all scopes, and no default scope will be used either.
9049 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9050 /// for details).
9051 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
9052 self._scopes.clear();
9053 self
9054 }
9055}
9056
9057/// Imports entries from a source, such as data previously dumped into a Cloud Storage bucket, into Data Catalog. Import of entries is a sync operation that reconciles the state of the third-party system with the Data Catalog. `ImportEntries` accepts source data snapshots of a third-party system. Snapshot should be delivered as a .wire or base65-encoded .txt file containing a sequence of Protocol Buffer messages of DumpItem type. `ImportEntries` returns a long-running operation resource that can be queried with Operations.GetOperation to return ImportEntriesMetadata and an ImportEntriesResponse message.
9058///
9059/// A builder for the *locations.entryGroups.entries.import* method supported by a *project* resource.
9060/// It is not used directly, but through a [`ProjectMethods`] instance.
9061///
9062/// # Example
9063///
9064/// Instantiate a resource method builder
9065///
9066/// ```test_harness,no_run
9067/// # extern crate hyper;
9068/// # extern crate hyper_rustls;
9069/// # extern crate google_datacatalog1 as datacatalog1;
9070/// use datacatalog1::api::GoogleCloudDatacatalogV1ImportEntriesRequest;
9071/// # async fn dox() {
9072/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9073///
9074/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9075/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9076/// # .with_native_roots()
9077/// # .unwrap()
9078/// # .https_only()
9079/// # .enable_http2()
9080/// # .build();
9081///
9082/// # let executor = hyper_util::rt::TokioExecutor::new();
9083/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9084/// # secret,
9085/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9086/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9087/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9088/// # ),
9089/// # ).build().await.unwrap();
9090///
9091/// # let client = hyper_util::client::legacy::Client::builder(
9092/// # hyper_util::rt::TokioExecutor::new()
9093/// # )
9094/// # .build(
9095/// # hyper_rustls::HttpsConnectorBuilder::new()
9096/// # .with_native_roots()
9097/// # .unwrap()
9098/// # .https_or_http()
9099/// # .enable_http2()
9100/// # .build()
9101/// # );
9102/// # let mut hub = DataCatalog::new(client, auth);
9103/// // As the method needs a request, you would usually fill it with the desired information
9104/// // into the respective structure. Some of the parts shown here might not be applicable !
9105/// // Values shown here are possibly random and not representative !
9106/// let mut req = GoogleCloudDatacatalogV1ImportEntriesRequest::default();
9107///
9108/// // You can configure optional parameters by calling the respective setters at will, and
9109/// // execute the final call using `doit()`.
9110/// // Values shown here are possibly random and not representative !
9111/// let result = hub.projects().locations_entry_groups_entries_import(req, "parent")
9112/// .doit().await;
9113/// # }
9114/// ```
9115pub struct ProjectLocationEntryGroupEntryImportCall<'a, C>
9116where
9117 C: 'a,
9118{
9119 hub: &'a DataCatalog<C>,
9120 _request: GoogleCloudDatacatalogV1ImportEntriesRequest,
9121 _parent: String,
9122 _delegate: Option<&'a mut dyn common::Delegate>,
9123 _additional_params: HashMap<String, String>,
9124 _scopes: BTreeSet<String>,
9125}
9126
9127impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryImportCall<'a, C> {}
9128
9129impl<'a, C> ProjectLocationEntryGroupEntryImportCall<'a, C>
9130where
9131 C: common::Connector,
9132{
9133 /// Perform the operation you have build so far.
9134 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9135 use std::borrow::Cow;
9136 use std::io::{Read, Seek};
9137
9138 use common::{url::Params, ToParts};
9139 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9140
9141 let mut dd = common::DefaultDelegate;
9142 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9143 dlg.begin(common::MethodInfo {
9144 id: "datacatalog.projects.locations.entryGroups.entries.import",
9145 http_method: hyper::Method::POST,
9146 });
9147
9148 for &field in ["alt", "parent"].iter() {
9149 if self._additional_params.contains_key(field) {
9150 dlg.finished(false);
9151 return Err(common::Error::FieldClash(field));
9152 }
9153 }
9154
9155 let mut params = Params::with_capacity(4 + self._additional_params.len());
9156 params.push("parent", self._parent);
9157
9158 params.extend(self._additional_params.iter());
9159
9160 params.push("alt", "json");
9161 let mut url = self.hub._base_url.clone() + "v1/{+parent}/entries:import";
9162 if self._scopes.is_empty() {
9163 self._scopes
9164 .insert(Scope::CloudPlatform.as_ref().to_string());
9165 }
9166
9167 #[allow(clippy::single_element_loop)]
9168 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9169 url = params.uri_replacement(url, param_name, find_this, true);
9170 }
9171 {
9172 let to_remove = ["parent"];
9173 params.remove_params(&to_remove);
9174 }
9175
9176 let url = params.parse_with_url(&url);
9177
9178 let mut json_mime_type = mime::APPLICATION_JSON;
9179 let mut request_value_reader = {
9180 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9181 common::remove_json_null_values(&mut value);
9182 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9183 serde_json::to_writer(&mut dst, &value).unwrap();
9184 dst
9185 };
9186 let request_size = request_value_reader
9187 .seek(std::io::SeekFrom::End(0))
9188 .unwrap();
9189 request_value_reader
9190 .seek(std::io::SeekFrom::Start(0))
9191 .unwrap();
9192
9193 loop {
9194 let token = match self
9195 .hub
9196 .auth
9197 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9198 .await
9199 {
9200 Ok(token) => token,
9201 Err(e) => match dlg.token(e) {
9202 Ok(token) => token,
9203 Err(e) => {
9204 dlg.finished(false);
9205 return Err(common::Error::MissingToken(e));
9206 }
9207 },
9208 };
9209 request_value_reader
9210 .seek(std::io::SeekFrom::Start(0))
9211 .unwrap();
9212 let mut req_result = {
9213 let client = &self.hub.client;
9214 dlg.pre_request();
9215 let mut req_builder = hyper::Request::builder()
9216 .method(hyper::Method::POST)
9217 .uri(url.as_str())
9218 .header(USER_AGENT, self.hub._user_agent.clone());
9219
9220 if let Some(token) = token.as_ref() {
9221 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9222 }
9223
9224 let request = req_builder
9225 .header(CONTENT_TYPE, json_mime_type.to_string())
9226 .header(CONTENT_LENGTH, request_size as u64)
9227 .body(common::to_body(
9228 request_value_reader.get_ref().clone().into(),
9229 ));
9230
9231 client.request(request.unwrap()).await
9232 };
9233
9234 match req_result {
9235 Err(err) => {
9236 if let common::Retry::After(d) = dlg.http_error(&err) {
9237 sleep(d).await;
9238 continue;
9239 }
9240 dlg.finished(false);
9241 return Err(common::Error::HttpError(err));
9242 }
9243 Ok(res) => {
9244 let (mut parts, body) = res.into_parts();
9245 let mut body = common::Body::new(body);
9246 if !parts.status.is_success() {
9247 let bytes = common::to_bytes(body).await.unwrap_or_default();
9248 let error = serde_json::from_str(&common::to_string(&bytes));
9249 let response = common::to_response(parts, bytes.into());
9250
9251 if let common::Retry::After(d) =
9252 dlg.http_failure(&response, error.as_ref().ok())
9253 {
9254 sleep(d).await;
9255 continue;
9256 }
9257
9258 dlg.finished(false);
9259
9260 return Err(match error {
9261 Ok(value) => common::Error::BadRequest(value),
9262 _ => common::Error::Failure(response),
9263 });
9264 }
9265 let response = {
9266 let bytes = common::to_bytes(body).await.unwrap_or_default();
9267 let encoded = common::to_string(&bytes);
9268 match serde_json::from_str(&encoded) {
9269 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9270 Err(error) => {
9271 dlg.response_json_decode_error(&encoded, &error);
9272 return Err(common::Error::JsonDecodeError(
9273 encoded.to_string(),
9274 error,
9275 ));
9276 }
9277 }
9278 };
9279
9280 dlg.finished(true);
9281 return Ok(response);
9282 }
9283 }
9284 }
9285 }
9286
9287 ///
9288 /// Sets the *request* property to the given value.
9289 ///
9290 /// Even though the property as already been set when instantiating this call,
9291 /// we provide this method for API completeness.
9292 pub fn request(
9293 mut self,
9294 new_value: GoogleCloudDatacatalogV1ImportEntriesRequest,
9295 ) -> ProjectLocationEntryGroupEntryImportCall<'a, C> {
9296 self._request = new_value;
9297 self
9298 }
9299 /// Required. Target entry group for ingested entries.
9300 ///
9301 /// Sets the *parent* path property to the given value.
9302 ///
9303 /// Even though the property as already been set when instantiating this call,
9304 /// we provide this method for API completeness.
9305 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryImportCall<'a, C> {
9306 self._parent = new_value.to_string();
9307 self
9308 }
9309 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9310 /// while executing the actual API request.
9311 ///
9312 /// ````text
9313 /// It should be used to handle progress information, and to implement a certain level of resilience.
9314 /// ````
9315 ///
9316 /// Sets the *delegate* property to the given value.
9317 pub fn delegate(
9318 mut self,
9319 new_value: &'a mut dyn common::Delegate,
9320 ) -> ProjectLocationEntryGroupEntryImportCall<'a, C> {
9321 self._delegate = Some(new_value);
9322 self
9323 }
9324
9325 /// Set any additional parameter of the query string used in the request.
9326 /// It should be used to set parameters which are not yet available through their own
9327 /// setters.
9328 ///
9329 /// Please note that this method must not be used to set any of the known parameters
9330 /// which have their own setter method. If done anyway, the request will fail.
9331 ///
9332 /// # Additional Parameters
9333 ///
9334 /// * *$.xgafv* (query-string) - V1 error format.
9335 /// * *access_token* (query-string) - OAuth access token.
9336 /// * *alt* (query-string) - Data format for response.
9337 /// * *callback* (query-string) - JSONP
9338 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9339 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9340 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9341 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9342 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9343 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9344 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9345 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryImportCall<'a, C>
9346 where
9347 T: AsRef<str>,
9348 {
9349 self._additional_params
9350 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9351 self
9352 }
9353
9354 /// Identifies the authorization scope for the method you are building.
9355 ///
9356 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9357 /// [`Scope::CloudPlatform`].
9358 ///
9359 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9360 /// tokens for more than one scope.
9361 ///
9362 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9363 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9364 /// sufficient, a read-write scope will do as well.
9365 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryImportCall<'a, C>
9366 where
9367 St: AsRef<str>,
9368 {
9369 self._scopes.insert(String::from(scope.as_ref()));
9370 self
9371 }
9372 /// Identifies the authorization scope(s) for the method you are building.
9373 ///
9374 /// See [`Self::add_scope()`] for details.
9375 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryImportCall<'a, C>
9376 where
9377 I: IntoIterator<Item = St>,
9378 St: AsRef<str>,
9379 {
9380 self._scopes
9381 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9382 self
9383 }
9384
9385 /// Removes all scopes, and no default scope will be used either.
9386 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9387 /// for details).
9388 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryImportCall<'a, C> {
9389 self._scopes.clear();
9390 self
9391 }
9392}
9393
9394/// Lists entries. Note: Currently, this method can list only custom entries. To get a list of both custom and automatically created entries, use SearchCatalog.
9395///
9396/// A builder for the *locations.entryGroups.entries.list* method supported by a *project* resource.
9397/// It is not used directly, but through a [`ProjectMethods`] instance.
9398///
9399/// # Example
9400///
9401/// Instantiate a resource method builder
9402///
9403/// ```test_harness,no_run
9404/// # extern crate hyper;
9405/// # extern crate hyper_rustls;
9406/// # extern crate google_datacatalog1 as datacatalog1;
9407/// # async fn dox() {
9408/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9409///
9410/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9411/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9412/// # .with_native_roots()
9413/// # .unwrap()
9414/// # .https_only()
9415/// # .enable_http2()
9416/// # .build();
9417///
9418/// # let executor = hyper_util::rt::TokioExecutor::new();
9419/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9420/// # secret,
9421/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9422/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9423/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9424/// # ),
9425/// # ).build().await.unwrap();
9426///
9427/// # let client = hyper_util::client::legacy::Client::builder(
9428/// # hyper_util::rt::TokioExecutor::new()
9429/// # )
9430/// # .build(
9431/// # hyper_rustls::HttpsConnectorBuilder::new()
9432/// # .with_native_roots()
9433/// # .unwrap()
9434/// # .https_or_http()
9435/// # .enable_http2()
9436/// # .build()
9437/// # );
9438/// # let mut hub = DataCatalog::new(client, auth);
9439/// // You can configure optional parameters by calling the respective setters at will, and
9440/// // execute the final call using `doit()`.
9441/// // Values shown here are possibly random and not representative !
9442/// let result = hub.projects().locations_entry_groups_entries_list("parent")
9443/// .read_mask(FieldMask::new::<&str>(&[]))
9444/// .page_token("gubergren")
9445/// .page_size(-17)
9446/// .doit().await;
9447/// # }
9448/// ```
9449pub struct ProjectLocationEntryGroupEntryListCall<'a, C>
9450where
9451 C: 'a,
9452{
9453 hub: &'a DataCatalog<C>,
9454 _parent: String,
9455 _read_mask: Option<common::FieldMask>,
9456 _page_token: Option<String>,
9457 _page_size: Option<i32>,
9458 _delegate: Option<&'a mut dyn common::Delegate>,
9459 _additional_params: HashMap<String, String>,
9460 _scopes: BTreeSet<String>,
9461}
9462
9463impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryListCall<'a, C> {}
9464
9465impl<'a, C> ProjectLocationEntryGroupEntryListCall<'a, C>
9466where
9467 C: common::Connector,
9468{
9469 /// Perform the operation you have build so far.
9470 pub async fn doit(
9471 mut self,
9472 ) -> common::Result<(
9473 common::Response,
9474 GoogleCloudDatacatalogV1ListEntriesResponse,
9475 )> {
9476 use std::borrow::Cow;
9477 use std::io::{Read, Seek};
9478
9479 use common::{url::Params, ToParts};
9480 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9481
9482 let mut dd = common::DefaultDelegate;
9483 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9484 dlg.begin(common::MethodInfo {
9485 id: "datacatalog.projects.locations.entryGroups.entries.list",
9486 http_method: hyper::Method::GET,
9487 });
9488
9489 for &field in ["alt", "parent", "readMask", "pageToken", "pageSize"].iter() {
9490 if self._additional_params.contains_key(field) {
9491 dlg.finished(false);
9492 return Err(common::Error::FieldClash(field));
9493 }
9494 }
9495
9496 let mut params = Params::with_capacity(6 + self._additional_params.len());
9497 params.push("parent", self._parent);
9498 if let Some(value) = self._read_mask.as_ref() {
9499 params.push("readMask", value.to_string());
9500 }
9501 if let Some(value) = self._page_token.as_ref() {
9502 params.push("pageToken", value);
9503 }
9504 if let Some(value) = self._page_size.as_ref() {
9505 params.push("pageSize", value.to_string());
9506 }
9507
9508 params.extend(self._additional_params.iter());
9509
9510 params.push("alt", "json");
9511 let mut url = self.hub._base_url.clone() + "v1/{+parent}/entries";
9512 if self._scopes.is_empty() {
9513 self._scopes
9514 .insert(Scope::CloudPlatform.as_ref().to_string());
9515 }
9516
9517 #[allow(clippy::single_element_loop)]
9518 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9519 url = params.uri_replacement(url, param_name, find_this, true);
9520 }
9521 {
9522 let to_remove = ["parent"];
9523 params.remove_params(&to_remove);
9524 }
9525
9526 let url = params.parse_with_url(&url);
9527
9528 loop {
9529 let token = match self
9530 .hub
9531 .auth
9532 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9533 .await
9534 {
9535 Ok(token) => token,
9536 Err(e) => match dlg.token(e) {
9537 Ok(token) => token,
9538 Err(e) => {
9539 dlg.finished(false);
9540 return Err(common::Error::MissingToken(e));
9541 }
9542 },
9543 };
9544 let mut req_result = {
9545 let client = &self.hub.client;
9546 dlg.pre_request();
9547 let mut req_builder = hyper::Request::builder()
9548 .method(hyper::Method::GET)
9549 .uri(url.as_str())
9550 .header(USER_AGENT, self.hub._user_agent.clone());
9551
9552 if let Some(token) = token.as_ref() {
9553 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9554 }
9555
9556 let request = req_builder
9557 .header(CONTENT_LENGTH, 0_u64)
9558 .body(common::to_body::<String>(None));
9559
9560 client.request(request.unwrap()).await
9561 };
9562
9563 match req_result {
9564 Err(err) => {
9565 if let common::Retry::After(d) = dlg.http_error(&err) {
9566 sleep(d).await;
9567 continue;
9568 }
9569 dlg.finished(false);
9570 return Err(common::Error::HttpError(err));
9571 }
9572 Ok(res) => {
9573 let (mut parts, body) = res.into_parts();
9574 let mut body = common::Body::new(body);
9575 if !parts.status.is_success() {
9576 let bytes = common::to_bytes(body).await.unwrap_or_default();
9577 let error = serde_json::from_str(&common::to_string(&bytes));
9578 let response = common::to_response(parts, bytes.into());
9579
9580 if let common::Retry::After(d) =
9581 dlg.http_failure(&response, error.as_ref().ok())
9582 {
9583 sleep(d).await;
9584 continue;
9585 }
9586
9587 dlg.finished(false);
9588
9589 return Err(match error {
9590 Ok(value) => common::Error::BadRequest(value),
9591 _ => common::Error::Failure(response),
9592 });
9593 }
9594 let response = {
9595 let bytes = common::to_bytes(body).await.unwrap_or_default();
9596 let encoded = common::to_string(&bytes);
9597 match serde_json::from_str(&encoded) {
9598 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9599 Err(error) => {
9600 dlg.response_json_decode_error(&encoded, &error);
9601 return Err(common::Error::JsonDecodeError(
9602 encoded.to_string(),
9603 error,
9604 ));
9605 }
9606 }
9607 };
9608
9609 dlg.finished(true);
9610 return Ok(response);
9611 }
9612 }
9613 }
9614 }
9615
9616 /// Required. The name of the entry group that contains the entries to list. Can be provided in URL format.
9617 ///
9618 /// Sets the *parent* path property to the given value.
9619 ///
9620 /// Even though the property as already been set when instantiating this call,
9621 /// we provide this method for API completeness.
9622 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
9623 self._parent = new_value.to_string();
9624 self
9625 }
9626 /// The fields to return for each entry. If empty or omitted, all fields are returned. For example, to return a list of entries with only the `name` field, set `read_mask` to only one path with the `name` value.
9627 ///
9628 /// Sets the *read mask* query property to the given value.
9629 pub fn read_mask(
9630 mut self,
9631 new_value: common::FieldMask,
9632 ) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
9633 self._read_mask = Some(new_value);
9634 self
9635 }
9636 /// Pagination token that specifies the next page to return. If empty, the first page is returned.
9637 ///
9638 /// Sets the *page token* query property to the given value.
9639 pub fn page_token(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
9640 self._page_token = Some(new_value.to_string());
9641 self
9642 }
9643 /// The maximum number of items to return. Default is 10. Maximum limit is 1000. Throws an invalid argument if `page_size` is more than 1000.
9644 ///
9645 /// Sets the *page size* query property to the given value.
9646 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
9647 self._page_size = Some(new_value);
9648 self
9649 }
9650 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9651 /// while executing the actual API request.
9652 ///
9653 /// ````text
9654 /// It should be used to handle progress information, and to implement a certain level of resilience.
9655 /// ````
9656 ///
9657 /// Sets the *delegate* property to the given value.
9658 pub fn delegate(
9659 mut self,
9660 new_value: &'a mut dyn common::Delegate,
9661 ) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
9662 self._delegate = Some(new_value);
9663 self
9664 }
9665
9666 /// Set any additional parameter of the query string used in the request.
9667 /// It should be used to set parameters which are not yet available through their own
9668 /// setters.
9669 ///
9670 /// Please note that this method must not be used to set any of the known parameters
9671 /// which have their own setter method. If done anyway, the request will fail.
9672 ///
9673 /// # Additional Parameters
9674 ///
9675 /// * *$.xgafv* (query-string) - V1 error format.
9676 /// * *access_token* (query-string) - OAuth access token.
9677 /// * *alt* (query-string) - Data format for response.
9678 /// * *callback* (query-string) - JSONP
9679 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9680 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9681 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9682 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9683 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9684 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9685 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9686 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryListCall<'a, C>
9687 where
9688 T: AsRef<str>,
9689 {
9690 self._additional_params
9691 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9692 self
9693 }
9694
9695 /// Identifies the authorization scope for the method you are building.
9696 ///
9697 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9698 /// [`Scope::CloudPlatform`].
9699 ///
9700 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9701 /// tokens for more than one scope.
9702 ///
9703 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9704 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9705 /// sufficient, a read-write scope will do as well.
9706 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryListCall<'a, C>
9707 where
9708 St: AsRef<str>,
9709 {
9710 self._scopes.insert(String::from(scope.as_ref()));
9711 self
9712 }
9713 /// Identifies the authorization scope(s) for the method you are building.
9714 ///
9715 /// See [`Self::add_scope()`] for details.
9716 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryListCall<'a, C>
9717 where
9718 I: IntoIterator<Item = St>,
9719 St: AsRef<str>,
9720 {
9721 self._scopes
9722 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9723 self
9724 }
9725
9726 /// Removes all scopes, and no default scope will be used either.
9727 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9728 /// for details).
9729 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
9730 self._scopes.clear();
9731 self
9732 }
9733}
9734
9735/// Modifies contacts, part of the business context of an Entry. To call this method, you must have the `datacatalog.entries.updateContacts` IAM permission on the corresponding project.
9736///
9737/// A builder for the *locations.entryGroups.entries.modifyEntryContacts* method supported by a *project* resource.
9738/// It is not used directly, but through a [`ProjectMethods`] instance.
9739///
9740/// # Example
9741///
9742/// Instantiate a resource method builder
9743///
9744/// ```test_harness,no_run
9745/// # extern crate hyper;
9746/// # extern crate hyper_rustls;
9747/// # extern crate google_datacatalog1 as datacatalog1;
9748/// use datacatalog1::api::GoogleCloudDatacatalogV1ModifyEntryContactsRequest;
9749/// # async fn dox() {
9750/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9751///
9752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9753/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9754/// # .with_native_roots()
9755/// # .unwrap()
9756/// # .https_only()
9757/// # .enable_http2()
9758/// # .build();
9759///
9760/// # let executor = hyper_util::rt::TokioExecutor::new();
9761/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9762/// # secret,
9763/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9764/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9765/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9766/// # ),
9767/// # ).build().await.unwrap();
9768///
9769/// # let client = hyper_util::client::legacy::Client::builder(
9770/// # hyper_util::rt::TokioExecutor::new()
9771/// # )
9772/// # .build(
9773/// # hyper_rustls::HttpsConnectorBuilder::new()
9774/// # .with_native_roots()
9775/// # .unwrap()
9776/// # .https_or_http()
9777/// # .enable_http2()
9778/// # .build()
9779/// # );
9780/// # let mut hub = DataCatalog::new(client, auth);
9781/// // As the method needs a request, you would usually fill it with the desired information
9782/// // into the respective structure. Some of the parts shown here might not be applicable !
9783/// // Values shown here are possibly random and not representative !
9784/// let mut req = GoogleCloudDatacatalogV1ModifyEntryContactsRequest::default();
9785///
9786/// // You can configure optional parameters by calling the respective setters at will, and
9787/// // execute the final call using `doit()`.
9788/// // Values shown here are possibly random and not representative !
9789/// let result = hub.projects().locations_entry_groups_entries_modify_entry_contacts(req, "name")
9790/// .doit().await;
9791/// # }
9792/// ```
9793pub struct ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C>
9794where
9795 C: 'a,
9796{
9797 hub: &'a DataCatalog<C>,
9798 _request: GoogleCloudDatacatalogV1ModifyEntryContactsRequest,
9799 _name: String,
9800 _delegate: Option<&'a mut dyn common::Delegate>,
9801 _additional_params: HashMap<String, String>,
9802 _scopes: BTreeSet<String>,
9803}
9804
9805impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C> {}
9806
9807impl<'a, C> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C>
9808where
9809 C: common::Connector,
9810{
9811 /// Perform the operation you have build so far.
9812 pub async fn doit(
9813 mut self,
9814 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Contacts)> {
9815 use std::borrow::Cow;
9816 use std::io::{Read, Seek};
9817
9818 use common::{url::Params, ToParts};
9819 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9820
9821 let mut dd = common::DefaultDelegate;
9822 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9823 dlg.begin(common::MethodInfo {
9824 id: "datacatalog.projects.locations.entryGroups.entries.modifyEntryContacts",
9825 http_method: hyper::Method::POST,
9826 });
9827
9828 for &field in ["alt", "name"].iter() {
9829 if self._additional_params.contains_key(field) {
9830 dlg.finished(false);
9831 return Err(common::Error::FieldClash(field));
9832 }
9833 }
9834
9835 let mut params = Params::with_capacity(4 + self._additional_params.len());
9836 params.push("name", self._name);
9837
9838 params.extend(self._additional_params.iter());
9839
9840 params.push("alt", "json");
9841 let mut url = self.hub._base_url.clone() + "v1/{+name}:modifyEntryContacts";
9842 if self._scopes.is_empty() {
9843 self._scopes
9844 .insert(Scope::CloudPlatform.as_ref().to_string());
9845 }
9846
9847 #[allow(clippy::single_element_loop)]
9848 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9849 url = params.uri_replacement(url, param_name, find_this, true);
9850 }
9851 {
9852 let to_remove = ["name"];
9853 params.remove_params(&to_remove);
9854 }
9855
9856 let url = params.parse_with_url(&url);
9857
9858 let mut json_mime_type = mime::APPLICATION_JSON;
9859 let mut request_value_reader = {
9860 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9861 common::remove_json_null_values(&mut value);
9862 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9863 serde_json::to_writer(&mut dst, &value).unwrap();
9864 dst
9865 };
9866 let request_size = request_value_reader
9867 .seek(std::io::SeekFrom::End(0))
9868 .unwrap();
9869 request_value_reader
9870 .seek(std::io::SeekFrom::Start(0))
9871 .unwrap();
9872
9873 loop {
9874 let token = match self
9875 .hub
9876 .auth
9877 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9878 .await
9879 {
9880 Ok(token) => token,
9881 Err(e) => match dlg.token(e) {
9882 Ok(token) => token,
9883 Err(e) => {
9884 dlg.finished(false);
9885 return Err(common::Error::MissingToken(e));
9886 }
9887 },
9888 };
9889 request_value_reader
9890 .seek(std::io::SeekFrom::Start(0))
9891 .unwrap();
9892 let mut req_result = {
9893 let client = &self.hub.client;
9894 dlg.pre_request();
9895 let mut req_builder = hyper::Request::builder()
9896 .method(hyper::Method::POST)
9897 .uri(url.as_str())
9898 .header(USER_AGENT, self.hub._user_agent.clone());
9899
9900 if let Some(token) = token.as_ref() {
9901 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9902 }
9903
9904 let request = req_builder
9905 .header(CONTENT_TYPE, json_mime_type.to_string())
9906 .header(CONTENT_LENGTH, request_size as u64)
9907 .body(common::to_body(
9908 request_value_reader.get_ref().clone().into(),
9909 ));
9910
9911 client.request(request.unwrap()).await
9912 };
9913
9914 match req_result {
9915 Err(err) => {
9916 if let common::Retry::After(d) = dlg.http_error(&err) {
9917 sleep(d).await;
9918 continue;
9919 }
9920 dlg.finished(false);
9921 return Err(common::Error::HttpError(err));
9922 }
9923 Ok(res) => {
9924 let (mut parts, body) = res.into_parts();
9925 let mut body = common::Body::new(body);
9926 if !parts.status.is_success() {
9927 let bytes = common::to_bytes(body).await.unwrap_or_default();
9928 let error = serde_json::from_str(&common::to_string(&bytes));
9929 let response = common::to_response(parts, bytes.into());
9930
9931 if let common::Retry::After(d) =
9932 dlg.http_failure(&response, error.as_ref().ok())
9933 {
9934 sleep(d).await;
9935 continue;
9936 }
9937
9938 dlg.finished(false);
9939
9940 return Err(match error {
9941 Ok(value) => common::Error::BadRequest(value),
9942 _ => common::Error::Failure(response),
9943 });
9944 }
9945 let response = {
9946 let bytes = common::to_bytes(body).await.unwrap_or_default();
9947 let encoded = common::to_string(&bytes);
9948 match serde_json::from_str(&encoded) {
9949 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9950 Err(error) => {
9951 dlg.response_json_decode_error(&encoded, &error);
9952 return Err(common::Error::JsonDecodeError(
9953 encoded.to_string(),
9954 error,
9955 ));
9956 }
9957 }
9958 };
9959
9960 dlg.finished(true);
9961 return Ok(response);
9962 }
9963 }
9964 }
9965 }
9966
9967 ///
9968 /// Sets the *request* property to the given value.
9969 ///
9970 /// Even though the property as already been set when instantiating this call,
9971 /// we provide this method for API completeness.
9972 pub fn request(
9973 mut self,
9974 new_value: GoogleCloudDatacatalogV1ModifyEntryContactsRequest,
9975 ) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C> {
9976 self._request = new_value;
9977 self
9978 }
9979 /// Required. The full resource name of the entry.
9980 ///
9981 /// Sets the *name* path property to the given value.
9982 ///
9983 /// Even though the property as already been set when instantiating this call,
9984 /// we provide this method for API completeness.
9985 pub fn name(
9986 mut self,
9987 new_value: &str,
9988 ) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C> {
9989 self._name = new_value.to_string();
9990 self
9991 }
9992 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9993 /// while executing the actual API request.
9994 ///
9995 /// ````text
9996 /// It should be used to handle progress information, and to implement a certain level of resilience.
9997 /// ````
9998 ///
9999 /// Sets the *delegate* property to the given value.
10000 pub fn delegate(
10001 mut self,
10002 new_value: &'a mut dyn common::Delegate,
10003 ) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C> {
10004 self._delegate = Some(new_value);
10005 self
10006 }
10007
10008 /// Set any additional parameter of the query string used in the request.
10009 /// It should be used to set parameters which are not yet available through their own
10010 /// setters.
10011 ///
10012 /// Please note that this method must not be used to set any of the known parameters
10013 /// which have their own setter method. If done anyway, the request will fail.
10014 ///
10015 /// # Additional Parameters
10016 ///
10017 /// * *$.xgafv* (query-string) - V1 error format.
10018 /// * *access_token* (query-string) - OAuth access token.
10019 /// * *alt* (query-string) - Data format for response.
10020 /// * *callback* (query-string) - JSONP
10021 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10022 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10023 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10024 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10025 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10026 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10027 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10028 pub fn param<T>(
10029 mut self,
10030 name: T,
10031 value: T,
10032 ) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C>
10033 where
10034 T: AsRef<str>,
10035 {
10036 self._additional_params
10037 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10038 self
10039 }
10040
10041 /// Identifies the authorization scope for the method you are building.
10042 ///
10043 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10044 /// [`Scope::CloudPlatform`].
10045 ///
10046 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10047 /// tokens for more than one scope.
10048 ///
10049 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10050 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10051 /// sufficient, a read-write scope will do as well.
10052 pub fn add_scope<St>(
10053 mut self,
10054 scope: St,
10055 ) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C>
10056 where
10057 St: AsRef<str>,
10058 {
10059 self._scopes.insert(String::from(scope.as_ref()));
10060 self
10061 }
10062 /// Identifies the authorization scope(s) for the method you are building.
10063 ///
10064 /// See [`Self::add_scope()`] for details.
10065 pub fn add_scopes<I, St>(
10066 mut self,
10067 scopes: I,
10068 ) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C>
10069 where
10070 I: IntoIterator<Item = St>,
10071 St: AsRef<str>,
10072 {
10073 self._scopes
10074 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10075 self
10076 }
10077
10078 /// Removes all scopes, and no default scope will be used either.
10079 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10080 /// for details).
10081 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryModifyEntryContactCall<'a, C> {
10082 self._scopes.clear();
10083 self
10084 }
10085}
10086
10087/// Modifies entry overview, part of the business context of an Entry. To call this method, you must have the `datacatalog.entries.updateOverview` IAM permission on the corresponding project.
10088///
10089/// A builder for the *locations.entryGroups.entries.modifyEntryOverview* method supported by a *project* resource.
10090/// It is not used directly, but through a [`ProjectMethods`] instance.
10091///
10092/// # Example
10093///
10094/// Instantiate a resource method builder
10095///
10096/// ```test_harness,no_run
10097/// # extern crate hyper;
10098/// # extern crate hyper_rustls;
10099/// # extern crate google_datacatalog1 as datacatalog1;
10100/// use datacatalog1::api::GoogleCloudDatacatalogV1ModifyEntryOverviewRequest;
10101/// # async fn dox() {
10102/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10103///
10104/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10105/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10106/// # .with_native_roots()
10107/// # .unwrap()
10108/// # .https_only()
10109/// # .enable_http2()
10110/// # .build();
10111///
10112/// # let executor = hyper_util::rt::TokioExecutor::new();
10113/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10114/// # secret,
10115/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10116/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10117/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10118/// # ),
10119/// # ).build().await.unwrap();
10120///
10121/// # let client = hyper_util::client::legacy::Client::builder(
10122/// # hyper_util::rt::TokioExecutor::new()
10123/// # )
10124/// # .build(
10125/// # hyper_rustls::HttpsConnectorBuilder::new()
10126/// # .with_native_roots()
10127/// # .unwrap()
10128/// # .https_or_http()
10129/// # .enable_http2()
10130/// # .build()
10131/// # );
10132/// # let mut hub = DataCatalog::new(client, auth);
10133/// // As the method needs a request, you would usually fill it with the desired information
10134/// // into the respective structure. Some of the parts shown here might not be applicable !
10135/// // Values shown here are possibly random and not representative !
10136/// let mut req = GoogleCloudDatacatalogV1ModifyEntryOverviewRequest::default();
10137///
10138/// // You can configure optional parameters by calling the respective setters at will, and
10139/// // execute the final call using `doit()`.
10140/// // Values shown here are possibly random and not representative !
10141/// let result = hub.projects().locations_entry_groups_entries_modify_entry_overview(req, "name")
10142/// .doit().await;
10143/// # }
10144/// ```
10145pub struct ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C>
10146where
10147 C: 'a,
10148{
10149 hub: &'a DataCatalog<C>,
10150 _request: GoogleCloudDatacatalogV1ModifyEntryOverviewRequest,
10151 _name: String,
10152 _delegate: Option<&'a mut dyn common::Delegate>,
10153 _additional_params: HashMap<String, String>,
10154 _scopes: BTreeSet<String>,
10155}
10156
10157impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C> {}
10158
10159impl<'a, C> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C>
10160where
10161 C: common::Connector,
10162{
10163 /// Perform the operation you have build so far.
10164 pub async fn doit(
10165 mut self,
10166 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1EntryOverview)> {
10167 use std::borrow::Cow;
10168 use std::io::{Read, Seek};
10169
10170 use common::{url::Params, ToParts};
10171 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10172
10173 let mut dd = common::DefaultDelegate;
10174 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10175 dlg.begin(common::MethodInfo {
10176 id: "datacatalog.projects.locations.entryGroups.entries.modifyEntryOverview",
10177 http_method: hyper::Method::POST,
10178 });
10179
10180 for &field in ["alt", "name"].iter() {
10181 if self._additional_params.contains_key(field) {
10182 dlg.finished(false);
10183 return Err(common::Error::FieldClash(field));
10184 }
10185 }
10186
10187 let mut params = Params::with_capacity(4 + self._additional_params.len());
10188 params.push("name", self._name);
10189
10190 params.extend(self._additional_params.iter());
10191
10192 params.push("alt", "json");
10193 let mut url = self.hub._base_url.clone() + "v1/{+name}:modifyEntryOverview";
10194 if self._scopes.is_empty() {
10195 self._scopes
10196 .insert(Scope::CloudPlatform.as_ref().to_string());
10197 }
10198
10199 #[allow(clippy::single_element_loop)]
10200 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10201 url = params.uri_replacement(url, param_name, find_this, true);
10202 }
10203 {
10204 let to_remove = ["name"];
10205 params.remove_params(&to_remove);
10206 }
10207
10208 let url = params.parse_with_url(&url);
10209
10210 let mut json_mime_type = mime::APPLICATION_JSON;
10211 let mut request_value_reader = {
10212 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10213 common::remove_json_null_values(&mut value);
10214 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10215 serde_json::to_writer(&mut dst, &value).unwrap();
10216 dst
10217 };
10218 let request_size = request_value_reader
10219 .seek(std::io::SeekFrom::End(0))
10220 .unwrap();
10221 request_value_reader
10222 .seek(std::io::SeekFrom::Start(0))
10223 .unwrap();
10224
10225 loop {
10226 let token = match self
10227 .hub
10228 .auth
10229 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10230 .await
10231 {
10232 Ok(token) => token,
10233 Err(e) => match dlg.token(e) {
10234 Ok(token) => token,
10235 Err(e) => {
10236 dlg.finished(false);
10237 return Err(common::Error::MissingToken(e));
10238 }
10239 },
10240 };
10241 request_value_reader
10242 .seek(std::io::SeekFrom::Start(0))
10243 .unwrap();
10244 let mut req_result = {
10245 let client = &self.hub.client;
10246 dlg.pre_request();
10247 let mut req_builder = hyper::Request::builder()
10248 .method(hyper::Method::POST)
10249 .uri(url.as_str())
10250 .header(USER_AGENT, self.hub._user_agent.clone());
10251
10252 if let Some(token) = token.as_ref() {
10253 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10254 }
10255
10256 let request = req_builder
10257 .header(CONTENT_TYPE, json_mime_type.to_string())
10258 .header(CONTENT_LENGTH, request_size as u64)
10259 .body(common::to_body(
10260 request_value_reader.get_ref().clone().into(),
10261 ));
10262
10263 client.request(request.unwrap()).await
10264 };
10265
10266 match req_result {
10267 Err(err) => {
10268 if let common::Retry::After(d) = dlg.http_error(&err) {
10269 sleep(d).await;
10270 continue;
10271 }
10272 dlg.finished(false);
10273 return Err(common::Error::HttpError(err));
10274 }
10275 Ok(res) => {
10276 let (mut parts, body) = res.into_parts();
10277 let mut body = common::Body::new(body);
10278 if !parts.status.is_success() {
10279 let bytes = common::to_bytes(body).await.unwrap_or_default();
10280 let error = serde_json::from_str(&common::to_string(&bytes));
10281 let response = common::to_response(parts, bytes.into());
10282
10283 if let common::Retry::After(d) =
10284 dlg.http_failure(&response, error.as_ref().ok())
10285 {
10286 sleep(d).await;
10287 continue;
10288 }
10289
10290 dlg.finished(false);
10291
10292 return Err(match error {
10293 Ok(value) => common::Error::BadRequest(value),
10294 _ => common::Error::Failure(response),
10295 });
10296 }
10297 let response = {
10298 let bytes = common::to_bytes(body).await.unwrap_or_default();
10299 let encoded = common::to_string(&bytes);
10300 match serde_json::from_str(&encoded) {
10301 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10302 Err(error) => {
10303 dlg.response_json_decode_error(&encoded, &error);
10304 return Err(common::Error::JsonDecodeError(
10305 encoded.to_string(),
10306 error,
10307 ));
10308 }
10309 }
10310 };
10311
10312 dlg.finished(true);
10313 return Ok(response);
10314 }
10315 }
10316 }
10317 }
10318
10319 ///
10320 /// Sets the *request* property to the given value.
10321 ///
10322 /// Even though the property as already been set when instantiating this call,
10323 /// we provide this method for API completeness.
10324 pub fn request(
10325 mut self,
10326 new_value: GoogleCloudDatacatalogV1ModifyEntryOverviewRequest,
10327 ) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C> {
10328 self._request = new_value;
10329 self
10330 }
10331 /// Required. The full resource name of the entry.
10332 ///
10333 /// Sets the *name* path property to the given value.
10334 ///
10335 /// Even though the property as already been set when instantiating this call,
10336 /// we provide this method for API completeness.
10337 pub fn name(
10338 mut self,
10339 new_value: &str,
10340 ) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C> {
10341 self._name = new_value.to_string();
10342 self
10343 }
10344 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10345 /// while executing the actual API request.
10346 ///
10347 /// ````text
10348 /// It should be used to handle progress information, and to implement a certain level of resilience.
10349 /// ````
10350 ///
10351 /// Sets the *delegate* property to the given value.
10352 pub fn delegate(
10353 mut self,
10354 new_value: &'a mut dyn common::Delegate,
10355 ) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C> {
10356 self._delegate = Some(new_value);
10357 self
10358 }
10359
10360 /// Set any additional parameter of the query string used in the request.
10361 /// It should be used to set parameters which are not yet available through their own
10362 /// setters.
10363 ///
10364 /// Please note that this method must not be used to set any of the known parameters
10365 /// which have their own setter method. If done anyway, the request will fail.
10366 ///
10367 /// # Additional Parameters
10368 ///
10369 /// * *$.xgafv* (query-string) - V1 error format.
10370 /// * *access_token* (query-string) - OAuth access token.
10371 /// * *alt* (query-string) - Data format for response.
10372 /// * *callback* (query-string) - JSONP
10373 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10374 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10375 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10376 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10377 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10378 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10379 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10380 pub fn param<T>(
10381 mut self,
10382 name: T,
10383 value: T,
10384 ) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C>
10385 where
10386 T: AsRef<str>,
10387 {
10388 self._additional_params
10389 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10390 self
10391 }
10392
10393 /// Identifies the authorization scope for the method you are building.
10394 ///
10395 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10396 /// [`Scope::CloudPlatform`].
10397 ///
10398 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10399 /// tokens for more than one scope.
10400 ///
10401 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10402 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10403 /// sufficient, a read-write scope will do as well.
10404 pub fn add_scope<St>(
10405 mut self,
10406 scope: St,
10407 ) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C>
10408 where
10409 St: AsRef<str>,
10410 {
10411 self._scopes.insert(String::from(scope.as_ref()));
10412 self
10413 }
10414 /// Identifies the authorization scope(s) for the method you are building.
10415 ///
10416 /// See [`Self::add_scope()`] for details.
10417 pub fn add_scopes<I, St>(
10418 mut self,
10419 scopes: I,
10420 ) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C>
10421 where
10422 I: IntoIterator<Item = St>,
10423 St: AsRef<str>,
10424 {
10425 self._scopes
10426 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10427 self
10428 }
10429
10430 /// Removes all scopes, and no default scope will be used either.
10431 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10432 /// for details).
10433 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryModifyEntryOverviewCall<'a, C> {
10434 self._scopes.clear();
10435 self
10436 }
10437}
10438
10439/// Updates an existing entry. You must enable the Data Catalog API in the project identified by the `entry.name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
10440///
10441/// A builder for the *locations.entryGroups.entries.patch* method supported by a *project* resource.
10442/// It is not used directly, but through a [`ProjectMethods`] instance.
10443///
10444/// # Example
10445///
10446/// Instantiate a resource method builder
10447///
10448/// ```test_harness,no_run
10449/// # extern crate hyper;
10450/// # extern crate hyper_rustls;
10451/// # extern crate google_datacatalog1 as datacatalog1;
10452/// use datacatalog1::api::GoogleCloudDatacatalogV1Entry;
10453/// # async fn dox() {
10454/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10455///
10456/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10457/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10458/// # .with_native_roots()
10459/// # .unwrap()
10460/// # .https_only()
10461/// # .enable_http2()
10462/// # .build();
10463///
10464/// # let executor = hyper_util::rt::TokioExecutor::new();
10465/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10466/// # secret,
10467/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10468/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10469/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10470/// # ),
10471/// # ).build().await.unwrap();
10472///
10473/// # let client = hyper_util::client::legacy::Client::builder(
10474/// # hyper_util::rt::TokioExecutor::new()
10475/// # )
10476/// # .build(
10477/// # hyper_rustls::HttpsConnectorBuilder::new()
10478/// # .with_native_roots()
10479/// # .unwrap()
10480/// # .https_or_http()
10481/// # .enable_http2()
10482/// # .build()
10483/// # );
10484/// # let mut hub = DataCatalog::new(client, auth);
10485/// // As the method needs a request, you would usually fill it with the desired information
10486/// // into the respective structure. Some of the parts shown here might not be applicable !
10487/// // Values shown here are possibly random and not representative !
10488/// let mut req = GoogleCloudDatacatalogV1Entry::default();
10489///
10490/// // You can configure optional parameters by calling the respective setters at will, and
10491/// // execute the final call using `doit()`.
10492/// // Values shown here are possibly random and not representative !
10493/// let result = hub.projects().locations_entry_groups_entries_patch(req, "name")
10494/// .update_mask(FieldMask::new::<&str>(&[]))
10495/// .doit().await;
10496/// # }
10497/// ```
10498pub struct ProjectLocationEntryGroupEntryPatchCall<'a, C>
10499where
10500 C: 'a,
10501{
10502 hub: &'a DataCatalog<C>,
10503 _request: GoogleCloudDatacatalogV1Entry,
10504 _name: String,
10505 _update_mask: Option<common::FieldMask>,
10506 _delegate: Option<&'a mut dyn common::Delegate>,
10507 _additional_params: HashMap<String, String>,
10508 _scopes: BTreeSet<String>,
10509}
10510
10511impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryPatchCall<'a, C> {}
10512
10513impl<'a, C> ProjectLocationEntryGroupEntryPatchCall<'a, C>
10514where
10515 C: common::Connector,
10516{
10517 /// Perform the operation you have build so far.
10518 pub async fn doit(
10519 mut self,
10520 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Entry)> {
10521 use std::borrow::Cow;
10522 use std::io::{Read, Seek};
10523
10524 use common::{url::Params, ToParts};
10525 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10526
10527 let mut dd = common::DefaultDelegate;
10528 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10529 dlg.begin(common::MethodInfo {
10530 id: "datacatalog.projects.locations.entryGroups.entries.patch",
10531 http_method: hyper::Method::PATCH,
10532 });
10533
10534 for &field in ["alt", "name", "updateMask"].iter() {
10535 if self._additional_params.contains_key(field) {
10536 dlg.finished(false);
10537 return Err(common::Error::FieldClash(field));
10538 }
10539 }
10540
10541 let mut params = Params::with_capacity(5 + self._additional_params.len());
10542 params.push("name", self._name);
10543 if let Some(value) = self._update_mask.as_ref() {
10544 params.push("updateMask", value.to_string());
10545 }
10546
10547 params.extend(self._additional_params.iter());
10548
10549 params.push("alt", "json");
10550 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10551 if self._scopes.is_empty() {
10552 self._scopes
10553 .insert(Scope::CloudPlatform.as_ref().to_string());
10554 }
10555
10556 #[allow(clippy::single_element_loop)]
10557 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10558 url = params.uri_replacement(url, param_name, find_this, true);
10559 }
10560 {
10561 let to_remove = ["name"];
10562 params.remove_params(&to_remove);
10563 }
10564
10565 let url = params.parse_with_url(&url);
10566
10567 let mut json_mime_type = mime::APPLICATION_JSON;
10568 let mut request_value_reader = {
10569 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10570 common::remove_json_null_values(&mut value);
10571 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10572 serde_json::to_writer(&mut dst, &value).unwrap();
10573 dst
10574 };
10575 let request_size = request_value_reader
10576 .seek(std::io::SeekFrom::End(0))
10577 .unwrap();
10578 request_value_reader
10579 .seek(std::io::SeekFrom::Start(0))
10580 .unwrap();
10581
10582 loop {
10583 let token = match self
10584 .hub
10585 .auth
10586 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10587 .await
10588 {
10589 Ok(token) => token,
10590 Err(e) => match dlg.token(e) {
10591 Ok(token) => token,
10592 Err(e) => {
10593 dlg.finished(false);
10594 return Err(common::Error::MissingToken(e));
10595 }
10596 },
10597 };
10598 request_value_reader
10599 .seek(std::io::SeekFrom::Start(0))
10600 .unwrap();
10601 let mut req_result = {
10602 let client = &self.hub.client;
10603 dlg.pre_request();
10604 let mut req_builder = hyper::Request::builder()
10605 .method(hyper::Method::PATCH)
10606 .uri(url.as_str())
10607 .header(USER_AGENT, self.hub._user_agent.clone());
10608
10609 if let Some(token) = token.as_ref() {
10610 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10611 }
10612
10613 let request = req_builder
10614 .header(CONTENT_TYPE, json_mime_type.to_string())
10615 .header(CONTENT_LENGTH, request_size as u64)
10616 .body(common::to_body(
10617 request_value_reader.get_ref().clone().into(),
10618 ));
10619
10620 client.request(request.unwrap()).await
10621 };
10622
10623 match req_result {
10624 Err(err) => {
10625 if let common::Retry::After(d) = dlg.http_error(&err) {
10626 sleep(d).await;
10627 continue;
10628 }
10629 dlg.finished(false);
10630 return Err(common::Error::HttpError(err));
10631 }
10632 Ok(res) => {
10633 let (mut parts, body) = res.into_parts();
10634 let mut body = common::Body::new(body);
10635 if !parts.status.is_success() {
10636 let bytes = common::to_bytes(body).await.unwrap_or_default();
10637 let error = serde_json::from_str(&common::to_string(&bytes));
10638 let response = common::to_response(parts, bytes.into());
10639
10640 if let common::Retry::After(d) =
10641 dlg.http_failure(&response, error.as_ref().ok())
10642 {
10643 sleep(d).await;
10644 continue;
10645 }
10646
10647 dlg.finished(false);
10648
10649 return Err(match error {
10650 Ok(value) => common::Error::BadRequest(value),
10651 _ => common::Error::Failure(response),
10652 });
10653 }
10654 let response = {
10655 let bytes = common::to_bytes(body).await.unwrap_or_default();
10656 let encoded = common::to_string(&bytes);
10657 match serde_json::from_str(&encoded) {
10658 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10659 Err(error) => {
10660 dlg.response_json_decode_error(&encoded, &error);
10661 return Err(common::Error::JsonDecodeError(
10662 encoded.to_string(),
10663 error,
10664 ));
10665 }
10666 }
10667 };
10668
10669 dlg.finished(true);
10670 return Ok(response);
10671 }
10672 }
10673 }
10674 }
10675
10676 ///
10677 /// Sets the *request* property to the given value.
10678 ///
10679 /// Even though the property as already been set when instantiating this call,
10680 /// we provide this method for API completeness.
10681 pub fn request(
10682 mut self,
10683 new_value: GoogleCloudDatacatalogV1Entry,
10684 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
10685 self._request = new_value;
10686 self
10687 }
10688 /// Output only. Identifier. The resource name of an entry in URL format. Note: The entry itself and its child resources might not be stored in the location specified in its name.
10689 ///
10690 /// Sets the *name* path property to the given value.
10691 ///
10692 /// Even though the property as already been set when instantiating this call,
10693 /// we provide this method for API completeness.
10694 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
10695 self._name = new_value.to_string();
10696 self
10697 }
10698 /// Names of fields whose values to overwrite on an entry. If this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied. You can modify only the fields listed below. For entries with type `DATA_STREAM`: * `schema` For entries with type `FILESET`: * `schema` * `display_name` * `description` * `gcs_fileset_spec` * `gcs_fileset_spec.file_patterns` For entries with `user_specified_type`: * `schema` * `display_name` * `description` * `user_specified_type` * `user_specified_system` * `linked_resource` * `source_system_timestamps`
10699 ///
10700 /// Sets the *update mask* query property to the given value.
10701 pub fn update_mask(
10702 mut self,
10703 new_value: common::FieldMask,
10704 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
10705 self._update_mask = Some(new_value);
10706 self
10707 }
10708 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10709 /// while executing the actual API request.
10710 ///
10711 /// ````text
10712 /// It should be used to handle progress information, and to implement a certain level of resilience.
10713 /// ````
10714 ///
10715 /// Sets the *delegate* property to the given value.
10716 pub fn delegate(
10717 mut self,
10718 new_value: &'a mut dyn common::Delegate,
10719 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
10720 self._delegate = Some(new_value);
10721 self
10722 }
10723
10724 /// Set any additional parameter of the query string used in the request.
10725 /// It should be used to set parameters which are not yet available through their own
10726 /// setters.
10727 ///
10728 /// Please note that this method must not be used to set any of the known parameters
10729 /// which have their own setter method. If done anyway, the request will fail.
10730 ///
10731 /// # Additional Parameters
10732 ///
10733 /// * *$.xgafv* (query-string) - V1 error format.
10734 /// * *access_token* (query-string) - OAuth access token.
10735 /// * *alt* (query-string) - Data format for response.
10736 /// * *callback* (query-string) - JSONP
10737 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10738 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10739 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10740 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10741 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10742 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10743 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10744 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryPatchCall<'a, C>
10745 where
10746 T: AsRef<str>,
10747 {
10748 self._additional_params
10749 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10750 self
10751 }
10752
10753 /// Identifies the authorization scope for the method you are building.
10754 ///
10755 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10756 /// [`Scope::CloudPlatform`].
10757 ///
10758 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10759 /// tokens for more than one scope.
10760 ///
10761 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10762 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10763 /// sufficient, a read-write scope will do as well.
10764 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryPatchCall<'a, C>
10765 where
10766 St: AsRef<str>,
10767 {
10768 self._scopes.insert(String::from(scope.as_ref()));
10769 self
10770 }
10771 /// Identifies the authorization scope(s) for the method you are building.
10772 ///
10773 /// See [`Self::add_scope()`] for details.
10774 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryPatchCall<'a, C>
10775 where
10776 I: IntoIterator<Item = St>,
10777 St: AsRef<str>,
10778 {
10779 self._scopes
10780 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10781 self
10782 }
10783
10784 /// Removes all scopes, and no default scope will be used either.
10785 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10786 /// for details).
10787 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
10788 self._scopes.clear();
10789 self
10790 }
10791}
10792
10793/// Marks an Entry as starred by the current user. Starring information is private to each user.
10794///
10795/// A builder for the *locations.entryGroups.entries.star* method supported by a *project* resource.
10796/// It is not used directly, but through a [`ProjectMethods`] instance.
10797///
10798/// # Example
10799///
10800/// Instantiate a resource method builder
10801///
10802/// ```test_harness,no_run
10803/// # extern crate hyper;
10804/// # extern crate hyper_rustls;
10805/// # extern crate google_datacatalog1 as datacatalog1;
10806/// use datacatalog1::api::GoogleCloudDatacatalogV1StarEntryRequest;
10807/// # async fn dox() {
10808/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10809///
10810/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10811/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10812/// # .with_native_roots()
10813/// # .unwrap()
10814/// # .https_only()
10815/// # .enable_http2()
10816/// # .build();
10817///
10818/// # let executor = hyper_util::rt::TokioExecutor::new();
10819/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10820/// # secret,
10821/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10822/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10823/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10824/// # ),
10825/// # ).build().await.unwrap();
10826///
10827/// # let client = hyper_util::client::legacy::Client::builder(
10828/// # hyper_util::rt::TokioExecutor::new()
10829/// # )
10830/// # .build(
10831/// # hyper_rustls::HttpsConnectorBuilder::new()
10832/// # .with_native_roots()
10833/// # .unwrap()
10834/// # .https_or_http()
10835/// # .enable_http2()
10836/// # .build()
10837/// # );
10838/// # let mut hub = DataCatalog::new(client, auth);
10839/// // As the method needs a request, you would usually fill it with the desired information
10840/// // into the respective structure. Some of the parts shown here might not be applicable !
10841/// // Values shown here are possibly random and not representative !
10842/// let mut req = GoogleCloudDatacatalogV1StarEntryRequest::default();
10843///
10844/// // You can configure optional parameters by calling the respective setters at will, and
10845/// // execute the final call using `doit()`.
10846/// // Values shown here are possibly random and not representative !
10847/// let result = hub.projects().locations_entry_groups_entries_star(req, "name")
10848/// .doit().await;
10849/// # }
10850/// ```
10851pub struct ProjectLocationEntryGroupEntryStarCall<'a, C>
10852where
10853 C: 'a,
10854{
10855 hub: &'a DataCatalog<C>,
10856 _request: GoogleCloudDatacatalogV1StarEntryRequest,
10857 _name: String,
10858 _delegate: Option<&'a mut dyn common::Delegate>,
10859 _additional_params: HashMap<String, String>,
10860 _scopes: BTreeSet<String>,
10861}
10862
10863impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryStarCall<'a, C> {}
10864
10865impl<'a, C> ProjectLocationEntryGroupEntryStarCall<'a, C>
10866where
10867 C: common::Connector,
10868{
10869 /// Perform the operation you have build so far.
10870 pub async fn doit(
10871 mut self,
10872 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1StarEntryResponse)> {
10873 use std::borrow::Cow;
10874 use std::io::{Read, Seek};
10875
10876 use common::{url::Params, ToParts};
10877 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10878
10879 let mut dd = common::DefaultDelegate;
10880 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10881 dlg.begin(common::MethodInfo {
10882 id: "datacatalog.projects.locations.entryGroups.entries.star",
10883 http_method: hyper::Method::POST,
10884 });
10885
10886 for &field in ["alt", "name"].iter() {
10887 if self._additional_params.contains_key(field) {
10888 dlg.finished(false);
10889 return Err(common::Error::FieldClash(field));
10890 }
10891 }
10892
10893 let mut params = Params::with_capacity(4 + self._additional_params.len());
10894 params.push("name", self._name);
10895
10896 params.extend(self._additional_params.iter());
10897
10898 params.push("alt", "json");
10899 let mut url = self.hub._base_url.clone() + "v1/{+name}:star";
10900 if self._scopes.is_empty() {
10901 self._scopes
10902 .insert(Scope::CloudPlatform.as_ref().to_string());
10903 }
10904
10905 #[allow(clippy::single_element_loop)]
10906 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10907 url = params.uri_replacement(url, param_name, find_this, true);
10908 }
10909 {
10910 let to_remove = ["name"];
10911 params.remove_params(&to_remove);
10912 }
10913
10914 let url = params.parse_with_url(&url);
10915
10916 let mut json_mime_type = mime::APPLICATION_JSON;
10917 let mut request_value_reader = {
10918 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10919 common::remove_json_null_values(&mut value);
10920 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10921 serde_json::to_writer(&mut dst, &value).unwrap();
10922 dst
10923 };
10924 let request_size = request_value_reader
10925 .seek(std::io::SeekFrom::End(0))
10926 .unwrap();
10927 request_value_reader
10928 .seek(std::io::SeekFrom::Start(0))
10929 .unwrap();
10930
10931 loop {
10932 let token = match self
10933 .hub
10934 .auth
10935 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10936 .await
10937 {
10938 Ok(token) => token,
10939 Err(e) => match dlg.token(e) {
10940 Ok(token) => token,
10941 Err(e) => {
10942 dlg.finished(false);
10943 return Err(common::Error::MissingToken(e));
10944 }
10945 },
10946 };
10947 request_value_reader
10948 .seek(std::io::SeekFrom::Start(0))
10949 .unwrap();
10950 let mut req_result = {
10951 let client = &self.hub.client;
10952 dlg.pre_request();
10953 let mut req_builder = hyper::Request::builder()
10954 .method(hyper::Method::POST)
10955 .uri(url.as_str())
10956 .header(USER_AGENT, self.hub._user_agent.clone());
10957
10958 if let Some(token) = token.as_ref() {
10959 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10960 }
10961
10962 let request = req_builder
10963 .header(CONTENT_TYPE, json_mime_type.to_string())
10964 .header(CONTENT_LENGTH, request_size as u64)
10965 .body(common::to_body(
10966 request_value_reader.get_ref().clone().into(),
10967 ));
10968
10969 client.request(request.unwrap()).await
10970 };
10971
10972 match req_result {
10973 Err(err) => {
10974 if let common::Retry::After(d) = dlg.http_error(&err) {
10975 sleep(d).await;
10976 continue;
10977 }
10978 dlg.finished(false);
10979 return Err(common::Error::HttpError(err));
10980 }
10981 Ok(res) => {
10982 let (mut parts, body) = res.into_parts();
10983 let mut body = common::Body::new(body);
10984 if !parts.status.is_success() {
10985 let bytes = common::to_bytes(body).await.unwrap_or_default();
10986 let error = serde_json::from_str(&common::to_string(&bytes));
10987 let response = common::to_response(parts, bytes.into());
10988
10989 if let common::Retry::After(d) =
10990 dlg.http_failure(&response, error.as_ref().ok())
10991 {
10992 sleep(d).await;
10993 continue;
10994 }
10995
10996 dlg.finished(false);
10997
10998 return Err(match error {
10999 Ok(value) => common::Error::BadRequest(value),
11000 _ => common::Error::Failure(response),
11001 });
11002 }
11003 let response = {
11004 let bytes = common::to_bytes(body).await.unwrap_or_default();
11005 let encoded = common::to_string(&bytes);
11006 match serde_json::from_str(&encoded) {
11007 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11008 Err(error) => {
11009 dlg.response_json_decode_error(&encoded, &error);
11010 return Err(common::Error::JsonDecodeError(
11011 encoded.to_string(),
11012 error,
11013 ));
11014 }
11015 }
11016 };
11017
11018 dlg.finished(true);
11019 return Ok(response);
11020 }
11021 }
11022 }
11023 }
11024
11025 ///
11026 /// Sets the *request* property to the given value.
11027 ///
11028 /// Even though the property as already been set when instantiating this call,
11029 /// we provide this method for API completeness.
11030 pub fn request(
11031 mut self,
11032 new_value: GoogleCloudDatacatalogV1StarEntryRequest,
11033 ) -> ProjectLocationEntryGroupEntryStarCall<'a, C> {
11034 self._request = new_value;
11035 self
11036 }
11037 /// Required. The name of the entry to mark as starred.
11038 ///
11039 /// Sets the *name* path property to the given value.
11040 ///
11041 /// Even though the property as already been set when instantiating this call,
11042 /// we provide this method for API completeness.
11043 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryStarCall<'a, C> {
11044 self._name = new_value.to_string();
11045 self
11046 }
11047 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11048 /// while executing the actual API request.
11049 ///
11050 /// ````text
11051 /// It should be used to handle progress information, and to implement a certain level of resilience.
11052 /// ````
11053 ///
11054 /// Sets the *delegate* property to the given value.
11055 pub fn delegate(
11056 mut self,
11057 new_value: &'a mut dyn common::Delegate,
11058 ) -> ProjectLocationEntryGroupEntryStarCall<'a, C> {
11059 self._delegate = Some(new_value);
11060 self
11061 }
11062
11063 /// Set any additional parameter of the query string used in the request.
11064 /// It should be used to set parameters which are not yet available through their own
11065 /// setters.
11066 ///
11067 /// Please note that this method must not be used to set any of the known parameters
11068 /// which have their own setter method. If done anyway, the request will fail.
11069 ///
11070 /// # Additional Parameters
11071 ///
11072 /// * *$.xgafv* (query-string) - V1 error format.
11073 /// * *access_token* (query-string) - OAuth access token.
11074 /// * *alt* (query-string) - Data format for response.
11075 /// * *callback* (query-string) - JSONP
11076 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11077 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11078 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11079 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11080 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11081 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11082 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11083 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryStarCall<'a, C>
11084 where
11085 T: AsRef<str>,
11086 {
11087 self._additional_params
11088 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11089 self
11090 }
11091
11092 /// Identifies the authorization scope for the method you are building.
11093 ///
11094 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11095 /// [`Scope::CloudPlatform`].
11096 ///
11097 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11098 /// tokens for more than one scope.
11099 ///
11100 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11101 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11102 /// sufficient, a read-write scope will do as well.
11103 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryStarCall<'a, C>
11104 where
11105 St: AsRef<str>,
11106 {
11107 self._scopes.insert(String::from(scope.as_ref()));
11108 self
11109 }
11110 /// Identifies the authorization scope(s) for the method you are building.
11111 ///
11112 /// See [`Self::add_scope()`] for details.
11113 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryStarCall<'a, C>
11114 where
11115 I: IntoIterator<Item = St>,
11116 St: AsRef<str>,
11117 {
11118 self._scopes
11119 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11120 self
11121 }
11122
11123 /// Removes all scopes, and no default scope will be used either.
11124 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11125 /// for details).
11126 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryStarCall<'a, C> {
11127 self._scopes.clear();
11128 self
11129 }
11130}
11131
11132/// Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist. Supported resources are: - Tag templates - Entry groups Note: This method gets policies only within Data Catalog and can't be used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources ingested into Data Catalog. No Google IAM permissions are required to call this method.
11133///
11134/// A builder for the *locations.entryGroups.entries.testIamPermissions* method supported by a *project* resource.
11135/// It is not used directly, but through a [`ProjectMethods`] instance.
11136///
11137/// # Example
11138///
11139/// Instantiate a resource method builder
11140///
11141/// ```test_harness,no_run
11142/// # extern crate hyper;
11143/// # extern crate hyper_rustls;
11144/// # extern crate google_datacatalog1 as datacatalog1;
11145/// use datacatalog1::api::TestIamPermissionsRequest;
11146/// # async fn dox() {
11147/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11148///
11149/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11150/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11151/// # .with_native_roots()
11152/// # .unwrap()
11153/// # .https_only()
11154/// # .enable_http2()
11155/// # .build();
11156///
11157/// # let executor = hyper_util::rt::TokioExecutor::new();
11158/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11159/// # secret,
11160/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11161/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11162/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11163/// # ),
11164/// # ).build().await.unwrap();
11165///
11166/// # let client = hyper_util::client::legacy::Client::builder(
11167/// # hyper_util::rt::TokioExecutor::new()
11168/// # )
11169/// # .build(
11170/// # hyper_rustls::HttpsConnectorBuilder::new()
11171/// # .with_native_roots()
11172/// # .unwrap()
11173/// # .https_or_http()
11174/// # .enable_http2()
11175/// # .build()
11176/// # );
11177/// # let mut hub = DataCatalog::new(client, auth);
11178/// // As the method needs a request, you would usually fill it with the desired information
11179/// // into the respective structure. Some of the parts shown here might not be applicable !
11180/// // Values shown here are possibly random and not representative !
11181/// let mut req = TestIamPermissionsRequest::default();
11182///
11183/// // You can configure optional parameters by calling the respective setters at will, and
11184/// // execute the final call using `doit()`.
11185/// // Values shown here are possibly random and not representative !
11186/// let result = hub.projects().locations_entry_groups_entries_test_iam_permissions(req, "resource")
11187/// .doit().await;
11188/// # }
11189/// ```
11190pub struct ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
11191where
11192 C: 'a,
11193{
11194 hub: &'a DataCatalog<C>,
11195 _request: TestIamPermissionsRequest,
11196 _resource: String,
11197 _delegate: Option<&'a mut dyn common::Delegate>,
11198 _additional_params: HashMap<String, String>,
11199 _scopes: BTreeSet<String>,
11200}
11201
11202impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {}
11203
11204impl<'a, C> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
11205where
11206 C: common::Connector,
11207{
11208 /// Perform the operation you have build so far.
11209 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
11210 use std::borrow::Cow;
11211 use std::io::{Read, Seek};
11212
11213 use common::{url::Params, ToParts};
11214 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11215
11216 let mut dd = common::DefaultDelegate;
11217 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11218 dlg.begin(common::MethodInfo {
11219 id: "datacatalog.projects.locations.entryGroups.entries.testIamPermissions",
11220 http_method: hyper::Method::POST,
11221 });
11222
11223 for &field in ["alt", "resource"].iter() {
11224 if self._additional_params.contains_key(field) {
11225 dlg.finished(false);
11226 return Err(common::Error::FieldClash(field));
11227 }
11228 }
11229
11230 let mut params = Params::with_capacity(4 + self._additional_params.len());
11231 params.push("resource", self._resource);
11232
11233 params.extend(self._additional_params.iter());
11234
11235 params.push("alt", "json");
11236 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
11237 if self._scopes.is_empty() {
11238 self._scopes
11239 .insert(Scope::CloudPlatform.as_ref().to_string());
11240 }
11241
11242 #[allow(clippy::single_element_loop)]
11243 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11244 url = params.uri_replacement(url, param_name, find_this, true);
11245 }
11246 {
11247 let to_remove = ["resource"];
11248 params.remove_params(&to_remove);
11249 }
11250
11251 let url = params.parse_with_url(&url);
11252
11253 let mut json_mime_type = mime::APPLICATION_JSON;
11254 let mut request_value_reader = {
11255 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11256 common::remove_json_null_values(&mut value);
11257 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11258 serde_json::to_writer(&mut dst, &value).unwrap();
11259 dst
11260 };
11261 let request_size = request_value_reader
11262 .seek(std::io::SeekFrom::End(0))
11263 .unwrap();
11264 request_value_reader
11265 .seek(std::io::SeekFrom::Start(0))
11266 .unwrap();
11267
11268 loop {
11269 let token = match self
11270 .hub
11271 .auth
11272 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11273 .await
11274 {
11275 Ok(token) => token,
11276 Err(e) => match dlg.token(e) {
11277 Ok(token) => token,
11278 Err(e) => {
11279 dlg.finished(false);
11280 return Err(common::Error::MissingToken(e));
11281 }
11282 },
11283 };
11284 request_value_reader
11285 .seek(std::io::SeekFrom::Start(0))
11286 .unwrap();
11287 let mut req_result = {
11288 let client = &self.hub.client;
11289 dlg.pre_request();
11290 let mut req_builder = hyper::Request::builder()
11291 .method(hyper::Method::POST)
11292 .uri(url.as_str())
11293 .header(USER_AGENT, self.hub._user_agent.clone());
11294
11295 if let Some(token) = token.as_ref() {
11296 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11297 }
11298
11299 let request = req_builder
11300 .header(CONTENT_TYPE, json_mime_type.to_string())
11301 .header(CONTENT_LENGTH, request_size as u64)
11302 .body(common::to_body(
11303 request_value_reader.get_ref().clone().into(),
11304 ));
11305
11306 client.request(request.unwrap()).await
11307 };
11308
11309 match req_result {
11310 Err(err) => {
11311 if let common::Retry::After(d) = dlg.http_error(&err) {
11312 sleep(d).await;
11313 continue;
11314 }
11315 dlg.finished(false);
11316 return Err(common::Error::HttpError(err));
11317 }
11318 Ok(res) => {
11319 let (mut parts, body) = res.into_parts();
11320 let mut body = common::Body::new(body);
11321 if !parts.status.is_success() {
11322 let bytes = common::to_bytes(body).await.unwrap_or_default();
11323 let error = serde_json::from_str(&common::to_string(&bytes));
11324 let response = common::to_response(parts, bytes.into());
11325
11326 if let common::Retry::After(d) =
11327 dlg.http_failure(&response, error.as_ref().ok())
11328 {
11329 sleep(d).await;
11330 continue;
11331 }
11332
11333 dlg.finished(false);
11334
11335 return Err(match error {
11336 Ok(value) => common::Error::BadRequest(value),
11337 _ => common::Error::Failure(response),
11338 });
11339 }
11340 let response = {
11341 let bytes = common::to_bytes(body).await.unwrap_or_default();
11342 let encoded = common::to_string(&bytes);
11343 match serde_json::from_str(&encoded) {
11344 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11345 Err(error) => {
11346 dlg.response_json_decode_error(&encoded, &error);
11347 return Err(common::Error::JsonDecodeError(
11348 encoded.to_string(),
11349 error,
11350 ));
11351 }
11352 }
11353 };
11354
11355 dlg.finished(true);
11356 return Ok(response);
11357 }
11358 }
11359 }
11360 }
11361
11362 ///
11363 /// Sets the *request* property to the given value.
11364 ///
11365 /// Even though the property as already been set when instantiating this call,
11366 /// we provide this method for API completeness.
11367 pub fn request(
11368 mut self,
11369 new_value: TestIamPermissionsRequest,
11370 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
11371 self._request = new_value;
11372 self
11373 }
11374 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
11375 ///
11376 /// Sets the *resource* path property to the given value.
11377 ///
11378 /// Even though the property as already been set when instantiating this call,
11379 /// we provide this method for API completeness.
11380 pub fn resource(
11381 mut self,
11382 new_value: &str,
11383 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
11384 self._resource = new_value.to_string();
11385 self
11386 }
11387 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11388 /// while executing the actual API request.
11389 ///
11390 /// ````text
11391 /// It should be used to handle progress information, and to implement a certain level of resilience.
11392 /// ````
11393 ///
11394 /// Sets the *delegate* property to the given value.
11395 pub fn delegate(
11396 mut self,
11397 new_value: &'a mut dyn common::Delegate,
11398 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
11399 self._delegate = Some(new_value);
11400 self
11401 }
11402
11403 /// Set any additional parameter of the query string used in the request.
11404 /// It should be used to set parameters which are not yet available through their own
11405 /// setters.
11406 ///
11407 /// Please note that this method must not be used to set any of the known parameters
11408 /// which have their own setter method. If done anyway, the request will fail.
11409 ///
11410 /// # Additional Parameters
11411 ///
11412 /// * *$.xgafv* (query-string) - V1 error format.
11413 /// * *access_token* (query-string) - OAuth access token.
11414 /// * *alt* (query-string) - Data format for response.
11415 /// * *callback* (query-string) - JSONP
11416 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11417 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11418 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11419 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11420 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11421 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11422 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11423 pub fn param<T>(
11424 mut self,
11425 name: T,
11426 value: T,
11427 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
11428 where
11429 T: AsRef<str>,
11430 {
11431 self._additional_params
11432 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11433 self
11434 }
11435
11436 /// Identifies the authorization scope for the method you are building.
11437 ///
11438 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11439 /// [`Scope::CloudPlatform`].
11440 ///
11441 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11442 /// tokens for more than one scope.
11443 ///
11444 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11445 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11446 /// sufficient, a read-write scope will do as well.
11447 pub fn add_scope<St>(
11448 mut self,
11449 scope: St,
11450 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
11451 where
11452 St: AsRef<str>,
11453 {
11454 self._scopes.insert(String::from(scope.as_ref()));
11455 self
11456 }
11457 /// Identifies the authorization scope(s) for the method you are building.
11458 ///
11459 /// See [`Self::add_scope()`] for details.
11460 pub fn add_scopes<I, St>(
11461 mut self,
11462 scopes: I,
11463 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
11464 where
11465 I: IntoIterator<Item = St>,
11466 St: AsRef<str>,
11467 {
11468 self._scopes
11469 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11470 self
11471 }
11472
11473 /// Removes all scopes, and no default scope will be used either.
11474 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11475 /// for details).
11476 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
11477 self._scopes.clear();
11478 self
11479 }
11480}
11481
11482/// Marks an Entry as NOT starred by the current user. Starring information is private to each user.
11483///
11484/// A builder for the *locations.entryGroups.entries.unstar* method supported by a *project* resource.
11485/// It is not used directly, but through a [`ProjectMethods`] instance.
11486///
11487/// # Example
11488///
11489/// Instantiate a resource method builder
11490///
11491/// ```test_harness,no_run
11492/// # extern crate hyper;
11493/// # extern crate hyper_rustls;
11494/// # extern crate google_datacatalog1 as datacatalog1;
11495/// use datacatalog1::api::GoogleCloudDatacatalogV1UnstarEntryRequest;
11496/// # async fn dox() {
11497/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11498///
11499/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11500/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11501/// # .with_native_roots()
11502/// # .unwrap()
11503/// # .https_only()
11504/// # .enable_http2()
11505/// # .build();
11506///
11507/// # let executor = hyper_util::rt::TokioExecutor::new();
11508/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11509/// # secret,
11510/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11511/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11512/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11513/// # ),
11514/// # ).build().await.unwrap();
11515///
11516/// # let client = hyper_util::client::legacy::Client::builder(
11517/// # hyper_util::rt::TokioExecutor::new()
11518/// # )
11519/// # .build(
11520/// # hyper_rustls::HttpsConnectorBuilder::new()
11521/// # .with_native_roots()
11522/// # .unwrap()
11523/// # .https_or_http()
11524/// # .enable_http2()
11525/// # .build()
11526/// # );
11527/// # let mut hub = DataCatalog::new(client, auth);
11528/// // As the method needs a request, you would usually fill it with the desired information
11529/// // into the respective structure. Some of the parts shown here might not be applicable !
11530/// // Values shown here are possibly random and not representative !
11531/// let mut req = GoogleCloudDatacatalogV1UnstarEntryRequest::default();
11532///
11533/// // You can configure optional parameters by calling the respective setters at will, and
11534/// // execute the final call using `doit()`.
11535/// // Values shown here are possibly random and not representative !
11536/// let result = hub.projects().locations_entry_groups_entries_unstar(req, "name")
11537/// .doit().await;
11538/// # }
11539/// ```
11540pub struct ProjectLocationEntryGroupEntryUnstarCall<'a, C>
11541where
11542 C: 'a,
11543{
11544 hub: &'a DataCatalog<C>,
11545 _request: GoogleCloudDatacatalogV1UnstarEntryRequest,
11546 _name: String,
11547 _delegate: Option<&'a mut dyn common::Delegate>,
11548 _additional_params: HashMap<String, String>,
11549 _scopes: BTreeSet<String>,
11550}
11551
11552impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryUnstarCall<'a, C> {}
11553
11554impl<'a, C> ProjectLocationEntryGroupEntryUnstarCall<'a, C>
11555where
11556 C: common::Connector,
11557{
11558 /// Perform the operation you have build so far.
11559 pub async fn doit(
11560 mut self,
11561 ) -> common::Result<(
11562 common::Response,
11563 GoogleCloudDatacatalogV1UnstarEntryResponse,
11564 )> {
11565 use std::borrow::Cow;
11566 use std::io::{Read, Seek};
11567
11568 use common::{url::Params, ToParts};
11569 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11570
11571 let mut dd = common::DefaultDelegate;
11572 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11573 dlg.begin(common::MethodInfo {
11574 id: "datacatalog.projects.locations.entryGroups.entries.unstar",
11575 http_method: hyper::Method::POST,
11576 });
11577
11578 for &field in ["alt", "name"].iter() {
11579 if self._additional_params.contains_key(field) {
11580 dlg.finished(false);
11581 return Err(common::Error::FieldClash(field));
11582 }
11583 }
11584
11585 let mut params = Params::with_capacity(4 + self._additional_params.len());
11586 params.push("name", self._name);
11587
11588 params.extend(self._additional_params.iter());
11589
11590 params.push("alt", "json");
11591 let mut url = self.hub._base_url.clone() + "v1/{+name}:unstar";
11592 if self._scopes.is_empty() {
11593 self._scopes
11594 .insert(Scope::CloudPlatform.as_ref().to_string());
11595 }
11596
11597 #[allow(clippy::single_element_loop)]
11598 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11599 url = params.uri_replacement(url, param_name, find_this, true);
11600 }
11601 {
11602 let to_remove = ["name"];
11603 params.remove_params(&to_remove);
11604 }
11605
11606 let url = params.parse_with_url(&url);
11607
11608 let mut json_mime_type = mime::APPLICATION_JSON;
11609 let mut request_value_reader = {
11610 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11611 common::remove_json_null_values(&mut value);
11612 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11613 serde_json::to_writer(&mut dst, &value).unwrap();
11614 dst
11615 };
11616 let request_size = request_value_reader
11617 .seek(std::io::SeekFrom::End(0))
11618 .unwrap();
11619 request_value_reader
11620 .seek(std::io::SeekFrom::Start(0))
11621 .unwrap();
11622
11623 loop {
11624 let token = match self
11625 .hub
11626 .auth
11627 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11628 .await
11629 {
11630 Ok(token) => token,
11631 Err(e) => match dlg.token(e) {
11632 Ok(token) => token,
11633 Err(e) => {
11634 dlg.finished(false);
11635 return Err(common::Error::MissingToken(e));
11636 }
11637 },
11638 };
11639 request_value_reader
11640 .seek(std::io::SeekFrom::Start(0))
11641 .unwrap();
11642 let mut req_result = {
11643 let client = &self.hub.client;
11644 dlg.pre_request();
11645 let mut req_builder = hyper::Request::builder()
11646 .method(hyper::Method::POST)
11647 .uri(url.as_str())
11648 .header(USER_AGENT, self.hub._user_agent.clone());
11649
11650 if let Some(token) = token.as_ref() {
11651 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11652 }
11653
11654 let request = req_builder
11655 .header(CONTENT_TYPE, json_mime_type.to_string())
11656 .header(CONTENT_LENGTH, request_size as u64)
11657 .body(common::to_body(
11658 request_value_reader.get_ref().clone().into(),
11659 ));
11660
11661 client.request(request.unwrap()).await
11662 };
11663
11664 match req_result {
11665 Err(err) => {
11666 if let common::Retry::After(d) = dlg.http_error(&err) {
11667 sleep(d).await;
11668 continue;
11669 }
11670 dlg.finished(false);
11671 return Err(common::Error::HttpError(err));
11672 }
11673 Ok(res) => {
11674 let (mut parts, body) = res.into_parts();
11675 let mut body = common::Body::new(body);
11676 if !parts.status.is_success() {
11677 let bytes = common::to_bytes(body).await.unwrap_or_default();
11678 let error = serde_json::from_str(&common::to_string(&bytes));
11679 let response = common::to_response(parts, bytes.into());
11680
11681 if let common::Retry::After(d) =
11682 dlg.http_failure(&response, error.as_ref().ok())
11683 {
11684 sleep(d).await;
11685 continue;
11686 }
11687
11688 dlg.finished(false);
11689
11690 return Err(match error {
11691 Ok(value) => common::Error::BadRequest(value),
11692 _ => common::Error::Failure(response),
11693 });
11694 }
11695 let response = {
11696 let bytes = common::to_bytes(body).await.unwrap_or_default();
11697 let encoded = common::to_string(&bytes);
11698 match serde_json::from_str(&encoded) {
11699 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11700 Err(error) => {
11701 dlg.response_json_decode_error(&encoded, &error);
11702 return Err(common::Error::JsonDecodeError(
11703 encoded.to_string(),
11704 error,
11705 ));
11706 }
11707 }
11708 };
11709
11710 dlg.finished(true);
11711 return Ok(response);
11712 }
11713 }
11714 }
11715 }
11716
11717 ///
11718 /// Sets the *request* property to the given value.
11719 ///
11720 /// Even though the property as already been set when instantiating this call,
11721 /// we provide this method for API completeness.
11722 pub fn request(
11723 mut self,
11724 new_value: GoogleCloudDatacatalogV1UnstarEntryRequest,
11725 ) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C> {
11726 self._request = new_value;
11727 self
11728 }
11729 /// Required. The name of the entry to mark as **not** starred.
11730 ///
11731 /// Sets the *name* path property to the given value.
11732 ///
11733 /// Even though the property as already been set when instantiating this call,
11734 /// we provide this method for API completeness.
11735 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C> {
11736 self._name = new_value.to_string();
11737 self
11738 }
11739 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11740 /// while executing the actual API request.
11741 ///
11742 /// ````text
11743 /// It should be used to handle progress information, and to implement a certain level of resilience.
11744 /// ````
11745 ///
11746 /// Sets the *delegate* property to the given value.
11747 pub fn delegate(
11748 mut self,
11749 new_value: &'a mut dyn common::Delegate,
11750 ) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C> {
11751 self._delegate = Some(new_value);
11752 self
11753 }
11754
11755 /// Set any additional parameter of the query string used in the request.
11756 /// It should be used to set parameters which are not yet available through their own
11757 /// setters.
11758 ///
11759 /// Please note that this method must not be used to set any of the known parameters
11760 /// which have their own setter method. If done anyway, the request will fail.
11761 ///
11762 /// # Additional Parameters
11763 ///
11764 /// * *$.xgafv* (query-string) - V1 error format.
11765 /// * *access_token* (query-string) - OAuth access token.
11766 /// * *alt* (query-string) - Data format for response.
11767 /// * *callback* (query-string) - JSONP
11768 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11769 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11770 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11771 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11772 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11773 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11774 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11775 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C>
11776 where
11777 T: AsRef<str>,
11778 {
11779 self._additional_params
11780 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11781 self
11782 }
11783
11784 /// Identifies the authorization scope for the method you are building.
11785 ///
11786 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11787 /// [`Scope::CloudPlatform`].
11788 ///
11789 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11790 /// tokens for more than one scope.
11791 ///
11792 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11793 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11794 /// sufficient, a read-write scope will do as well.
11795 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C>
11796 where
11797 St: AsRef<str>,
11798 {
11799 self._scopes.insert(String::from(scope.as_ref()));
11800 self
11801 }
11802 /// Identifies the authorization scope(s) for the method you are building.
11803 ///
11804 /// See [`Self::add_scope()`] for details.
11805 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C>
11806 where
11807 I: IntoIterator<Item = St>,
11808 St: AsRef<str>,
11809 {
11810 self._scopes
11811 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11812 self
11813 }
11814
11815 /// Removes all scopes, and no default scope will be used either.
11816 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11817 /// for details).
11818 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryUnstarCall<'a, C> {
11819 self._scopes.clear();
11820 self
11821 }
11822}
11823
11824/// Creates a tag and assigns it to: * An Entry if the method name is `projects.locations.entryGroups.entries.tags.create`. * Or EntryGroupif the method name is `projects.locations.entryGroups.tags.create`. Note: The project identified by the `parent` parameter for the [tag] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template] (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be in the same organization.
11825///
11826/// A builder for the *locations.entryGroups.tags.create* method supported by a *project* resource.
11827/// It is not used directly, but through a [`ProjectMethods`] instance.
11828///
11829/// # Example
11830///
11831/// Instantiate a resource method builder
11832///
11833/// ```test_harness,no_run
11834/// # extern crate hyper;
11835/// # extern crate hyper_rustls;
11836/// # extern crate google_datacatalog1 as datacatalog1;
11837/// use datacatalog1::api::GoogleCloudDatacatalogV1Tag;
11838/// # async fn dox() {
11839/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11840///
11841/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11842/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11843/// # .with_native_roots()
11844/// # .unwrap()
11845/// # .https_only()
11846/// # .enable_http2()
11847/// # .build();
11848///
11849/// # let executor = hyper_util::rt::TokioExecutor::new();
11850/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11851/// # secret,
11852/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11853/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11854/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11855/// # ),
11856/// # ).build().await.unwrap();
11857///
11858/// # let client = hyper_util::client::legacy::Client::builder(
11859/// # hyper_util::rt::TokioExecutor::new()
11860/// # )
11861/// # .build(
11862/// # hyper_rustls::HttpsConnectorBuilder::new()
11863/// # .with_native_roots()
11864/// # .unwrap()
11865/// # .https_or_http()
11866/// # .enable_http2()
11867/// # .build()
11868/// # );
11869/// # let mut hub = DataCatalog::new(client, auth);
11870/// // As the method needs a request, you would usually fill it with the desired information
11871/// // into the respective structure. Some of the parts shown here might not be applicable !
11872/// // Values shown here are possibly random and not representative !
11873/// let mut req = GoogleCloudDatacatalogV1Tag::default();
11874///
11875/// // You can configure optional parameters by calling the respective setters at will, and
11876/// // execute the final call using `doit()`.
11877/// // Values shown here are possibly random and not representative !
11878/// let result = hub.projects().locations_entry_groups_tags_create(req, "parent")
11879/// .doit().await;
11880/// # }
11881/// ```
11882pub struct ProjectLocationEntryGroupTagCreateCall<'a, C>
11883where
11884 C: 'a,
11885{
11886 hub: &'a DataCatalog<C>,
11887 _request: GoogleCloudDatacatalogV1Tag,
11888 _parent: String,
11889 _delegate: Option<&'a mut dyn common::Delegate>,
11890 _additional_params: HashMap<String, String>,
11891 _scopes: BTreeSet<String>,
11892}
11893
11894impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagCreateCall<'a, C> {}
11895
11896impl<'a, C> ProjectLocationEntryGroupTagCreateCall<'a, C>
11897where
11898 C: common::Connector,
11899{
11900 /// Perform the operation you have build so far.
11901 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Tag)> {
11902 use std::borrow::Cow;
11903 use std::io::{Read, Seek};
11904
11905 use common::{url::Params, ToParts};
11906 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11907
11908 let mut dd = common::DefaultDelegate;
11909 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11910 dlg.begin(common::MethodInfo {
11911 id: "datacatalog.projects.locations.entryGroups.tags.create",
11912 http_method: hyper::Method::POST,
11913 });
11914
11915 for &field in ["alt", "parent"].iter() {
11916 if self._additional_params.contains_key(field) {
11917 dlg.finished(false);
11918 return Err(common::Error::FieldClash(field));
11919 }
11920 }
11921
11922 let mut params = Params::with_capacity(4 + self._additional_params.len());
11923 params.push("parent", self._parent);
11924
11925 params.extend(self._additional_params.iter());
11926
11927 params.push("alt", "json");
11928 let mut url = self.hub._base_url.clone() + "v1/{+parent}/tags";
11929 if self._scopes.is_empty() {
11930 self._scopes
11931 .insert(Scope::CloudPlatform.as_ref().to_string());
11932 }
11933
11934 #[allow(clippy::single_element_loop)]
11935 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11936 url = params.uri_replacement(url, param_name, find_this, true);
11937 }
11938 {
11939 let to_remove = ["parent"];
11940 params.remove_params(&to_remove);
11941 }
11942
11943 let url = params.parse_with_url(&url);
11944
11945 let mut json_mime_type = mime::APPLICATION_JSON;
11946 let mut request_value_reader = {
11947 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11948 common::remove_json_null_values(&mut value);
11949 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11950 serde_json::to_writer(&mut dst, &value).unwrap();
11951 dst
11952 };
11953 let request_size = request_value_reader
11954 .seek(std::io::SeekFrom::End(0))
11955 .unwrap();
11956 request_value_reader
11957 .seek(std::io::SeekFrom::Start(0))
11958 .unwrap();
11959
11960 loop {
11961 let token = match self
11962 .hub
11963 .auth
11964 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11965 .await
11966 {
11967 Ok(token) => token,
11968 Err(e) => match dlg.token(e) {
11969 Ok(token) => token,
11970 Err(e) => {
11971 dlg.finished(false);
11972 return Err(common::Error::MissingToken(e));
11973 }
11974 },
11975 };
11976 request_value_reader
11977 .seek(std::io::SeekFrom::Start(0))
11978 .unwrap();
11979 let mut req_result = {
11980 let client = &self.hub.client;
11981 dlg.pre_request();
11982 let mut req_builder = hyper::Request::builder()
11983 .method(hyper::Method::POST)
11984 .uri(url.as_str())
11985 .header(USER_AGENT, self.hub._user_agent.clone());
11986
11987 if let Some(token) = token.as_ref() {
11988 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11989 }
11990
11991 let request = req_builder
11992 .header(CONTENT_TYPE, json_mime_type.to_string())
11993 .header(CONTENT_LENGTH, request_size as u64)
11994 .body(common::to_body(
11995 request_value_reader.get_ref().clone().into(),
11996 ));
11997
11998 client.request(request.unwrap()).await
11999 };
12000
12001 match req_result {
12002 Err(err) => {
12003 if let common::Retry::After(d) = dlg.http_error(&err) {
12004 sleep(d).await;
12005 continue;
12006 }
12007 dlg.finished(false);
12008 return Err(common::Error::HttpError(err));
12009 }
12010 Ok(res) => {
12011 let (mut parts, body) = res.into_parts();
12012 let mut body = common::Body::new(body);
12013 if !parts.status.is_success() {
12014 let bytes = common::to_bytes(body).await.unwrap_or_default();
12015 let error = serde_json::from_str(&common::to_string(&bytes));
12016 let response = common::to_response(parts, bytes.into());
12017
12018 if let common::Retry::After(d) =
12019 dlg.http_failure(&response, error.as_ref().ok())
12020 {
12021 sleep(d).await;
12022 continue;
12023 }
12024
12025 dlg.finished(false);
12026
12027 return Err(match error {
12028 Ok(value) => common::Error::BadRequest(value),
12029 _ => common::Error::Failure(response),
12030 });
12031 }
12032 let response = {
12033 let bytes = common::to_bytes(body).await.unwrap_or_default();
12034 let encoded = common::to_string(&bytes);
12035 match serde_json::from_str(&encoded) {
12036 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12037 Err(error) => {
12038 dlg.response_json_decode_error(&encoded, &error);
12039 return Err(common::Error::JsonDecodeError(
12040 encoded.to_string(),
12041 error,
12042 ));
12043 }
12044 }
12045 };
12046
12047 dlg.finished(true);
12048 return Ok(response);
12049 }
12050 }
12051 }
12052 }
12053
12054 ///
12055 /// Sets the *request* property to the given value.
12056 ///
12057 /// Even though the property as already been set when instantiating this call,
12058 /// we provide this method for API completeness.
12059 pub fn request(
12060 mut self,
12061 new_value: GoogleCloudDatacatalogV1Tag,
12062 ) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
12063 self._request = new_value;
12064 self
12065 }
12066 /// Required. The name of the resource to attach this tag to. Tags can be attached to entries or entry groups. An entry can have up to 1000 attached tags. Note: The tag and its child resources might not be stored in the location specified in its name.
12067 ///
12068 /// Sets the *parent* path property to the given value.
12069 ///
12070 /// Even though the property as already been set when instantiating this call,
12071 /// we provide this method for API completeness.
12072 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
12073 self._parent = new_value.to_string();
12074 self
12075 }
12076 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12077 /// while executing the actual API request.
12078 ///
12079 /// ````text
12080 /// It should be used to handle progress information, and to implement a certain level of resilience.
12081 /// ````
12082 ///
12083 /// Sets the *delegate* property to the given value.
12084 pub fn delegate(
12085 mut self,
12086 new_value: &'a mut dyn common::Delegate,
12087 ) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
12088 self._delegate = Some(new_value);
12089 self
12090 }
12091
12092 /// Set any additional parameter of the query string used in the request.
12093 /// It should be used to set parameters which are not yet available through their own
12094 /// setters.
12095 ///
12096 /// Please note that this method must not be used to set any of the known parameters
12097 /// which have their own setter method. If done anyway, the request will fail.
12098 ///
12099 /// # Additional Parameters
12100 ///
12101 /// * *$.xgafv* (query-string) - V1 error format.
12102 /// * *access_token* (query-string) - OAuth access token.
12103 /// * *alt* (query-string) - Data format for response.
12104 /// * *callback* (query-string) - JSONP
12105 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12106 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12107 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12108 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12109 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12110 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12111 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12112 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagCreateCall<'a, C>
12113 where
12114 T: AsRef<str>,
12115 {
12116 self._additional_params
12117 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12118 self
12119 }
12120
12121 /// Identifies the authorization scope for the method you are building.
12122 ///
12123 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12124 /// [`Scope::CloudPlatform`].
12125 ///
12126 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12127 /// tokens for more than one scope.
12128 ///
12129 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12130 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12131 /// sufficient, a read-write scope will do as well.
12132 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagCreateCall<'a, C>
12133 where
12134 St: AsRef<str>,
12135 {
12136 self._scopes.insert(String::from(scope.as_ref()));
12137 self
12138 }
12139 /// Identifies the authorization scope(s) for the method you are building.
12140 ///
12141 /// See [`Self::add_scope()`] for details.
12142 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagCreateCall<'a, C>
12143 where
12144 I: IntoIterator<Item = St>,
12145 St: AsRef<str>,
12146 {
12147 self._scopes
12148 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12149 self
12150 }
12151
12152 /// Removes all scopes, and no default scope will be used either.
12153 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12154 /// for details).
12155 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
12156 self._scopes.clear();
12157 self
12158 }
12159}
12160
12161/// Deletes a tag.
12162///
12163/// A builder for the *locations.entryGroups.tags.delete* method supported by a *project* resource.
12164/// It is not used directly, but through a [`ProjectMethods`] instance.
12165///
12166/// # Example
12167///
12168/// Instantiate a resource method builder
12169///
12170/// ```test_harness,no_run
12171/// # extern crate hyper;
12172/// # extern crate hyper_rustls;
12173/// # extern crate google_datacatalog1 as datacatalog1;
12174/// # async fn dox() {
12175/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12176///
12177/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12178/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12179/// # .with_native_roots()
12180/// # .unwrap()
12181/// # .https_only()
12182/// # .enable_http2()
12183/// # .build();
12184///
12185/// # let executor = hyper_util::rt::TokioExecutor::new();
12186/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12187/// # secret,
12188/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12189/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12190/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12191/// # ),
12192/// # ).build().await.unwrap();
12193///
12194/// # let client = hyper_util::client::legacy::Client::builder(
12195/// # hyper_util::rt::TokioExecutor::new()
12196/// # )
12197/// # .build(
12198/// # hyper_rustls::HttpsConnectorBuilder::new()
12199/// # .with_native_roots()
12200/// # .unwrap()
12201/// # .https_or_http()
12202/// # .enable_http2()
12203/// # .build()
12204/// # );
12205/// # let mut hub = DataCatalog::new(client, auth);
12206/// // You can configure optional parameters by calling the respective setters at will, and
12207/// // execute the final call using `doit()`.
12208/// // Values shown here are possibly random and not representative !
12209/// let result = hub.projects().locations_entry_groups_tags_delete("name")
12210/// .doit().await;
12211/// # }
12212/// ```
12213pub struct ProjectLocationEntryGroupTagDeleteCall<'a, C>
12214where
12215 C: 'a,
12216{
12217 hub: &'a DataCatalog<C>,
12218 _name: String,
12219 _delegate: Option<&'a mut dyn common::Delegate>,
12220 _additional_params: HashMap<String, String>,
12221 _scopes: BTreeSet<String>,
12222}
12223
12224impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagDeleteCall<'a, C> {}
12225
12226impl<'a, C> ProjectLocationEntryGroupTagDeleteCall<'a, C>
12227where
12228 C: common::Connector,
12229{
12230 /// Perform the operation you have build so far.
12231 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
12232 use std::borrow::Cow;
12233 use std::io::{Read, Seek};
12234
12235 use common::{url::Params, ToParts};
12236 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12237
12238 let mut dd = common::DefaultDelegate;
12239 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12240 dlg.begin(common::MethodInfo {
12241 id: "datacatalog.projects.locations.entryGroups.tags.delete",
12242 http_method: hyper::Method::DELETE,
12243 });
12244
12245 for &field in ["alt", "name"].iter() {
12246 if self._additional_params.contains_key(field) {
12247 dlg.finished(false);
12248 return Err(common::Error::FieldClash(field));
12249 }
12250 }
12251
12252 let mut params = Params::with_capacity(3 + self._additional_params.len());
12253 params.push("name", self._name);
12254
12255 params.extend(self._additional_params.iter());
12256
12257 params.push("alt", "json");
12258 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12259 if self._scopes.is_empty() {
12260 self._scopes
12261 .insert(Scope::CloudPlatform.as_ref().to_string());
12262 }
12263
12264 #[allow(clippy::single_element_loop)]
12265 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12266 url = params.uri_replacement(url, param_name, find_this, true);
12267 }
12268 {
12269 let to_remove = ["name"];
12270 params.remove_params(&to_remove);
12271 }
12272
12273 let url = params.parse_with_url(&url);
12274
12275 loop {
12276 let token = match self
12277 .hub
12278 .auth
12279 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12280 .await
12281 {
12282 Ok(token) => token,
12283 Err(e) => match dlg.token(e) {
12284 Ok(token) => token,
12285 Err(e) => {
12286 dlg.finished(false);
12287 return Err(common::Error::MissingToken(e));
12288 }
12289 },
12290 };
12291 let mut req_result = {
12292 let client = &self.hub.client;
12293 dlg.pre_request();
12294 let mut req_builder = hyper::Request::builder()
12295 .method(hyper::Method::DELETE)
12296 .uri(url.as_str())
12297 .header(USER_AGENT, self.hub._user_agent.clone());
12298
12299 if let Some(token) = token.as_ref() {
12300 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12301 }
12302
12303 let request = req_builder
12304 .header(CONTENT_LENGTH, 0_u64)
12305 .body(common::to_body::<String>(None));
12306
12307 client.request(request.unwrap()).await
12308 };
12309
12310 match req_result {
12311 Err(err) => {
12312 if let common::Retry::After(d) = dlg.http_error(&err) {
12313 sleep(d).await;
12314 continue;
12315 }
12316 dlg.finished(false);
12317 return Err(common::Error::HttpError(err));
12318 }
12319 Ok(res) => {
12320 let (mut parts, body) = res.into_parts();
12321 let mut body = common::Body::new(body);
12322 if !parts.status.is_success() {
12323 let bytes = common::to_bytes(body).await.unwrap_or_default();
12324 let error = serde_json::from_str(&common::to_string(&bytes));
12325 let response = common::to_response(parts, bytes.into());
12326
12327 if let common::Retry::After(d) =
12328 dlg.http_failure(&response, error.as_ref().ok())
12329 {
12330 sleep(d).await;
12331 continue;
12332 }
12333
12334 dlg.finished(false);
12335
12336 return Err(match error {
12337 Ok(value) => common::Error::BadRequest(value),
12338 _ => common::Error::Failure(response),
12339 });
12340 }
12341 let response = {
12342 let bytes = common::to_bytes(body).await.unwrap_or_default();
12343 let encoded = common::to_string(&bytes);
12344 match serde_json::from_str(&encoded) {
12345 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12346 Err(error) => {
12347 dlg.response_json_decode_error(&encoded, &error);
12348 return Err(common::Error::JsonDecodeError(
12349 encoded.to_string(),
12350 error,
12351 ));
12352 }
12353 }
12354 };
12355
12356 dlg.finished(true);
12357 return Ok(response);
12358 }
12359 }
12360 }
12361 }
12362
12363 /// Required. The name of the tag to delete.
12364 ///
12365 /// Sets the *name* path property to the given value.
12366 ///
12367 /// Even though the property as already been set when instantiating this call,
12368 /// we provide this method for API completeness.
12369 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
12370 self._name = new_value.to_string();
12371 self
12372 }
12373 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12374 /// while executing the actual API request.
12375 ///
12376 /// ````text
12377 /// It should be used to handle progress information, and to implement a certain level of resilience.
12378 /// ````
12379 ///
12380 /// Sets the *delegate* property to the given value.
12381 pub fn delegate(
12382 mut self,
12383 new_value: &'a mut dyn common::Delegate,
12384 ) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
12385 self._delegate = Some(new_value);
12386 self
12387 }
12388
12389 /// Set any additional parameter of the query string used in the request.
12390 /// It should be used to set parameters which are not yet available through their own
12391 /// setters.
12392 ///
12393 /// Please note that this method must not be used to set any of the known parameters
12394 /// which have their own setter method. If done anyway, the request will fail.
12395 ///
12396 /// # Additional Parameters
12397 ///
12398 /// * *$.xgafv* (query-string) - V1 error format.
12399 /// * *access_token* (query-string) - OAuth access token.
12400 /// * *alt* (query-string) - Data format for response.
12401 /// * *callback* (query-string) - JSONP
12402 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12403 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12404 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12405 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12406 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12407 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12408 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12409 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagDeleteCall<'a, C>
12410 where
12411 T: AsRef<str>,
12412 {
12413 self._additional_params
12414 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12415 self
12416 }
12417
12418 /// Identifies the authorization scope for the method you are building.
12419 ///
12420 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12421 /// [`Scope::CloudPlatform`].
12422 ///
12423 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12424 /// tokens for more than one scope.
12425 ///
12426 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12427 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12428 /// sufficient, a read-write scope will do as well.
12429 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagDeleteCall<'a, C>
12430 where
12431 St: AsRef<str>,
12432 {
12433 self._scopes.insert(String::from(scope.as_ref()));
12434 self
12435 }
12436 /// Identifies the authorization scope(s) for the method you are building.
12437 ///
12438 /// See [`Self::add_scope()`] for details.
12439 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagDeleteCall<'a, C>
12440 where
12441 I: IntoIterator<Item = St>,
12442 St: AsRef<str>,
12443 {
12444 self._scopes
12445 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12446 self
12447 }
12448
12449 /// Removes all scopes, and no default scope will be used either.
12450 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12451 /// for details).
12452 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
12453 self._scopes.clear();
12454 self
12455 }
12456}
12457
12458/// Lists tags assigned to an Entry. The columns in the response are lowercased.
12459///
12460/// A builder for the *locations.entryGroups.tags.list* method supported by a *project* resource.
12461/// It is not used directly, but through a [`ProjectMethods`] instance.
12462///
12463/// # Example
12464///
12465/// Instantiate a resource method builder
12466///
12467/// ```test_harness,no_run
12468/// # extern crate hyper;
12469/// # extern crate hyper_rustls;
12470/// # extern crate google_datacatalog1 as datacatalog1;
12471/// # async fn dox() {
12472/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12473///
12474/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12475/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12476/// # .with_native_roots()
12477/// # .unwrap()
12478/// # .https_only()
12479/// # .enable_http2()
12480/// # .build();
12481///
12482/// # let executor = hyper_util::rt::TokioExecutor::new();
12483/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12484/// # secret,
12485/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12486/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12487/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12488/// # ),
12489/// # ).build().await.unwrap();
12490///
12491/// # let client = hyper_util::client::legacy::Client::builder(
12492/// # hyper_util::rt::TokioExecutor::new()
12493/// # )
12494/// # .build(
12495/// # hyper_rustls::HttpsConnectorBuilder::new()
12496/// # .with_native_roots()
12497/// # .unwrap()
12498/// # .https_or_http()
12499/// # .enable_http2()
12500/// # .build()
12501/// # );
12502/// # let mut hub = DataCatalog::new(client, auth);
12503/// // You can configure optional parameters by calling the respective setters at will, and
12504/// // execute the final call using `doit()`.
12505/// // Values shown here are possibly random and not representative !
12506/// let result = hub.projects().locations_entry_groups_tags_list("parent")
12507/// .page_token("kasd")
12508/// .page_size(-24)
12509/// .doit().await;
12510/// # }
12511/// ```
12512pub struct ProjectLocationEntryGroupTagListCall<'a, C>
12513where
12514 C: 'a,
12515{
12516 hub: &'a DataCatalog<C>,
12517 _parent: String,
12518 _page_token: Option<String>,
12519 _page_size: Option<i32>,
12520 _delegate: Option<&'a mut dyn common::Delegate>,
12521 _additional_params: HashMap<String, String>,
12522 _scopes: BTreeSet<String>,
12523}
12524
12525impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagListCall<'a, C> {}
12526
12527impl<'a, C> ProjectLocationEntryGroupTagListCall<'a, C>
12528where
12529 C: common::Connector,
12530{
12531 /// Perform the operation you have build so far.
12532 pub async fn doit(
12533 mut self,
12534 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1ListTagsResponse)> {
12535 use std::borrow::Cow;
12536 use std::io::{Read, Seek};
12537
12538 use common::{url::Params, ToParts};
12539 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12540
12541 let mut dd = common::DefaultDelegate;
12542 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12543 dlg.begin(common::MethodInfo {
12544 id: "datacatalog.projects.locations.entryGroups.tags.list",
12545 http_method: hyper::Method::GET,
12546 });
12547
12548 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
12549 if self._additional_params.contains_key(field) {
12550 dlg.finished(false);
12551 return Err(common::Error::FieldClash(field));
12552 }
12553 }
12554
12555 let mut params = Params::with_capacity(5 + self._additional_params.len());
12556 params.push("parent", self._parent);
12557 if let Some(value) = self._page_token.as_ref() {
12558 params.push("pageToken", value);
12559 }
12560 if let Some(value) = self._page_size.as_ref() {
12561 params.push("pageSize", value.to_string());
12562 }
12563
12564 params.extend(self._additional_params.iter());
12565
12566 params.push("alt", "json");
12567 let mut url = self.hub._base_url.clone() + "v1/{+parent}/tags";
12568 if self._scopes.is_empty() {
12569 self._scopes
12570 .insert(Scope::CloudPlatform.as_ref().to_string());
12571 }
12572
12573 #[allow(clippy::single_element_loop)]
12574 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12575 url = params.uri_replacement(url, param_name, find_this, true);
12576 }
12577 {
12578 let to_remove = ["parent"];
12579 params.remove_params(&to_remove);
12580 }
12581
12582 let url = params.parse_with_url(&url);
12583
12584 loop {
12585 let token = match self
12586 .hub
12587 .auth
12588 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12589 .await
12590 {
12591 Ok(token) => token,
12592 Err(e) => match dlg.token(e) {
12593 Ok(token) => token,
12594 Err(e) => {
12595 dlg.finished(false);
12596 return Err(common::Error::MissingToken(e));
12597 }
12598 },
12599 };
12600 let mut req_result = {
12601 let client = &self.hub.client;
12602 dlg.pre_request();
12603 let mut req_builder = hyper::Request::builder()
12604 .method(hyper::Method::GET)
12605 .uri(url.as_str())
12606 .header(USER_AGENT, self.hub._user_agent.clone());
12607
12608 if let Some(token) = token.as_ref() {
12609 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12610 }
12611
12612 let request = req_builder
12613 .header(CONTENT_LENGTH, 0_u64)
12614 .body(common::to_body::<String>(None));
12615
12616 client.request(request.unwrap()).await
12617 };
12618
12619 match req_result {
12620 Err(err) => {
12621 if let common::Retry::After(d) = dlg.http_error(&err) {
12622 sleep(d).await;
12623 continue;
12624 }
12625 dlg.finished(false);
12626 return Err(common::Error::HttpError(err));
12627 }
12628 Ok(res) => {
12629 let (mut parts, body) = res.into_parts();
12630 let mut body = common::Body::new(body);
12631 if !parts.status.is_success() {
12632 let bytes = common::to_bytes(body).await.unwrap_or_default();
12633 let error = serde_json::from_str(&common::to_string(&bytes));
12634 let response = common::to_response(parts, bytes.into());
12635
12636 if let common::Retry::After(d) =
12637 dlg.http_failure(&response, error.as_ref().ok())
12638 {
12639 sleep(d).await;
12640 continue;
12641 }
12642
12643 dlg.finished(false);
12644
12645 return Err(match error {
12646 Ok(value) => common::Error::BadRequest(value),
12647 _ => common::Error::Failure(response),
12648 });
12649 }
12650 let response = {
12651 let bytes = common::to_bytes(body).await.unwrap_or_default();
12652 let encoded = common::to_string(&bytes);
12653 match serde_json::from_str(&encoded) {
12654 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12655 Err(error) => {
12656 dlg.response_json_decode_error(&encoded, &error);
12657 return Err(common::Error::JsonDecodeError(
12658 encoded.to_string(),
12659 error,
12660 ));
12661 }
12662 }
12663 };
12664
12665 dlg.finished(true);
12666 return Ok(response);
12667 }
12668 }
12669 }
12670 }
12671
12672 /// Required. The name of the Data Catalog resource to list the tags of. The resource can be an Entry or an EntryGroup (without `/entries/{entries}` at the end).
12673 ///
12674 /// Sets the *parent* path property to the given value.
12675 ///
12676 /// Even though the property as already been set when instantiating this call,
12677 /// we provide this method for API completeness.
12678 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupTagListCall<'a, C> {
12679 self._parent = new_value.to_string();
12680 self
12681 }
12682 /// Pagination token that specifies the next page to return. If empty, the first page is returned.
12683 ///
12684 /// Sets the *page token* query property to the given value.
12685 pub fn page_token(mut self, new_value: &str) -> ProjectLocationEntryGroupTagListCall<'a, C> {
12686 self._page_token = Some(new_value.to_string());
12687 self
12688 }
12689 /// The maximum number of tags to return. Default is 10. Maximum limit is 1000.
12690 ///
12691 /// Sets the *page size* query property to the given value.
12692 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupTagListCall<'a, C> {
12693 self._page_size = Some(new_value);
12694 self
12695 }
12696 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12697 /// while executing the actual API request.
12698 ///
12699 /// ````text
12700 /// It should be used to handle progress information, and to implement a certain level of resilience.
12701 /// ````
12702 ///
12703 /// Sets the *delegate* property to the given value.
12704 pub fn delegate(
12705 mut self,
12706 new_value: &'a mut dyn common::Delegate,
12707 ) -> ProjectLocationEntryGroupTagListCall<'a, C> {
12708 self._delegate = Some(new_value);
12709 self
12710 }
12711
12712 /// Set any additional parameter of the query string used in the request.
12713 /// It should be used to set parameters which are not yet available through their own
12714 /// setters.
12715 ///
12716 /// Please note that this method must not be used to set any of the known parameters
12717 /// which have their own setter method. If done anyway, the request will fail.
12718 ///
12719 /// # Additional Parameters
12720 ///
12721 /// * *$.xgafv* (query-string) - V1 error format.
12722 /// * *access_token* (query-string) - OAuth access token.
12723 /// * *alt* (query-string) - Data format for response.
12724 /// * *callback* (query-string) - JSONP
12725 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12726 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12727 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12728 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12729 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12730 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12731 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12732 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagListCall<'a, C>
12733 where
12734 T: AsRef<str>,
12735 {
12736 self._additional_params
12737 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12738 self
12739 }
12740
12741 /// Identifies the authorization scope for the method you are building.
12742 ///
12743 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12744 /// [`Scope::CloudPlatform`].
12745 ///
12746 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12747 /// tokens for more than one scope.
12748 ///
12749 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12750 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12751 /// sufficient, a read-write scope will do as well.
12752 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagListCall<'a, C>
12753 where
12754 St: AsRef<str>,
12755 {
12756 self._scopes.insert(String::from(scope.as_ref()));
12757 self
12758 }
12759 /// Identifies the authorization scope(s) for the method you are building.
12760 ///
12761 /// See [`Self::add_scope()`] for details.
12762 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagListCall<'a, C>
12763 where
12764 I: IntoIterator<Item = St>,
12765 St: AsRef<str>,
12766 {
12767 self._scopes
12768 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12769 self
12770 }
12771
12772 /// Removes all scopes, and no default scope will be used either.
12773 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12774 /// for details).
12775 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagListCall<'a, C> {
12776 self._scopes.clear();
12777 self
12778 }
12779}
12780
12781/// Updates an existing tag.
12782///
12783/// A builder for the *locations.entryGroups.tags.patch* method supported by a *project* resource.
12784/// It is not used directly, but through a [`ProjectMethods`] instance.
12785///
12786/// # Example
12787///
12788/// Instantiate a resource method builder
12789///
12790/// ```test_harness,no_run
12791/// # extern crate hyper;
12792/// # extern crate hyper_rustls;
12793/// # extern crate google_datacatalog1 as datacatalog1;
12794/// use datacatalog1::api::GoogleCloudDatacatalogV1Tag;
12795/// # async fn dox() {
12796/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12797///
12798/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12799/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12800/// # .with_native_roots()
12801/// # .unwrap()
12802/// # .https_only()
12803/// # .enable_http2()
12804/// # .build();
12805///
12806/// # let executor = hyper_util::rt::TokioExecutor::new();
12807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12808/// # secret,
12809/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12810/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12811/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12812/// # ),
12813/// # ).build().await.unwrap();
12814///
12815/// # let client = hyper_util::client::legacy::Client::builder(
12816/// # hyper_util::rt::TokioExecutor::new()
12817/// # )
12818/// # .build(
12819/// # hyper_rustls::HttpsConnectorBuilder::new()
12820/// # .with_native_roots()
12821/// # .unwrap()
12822/// # .https_or_http()
12823/// # .enable_http2()
12824/// # .build()
12825/// # );
12826/// # let mut hub = DataCatalog::new(client, auth);
12827/// // As the method needs a request, you would usually fill it with the desired information
12828/// // into the respective structure. Some of the parts shown here might not be applicable !
12829/// // Values shown here are possibly random and not representative !
12830/// let mut req = GoogleCloudDatacatalogV1Tag::default();
12831///
12832/// // You can configure optional parameters by calling the respective setters at will, and
12833/// // execute the final call using `doit()`.
12834/// // Values shown here are possibly random and not representative !
12835/// let result = hub.projects().locations_entry_groups_tags_patch(req, "name")
12836/// .update_mask(FieldMask::new::<&str>(&[]))
12837/// .doit().await;
12838/// # }
12839/// ```
12840pub struct ProjectLocationEntryGroupTagPatchCall<'a, C>
12841where
12842 C: 'a,
12843{
12844 hub: &'a DataCatalog<C>,
12845 _request: GoogleCloudDatacatalogV1Tag,
12846 _name: String,
12847 _update_mask: Option<common::FieldMask>,
12848 _delegate: Option<&'a mut dyn common::Delegate>,
12849 _additional_params: HashMap<String, String>,
12850 _scopes: BTreeSet<String>,
12851}
12852
12853impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagPatchCall<'a, C> {}
12854
12855impl<'a, C> ProjectLocationEntryGroupTagPatchCall<'a, C>
12856where
12857 C: common::Connector,
12858{
12859 /// Perform the operation you have build so far.
12860 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Tag)> {
12861 use std::borrow::Cow;
12862 use std::io::{Read, Seek};
12863
12864 use common::{url::Params, ToParts};
12865 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12866
12867 let mut dd = common::DefaultDelegate;
12868 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12869 dlg.begin(common::MethodInfo {
12870 id: "datacatalog.projects.locations.entryGroups.tags.patch",
12871 http_method: hyper::Method::PATCH,
12872 });
12873
12874 for &field in ["alt", "name", "updateMask"].iter() {
12875 if self._additional_params.contains_key(field) {
12876 dlg.finished(false);
12877 return Err(common::Error::FieldClash(field));
12878 }
12879 }
12880
12881 let mut params = Params::with_capacity(5 + self._additional_params.len());
12882 params.push("name", self._name);
12883 if let Some(value) = self._update_mask.as_ref() {
12884 params.push("updateMask", value.to_string());
12885 }
12886
12887 params.extend(self._additional_params.iter());
12888
12889 params.push("alt", "json");
12890 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12891 if self._scopes.is_empty() {
12892 self._scopes
12893 .insert(Scope::CloudPlatform.as_ref().to_string());
12894 }
12895
12896 #[allow(clippy::single_element_loop)]
12897 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12898 url = params.uri_replacement(url, param_name, find_this, true);
12899 }
12900 {
12901 let to_remove = ["name"];
12902 params.remove_params(&to_remove);
12903 }
12904
12905 let url = params.parse_with_url(&url);
12906
12907 let mut json_mime_type = mime::APPLICATION_JSON;
12908 let mut request_value_reader = {
12909 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12910 common::remove_json_null_values(&mut value);
12911 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12912 serde_json::to_writer(&mut dst, &value).unwrap();
12913 dst
12914 };
12915 let request_size = request_value_reader
12916 .seek(std::io::SeekFrom::End(0))
12917 .unwrap();
12918 request_value_reader
12919 .seek(std::io::SeekFrom::Start(0))
12920 .unwrap();
12921
12922 loop {
12923 let token = match self
12924 .hub
12925 .auth
12926 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12927 .await
12928 {
12929 Ok(token) => token,
12930 Err(e) => match dlg.token(e) {
12931 Ok(token) => token,
12932 Err(e) => {
12933 dlg.finished(false);
12934 return Err(common::Error::MissingToken(e));
12935 }
12936 },
12937 };
12938 request_value_reader
12939 .seek(std::io::SeekFrom::Start(0))
12940 .unwrap();
12941 let mut req_result = {
12942 let client = &self.hub.client;
12943 dlg.pre_request();
12944 let mut req_builder = hyper::Request::builder()
12945 .method(hyper::Method::PATCH)
12946 .uri(url.as_str())
12947 .header(USER_AGENT, self.hub._user_agent.clone());
12948
12949 if let Some(token) = token.as_ref() {
12950 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12951 }
12952
12953 let request = req_builder
12954 .header(CONTENT_TYPE, json_mime_type.to_string())
12955 .header(CONTENT_LENGTH, request_size as u64)
12956 .body(common::to_body(
12957 request_value_reader.get_ref().clone().into(),
12958 ));
12959
12960 client.request(request.unwrap()).await
12961 };
12962
12963 match req_result {
12964 Err(err) => {
12965 if let common::Retry::After(d) = dlg.http_error(&err) {
12966 sleep(d).await;
12967 continue;
12968 }
12969 dlg.finished(false);
12970 return Err(common::Error::HttpError(err));
12971 }
12972 Ok(res) => {
12973 let (mut parts, body) = res.into_parts();
12974 let mut body = common::Body::new(body);
12975 if !parts.status.is_success() {
12976 let bytes = common::to_bytes(body).await.unwrap_or_default();
12977 let error = serde_json::from_str(&common::to_string(&bytes));
12978 let response = common::to_response(parts, bytes.into());
12979
12980 if let common::Retry::After(d) =
12981 dlg.http_failure(&response, error.as_ref().ok())
12982 {
12983 sleep(d).await;
12984 continue;
12985 }
12986
12987 dlg.finished(false);
12988
12989 return Err(match error {
12990 Ok(value) => common::Error::BadRequest(value),
12991 _ => common::Error::Failure(response),
12992 });
12993 }
12994 let response = {
12995 let bytes = common::to_bytes(body).await.unwrap_or_default();
12996 let encoded = common::to_string(&bytes);
12997 match serde_json::from_str(&encoded) {
12998 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12999 Err(error) => {
13000 dlg.response_json_decode_error(&encoded, &error);
13001 return Err(common::Error::JsonDecodeError(
13002 encoded.to_string(),
13003 error,
13004 ));
13005 }
13006 }
13007 };
13008
13009 dlg.finished(true);
13010 return Ok(response);
13011 }
13012 }
13013 }
13014 }
13015
13016 ///
13017 /// Sets the *request* property to the given value.
13018 ///
13019 /// Even though the property as already been set when instantiating this call,
13020 /// we provide this method for API completeness.
13021 pub fn request(
13022 mut self,
13023 new_value: GoogleCloudDatacatalogV1Tag,
13024 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
13025 self._request = new_value;
13026 self
13027 }
13028 /// Identifier. The resource name of the tag in URL format where tag ID is a system-generated identifier. Note: The tag itself might not be stored in the location specified in its name.
13029 ///
13030 /// Sets the *name* path property to the given value.
13031 ///
13032 /// Even though the property as already been set when instantiating this call,
13033 /// we provide this method for API completeness.
13034 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
13035 self._name = new_value.to_string();
13036 self
13037 }
13038 /// Names of fields whose values to overwrite on a tag. Currently, a tag has the only modifiable field with the name `fields`. In general, if this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied.
13039 ///
13040 /// Sets the *update mask* query property to the given value.
13041 pub fn update_mask(
13042 mut self,
13043 new_value: common::FieldMask,
13044 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
13045 self._update_mask = Some(new_value);
13046 self
13047 }
13048 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13049 /// while executing the actual API request.
13050 ///
13051 /// ````text
13052 /// It should be used to handle progress information, and to implement a certain level of resilience.
13053 /// ````
13054 ///
13055 /// Sets the *delegate* property to the given value.
13056 pub fn delegate(
13057 mut self,
13058 new_value: &'a mut dyn common::Delegate,
13059 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
13060 self._delegate = Some(new_value);
13061 self
13062 }
13063
13064 /// Set any additional parameter of the query string used in the request.
13065 /// It should be used to set parameters which are not yet available through their own
13066 /// setters.
13067 ///
13068 /// Please note that this method must not be used to set any of the known parameters
13069 /// which have their own setter method. If done anyway, the request will fail.
13070 ///
13071 /// # Additional Parameters
13072 ///
13073 /// * *$.xgafv* (query-string) - V1 error format.
13074 /// * *access_token* (query-string) - OAuth access token.
13075 /// * *alt* (query-string) - Data format for response.
13076 /// * *callback* (query-string) - JSONP
13077 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13078 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13079 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13080 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13081 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13082 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13083 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13084 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagPatchCall<'a, C>
13085 where
13086 T: AsRef<str>,
13087 {
13088 self._additional_params
13089 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13090 self
13091 }
13092
13093 /// Identifies the authorization scope for the method you are building.
13094 ///
13095 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13096 /// [`Scope::CloudPlatform`].
13097 ///
13098 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13099 /// tokens for more than one scope.
13100 ///
13101 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13102 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13103 /// sufficient, a read-write scope will do as well.
13104 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagPatchCall<'a, C>
13105 where
13106 St: AsRef<str>,
13107 {
13108 self._scopes.insert(String::from(scope.as_ref()));
13109 self
13110 }
13111 /// Identifies the authorization scope(s) for the method you are building.
13112 ///
13113 /// See [`Self::add_scope()`] for details.
13114 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagPatchCall<'a, C>
13115 where
13116 I: IntoIterator<Item = St>,
13117 St: AsRef<str>,
13118 {
13119 self._scopes
13120 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13121 self
13122 }
13123
13124 /// Removes all scopes, and no default scope will be used either.
13125 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13126 /// for details).
13127 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
13128 self._scopes.clear();
13129 self
13130 }
13131}
13132
13133/// Creates an entry group. An entry group contains logically related entries together with [Cloud Identity and Access Management](https://cloud.google.com/data-catalog/docs/concepts/iam) policies. These policies specify users who can create, edit, and view entries within entry groups. Data Catalog automatically creates entry groups with names that start with the `@` symbol for the following resources: * BigQuery entries (`@bigquery`) * Pub/Sub topics (`@pubsub`) * Dataproc Metastore services (`@dataproc_metastore_{SERVICE_NAME_HASH}`) You can create your own entry groups for Cloud Storage fileset entries and custom entries together with the corresponding IAM policies. User-created entry groups can’t contain the `@` symbol, it is reserved for automatically created groups. Entry groups, like entries, can be searched. A maximum of 10,000 entry groups may be created per organization across all locations. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
13134///
13135/// A builder for the *locations.entryGroups.create* method supported by a *project* resource.
13136/// It is not used directly, but through a [`ProjectMethods`] instance.
13137///
13138/// # Example
13139///
13140/// Instantiate a resource method builder
13141///
13142/// ```test_harness,no_run
13143/// # extern crate hyper;
13144/// # extern crate hyper_rustls;
13145/// # extern crate google_datacatalog1 as datacatalog1;
13146/// use datacatalog1::api::GoogleCloudDatacatalogV1EntryGroup;
13147/// # async fn dox() {
13148/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13149///
13150/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13151/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13152/// # .with_native_roots()
13153/// # .unwrap()
13154/// # .https_only()
13155/// # .enable_http2()
13156/// # .build();
13157///
13158/// # let executor = hyper_util::rt::TokioExecutor::new();
13159/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13160/// # secret,
13161/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13162/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13163/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13164/// # ),
13165/// # ).build().await.unwrap();
13166///
13167/// # let client = hyper_util::client::legacy::Client::builder(
13168/// # hyper_util::rt::TokioExecutor::new()
13169/// # )
13170/// # .build(
13171/// # hyper_rustls::HttpsConnectorBuilder::new()
13172/// # .with_native_roots()
13173/// # .unwrap()
13174/// # .https_or_http()
13175/// # .enable_http2()
13176/// # .build()
13177/// # );
13178/// # let mut hub = DataCatalog::new(client, auth);
13179/// // As the method needs a request, you would usually fill it with the desired information
13180/// // into the respective structure. Some of the parts shown here might not be applicable !
13181/// // Values shown here are possibly random and not representative !
13182/// let mut req = GoogleCloudDatacatalogV1EntryGroup::default();
13183///
13184/// // You can configure optional parameters by calling the respective setters at will, and
13185/// // execute the final call using `doit()`.
13186/// // Values shown here are possibly random and not representative !
13187/// let result = hub.projects().locations_entry_groups_create(req, "parent")
13188/// .entry_group_id("et")
13189/// .doit().await;
13190/// # }
13191/// ```
13192pub struct ProjectLocationEntryGroupCreateCall<'a, C>
13193where
13194 C: 'a,
13195{
13196 hub: &'a DataCatalog<C>,
13197 _request: GoogleCloudDatacatalogV1EntryGroup,
13198 _parent: String,
13199 _entry_group_id: Option<String>,
13200 _delegate: Option<&'a mut dyn common::Delegate>,
13201 _additional_params: HashMap<String, String>,
13202 _scopes: BTreeSet<String>,
13203}
13204
13205impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupCreateCall<'a, C> {}
13206
13207impl<'a, C> ProjectLocationEntryGroupCreateCall<'a, C>
13208where
13209 C: common::Connector,
13210{
13211 /// Perform the operation you have build so far.
13212 pub async fn doit(
13213 mut self,
13214 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1EntryGroup)> {
13215 use std::borrow::Cow;
13216 use std::io::{Read, Seek};
13217
13218 use common::{url::Params, ToParts};
13219 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13220
13221 let mut dd = common::DefaultDelegate;
13222 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13223 dlg.begin(common::MethodInfo {
13224 id: "datacatalog.projects.locations.entryGroups.create",
13225 http_method: hyper::Method::POST,
13226 });
13227
13228 for &field in ["alt", "parent", "entryGroupId"].iter() {
13229 if self._additional_params.contains_key(field) {
13230 dlg.finished(false);
13231 return Err(common::Error::FieldClash(field));
13232 }
13233 }
13234
13235 let mut params = Params::with_capacity(5 + self._additional_params.len());
13236 params.push("parent", self._parent);
13237 if let Some(value) = self._entry_group_id.as_ref() {
13238 params.push("entryGroupId", value);
13239 }
13240
13241 params.extend(self._additional_params.iter());
13242
13243 params.push("alt", "json");
13244 let mut url = self.hub._base_url.clone() + "v1/{+parent}/entryGroups";
13245 if self._scopes.is_empty() {
13246 self._scopes
13247 .insert(Scope::CloudPlatform.as_ref().to_string());
13248 }
13249
13250 #[allow(clippy::single_element_loop)]
13251 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13252 url = params.uri_replacement(url, param_name, find_this, true);
13253 }
13254 {
13255 let to_remove = ["parent"];
13256 params.remove_params(&to_remove);
13257 }
13258
13259 let url = params.parse_with_url(&url);
13260
13261 let mut json_mime_type = mime::APPLICATION_JSON;
13262 let mut request_value_reader = {
13263 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13264 common::remove_json_null_values(&mut value);
13265 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13266 serde_json::to_writer(&mut dst, &value).unwrap();
13267 dst
13268 };
13269 let request_size = request_value_reader
13270 .seek(std::io::SeekFrom::End(0))
13271 .unwrap();
13272 request_value_reader
13273 .seek(std::io::SeekFrom::Start(0))
13274 .unwrap();
13275
13276 loop {
13277 let token = match self
13278 .hub
13279 .auth
13280 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13281 .await
13282 {
13283 Ok(token) => token,
13284 Err(e) => match dlg.token(e) {
13285 Ok(token) => token,
13286 Err(e) => {
13287 dlg.finished(false);
13288 return Err(common::Error::MissingToken(e));
13289 }
13290 },
13291 };
13292 request_value_reader
13293 .seek(std::io::SeekFrom::Start(0))
13294 .unwrap();
13295 let mut req_result = {
13296 let client = &self.hub.client;
13297 dlg.pre_request();
13298 let mut req_builder = hyper::Request::builder()
13299 .method(hyper::Method::POST)
13300 .uri(url.as_str())
13301 .header(USER_AGENT, self.hub._user_agent.clone());
13302
13303 if let Some(token) = token.as_ref() {
13304 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13305 }
13306
13307 let request = req_builder
13308 .header(CONTENT_TYPE, json_mime_type.to_string())
13309 .header(CONTENT_LENGTH, request_size as u64)
13310 .body(common::to_body(
13311 request_value_reader.get_ref().clone().into(),
13312 ));
13313
13314 client.request(request.unwrap()).await
13315 };
13316
13317 match req_result {
13318 Err(err) => {
13319 if let common::Retry::After(d) = dlg.http_error(&err) {
13320 sleep(d).await;
13321 continue;
13322 }
13323 dlg.finished(false);
13324 return Err(common::Error::HttpError(err));
13325 }
13326 Ok(res) => {
13327 let (mut parts, body) = res.into_parts();
13328 let mut body = common::Body::new(body);
13329 if !parts.status.is_success() {
13330 let bytes = common::to_bytes(body).await.unwrap_or_default();
13331 let error = serde_json::from_str(&common::to_string(&bytes));
13332 let response = common::to_response(parts, bytes.into());
13333
13334 if let common::Retry::After(d) =
13335 dlg.http_failure(&response, error.as_ref().ok())
13336 {
13337 sleep(d).await;
13338 continue;
13339 }
13340
13341 dlg.finished(false);
13342
13343 return Err(match error {
13344 Ok(value) => common::Error::BadRequest(value),
13345 _ => common::Error::Failure(response),
13346 });
13347 }
13348 let response = {
13349 let bytes = common::to_bytes(body).await.unwrap_or_default();
13350 let encoded = common::to_string(&bytes);
13351 match serde_json::from_str(&encoded) {
13352 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13353 Err(error) => {
13354 dlg.response_json_decode_error(&encoded, &error);
13355 return Err(common::Error::JsonDecodeError(
13356 encoded.to_string(),
13357 error,
13358 ));
13359 }
13360 }
13361 };
13362
13363 dlg.finished(true);
13364 return Ok(response);
13365 }
13366 }
13367 }
13368 }
13369
13370 ///
13371 /// Sets the *request* property to the given value.
13372 ///
13373 /// Even though the property as already been set when instantiating this call,
13374 /// we provide this method for API completeness.
13375 pub fn request(
13376 mut self,
13377 new_value: GoogleCloudDatacatalogV1EntryGroup,
13378 ) -> ProjectLocationEntryGroupCreateCall<'a, C> {
13379 self._request = new_value;
13380 self
13381 }
13382 /// Required. The names of the project and location that the new entry group belongs to. Note: The entry group itself and its child resources might not be stored in the location specified in its name.
13383 ///
13384 /// Sets the *parent* path property to the given value.
13385 ///
13386 /// Even though the property as already been set when instantiating this call,
13387 /// we provide this method for API completeness.
13388 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupCreateCall<'a, C> {
13389 self._parent = new_value.to_string();
13390 self
13391 }
13392 /// Required. The ID of the entry group to create. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and must start with a letter or underscore. The maximum size is 64 bytes when encoded in UTF-8.
13393 ///
13394 /// Sets the *entry group id* query property to the given value.
13395 pub fn entry_group_id(mut self, new_value: &str) -> ProjectLocationEntryGroupCreateCall<'a, C> {
13396 self._entry_group_id = Some(new_value.to_string());
13397 self
13398 }
13399 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13400 /// while executing the actual API request.
13401 ///
13402 /// ````text
13403 /// It should be used to handle progress information, and to implement a certain level of resilience.
13404 /// ````
13405 ///
13406 /// Sets the *delegate* property to the given value.
13407 pub fn delegate(
13408 mut self,
13409 new_value: &'a mut dyn common::Delegate,
13410 ) -> ProjectLocationEntryGroupCreateCall<'a, C> {
13411 self._delegate = Some(new_value);
13412 self
13413 }
13414
13415 /// Set any additional parameter of the query string used in the request.
13416 /// It should be used to set parameters which are not yet available through their own
13417 /// setters.
13418 ///
13419 /// Please note that this method must not be used to set any of the known parameters
13420 /// which have their own setter method. If done anyway, the request will fail.
13421 ///
13422 /// # Additional Parameters
13423 ///
13424 /// * *$.xgafv* (query-string) - V1 error format.
13425 /// * *access_token* (query-string) - OAuth access token.
13426 /// * *alt* (query-string) - Data format for response.
13427 /// * *callback* (query-string) - JSONP
13428 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13429 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13430 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13431 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13432 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13433 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13434 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13435 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupCreateCall<'a, C>
13436 where
13437 T: AsRef<str>,
13438 {
13439 self._additional_params
13440 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13441 self
13442 }
13443
13444 /// Identifies the authorization scope for the method you are building.
13445 ///
13446 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13447 /// [`Scope::CloudPlatform`].
13448 ///
13449 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13450 /// tokens for more than one scope.
13451 ///
13452 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13453 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13454 /// sufficient, a read-write scope will do as well.
13455 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupCreateCall<'a, C>
13456 where
13457 St: AsRef<str>,
13458 {
13459 self._scopes.insert(String::from(scope.as_ref()));
13460 self
13461 }
13462 /// Identifies the authorization scope(s) for the method you are building.
13463 ///
13464 /// See [`Self::add_scope()`] for details.
13465 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupCreateCall<'a, C>
13466 where
13467 I: IntoIterator<Item = St>,
13468 St: AsRef<str>,
13469 {
13470 self._scopes
13471 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13472 self
13473 }
13474
13475 /// Removes all scopes, and no default scope will be used either.
13476 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13477 /// for details).
13478 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupCreateCall<'a, C> {
13479 self._scopes.clear();
13480 self
13481 }
13482}
13483
13484/// Deletes an entry group. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
13485///
13486/// A builder for the *locations.entryGroups.delete* method supported by a *project* resource.
13487/// It is not used directly, but through a [`ProjectMethods`] instance.
13488///
13489/// # Example
13490///
13491/// Instantiate a resource method builder
13492///
13493/// ```test_harness,no_run
13494/// # extern crate hyper;
13495/// # extern crate hyper_rustls;
13496/// # extern crate google_datacatalog1 as datacatalog1;
13497/// # async fn dox() {
13498/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13499///
13500/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13501/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13502/// # .with_native_roots()
13503/// # .unwrap()
13504/// # .https_only()
13505/// # .enable_http2()
13506/// # .build();
13507///
13508/// # let executor = hyper_util::rt::TokioExecutor::new();
13509/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13510/// # secret,
13511/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13512/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13513/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13514/// # ),
13515/// # ).build().await.unwrap();
13516///
13517/// # let client = hyper_util::client::legacy::Client::builder(
13518/// # hyper_util::rt::TokioExecutor::new()
13519/// # )
13520/// # .build(
13521/// # hyper_rustls::HttpsConnectorBuilder::new()
13522/// # .with_native_roots()
13523/// # .unwrap()
13524/// # .https_or_http()
13525/// # .enable_http2()
13526/// # .build()
13527/// # );
13528/// # let mut hub = DataCatalog::new(client, auth);
13529/// // You can configure optional parameters by calling the respective setters at will, and
13530/// // execute the final call using `doit()`.
13531/// // Values shown here are possibly random and not representative !
13532/// let result = hub.projects().locations_entry_groups_delete("name")
13533/// .force(false)
13534/// .doit().await;
13535/// # }
13536/// ```
13537pub struct ProjectLocationEntryGroupDeleteCall<'a, C>
13538where
13539 C: 'a,
13540{
13541 hub: &'a DataCatalog<C>,
13542 _name: String,
13543 _force: Option<bool>,
13544 _delegate: Option<&'a mut dyn common::Delegate>,
13545 _additional_params: HashMap<String, String>,
13546 _scopes: BTreeSet<String>,
13547}
13548
13549impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupDeleteCall<'a, C> {}
13550
13551impl<'a, C> ProjectLocationEntryGroupDeleteCall<'a, C>
13552where
13553 C: common::Connector,
13554{
13555 /// Perform the operation you have build so far.
13556 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
13557 use std::borrow::Cow;
13558 use std::io::{Read, Seek};
13559
13560 use common::{url::Params, ToParts};
13561 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13562
13563 let mut dd = common::DefaultDelegate;
13564 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13565 dlg.begin(common::MethodInfo {
13566 id: "datacatalog.projects.locations.entryGroups.delete",
13567 http_method: hyper::Method::DELETE,
13568 });
13569
13570 for &field in ["alt", "name", "force"].iter() {
13571 if self._additional_params.contains_key(field) {
13572 dlg.finished(false);
13573 return Err(common::Error::FieldClash(field));
13574 }
13575 }
13576
13577 let mut params = Params::with_capacity(4 + self._additional_params.len());
13578 params.push("name", self._name);
13579 if let Some(value) = self._force.as_ref() {
13580 params.push("force", value.to_string());
13581 }
13582
13583 params.extend(self._additional_params.iter());
13584
13585 params.push("alt", "json");
13586 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13587 if self._scopes.is_empty() {
13588 self._scopes
13589 .insert(Scope::CloudPlatform.as_ref().to_string());
13590 }
13591
13592 #[allow(clippy::single_element_loop)]
13593 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13594 url = params.uri_replacement(url, param_name, find_this, true);
13595 }
13596 {
13597 let to_remove = ["name"];
13598 params.remove_params(&to_remove);
13599 }
13600
13601 let url = params.parse_with_url(&url);
13602
13603 loop {
13604 let token = match self
13605 .hub
13606 .auth
13607 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13608 .await
13609 {
13610 Ok(token) => token,
13611 Err(e) => match dlg.token(e) {
13612 Ok(token) => token,
13613 Err(e) => {
13614 dlg.finished(false);
13615 return Err(common::Error::MissingToken(e));
13616 }
13617 },
13618 };
13619 let mut req_result = {
13620 let client = &self.hub.client;
13621 dlg.pre_request();
13622 let mut req_builder = hyper::Request::builder()
13623 .method(hyper::Method::DELETE)
13624 .uri(url.as_str())
13625 .header(USER_AGENT, self.hub._user_agent.clone());
13626
13627 if let Some(token) = token.as_ref() {
13628 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13629 }
13630
13631 let request = req_builder
13632 .header(CONTENT_LENGTH, 0_u64)
13633 .body(common::to_body::<String>(None));
13634
13635 client.request(request.unwrap()).await
13636 };
13637
13638 match req_result {
13639 Err(err) => {
13640 if let common::Retry::After(d) = dlg.http_error(&err) {
13641 sleep(d).await;
13642 continue;
13643 }
13644 dlg.finished(false);
13645 return Err(common::Error::HttpError(err));
13646 }
13647 Ok(res) => {
13648 let (mut parts, body) = res.into_parts();
13649 let mut body = common::Body::new(body);
13650 if !parts.status.is_success() {
13651 let bytes = common::to_bytes(body).await.unwrap_or_default();
13652 let error = serde_json::from_str(&common::to_string(&bytes));
13653 let response = common::to_response(parts, bytes.into());
13654
13655 if let common::Retry::After(d) =
13656 dlg.http_failure(&response, error.as_ref().ok())
13657 {
13658 sleep(d).await;
13659 continue;
13660 }
13661
13662 dlg.finished(false);
13663
13664 return Err(match error {
13665 Ok(value) => common::Error::BadRequest(value),
13666 _ => common::Error::Failure(response),
13667 });
13668 }
13669 let response = {
13670 let bytes = common::to_bytes(body).await.unwrap_or_default();
13671 let encoded = common::to_string(&bytes);
13672 match serde_json::from_str(&encoded) {
13673 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13674 Err(error) => {
13675 dlg.response_json_decode_error(&encoded, &error);
13676 return Err(common::Error::JsonDecodeError(
13677 encoded.to_string(),
13678 error,
13679 ));
13680 }
13681 }
13682 };
13683
13684 dlg.finished(true);
13685 return Ok(response);
13686 }
13687 }
13688 }
13689 }
13690
13691 /// Required. The name of the entry group to delete.
13692 ///
13693 /// Sets the *name* path property to the given value.
13694 ///
13695 /// Even though the property as already been set when instantiating this call,
13696 /// we provide this method for API completeness.
13697 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
13698 self._name = new_value.to_string();
13699 self
13700 }
13701 /// Optional. If true, deletes all entries in the entry group.
13702 ///
13703 /// Sets the *force* query property to the given value.
13704 pub fn force(mut self, new_value: bool) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
13705 self._force = Some(new_value);
13706 self
13707 }
13708 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13709 /// while executing the actual API request.
13710 ///
13711 /// ````text
13712 /// It should be used to handle progress information, and to implement a certain level of resilience.
13713 /// ````
13714 ///
13715 /// Sets the *delegate* property to the given value.
13716 pub fn delegate(
13717 mut self,
13718 new_value: &'a mut dyn common::Delegate,
13719 ) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
13720 self._delegate = Some(new_value);
13721 self
13722 }
13723
13724 /// Set any additional parameter of the query string used in the request.
13725 /// It should be used to set parameters which are not yet available through their own
13726 /// setters.
13727 ///
13728 /// Please note that this method must not be used to set any of the known parameters
13729 /// which have their own setter method. If done anyway, the request will fail.
13730 ///
13731 /// # Additional Parameters
13732 ///
13733 /// * *$.xgafv* (query-string) - V1 error format.
13734 /// * *access_token* (query-string) - OAuth access token.
13735 /// * *alt* (query-string) - Data format for response.
13736 /// * *callback* (query-string) - JSONP
13737 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13738 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13739 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13740 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13741 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13742 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13743 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13744 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupDeleteCall<'a, C>
13745 where
13746 T: AsRef<str>,
13747 {
13748 self._additional_params
13749 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13750 self
13751 }
13752
13753 /// Identifies the authorization scope for the method you are building.
13754 ///
13755 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13756 /// [`Scope::CloudPlatform`].
13757 ///
13758 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13759 /// tokens for more than one scope.
13760 ///
13761 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13762 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13763 /// sufficient, a read-write scope will do as well.
13764 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupDeleteCall<'a, C>
13765 where
13766 St: AsRef<str>,
13767 {
13768 self._scopes.insert(String::from(scope.as_ref()));
13769 self
13770 }
13771 /// Identifies the authorization scope(s) for the method you are building.
13772 ///
13773 /// See [`Self::add_scope()`] for details.
13774 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupDeleteCall<'a, C>
13775 where
13776 I: IntoIterator<Item = St>,
13777 St: AsRef<str>,
13778 {
13779 self._scopes
13780 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13781 self
13782 }
13783
13784 /// Removes all scopes, and no default scope will be used either.
13785 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13786 /// for details).
13787 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
13788 self._scopes.clear();
13789 self
13790 }
13791}
13792
13793/// Gets an entry group.
13794///
13795/// A builder for the *locations.entryGroups.get* method supported by a *project* resource.
13796/// It is not used directly, but through a [`ProjectMethods`] instance.
13797///
13798/// # Example
13799///
13800/// Instantiate a resource method builder
13801///
13802/// ```test_harness,no_run
13803/// # extern crate hyper;
13804/// # extern crate hyper_rustls;
13805/// # extern crate google_datacatalog1 as datacatalog1;
13806/// # async fn dox() {
13807/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13808///
13809/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13810/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13811/// # .with_native_roots()
13812/// # .unwrap()
13813/// # .https_only()
13814/// # .enable_http2()
13815/// # .build();
13816///
13817/// # let executor = hyper_util::rt::TokioExecutor::new();
13818/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13819/// # secret,
13820/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13821/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13822/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13823/// # ),
13824/// # ).build().await.unwrap();
13825///
13826/// # let client = hyper_util::client::legacy::Client::builder(
13827/// # hyper_util::rt::TokioExecutor::new()
13828/// # )
13829/// # .build(
13830/// # hyper_rustls::HttpsConnectorBuilder::new()
13831/// # .with_native_roots()
13832/// # .unwrap()
13833/// # .https_or_http()
13834/// # .enable_http2()
13835/// # .build()
13836/// # );
13837/// # let mut hub = DataCatalog::new(client, auth);
13838/// // You can configure optional parameters by calling the respective setters at will, and
13839/// // execute the final call using `doit()`.
13840/// // Values shown here are possibly random and not representative !
13841/// let result = hub.projects().locations_entry_groups_get("name")
13842/// .read_mask(FieldMask::new::<&str>(&[]))
13843/// .doit().await;
13844/// # }
13845/// ```
13846pub struct ProjectLocationEntryGroupGetCall<'a, C>
13847where
13848 C: 'a,
13849{
13850 hub: &'a DataCatalog<C>,
13851 _name: String,
13852 _read_mask: Option<common::FieldMask>,
13853 _delegate: Option<&'a mut dyn common::Delegate>,
13854 _additional_params: HashMap<String, String>,
13855 _scopes: BTreeSet<String>,
13856}
13857
13858impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupGetCall<'a, C> {}
13859
13860impl<'a, C> ProjectLocationEntryGroupGetCall<'a, C>
13861where
13862 C: common::Connector,
13863{
13864 /// Perform the operation you have build so far.
13865 pub async fn doit(
13866 mut self,
13867 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1EntryGroup)> {
13868 use std::borrow::Cow;
13869 use std::io::{Read, Seek};
13870
13871 use common::{url::Params, ToParts};
13872 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13873
13874 let mut dd = common::DefaultDelegate;
13875 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13876 dlg.begin(common::MethodInfo {
13877 id: "datacatalog.projects.locations.entryGroups.get",
13878 http_method: hyper::Method::GET,
13879 });
13880
13881 for &field in ["alt", "name", "readMask"].iter() {
13882 if self._additional_params.contains_key(field) {
13883 dlg.finished(false);
13884 return Err(common::Error::FieldClash(field));
13885 }
13886 }
13887
13888 let mut params = Params::with_capacity(4 + self._additional_params.len());
13889 params.push("name", self._name);
13890 if let Some(value) = self._read_mask.as_ref() {
13891 params.push("readMask", value.to_string());
13892 }
13893
13894 params.extend(self._additional_params.iter());
13895
13896 params.push("alt", "json");
13897 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13898 if self._scopes.is_empty() {
13899 self._scopes
13900 .insert(Scope::CloudPlatform.as_ref().to_string());
13901 }
13902
13903 #[allow(clippy::single_element_loop)]
13904 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13905 url = params.uri_replacement(url, param_name, find_this, true);
13906 }
13907 {
13908 let to_remove = ["name"];
13909 params.remove_params(&to_remove);
13910 }
13911
13912 let url = params.parse_with_url(&url);
13913
13914 loop {
13915 let token = match self
13916 .hub
13917 .auth
13918 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13919 .await
13920 {
13921 Ok(token) => token,
13922 Err(e) => match dlg.token(e) {
13923 Ok(token) => token,
13924 Err(e) => {
13925 dlg.finished(false);
13926 return Err(common::Error::MissingToken(e));
13927 }
13928 },
13929 };
13930 let mut req_result = {
13931 let client = &self.hub.client;
13932 dlg.pre_request();
13933 let mut req_builder = hyper::Request::builder()
13934 .method(hyper::Method::GET)
13935 .uri(url.as_str())
13936 .header(USER_AGENT, self.hub._user_agent.clone());
13937
13938 if let Some(token) = token.as_ref() {
13939 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13940 }
13941
13942 let request = req_builder
13943 .header(CONTENT_LENGTH, 0_u64)
13944 .body(common::to_body::<String>(None));
13945
13946 client.request(request.unwrap()).await
13947 };
13948
13949 match req_result {
13950 Err(err) => {
13951 if let common::Retry::After(d) = dlg.http_error(&err) {
13952 sleep(d).await;
13953 continue;
13954 }
13955 dlg.finished(false);
13956 return Err(common::Error::HttpError(err));
13957 }
13958 Ok(res) => {
13959 let (mut parts, body) = res.into_parts();
13960 let mut body = common::Body::new(body);
13961 if !parts.status.is_success() {
13962 let bytes = common::to_bytes(body).await.unwrap_or_default();
13963 let error = serde_json::from_str(&common::to_string(&bytes));
13964 let response = common::to_response(parts, bytes.into());
13965
13966 if let common::Retry::After(d) =
13967 dlg.http_failure(&response, error.as_ref().ok())
13968 {
13969 sleep(d).await;
13970 continue;
13971 }
13972
13973 dlg.finished(false);
13974
13975 return Err(match error {
13976 Ok(value) => common::Error::BadRequest(value),
13977 _ => common::Error::Failure(response),
13978 });
13979 }
13980 let response = {
13981 let bytes = common::to_bytes(body).await.unwrap_or_default();
13982 let encoded = common::to_string(&bytes);
13983 match serde_json::from_str(&encoded) {
13984 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13985 Err(error) => {
13986 dlg.response_json_decode_error(&encoded, &error);
13987 return Err(common::Error::JsonDecodeError(
13988 encoded.to_string(),
13989 error,
13990 ));
13991 }
13992 }
13993 };
13994
13995 dlg.finished(true);
13996 return Ok(response);
13997 }
13998 }
13999 }
14000 }
14001
14002 /// Required. The name of the entry group to get.
14003 ///
14004 /// Sets the *name* path property to the given value.
14005 ///
14006 /// Even though the property as already been set when instantiating this call,
14007 /// we provide this method for API completeness.
14008 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupGetCall<'a, C> {
14009 self._name = new_value.to_string();
14010 self
14011 }
14012 /// The fields to return. If empty or omitted, all fields are returned.
14013 ///
14014 /// Sets the *read mask* query property to the given value.
14015 pub fn read_mask(
14016 mut self,
14017 new_value: common::FieldMask,
14018 ) -> ProjectLocationEntryGroupGetCall<'a, C> {
14019 self._read_mask = Some(new_value);
14020 self
14021 }
14022 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14023 /// while executing the actual API request.
14024 ///
14025 /// ````text
14026 /// It should be used to handle progress information, and to implement a certain level of resilience.
14027 /// ````
14028 ///
14029 /// Sets the *delegate* property to the given value.
14030 pub fn delegate(
14031 mut self,
14032 new_value: &'a mut dyn common::Delegate,
14033 ) -> ProjectLocationEntryGroupGetCall<'a, C> {
14034 self._delegate = Some(new_value);
14035 self
14036 }
14037
14038 /// Set any additional parameter of the query string used in the request.
14039 /// It should be used to set parameters which are not yet available through their own
14040 /// setters.
14041 ///
14042 /// Please note that this method must not be used to set any of the known parameters
14043 /// which have their own setter method. If done anyway, the request will fail.
14044 ///
14045 /// # Additional Parameters
14046 ///
14047 /// * *$.xgafv* (query-string) - V1 error format.
14048 /// * *access_token* (query-string) - OAuth access token.
14049 /// * *alt* (query-string) - Data format for response.
14050 /// * *callback* (query-string) - JSONP
14051 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14052 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14053 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14054 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14055 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14056 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14057 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14058 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupGetCall<'a, C>
14059 where
14060 T: AsRef<str>,
14061 {
14062 self._additional_params
14063 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14064 self
14065 }
14066
14067 /// Identifies the authorization scope for the method you are building.
14068 ///
14069 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14070 /// [`Scope::CloudPlatform`].
14071 ///
14072 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14073 /// tokens for more than one scope.
14074 ///
14075 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14076 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14077 /// sufficient, a read-write scope will do as well.
14078 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupGetCall<'a, C>
14079 where
14080 St: AsRef<str>,
14081 {
14082 self._scopes.insert(String::from(scope.as_ref()));
14083 self
14084 }
14085 /// Identifies the authorization scope(s) for the method you are building.
14086 ///
14087 /// See [`Self::add_scope()`] for details.
14088 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupGetCall<'a, C>
14089 where
14090 I: IntoIterator<Item = St>,
14091 St: AsRef<str>,
14092 {
14093 self._scopes
14094 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14095 self
14096 }
14097
14098 /// Removes all scopes, and no default scope will be used either.
14099 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14100 /// for details).
14101 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupGetCall<'a, C> {
14102 self._scopes.clear();
14103 self
14104 }
14105}
14106
14107/// Gets the access control policy for a resource. May return: * A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it. * An empty policy if the resource exists but doesn't have a set policy. Supported resources are: - Tag templates - Entry groups Note: This method doesn't get policies from Google Cloud Platform resources ingested into Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
14108///
14109/// A builder for the *locations.entryGroups.getIamPolicy* method supported by a *project* resource.
14110/// It is not used directly, but through a [`ProjectMethods`] instance.
14111///
14112/// # Example
14113///
14114/// Instantiate a resource method builder
14115///
14116/// ```test_harness,no_run
14117/// # extern crate hyper;
14118/// # extern crate hyper_rustls;
14119/// # extern crate google_datacatalog1 as datacatalog1;
14120/// use datacatalog1::api::GetIamPolicyRequest;
14121/// # async fn dox() {
14122/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14123///
14124/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14125/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14126/// # .with_native_roots()
14127/// # .unwrap()
14128/// # .https_only()
14129/// # .enable_http2()
14130/// # .build();
14131///
14132/// # let executor = hyper_util::rt::TokioExecutor::new();
14133/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14134/// # secret,
14135/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14136/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14137/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14138/// # ),
14139/// # ).build().await.unwrap();
14140///
14141/// # let client = hyper_util::client::legacy::Client::builder(
14142/// # hyper_util::rt::TokioExecutor::new()
14143/// # )
14144/// # .build(
14145/// # hyper_rustls::HttpsConnectorBuilder::new()
14146/// # .with_native_roots()
14147/// # .unwrap()
14148/// # .https_or_http()
14149/// # .enable_http2()
14150/// # .build()
14151/// # );
14152/// # let mut hub = DataCatalog::new(client, auth);
14153/// // As the method needs a request, you would usually fill it with the desired information
14154/// // into the respective structure. Some of the parts shown here might not be applicable !
14155/// // Values shown here are possibly random and not representative !
14156/// let mut req = GetIamPolicyRequest::default();
14157///
14158/// // You can configure optional parameters by calling the respective setters at will, and
14159/// // execute the final call using `doit()`.
14160/// // Values shown here are possibly random and not representative !
14161/// let result = hub.projects().locations_entry_groups_get_iam_policy(req, "resource")
14162/// .doit().await;
14163/// # }
14164/// ```
14165pub struct ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
14166where
14167 C: 'a,
14168{
14169 hub: &'a DataCatalog<C>,
14170 _request: GetIamPolicyRequest,
14171 _resource: String,
14172 _delegate: Option<&'a mut dyn common::Delegate>,
14173 _additional_params: HashMap<String, String>,
14174 _scopes: BTreeSet<String>,
14175}
14176
14177impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {}
14178
14179impl<'a, C> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
14180where
14181 C: common::Connector,
14182{
14183 /// Perform the operation you have build so far.
14184 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14185 use std::borrow::Cow;
14186 use std::io::{Read, Seek};
14187
14188 use common::{url::Params, ToParts};
14189 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14190
14191 let mut dd = common::DefaultDelegate;
14192 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14193 dlg.begin(common::MethodInfo {
14194 id: "datacatalog.projects.locations.entryGroups.getIamPolicy",
14195 http_method: hyper::Method::POST,
14196 });
14197
14198 for &field in ["alt", "resource"].iter() {
14199 if self._additional_params.contains_key(field) {
14200 dlg.finished(false);
14201 return Err(common::Error::FieldClash(field));
14202 }
14203 }
14204
14205 let mut params = Params::with_capacity(4 + self._additional_params.len());
14206 params.push("resource", self._resource);
14207
14208 params.extend(self._additional_params.iter());
14209
14210 params.push("alt", "json");
14211 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
14212 if self._scopes.is_empty() {
14213 self._scopes
14214 .insert(Scope::CloudPlatform.as_ref().to_string());
14215 }
14216
14217 #[allow(clippy::single_element_loop)]
14218 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14219 url = params.uri_replacement(url, param_name, find_this, true);
14220 }
14221 {
14222 let to_remove = ["resource"];
14223 params.remove_params(&to_remove);
14224 }
14225
14226 let url = params.parse_with_url(&url);
14227
14228 let mut json_mime_type = mime::APPLICATION_JSON;
14229 let mut request_value_reader = {
14230 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14231 common::remove_json_null_values(&mut value);
14232 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14233 serde_json::to_writer(&mut dst, &value).unwrap();
14234 dst
14235 };
14236 let request_size = request_value_reader
14237 .seek(std::io::SeekFrom::End(0))
14238 .unwrap();
14239 request_value_reader
14240 .seek(std::io::SeekFrom::Start(0))
14241 .unwrap();
14242
14243 loop {
14244 let token = match self
14245 .hub
14246 .auth
14247 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14248 .await
14249 {
14250 Ok(token) => token,
14251 Err(e) => match dlg.token(e) {
14252 Ok(token) => token,
14253 Err(e) => {
14254 dlg.finished(false);
14255 return Err(common::Error::MissingToken(e));
14256 }
14257 },
14258 };
14259 request_value_reader
14260 .seek(std::io::SeekFrom::Start(0))
14261 .unwrap();
14262 let mut req_result = {
14263 let client = &self.hub.client;
14264 dlg.pre_request();
14265 let mut req_builder = hyper::Request::builder()
14266 .method(hyper::Method::POST)
14267 .uri(url.as_str())
14268 .header(USER_AGENT, self.hub._user_agent.clone());
14269
14270 if let Some(token) = token.as_ref() {
14271 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14272 }
14273
14274 let request = req_builder
14275 .header(CONTENT_TYPE, json_mime_type.to_string())
14276 .header(CONTENT_LENGTH, request_size as u64)
14277 .body(common::to_body(
14278 request_value_reader.get_ref().clone().into(),
14279 ));
14280
14281 client.request(request.unwrap()).await
14282 };
14283
14284 match req_result {
14285 Err(err) => {
14286 if let common::Retry::After(d) = dlg.http_error(&err) {
14287 sleep(d).await;
14288 continue;
14289 }
14290 dlg.finished(false);
14291 return Err(common::Error::HttpError(err));
14292 }
14293 Ok(res) => {
14294 let (mut parts, body) = res.into_parts();
14295 let mut body = common::Body::new(body);
14296 if !parts.status.is_success() {
14297 let bytes = common::to_bytes(body).await.unwrap_or_default();
14298 let error = serde_json::from_str(&common::to_string(&bytes));
14299 let response = common::to_response(parts, bytes.into());
14300
14301 if let common::Retry::After(d) =
14302 dlg.http_failure(&response, error.as_ref().ok())
14303 {
14304 sleep(d).await;
14305 continue;
14306 }
14307
14308 dlg.finished(false);
14309
14310 return Err(match error {
14311 Ok(value) => common::Error::BadRequest(value),
14312 _ => common::Error::Failure(response),
14313 });
14314 }
14315 let response = {
14316 let bytes = common::to_bytes(body).await.unwrap_or_default();
14317 let encoded = common::to_string(&bytes);
14318 match serde_json::from_str(&encoded) {
14319 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14320 Err(error) => {
14321 dlg.response_json_decode_error(&encoded, &error);
14322 return Err(common::Error::JsonDecodeError(
14323 encoded.to_string(),
14324 error,
14325 ));
14326 }
14327 }
14328 };
14329
14330 dlg.finished(true);
14331 return Ok(response);
14332 }
14333 }
14334 }
14335 }
14336
14337 ///
14338 /// Sets the *request* property to the given value.
14339 ///
14340 /// Even though the property as already been set when instantiating this call,
14341 /// we provide this method for API completeness.
14342 pub fn request(
14343 mut self,
14344 new_value: GetIamPolicyRequest,
14345 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
14346 self._request = new_value;
14347 self
14348 }
14349 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
14350 ///
14351 /// Sets the *resource* path property to the given value.
14352 ///
14353 /// Even though the property as already been set when instantiating this call,
14354 /// we provide this method for API completeness.
14355 pub fn resource(mut self, new_value: &str) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
14356 self._resource = new_value.to_string();
14357 self
14358 }
14359 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14360 /// while executing the actual API request.
14361 ///
14362 /// ````text
14363 /// It should be used to handle progress information, and to implement a certain level of resilience.
14364 /// ````
14365 ///
14366 /// Sets the *delegate* property to the given value.
14367 pub fn delegate(
14368 mut self,
14369 new_value: &'a mut dyn common::Delegate,
14370 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
14371 self._delegate = Some(new_value);
14372 self
14373 }
14374
14375 /// Set any additional parameter of the query string used in the request.
14376 /// It should be used to set parameters which are not yet available through their own
14377 /// setters.
14378 ///
14379 /// Please note that this method must not be used to set any of the known parameters
14380 /// which have their own setter method. If done anyway, the request will fail.
14381 ///
14382 /// # Additional Parameters
14383 ///
14384 /// * *$.xgafv* (query-string) - V1 error format.
14385 /// * *access_token* (query-string) - OAuth access token.
14386 /// * *alt* (query-string) - Data format for response.
14387 /// * *callback* (query-string) - JSONP
14388 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14389 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14390 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14391 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14392 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14393 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14394 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14395 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
14396 where
14397 T: AsRef<str>,
14398 {
14399 self._additional_params
14400 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14401 self
14402 }
14403
14404 /// Identifies the authorization scope for the method you are building.
14405 ///
14406 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14407 /// [`Scope::CloudPlatform`].
14408 ///
14409 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14410 /// tokens for more than one scope.
14411 ///
14412 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14413 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14414 /// sufficient, a read-write scope will do as well.
14415 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
14416 where
14417 St: AsRef<str>,
14418 {
14419 self._scopes.insert(String::from(scope.as_ref()));
14420 self
14421 }
14422 /// Identifies the authorization scope(s) for the method you are building.
14423 ///
14424 /// See [`Self::add_scope()`] for details.
14425 pub fn add_scopes<I, St>(
14426 mut self,
14427 scopes: I,
14428 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
14429 where
14430 I: IntoIterator<Item = St>,
14431 St: AsRef<str>,
14432 {
14433 self._scopes
14434 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14435 self
14436 }
14437
14438 /// Removes all scopes, and no default scope will be used either.
14439 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14440 /// for details).
14441 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
14442 self._scopes.clear();
14443 self
14444 }
14445}
14446
14447/// Lists entry groups.
14448///
14449/// A builder for the *locations.entryGroups.list* method supported by a *project* resource.
14450/// It is not used directly, but through a [`ProjectMethods`] instance.
14451///
14452/// # Example
14453///
14454/// Instantiate a resource method builder
14455///
14456/// ```test_harness,no_run
14457/// # extern crate hyper;
14458/// # extern crate hyper_rustls;
14459/// # extern crate google_datacatalog1 as datacatalog1;
14460/// # async fn dox() {
14461/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14462///
14463/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14464/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14465/// # .with_native_roots()
14466/// # .unwrap()
14467/// # .https_only()
14468/// # .enable_http2()
14469/// # .build();
14470///
14471/// # let executor = hyper_util::rt::TokioExecutor::new();
14472/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14473/// # secret,
14474/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14475/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14476/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14477/// # ),
14478/// # ).build().await.unwrap();
14479///
14480/// # let client = hyper_util::client::legacy::Client::builder(
14481/// # hyper_util::rt::TokioExecutor::new()
14482/// # )
14483/// # .build(
14484/// # hyper_rustls::HttpsConnectorBuilder::new()
14485/// # .with_native_roots()
14486/// # .unwrap()
14487/// # .https_or_http()
14488/// # .enable_http2()
14489/// # .build()
14490/// # );
14491/// # let mut hub = DataCatalog::new(client, auth);
14492/// // You can configure optional parameters by calling the respective setters at will, and
14493/// // execute the final call using `doit()`.
14494/// // Values shown here are possibly random and not representative !
14495/// let result = hub.projects().locations_entry_groups_list("parent")
14496/// .page_token("voluptua.")
14497/// .page_size(-2)
14498/// .doit().await;
14499/// # }
14500/// ```
14501pub struct ProjectLocationEntryGroupListCall<'a, C>
14502where
14503 C: 'a,
14504{
14505 hub: &'a DataCatalog<C>,
14506 _parent: String,
14507 _page_token: Option<String>,
14508 _page_size: Option<i32>,
14509 _delegate: Option<&'a mut dyn common::Delegate>,
14510 _additional_params: HashMap<String, String>,
14511 _scopes: BTreeSet<String>,
14512}
14513
14514impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupListCall<'a, C> {}
14515
14516impl<'a, C> ProjectLocationEntryGroupListCall<'a, C>
14517where
14518 C: common::Connector,
14519{
14520 /// Perform the operation you have build so far.
14521 pub async fn doit(
14522 mut self,
14523 ) -> common::Result<(
14524 common::Response,
14525 GoogleCloudDatacatalogV1ListEntryGroupsResponse,
14526 )> {
14527 use std::borrow::Cow;
14528 use std::io::{Read, Seek};
14529
14530 use common::{url::Params, ToParts};
14531 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14532
14533 let mut dd = common::DefaultDelegate;
14534 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14535 dlg.begin(common::MethodInfo {
14536 id: "datacatalog.projects.locations.entryGroups.list",
14537 http_method: hyper::Method::GET,
14538 });
14539
14540 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
14541 if self._additional_params.contains_key(field) {
14542 dlg.finished(false);
14543 return Err(common::Error::FieldClash(field));
14544 }
14545 }
14546
14547 let mut params = Params::with_capacity(5 + self._additional_params.len());
14548 params.push("parent", self._parent);
14549 if let Some(value) = self._page_token.as_ref() {
14550 params.push("pageToken", value);
14551 }
14552 if let Some(value) = self._page_size.as_ref() {
14553 params.push("pageSize", value.to_string());
14554 }
14555
14556 params.extend(self._additional_params.iter());
14557
14558 params.push("alt", "json");
14559 let mut url = self.hub._base_url.clone() + "v1/{+parent}/entryGroups";
14560 if self._scopes.is_empty() {
14561 self._scopes
14562 .insert(Scope::CloudPlatform.as_ref().to_string());
14563 }
14564
14565 #[allow(clippy::single_element_loop)]
14566 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14567 url = params.uri_replacement(url, param_name, find_this, true);
14568 }
14569 {
14570 let to_remove = ["parent"];
14571 params.remove_params(&to_remove);
14572 }
14573
14574 let url = params.parse_with_url(&url);
14575
14576 loop {
14577 let token = match self
14578 .hub
14579 .auth
14580 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14581 .await
14582 {
14583 Ok(token) => token,
14584 Err(e) => match dlg.token(e) {
14585 Ok(token) => token,
14586 Err(e) => {
14587 dlg.finished(false);
14588 return Err(common::Error::MissingToken(e));
14589 }
14590 },
14591 };
14592 let mut req_result = {
14593 let client = &self.hub.client;
14594 dlg.pre_request();
14595 let mut req_builder = hyper::Request::builder()
14596 .method(hyper::Method::GET)
14597 .uri(url.as_str())
14598 .header(USER_AGENT, self.hub._user_agent.clone());
14599
14600 if let Some(token) = token.as_ref() {
14601 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14602 }
14603
14604 let request = req_builder
14605 .header(CONTENT_LENGTH, 0_u64)
14606 .body(common::to_body::<String>(None));
14607
14608 client.request(request.unwrap()).await
14609 };
14610
14611 match req_result {
14612 Err(err) => {
14613 if let common::Retry::After(d) = dlg.http_error(&err) {
14614 sleep(d).await;
14615 continue;
14616 }
14617 dlg.finished(false);
14618 return Err(common::Error::HttpError(err));
14619 }
14620 Ok(res) => {
14621 let (mut parts, body) = res.into_parts();
14622 let mut body = common::Body::new(body);
14623 if !parts.status.is_success() {
14624 let bytes = common::to_bytes(body).await.unwrap_or_default();
14625 let error = serde_json::from_str(&common::to_string(&bytes));
14626 let response = common::to_response(parts, bytes.into());
14627
14628 if let common::Retry::After(d) =
14629 dlg.http_failure(&response, error.as_ref().ok())
14630 {
14631 sleep(d).await;
14632 continue;
14633 }
14634
14635 dlg.finished(false);
14636
14637 return Err(match error {
14638 Ok(value) => common::Error::BadRequest(value),
14639 _ => common::Error::Failure(response),
14640 });
14641 }
14642 let response = {
14643 let bytes = common::to_bytes(body).await.unwrap_or_default();
14644 let encoded = common::to_string(&bytes);
14645 match serde_json::from_str(&encoded) {
14646 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14647 Err(error) => {
14648 dlg.response_json_decode_error(&encoded, &error);
14649 return Err(common::Error::JsonDecodeError(
14650 encoded.to_string(),
14651 error,
14652 ));
14653 }
14654 }
14655 };
14656
14657 dlg.finished(true);
14658 return Ok(response);
14659 }
14660 }
14661 }
14662 }
14663
14664 /// Required. The name of the location that contains the entry groups to list. Can be provided as a URL.
14665 ///
14666 /// Sets the *parent* path property to the given value.
14667 ///
14668 /// Even though the property as already been set when instantiating this call,
14669 /// we provide this method for API completeness.
14670 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupListCall<'a, C> {
14671 self._parent = new_value.to_string();
14672 self
14673 }
14674 /// Optional. Pagination token that specifies the next page to return. If empty, returns the first page.
14675 ///
14676 /// Sets the *page token* query property to the given value.
14677 pub fn page_token(mut self, new_value: &str) -> ProjectLocationEntryGroupListCall<'a, C> {
14678 self._page_token = Some(new_value.to_string());
14679 self
14680 }
14681 /// Optional. The maximum number of items to return. Default is 10. Maximum limit is 1000. Throws an invalid argument if `page_size` is greater than 1000.
14682 ///
14683 /// Sets the *page size* query property to the given value.
14684 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupListCall<'a, C> {
14685 self._page_size = Some(new_value);
14686 self
14687 }
14688 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14689 /// while executing the actual API request.
14690 ///
14691 /// ````text
14692 /// It should be used to handle progress information, and to implement a certain level of resilience.
14693 /// ````
14694 ///
14695 /// Sets the *delegate* property to the given value.
14696 pub fn delegate(
14697 mut self,
14698 new_value: &'a mut dyn common::Delegate,
14699 ) -> ProjectLocationEntryGroupListCall<'a, C> {
14700 self._delegate = Some(new_value);
14701 self
14702 }
14703
14704 /// Set any additional parameter of the query string used in the request.
14705 /// It should be used to set parameters which are not yet available through their own
14706 /// setters.
14707 ///
14708 /// Please note that this method must not be used to set any of the known parameters
14709 /// which have their own setter method. If done anyway, the request will fail.
14710 ///
14711 /// # Additional Parameters
14712 ///
14713 /// * *$.xgafv* (query-string) - V1 error format.
14714 /// * *access_token* (query-string) - OAuth access token.
14715 /// * *alt* (query-string) - Data format for response.
14716 /// * *callback* (query-string) - JSONP
14717 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14718 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14719 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14720 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14721 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14722 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14723 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14724 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupListCall<'a, C>
14725 where
14726 T: AsRef<str>,
14727 {
14728 self._additional_params
14729 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14730 self
14731 }
14732
14733 /// Identifies the authorization scope for the method you are building.
14734 ///
14735 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14736 /// [`Scope::CloudPlatform`].
14737 ///
14738 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14739 /// tokens for more than one scope.
14740 ///
14741 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14742 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14743 /// sufficient, a read-write scope will do as well.
14744 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupListCall<'a, C>
14745 where
14746 St: AsRef<str>,
14747 {
14748 self._scopes.insert(String::from(scope.as_ref()));
14749 self
14750 }
14751 /// Identifies the authorization scope(s) for the method you are building.
14752 ///
14753 /// See [`Self::add_scope()`] for details.
14754 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupListCall<'a, C>
14755 where
14756 I: IntoIterator<Item = St>,
14757 St: AsRef<str>,
14758 {
14759 self._scopes
14760 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14761 self
14762 }
14763
14764 /// Removes all scopes, and no default scope will be used either.
14765 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14766 /// for details).
14767 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupListCall<'a, C> {
14768 self._scopes.clear();
14769 self
14770 }
14771}
14772
14773/// Updates an entry group. You must enable the Data Catalog API in the project identified by the `entry_group.name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
14774///
14775/// A builder for the *locations.entryGroups.patch* method supported by a *project* resource.
14776/// It is not used directly, but through a [`ProjectMethods`] instance.
14777///
14778/// # Example
14779///
14780/// Instantiate a resource method builder
14781///
14782/// ```test_harness,no_run
14783/// # extern crate hyper;
14784/// # extern crate hyper_rustls;
14785/// # extern crate google_datacatalog1 as datacatalog1;
14786/// use datacatalog1::api::GoogleCloudDatacatalogV1EntryGroup;
14787/// # async fn dox() {
14788/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14789///
14790/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14791/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14792/// # .with_native_roots()
14793/// # .unwrap()
14794/// # .https_only()
14795/// # .enable_http2()
14796/// # .build();
14797///
14798/// # let executor = hyper_util::rt::TokioExecutor::new();
14799/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14800/// # secret,
14801/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14802/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14803/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14804/// # ),
14805/// # ).build().await.unwrap();
14806///
14807/// # let client = hyper_util::client::legacy::Client::builder(
14808/// # hyper_util::rt::TokioExecutor::new()
14809/// # )
14810/// # .build(
14811/// # hyper_rustls::HttpsConnectorBuilder::new()
14812/// # .with_native_roots()
14813/// # .unwrap()
14814/// # .https_or_http()
14815/// # .enable_http2()
14816/// # .build()
14817/// # );
14818/// # let mut hub = DataCatalog::new(client, auth);
14819/// // As the method needs a request, you would usually fill it with the desired information
14820/// // into the respective structure. Some of the parts shown here might not be applicable !
14821/// // Values shown here are possibly random and not representative !
14822/// let mut req = GoogleCloudDatacatalogV1EntryGroup::default();
14823///
14824/// // You can configure optional parameters by calling the respective setters at will, and
14825/// // execute the final call using `doit()`.
14826/// // Values shown here are possibly random and not representative !
14827/// let result = hub.projects().locations_entry_groups_patch(req, "name")
14828/// .update_mask(FieldMask::new::<&str>(&[]))
14829/// .doit().await;
14830/// # }
14831/// ```
14832pub struct ProjectLocationEntryGroupPatchCall<'a, C>
14833where
14834 C: 'a,
14835{
14836 hub: &'a DataCatalog<C>,
14837 _request: GoogleCloudDatacatalogV1EntryGroup,
14838 _name: String,
14839 _update_mask: Option<common::FieldMask>,
14840 _delegate: Option<&'a mut dyn common::Delegate>,
14841 _additional_params: HashMap<String, String>,
14842 _scopes: BTreeSet<String>,
14843}
14844
14845impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupPatchCall<'a, C> {}
14846
14847impl<'a, C> ProjectLocationEntryGroupPatchCall<'a, C>
14848where
14849 C: common::Connector,
14850{
14851 /// Perform the operation you have build so far.
14852 pub async fn doit(
14853 mut self,
14854 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1EntryGroup)> {
14855 use std::borrow::Cow;
14856 use std::io::{Read, Seek};
14857
14858 use common::{url::Params, ToParts};
14859 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14860
14861 let mut dd = common::DefaultDelegate;
14862 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14863 dlg.begin(common::MethodInfo {
14864 id: "datacatalog.projects.locations.entryGroups.patch",
14865 http_method: hyper::Method::PATCH,
14866 });
14867
14868 for &field in ["alt", "name", "updateMask"].iter() {
14869 if self._additional_params.contains_key(field) {
14870 dlg.finished(false);
14871 return Err(common::Error::FieldClash(field));
14872 }
14873 }
14874
14875 let mut params = Params::with_capacity(5 + self._additional_params.len());
14876 params.push("name", self._name);
14877 if let Some(value) = self._update_mask.as_ref() {
14878 params.push("updateMask", value.to_string());
14879 }
14880
14881 params.extend(self._additional_params.iter());
14882
14883 params.push("alt", "json");
14884 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14885 if self._scopes.is_empty() {
14886 self._scopes
14887 .insert(Scope::CloudPlatform.as_ref().to_string());
14888 }
14889
14890 #[allow(clippy::single_element_loop)]
14891 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14892 url = params.uri_replacement(url, param_name, find_this, true);
14893 }
14894 {
14895 let to_remove = ["name"];
14896 params.remove_params(&to_remove);
14897 }
14898
14899 let url = params.parse_with_url(&url);
14900
14901 let mut json_mime_type = mime::APPLICATION_JSON;
14902 let mut request_value_reader = {
14903 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14904 common::remove_json_null_values(&mut value);
14905 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14906 serde_json::to_writer(&mut dst, &value).unwrap();
14907 dst
14908 };
14909 let request_size = request_value_reader
14910 .seek(std::io::SeekFrom::End(0))
14911 .unwrap();
14912 request_value_reader
14913 .seek(std::io::SeekFrom::Start(0))
14914 .unwrap();
14915
14916 loop {
14917 let token = match self
14918 .hub
14919 .auth
14920 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14921 .await
14922 {
14923 Ok(token) => token,
14924 Err(e) => match dlg.token(e) {
14925 Ok(token) => token,
14926 Err(e) => {
14927 dlg.finished(false);
14928 return Err(common::Error::MissingToken(e));
14929 }
14930 },
14931 };
14932 request_value_reader
14933 .seek(std::io::SeekFrom::Start(0))
14934 .unwrap();
14935 let mut req_result = {
14936 let client = &self.hub.client;
14937 dlg.pre_request();
14938 let mut req_builder = hyper::Request::builder()
14939 .method(hyper::Method::PATCH)
14940 .uri(url.as_str())
14941 .header(USER_AGENT, self.hub._user_agent.clone());
14942
14943 if let Some(token) = token.as_ref() {
14944 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14945 }
14946
14947 let request = req_builder
14948 .header(CONTENT_TYPE, json_mime_type.to_string())
14949 .header(CONTENT_LENGTH, request_size as u64)
14950 .body(common::to_body(
14951 request_value_reader.get_ref().clone().into(),
14952 ));
14953
14954 client.request(request.unwrap()).await
14955 };
14956
14957 match req_result {
14958 Err(err) => {
14959 if let common::Retry::After(d) = dlg.http_error(&err) {
14960 sleep(d).await;
14961 continue;
14962 }
14963 dlg.finished(false);
14964 return Err(common::Error::HttpError(err));
14965 }
14966 Ok(res) => {
14967 let (mut parts, body) = res.into_parts();
14968 let mut body = common::Body::new(body);
14969 if !parts.status.is_success() {
14970 let bytes = common::to_bytes(body).await.unwrap_or_default();
14971 let error = serde_json::from_str(&common::to_string(&bytes));
14972 let response = common::to_response(parts, bytes.into());
14973
14974 if let common::Retry::After(d) =
14975 dlg.http_failure(&response, error.as_ref().ok())
14976 {
14977 sleep(d).await;
14978 continue;
14979 }
14980
14981 dlg.finished(false);
14982
14983 return Err(match error {
14984 Ok(value) => common::Error::BadRequest(value),
14985 _ => common::Error::Failure(response),
14986 });
14987 }
14988 let response = {
14989 let bytes = common::to_bytes(body).await.unwrap_or_default();
14990 let encoded = common::to_string(&bytes);
14991 match serde_json::from_str(&encoded) {
14992 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14993 Err(error) => {
14994 dlg.response_json_decode_error(&encoded, &error);
14995 return Err(common::Error::JsonDecodeError(
14996 encoded.to_string(),
14997 error,
14998 ));
14999 }
15000 }
15001 };
15002
15003 dlg.finished(true);
15004 return Ok(response);
15005 }
15006 }
15007 }
15008 }
15009
15010 ///
15011 /// Sets the *request* property to the given value.
15012 ///
15013 /// Even though the property as already been set when instantiating this call,
15014 /// we provide this method for API completeness.
15015 pub fn request(
15016 mut self,
15017 new_value: GoogleCloudDatacatalogV1EntryGroup,
15018 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
15019 self._request = new_value;
15020 self
15021 }
15022 /// Identifier. The resource name of the entry group in URL format. Note: The entry group itself and its child resources might not be stored in the location specified in its name.
15023 ///
15024 /// Sets the *name* path property to the given value.
15025 ///
15026 /// Even though the property as already been set when instantiating this call,
15027 /// we provide this method for API completeness.
15028 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupPatchCall<'a, C> {
15029 self._name = new_value.to_string();
15030 self
15031 }
15032 /// Names of fields whose values to overwrite on an entry group. If this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied.
15033 ///
15034 /// Sets the *update mask* query property to the given value.
15035 pub fn update_mask(
15036 mut self,
15037 new_value: common::FieldMask,
15038 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
15039 self._update_mask = Some(new_value);
15040 self
15041 }
15042 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15043 /// while executing the actual API request.
15044 ///
15045 /// ````text
15046 /// It should be used to handle progress information, and to implement a certain level of resilience.
15047 /// ````
15048 ///
15049 /// Sets the *delegate* property to the given value.
15050 pub fn delegate(
15051 mut self,
15052 new_value: &'a mut dyn common::Delegate,
15053 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
15054 self._delegate = Some(new_value);
15055 self
15056 }
15057
15058 /// Set any additional parameter of the query string used in the request.
15059 /// It should be used to set parameters which are not yet available through their own
15060 /// setters.
15061 ///
15062 /// Please note that this method must not be used to set any of the known parameters
15063 /// which have their own setter method. If done anyway, the request will fail.
15064 ///
15065 /// # Additional Parameters
15066 ///
15067 /// * *$.xgafv* (query-string) - V1 error format.
15068 /// * *access_token* (query-string) - OAuth access token.
15069 /// * *alt* (query-string) - Data format for response.
15070 /// * *callback* (query-string) - JSONP
15071 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15072 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15073 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15074 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15075 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15076 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15077 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15078 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupPatchCall<'a, C>
15079 where
15080 T: AsRef<str>,
15081 {
15082 self._additional_params
15083 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15084 self
15085 }
15086
15087 /// Identifies the authorization scope for the method you are building.
15088 ///
15089 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15090 /// [`Scope::CloudPlatform`].
15091 ///
15092 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15093 /// tokens for more than one scope.
15094 ///
15095 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15096 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15097 /// sufficient, a read-write scope will do as well.
15098 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupPatchCall<'a, C>
15099 where
15100 St: AsRef<str>,
15101 {
15102 self._scopes.insert(String::from(scope.as_ref()));
15103 self
15104 }
15105 /// Identifies the authorization scope(s) for the method you are building.
15106 ///
15107 /// See [`Self::add_scope()`] for details.
15108 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupPatchCall<'a, C>
15109 where
15110 I: IntoIterator<Item = St>,
15111 St: AsRef<str>,
15112 {
15113 self._scopes
15114 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15115 self
15116 }
15117
15118 /// Removes all scopes, and no default scope will be used either.
15119 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15120 /// for details).
15121 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupPatchCall<'a, C> {
15122 self._scopes.clear();
15123 self
15124 }
15125}
15126
15127/// Sets an access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates - Entry groups Note: This method sets policies only within Data Catalog and can't be used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources synced with the Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
15128///
15129/// A builder for the *locations.entryGroups.setIamPolicy* method supported by a *project* resource.
15130/// It is not used directly, but through a [`ProjectMethods`] instance.
15131///
15132/// # Example
15133///
15134/// Instantiate a resource method builder
15135///
15136/// ```test_harness,no_run
15137/// # extern crate hyper;
15138/// # extern crate hyper_rustls;
15139/// # extern crate google_datacatalog1 as datacatalog1;
15140/// use datacatalog1::api::SetIamPolicyRequest;
15141/// # async fn dox() {
15142/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15143///
15144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15145/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15146/// # .with_native_roots()
15147/// # .unwrap()
15148/// # .https_only()
15149/// # .enable_http2()
15150/// # .build();
15151///
15152/// # let executor = hyper_util::rt::TokioExecutor::new();
15153/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15154/// # secret,
15155/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15156/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15157/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15158/// # ),
15159/// # ).build().await.unwrap();
15160///
15161/// # let client = hyper_util::client::legacy::Client::builder(
15162/// # hyper_util::rt::TokioExecutor::new()
15163/// # )
15164/// # .build(
15165/// # hyper_rustls::HttpsConnectorBuilder::new()
15166/// # .with_native_roots()
15167/// # .unwrap()
15168/// # .https_or_http()
15169/// # .enable_http2()
15170/// # .build()
15171/// # );
15172/// # let mut hub = DataCatalog::new(client, auth);
15173/// // As the method needs a request, you would usually fill it with the desired information
15174/// // into the respective structure. Some of the parts shown here might not be applicable !
15175/// // Values shown here are possibly random and not representative !
15176/// let mut req = SetIamPolicyRequest::default();
15177///
15178/// // You can configure optional parameters by calling the respective setters at will, and
15179/// // execute the final call using `doit()`.
15180/// // Values shown here are possibly random and not representative !
15181/// let result = hub.projects().locations_entry_groups_set_iam_policy(req, "resource")
15182/// .doit().await;
15183/// # }
15184/// ```
15185pub struct ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
15186where
15187 C: 'a,
15188{
15189 hub: &'a DataCatalog<C>,
15190 _request: SetIamPolicyRequest,
15191 _resource: String,
15192 _delegate: Option<&'a mut dyn common::Delegate>,
15193 _additional_params: HashMap<String, String>,
15194 _scopes: BTreeSet<String>,
15195}
15196
15197impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {}
15198
15199impl<'a, C> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
15200where
15201 C: common::Connector,
15202{
15203 /// Perform the operation you have build so far.
15204 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
15205 use std::borrow::Cow;
15206 use std::io::{Read, Seek};
15207
15208 use common::{url::Params, ToParts};
15209 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15210
15211 let mut dd = common::DefaultDelegate;
15212 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15213 dlg.begin(common::MethodInfo {
15214 id: "datacatalog.projects.locations.entryGroups.setIamPolicy",
15215 http_method: hyper::Method::POST,
15216 });
15217
15218 for &field in ["alt", "resource"].iter() {
15219 if self._additional_params.contains_key(field) {
15220 dlg.finished(false);
15221 return Err(common::Error::FieldClash(field));
15222 }
15223 }
15224
15225 let mut params = Params::with_capacity(4 + self._additional_params.len());
15226 params.push("resource", self._resource);
15227
15228 params.extend(self._additional_params.iter());
15229
15230 params.push("alt", "json");
15231 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
15232 if self._scopes.is_empty() {
15233 self._scopes
15234 .insert(Scope::CloudPlatform.as_ref().to_string());
15235 }
15236
15237 #[allow(clippy::single_element_loop)]
15238 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15239 url = params.uri_replacement(url, param_name, find_this, true);
15240 }
15241 {
15242 let to_remove = ["resource"];
15243 params.remove_params(&to_remove);
15244 }
15245
15246 let url = params.parse_with_url(&url);
15247
15248 let mut json_mime_type = mime::APPLICATION_JSON;
15249 let mut request_value_reader = {
15250 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15251 common::remove_json_null_values(&mut value);
15252 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15253 serde_json::to_writer(&mut dst, &value).unwrap();
15254 dst
15255 };
15256 let request_size = request_value_reader
15257 .seek(std::io::SeekFrom::End(0))
15258 .unwrap();
15259 request_value_reader
15260 .seek(std::io::SeekFrom::Start(0))
15261 .unwrap();
15262
15263 loop {
15264 let token = match self
15265 .hub
15266 .auth
15267 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15268 .await
15269 {
15270 Ok(token) => token,
15271 Err(e) => match dlg.token(e) {
15272 Ok(token) => token,
15273 Err(e) => {
15274 dlg.finished(false);
15275 return Err(common::Error::MissingToken(e));
15276 }
15277 },
15278 };
15279 request_value_reader
15280 .seek(std::io::SeekFrom::Start(0))
15281 .unwrap();
15282 let mut req_result = {
15283 let client = &self.hub.client;
15284 dlg.pre_request();
15285 let mut req_builder = hyper::Request::builder()
15286 .method(hyper::Method::POST)
15287 .uri(url.as_str())
15288 .header(USER_AGENT, self.hub._user_agent.clone());
15289
15290 if let Some(token) = token.as_ref() {
15291 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15292 }
15293
15294 let request = req_builder
15295 .header(CONTENT_TYPE, json_mime_type.to_string())
15296 .header(CONTENT_LENGTH, request_size as u64)
15297 .body(common::to_body(
15298 request_value_reader.get_ref().clone().into(),
15299 ));
15300
15301 client.request(request.unwrap()).await
15302 };
15303
15304 match req_result {
15305 Err(err) => {
15306 if let common::Retry::After(d) = dlg.http_error(&err) {
15307 sleep(d).await;
15308 continue;
15309 }
15310 dlg.finished(false);
15311 return Err(common::Error::HttpError(err));
15312 }
15313 Ok(res) => {
15314 let (mut parts, body) = res.into_parts();
15315 let mut body = common::Body::new(body);
15316 if !parts.status.is_success() {
15317 let bytes = common::to_bytes(body).await.unwrap_or_default();
15318 let error = serde_json::from_str(&common::to_string(&bytes));
15319 let response = common::to_response(parts, bytes.into());
15320
15321 if let common::Retry::After(d) =
15322 dlg.http_failure(&response, error.as_ref().ok())
15323 {
15324 sleep(d).await;
15325 continue;
15326 }
15327
15328 dlg.finished(false);
15329
15330 return Err(match error {
15331 Ok(value) => common::Error::BadRequest(value),
15332 _ => common::Error::Failure(response),
15333 });
15334 }
15335 let response = {
15336 let bytes = common::to_bytes(body).await.unwrap_or_default();
15337 let encoded = common::to_string(&bytes);
15338 match serde_json::from_str(&encoded) {
15339 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15340 Err(error) => {
15341 dlg.response_json_decode_error(&encoded, &error);
15342 return Err(common::Error::JsonDecodeError(
15343 encoded.to_string(),
15344 error,
15345 ));
15346 }
15347 }
15348 };
15349
15350 dlg.finished(true);
15351 return Ok(response);
15352 }
15353 }
15354 }
15355 }
15356
15357 ///
15358 /// Sets the *request* property to the given value.
15359 ///
15360 /// Even though the property as already been set when instantiating this call,
15361 /// we provide this method for API completeness.
15362 pub fn request(
15363 mut self,
15364 new_value: SetIamPolicyRequest,
15365 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
15366 self._request = new_value;
15367 self
15368 }
15369 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
15370 ///
15371 /// Sets the *resource* path property to the given value.
15372 ///
15373 /// Even though the property as already been set when instantiating this call,
15374 /// we provide this method for API completeness.
15375 pub fn resource(mut self, new_value: &str) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
15376 self._resource = new_value.to_string();
15377 self
15378 }
15379 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15380 /// while executing the actual API request.
15381 ///
15382 /// ````text
15383 /// It should be used to handle progress information, and to implement a certain level of resilience.
15384 /// ````
15385 ///
15386 /// Sets the *delegate* property to the given value.
15387 pub fn delegate(
15388 mut self,
15389 new_value: &'a mut dyn common::Delegate,
15390 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
15391 self._delegate = Some(new_value);
15392 self
15393 }
15394
15395 /// Set any additional parameter of the query string used in the request.
15396 /// It should be used to set parameters which are not yet available through their own
15397 /// setters.
15398 ///
15399 /// Please note that this method must not be used to set any of the known parameters
15400 /// which have their own setter method. If done anyway, the request will fail.
15401 ///
15402 /// # Additional Parameters
15403 ///
15404 /// * *$.xgafv* (query-string) - V1 error format.
15405 /// * *access_token* (query-string) - OAuth access token.
15406 /// * *alt* (query-string) - Data format for response.
15407 /// * *callback* (query-string) - JSONP
15408 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15409 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15410 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15411 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15412 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15413 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15414 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15415 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
15416 where
15417 T: AsRef<str>,
15418 {
15419 self._additional_params
15420 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15421 self
15422 }
15423
15424 /// Identifies the authorization scope for the method you are building.
15425 ///
15426 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15427 /// [`Scope::CloudPlatform`].
15428 ///
15429 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15430 /// tokens for more than one scope.
15431 ///
15432 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15433 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15434 /// sufficient, a read-write scope will do as well.
15435 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
15436 where
15437 St: AsRef<str>,
15438 {
15439 self._scopes.insert(String::from(scope.as_ref()));
15440 self
15441 }
15442 /// Identifies the authorization scope(s) for the method you are building.
15443 ///
15444 /// See [`Self::add_scope()`] for details.
15445 pub fn add_scopes<I, St>(
15446 mut self,
15447 scopes: I,
15448 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
15449 where
15450 I: IntoIterator<Item = St>,
15451 St: AsRef<str>,
15452 {
15453 self._scopes
15454 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15455 self
15456 }
15457
15458 /// Removes all scopes, and no default scope will be used either.
15459 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15460 /// for details).
15461 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
15462 self._scopes.clear();
15463 self
15464 }
15465}
15466
15467/// Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist. Supported resources are: - Tag templates - Entry groups Note: This method gets policies only within Data Catalog and can't be used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources ingested into Data Catalog. No Google IAM permissions are required to call this method.
15468///
15469/// A builder for the *locations.entryGroups.testIamPermissions* method supported by a *project* resource.
15470/// It is not used directly, but through a [`ProjectMethods`] instance.
15471///
15472/// # Example
15473///
15474/// Instantiate a resource method builder
15475///
15476/// ```test_harness,no_run
15477/// # extern crate hyper;
15478/// # extern crate hyper_rustls;
15479/// # extern crate google_datacatalog1 as datacatalog1;
15480/// use datacatalog1::api::TestIamPermissionsRequest;
15481/// # async fn dox() {
15482/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15483///
15484/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15485/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15486/// # .with_native_roots()
15487/// # .unwrap()
15488/// # .https_only()
15489/// # .enable_http2()
15490/// # .build();
15491///
15492/// # let executor = hyper_util::rt::TokioExecutor::new();
15493/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15494/// # secret,
15495/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15496/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15497/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15498/// # ),
15499/// # ).build().await.unwrap();
15500///
15501/// # let client = hyper_util::client::legacy::Client::builder(
15502/// # hyper_util::rt::TokioExecutor::new()
15503/// # )
15504/// # .build(
15505/// # hyper_rustls::HttpsConnectorBuilder::new()
15506/// # .with_native_roots()
15507/// # .unwrap()
15508/// # .https_or_http()
15509/// # .enable_http2()
15510/// # .build()
15511/// # );
15512/// # let mut hub = DataCatalog::new(client, auth);
15513/// // As the method needs a request, you would usually fill it with the desired information
15514/// // into the respective structure. Some of the parts shown here might not be applicable !
15515/// // Values shown here are possibly random and not representative !
15516/// let mut req = TestIamPermissionsRequest::default();
15517///
15518/// // You can configure optional parameters by calling the respective setters at will, and
15519/// // execute the final call using `doit()`.
15520/// // Values shown here are possibly random and not representative !
15521/// let result = hub.projects().locations_entry_groups_test_iam_permissions(req, "resource")
15522/// .doit().await;
15523/// # }
15524/// ```
15525pub struct ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
15526where
15527 C: 'a,
15528{
15529 hub: &'a DataCatalog<C>,
15530 _request: TestIamPermissionsRequest,
15531 _resource: String,
15532 _delegate: Option<&'a mut dyn common::Delegate>,
15533 _additional_params: HashMap<String, String>,
15534 _scopes: BTreeSet<String>,
15535}
15536
15537impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {}
15538
15539impl<'a, C> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
15540where
15541 C: common::Connector,
15542{
15543 /// Perform the operation you have build so far.
15544 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
15545 use std::borrow::Cow;
15546 use std::io::{Read, Seek};
15547
15548 use common::{url::Params, ToParts};
15549 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15550
15551 let mut dd = common::DefaultDelegate;
15552 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15553 dlg.begin(common::MethodInfo {
15554 id: "datacatalog.projects.locations.entryGroups.testIamPermissions",
15555 http_method: hyper::Method::POST,
15556 });
15557
15558 for &field in ["alt", "resource"].iter() {
15559 if self._additional_params.contains_key(field) {
15560 dlg.finished(false);
15561 return Err(common::Error::FieldClash(field));
15562 }
15563 }
15564
15565 let mut params = Params::with_capacity(4 + self._additional_params.len());
15566 params.push("resource", self._resource);
15567
15568 params.extend(self._additional_params.iter());
15569
15570 params.push("alt", "json");
15571 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
15572 if self._scopes.is_empty() {
15573 self._scopes
15574 .insert(Scope::CloudPlatform.as_ref().to_string());
15575 }
15576
15577 #[allow(clippy::single_element_loop)]
15578 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15579 url = params.uri_replacement(url, param_name, find_this, true);
15580 }
15581 {
15582 let to_remove = ["resource"];
15583 params.remove_params(&to_remove);
15584 }
15585
15586 let url = params.parse_with_url(&url);
15587
15588 let mut json_mime_type = mime::APPLICATION_JSON;
15589 let mut request_value_reader = {
15590 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15591 common::remove_json_null_values(&mut value);
15592 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15593 serde_json::to_writer(&mut dst, &value).unwrap();
15594 dst
15595 };
15596 let request_size = request_value_reader
15597 .seek(std::io::SeekFrom::End(0))
15598 .unwrap();
15599 request_value_reader
15600 .seek(std::io::SeekFrom::Start(0))
15601 .unwrap();
15602
15603 loop {
15604 let token = match self
15605 .hub
15606 .auth
15607 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15608 .await
15609 {
15610 Ok(token) => token,
15611 Err(e) => match dlg.token(e) {
15612 Ok(token) => token,
15613 Err(e) => {
15614 dlg.finished(false);
15615 return Err(common::Error::MissingToken(e));
15616 }
15617 },
15618 };
15619 request_value_reader
15620 .seek(std::io::SeekFrom::Start(0))
15621 .unwrap();
15622 let mut req_result = {
15623 let client = &self.hub.client;
15624 dlg.pre_request();
15625 let mut req_builder = hyper::Request::builder()
15626 .method(hyper::Method::POST)
15627 .uri(url.as_str())
15628 .header(USER_AGENT, self.hub._user_agent.clone());
15629
15630 if let Some(token) = token.as_ref() {
15631 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15632 }
15633
15634 let request = req_builder
15635 .header(CONTENT_TYPE, json_mime_type.to_string())
15636 .header(CONTENT_LENGTH, request_size as u64)
15637 .body(common::to_body(
15638 request_value_reader.get_ref().clone().into(),
15639 ));
15640
15641 client.request(request.unwrap()).await
15642 };
15643
15644 match req_result {
15645 Err(err) => {
15646 if let common::Retry::After(d) = dlg.http_error(&err) {
15647 sleep(d).await;
15648 continue;
15649 }
15650 dlg.finished(false);
15651 return Err(common::Error::HttpError(err));
15652 }
15653 Ok(res) => {
15654 let (mut parts, body) = res.into_parts();
15655 let mut body = common::Body::new(body);
15656 if !parts.status.is_success() {
15657 let bytes = common::to_bytes(body).await.unwrap_or_default();
15658 let error = serde_json::from_str(&common::to_string(&bytes));
15659 let response = common::to_response(parts, bytes.into());
15660
15661 if let common::Retry::After(d) =
15662 dlg.http_failure(&response, error.as_ref().ok())
15663 {
15664 sleep(d).await;
15665 continue;
15666 }
15667
15668 dlg.finished(false);
15669
15670 return Err(match error {
15671 Ok(value) => common::Error::BadRequest(value),
15672 _ => common::Error::Failure(response),
15673 });
15674 }
15675 let response = {
15676 let bytes = common::to_bytes(body).await.unwrap_or_default();
15677 let encoded = common::to_string(&bytes);
15678 match serde_json::from_str(&encoded) {
15679 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15680 Err(error) => {
15681 dlg.response_json_decode_error(&encoded, &error);
15682 return Err(common::Error::JsonDecodeError(
15683 encoded.to_string(),
15684 error,
15685 ));
15686 }
15687 }
15688 };
15689
15690 dlg.finished(true);
15691 return Ok(response);
15692 }
15693 }
15694 }
15695 }
15696
15697 ///
15698 /// Sets the *request* property to the given value.
15699 ///
15700 /// Even though the property as already been set when instantiating this call,
15701 /// we provide this method for API completeness.
15702 pub fn request(
15703 mut self,
15704 new_value: TestIamPermissionsRequest,
15705 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
15706 self._request = new_value;
15707 self
15708 }
15709 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
15710 ///
15711 /// Sets the *resource* path property to the given value.
15712 ///
15713 /// Even though the property as already been set when instantiating this call,
15714 /// we provide this method for API completeness.
15715 pub fn resource(
15716 mut self,
15717 new_value: &str,
15718 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
15719 self._resource = new_value.to_string();
15720 self
15721 }
15722 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15723 /// while executing the actual API request.
15724 ///
15725 /// ````text
15726 /// It should be used to handle progress information, and to implement a certain level of resilience.
15727 /// ````
15728 ///
15729 /// Sets the *delegate* property to the given value.
15730 pub fn delegate(
15731 mut self,
15732 new_value: &'a mut dyn common::Delegate,
15733 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
15734 self._delegate = Some(new_value);
15735 self
15736 }
15737
15738 /// Set any additional parameter of the query string used in the request.
15739 /// It should be used to set parameters which are not yet available through their own
15740 /// setters.
15741 ///
15742 /// Please note that this method must not be used to set any of the known parameters
15743 /// which have their own setter method. If done anyway, the request will fail.
15744 ///
15745 /// # Additional Parameters
15746 ///
15747 /// * *$.xgafv* (query-string) - V1 error format.
15748 /// * *access_token* (query-string) - OAuth access token.
15749 /// * *alt* (query-string) - Data format for response.
15750 /// * *callback* (query-string) - JSONP
15751 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15752 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15753 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15754 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15755 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15756 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15757 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15758 pub fn param<T>(
15759 mut self,
15760 name: T,
15761 value: T,
15762 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
15763 where
15764 T: AsRef<str>,
15765 {
15766 self._additional_params
15767 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15768 self
15769 }
15770
15771 /// Identifies the authorization scope for the method you are building.
15772 ///
15773 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15774 /// [`Scope::CloudPlatform`].
15775 ///
15776 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15777 /// tokens for more than one scope.
15778 ///
15779 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15780 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15781 /// sufficient, a read-write scope will do as well.
15782 pub fn add_scope<St>(
15783 mut self,
15784 scope: St,
15785 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
15786 where
15787 St: AsRef<str>,
15788 {
15789 self._scopes.insert(String::from(scope.as_ref()));
15790 self
15791 }
15792 /// Identifies the authorization scope(s) for the method you are building.
15793 ///
15794 /// See [`Self::add_scope()`] for details.
15795 pub fn add_scopes<I, St>(
15796 mut self,
15797 scopes: I,
15798 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
15799 where
15800 I: IntoIterator<Item = St>,
15801 St: AsRef<str>,
15802 {
15803 self._scopes
15804 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15805 self
15806 }
15807
15808 /// Removes all scopes, and no default scope will be used either.
15809 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15810 /// for details).
15811 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
15812 self._scopes.clear();
15813 self
15814 }
15815}
15816
15817/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
15818///
15819/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
15820/// It is not used directly, but through a [`ProjectMethods`] instance.
15821///
15822/// # Example
15823///
15824/// Instantiate a resource method builder
15825///
15826/// ```test_harness,no_run
15827/// # extern crate hyper;
15828/// # extern crate hyper_rustls;
15829/// # extern crate google_datacatalog1 as datacatalog1;
15830/// # async fn dox() {
15831/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15832///
15833/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15834/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15835/// # .with_native_roots()
15836/// # .unwrap()
15837/// # .https_only()
15838/// # .enable_http2()
15839/// # .build();
15840///
15841/// # let executor = hyper_util::rt::TokioExecutor::new();
15842/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15843/// # secret,
15844/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15845/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15846/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15847/// # ),
15848/// # ).build().await.unwrap();
15849///
15850/// # let client = hyper_util::client::legacy::Client::builder(
15851/// # hyper_util::rt::TokioExecutor::new()
15852/// # )
15853/// # .build(
15854/// # hyper_rustls::HttpsConnectorBuilder::new()
15855/// # .with_native_roots()
15856/// # .unwrap()
15857/// # .https_or_http()
15858/// # .enable_http2()
15859/// # .build()
15860/// # );
15861/// # let mut hub = DataCatalog::new(client, auth);
15862/// // You can configure optional parameters by calling the respective setters at will, and
15863/// // execute the final call using `doit()`.
15864/// // Values shown here are possibly random and not representative !
15865/// let result = hub.projects().locations_operations_cancel("name")
15866/// .doit().await;
15867/// # }
15868/// ```
15869pub struct ProjectLocationOperationCancelCall<'a, C>
15870where
15871 C: 'a,
15872{
15873 hub: &'a DataCatalog<C>,
15874 _name: String,
15875 _delegate: Option<&'a mut dyn common::Delegate>,
15876 _additional_params: HashMap<String, String>,
15877 _scopes: BTreeSet<String>,
15878}
15879
15880impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
15881
15882impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
15883where
15884 C: common::Connector,
15885{
15886 /// Perform the operation you have build so far.
15887 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
15888 use std::borrow::Cow;
15889 use std::io::{Read, Seek};
15890
15891 use common::{url::Params, ToParts};
15892 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15893
15894 let mut dd = common::DefaultDelegate;
15895 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15896 dlg.begin(common::MethodInfo {
15897 id: "datacatalog.projects.locations.operations.cancel",
15898 http_method: hyper::Method::POST,
15899 });
15900
15901 for &field in ["alt", "name"].iter() {
15902 if self._additional_params.contains_key(field) {
15903 dlg.finished(false);
15904 return Err(common::Error::FieldClash(field));
15905 }
15906 }
15907
15908 let mut params = Params::with_capacity(3 + self._additional_params.len());
15909 params.push("name", self._name);
15910
15911 params.extend(self._additional_params.iter());
15912
15913 params.push("alt", "json");
15914 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
15915 if self._scopes.is_empty() {
15916 self._scopes
15917 .insert(Scope::CloudPlatform.as_ref().to_string());
15918 }
15919
15920 #[allow(clippy::single_element_loop)]
15921 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15922 url = params.uri_replacement(url, param_name, find_this, true);
15923 }
15924 {
15925 let to_remove = ["name"];
15926 params.remove_params(&to_remove);
15927 }
15928
15929 let url = params.parse_with_url(&url);
15930
15931 loop {
15932 let token = match self
15933 .hub
15934 .auth
15935 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15936 .await
15937 {
15938 Ok(token) => token,
15939 Err(e) => match dlg.token(e) {
15940 Ok(token) => token,
15941 Err(e) => {
15942 dlg.finished(false);
15943 return Err(common::Error::MissingToken(e));
15944 }
15945 },
15946 };
15947 let mut req_result = {
15948 let client = &self.hub.client;
15949 dlg.pre_request();
15950 let mut req_builder = hyper::Request::builder()
15951 .method(hyper::Method::POST)
15952 .uri(url.as_str())
15953 .header(USER_AGENT, self.hub._user_agent.clone());
15954
15955 if let Some(token) = token.as_ref() {
15956 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15957 }
15958
15959 let request = req_builder
15960 .header(CONTENT_LENGTH, 0_u64)
15961 .body(common::to_body::<String>(None));
15962
15963 client.request(request.unwrap()).await
15964 };
15965
15966 match req_result {
15967 Err(err) => {
15968 if let common::Retry::After(d) = dlg.http_error(&err) {
15969 sleep(d).await;
15970 continue;
15971 }
15972 dlg.finished(false);
15973 return Err(common::Error::HttpError(err));
15974 }
15975 Ok(res) => {
15976 let (mut parts, body) = res.into_parts();
15977 let mut body = common::Body::new(body);
15978 if !parts.status.is_success() {
15979 let bytes = common::to_bytes(body).await.unwrap_or_default();
15980 let error = serde_json::from_str(&common::to_string(&bytes));
15981 let response = common::to_response(parts, bytes.into());
15982
15983 if let common::Retry::After(d) =
15984 dlg.http_failure(&response, error.as_ref().ok())
15985 {
15986 sleep(d).await;
15987 continue;
15988 }
15989
15990 dlg.finished(false);
15991
15992 return Err(match error {
15993 Ok(value) => common::Error::BadRequest(value),
15994 _ => common::Error::Failure(response),
15995 });
15996 }
15997 let response = {
15998 let bytes = common::to_bytes(body).await.unwrap_or_default();
15999 let encoded = common::to_string(&bytes);
16000 match serde_json::from_str(&encoded) {
16001 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16002 Err(error) => {
16003 dlg.response_json_decode_error(&encoded, &error);
16004 return Err(common::Error::JsonDecodeError(
16005 encoded.to_string(),
16006 error,
16007 ));
16008 }
16009 }
16010 };
16011
16012 dlg.finished(true);
16013 return Ok(response);
16014 }
16015 }
16016 }
16017 }
16018
16019 /// The name of the operation resource to be cancelled.
16020 ///
16021 /// Sets the *name* path property to the given value.
16022 ///
16023 /// Even though the property as already been set when instantiating this call,
16024 /// we provide this method for API completeness.
16025 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
16026 self._name = new_value.to_string();
16027 self
16028 }
16029 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16030 /// while executing the actual API request.
16031 ///
16032 /// ````text
16033 /// It should be used to handle progress information, and to implement a certain level of resilience.
16034 /// ````
16035 ///
16036 /// Sets the *delegate* property to the given value.
16037 pub fn delegate(
16038 mut self,
16039 new_value: &'a mut dyn common::Delegate,
16040 ) -> ProjectLocationOperationCancelCall<'a, C> {
16041 self._delegate = Some(new_value);
16042 self
16043 }
16044
16045 /// Set any additional parameter of the query string used in the request.
16046 /// It should be used to set parameters which are not yet available through their own
16047 /// setters.
16048 ///
16049 /// Please note that this method must not be used to set any of the known parameters
16050 /// which have their own setter method. If done anyway, the request will fail.
16051 ///
16052 /// # Additional Parameters
16053 ///
16054 /// * *$.xgafv* (query-string) - V1 error format.
16055 /// * *access_token* (query-string) - OAuth access token.
16056 /// * *alt* (query-string) - Data format for response.
16057 /// * *callback* (query-string) - JSONP
16058 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16059 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16060 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16061 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16062 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16063 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16064 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16065 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
16066 where
16067 T: AsRef<str>,
16068 {
16069 self._additional_params
16070 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16071 self
16072 }
16073
16074 /// Identifies the authorization scope for the method you are building.
16075 ///
16076 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16077 /// [`Scope::CloudPlatform`].
16078 ///
16079 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16080 /// tokens for more than one scope.
16081 ///
16082 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16083 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16084 /// sufficient, a read-write scope will do as well.
16085 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
16086 where
16087 St: AsRef<str>,
16088 {
16089 self._scopes.insert(String::from(scope.as_ref()));
16090 self
16091 }
16092 /// Identifies the authorization scope(s) for the method you are building.
16093 ///
16094 /// See [`Self::add_scope()`] for details.
16095 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
16096 where
16097 I: IntoIterator<Item = St>,
16098 St: AsRef<str>,
16099 {
16100 self._scopes
16101 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16102 self
16103 }
16104
16105 /// Removes all scopes, and no default scope will be used either.
16106 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16107 /// for details).
16108 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
16109 self._scopes.clear();
16110 self
16111 }
16112}
16113
16114/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
16115///
16116/// A builder for the *locations.operations.delete* method supported by a *project* resource.
16117/// It is not used directly, but through a [`ProjectMethods`] instance.
16118///
16119/// # Example
16120///
16121/// Instantiate a resource method builder
16122///
16123/// ```test_harness,no_run
16124/// # extern crate hyper;
16125/// # extern crate hyper_rustls;
16126/// # extern crate google_datacatalog1 as datacatalog1;
16127/// # async fn dox() {
16128/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16129///
16130/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16131/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16132/// # .with_native_roots()
16133/// # .unwrap()
16134/// # .https_only()
16135/// # .enable_http2()
16136/// # .build();
16137///
16138/// # let executor = hyper_util::rt::TokioExecutor::new();
16139/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16140/// # secret,
16141/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16142/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16143/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16144/// # ),
16145/// # ).build().await.unwrap();
16146///
16147/// # let client = hyper_util::client::legacy::Client::builder(
16148/// # hyper_util::rt::TokioExecutor::new()
16149/// # )
16150/// # .build(
16151/// # hyper_rustls::HttpsConnectorBuilder::new()
16152/// # .with_native_roots()
16153/// # .unwrap()
16154/// # .https_or_http()
16155/// # .enable_http2()
16156/// # .build()
16157/// # );
16158/// # let mut hub = DataCatalog::new(client, auth);
16159/// // You can configure optional parameters by calling the respective setters at will, and
16160/// // execute the final call using `doit()`.
16161/// // Values shown here are possibly random and not representative !
16162/// let result = hub.projects().locations_operations_delete("name")
16163/// .doit().await;
16164/// # }
16165/// ```
16166pub struct ProjectLocationOperationDeleteCall<'a, C>
16167where
16168 C: 'a,
16169{
16170 hub: &'a DataCatalog<C>,
16171 _name: String,
16172 _delegate: Option<&'a mut dyn common::Delegate>,
16173 _additional_params: HashMap<String, String>,
16174 _scopes: BTreeSet<String>,
16175}
16176
16177impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
16178
16179impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
16180where
16181 C: common::Connector,
16182{
16183 /// Perform the operation you have build so far.
16184 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16185 use std::borrow::Cow;
16186 use std::io::{Read, Seek};
16187
16188 use common::{url::Params, ToParts};
16189 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16190
16191 let mut dd = common::DefaultDelegate;
16192 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16193 dlg.begin(common::MethodInfo {
16194 id: "datacatalog.projects.locations.operations.delete",
16195 http_method: hyper::Method::DELETE,
16196 });
16197
16198 for &field in ["alt", "name"].iter() {
16199 if self._additional_params.contains_key(field) {
16200 dlg.finished(false);
16201 return Err(common::Error::FieldClash(field));
16202 }
16203 }
16204
16205 let mut params = Params::with_capacity(3 + self._additional_params.len());
16206 params.push("name", self._name);
16207
16208 params.extend(self._additional_params.iter());
16209
16210 params.push("alt", "json");
16211 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16212 if self._scopes.is_empty() {
16213 self._scopes
16214 .insert(Scope::CloudPlatform.as_ref().to_string());
16215 }
16216
16217 #[allow(clippy::single_element_loop)]
16218 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16219 url = params.uri_replacement(url, param_name, find_this, true);
16220 }
16221 {
16222 let to_remove = ["name"];
16223 params.remove_params(&to_remove);
16224 }
16225
16226 let url = params.parse_with_url(&url);
16227
16228 loop {
16229 let token = match self
16230 .hub
16231 .auth
16232 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16233 .await
16234 {
16235 Ok(token) => token,
16236 Err(e) => match dlg.token(e) {
16237 Ok(token) => token,
16238 Err(e) => {
16239 dlg.finished(false);
16240 return Err(common::Error::MissingToken(e));
16241 }
16242 },
16243 };
16244 let mut req_result = {
16245 let client = &self.hub.client;
16246 dlg.pre_request();
16247 let mut req_builder = hyper::Request::builder()
16248 .method(hyper::Method::DELETE)
16249 .uri(url.as_str())
16250 .header(USER_AGENT, self.hub._user_agent.clone());
16251
16252 if let Some(token) = token.as_ref() {
16253 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16254 }
16255
16256 let request = req_builder
16257 .header(CONTENT_LENGTH, 0_u64)
16258 .body(common::to_body::<String>(None));
16259
16260 client.request(request.unwrap()).await
16261 };
16262
16263 match req_result {
16264 Err(err) => {
16265 if let common::Retry::After(d) = dlg.http_error(&err) {
16266 sleep(d).await;
16267 continue;
16268 }
16269 dlg.finished(false);
16270 return Err(common::Error::HttpError(err));
16271 }
16272 Ok(res) => {
16273 let (mut parts, body) = res.into_parts();
16274 let mut body = common::Body::new(body);
16275 if !parts.status.is_success() {
16276 let bytes = common::to_bytes(body).await.unwrap_or_default();
16277 let error = serde_json::from_str(&common::to_string(&bytes));
16278 let response = common::to_response(parts, bytes.into());
16279
16280 if let common::Retry::After(d) =
16281 dlg.http_failure(&response, error.as_ref().ok())
16282 {
16283 sleep(d).await;
16284 continue;
16285 }
16286
16287 dlg.finished(false);
16288
16289 return Err(match error {
16290 Ok(value) => common::Error::BadRequest(value),
16291 _ => common::Error::Failure(response),
16292 });
16293 }
16294 let response = {
16295 let bytes = common::to_bytes(body).await.unwrap_or_default();
16296 let encoded = common::to_string(&bytes);
16297 match serde_json::from_str(&encoded) {
16298 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16299 Err(error) => {
16300 dlg.response_json_decode_error(&encoded, &error);
16301 return Err(common::Error::JsonDecodeError(
16302 encoded.to_string(),
16303 error,
16304 ));
16305 }
16306 }
16307 };
16308
16309 dlg.finished(true);
16310 return Ok(response);
16311 }
16312 }
16313 }
16314 }
16315
16316 /// The name of the operation resource to be deleted.
16317 ///
16318 /// Sets the *name* path property to the given value.
16319 ///
16320 /// Even though the property as already been set when instantiating this call,
16321 /// we provide this method for API completeness.
16322 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
16323 self._name = new_value.to_string();
16324 self
16325 }
16326 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16327 /// while executing the actual API request.
16328 ///
16329 /// ````text
16330 /// It should be used to handle progress information, and to implement a certain level of resilience.
16331 /// ````
16332 ///
16333 /// Sets the *delegate* property to the given value.
16334 pub fn delegate(
16335 mut self,
16336 new_value: &'a mut dyn common::Delegate,
16337 ) -> ProjectLocationOperationDeleteCall<'a, C> {
16338 self._delegate = Some(new_value);
16339 self
16340 }
16341
16342 /// Set any additional parameter of the query string used in the request.
16343 /// It should be used to set parameters which are not yet available through their own
16344 /// setters.
16345 ///
16346 /// Please note that this method must not be used to set any of the known parameters
16347 /// which have their own setter method. If done anyway, the request will fail.
16348 ///
16349 /// # Additional Parameters
16350 ///
16351 /// * *$.xgafv* (query-string) - V1 error format.
16352 /// * *access_token* (query-string) - OAuth access token.
16353 /// * *alt* (query-string) - Data format for response.
16354 /// * *callback* (query-string) - JSONP
16355 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16356 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16357 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16358 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16359 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16360 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16361 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16362 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
16363 where
16364 T: AsRef<str>,
16365 {
16366 self._additional_params
16367 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16368 self
16369 }
16370
16371 /// Identifies the authorization scope for the method you are building.
16372 ///
16373 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16374 /// [`Scope::CloudPlatform`].
16375 ///
16376 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16377 /// tokens for more than one scope.
16378 ///
16379 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16380 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16381 /// sufficient, a read-write scope will do as well.
16382 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
16383 where
16384 St: AsRef<str>,
16385 {
16386 self._scopes.insert(String::from(scope.as_ref()));
16387 self
16388 }
16389 /// Identifies the authorization scope(s) for the method you are building.
16390 ///
16391 /// See [`Self::add_scope()`] for details.
16392 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
16393 where
16394 I: IntoIterator<Item = St>,
16395 St: AsRef<str>,
16396 {
16397 self._scopes
16398 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16399 self
16400 }
16401
16402 /// Removes all scopes, and no default scope will be used either.
16403 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16404 /// for details).
16405 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
16406 self._scopes.clear();
16407 self
16408 }
16409}
16410
16411/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
16412///
16413/// A builder for the *locations.operations.get* method supported by a *project* resource.
16414/// It is not used directly, but through a [`ProjectMethods`] instance.
16415///
16416/// # Example
16417///
16418/// Instantiate a resource method builder
16419///
16420/// ```test_harness,no_run
16421/// # extern crate hyper;
16422/// # extern crate hyper_rustls;
16423/// # extern crate google_datacatalog1 as datacatalog1;
16424/// # async fn dox() {
16425/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16426///
16427/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16428/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16429/// # .with_native_roots()
16430/// # .unwrap()
16431/// # .https_only()
16432/// # .enable_http2()
16433/// # .build();
16434///
16435/// # let executor = hyper_util::rt::TokioExecutor::new();
16436/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16437/// # secret,
16438/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16439/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16440/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16441/// # ),
16442/// # ).build().await.unwrap();
16443///
16444/// # let client = hyper_util::client::legacy::Client::builder(
16445/// # hyper_util::rt::TokioExecutor::new()
16446/// # )
16447/// # .build(
16448/// # hyper_rustls::HttpsConnectorBuilder::new()
16449/// # .with_native_roots()
16450/// # .unwrap()
16451/// # .https_or_http()
16452/// # .enable_http2()
16453/// # .build()
16454/// # );
16455/// # let mut hub = DataCatalog::new(client, auth);
16456/// // You can configure optional parameters by calling the respective setters at will, and
16457/// // execute the final call using `doit()`.
16458/// // Values shown here are possibly random and not representative !
16459/// let result = hub.projects().locations_operations_get("name")
16460/// .doit().await;
16461/// # }
16462/// ```
16463pub struct ProjectLocationOperationGetCall<'a, C>
16464where
16465 C: 'a,
16466{
16467 hub: &'a DataCatalog<C>,
16468 _name: String,
16469 _delegate: Option<&'a mut dyn common::Delegate>,
16470 _additional_params: HashMap<String, String>,
16471 _scopes: BTreeSet<String>,
16472}
16473
16474impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
16475
16476impl<'a, C> ProjectLocationOperationGetCall<'a, C>
16477where
16478 C: common::Connector,
16479{
16480 /// Perform the operation you have build so far.
16481 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16482 use std::borrow::Cow;
16483 use std::io::{Read, Seek};
16484
16485 use common::{url::Params, ToParts};
16486 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16487
16488 let mut dd = common::DefaultDelegate;
16489 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16490 dlg.begin(common::MethodInfo {
16491 id: "datacatalog.projects.locations.operations.get",
16492 http_method: hyper::Method::GET,
16493 });
16494
16495 for &field in ["alt", "name"].iter() {
16496 if self._additional_params.contains_key(field) {
16497 dlg.finished(false);
16498 return Err(common::Error::FieldClash(field));
16499 }
16500 }
16501
16502 let mut params = Params::with_capacity(3 + self._additional_params.len());
16503 params.push("name", self._name);
16504
16505 params.extend(self._additional_params.iter());
16506
16507 params.push("alt", "json");
16508 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16509 if self._scopes.is_empty() {
16510 self._scopes
16511 .insert(Scope::CloudPlatform.as_ref().to_string());
16512 }
16513
16514 #[allow(clippy::single_element_loop)]
16515 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16516 url = params.uri_replacement(url, param_name, find_this, true);
16517 }
16518 {
16519 let to_remove = ["name"];
16520 params.remove_params(&to_remove);
16521 }
16522
16523 let url = params.parse_with_url(&url);
16524
16525 loop {
16526 let token = match self
16527 .hub
16528 .auth
16529 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16530 .await
16531 {
16532 Ok(token) => token,
16533 Err(e) => match dlg.token(e) {
16534 Ok(token) => token,
16535 Err(e) => {
16536 dlg.finished(false);
16537 return Err(common::Error::MissingToken(e));
16538 }
16539 },
16540 };
16541 let mut req_result = {
16542 let client = &self.hub.client;
16543 dlg.pre_request();
16544 let mut req_builder = hyper::Request::builder()
16545 .method(hyper::Method::GET)
16546 .uri(url.as_str())
16547 .header(USER_AGENT, self.hub._user_agent.clone());
16548
16549 if let Some(token) = token.as_ref() {
16550 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16551 }
16552
16553 let request = req_builder
16554 .header(CONTENT_LENGTH, 0_u64)
16555 .body(common::to_body::<String>(None));
16556
16557 client.request(request.unwrap()).await
16558 };
16559
16560 match req_result {
16561 Err(err) => {
16562 if let common::Retry::After(d) = dlg.http_error(&err) {
16563 sleep(d).await;
16564 continue;
16565 }
16566 dlg.finished(false);
16567 return Err(common::Error::HttpError(err));
16568 }
16569 Ok(res) => {
16570 let (mut parts, body) = res.into_parts();
16571 let mut body = common::Body::new(body);
16572 if !parts.status.is_success() {
16573 let bytes = common::to_bytes(body).await.unwrap_or_default();
16574 let error = serde_json::from_str(&common::to_string(&bytes));
16575 let response = common::to_response(parts, bytes.into());
16576
16577 if let common::Retry::After(d) =
16578 dlg.http_failure(&response, error.as_ref().ok())
16579 {
16580 sleep(d).await;
16581 continue;
16582 }
16583
16584 dlg.finished(false);
16585
16586 return Err(match error {
16587 Ok(value) => common::Error::BadRequest(value),
16588 _ => common::Error::Failure(response),
16589 });
16590 }
16591 let response = {
16592 let bytes = common::to_bytes(body).await.unwrap_or_default();
16593 let encoded = common::to_string(&bytes);
16594 match serde_json::from_str(&encoded) {
16595 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16596 Err(error) => {
16597 dlg.response_json_decode_error(&encoded, &error);
16598 return Err(common::Error::JsonDecodeError(
16599 encoded.to_string(),
16600 error,
16601 ));
16602 }
16603 }
16604 };
16605
16606 dlg.finished(true);
16607 return Ok(response);
16608 }
16609 }
16610 }
16611 }
16612
16613 /// The name of the operation resource.
16614 ///
16615 /// Sets the *name* path property to the given value.
16616 ///
16617 /// Even though the property as already been set when instantiating this call,
16618 /// we provide this method for API completeness.
16619 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
16620 self._name = new_value.to_string();
16621 self
16622 }
16623 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16624 /// while executing the actual API request.
16625 ///
16626 /// ````text
16627 /// It should be used to handle progress information, and to implement a certain level of resilience.
16628 /// ````
16629 ///
16630 /// Sets the *delegate* property to the given value.
16631 pub fn delegate(
16632 mut self,
16633 new_value: &'a mut dyn common::Delegate,
16634 ) -> ProjectLocationOperationGetCall<'a, C> {
16635 self._delegate = Some(new_value);
16636 self
16637 }
16638
16639 /// Set any additional parameter of the query string used in the request.
16640 /// It should be used to set parameters which are not yet available through their own
16641 /// setters.
16642 ///
16643 /// Please note that this method must not be used to set any of the known parameters
16644 /// which have their own setter method. If done anyway, the request will fail.
16645 ///
16646 /// # Additional Parameters
16647 ///
16648 /// * *$.xgafv* (query-string) - V1 error format.
16649 /// * *access_token* (query-string) - OAuth access token.
16650 /// * *alt* (query-string) - Data format for response.
16651 /// * *callback* (query-string) - JSONP
16652 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16653 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16654 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16655 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16656 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16657 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16658 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16659 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
16660 where
16661 T: AsRef<str>,
16662 {
16663 self._additional_params
16664 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16665 self
16666 }
16667
16668 /// Identifies the authorization scope for the method you are building.
16669 ///
16670 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16671 /// [`Scope::CloudPlatform`].
16672 ///
16673 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16674 /// tokens for more than one scope.
16675 ///
16676 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16677 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16678 /// sufficient, a read-write scope will do as well.
16679 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
16680 where
16681 St: AsRef<str>,
16682 {
16683 self._scopes.insert(String::from(scope.as_ref()));
16684 self
16685 }
16686 /// Identifies the authorization scope(s) for the method you are building.
16687 ///
16688 /// See [`Self::add_scope()`] for details.
16689 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
16690 where
16691 I: IntoIterator<Item = St>,
16692 St: AsRef<str>,
16693 {
16694 self._scopes
16695 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16696 self
16697 }
16698
16699 /// Removes all scopes, and no default scope will be used either.
16700 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16701 /// for details).
16702 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
16703 self._scopes.clear();
16704 self
16705 }
16706}
16707
16708/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
16709///
16710/// A builder for the *locations.operations.list* method supported by a *project* resource.
16711/// It is not used directly, but through a [`ProjectMethods`] instance.
16712///
16713/// # Example
16714///
16715/// Instantiate a resource method builder
16716///
16717/// ```test_harness,no_run
16718/// # extern crate hyper;
16719/// # extern crate hyper_rustls;
16720/// # extern crate google_datacatalog1 as datacatalog1;
16721/// # async fn dox() {
16722/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16723///
16724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16725/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16726/// # .with_native_roots()
16727/// # .unwrap()
16728/// # .https_only()
16729/// # .enable_http2()
16730/// # .build();
16731///
16732/// # let executor = hyper_util::rt::TokioExecutor::new();
16733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16734/// # secret,
16735/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16736/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16737/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16738/// # ),
16739/// # ).build().await.unwrap();
16740///
16741/// # let client = hyper_util::client::legacy::Client::builder(
16742/// # hyper_util::rt::TokioExecutor::new()
16743/// # )
16744/// # .build(
16745/// # hyper_rustls::HttpsConnectorBuilder::new()
16746/// # .with_native_roots()
16747/// # .unwrap()
16748/// # .https_or_http()
16749/// # .enable_http2()
16750/// # .build()
16751/// # );
16752/// # let mut hub = DataCatalog::new(client, auth);
16753/// // You can configure optional parameters by calling the respective setters at will, and
16754/// // execute the final call using `doit()`.
16755/// // Values shown here are possibly random and not representative !
16756/// let result = hub.projects().locations_operations_list("name")
16757/// .return_partial_success(false)
16758/// .page_token("duo")
16759/// .page_size(-76)
16760/// .filter("vero")
16761/// .doit().await;
16762/// # }
16763/// ```
16764pub struct ProjectLocationOperationListCall<'a, C>
16765where
16766 C: 'a,
16767{
16768 hub: &'a DataCatalog<C>,
16769 _name: String,
16770 _return_partial_success: Option<bool>,
16771 _page_token: Option<String>,
16772 _page_size: Option<i32>,
16773 _filter: Option<String>,
16774 _delegate: Option<&'a mut dyn common::Delegate>,
16775 _additional_params: HashMap<String, String>,
16776 _scopes: BTreeSet<String>,
16777}
16778
16779impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
16780
16781impl<'a, C> ProjectLocationOperationListCall<'a, C>
16782where
16783 C: common::Connector,
16784{
16785 /// Perform the operation you have build so far.
16786 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
16787 use std::borrow::Cow;
16788 use std::io::{Read, Seek};
16789
16790 use common::{url::Params, ToParts};
16791 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16792
16793 let mut dd = common::DefaultDelegate;
16794 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16795 dlg.begin(common::MethodInfo {
16796 id: "datacatalog.projects.locations.operations.list",
16797 http_method: hyper::Method::GET,
16798 });
16799
16800 for &field in [
16801 "alt",
16802 "name",
16803 "returnPartialSuccess",
16804 "pageToken",
16805 "pageSize",
16806 "filter",
16807 ]
16808 .iter()
16809 {
16810 if self._additional_params.contains_key(field) {
16811 dlg.finished(false);
16812 return Err(common::Error::FieldClash(field));
16813 }
16814 }
16815
16816 let mut params = Params::with_capacity(7 + self._additional_params.len());
16817 params.push("name", self._name);
16818 if let Some(value) = self._return_partial_success.as_ref() {
16819 params.push("returnPartialSuccess", value.to_string());
16820 }
16821 if let Some(value) = self._page_token.as_ref() {
16822 params.push("pageToken", value);
16823 }
16824 if let Some(value) = self._page_size.as_ref() {
16825 params.push("pageSize", value.to_string());
16826 }
16827 if let Some(value) = self._filter.as_ref() {
16828 params.push("filter", value);
16829 }
16830
16831 params.extend(self._additional_params.iter());
16832
16833 params.push("alt", "json");
16834 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
16835 if self._scopes.is_empty() {
16836 self._scopes
16837 .insert(Scope::CloudPlatform.as_ref().to_string());
16838 }
16839
16840 #[allow(clippy::single_element_loop)]
16841 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16842 url = params.uri_replacement(url, param_name, find_this, true);
16843 }
16844 {
16845 let to_remove = ["name"];
16846 params.remove_params(&to_remove);
16847 }
16848
16849 let url = params.parse_with_url(&url);
16850
16851 loop {
16852 let token = match self
16853 .hub
16854 .auth
16855 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16856 .await
16857 {
16858 Ok(token) => token,
16859 Err(e) => match dlg.token(e) {
16860 Ok(token) => token,
16861 Err(e) => {
16862 dlg.finished(false);
16863 return Err(common::Error::MissingToken(e));
16864 }
16865 },
16866 };
16867 let mut req_result = {
16868 let client = &self.hub.client;
16869 dlg.pre_request();
16870 let mut req_builder = hyper::Request::builder()
16871 .method(hyper::Method::GET)
16872 .uri(url.as_str())
16873 .header(USER_AGENT, self.hub._user_agent.clone());
16874
16875 if let Some(token) = token.as_ref() {
16876 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16877 }
16878
16879 let request = req_builder
16880 .header(CONTENT_LENGTH, 0_u64)
16881 .body(common::to_body::<String>(None));
16882
16883 client.request(request.unwrap()).await
16884 };
16885
16886 match req_result {
16887 Err(err) => {
16888 if let common::Retry::After(d) = dlg.http_error(&err) {
16889 sleep(d).await;
16890 continue;
16891 }
16892 dlg.finished(false);
16893 return Err(common::Error::HttpError(err));
16894 }
16895 Ok(res) => {
16896 let (mut parts, body) = res.into_parts();
16897 let mut body = common::Body::new(body);
16898 if !parts.status.is_success() {
16899 let bytes = common::to_bytes(body).await.unwrap_or_default();
16900 let error = serde_json::from_str(&common::to_string(&bytes));
16901 let response = common::to_response(parts, bytes.into());
16902
16903 if let common::Retry::After(d) =
16904 dlg.http_failure(&response, error.as_ref().ok())
16905 {
16906 sleep(d).await;
16907 continue;
16908 }
16909
16910 dlg.finished(false);
16911
16912 return Err(match error {
16913 Ok(value) => common::Error::BadRequest(value),
16914 _ => common::Error::Failure(response),
16915 });
16916 }
16917 let response = {
16918 let bytes = common::to_bytes(body).await.unwrap_or_default();
16919 let encoded = common::to_string(&bytes);
16920 match serde_json::from_str(&encoded) {
16921 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16922 Err(error) => {
16923 dlg.response_json_decode_error(&encoded, &error);
16924 return Err(common::Error::JsonDecodeError(
16925 encoded.to_string(),
16926 error,
16927 ));
16928 }
16929 }
16930 };
16931
16932 dlg.finished(true);
16933 return Ok(response);
16934 }
16935 }
16936 }
16937 }
16938
16939 /// The name of the operation's parent resource.
16940 ///
16941 /// Sets the *name* path property to the given value.
16942 ///
16943 /// Even though the property as already been set when instantiating this call,
16944 /// we provide this method for API completeness.
16945 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
16946 self._name = new_value.to_string();
16947 self
16948 }
16949 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
16950 ///
16951 /// Sets the *return partial success* query property to the given value.
16952 pub fn return_partial_success(
16953 mut self,
16954 new_value: bool,
16955 ) -> ProjectLocationOperationListCall<'a, C> {
16956 self._return_partial_success = Some(new_value);
16957 self
16958 }
16959 /// The standard list page token.
16960 ///
16961 /// Sets the *page token* query property to the given value.
16962 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
16963 self._page_token = Some(new_value.to_string());
16964 self
16965 }
16966 /// The standard list page size.
16967 ///
16968 /// Sets the *page size* query property to the given value.
16969 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
16970 self._page_size = Some(new_value);
16971 self
16972 }
16973 /// The standard list filter.
16974 ///
16975 /// Sets the *filter* query property to the given value.
16976 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
16977 self._filter = Some(new_value.to_string());
16978 self
16979 }
16980 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16981 /// while executing the actual API request.
16982 ///
16983 /// ````text
16984 /// It should be used to handle progress information, and to implement a certain level of resilience.
16985 /// ````
16986 ///
16987 /// Sets the *delegate* property to the given value.
16988 pub fn delegate(
16989 mut self,
16990 new_value: &'a mut dyn common::Delegate,
16991 ) -> ProjectLocationOperationListCall<'a, C> {
16992 self._delegate = Some(new_value);
16993 self
16994 }
16995
16996 /// Set any additional parameter of the query string used in the request.
16997 /// It should be used to set parameters which are not yet available through their own
16998 /// setters.
16999 ///
17000 /// Please note that this method must not be used to set any of the known parameters
17001 /// which have their own setter method. If done anyway, the request will fail.
17002 ///
17003 /// # Additional Parameters
17004 ///
17005 /// * *$.xgafv* (query-string) - V1 error format.
17006 /// * *access_token* (query-string) - OAuth access token.
17007 /// * *alt* (query-string) - Data format for response.
17008 /// * *callback* (query-string) - JSONP
17009 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17010 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17011 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17012 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17013 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17014 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17015 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17016 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
17017 where
17018 T: AsRef<str>,
17019 {
17020 self._additional_params
17021 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17022 self
17023 }
17024
17025 /// Identifies the authorization scope for the method you are building.
17026 ///
17027 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17028 /// [`Scope::CloudPlatform`].
17029 ///
17030 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17031 /// tokens for more than one scope.
17032 ///
17033 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17034 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17035 /// sufficient, a read-write scope will do as well.
17036 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
17037 where
17038 St: AsRef<str>,
17039 {
17040 self._scopes.insert(String::from(scope.as_ref()));
17041 self
17042 }
17043 /// Identifies the authorization scope(s) for the method you are building.
17044 ///
17045 /// See [`Self::add_scope()`] for details.
17046 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
17047 where
17048 I: IntoIterator<Item = St>,
17049 St: AsRef<str>,
17050 {
17051 self._scopes
17052 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17053 self
17054 }
17055
17056 /// Removes all scopes, and no default scope will be used either.
17057 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17058 /// for details).
17059 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
17060 self._scopes.clear();
17061 self
17062 }
17063}
17064
17065/// Renames an enum value in a tag template. Within a single enum field, enum values must be unique.
17066///
17067/// A builder for the *locations.tagTemplates.fields.enumValues.rename* method supported by a *project* resource.
17068/// It is not used directly, but through a [`ProjectMethods`] instance.
17069///
17070/// # Example
17071///
17072/// Instantiate a resource method builder
17073///
17074/// ```test_harness,no_run
17075/// # extern crate hyper;
17076/// # extern crate hyper_rustls;
17077/// # extern crate google_datacatalog1 as datacatalog1;
17078/// use datacatalog1::api::GoogleCloudDatacatalogV1RenameTagTemplateFieldEnumValueRequest;
17079/// # async fn dox() {
17080/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17081///
17082/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17083/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17084/// # .with_native_roots()
17085/// # .unwrap()
17086/// # .https_only()
17087/// # .enable_http2()
17088/// # .build();
17089///
17090/// # let executor = hyper_util::rt::TokioExecutor::new();
17091/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17092/// # secret,
17093/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17094/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17095/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17096/// # ),
17097/// # ).build().await.unwrap();
17098///
17099/// # let client = hyper_util::client::legacy::Client::builder(
17100/// # hyper_util::rt::TokioExecutor::new()
17101/// # )
17102/// # .build(
17103/// # hyper_rustls::HttpsConnectorBuilder::new()
17104/// # .with_native_roots()
17105/// # .unwrap()
17106/// # .https_or_http()
17107/// # .enable_http2()
17108/// # .build()
17109/// # );
17110/// # let mut hub = DataCatalog::new(client, auth);
17111/// // As the method needs a request, you would usually fill it with the desired information
17112/// // into the respective structure. Some of the parts shown here might not be applicable !
17113/// // Values shown here are possibly random and not representative !
17114/// let mut req = GoogleCloudDatacatalogV1RenameTagTemplateFieldEnumValueRequest::default();
17115///
17116/// // You can configure optional parameters by calling the respective setters at will, and
17117/// // execute the final call using `doit()`.
17118/// // Values shown here are possibly random and not representative !
17119/// let result = hub.projects().locations_tag_templates_fields_enum_values_rename(req, "name")
17120/// .doit().await;
17121/// # }
17122/// ```
17123pub struct ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
17124where
17125 C: 'a,
17126{
17127 hub: &'a DataCatalog<C>,
17128 _request: GoogleCloudDatacatalogV1RenameTagTemplateFieldEnumValueRequest,
17129 _name: String,
17130 _delegate: Option<&'a mut dyn common::Delegate>,
17131 _additional_params: HashMap<String, String>,
17132 _scopes: BTreeSet<String>,
17133}
17134
17135impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {}
17136
17137impl<'a, C> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
17138where
17139 C: common::Connector,
17140{
17141 /// Perform the operation you have build so far.
17142 pub async fn doit(
17143 mut self,
17144 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1TagTemplateField)> {
17145 use std::borrow::Cow;
17146 use std::io::{Read, Seek};
17147
17148 use common::{url::Params, ToParts};
17149 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17150
17151 let mut dd = common::DefaultDelegate;
17152 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17153 dlg.begin(common::MethodInfo {
17154 id: "datacatalog.projects.locations.tagTemplates.fields.enumValues.rename",
17155 http_method: hyper::Method::POST,
17156 });
17157
17158 for &field in ["alt", "name"].iter() {
17159 if self._additional_params.contains_key(field) {
17160 dlg.finished(false);
17161 return Err(common::Error::FieldClash(field));
17162 }
17163 }
17164
17165 let mut params = Params::with_capacity(4 + self._additional_params.len());
17166 params.push("name", self._name);
17167
17168 params.extend(self._additional_params.iter());
17169
17170 params.push("alt", "json");
17171 let mut url = self.hub._base_url.clone() + "v1/{+name}:rename";
17172 if self._scopes.is_empty() {
17173 self._scopes
17174 .insert(Scope::CloudPlatform.as_ref().to_string());
17175 }
17176
17177 #[allow(clippy::single_element_loop)]
17178 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17179 url = params.uri_replacement(url, param_name, find_this, true);
17180 }
17181 {
17182 let to_remove = ["name"];
17183 params.remove_params(&to_remove);
17184 }
17185
17186 let url = params.parse_with_url(&url);
17187
17188 let mut json_mime_type = mime::APPLICATION_JSON;
17189 let mut request_value_reader = {
17190 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17191 common::remove_json_null_values(&mut value);
17192 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17193 serde_json::to_writer(&mut dst, &value).unwrap();
17194 dst
17195 };
17196 let request_size = request_value_reader
17197 .seek(std::io::SeekFrom::End(0))
17198 .unwrap();
17199 request_value_reader
17200 .seek(std::io::SeekFrom::Start(0))
17201 .unwrap();
17202
17203 loop {
17204 let token = match self
17205 .hub
17206 .auth
17207 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17208 .await
17209 {
17210 Ok(token) => token,
17211 Err(e) => match dlg.token(e) {
17212 Ok(token) => token,
17213 Err(e) => {
17214 dlg.finished(false);
17215 return Err(common::Error::MissingToken(e));
17216 }
17217 },
17218 };
17219 request_value_reader
17220 .seek(std::io::SeekFrom::Start(0))
17221 .unwrap();
17222 let mut req_result = {
17223 let client = &self.hub.client;
17224 dlg.pre_request();
17225 let mut req_builder = hyper::Request::builder()
17226 .method(hyper::Method::POST)
17227 .uri(url.as_str())
17228 .header(USER_AGENT, self.hub._user_agent.clone());
17229
17230 if let Some(token) = token.as_ref() {
17231 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17232 }
17233
17234 let request = req_builder
17235 .header(CONTENT_TYPE, json_mime_type.to_string())
17236 .header(CONTENT_LENGTH, request_size as u64)
17237 .body(common::to_body(
17238 request_value_reader.get_ref().clone().into(),
17239 ));
17240
17241 client.request(request.unwrap()).await
17242 };
17243
17244 match req_result {
17245 Err(err) => {
17246 if let common::Retry::After(d) = dlg.http_error(&err) {
17247 sleep(d).await;
17248 continue;
17249 }
17250 dlg.finished(false);
17251 return Err(common::Error::HttpError(err));
17252 }
17253 Ok(res) => {
17254 let (mut parts, body) = res.into_parts();
17255 let mut body = common::Body::new(body);
17256 if !parts.status.is_success() {
17257 let bytes = common::to_bytes(body).await.unwrap_or_default();
17258 let error = serde_json::from_str(&common::to_string(&bytes));
17259 let response = common::to_response(parts, bytes.into());
17260
17261 if let common::Retry::After(d) =
17262 dlg.http_failure(&response, error.as_ref().ok())
17263 {
17264 sleep(d).await;
17265 continue;
17266 }
17267
17268 dlg.finished(false);
17269
17270 return Err(match error {
17271 Ok(value) => common::Error::BadRequest(value),
17272 _ => common::Error::Failure(response),
17273 });
17274 }
17275 let response = {
17276 let bytes = common::to_bytes(body).await.unwrap_or_default();
17277 let encoded = common::to_string(&bytes);
17278 match serde_json::from_str(&encoded) {
17279 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17280 Err(error) => {
17281 dlg.response_json_decode_error(&encoded, &error);
17282 return Err(common::Error::JsonDecodeError(
17283 encoded.to_string(),
17284 error,
17285 ));
17286 }
17287 }
17288 };
17289
17290 dlg.finished(true);
17291 return Ok(response);
17292 }
17293 }
17294 }
17295 }
17296
17297 ///
17298 /// Sets the *request* property to the given value.
17299 ///
17300 /// Even though the property as already been set when instantiating this call,
17301 /// we provide this method for API completeness.
17302 pub fn request(
17303 mut self,
17304 new_value: GoogleCloudDatacatalogV1RenameTagTemplateFieldEnumValueRequest,
17305 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
17306 self._request = new_value;
17307 self
17308 }
17309 /// Required. The name of the enum field value.
17310 ///
17311 /// Sets the *name* path property to the given value.
17312 ///
17313 /// Even though the property as already been set when instantiating this call,
17314 /// we provide this method for API completeness.
17315 pub fn name(
17316 mut self,
17317 new_value: &str,
17318 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
17319 self._name = new_value.to_string();
17320 self
17321 }
17322 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17323 /// while executing the actual API request.
17324 ///
17325 /// ````text
17326 /// It should be used to handle progress information, and to implement a certain level of resilience.
17327 /// ````
17328 ///
17329 /// Sets the *delegate* property to the given value.
17330 pub fn delegate(
17331 mut self,
17332 new_value: &'a mut dyn common::Delegate,
17333 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
17334 self._delegate = Some(new_value);
17335 self
17336 }
17337
17338 /// Set any additional parameter of the query string used in the request.
17339 /// It should be used to set parameters which are not yet available through their own
17340 /// setters.
17341 ///
17342 /// Please note that this method must not be used to set any of the known parameters
17343 /// which have their own setter method. If done anyway, the request will fail.
17344 ///
17345 /// # Additional Parameters
17346 ///
17347 /// * *$.xgafv* (query-string) - V1 error format.
17348 /// * *access_token* (query-string) - OAuth access token.
17349 /// * *alt* (query-string) - Data format for response.
17350 /// * *callback* (query-string) - JSONP
17351 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17352 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17353 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17354 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17355 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17356 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17357 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17358 pub fn param<T>(
17359 mut self,
17360 name: T,
17361 value: T,
17362 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
17363 where
17364 T: AsRef<str>,
17365 {
17366 self._additional_params
17367 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17368 self
17369 }
17370
17371 /// Identifies the authorization scope for the method you are building.
17372 ///
17373 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17374 /// [`Scope::CloudPlatform`].
17375 ///
17376 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17377 /// tokens for more than one scope.
17378 ///
17379 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17380 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17381 /// sufficient, a read-write scope will do as well.
17382 pub fn add_scope<St>(
17383 mut self,
17384 scope: St,
17385 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
17386 where
17387 St: AsRef<str>,
17388 {
17389 self._scopes.insert(String::from(scope.as_ref()));
17390 self
17391 }
17392 /// Identifies the authorization scope(s) for the method you are building.
17393 ///
17394 /// See [`Self::add_scope()`] for details.
17395 pub fn add_scopes<I, St>(
17396 mut self,
17397 scopes: I,
17398 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
17399 where
17400 I: IntoIterator<Item = St>,
17401 St: AsRef<str>,
17402 {
17403 self._scopes
17404 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17405 self
17406 }
17407
17408 /// Removes all scopes, and no default scope will be used either.
17409 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17410 /// for details).
17411 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
17412 self._scopes.clear();
17413 self
17414 }
17415}
17416
17417/// Creates a field in a tag template. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
17418///
17419/// A builder for the *locations.tagTemplates.fields.create* method supported by a *project* resource.
17420/// It is not used directly, but through a [`ProjectMethods`] instance.
17421///
17422/// # Example
17423///
17424/// Instantiate a resource method builder
17425///
17426/// ```test_harness,no_run
17427/// # extern crate hyper;
17428/// # extern crate hyper_rustls;
17429/// # extern crate google_datacatalog1 as datacatalog1;
17430/// use datacatalog1::api::GoogleCloudDatacatalogV1TagTemplateField;
17431/// # async fn dox() {
17432/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17433///
17434/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17435/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17436/// # .with_native_roots()
17437/// # .unwrap()
17438/// # .https_only()
17439/// # .enable_http2()
17440/// # .build();
17441///
17442/// # let executor = hyper_util::rt::TokioExecutor::new();
17443/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17444/// # secret,
17445/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17446/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17447/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17448/// # ),
17449/// # ).build().await.unwrap();
17450///
17451/// # let client = hyper_util::client::legacy::Client::builder(
17452/// # hyper_util::rt::TokioExecutor::new()
17453/// # )
17454/// # .build(
17455/// # hyper_rustls::HttpsConnectorBuilder::new()
17456/// # .with_native_roots()
17457/// # .unwrap()
17458/// # .https_or_http()
17459/// # .enable_http2()
17460/// # .build()
17461/// # );
17462/// # let mut hub = DataCatalog::new(client, auth);
17463/// // As the method needs a request, you would usually fill it with the desired information
17464/// // into the respective structure. Some of the parts shown here might not be applicable !
17465/// // Values shown here are possibly random and not representative !
17466/// let mut req = GoogleCloudDatacatalogV1TagTemplateField::default();
17467///
17468/// // You can configure optional parameters by calling the respective setters at will, and
17469/// // execute the final call using `doit()`.
17470/// // Values shown here are possibly random and not representative !
17471/// let result = hub.projects().locations_tag_templates_fields_create(req, "parent")
17472/// .tag_template_field_id("vero")
17473/// .doit().await;
17474/// # }
17475/// ```
17476pub struct ProjectLocationTagTemplateFieldCreateCall<'a, C>
17477where
17478 C: 'a,
17479{
17480 hub: &'a DataCatalog<C>,
17481 _request: GoogleCloudDatacatalogV1TagTemplateField,
17482 _parent: String,
17483 _tag_template_field_id: Option<String>,
17484 _delegate: Option<&'a mut dyn common::Delegate>,
17485 _additional_params: HashMap<String, String>,
17486 _scopes: BTreeSet<String>,
17487}
17488
17489impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldCreateCall<'a, C> {}
17490
17491impl<'a, C> ProjectLocationTagTemplateFieldCreateCall<'a, C>
17492where
17493 C: common::Connector,
17494{
17495 /// Perform the operation you have build so far.
17496 pub async fn doit(
17497 mut self,
17498 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1TagTemplateField)> {
17499 use std::borrow::Cow;
17500 use std::io::{Read, Seek};
17501
17502 use common::{url::Params, ToParts};
17503 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17504
17505 let mut dd = common::DefaultDelegate;
17506 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17507 dlg.begin(common::MethodInfo {
17508 id: "datacatalog.projects.locations.tagTemplates.fields.create",
17509 http_method: hyper::Method::POST,
17510 });
17511
17512 for &field in ["alt", "parent", "tagTemplateFieldId"].iter() {
17513 if self._additional_params.contains_key(field) {
17514 dlg.finished(false);
17515 return Err(common::Error::FieldClash(field));
17516 }
17517 }
17518
17519 let mut params = Params::with_capacity(5 + self._additional_params.len());
17520 params.push("parent", self._parent);
17521 if let Some(value) = self._tag_template_field_id.as_ref() {
17522 params.push("tagTemplateFieldId", value);
17523 }
17524
17525 params.extend(self._additional_params.iter());
17526
17527 params.push("alt", "json");
17528 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fields";
17529 if self._scopes.is_empty() {
17530 self._scopes
17531 .insert(Scope::CloudPlatform.as_ref().to_string());
17532 }
17533
17534 #[allow(clippy::single_element_loop)]
17535 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17536 url = params.uri_replacement(url, param_name, find_this, true);
17537 }
17538 {
17539 let to_remove = ["parent"];
17540 params.remove_params(&to_remove);
17541 }
17542
17543 let url = params.parse_with_url(&url);
17544
17545 let mut json_mime_type = mime::APPLICATION_JSON;
17546 let mut request_value_reader = {
17547 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17548 common::remove_json_null_values(&mut value);
17549 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17550 serde_json::to_writer(&mut dst, &value).unwrap();
17551 dst
17552 };
17553 let request_size = request_value_reader
17554 .seek(std::io::SeekFrom::End(0))
17555 .unwrap();
17556 request_value_reader
17557 .seek(std::io::SeekFrom::Start(0))
17558 .unwrap();
17559
17560 loop {
17561 let token = match self
17562 .hub
17563 .auth
17564 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17565 .await
17566 {
17567 Ok(token) => token,
17568 Err(e) => match dlg.token(e) {
17569 Ok(token) => token,
17570 Err(e) => {
17571 dlg.finished(false);
17572 return Err(common::Error::MissingToken(e));
17573 }
17574 },
17575 };
17576 request_value_reader
17577 .seek(std::io::SeekFrom::Start(0))
17578 .unwrap();
17579 let mut req_result = {
17580 let client = &self.hub.client;
17581 dlg.pre_request();
17582 let mut req_builder = hyper::Request::builder()
17583 .method(hyper::Method::POST)
17584 .uri(url.as_str())
17585 .header(USER_AGENT, self.hub._user_agent.clone());
17586
17587 if let Some(token) = token.as_ref() {
17588 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17589 }
17590
17591 let request = req_builder
17592 .header(CONTENT_TYPE, json_mime_type.to_string())
17593 .header(CONTENT_LENGTH, request_size as u64)
17594 .body(common::to_body(
17595 request_value_reader.get_ref().clone().into(),
17596 ));
17597
17598 client.request(request.unwrap()).await
17599 };
17600
17601 match req_result {
17602 Err(err) => {
17603 if let common::Retry::After(d) = dlg.http_error(&err) {
17604 sleep(d).await;
17605 continue;
17606 }
17607 dlg.finished(false);
17608 return Err(common::Error::HttpError(err));
17609 }
17610 Ok(res) => {
17611 let (mut parts, body) = res.into_parts();
17612 let mut body = common::Body::new(body);
17613 if !parts.status.is_success() {
17614 let bytes = common::to_bytes(body).await.unwrap_or_default();
17615 let error = serde_json::from_str(&common::to_string(&bytes));
17616 let response = common::to_response(parts, bytes.into());
17617
17618 if let common::Retry::After(d) =
17619 dlg.http_failure(&response, error.as_ref().ok())
17620 {
17621 sleep(d).await;
17622 continue;
17623 }
17624
17625 dlg.finished(false);
17626
17627 return Err(match error {
17628 Ok(value) => common::Error::BadRequest(value),
17629 _ => common::Error::Failure(response),
17630 });
17631 }
17632 let response = {
17633 let bytes = common::to_bytes(body).await.unwrap_or_default();
17634 let encoded = common::to_string(&bytes);
17635 match serde_json::from_str(&encoded) {
17636 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17637 Err(error) => {
17638 dlg.response_json_decode_error(&encoded, &error);
17639 return Err(common::Error::JsonDecodeError(
17640 encoded.to_string(),
17641 error,
17642 ));
17643 }
17644 }
17645 };
17646
17647 dlg.finished(true);
17648 return Ok(response);
17649 }
17650 }
17651 }
17652 }
17653
17654 ///
17655 /// Sets the *request* property to the given value.
17656 ///
17657 /// Even though the property as already been set when instantiating this call,
17658 /// we provide this method for API completeness.
17659 pub fn request(
17660 mut self,
17661 new_value: GoogleCloudDatacatalogV1TagTemplateField,
17662 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
17663 self._request = new_value;
17664 self
17665 }
17666 /// Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions).
17667 ///
17668 /// Sets the *parent* path property to the given value.
17669 ///
17670 /// Even though the property as already been set when instantiating this call,
17671 /// we provide this method for API completeness.
17672 pub fn parent(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
17673 self._parent = new_value.to_string();
17674 self
17675 }
17676 /// Required. The ID of the tag template field to create. Note: Adding a required field to an existing template is *not* allowed. Field IDs can contain letters (both uppercase and lowercase), numbers (0-9), underscores (_) and dashes (-). Field IDs must be at least 1 character long and at most 128 characters long. Field IDs must also be unique within their template.
17677 ///
17678 /// Sets the *tag template field id* query property to the given value.
17679 pub fn tag_template_field_id(
17680 mut self,
17681 new_value: &str,
17682 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
17683 self._tag_template_field_id = Some(new_value.to_string());
17684 self
17685 }
17686 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17687 /// while executing the actual API request.
17688 ///
17689 /// ````text
17690 /// It should be used to handle progress information, and to implement a certain level of resilience.
17691 /// ````
17692 ///
17693 /// Sets the *delegate* property to the given value.
17694 pub fn delegate(
17695 mut self,
17696 new_value: &'a mut dyn common::Delegate,
17697 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
17698 self._delegate = Some(new_value);
17699 self
17700 }
17701
17702 /// Set any additional parameter of the query string used in the request.
17703 /// It should be used to set parameters which are not yet available through their own
17704 /// setters.
17705 ///
17706 /// Please note that this method must not be used to set any of the known parameters
17707 /// which have their own setter method. If done anyway, the request will fail.
17708 ///
17709 /// # Additional Parameters
17710 ///
17711 /// * *$.xgafv* (query-string) - V1 error format.
17712 /// * *access_token* (query-string) - OAuth access token.
17713 /// * *alt* (query-string) - Data format for response.
17714 /// * *callback* (query-string) - JSONP
17715 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17716 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17717 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17718 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17719 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17720 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17721 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17722 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldCreateCall<'a, C>
17723 where
17724 T: AsRef<str>,
17725 {
17726 self._additional_params
17727 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17728 self
17729 }
17730
17731 /// Identifies the authorization scope for the method you are building.
17732 ///
17733 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17734 /// [`Scope::CloudPlatform`].
17735 ///
17736 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17737 /// tokens for more than one scope.
17738 ///
17739 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17740 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17741 /// sufficient, a read-write scope will do as well.
17742 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldCreateCall<'a, C>
17743 where
17744 St: AsRef<str>,
17745 {
17746 self._scopes.insert(String::from(scope.as_ref()));
17747 self
17748 }
17749 /// Identifies the authorization scope(s) for the method you are building.
17750 ///
17751 /// See [`Self::add_scope()`] for details.
17752 pub fn add_scopes<I, St>(
17753 mut self,
17754 scopes: I,
17755 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C>
17756 where
17757 I: IntoIterator<Item = St>,
17758 St: AsRef<str>,
17759 {
17760 self._scopes
17761 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17762 self
17763 }
17764
17765 /// Removes all scopes, and no default scope will be used either.
17766 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17767 /// for details).
17768 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
17769 self._scopes.clear();
17770 self
17771 }
17772}
17773
17774/// Deletes a field in a tag template and all uses of this field from the tags based on this template. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
17775///
17776/// A builder for the *locations.tagTemplates.fields.delete* method supported by a *project* resource.
17777/// It is not used directly, but through a [`ProjectMethods`] instance.
17778///
17779/// # Example
17780///
17781/// Instantiate a resource method builder
17782///
17783/// ```test_harness,no_run
17784/// # extern crate hyper;
17785/// # extern crate hyper_rustls;
17786/// # extern crate google_datacatalog1 as datacatalog1;
17787/// # async fn dox() {
17788/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17789///
17790/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17791/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17792/// # .with_native_roots()
17793/// # .unwrap()
17794/// # .https_only()
17795/// # .enable_http2()
17796/// # .build();
17797///
17798/// # let executor = hyper_util::rt::TokioExecutor::new();
17799/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17800/// # secret,
17801/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17802/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17803/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17804/// # ),
17805/// # ).build().await.unwrap();
17806///
17807/// # let client = hyper_util::client::legacy::Client::builder(
17808/// # hyper_util::rt::TokioExecutor::new()
17809/// # )
17810/// # .build(
17811/// # hyper_rustls::HttpsConnectorBuilder::new()
17812/// # .with_native_roots()
17813/// # .unwrap()
17814/// # .https_or_http()
17815/// # .enable_http2()
17816/// # .build()
17817/// # );
17818/// # let mut hub = DataCatalog::new(client, auth);
17819/// // You can configure optional parameters by calling the respective setters at will, and
17820/// // execute the final call using `doit()`.
17821/// // Values shown here are possibly random and not representative !
17822/// let result = hub.projects().locations_tag_templates_fields_delete("name")
17823/// .force(true)
17824/// .doit().await;
17825/// # }
17826/// ```
17827pub struct ProjectLocationTagTemplateFieldDeleteCall<'a, C>
17828where
17829 C: 'a,
17830{
17831 hub: &'a DataCatalog<C>,
17832 _name: String,
17833 _force: Option<bool>,
17834 _delegate: Option<&'a mut dyn common::Delegate>,
17835 _additional_params: HashMap<String, String>,
17836 _scopes: BTreeSet<String>,
17837}
17838
17839impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldDeleteCall<'a, C> {}
17840
17841impl<'a, C> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
17842where
17843 C: common::Connector,
17844{
17845 /// Perform the operation you have build so far.
17846 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
17847 use std::borrow::Cow;
17848 use std::io::{Read, Seek};
17849
17850 use common::{url::Params, ToParts};
17851 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17852
17853 let mut dd = common::DefaultDelegate;
17854 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17855 dlg.begin(common::MethodInfo {
17856 id: "datacatalog.projects.locations.tagTemplates.fields.delete",
17857 http_method: hyper::Method::DELETE,
17858 });
17859
17860 for &field in ["alt", "name", "force"].iter() {
17861 if self._additional_params.contains_key(field) {
17862 dlg.finished(false);
17863 return Err(common::Error::FieldClash(field));
17864 }
17865 }
17866
17867 let mut params = Params::with_capacity(4 + self._additional_params.len());
17868 params.push("name", self._name);
17869 if let Some(value) = self._force.as_ref() {
17870 params.push("force", value.to_string());
17871 }
17872
17873 params.extend(self._additional_params.iter());
17874
17875 params.push("alt", "json");
17876 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17877 if self._scopes.is_empty() {
17878 self._scopes
17879 .insert(Scope::CloudPlatform.as_ref().to_string());
17880 }
17881
17882 #[allow(clippy::single_element_loop)]
17883 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17884 url = params.uri_replacement(url, param_name, find_this, true);
17885 }
17886 {
17887 let to_remove = ["name"];
17888 params.remove_params(&to_remove);
17889 }
17890
17891 let url = params.parse_with_url(&url);
17892
17893 loop {
17894 let token = match self
17895 .hub
17896 .auth
17897 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17898 .await
17899 {
17900 Ok(token) => token,
17901 Err(e) => match dlg.token(e) {
17902 Ok(token) => token,
17903 Err(e) => {
17904 dlg.finished(false);
17905 return Err(common::Error::MissingToken(e));
17906 }
17907 },
17908 };
17909 let mut req_result = {
17910 let client = &self.hub.client;
17911 dlg.pre_request();
17912 let mut req_builder = hyper::Request::builder()
17913 .method(hyper::Method::DELETE)
17914 .uri(url.as_str())
17915 .header(USER_AGENT, self.hub._user_agent.clone());
17916
17917 if let Some(token) = token.as_ref() {
17918 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17919 }
17920
17921 let request = req_builder
17922 .header(CONTENT_LENGTH, 0_u64)
17923 .body(common::to_body::<String>(None));
17924
17925 client.request(request.unwrap()).await
17926 };
17927
17928 match req_result {
17929 Err(err) => {
17930 if let common::Retry::After(d) = dlg.http_error(&err) {
17931 sleep(d).await;
17932 continue;
17933 }
17934 dlg.finished(false);
17935 return Err(common::Error::HttpError(err));
17936 }
17937 Ok(res) => {
17938 let (mut parts, body) = res.into_parts();
17939 let mut body = common::Body::new(body);
17940 if !parts.status.is_success() {
17941 let bytes = common::to_bytes(body).await.unwrap_or_default();
17942 let error = serde_json::from_str(&common::to_string(&bytes));
17943 let response = common::to_response(parts, bytes.into());
17944
17945 if let common::Retry::After(d) =
17946 dlg.http_failure(&response, error.as_ref().ok())
17947 {
17948 sleep(d).await;
17949 continue;
17950 }
17951
17952 dlg.finished(false);
17953
17954 return Err(match error {
17955 Ok(value) => common::Error::BadRequest(value),
17956 _ => common::Error::Failure(response),
17957 });
17958 }
17959 let response = {
17960 let bytes = common::to_bytes(body).await.unwrap_or_default();
17961 let encoded = common::to_string(&bytes);
17962 match serde_json::from_str(&encoded) {
17963 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17964 Err(error) => {
17965 dlg.response_json_decode_error(&encoded, &error);
17966 return Err(common::Error::JsonDecodeError(
17967 encoded.to_string(),
17968 error,
17969 ));
17970 }
17971 }
17972 };
17973
17974 dlg.finished(true);
17975 return Ok(response);
17976 }
17977 }
17978 }
17979 }
17980
17981 /// Required. The name of the tag template field to delete.
17982 ///
17983 /// Sets the *name* path property to the given value.
17984 ///
17985 /// Even though the property as already been set when instantiating this call,
17986 /// we provide this method for API completeness.
17987 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
17988 self._name = new_value.to_string();
17989 self
17990 }
17991 /// Required. If true, deletes this field from any tags that use it. Currently, `true` is the only supported value.
17992 ///
17993 /// Sets the *force* query property to the given value.
17994 pub fn force(mut self, new_value: bool) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
17995 self._force = Some(new_value);
17996 self
17997 }
17998 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17999 /// while executing the actual API request.
18000 ///
18001 /// ````text
18002 /// It should be used to handle progress information, and to implement a certain level of resilience.
18003 /// ````
18004 ///
18005 /// Sets the *delegate* property to the given value.
18006 pub fn delegate(
18007 mut self,
18008 new_value: &'a mut dyn common::Delegate,
18009 ) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
18010 self._delegate = Some(new_value);
18011 self
18012 }
18013
18014 /// Set any additional parameter of the query string used in the request.
18015 /// It should be used to set parameters which are not yet available through their own
18016 /// setters.
18017 ///
18018 /// Please note that this method must not be used to set any of the known parameters
18019 /// which have their own setter method. If done anyway, the request will fail.
18020 ///
18021 /// # Additional Parameters
18022 ///
18023 /// * *$.xgafv* (query-string) - V1 error format.
18024 /// * *access_token* (query-string) - OAuth access token.
18025 /// * *alt* (query-string) - Data format for response.
18026 /// * *callback* (query-string) - JSONP
18027 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18028 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18029 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18030 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18031 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18032 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18033 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18034 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
18035 where
18036 T: AsRef<str>,
18037 {
18038 self._additional_params
18039 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18040 self
18041 }
18042
18043 /// Identifies the authorization scope for the method you are building.
18044 ///
18045 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18046 /// [`Scope::CloudPlatform`].
18047 ///
18048 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18049 /// tokens for more than one scope.
18050 ///
18051 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18052 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18053 /// sufficient, a read-write scope will do as well.
18054 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
18055 where
18056 St: AsRef<str>,
18057 {
18058 self._scopes.insert(String::from(scope.as_ref()));
18059 self
18060 }
18061 /// Identifies the authorization scope(s) for the method you are building.
18062 ///
18063 /// See [`Self::add_scope()`] for details.
18064 pub fn add_scopes<I, St>(
18065 mut self,
18066 scopes: I,
18067 ) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
18068 where
18069 I: IntoIterator<Item = St>,
18070 St: AsRef<str>,
18071 {
18072 self._scopes
18073 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18074 self
18075 }
18076
18077 /// Removes all scopes, and no default scope will be used either.
18078 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18079 /// for details).
18080 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
18081 self._scopes.clear();
18082 self
18083 }
18084}
18085
18086/// Updates a field in a tag template. You can't update the field type with this method. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
18087///
18088/// A builder for the *locations.tagTemplates.fields.patch* method supported by a *project* resource.
18089/// It is not used directly, but through a [`ProjectMethods`] instance.
18090///
18091/// # Example
18092///
18093/// Instantiate a resource method builder
18094///
18095/// ```test_harness,no_run
18096/// # extern crate hyper;
18097/// # extern crate hyper_rustls;
18098/// # extern crate google_datacatalog1 as datacatalog1;
18099/// use datacatalog1::api::GoogleCloudDatacatalogV1TagTemplateField;
18100/// # async fn dox() {
18101/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18102///
18103/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18104/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18105/// # .with_native_roots()
18106/// # .unwrap()
18107/// # .https_only()
18108/// # .enable_http2()
18109/// # .build();
18110///
18111/// # let executor = hyper_util::rt::TokioExecutor::new();
18112/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18113/// # secret,
18114/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18115/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18116/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18117/// # ),
18118/// # ).build().await.unwrap();
18119///
18120/// # let client = hyper_util::client::legacy::Client::builder(
18121/// # hyper_util::rt::TokioExecutor::new()
18122/// # )
18123/// # .build(
18124/// # hyper_rustls::HttpsConnectorBuilder::new()
18125/// # .with_native_roots()
18126/// # .unwrap()
18127/// # .https_or_http()
18128/// # .enable_http2()
18129/// # .build()
18130/// # );
18131/// # let mut hub = DataCatalog::new(client, auth);
18132/// // As the method needs a request, you would usually fill it with the desired information
18133/// // into the respective structure. Some of the parts shown here might not be applicable !
18134/// // Values shown here are possibly random and not representative !
18135/// let mut req = GoogleCloudDatacatalogV1TagTemplateField::default();
18136///
18137/// // You can configure optional parameters by calling the respective setters at will, and
18138/// // execute the final call using `doit()`.
18139/// // Values shown here are possibly random and not representative !
18140/// let result = hub.projects().locations_tag_templates_fields_patch(req, "name")
18141/// .update_mask(FieldMask::new::<&str>(&[]))
18142/// .doit().await;
18143/// # }
18144/// ```
18145pub struct ProjectLocationTagTemplateFieldPatchCall<'a, C>
18146where
18147 C: 'a,
18148{
18149 hub: &'a DataCatalog<C>,
18150 _request: GoogleCloudDatacatalogV1TagTemplateField,
18151 _name: String,
18152 _update_mask: Option<common::FieldMask>,
18153 _delegate: Option<&'a mut dyn common::Delegate>,
18154 _additional_params: HashMap<String, String>,
18155 _scopes: BTreeSet<String>,
18156}
18157
18158impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldPatchCall<'a, C> {}
18159
18160impl<'a, C> ProjectLocationTagTemplateFieldPatchCall<'a, C>
18161where
18162 C: common::Connector,
18163{
18164 /// Perform the operation you have build so far.
18165 pub async fn doit(
18166 mut self,
18167 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1TagTemplateField)> {
18168 use std::borrow::Cow;
18169 use std::io::{Read, Seek};
18170
18171 use common::{url::Params, ToParts};
18172 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18173
18174 let mut dd = common::DefaultDelegate;
18175 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18176 dlg.begin(common::MethodInfo {
18177 id: "datacatalog.projects.locations.tagTemplates.fields.patch",
18178 http_method: hyper::Method::PATCH,
18179 });
18180
18181 for &field in ["alt", "name", "updateMask"].iter() {
18182 if self._additional_params.contains_key(field) {
18183 dlg.finished(false);
18184 return Err(common::Error::FieldClash(field));
18185 }
18186 }
18187
18188 let mut params = Params::with_capacity(5 + self._additional_params.len());
18189 params.push("name", self._name);
18190 if let Some(value) = self._update_mask.as_ref() {
18191 params.push("updateMask", value.to_string());
18192 }
18193
18194 params.extend(self._additional_params.iter());
18195
18196 params.push("alt", "json");
18197 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18198 if self._scopes.is_empty() {
18199 self._scopes
18200 .insert(Scope::CloudPlatform.as_ref().to_string());
18201 }
18202
18203 #[allow(clippy::single_element_loop)]
18204 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18205 url = params.uri_replacement(url, param_name, find_this, true);
18206 }
18207 {
18208 let to_remove = ["name"];
18209 params.remove_params(&to_remove);
18210 }
18211
18212 let url = params.parse_with_url(&url);
18213
18214 let mut json_mime_type = mime::APPLICATION_JSON;
18215 let mut request_value_reader = {
18216 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18217 common::remove_json_null_values(&mut value);
18218 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18219 serde_json::to_writer(&mut dst, &value).unwrap();
18220 dst
18221 };
18222 let request_size = request_value_reader
18223 .seek(std::io::SeekFrom::End(0))
18224 .unwrap();
18225 request_value_reader
18226 .seek(std::io::SeekFrom::Start(0))
18227 .unwrap();
18228
18229 loop {
18230 let token = match self
18231 .hub
18232 .auth
18233 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18234 .await
18235 {
18236 Ok(token) => token,
18237 Err(e) => match dlg.token(e) {
18238 Ok(token) => token,
18239 Err(e) => {
18240 dlg.finished(false);
18241 return Err(common::Error::MissingToken(e));
18242 }
18243 },
18244 };
18245 request_value_reader
18246 .seek(std::io::SeekFrom::Start(0))
18247 .unwrap();
18248 let mut req_result = {
18249 let client = &self.hub.client;
18250 dlg.pre_request();
18251 let mut req_builder = hyper::Request::builder()
18252 .method(hyper::Method::PATCH)
18253 .uri(url.as_str())
18254 .header(USER_AGENT, self.hub._user_agent.clone());
18255
18256 if let Some(token) = token.as_ref() {
18257 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18258 }
18259
18260 let request = req_builder
18261 .header(CONTENT_TYPE, json_mime_type.to_string())
18262 .header(CONTENT_LENGTH, request_size as u64)
18263 .body(common::to_body(
18264 request_value_reader.get_ref().clone().into(),
18265 ));
18266
18267 client.request(request.unwrap()).await
18268 };
18269
18270 match req_result {
18271 Err(err) => {
18272 if let common::Retry::After(d) = dlg.http_error(&err) {
18273 sleep(d).await;
18274 continue;
18275 }
18276 dlg.finished(false);
18277 return Err(common::Error::HttpError(err));
18278 }
18279 Ok(res) => {
18280 let (mut parts, body) = res.into_parts();
18281 let mut body = common::Body::new(body);
18282 if !parts.status.is_success() {
18283 let bytes = common::to_bytes(body).await.unwrap_or_default();
18284 let error = serde_json::from_str(&common::to_string(&bytes));
18285 let response = common::to_response(parts, bytes.into());
18286
18287 if let common::Retry::After(d) =
18288 dlg.http_failure(&response, error.as_ref().ok())
18289 {
18290 sleep(d).await;
18291 continue;
18292 }
18293
18294 dlg.finished(false);
18295
18296 return Err(match error {
18297 Ok(value) => common::Error::BadRequest(value),
18298 _ => common::Error::Failure(response),
18299 });
18300 }
18301 let response = {
18302 let bytes = common::to_bytes(body).await.unwrap_or_default();
18303 let encoded = common::to_string(&bytes);
18304 match serde_json::from_str(&encoded) {
18305 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18306 Err(error) => {
18307 dlg.response_json_decode_error(&encoded, &error);
18308 return Err(common::Error::JsonDecodeError(
18309 encoded.to_string(),
18310 error,
18311 ));
18312 }
18313 }
18314 };
18315
18316 dlg.finished(true);
18317 return Ok(response);
18318 }
18319 }
18320 }
18321 }
18322
18323 ///
18324 /// Sets the *request* property to the given value.
18325 ///
18326 /// Even though the property as already been set when instantiating this call,
18327 /// we provide this method for API completeness.
18328 pub fn request(
18329 mut self,
18330 new_value: GoogleCloudDatacatalogV1TagTemplateField,
18331 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
18332 self._request = new_value;
18333 self
18334 }
18335 /// Required. The name of the tag template field.
18336 ///
18337 /// Sets the *name* path property to the given value.
18338 ///
18339 /// Even though the property as already been set when instantiating this call,
18340 /// we provide this method for API completeness.
18341 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
18342 self._name = new_value.to_string();
18343 self
18344 }
18345 /// Optional. Names of fields whose values to overwrite on an individual field of a tag template. The following fields are modifiable: * `display_name` * `type.enum_type` * `is_required` If this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied with one exception: when updating an enum type, the provided values are merged with the existing values. Therefore, enum values can only be added, existing enum values cannot be deleted or renamed. Additionally, updating a template field from optional to required is *not* allowed.
18346 ///
18347 /// Sets the *update mask* query property to the given value.
18348 pub fn update_mask(
18349 mut self,
18350 new_value: common::FieldMask,
18351 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
18352 self._update_mask = Some(new_value);
18353 self
18354 }
18355 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18356 /// while executing the actual API request.
18357 ///
18358 /// ````text
18359 /// It should be used to handle progress information, and to implement a certain level of resilience.
18360 /// ````
18361 ///
18362 /// Sets the *delegate* property to the given value.
18363 pub fn delegate(
18364 mut self,
18365 new_value: &'a mut dyn common::Delegate,
18366 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
18367 self._delegate = Some(new_value);
18368 self
18369 }
18370
18371 /// Set any additional parameter of the query string used in the request.
18372 /// It should be used to set parameters which are not yet available through their own
18373 /// setters.
18374 ///
18375 /// Please note that this method must not be used to set any of the known parameters
18376 /// which have their own setter method. If done anyway, the request will fail.
18377 ///
18378 /// # Additional Parameters
18379 ///
18380 /// * *$.xgafv* (query-string) - V1 error format.
18381 /// * *access_token* (query-string) - OAuth access token.
18382 /// * *alt* (query-string) - Data format for response.
18383 /// * *callback* (query-string) - JSONP
18384 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18385 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18386 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18387 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18388 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18389 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18390 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18391 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldPatchCall<'a, C>
18392 where
18393 T: AsRef<str>,
18394 {
18395 self._additional_params
18396 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18397 self
18398 }
18399
18400 /// Identifies the authorization scope for the method you are building.
18401 ///
18402 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18403 /// [`Scope::CloudPlatform`].
18404 ///
18405 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18406 /// tokens for more than one scope.
18407 ///
18408 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18409 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18410 /// sufficient, a read-write scope will do as well.
18411 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldPatchCall<'a, C>
18412 where
18413 St: AsRef<str>,
18414 {
18415 self._scopes.insert(String::from(scope.as_ref()));
18416 self
18417 }
18418 /// Identifies the authorization scope(s) for the method you are building.
18419 ///
18420 /// See [`Self::add_scope()`] for details.
18421 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateFieldPatchCall<'a, C>
18422 where
18423 I: IntoIterator<Item = St>,
18424 St: AsRef<str>,
18425 {
18426 self._scopes
18427 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18428 self
18429 }
18430
18431 /// Removes all scopes, and no default scope will be used either.
18432 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18433 /// for details).
18434 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
18435 self._scopes.clear();
18436 self
18437 }
18438}
18439
18440/// Renames a field in a tag template. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project).
18441///
18442/// A builder for the *locations.tagTemplates.fields.rename* method supported by a *project* resource.
18443/// It is not used directly, but through a [`ProjectMethods`] instance.
18444///
18445/// # Example
18446///
18447/// Instantiate a resource method builder
18448///
18449/// ```test_harness,no_run
18450/// # extern crate hyper;
18451/// # extern crate hyper_rustls;
18452/// # extern crate google_datacatalog1 as datacatalog1;
18453/// use datacatalog1::api::GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest;
18454/// # async fn dox() {
18455/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18456///
18457/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18458/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18459/// # .with_native_roots()
18460/// # .unwrap()
18461/// # .https_only()
18462/// # .enable_http2()
18463/// # .build();
18464///
18465/// # let executor = hyper_util::rt::TokioExecutor::new();
18466/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18467/// # secret,
18468/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18469/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18470/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18471/// # ),
18472/// # ).build().await.unwrap();
18473///
18474/// # let client = hyper_util::client::legacy::Client::builder(
18475/// # hyper_util::rt::TokioExecutor::new()
18476/// # )
18477/// # .build(
18478/// # hyper_rustls::HttpsConnectorBuilder::new()
18479/// # .with_native_roots()
18480/// # .unwrap()
18481/// # .https_or_http()
18482/// # .enable_http2()
18483/// # .build()
18484/// # );
18485/// # let mut hub = DataCatalog::new(client, auth);
18486/// // As the method needs a request, you would usually fill it with the desired information
18487/// // into the respective structure. Some of the parts shown here might not be applicable !
18488/// // Values shown here are possibly random and not representative !
18489/// let mut req = GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest::default();
18490///
18491/// // You can configure optional parameters by calling the respective setters at will, and
18492/// // execute the final call using `doit()`.
18493/// // Values shown here are possibly random and not representative !
18494/// let result = hub.projects().locations_tag_templates_fields_rename(req, "name")
18495/// .doit().await;
18496/// # }
18497/// ```
18498pub struct ProjectLocationTagTemplateFieldRenameCall<'a, C>
18499where
18500 C: 'a,
18501{
18502 hub: &'a DataCatalog<C>,
18503 _request: GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest,
18504 _name: String,
18505 _delegate: Option<&'a mut dyn common::Delegate>,
18506 _additional_params: HashMap<String, String>,
18507 _scopes: BTreeSet<String>,
18508}
18509
18510impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldRenameCall<'a, C> {}
18511
18512impl<'a, C> ProjectLocationTagTemplateFieldRenameCall<'a, C>
18513where
18514 C: common::Connector,
18515{
18516 /// Perform the operation you have build so far.
18517 pub async fn doit(
18518 mut self,
18519 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1TagTemplateField)> {
18520 use std::borrow::Cow;
18521 use std::io::{Read, Seek};
18522
18523 use common::{url::Params, ToParts};
18524 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18525
18526 let mut dd = common::DefaultDelegate;
18527 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18528 dlg.begin(common::MethodInfo {
18529 id: "datacatalog.projects.locations.tagTemplates.fields.rename",
18530 http_method: hyper::Method::POST,
18531 });
18532
18533 for &field in ["alt", "name"].iter() {
18534 if self._additional_params.contains_key(field) {
18535 dlg.finished(false);
18536 return Err(common::Error::FieldClash(field));
18537 }
18538 }
18539
18540 let mut params = Params::with_capacity(4 + self._additional_params.len());
18541 params.push("name", self._name);
18542
18543 params.extend(self._additional_params.iter());
18544
18545 params.push("alt", "json");
18546 let mut url = self.hub._base_url.clone() + "v1/{+name}:rename";
18547 if self._scopes.is_empty() {
18548 self._scopes
18549 .insert(Scope::CloudPlatform.as_ref().to_string());
18550 }
18551
18552 #[allow(clippy::single_element_loop)]
18553 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18554 url = params.uri_replacement(url, param_name, find_this, true);
18555 }
18556 {
18557 let to_remove = ["name"];
18558 params.remove_params(&to_remove);
18559 }
18560
18561 let url = params.parse_with_url(&url);
18562
18563 let mut json_mime_type = mime::APPLICATION_JSON;
18564 let mut request_value_reader = {
18565 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18566 common::remove_json_null_values(&mut value);
18567 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18568 serde_json::to_writer(&mut dst, &value).unwrap();
18569 dst
18570 };
18571 let request_size = request_value_reader
18572 .seek(std::io::SeekFrom::End(0))
18573 .unwrap();
18574 request_value_reader
18575 .seek(std::io::SeekFrom::Start(0))
18576 .unwrap();
18577
18578 loop {
18579 let token = match self
18580 .hub
18581 .auth
18582 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18583 .await
18584 {
18585 Ok(token) => token,
18586 Err(e) => match dlg.token(e) {
18587 Ok(token) => token,
18588 Err(e) => {
18589 dlg.finished(false);
18590 return Err(common::Error::MissingToken(e));
18591 }
18592 },
18593 };
18594 request_value_reader
18595 .seek(std::io::SeekFrom::Start(0))
18596 .unwrap();
18597 let mut req_result = {
18598 let client = &self.hub.client;
18599 dlg.pre_request();
18600 let mut req_builder = hyper::Request::builder()
18601 .method(hyper::Method::POST)
18602 .uri(url.as_str())
18603 .header(USER_AGENT, self.hub._user_agent.clone());
18604
18605 if let Some(token) = token.as_ref() {
18606 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18607 }
18608
18609 let request = req_builder
18610 .header(CONTENT_TYPE, json_mime_type.to_string())
18611 .header(CONTENT_LENGTH, request_size as u64)
18612 .body(common::to_body(
18613 request_value_reader.get_ref().clone().into(),
18614 ));
18615
18616 client.request(request.unwrap()).await
18617 };
18618
18619 match req_result {
18620 Err(err) => {
18621 if let common::Retry::After(d) = dlg.http_error(&err) {
18622 sleep(d).await;
18623 continue;
18624 }
18625 dlg.finished(false);
18626 return Err(common::Error::HttpError(err));
18627 }
18628 Ok(res) => {
18629 let (mut parts, body) = res.into_parts();
18630 let mut body = common::Body::new(body);
18631 if !parts.status.is_success() {
18632 let bytes = common::to_bytes(body).await.unwrap_or_default();
18633 let error = serde_json::from_str(&common::to_string(&bytes));
18634 let response = common::to_response(parts, bytes.into());
18635
18636 if let common::Retry::After(d) =
18637 dlg.http_failure(&response, error.as_ref().ok())
18638 {
18639 sleep(d).await;
18640 continue;
18641 }
18642
18643 dlg.finished(false);
18644
18645 return Err(match error {
18646 Ok(value) => common::Error::BadRequest(value),
18647 _ => common::Error::Failure(response),
18648 });
18649 }
18650 let response = {
18651 let bytes = common::to_bytes(body).await.unwrap_or_default();
18652 let encoded = common::to_string(&bytes);
18653 match serde_json::from_str(&encoded) {
18654 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18655 Err(error) => {
18656 dlg.response_json_decode_error(&encoded, &error);
18657 return Err(common::Error::JsonDecodeError(
18658 encoded.to_string(),
18659 error,
18660 ));
18661 }
18662 }
18663 };
18664
18665 dlg.finished(true);
18666 return Ok(response);
18667 }
18668 }
18669 }
18670 }
18671
18672 ///
18673 /// Sets the *request* property to the given value.
18674 ///
18675 /// Even though the property as already been set when instantiating this call,
18676 /// we provide this method for API completeness.
18677 pub fn request(
18678 mut self,
18679 new_value: GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest,
18680 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
18681 self._request = new_value;
18682 self
18683 }
18684 /// Required. The name of the tag template field.
18685 ///
18686 /// Sets the *name* path property to the given value.
18687 ///
18688 /// Even though the property as already been set when instantiating this call,
18689 /// we provide this method for API completeness.
18690 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
18691 self._name = new_value.to_string();
18692 self
18693 }
18694 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18695 /// while executing the actual API request.
18696 ///
18697 /// ````text
18698 /// It should be used to handle progress information, and to implement a certain level of resilience.
18699 /// ````
18700 ///
18701 /// Sets the *delegate* property to the given value.
18702 pub fn delegate(
18703 mut self,
18704 new_value: &'a mut dyn common::Delegate,
18705 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
18706 self._delegate = Some(new_value);
18707 self
18708 }
18709
18710 /// Set any additional parameter of the query string used in the request.
18711 /// It should be used to set parameters which are not yet available through their own
18712 /// setters.
18713 ///
18714 /// Please note that this method must not be used to set any of the known parameters
18715 /// which have their own setter method. If done anyway, the request will fail.
18716 ///
18717 /// # Additional Parameters
18718 ///
18719 /// * *$.xgafv* (query-string) - V1 error format.
18720 /// * *access_token* (query-string) - OAuth access token.
18721 /// * *alt* (query-string) - Data format for response.
18722 /// * *callback* (query-string) - JSONP
18723 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18724 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18725 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18726 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18727 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18728 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18729 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18730 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldRenameCall<'a, C>
18731 where
18732 T: AsRef<str>,
18733 {
18734 self._additional_params
18735 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18736 self
18737 }
18738
18739 /// Identifies the authorization scope for the method you are building.
18740 ///
18741 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18742 /// [`Scope::CloudPlatform`].
18743 ///
18744 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18745 /// tokens for more than one scope.
18746 ///
18747 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18748 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18749 /// sufficient, a read-write scope will do as well.
18750 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldRenameCall<'a, C>
18751 where
18752 St: AsRef<str>,
18753 {
18754 self._scopes.insert(String::from(scope.as_ref()));
18755 self
18756 }
18757 /// Identifies the authorization scope(s) for the method you are building.
18758 ///
18759 /// See [`Self::add_scope()`] for details.
18760 pub fn add_scopes<I, St>(
18761 mut self,
18762 scopes: I,
18763 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C>
18764 where
18765 I: IntoIterator<Item = St>,
18766 St: AsRef<str>,
18767 {
18768 self._scopes
18769 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18770 self
18771 }
18772
18773 /// Removes all scopes, and no default scope will be used either.
18774 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18775 /// for details).
18776 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
18777 self._scopes.clear();
18778 self
18779 }
18780}
18781
18782/// Creates a tag template. You must enable the Data Catalog API in the project identified by the `parent` parameter. For more information, see [Data Catalog resource project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project).
18783///
18784/// A builder for the *locations.tagTemplates.create* method supported by a *project* resource.
18785/// It is not used directly, but through a [`ProjectMethods`] instance.
18786///
18787/// # Example
18788///
18789/// Instantiate a resource method builder
18790///
18791/// ```test_harness,no_run
18792/// # extern crate hyper;
18793/// # extern crate hyper_rustls;
18794/// # extern crate google_datacatalog1 as datacatalog1;
18795/// use datacatalog1::api::GoogleCloudDatacatalogV1TagTemplate;
18796/// # async fn dox() {
18797/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18798///
18799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18800/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18801/// # .with_native_roots()
18802/// # .unwrap()
18803/// # .https_only()
18804/// # .enable_http2()
18805/// # .build();
18806///
18807/// # let executor = hyper_util::rt::TokioExecutor::new();
18808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18809/// # secret,
18810/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18811/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18812/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18813/// # ),
18814/// # ).build().await.unwrap();
18815///
18816/// # let client = hyper_util::client::legacy::Client::builder(
18817/// # hyper_util::rt::TokioExecutor::new()
18818/// # )
18819/// # .build(
18820/// # hyper_rustls::HttpsConnectorBuilder::new()
18821/// # .with_native_roots()
18822/// # .unwrap()
18823/// # .https_or_http()
18824/// # .enable_http2()
18825/// # .build()
18826/// # );
18827/// # let mut hub = DataCatalog::new(client, auth);
18828/// // As the method needs a request, you would usually fill it with the desired information
18829/// // into the respective structure. Some of the parts shown here might not be applicable !
18830/// // Values shown here are possibly random and not representative !
18831/// let mut req = GoogleCloudDatacatalogV1TagTemplate::default();
18832///
18833/// // You can configure optional parameters by calling the respective setters at will, and
18834/// // execute the final call using `doit()`.
18835/// // Values shown here are possibly random and not representative !
18836/// let result = hub.projects().locations_tag_templates_create(req, "parent")
18837/// .tag_template_id("consetetur")
18838/// .doit().await;
18839/// # }
18840/// ```
18841pub struct ProjectLocationTagTemplateCreateCall<'a, C>
18842where
18843 C: 'a,
18844{
18845 hub: &'a DataCatalog<C>,
18846 _request: GoogleCloudDatacatalogV1TagTemplate,
18847 _parent: String,
18848 _tag_template_id: Option<String>,
18849 _delegate: Option<&'a mut dyn common::Delegate>,
18850 _additional_params: HashMap<String, String>,
18851 _scopes: BTreeSet<String>,
18852}
18853
18854impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateCreateCall<'a, C> {}
18855
18856impl<'a, C> ProjectLocationTagTemplateCreateCall<'a, C>
18857where
18858 C: common::Connector,
18859{
18860 /// Perform the operation you have build so far.
18861 pub async fn doit(
18862 mut self,
18863 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1TagTemplate)> {
18864 use std::borrow::Cow;
18865 use std::io::{Read, Seek};
18866
18867 use common::{url::Params, ToParts};
18868 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18869
18870 let mut dd = common::DefaultDelegate;
18871 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18872 dlg.begin(common::MethodInfo {
18873 id: "datacatalog.projects.locations.tagTemplates.create",
18874 http_method: hyper::Method::POST,
18875 });
18876
18877 for &field in ["alt", "parent", "tagTemplateId"].iter() {
18878 if self._additional_params.contains_key(field) {
18879 dlg.finished(false);
18880 return Err(common::Error::FieldClash(field));
18881 }
18882 }
18883
18884 let mut params = Params::with_capacity(5 + self._additional_params.len());
18885 params.push("parent", self._parent);
18886 if let Some(value) = self._tag_template_id.as_ref() {
18887 params.push("tagTemplateId", value);
18888 }
18889
18890 params.extend(self._additional_params.iter());
18891
18892 params.push("alt", "json");
18893 let mut url = self.hub._base_url.clone() + "v1/{+parent}/tagTemplates";
18894 if self._scopes.is_empty() {
18895 self._scopes
18896 .insert(Scope::CloudPlatform.as_ref().to_string());
18897 }
18898
18899 #[allow(clippy::single_element_loop)]
18900 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18901 url = params.uri_replacement(url, param_name, find_this, true);
18902 }
18903 {
18904 let to_remove = ["parent"];
18905 params.remove_params(&to_remove);
18906 }
18907
18908 let url = params.parse_with_url(&url);
18909
18910 let mut json_mime_type = mime::APPLICATION_JSON;
18911 let mut request_value_reader = {
18912 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18913 common::remove_json_null_values(&mut value);
18914 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18915 serde_json::to_writer(&mut dst, &value).unwrap();
18916 dst
18917 };
18918 let request_size = request_value_reader
18919 .seek(std::io::SeekFrom::End(0))
18920 .unwrap();
18921 request_value_reader
18922 .seek(std::io::SeekFrom::Start(0))
18923 .unwrap();
18924
18925 loop {
18926 let token = match self
18927 .hub
18928 .auth
18929 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18930 .await
18931 {
18932 Ok(token) => token,
18933 Err(e) => match dlg.token(e) {
18934 Ok(token) => token,
18935 Err(e) => {
18936 dlg.finished(false);
18937 return Err(common::Error::MissingToken(e));
18938 }
18939 },
18940 };
18941 request_value_reader
18942 .seek(std::io::SeekFrom::Start(0))
18943 .unwrap();
18944 let mut req_result = {
18945 let client = &self.hub.client;
18946 dlg.pre_request();
18947 let mut req_builder = hyper::Request::builder()
18948 .method(hyper::Method::POST)
18949 .uri(url.as_str())
18950 .header(USER_AGENT, self.hub._user_agent.clone());
18951
18952 if let Some(token) = token.as_ref() {
18953 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18954 }
18955
18956 let request = req_builder
18957 .header(CONTENT_TYPE, json_mime_type.to_string())
18958 .header(CONTENT_LENGTH, request_size as u64)
18959 .body(common::to_body(
18960 request_value_reader.get_ref().clone().into(),
18961 ));
18962
18963 client.request(request.unwrap()).await
18964 };
18965
18966 match req_result {
18967 Err(err) => {
18968 if let common::Retry::After(d) = dlg.http_error(&err) {
18969 sleep(d).await;
18970 continue;
18971 }
18972 dlg.finished(false);
18973 return Err(common::Error::HttpError(err));
18974 }
18975 Ok(res) => {
18976 let (mut parts, body) = res.into_parts();
18977 let mut body = common::Body::new(body);
18978 if !parts.status.is_success() {
18979 let bytes = common::to_bytes(body).await.unwrap_or_default();
18980 let error = serde_json::from_str(&common::to_string(&bytes));
18981 let response = common::to_response(parts, bytes.into());
18982
18983 if let common::Retry::After(d) =
18984 dlg.http_failure(&response, error.as_ref().ok())
18985 {
18986 sleep(d).await;
18987 continue;
18988 }
18989
18990 dlg.finished(false);
18991
18992 return Err(match error {
18993 Ok(value) => common::Error::BadRequest(value),
18994 _ => common::Error::Failure(response),
18995 });
18996 }
18997 let response = {
18998 let bytes = common::to_bytes(body).await.unwrap_or_default();
18999 let encoded = common::to_string(&bytes);
19000 match serde_json::from_str(&encoded) {
19001 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19002 Err(error) => {
19003 dlg.response_json_decode_error(&encoded, &error);
19004 return Err(common::Error::JsonDecodeError(
19005 encoded.to_string(),
19006 error,
19007 ));
19008 }
19009 }
19010 };
19011
19012 dlg.finished(true);
19013 return Ok(response);
19014 }
19015 }
19016 }
19017 }
19018
19019 ///
19020 /// Sets the *request* property to the given value.
19021 ///
19022 /// Even though the property as already been set when instantiating this call,
19023 /// we provide this method for API completeness.
19024 pub fn request(
19025 mut self,
19026 new_value: GoogleCloudDatacatalogV1TagTemplate,
19027 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
19028 self._request = new_value;
19029 self
19030 }
19031 /// Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions).
19032 ///
19033 /// Sets the *parent* path property to the given value.
19034 ///
19035 /// Even though the property as already been set when instantiating this call,
19036 /// we provide this method for API completeness.
19037 pub fn parent(mut self, new_value: &str) -> ProjectLocationTagTemplateCreateCall<'a, C> {
19038 self._parent = new_value.to_string();
19039 self
19040 }
19041 /// Required. The ID of the tag template to create. The ID must contain only lowercase letters (a-z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum size is 64 bytes when encoded in UTF-8.
19042 ///
19043 /// Sets the *tag template id* query property to the given value.
19044 pub fn tag_template_id(
19045 mut self,
19046 new_value: &str,
19047 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
19048 self._tag_template_id = Some(new_value.to_string());
19049 self
19050 }
19051 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19052 /// while executing the actual API request.
19053 ///
19054 /// ````text
19055 /// It should be used to handle progress information, and to implement a certain level of resilience.
19056 /// ````
19057 ///
19058 /// Sets the *delegate* property to the given value.
19059 pub fn delegate(
19060 mut self,
19061 new_value: &'a mut dyn common::Delegate,
19062 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
19063 self._delegate = Some(new_value);
19064 self
19065 }
19066
19067 /// Set any additional parameter of the query string used in the request.
19068 /// It should be used to set parameters which are not yet available through their own
19069 /// setters.
19070 ///
19071 /// Please note that this method must not be used to set any of the known parameters
19072 /// which have their own setter method. If done anyway, the request will fail.
19073 ///
19074 /// # Additional Parameters
19075 ///
19076 /// * *$.xgafv* (query-string) - V1 error format.
19077 /// * *access_token* (query-string) - OAuth access token.
19078 /// * *alt* (query-string) - Data format for response.
19079 /// * *callback* (query-string) - JSONP
19080 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19081 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19082 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19083 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19084 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19085 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19086 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19087 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateCreateCall<'a, C>
19088 where
19089 T: AsRef<str>,
19090 {
19091 self._additional_params
19092 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19093 self
19094 }
19095
19096 /// Identifies the authorization scope for the method you are building.
19097 ///
19098 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19099 /// [`Scope::CloudPlatform`].
19100 ///
19101 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19102 /// tokens for more than one scope.
19103 ///
19104 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19105 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19106 /// sufficient, a read-write scope will do as well.
19107 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateCreateCall<'a, C>
19108 where
19109 St: AsRef<str>,
19110 {
19111 self._scopes.insert(String::from(scope.as_ref()));
19112 self
19113 }
19114 /// Identifies the authorization scope(s) for the method you are building.
19115 ///
19116 /// See [`Self::add_scope()`] for details.
19117 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateCreateCall<'a, C>
19118 where
19119 I: IntoIterator<Item = St>,
19120 St: AsRef<str>,
19121 {
19122 self._scopes
19123 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19124 self
19125 }
19126
19127 /// Removes all scopes, and no default scope will be used either.
19128 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19129 /// for details).
19130 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateCreateCall<'a, C> {
19131 self._scopes.clear();
19132 self
19133 }
19134}
19135
19136/// Deletes a tag template and all tags that use it. You must enable the Data Catalog API in the project identified by the `name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
19137///
19138/// A builder for the *locations.tagTemplates.delete* method supported by a *project* resource.
19139/// It is not used directly, but through a [`ProjectMethods`] instance.
19140///
19141/// # Example
19142///
19143/// Instantiate a resource method builder
19144///
19145/// ```test_harness,no_run
19146/// # extern crate hyper;
19147/// # extern crate hyper_rustls;
19148/// # extern crate google_datacatalog1 as datacatalog1;
19149/// # async fn dox() {
19150/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19151///
19152/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19153/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19154/// # .with_native_roots()
19155/// # .unwrap()
19156/// # .https_only()
19157/// # .enable_http2()
19158/// # .build();
19159///
19160/// # let executor = hyper_util::rt::TokioExecutor::new();
19161/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19162/// # secret,
19163/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19164/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19165/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19166/// # ),
19167/// # ).build().await.unwrap();
19168///
19169/// # let client = hyper_util::client::legacy::Client::builder(
19170/// # hyper_util::rt::TokioExecutor::new()
19171/// # )
19172/// # .build(
19173/// # hyper_rustls::HttpsConnectorBuilder::new()
19174/// # .with_native_roots()
19175/// # .unwrap()
19176/// # .https_or_http()
19177/// # .enable_http2()
19178/// # .build()
19179/// # );
19180/// # let mut hub = DataCatalog::new(client, auth);
19181/// // You can configure optional parameters by calling the respective setters at will, and
19182/// // execute the final call using `doit()`.
19183/// // Values shown here are possibly random and not representative !
19184/// let result = hub.projects().locations_tag_templates_delete("name")
19185/// .force(false)
19186/// .doit().await;
19187/// # }
19188/// ```
19189pub struct ProjectLocationTagTemplateDeleteCall<'a, C>
19190where
19191 C: 'a,
19192{
19193 hub: &'a DataCatalog<C>,
19194 _name: String,
19195 _force: Option<bool>,
19196 _delegate: Option<&'a mut dyn common::Delegate>,
19197 _additional_params: HashMap<String, String>,
19198 _scopes: BTreeSet<String>,
19199}
19200
19201impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateDeleteCall<'a, C> {}
19202
19203impl<'a, C> ProjectLocationTagTemplateDeleteCall<'a, C>
19204where
19205 C: common::Connector,
19206{
19207 /// Perform the operation you have build so far.
19208 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
19209 use std::borrow::Cow;
19210 use std::io::{Read, Seek};
19211
19212 use common::{url::Params, ToParts};
19213 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19214
19215 let mut dd = common::DefaultDelegate;
19216 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19217 dlg.begin(common::MethodInfo {
19218 id: "datacatalog.projects.locations.tagTemplates.delete",
19219 http_method: hyper::Method::DELETE,
19220 });
19221
19222 for &field in ["alt", "name", "force"].iter() {
19223 if self._additional_params.contains_key(field) {
19224 dlg.finished(false);
19225 return Err(common::Error::FieldClash(field));
19226 }
19227 }
19228
19229 let mut params = Params::with_capacity(4 + self._additional_params.len());
19230 params.push("name", self._name);
19231 if let Some(value) = self._force.as_ref() {
19232 params.push("force", value.to_string());
19233 }
19234
19235 params.extend(self._additional_params.iter());
19236
19237 params.push("alt", "json");
19238 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19239 if self._scopes.is_empty() {
19240 self._scopes
19241 .insert(Scope::CloudPlatform.as_ref().to_string());
19242 }
19243
19244 #[allow(clippy::single_element_loop)]
19245 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19246 url = params.uri_replacement(url, param_name, find_this, true);
19247 }
19248 {
19249 let to_remove = ["name"];
19250 params.remove_params(&to_remove);
19251 }
19252
19253 let url = params.parse_with_url(&url);
19254
19255 loop {
19256 let token = match self
19257 .hub
19258 .auth
19259 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19260 .await
19261 {
19262 Ok(token) => token,
19263 Err(e) => match dlg.token(e) {
19264 Ok(token) => token,
19265 Err(e) => {
19266 dlg.finished(false);
19267 return Err(common::Error::MissingToken(e));
19268 }
19269 },
19270 };
19271 let mut req_result = {
19272 let client = &self.hub.client;
19273 dlg.pre_request();
19274 let mut req_builder = hyper::Request::builder()
19275 .method(hyper::Method::DELETE)
19276 .uri(url.as_str())
19277 .header(USER_AGENT, self.hub._user_agent.clone());
19278
19279 if let Some(token) = token.as_ref() {
19280 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19281 }
19282
19283 let request = req_builder
19284 .header(CONTENT_LENGTH, 0_u64)
19285 .body(common::to_body::<String>(None));
19286
19287 client.request(request.unwrap()).await
19288 };
19289
19290 match req_result {
19291 Err(err) => {
19292 if let common::Retry::After(d) = dlg.http_error(&err) {
19293 sleep(d).await;
19294 continue;
19295 }
19296 dlg.finished(false);
19297 return Err(common::Error::HttpError(err));
19298 }
19299 Ok(res) => {
19300 let (mut parts, body) = res.into_parts();
19301 let mut body = common::Body::new(body);
19302 if !parts.status.is_success() {
19303 let bytes = common::to_bytes(body).await.unwrap_or_default();
19304 let error = serde_json::from_str(&common::to_string(&bytes));
19305 let response = common::to_response(parts, bytes.into());
19306
19307 if let common::Retry::After(d) =
19308 dlg.http_failure(&response, error.as_ref().ok())
19309 {
19310 sleep(d).await;
19311 continue;
19312 }
19313
19314 dlg.finished(false);
19315
19316 return Err(match error {
19317 Ok(value) => common::Error::BadRequest(value),
19318 _ => common::Error::Failure(response),
19319 });
19320 }
19321 let response = {
19322 let bytes = common::to_bytes(body).await.unwrap_or_default();
19323 let encoded = common::to_string(&bytes);
19324 match serde_json::from_str(&encoded) {
19325 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19326 Err(error) => {
19327 dlg.response_json_decode_error(&encoded, &error);
19328 return Err(common::Error::JsonDecodeError(
19329 encoded.to_string(),
19330 error,
19331 ));
19332 }
19333 }
19334 };
19335
19336 dlg.finished(true);
19337 return Ok(response);
19338 }
19339 }
19340 }
19341 }
19342
19343 /// Required. The name of the tag template to delete.
19344 ///
19345 /// Sets the *name* path property to the given value.
19346 ///
19347 /// Even though the property as already been set when instantiating this call,
19348 /// we provide this method for API completeness.
19349 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
19350 self._name = new_value.to_string();
19351 self
19352 }
19353 /// Required. If true, deletes all tags that use this template. Currently, `true` is the only supported value.
19354 ///
19355 /// Sets the *force* query property to the given value.
19356 pub fn force(mut self, new_value: bool) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
19357 self._force = Some(new_value);
19358 self
19359 }
19360 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19361 /// while executing the actual API request.
19362 ///
19363 /// ````text
19364 /// It should be used to handle progress information, and to implement a certain level of resilience.
19365 /// ````
19366 ///
19367 /// Sets the *delegate* property to the given value.
19368 pub fn delegate(
19369 mut self,
19370 new_value: &'a mut dyn common::Delegate,
19371 ) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
19372 self._delegate = Some(new_value);
19373 self
19374 }
19375
19376 /// Set any additional parameter of the query string used in the request.
19377 /// It should be used to set parameters which are not yet available through their own
19378 /// setters.
19379 ///
19380 /// Please note that this method must not be used to set any of the known parameters
19381 /// which have their own setter method. If done anyway, the request will fail.
19382 ///
19383 /// # Additional Parameters
19384 ///
19385 /// * *$.xgafv* (query-string) - V1 error format.
19386 /// * *access_token* (query-string) - OAuth access token.
19387 /// * *alt* (query-string) - Data format for response.
19388 /// * *callback* (query-string) - JSONP
19389 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19390 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19391 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19392 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19393 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19394 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19395 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19396 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateDeleteCall<'a, C>
19397 where
19398 T: AsRef<str>,
19399 {
19400 self._additional_params
19401 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19402 self
19403 }
19404
19405 /// Identifies the authorization scope for the method you are building.
19406 ///
19407 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19408 /// [`Scope::CloudPlatform`].
19409 ///
19410 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19411 /// tokens for more than one scope.
19412 ///
19413 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19414 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19415 /// sufficient, a read-write scope will do as well.
19416 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateDeleteCall<'a, C>
19417 where
19418 St: AsRef<str>,
19419 {
19420 self._scopes.insert(String::from(scope.as_ref()));
19421 self
19422 }
19423 /// Identifies the authorization scope(s) for the method you are building.
19424 ///
19425 /// See [`Self::add_scope()`] for details.
19426 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateDeleteCall<'a, C>
19427 where
19428 I: IntoIterator<Item = St>,
19429 St: AsRef<str>,
19430 {
19431 self._scopes
19432 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19433 self
19434 }
19435
19436 /// Removes all scopes, and no default scope will be used either.
19437 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19438 /// for details).
19439 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
19440 self._scopes.clear();
19441 self
19442 }
19443}
19444
19445/// Gets a tag template.
19446///
19447/// A builder for the *locations.tagTemplates.get* method supported by a *project* resource.
19448/// It is not used directly, but through a [`ProjectMethods`] instance.
19449///
19450/// # Example
19451///
19452/// Instantiate a resource method builder
19453///
19454/// ```test_harness,no_run
19455/// # extern crate hyper;
19456/// # extern crate hyper_rustls;
19457/// # extern crate google_datacatalog1 as datacatalog1;
19458/// # async fn dox() {
19459/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19460///
19461/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19462/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19463/// # .with_native_roots()
19464/// # .unwrap()
19465/// # .https_only()
19466/// # .enable_http2()
19467/// # .build();
19468///
19469/// # let executor = hyper_util::rt::TokioExecutor::new();
19470/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19471/// # secret,
19472/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19473/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19474/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19475/// # ),
19476/// # ).build().await.unwrap();
19477///
19478/// # let client = hyper_util::client::legacy::Client::builder(
19479/// # hyper_util::rt::TokioExecutor::new()
19480/// # )
19481/// # .build(
19482/// # hyper_rustls::HttpsConnectorBuilder::new()
19483/// # .with_native_roots()
19484/// # .unwrap()
19485/// # .https_or_http()
19486/// # .enable_http2()
19487/// # .build()
19488/// # );
19489/// # let mut hub = DataCatalog::new(client, auth);
19490/// // You can configure optional parameters by calling the respective setters at will, and
19491/// // execute the final call using `doit()`.
19492/// // Values shown here are possibly random and not representative !
19493/// let result = hub.projects().locations_tag_templates_get("name")
19494/// .doit().await;
19495/// # }
19496/// ```
19497pub struct ProjectLocationTagTemplateGetCall<'a, C>
19498where
19499 C: 'a,
19500{
19501 hub: &'a DataCatalog<C>,
19502 _name: String,
19503 _delegate: Option<&'a mut dyn common::Delegate>,
19504 _additional_params: HashMap<String, String>,
19505 _scopes: BTreeSet<String>,
19506}
19507
19508impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateGetCall<'a, C> {}
19509
19510impl<'a, C> ProjectLocationTagTemplateGetCall<'a, C>
19511where
19512 C: common::Connector,
19513{
19514 /// Perform the operation you have build so far.
19515 pub async fn doit(
19516 mut self,
19517 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1TagTemplate)> {
19518 use std::borrow::Cow;
19519 use std::io::{Read, Seek};
19520
19521 use common::{url::Params, ToParts};
19522 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19523
19524 let mut dd = common::DefaultDelegate;
19525 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19526 dlg.begin(common::MethodInfo {
19527 id: "datacatalog.projects.locations.tagTemplates.get",
19528 http_method: hyper::Method::GET,
19529 });
19530
19531 for &field in ["alt", "name"].iter() {
19532 if self._additional_params.contains_key(field) {
19533 dlg.finished(false);
19534 return Err(common::Error::FieldClash(field));
19535 }
19536 }
19537
19538 let mut params = Params::with_capacity(3 + self._additional_params.len());
19539 params.push("name", self._name);
19540
19541 params.extend(self._additional_params.iter());
19542
19543 params.push("alt", "json");
19544 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19545 if self._scopes.is_empty() {
19546 self._scopes
19547 .insert(Scope::CloudPlatform.as_ref().to_string());
19548 }
19549
19550 #[allow(clippy::single_element_loop)]
19551 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19552 url = params.uri_replacement(url, param_name, find_this, true);
19553 }
19554 {
19555 let to_remove = ["name"];
19556 params.remove_params(&to_remove);
19557 }
19558
19559 let url = params.parse_with_url(&url);
19560
19561 loop {
19562 let token = match self
19563 .hub
19564 .auth
19565 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19566 .await
19567 {
19568 Ok(token) => token,
19569 Err(e) => match dlg.token(e) {
19570 Ok(token) => token,
19571 Err(e) => {
19572 dlg.finished(false);
19573 return Err(common::Error::MissingToken(e));
19574 }
19575 },
19576 };
19577 let mut req_result = {
19578 let client = &self.hub.client;
19579 dlg.pre_request();
19580 let mut req_builder = hyper::Request::builder()
19581 .method(hyper::Method::GET)
19582 .uri(url.as_str())
19583 .header(USER_AGENT, self.hub._user_agent.clone());
19584
19585 if let Some(token) = token.as_ref() {
19586 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19587 }
19588
19589 let request = req_builder
19590 .header(CONTENT_LENGTH, 0_u64)
19591 .body(common::to_body::<String>(None));
19592
19593 client.request(request.unwrap()).await
19594 };
19595
19596 match req_result {
19597 Err(err) => {
19598 if let common::Retry::After(d) = dlg.http_error(&err) {
19599 sleep(d).await;
19600 continue;
19601 }
19602 dlg.finished(false);
19603 return Err(common::Error::HttpError(err));
19604 }
19605 Ok(res) => {
19606 let (mut parts, body) = res.into_parts();
19607 let mut body = common::Body::new(body);
19608 if !parts.status.is_success() {
19609 let bytes = common::to_bytes(body).await.unwrap_or_default();
19610 let error = serde_json::from_str(&common::to_string(&bytes));
19611 let response = common::to_response(parts, bytes.into());
19612
19613 if let common::Retry::After(d) =
19614 dlg.http_failure(&response, error.as_ref().ok())
19615 {
19616 sleep(d).await;
19617 continue;
19618 }
19619
19620 dlg.finished(false);
19621
19622 return Err(match error {
19623 Ok(value) => common::Error::BadRequest(value),
19624 _ => common::Error::Failure(response),
19625 });
19626 }
19627 let response = {
19628 let bytes = common::to_bytes(body).await.unwrap_or_default();
19629 let encoded = common::to_string(&bytes);
19630 match serde_json::from_str(&encoded) {
19631 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19632 Err(error) => {
19633 dlg.response_json_decode_error(&encoded, &error);
19634 return Err(common::Error::JsonDecodeError(
19635 encoded.to_string(),
19636 error,
19637 ));
19638 }
19639 }
19640 };
19641
19642 dlg.finished(true);
19643 return Ok(response);
19644 }
19645 }
19646 }
19647 }
19648
19649 /// Required. The name of the tag template to get.
19650 ///
19651 /// Sets the *name* path property to the given value.
19652 ///
19653 /// Even though the property as already been set when instantiating this call,
19654 /// we provide this method for API completeness.
19655 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateGetCall<'a, C> {
19656 self._name = new_value.to_string();
19657 self
19658 }
19659 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19660 /// while executing the actual API request.
19661 ///
19662 /// ````text
19663 /// It should be used to handle progress information, and to implement a certain level of resilience.
19664 /// ````
19665 ///
19666 /// Sets the *delegate* property to the given value.
19667 pub fn delegate(
19668 mut self,
19669 new_value: &'a mut dyn common::Delegate,
19670 ) -> ProjectLocationTagTemplateGetCall<'a, C> {
19671 self._delegate = Some(new_value);
19672 self
19673 }
19674
19675 /// Set any additional parameter of the query string used in the request.
19676 /// It should be used to set parameters which are not yet available through their own
19677 /// setters.
19678 ///
19679 /// Please note that this method must not be used to set any of the known parameters
19680 /// which have their own setter method. If done anyway, the request will fail.
19681 ///
19682 /// # Additional Parameters
19683 ///
19684 /// * *$.xgafv* (query-string) - V1 error format.
19685 /// * *access_token* (query-string) - OAuth access token.
19686 /// * *alt* (query-string) - Data format for response.
19687 /// * *callback* (query-string) - JSONP
19688 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19689 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19690 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19691 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19692 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19693 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19694 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19695 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateGetCall<'a, C>
19696 where
19697 T: AsRef<str>,
19698 {
19699 self._additional_params
19700 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19701 self
19702 }
19703
19704 /// Identifies the authorization scope for the method you are building.
19705 ///
19706 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19707 /// [`Scope::CloudPlatform`].
19708 ///
19709 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19710 /// tokens for more than one scope.
19711 ///
19712 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19713 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19714 /// sufficient, a read-write scope will do as well.
19715 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateGetCall<'a, C>
19716 where
19717 St: AsRef<str>,
19718 {
19719 self._scopes.insert(String::from(scope.as_ref()));
19720 self
19721 }
19722 /// Identifies the authorization scope(s) for the method you are building.
19723 ///
19724 /// See [`Self::add_scope()`] for details.
19725 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateGetCall<'a, C>
19726 where
19727 I: IntoIterator<Item = St>,
19728 St: AsRef<str>,
19729 {
19730 self._scopes
19731 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19732 self
19733 }
19734
19735 /// Removes all scopes, and no default scope will be used either.
19736 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19737 /// for details).
19738 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateGetCall<'a, C> {
19739 self._scopes.clear();
19740 self
19741 }
19742}
19743
19744/// Gets the access control policy for a resource. May return: * A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it. * An empty policy if the resource exists but doesn't have a set policy. Supported resources are: - Tag templates - Entry groups Note: This method doesn't get policies from Google Cloud Platform resources ingested into Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
19745///
19746/// A builder for the *locations.tagTemplates.getIamPolicy* method supported by a *project* resource.
19747/// It is not used directly, but through a [`ProjectMethods`] instance.
19748///
19749/// # Example
19750///
19751/// Instantiate a resource method builder
19752///
19753/// ```test_harness,no_run
19754/// # extern crate hyper;
19755/// # extern crate hyper_rustls;
19756/// # extern crate google_datacatalog1 as datacatalog1;
19757/// use datacatalog1::api::GetIamPolicyRequest;
19758/// # async fn dox() {
19759/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19760///
19761/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19762/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19763/// # .with_native_roots()
19764/// # .unwrap()
19765/// # .https_only()
19766/// # .enable_http2()
19767/// # .build();
19768///
19769/// # let executor = hyper_util::rt::TokioExecutor::new();
19770/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19771/// # secret,
19772/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19773/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19774/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19775/// # ),
19776/// # ).build().await.unwrap();
19777///
19778/// # let client = hyper_util::client::legacy::Client::builder(
19779/// # hyper_util::rt::TokioExecutor::new()
19780/// # )
19781/// # .build(
19782/// # hyper_rustls::HttpsConnectorBuilder::new()
19783/// # .with_native_roots()
19784/// # .unwrap()
19785/// # .https_or_http()
19786/// # .enable_http2()
19787/// # .build()
19788/// # );
19789/// # let mut hub = DataCatalog::new(client, auth);
19790/// // As the method needs a request, you would usually fill it with the desired information
19791/// // into the respective structure. Some of the parts shown here might not be applicable !
19792/// // Values shown here are possibly random and not representative !
19793/// let mut req = GetIamPolicyRequest::default();
19794///
19795/// // You can configure optional parameters by calling the respective setters at will, and
19796/// // execute the final call using `doit()`.
19797/// // Values shown here are possibly random and not representative !
19798/// let result = hub.projects().locations_tag_templates_get_iam_policy(req, "resource")
19799/// .doit().await;
19800/// # }
19801/// ```
19802pub struct ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
19803where
19804 C: 'a,
19805{
19806 hub: &'a DataCatalog<C>,
19807 _request: GetIamPolicyRequest,
19808 _resource: String,
19809 _delegate: Option<&'a mut dyn common::Delegate>,
19810 _additional_params: HashMap<String, String>,
19811 _scopes: BTreeSet<String>,
19812}
19813
19814impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {}
19815
19816impl<'a, C> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
19817where
19818 C: common::Connector,
19819{
19820 /// Perform the operation you have build so far.
19821 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
19822 use std::borrow::Cow;
19823 use std::io::{Read, Seek};
19824
19825 use common::{url::Params, ToParts};
19826 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19827
19828 let mut dd = common::DefaultDelegate;
19829 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19830 dlg.begin(common::MethodInfo {
19831 id: "datacatalog.projects.locations.tagTemplates.getIamPolicy",
19832 http_method: hyper::Method::POST,
19833 });
19834
19835 for &field in ["alt", "resource"].iter() {
19836 if self._additional_params.contains_key(field) {
19837 dlg.finished(false);
19838 return Err(common::Error::FieldClash(field));
19839 }
19840 }
19841
19842 let mut params = Params::with_capacity(4 + self._additional_params.len());
19843 params.push("resource", self._resource);
19844
19845 params.extend(self._additional_params.iter());
19846
19847 params.push("alt", "json");
19848 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
19849 if self._scopes.is_empty() {
19850 self._scopes
19851 .insert(Scope::CloudPlatform.as_ref().to_string());
19852 }
19853
19854 #[allow(clippy::single_element_loop)]
19855 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19856 url = params.uri_replacement(url, param_name, find_this, true);
19857 }
19858 {
19859 let to_remove = ["resource"];
19860 params.remove_params(&to_remove);
19861 }
19862
19863 let url = params.parse_with_url(&url);
19864
19865 let mut json_mime_type = mime::APPLICATION_JSON;
19866 let mut request_value_reader = {
19867 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19868 common::remove_json_null_values(&mut value);
19869 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19870 serde_json::to_writer(&mut dst, &value).unwrap();
19871 dst
19872 };
19873 let request_size = request_value_reader
19874 .seek(std::io::SeekFrom::End(0))
19875 .unwrap();
19876 request_value_reader
19877 .seek(std::io::SeekFrom::Start(0))
19878 .unwrap();
19879
19880 loop {
19881 let token = match self
19882 .hub
19883 .auth
19884 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19885 .await
19886 {
19887 Ok(token) => token,
19888 Err(e) => match dlg.token(e) {
19889 Ok(token) => token,
19890 Err(e) => {
19891 dlg.finished(false);
19892 return Err(common::Error::MissingToken(e));
19893 }
19894 },
19895 };
19896 request_value_reader
19897 .seek(std::io::SeekFrom::Start(0))
19898 .unwrap();
19899 let mut req_result = {
19900 let client = &self.hub.client;
19901 dlg.pre_request();
19902 let mut req_builder = hyper::Request::builder()
19903 .method(hyper::Method::POST)
19904 .uri(url.as_str())
19905 .header(USER_AGENT, self.hub._user_agent.clone());
19906
19907 if let Some(token) = token.as_ref() {
19908 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19909 }
19910
19911 let request = req_builder
19912 .header(CONTENT_TYPE, json_mime_type.to_string())
19913 .header(CONTENT_LENGTH, request_size as u64)
19914 .body(common::to_body(
19915 request_value_reader.get_ref().clone().into(),
19916 ));
19917
19918 client.request(request.unwrap()).await
19919 };
19920
19921 match req_result {
19922 Err(err) => {
19923 if let common::Retry::After(d) = dlg.http_error(&err) {
19924 sleep(d).await;
19925 continue;
19926 }
19927 dlg.finished(false);
19928 return Err(common::Error::HttpError(err));
19929 }
19930 Ok(res) => {
19931 let (mut parts, body) = res.into_parts();
19932 let mut body = common::Body::new(body);
19933 if !parts.status.is_success() {
19934 let bytes = common::to_bytes(body).await.unwrap_or_default();
19935 let error = serde_json::from_str(&common::to_string(&bytes));
19936 let response = common::to_response(parts, bytes.into());
19937
19938 if let common::Retry::After(d) =
19939 dlg.http_failure(&response, error.as_ref().ok())
19940 {
19941 sleep(d).await;
19942 continue;
19943 }
19944
19945 dlg.finished(false);
19946
19947 return Err(match error {
19948 Ok(value) => common::Error::BadRequest(value),
19949 _ => common::Error::Failure(response),
19950 });
19951 }
19952 let response = {
19953 let bytes = common::to_bytes(body).await.unwrap_or_default();
19954 let encoded = common::to_string(&bytes);
19955 match serde_json::from_str(&encoded) {
19956 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19957 Err(error) => {
19958 dlg.response_json_decode_error(&encoded, &error);
19959 return Err(common::Error::JsonDecodeError(
19960 encoded.to_string(),
19961 error,
19962 ));
19963 }
19964 }
19965 };
19966
19967 dlg.finished(true);
19968 return Ok(response);
19969 }
19970 }
19971 }
19972 }
19973
19974 ///
19975 /// Sets the *request* property to the given value.
19976 ///
19977 /// Even though the property as already been set when instantiating this call,
19978 /// we provide this method for API completeness.
19979 pub fn request(
19980 mut self,
19981 new_value: GetIamPolicyRequest,
19982 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
19983 self._request = new_value;
19984 self
19985 }
19986 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
19987 ///
19988 /// Sets the *resource* path property to the given value.
19989 ///
19990 /// Even though the property as already been set when instantiating this call,
19991 /// we provide this method for API completeness.
19992 pub fn resource(
19993 mut self,
19994 new_value: &str,
19995 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
19996 self._resource = new_value.to_string();
19997 self
19998 }
19999 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20000 /// while executing the actual API request.
20001 ///
20002 /// ````text
20003 /// It should be used to handle progress information, and to implement a certain level of resilience.
20004 /// ````
20005 ///
20006 /// Sets the *delegate* property to the given value.
20007 pub fn delegate(
20008 mut self,
20009 new_value: &'a mut dyn common::Delegate,
20010 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
20011 self._delegate = Some(new_value);
20012 self
20013 }
20014
20015 /// Set any additional parameter of the query string used in the request.
20016 /// It should be used to set parameters which are not yet available through their own
20017 /// setters.
20018 ///
20019 /// Please note that this method must not be used to set any of the known parameters
20020 /// which have their own setter method. If done anyway, the request will fail.
20021 ///
20022 /// # Additional Parameters
20023 ///
20024 /// * *$.xgafv* (query-string) - V1 error format.
20025 /// * *access_token* (query-string) - OAuth access token.
20026 /// * *alt* (query-string) - Data format for response.
20027 /// * *callback* (query-string) - JSONP
20028 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20029 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20030 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20031 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20032 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20033 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20034 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20035 pub fn param<T>(
20036 mut self,
20037 name: T,
20038 value: T,
20039 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
20040 where
20041 T: AsRef<str>,
20042 {
20043 self._additional_params
20044 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20045 self
20046 }
20047
20048 /// Identifies the authorization scope for the method you are building.
20049 ///
20050 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20051 /// [`Scope::CloudPlatform`].
20052 ///
20053 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20054 /// tokens for more than one scope.
20055 ///
20056 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20057 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20058 /// sufficient, a read-write scope will do as well.
20059 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
20060 where
20061 St: AsRef<str>,
20062 {
20063 self._scopes.insert(String::from(scope.as_ref()));
20064 self
20065 }
20066 /// Identifies the authorization scope(s) for the method you are building.
20067 ///
20068 /// See [`Self::add_scope()`] for details.
20069 pub fn add_scopes<I, St>(
20070 mut self,
20071 scopes: I,
20072 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
20073 where
20074 I: IntoIterator<Item = St>,
20075 St: AsRef<str>,
20076 {
20077 self._scopes
20078 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20079 self
20080 }
20081
20082 /// Removes all scopes, and no default scope will be used either.
20083 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20084 /// for details).
20085 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
20086 self._scopes.clear();
20087 self
20088 }
20089}
20090
20091/// Updates a tag template. You can't update template fields with this method. These fields are separate resources with their own create, update, and delete methods. You must enable the Data Catalog API in the project identified by the `tag_template.name` parameter. For more information, see [Data Catalog resource project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
20092///
20093/// A builder for the *locations.tagTemplates.patch* method supported by a *project* resource.
20094/// It is not used directly, but through a [`ProjectMethods`] instance.
20095///
20096/// # Example
20097///
20098/// Instantiate a resource method builder
20099///
20100/// ```test_harness,no_run
20101/// # extern crate hyper;
20102/// # extern crate hyper_rustls;
20103/// # extern crate google_datacatalog1 as datacatalog1;
20104/// use datacatalog1::api::GoogleCloudDatacatalogV1TagTemplate;
20105/// # async fn dox() {
20106/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20107///
20108/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20109/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20110/// # .with_native_roots()
20111/// # .unwrap()
20112/// # .https_only()
20113/// # .enable_http2()
20114/// # .build();
20115///
20116/// # let executor = hyper_util::rt::TokioExecutor::new();
20117/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20118/// # secret,
20119/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20120/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20121/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20122/// # ),
20123/// # ).build().await.unwrap();
20124///
20125/// # let client = hyper_util::client::legacy::Client::builder(
20126/// # hyper_util::rt::TokioExecutor::new()
20127/// # )
20128/// # .build(
20129/// # hyper_rustls::HttpsConnectorBuilder::new()
20130/// # .with_native_roots()
20131/// # .unwrap()
20132/// # .https_or_http()
20133/// # .enable_http2()
20134/// # .build()
20135/// # );
20136/// # let mut hub = DataCatalog::new(client, auth);
20137/// // As the method needs a request, you would usually fill it with the desired information
20138/// // into the respective structure. Some of the parts shown here might not be applicable !
20139/// // Values shown here are possibly random and not representative !
20140/// let mut req = GoogleCloudDatacatalogV1TagTemplate::default();
20141///
20142/// // You can configure optional parameters by calling the respective setters at will, and
20143/// // execute the final call using `doit()`.
20144/// // Values shown here are possibly random and not representative !
20145/// let result = hub.projects().locations_tag_templates_patch(req, "name")
20146/// .update_mask(FieldMask::new::<&str>(&[]))
20147/// .doit().await;
20148/// # }
20149/// ```
20150pub struct ProjectLocationTagTemplatePatchCall<'a, C>
20151where
20152 C: 'a,
20153{
20154 hub: &'a DataCatalog<C>,
20155 _request: GoogleCloudDatacatalogV1TagTemplate,
20156 _name: String,
20157 _update_mask: Option<common::FieldMask>,
20158 _delegate: Option<&'a mut dyn common::Delegate>,
20159 _additional_params: HashMap<String, String>,
20160 _scopes: BTreeSet<String>,
20161}
20162
20163impl<'a, C> common::CallBuilder for ProjectLocationTagTemplatePatchCall<'a, C> {}
20164
20165impl<'a, C> ProjectLocationTagTemplatePatchCall<'a, C>
20166where
20167 C: common::Connector,
20168{
20169 /// Perform the operation you have build so far.
20170 pub async fn doit(
20171 mut self,
20172 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1TagTemplate)> {
20173 use std::borrow::Cow;
20174 use std::io::{Read, Seek};
20175
20176 use common::{url::Params, ToParts};
20177 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20178
20179 let mut dd = common::DefaultDelegate;
20180 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20181 dlg.begin(common::MethodInfo {
20182 id: "datacatalog.projects.locations.tagTemplates.patch",
20183 http_method: hyper::Method::PATCH,
20184 });
20185
20186 for &field in ["alt", "name", "updateMask"].iter() {
20187 if self._additional_params.contains_key(field) {
20188 dlg.finished(false);
20189 return Err(common::Error::FieldClash(field));
20190 }
20191 }
20192
20193 let mut params = Params::with_capacity(5 + self._additional_params.len());
20194 params.push("name", self._name);
20195 if let Some(value) = self._update_mask.as_ref() {
20196 params.push("updateMask", value.to_string());
20197 }
20198
20199 params.extend(self._additional_params.iter());
20200
20201 params.push("alt", "json");
20202 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20203 if self._scopes.is_empty() {
20204 self._scopes
20205 .insert(Scope::CloudPlatform.as_ref().to_string());
20206 }
20207
20208 #[allow(clippy::single_element_loop)]
20209 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20210 url = params.uri_replacement(url, param_name, find_this, true);
20211 }
20212 {
20213 let to_remove = ["name"];
20214 params.remove_params(&to_remove);
20215 }
20216
20217 let url = params.parse_with_url(&url);
20218
20219 let mut json_mime_type = mime::APPLICATION_JSON;
20220 let mut request_value_reader = {
20221 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20222 common::remove_json_null_values(&mut value);
20223 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20224 serde_json::to_writer(&mut dst, &value).unwrap();
20225 dst
20226 };
20227 let request_size = request_value_reader
20228 .seek(std::io::SeekFrom::End(0))
20229 .unwrap();
20230 request_value_reader
20231 .seek(std::io::SeekFrom::Start(0))
20232 .unwrap();
20233
20234 loop {
20235 let token = match self
20236 .hub
20237 .auth
20238 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20239 .await
20240 {
20241 Ok(token) => token,
20242 Err(e) => match dlg.token(e) {
20243 Ok(token) => token,
20244 Err(e) => {
20245 dlg.finished(false);
20246 return Err(common::Error::MissingToken(e));
20247 }
20248 },
20249 };
20250 request_value_reader
20251 .seek(std::io::SeekFrom::Start(0))
20252 .unwrap();
20253 let mut req_result = {
20254 let client = &self.hub.client;
20255 dlg.pre_request();
20256 let mut req_builder = hyper::Request::builder()
20257 .method(hyper::Method::PATCH)
20258 .uri(url.as_str())
20259 .header(USER_AGENT, self.hub._user_agent.clone());
20260
20261 if let Some(token) = token.as_ref() {
20262 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20263 }
20264
20265 let request = req_builder
20266 .header(CONTENT_TYPE, json_mime_type.to_string())
20267 .header(CONTENT_LENGTH, request_size as u64)
20268 .body(common::to_body(
20269 request_value_reader.get_ref().clone().into(),
20270 ));
20271
20272 client.request(request.unwrap()).await
20273 };
20274
20275 match req_result {
20276 Err(err) => {
20277 if let common::Retry::After(d) = dlg.http_error(&err) {
20278 sleep(d).await;
20279 continue;
20280 }
20281 dlg.finished(false);
20282 return Err(common::Error::HttpError(err));
20283 }
20284 Ok(res) => {
20285 let (mut parts, body) = res.into_parts();
20286 let mut body = common::Body::new(body);
20287 if !parts.status.is_success() {
20288 let bytes = common::to_bytes(body).await.unwrap_or_default();
20289 let error = serde_json::from_str(&common::to_string(&bytes));
20290 let response = common::to_response(parts, bytes.into());
20291
20292 if let common::Retry::After(d) =
20293 dlg.http_failure(&response, error.as_ref().ok())
20294 {
20295 sleep(d).await;
20296 continue;
20297 }
20298
20299 dlg.finished(false);
20300
20301 return Err(match error {
20302 Ok(value) => common::Error::BadRequest(value),
20303 _ => common::Error::Failure(response),
20304 });
20305 }
20306 let response = {
20307 let bytes = common::to_bytes(body).await.unwrap_or_default();
20308 let encoded = common::to_string(&bytes);
20309 match serde_json::from_str(&encoded) {
20310 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20311 Err(error) => {
20312 dlg.response_json_decode_error(&encoded, &error);
20313 return Err(common::Error::JsonDecodeError(
20314 encoded.to_string(),
20315 error,
20316 ));
20317 }
20318 }
20319 };
20320
20321 dlg.finished(true);
20322 return Ok(response);
20323 }
20324 }
20325 }
20326 }
20327
20328 ///
20329 /// Sets the *request* property to the given value.
20330 ///
20331 /// Even though the property as already been set when instantiating this call,
20332 /// we provide this method for API completeness.
20333 pub fn request(
20334 mut self,
20335 new_value: GoogleCloudDatacatalogV1TagTemplate,
20336 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
20337 self._request = new_value;
20338 self
20339 }
20340 /// Identifier. The resource name of the tag template in URL format. Note: The tag template itself and its child resources might not be stored in the location specified in its name.
20341 ///
20342 /// Sets the *name* path property to the given value.
20343 ///
20344 /// Even though the property as already been set when instantiating this call,
20345 /// we provide this method for API completeness.
20346 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplatePatchCall<'a, C> {
20347 self._name = new_value.to_string();
20348 self
20349 }
20350 /// Names of fields whose values to overwrite on a tag template. Currently, only `display_name` and `is_publicly_readable` can be overwritten. If this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied. Note: Updating the `is_publicly_readable` field may require up to 12 hours to take effect in search results.
20351 ///
20352 /// Sets the *update mask* query property to the given value.
20353 pub fn update_mask(
20354 mut self,
20355 new_value: common::FieldMask,
20356 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
20357 self._update_mask = Some(new_value);
20358 self
20359 }
20360 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20361 /// while executing the actual API request.
20362 ///
20363 /// ````text
20364 /// It should be used to handle progress information, and to implement a certain level of resilience.
20365 /// ````
20366 ///
20367 /// Sets the *delegate* property to the given value.
20368 pub fn delegate(
20369 mut self,
20370 new_value: &'a mut dyn common::Delegate,
20371 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
20372 self._delegate = Some(new_value);
20373 self
20374 }
20375
20376 /// Set any additional parameter of the query string used in the request.
20377 /// It should be used to set parameters which are not yet available through their own
20378 /// setters.
20379 ///
20380 /// Please note that this method must not be used to set any of the known parameters
20381 /// which have their own setter method. If done anyway, the request will fail.
20382 ///
20383 /// # Additional Parameters
20384 ///
20385 /// * *$.xgafv* (query-string) - V1 error format.
20386 /// * *access_token* (query-string) - OAuth access token.
20387 /// * *alt* (query-string) - Data format for response.
20388 /// * *callback* (query-string) - JSONP
20389 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20390 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20391 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20392 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20393 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20394 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20395 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20396 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplatePatchCall<'a, C>
20397 where
20398 T: AsRef<str>,
20399 {
20400 self._additional_params
20401 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20402 self
20403 }
20404
20405 /// Identifies the authorization scope for the method you are building.
20406 ///
20407 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20408 /// [`Scope::CloudPlatform`].
20409 ///
20410 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20411 /// tokens for more than one scope.
20412 ///
20413 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20414 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20415 /// sufficient, a read-write scope will do as well.
20416 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplatePatchCall<'a, C>
20417 where
20418 St: AsRef<str>,
20419 {
20420 self._scopes.insert(String::from(scope.as_ref()));
20421 self
20422 }
20423 /// Identifies the authorization scope(s) for the method you are building.
20424 ///
20425 /// See [`Self::add_scope()`] for details.
20426 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplatePatchCall<'a, C>
20427 where
20428 I: IntoIterator<Item = St>,
20429 St: AsRef<str>,
20430 {
20431 self._scopes
20432 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20433 self
20434 }
20435
20436 /// Removes all scopes, and no default scope will be used either.
20437 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20438 /// for details).
20439 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplatePatchCall<'a, C> {
20440 self._scopes.clear();
20441 self
20442 }
20443}
20444
20445/// Sets an access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates - Entry groups Note: This method sets policies only within Data Catalog and can't be used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources synced with the Data Catalog. To call this method, you must have the following Google IAM permissions: - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
20446///
20447/// A builder for the *locations.tagTemplates.setIamPolicy* method supported by a *project* resource.
20448/// It is not used directly, but through a [`ProjectMethods`] instance.
20449///
20450/// # Example
20451///
20452/// Instantiate a resource method builder
20453///
20454/// ```test_harness,no_run
20455/// # extern crate hyper;
20456/// # extern crate hyper_rustls;
20457/// # extern crate google_datacatalog1 as datacatalog1;
20458/// use datacatalog1::api::SetIamPolicyRequest;
20459/// # async fn dox() {
20460/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20461///
20462/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20463/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20464/// # .with_native_roots()
20465/// # .unwrap()
20466/// # .https_only()
20467/// # .enable_http2()
20468/// # .build();
20469///
20470/// # let executor = hyper_util::rt::TokioExecutor::new();
20471/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20472/// # secret,
20473/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20474/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20475/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20476/// # ),
20477/// # ).build().await.unwrap();
20478///
20479/// # let client = hyper_util::client::legacy::Client::builder(
20480/// # hyper_util::rt::TokioExecutor::new()
20481/// # )
20482/// # .build(
20483/// # hyper_rustls::HttpsConnectorBuilder::new()
20484/// # .with_native_roots()
20485/// # .unwrap()
20486/// # .https_or_http()
20487/// # .enable_http2()
20488/// # .build()
20489/// # );
20490/// # let mut hub = DataCatalog::new(client, auth);
20491/// // As the method needs a request, you would usually fill it with the desired information
20492/// // into the respective structure. Some of the parts shown here might not be applicable !
20493/// // Values shown here are possibly random and not representative !
20494/// let mut req = SetIamPolicyRequest::default();
20495///
20496/// // You can configure optional parameters by calling the respective setters at will, and
20497/// // execute the final call using `doit()`.
20498/// // Values shown here are possibly random and not representative !
20499/// let result = hub.projects().locations_tag_templates_set_iam_policy(req, "resource")
20500/// .doit().await;
20501/// # }
20502/// ```
20503pub struct ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
20504where
20505 C: 'a,
20506{
20507 hub: &'a DataCatalog<C>,
20508 _request: SetIamPolicyRequest,
20509 _resource: String,
20510 _delegate: Option<&'a mut dyn common::Delegate>,
20511 _additional_params: HashMap<String, String>,
20512 _scopes: BTreeSet<String>,
20513}
20514
20515impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {}
20516
20517impl<'a, C> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
20518where
20519 C: common::Connector,
20520{
20521 /// Perform the operation you have build so far.
20522 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
20523 use std::borrow::Cow;
20524 use std::io::{Read, Seek};
20525
20526 use common::{url::Params, ToParts};
20527 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20528
20529 let mut dd = common::DefaultDelegate;
20530 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20531 dlg.begin(common::MethodInfo {
20532 id: "datacatalog.projects.locations.tagTemplates.setIamPolicy",
20533 http_method: hyper::Method::POST,
20534 });
20535
20536 for &field in ["alt", "resource"].iter() {
20537 if self._additional_params.contains_key(field) {
20538 dlg.finished(false);
20539 return Err(common::Error::FieldClash(field));
20540 }
20541 }
20542
20543 let mut params = Params::with_capacity(4 + self._additional_params.len());
20544 params.push("resource", self._resource);
20545
20546 params.extend(self._additional_params.iter());
20547
20548 params.push("alt", "json");
20549 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
20550 if self._scopes.is_empty() {
20551 self._scopes
20552 .insert(Scope::CloudPlatform.as_ref().to_string());
20553 }
20554
20555 #[allow(clippy::single_element_loop)]
20556 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20557 url = params.uri_replacement(url, param_name, find_this, true);
20558 }
20559 {
20560 let to_remove = ["resource"];
20561 params.remove_params(&to_remove);
20562 }
20563
20564 let url = params.parse_with_url(&url);
20565
20566 let mut json_mime_type = mime::APPLICATION_JSON;
20567 let mut request_value_reader = {
20568 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20569 common::remove_json_null_values(&mut value);
20570 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20571 serde_json::to_writer(&mut dst, &value).unwrap();
20572 dst
20573 };
20574 let request_size = request_value_reader
20575 .seek(std::io::SeekFrom::End(0))
20576 .unwrap();
20577 request_value_reader
20578 .seek(std::io::SeekFrom::Start(0))
20579 .unwrap();
20580
20581 loop {
20582 let token = match self
20583 .hub
20584 .auth
20585 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20586 .await
20587 {
20588 Ok(token) => token,
20589 Err(e) => match dlg.token(e) {
20590 Ok(token) => token,
20591 Err(e) => {
20592 dlg.finished(false);
20593 return Err(common::Error::MissingToken(e));
20594 }
20595 },
20596 };
20597 request_value_reader
20598 .seek(std::io::SeekFrom::Start(0))
20599 .unwrap();
20600 let mut req_result = {
20601 let client = &self.hub.client;
20602 dlg.pre_request();
20603 let mut req_builder = hyper::Request::builder()
20604 .method(hyper::Method::POST)
20605 .uri(url.as_str())
20606 .header(USER_AGENT, self.hub._user_agent.clone());
20607
20608 if let Some(token) = token.as_ref() {
20609 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20610 }
20611
20612 let request = req_builder
20613 .header(CONTENT_TYPE, json_mime_type.to_string())
20614 .header(CONTENT_LENGTH, request_size as u64)
20615 .body(common::to_body(
20616 request_value_reader.get_ref().clone().into(),
20617 ));
20618
20619 client.request(request.unwrap()).await
20620 };
20621
20622 match req_result {
20623 Err(err) => {
20624 if let common::Retry::After(d) = dlg.http_error(&err) {
20625 sleep(d).await;
20626 continue;
20627 }
20628 dlg.finished(false);
20629 return Err(common::Error::HttpError(err));
20630 }
20631 Ok(res) => {
20632 let (mut parts, body) = res.into_parts();
20633 let mut body = common::Body::new(body);
20634 if !parts.status.is_success() {
20635 let bytes = common::to_bytes(body).await.unwrap_or_default();
20636 let error = serde_json::from_str(&common::to_string(&bytes));
20637 let response = common::to_response(parts, bytes.into());
20638
20639 if let common::Retry::After(d) =
20640 dlg.http_failure(&response, error.as_ref().ok())
20641 {
20642 sleep(d).await;
20643 continue;
20644 }
20645
20646 dlg.finished(false);
20647
20648 return Err(match error {
20649 Ok(value) => common::Error::BadRequest(value),
20650 _ => common::Error::Failure(response),
20651 });
20652 }
20653 let response = {
20654 let bytes = common::to_bytes(body).await.unwrap_or_default();
20655 let encoded = common::to_string(&bytes);
20656 match serde_json::from_str(&encoded) {
20657 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20658 Err(error) => {
20659 dlg.response_json_decode_error(&encoded, &error);
20660 return Err(common::Error::JsonDecodeError(
20661 encoded.to_string(),
20662 error,
20663 ));
20664 }
20665 }
20666 };
20667
20668 dlg.finished(true);
20669 return Ok(response);
20670 }
20671 }
20672 }
20673 }
20674
20675 ///
20676 /// Sets the *request* property to the given value.
20677 ///
20678 /// Even though the property as already been set when instantiating this call,
20679 /// we provide this method for API completeness.
20680 pub fn request(
20681 mut self,
20682 new_value: SetIamPolicyRequest,
20683 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
20684 self._request = new_value;
20685 self
20686 }
20687 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
20688 ///
20689 /// Sets the *resource* path property to the given value.
20690 ///
20691 /// Even though the property as already been set when instantiating this call,
20692 /// we provide this method for API completeness.
20693 pub fn resource(
20694 mut self,
20695 new_value: &str,
20696 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
20697 self._resource = new_value.to_string();
20698 self
20699 }
20700 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20701 /// while executing the actual API request.
20702 ///
20703 /// ````text
20704 /// It should be used to handle progress information, and to implement a certain level of resilience.
20705 /// ````
20706 ///
20707 /// Sets the *delegate* property to the given value.
20708 pub fn delegate(
20709 mut self,
20710 new_value: &'a mut dyn common::Delegate,
20711 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
20712 self._delegate = Some(new_value);
20713 self
20714 }
20715
20716 /// Set any additional parameter of the query string used in the request.
20717 /// It should be used to set parameters which are not yet available through their own
20718 /// setters.
20719 ///
20720 /// Please note that this method must not be used to set any of the known parameters
20721 /// which have their own setter method. If done anyway, the request will fail.
20722 ///
20723 /// # Additional Parameters
20724 ///
20725 /// * *$.xgafv* (query-string) - V1 error format.
20726 /// * *access_token* (query-string) - OAuth access token.
20727 /// * *alt* (query-string) - Data format for response.
20728 /// * *callback* (query-string) - JSONP
20729 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20730 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20731 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20732 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20733 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20734 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20735 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20736 pub fn param<T>(
20737 mut self,
20738 name: T,
20739 value: T,
20740 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
20741 where
20742 T: AsRef<str>,
20743 {
20744 self._additional_params
20745 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20746 self
20747 }
20748
20749 /// Identifies the authorization scope for the method you are building.
20750 ///
20751 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20752 /// [`Scope::CloudPlatform`].
20753 ///
20754 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20755 /// tokens for more than one scope.
20756 ///
20757 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20758 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20759 /// sufficient, a read-write scope will do as well.
20760 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
20761 where
20762 St: AsRef<str>,
20763 {
20764 self._scopes.insert(String::from(scope.as_ref()));
20765 self
20766 }
20767 /// Identifies the authorization scope(s) for the method you are building.
20768 ///
20769 /// See [`Self::add_scope()`] for details.
20770 pub fn add_scopes<I, St>(
20771 mut self,
20772 scopes: I,
20773 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
20774 where
20775 I: IntoIterator<Item = St>,
20776 St: AsRef<str>,
20777 {
20778 self._scopes
20779 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20780 self
20781 }
20782
20783 /// Removes all scopes, and no default scope will be used either.
20784 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20785 /// for details).
20786 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
20787 self._scopes.clear();
20788 self
20789 }
20790}
20791
20792/// Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist. Supported resources are: - Tag templates - Entry groups Note: This method gets policies only within Data Catalog and can't be used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources ingested into Data Catalog. No Google IAM permissions are required to call this method.
20793///
20794/// A builder for the *locations.tagTemplates.testIamPermissions* method supported by a *project* resource.
20795/// It is not used directly, but through a [`ProjectMethods`] instance.
20796///
20797/// # Example
20798///
20799/// Instantiate a resource method builder
20800///
20801/// ```test_harness,no_run
20802/// # extern crate hyper;
20803/// # extern crate hyper_rustls;
20804/// # extern crate google_datacatalog1 as datacatalog1;
20805/// use datacatalog1::api::TestIamPermissionsRequest;
20806/// # async fn dox() {
20807/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20808///
20809/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20810/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20811/// # .with_native_roots()
20812/// # .unwrap()
20813/// # .https_only()
20814/// # .enable_http2()
20815/// # .build();
20816///
20817/// # let executor = hyper_util::rt::TokioExecutor::new();
20818/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20819/// # secret,
20820/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20821/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20822/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20823/// # ),
20824/// # ).build().await.unwrap();
20825///
20826/// # let client = hyper_util::client::legacy::Client::builder(
20827/// # hyper_util::rt::TokioExecutor::new()
20828/// # )
20829/// # .build(
20830/// # hyper_rustls::HttpsConnectorBuilder::new()
20831/// # .with_native_roots()
20832/// # .unwrap()
20833/// # .https_or_http()
20834/// # .enable_http2()
20835/// # .build()
20836/// # );
20837/// # let mut hub = DataCatalog::new(client, auth);
20838/// // As the method needs a request, you would usually fill it with the desired information
20839/// // into the respective structure. Some of the parts shown here might not be applicable !
20840/// // Values shown here are possibly random and not representative !
20841/// let mut req = TestIamPermissionsRequest::default();
20842///
20843/// // You can configure optional parameters by calling the respective setters at will, and
20844/// // execute the final call using `doit()`.
20845/// // Values shown here are possibly random and not representative !
20846/// let result = hub.projects().locations_tag_templates_test_iam_permissions(req, "resource")
20847/// .doit().await;
20848/// # }
20849/// ```
20850pub struct ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
20851where
20852 C: 'a,
20853{
20854 hub: &'a DataCatalog<C>,
20855 _request: TestIamPermissionsRequest,
20856 _resource: String,
20857 _delegate: Option<&'a mut dyn common::Delegate>,
20858 _additional_params: HashMap<String, String>,
20859 _scopes: BTreeSet<String>,
20860}
20861
20862impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {}
20863
20864impl<'a, C> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
20865where
20866 C: common::Connector,
20867{
20868 /// Perform the operation you have build so far.
20869 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
20870 use std::borrow::Cow;
20871 use std::io::{Read, Seek};
20872
20873 use common::{url::Params, ToParts};
20874 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20875
20876 let mut dd = common::DefaultDelegate;
20877 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20878 dlg.begin(common::MethodInfo {
20879 id: "datacatalog.projects.locations.tagTemplates.testIamPermissions",
20880 http_method: hyper::Method::POST,
20881 });
20882
20883 for &field in ["alt", "resource"].iter() {
20884 if self._additional_params.contains_key(field) {
20885 dlg.finished(false);
20886 return Err(common::Error::FieldClash(field));
20887 }
20888 }
20889
20890 let mut params = Params::with_capacity(4 + self._additional_params.len());
20891 params.push("resource", self._resource);
20892
20893 params.extend(self._additional_params.iter());
20894
20895 params.push("alt", "json");
20896 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
20897 if self._scopes.is_empty() {
20898 self._scopes
20899 .insert(Scope::CloudPlatform.as_ref().to_string());
20900 }
20901
20902 #[allow(clippy::single_element_loop)]
20903 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20904 url = params.uri_replacement(url, param_name, find_this, true);
20905 }
20906 {
20907 let to_remove = ["resource"];
20908 params.remove_params(&to_remove);
20909 }
20910
20911 let url = params.parse_with_url(&url);
20912
20913 let mut json_mime_type = mime::APPLICATION_JSON;
20914 let mut request_value_reader = {
20915 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20916 common::remove_json_null_values(&mut value);
20917 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20918 serde_json::to_writer(&mut dst, &value).unwrap();
20919 dst
20920 };
20921 let request_size = request_value_reader
20922 .seek(std::io::SeekFrom::End(0))
20923 .unwrap();
20924 request_value_reader
20925 .seek(std::io::SeekFrom::Start(0))
20926 .unwrap();
20927
20928 loop {
20929 let token = match self
20930 .hub
20931 .auth
20932 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20933 .await
20934 {
20935 Ok(token) => token,
20936 Err(e) => match dlg.token(e) {
20937 Ok(token) => token,
20938 Err(e) => {
20939 dlg.finished(false);
20940 return Err(common::Error::MissingToken(e));
20941 }
20942 },
20943 };
20944 request_value_reader
20945 .seek(std::io::SeekFrom::Start(0))
20946 .unwrap();
20947 let mut req_result = {
20948 let client = &self.hub.client;
20949 dlg.pre_request();
20950 let mut req_builder = hyper::Request::builder()
20951 .method(hyper::Method::POST)
20952 .uri(url.as_str())
20953 .header(USER_AGENT, self.hub._user_agent.clone());
20954
20955 if let Some(token) = token.as_ref() {
20956 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20957 }
20958
20959 let request = req_builder
20960 .header(CONTENT_TYPE, json_mime_type.to_string())
20961 .header(CONTENT_LENGTH, request_size as u64)
20962 .body(common::to_body(
20963 request_value_reader.get_ref().clone().into(),
20964 ));
20965
20966 client.request(request.unwrap()).await
20967 };
20968
20969 match req_result {
20970 Err(err) => {
20971 if let common::Retry::After(d) = dlg.http_error(&err) {
20972 sleep(d).await;
20973 continue;
20974 }
20975 dlg.finished(false);
20976 return Err(common::Error::HttpError(err));
20977 }
20978 Ok(res) => {
20979 let (mut parts, body) = res.into_parts();
20980 let mut body = common::Body::new(body);
20981 if !parts.status.is_success() {
20982 let bytes = common::to_bytes(body).await.unwrap_or_default();
20983 let error = serde_json::from_str(&common::to_string(&bytes));
20984 let response = common::to_response(parts, bytes.into());
20985
20986 if let common::Retry::After(d) =
20987 dlg.http_failure(&response, error.as_ref().ok())
20988 {
20989 sleep(d).await;
20990 continue;
20991 }
20992
20993 dlg.finished(false);
20994
20995 return Err(match error {
20996 Ok(value) => common::Error::BadRequest(value),
20997 _ => common::Error::Failure(response),
20998 });
20999 }
21000 let response = {
21001 let bytes = common::to_bytes(body).await.unwrap_or_default();
21002 let encoded = common::to_string(&bytes);
21003 match serde_json::from_str(&encoded) {
21004 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21005 Err(error) => {
21006 dlg.response_json_decode_error(&encoded, &error);
21007 return Err(common::Error::JsonDecodeError(
21008 encoded.to_string(),
21009 error,
21010 ));
21011 }
21012 }
21013 };
21014
21015 dlg.finished(true);
21016 return Ok(response);
21017 }
21018 }
21019 }
21020 }
21021
21022 ///
21023 /// Sets the *request* property to the given value.
21024 ///
21025 /// Even though the property as already been set when instantiating this call,
21026 /// we provide this method for API completeness.
21027 pub fn request(
21028 mut self,
21029 new_value: TestIamPermissionsRequest,
21030 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
21031 self._request = new_value;
21032 self
21033 }
21034 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
21035 ///
21036 /// Sets the *resource* path property to the given value.
21037 ///
21038 /// Even though the property as already been set when instantiating this call,
21039 /// we provide this method for API completeness.
21040 pub fn resource(
21041 mut self,
21042 new_value: &str,
21043 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
21044 self._resource = new_value.to_string();
21045 self
21046 }
21047 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21048 /// while executing the actual API request.
21049 ///
21050 /// ````text
21051 /// It should be used to handle progress information, and to implement a certain level of resilience.
21052 /// ````
21053 ///
21054 /// Sets the *delegate* property to the given value.
21055 pub fn delegate(
21056 mut self,
21057 new_value: &'a mut dyn common::Delegate,
21058 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
21059 self._delegate = Some(new_value);
21060 self
21061 }
21062
21063 /// Set any additional parameter of the query string used in the request.
21064 /// It should be used to set parameters which are not yet available through their own
21065 /// setters.
21066 ///
21067 /// Please note that this method must not be used to set any of the known parameters
21068 /// which have their own setter method. If done anyway, the request will fail.
21069 ///
21070 /// # Additional Parameters
21071 ///
21072 /// * *$.xgafv* (query-string) - V1 error format.
21073 /// * *access_token* (query-string) - OAuth access token.
21074 /// * *alt* (query-string) - Data format for response.
21075 /// * *callback* (query-string) - JSONP
21076 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21077 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21078 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21079 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21080 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21081 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21082 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21083 pub fn param<T>(
21084 mut self,
21085 name: T,
21086 value: T,
21087 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
21088 where
21089 T: AsRef<str>,
21090 {
21091 self._additional_params
21092 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21093 self
21094 }
21095
21096 /// Identifies the authorization scope for the method you are building.
21097 ///
21098 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21099 /// [`Scope::CloudPlatform`].
21100 ///
21101 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21102 /// tokens for more than one scope.
21103 ///
21104 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21105 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21106 /// sufficient, a read-write scope will do as well.
21107 pub fn add_scope<St>(
21108 mut self,
21109 scope: St,
21110 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
21111 where
21112 St: AsRef<str>,
21113 {
21114 self._scopes.insert(String::from(scope.as_ref()));
21115 self
21116 }
21117 /// Identifies the authorization scope(s) for the method you are building.
21118 ///
21119 /// See [`Self::add_scope()`] for details.
21120 pub fn add_scopes<I, St>(
21121 mut self,
21122 scopes: I,
21123 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
21124 where
21125 I: IntoIterator<Item = St>,
21126 St: AsRef<str>,
21127 {
21128 self._scopes
21129 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21130 self
21131 }
21132
21133 /// Removes all scopes, and no default scope will be used either.
21134 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21135 /// for details).
21136 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
21137 self._scopes.clear();
21138 self
21139 }
21140}
21141
21142/// Creates a policy tag in a taxonomy.
21143///
21144/// A builder for the *locations.taxonomies.policyTags.create* method supported by a *project* resource.
21145/// It is not used directly, but through a [`ProjectMethods`] instance.
21146///
21147/// # Example
21148///
21149/// Instantiate a resource method builder
21150///
21151/// ```test_harness,no_run
21152/// # extern crate hyper;
21153/// # extern crate hyper_rustls;
21154/// # extern crate google_datacatalog1 as datacatalog1;
21155/// use datacatalog1::api::GoogleCloudDatacatalogV1PolicyTag;
21156/// # async fn dox() {
21157/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21158///
21159/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21160/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21161/// # .with_native_roots()
21162/// # .unwrap()
21163/// # .https_only()
21164/// # .enable_http2()
21165/// # .build();
21166///
21167/// # let executor = hyper_util::rt::TokioExecutor::new();
21168/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21169/// # secret,
21170/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21171/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21172/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21173/// # ),
21174/// # ).build().await.unwrap();
21175///
21176/// # let client = hyper_util::client::legacy::Client::builder(
21177/// # hyper_util::rt::TokioExecutor::new()
21178/// # )
21179/// # .build(
21180/// # hyper_rustls::HttpsConnectorBuilder::new()
21181/// # .with_native_roots()
21182/// # .unwrap()
21183/// # .https_or_http()
21184/// # .enable_http2()
21185/// # .build()
21186/// # );
21187/// # let mut hub = DataCatalog::new(client, auth);
21188/// // As the method needs a request, you would usually fill it with the desired information
21189/// // into the respective structure. Some of the parts shown here might not be applicable !
21190/// // Values shown here are possibly random and not representative !
21191/// let mut req = GoogleCloudDatacatalogV1PolicyTag::default();
21192///
21193/// // You can configure optional parameters by calling the respective setters at will, and
21194/// // execute the final call using `doit()`.
21195/// // Values shown here are possibly random and not representative !
21196/// let result = hub.projects().locations_taxonomies_policy_tags_create(req, "parent")
21197/// .doit().await;
21198/// # }
21199/// ```
21200pub struct ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
21201where
21202 C: 'a,
21203{
21204 hub: &'a DataCatalog<C>,
21205 _request: GoogleCloudDatacatalogV1PolicyTag,
21206 _parent: String,
21207 _delegate: Option<&'a mut dyn common::Delegate>,
21208 _additional_params: HashMap<String, String>,
21209 _scopes: BTreeSet<String>,
21210}
21211
21212impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {}
21213
21214impl<'a, C> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
21215where
21216 C: common::Connector,
21217{
21218 /// Perform the operation you have build so far.
21219 pub async fn doit(
21220 mut self,
21221 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1PolicyTag)> {
21222 use std::borrow::Cow;
21223 use std::io::{Read, Seek};
21224
21225 use common::{url::Params, ToParts};
21226 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21227
21228 let mut dd = common::DefaultDelegate;
21229 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21230 dlg.begin(common::MethodInfo {
21231 id: "datacatalog.projects.locations.taxonomies.policyTags.create",
21232 http_method: hyper::Method::POST,
21233 });
21234
21235 for &field in ["alt", "parent"].iter() {
21236 if self._additional_params.contains_key(field) {
21237 dlg.finished(false);
21238 return Err(common::Error::FieldClash(field));
21239 }
21240 }
21241
21242 let mut params = Params::with_capacity(4 + self._additional_params.len());
21243 params.push("parent", self._parent);
21244
21245 params.extend(self._additional_params.iter());
21246
21247 params.push("alt", "json");
21248 let mut url = self.hub._base_url.clone() + "v1/{+parent}/policyTags";
21249 if self._scopes.is_empty() {
21250 self._scopes
21251 .insert(Scope::CloudPlatform.as_ref().to_string());
21252 }
21253
21254 #[allow(clippy::single_element_loop)]
21255 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21256 url = params.uri_replacement(url, param_name, find_this, true);
21257 }
21258 {
21259 let to_remove = ["parent"];
21260 params.remove_params(&to_remove);
21261 }
21262
21263 let url = params.parse_with_url(&url);
21264
21265 let mut json_mime_type = mime::APPLICATION_JSON;
21266 let mut request_value_reader = {
21267 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21268 common::remove_json_null_values(&mut value);
21269 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21270 serde_json::to_writer(&mut dst, &value).unwrap();
21271 dst
21272 };
21273 let request_size = request_value_reader
21274 .seek(std::io::SeekFrom::End(0))
21275 .unwrap();
21276 request_value_reader
21277 .seek(std::io::SeekFrom::Start(0))
21278 .unwrap();
21279
21280 loop {
21281 let token = match self
21282 .hub
21283 .auth
21284 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21285 .await
21286 {
21287 Ok(token) => token,
21288 Err(e) => match dlg.token(e) {
21289 Ok(token) => token,
21290 Err(e) => {
21291 dlg.finished(false);
21292 return Err(common::Error::MissingToken(e));
21293 }
21294 },
21295 };
21296 request_value_reader
21297 .seek(std::io::SeekFrom::Start(0))
21298 .unwrap();
21299 let mut req_result = {
21300 let client = &self.hub.client;
21301 dlg.pre_request();
21302 let mut req_builder = hyper::Request::builder()
21303 .method(hyper::Method::POST)
21304 .uri(url.as_str())
21305 .header(USER_AGENT, self.hub._user_agent.clone());
21306
21307 if let Some(token) = token.as_ref() {
21308 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21309 }
21310
21311 let request = req_builder
21312 .header(CONTENT_TYPE, json_mime_type.to_string())
21313 .header(CONTENT_LENGTH, request_size as u64)
21314 .body(common::to_body(
21315 request_value_reader.get_ref().clone().into(),
21316 ));
21317
21318 client.request(request.unwrap()).await
21319 };
21320
21321 match req_result {
21322 Err(err) => {
21323 if let common::Retry::After(d) = dlg.http_error(&err) {
21324 sleep(d).await;
21325 continue;
21326 }
21327 dlg.finished(false);
21328 return Err(common::Error::HttpError(err));
21329 }
21330 Ok(res) => {
21331 let (mut parts, body) = res.into_parts();
21332 let mut body = common::Body::new(body);
21333 if !parts.status.is_success() {
21334 let bytes = common::to_bytes(body).await.unwrap_or_default();
21335 let error = serde_json::from_str(&common::to_string(&bytes));
21336 let response = common::to_response(parts, bytes.into());
21337
21338 if let common::Retry::After(d) =
21339 dlg.http_failure(&response, error.as_ref().ok())
21340 {
21341 sleep(d).await;
21342 continue;
21343 }
21344
21345 dlg.finished(false);
21346
21347 return Err(match error {
21348 Ok(value) => common::Error::BadRequest(value),
21349 _ => common::Error::Failure(response),
21350 });
21351 }
21352 let response = {
21353 let bytes = common::to_bytes(body).await.unwrap_or_default();
21354 let encoded = common::to_string(&bytes);
21355 match serde_json::from_str(&encoded) {
21356 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21357 Err(error) => {
21358 dlg.response_json_decode_error(&encoded, &error);
21359 return Err(common::Error::JsonDecodeError(
21360 encoded.to_string(),
21361 error,
21362 ));
21363 }
21364 }
21365 };
21366
21367 dlg.finished(true);
21368 return Ok(response);
21369 }
21370 }
21371 }
21372 }
21373
21374 ///
21375 /// Sets the *request* property to the given value.
21376 ///
21377 /// Even though the property as already been set when instantiating this call,
21378 /// we provide this method for API completeness.
21379 pub fn request(
21380 mut self,
21381 new_value: GoogleCloudDatacatalogV1PolicyTag,
21382 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
21383 self._request = new_value;
21384 self
21385 }
21386 /// Required. Resource name of the taxonomy that the policy tag will belong to.
21387 ///
21388 /// Sets the *parent* path property to the given value.
21389 ///
21390 /// Even though the property as already been set when instantiating this call,
21391 /// we provide this method for API completeness.
21392 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
21393 self._parent = new_value.to_string();
21394 self
21395 }
21396 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21397 /// while executing the actual API request.
21398 ///
21399 /// ````text
21400 /// It should be used to handle progress information, and to implement a certain level of resilience.
21401 /// ````
21402 ///
21403 /// Sets the *delegate* property to the given value.
21404 pub fn delegate(
21405 mut self,
21406 new_value: &'a mut dyn common::Delegate,
21407 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
21408 self._delegate = Some(new_value);
21409 self
21410 }
21411
21412 /// Set any additional parameter of the query string used in the request.
21413 /// It should be used to set parameters which are not yet available through their own
21414 /// setters.
21415 ///
21416 /// Please note that this method must not be used to set any of the known parameters
21417 /// which have their own setter method. If done anyway, the request will fail.
21418 ///
21419 /// # Additional Parameters
21420 ///
21421 /// * *$.xgafv* (query-string) - V1 error format.
21422 /// * *access_token* (query-string) - OAuth access token.
21423 /// * *alt* (query-string) - Data format for response.
21424 /// * *callback* (query-string) - JSONP
21425 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21426 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21427 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21428 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21429 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21430 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21431 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21432 pub fn param<T>(
21433 mut self,
21434 name: T,
21435 value: T,
21436 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
21437 where
21438 T: AsRef<str>,
21439 {
21440 self._additional_params
21441 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21442 self
21443 }
21444
21445 /// Identifies the authorization scope for the method you are building.
21446 ///
21447 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21448 /// [`Scope::CloudPlatform`].
21449 ///
21450 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21451 /// tokens for more than one scope.
21452 ///
21453 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21454 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21455 /// sufficient, a read-write scope will do as well.
21456 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
21457 where
21458 St: AsRef<str>,
21459 {
21460 self._scopes.insert(String::from(scope.as_ref()));
21461 self
21462 }
21463 /// Identifies the authorization scope(s) for the method you are building.
21464 ///
21465 /// See [`Self::add_scope()`] for details.
21466 pub fn add_scopes<I, St>(
21467 mut self,
21468 scopes: I,
21469 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
21470 where
21471 I: IntoIterator<Item = St>,
21472 St: AsRef<str>,
21473 {
21474 self._scopes
21475 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21476 self
21477 }
21478
21479 /// Removes all scopes, and no default scope will be used either.
21480 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21481 /// for details).
21482 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
21483 self._scopes.clear();
21484 self
21485 }
21486}
21487
21488/// Deletes a policy tag together with the following: * All of its descendant policy tags, if any * Policies associated with the policy tag and its descendants * References from BigQuery table schema of the policy tag and its descendants
21489///
21490/// A builder for the *locations.taxonomies.policyTags.delete* method supported by a *project* resource.
21491/// It is not used directly, but through a [`ProjectMethods`] instance.
21492///
21493/// # Example
21494///
21495/// Instantiate a resource method builder
21496///
21497/// ```test_harness,no_run
21498/// # extern crate hyper;
21499/// # extern crate hyper_rustls;
21500/// # extern crate google_datacatalog1 as datacatalog1;
21501/// # async fn dox() {
21502/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21503///
21504/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21505/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21506/// # .with_native_roots()
21507/// # .unwrap()
21508/// # .https_only()
21509/// # .enable_http2()
21510/// # .build();
21511///
21512/// # let executor = hyper_util::rt::TokioExecutor::new();
21513/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21514/// # secret,
21515/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21516/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21517/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21518/// # ),
21519/// # ).build().await.unwrap();
21520///
21521/// # let client = hyper_util::client::legacy::Client::builder(
21522/// # hyper_util::rt::TokioExecutor::new()
21523/// # )
21524/// # .build(
21525/// # hyper_rustls::HttpsConnectorBuilder::new()
21526/// # .with_native_roots()
21527/// # .unwrap()
21528/// # .https_or_http()
21529/// # .enable_http2()
21530/// # .build()
21531/// # );
21532/// # let mut hub = DataCatalog::new(client, auth);
21533/// // You can configure optional parameters by calling the respective setters at will, and
21534/// // execute the final call using `doit()`.
21535/// // Values shown here are possibly random and not representative !
21536/// let result = hub.projects().locations_taxonomies_policy_tags_delete("name")
21537/// .doit().await;
21538/// # }
21539/// ```
21540pub struct ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
21541where
21542 C: 'a,
21543{
21544 hub: &'a DataCatalog<C>,
21545 _name: String,
21546 _delegate: Option<&'a mut dyn common::Delegate>,
21547 _additional_params: HashMap<String, String>,
21548 _scopes: BTreeSet<String>,
21549}
21550
21551impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {}
21552
21553impl<'a, C> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
21554where
21555 C: common::Connector,
21556{
21557 /// Perform the operation you have build so far.
21558 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
21559 use std::borrow::Cow;
21560 use std::io::{Read, Seek};
21561
21562 use common::{url::Params, ToParts};
21563 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21564
21565 let mut dd = common::DefaultDelegate;
21566 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21567 dlg.begin(common::MethodInfo {
21568 id: "datacatalog.projects.locations.taxonomies.policyTags.delete",
21569 http_method: hyper::Method::DELETE,
21570 });
21571
21572 for &field in ["alt", "name"].iter() {
21573 if self._additional_params.contains_key(field) {
21574 dlg.finished(false);
21575 return Err(common::Error::FieldClash(field));
21576 }
21577 }
21578
21579 let mut params = Params::with_capacity(3 + self._additional_params.len());
21580 params.push("name", self._name);
21581
21582 params.extend(self._additional_params.iter());
21583
21584 params.push("alt", "json");
21585 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21586 if self._scopes.is_empty() {
21587 self._scopes
21588 .insert(Scope::CloudPlatform.as_ref().to_string());
21589 }
21590
21591 #[allow(clippy::single_element_loop)]
21592 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21593 url = params.uri_replacement(url, param_name, find_this, true);
21594 }
21595 {
21596 let to_remove = ["name"];
21597 params.remove_params(&to_remove);
21598 }
21599
21600 let url = params.parse_with_url(&url);
21601
21602 loop {
21603 let token = match self
21604 .hub
21605 .auth
21606 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21607 .await
21608 {
21609 Ok(token) => token,
21610 Err(e) => match dlg.token(e) {
21611 Ok(token) => token,
21612 Err(e) => {
21613 dlg.finished(false);
21614 return Err(common::Error::MissingToken(e));
21615 }
21616 },
21617 };
21618 let mut req_result = {
21619 let client = &self.hub.client;
21620 dlg.pre_request();
21621 let mut req_builder = hyper::Request::builder()
21622 .method(hyper::Method::DELETE)
21623 .uri(url.as_str())
21624 .header(USER_AGENT, self.hub._user_agent.clone());
21625
21626 if let Some(token) = token.as_ref() {
21627 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21628 }
21629
21630 let request = req_builder
21631 .header(CONTENT_LENGTH, 0_u64)
21632 .body(common::to_body::<String>(None));
21633
21634 client.request(request.unwrap()).await
21635 };
21636
21637 match req_result {
21638 Err(err) => {
21639 if let common::Retry::After(d) = dlg.http_error(&err) {
21640 sleep(d).await;
21641 continue;
21642 }
21643 dlg.finished(false);
21644 return Err(common::Error::HttpError(err));
21645 }
21646 Ok(res) => {
21647 let (mut parts, body) = res.into_parts();
21648 let mut body = common::Body::new(body);
21649 if !parts.status.is_success() {
21650 let bytes = common::to_bytes(body).await.unwrap_or_default();
21651 let error = serde_json::from_str(&common::to_string(&bytes));
21652 let response = common::to_response(parts, bytes.into());
21653
21654 if let common::Retry::After(d) =
21655 dlg.http_failure(&response, error.as_ref().ok())
21656 {
21657 sleep(d).await;
21658 continue;
21659 }
21660
21661 dlg.finished(false);
21662
21663 return Err(match error {
21664 Ok(value) => common::Error::BadRequest(value),
21665 _ => common::Error::Failure(response),
21666 });
21667 }
21668 let response = {
21669 let bytes = common::to_bytes(body).await.unwrap_or_default();
21670 let encoded = common::to_string(&bytes);
21671 match serde_json::from_str(&encoded) {
21672 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21673 Err(error) => {
21674 dlg.response_json_decode_error(&encoded, &error);
21675 return Err(common::Error::JsonDecodeError(
21676 encoded.to_string(),
21677 error,
21678 ));
21679 }
21680 }
21681 };
21682
21683 dlg.finished(true);
21684 return Ok(response);
21685 }
21686 }
21687 }
21688 }
21689
21690 /// Required. Resource name of the policy tag to delete. Note: All of its descendant policy tags are also deleted.
21691 ///
21692 /// Sets the *name* path property to the given value.
21693 ///
21694 /// Even though the property as already been set when instantiating this call,
21695 /// we provide this method for API completeness.
21696 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
21697 self._name = new_value.to_string();
21698 self
21699 }
21700 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21701 /// while executing the actual API request.
21702 ///
21703 /// ````text
21704 /// It should be used to handle progress information, and to implement a certain level of resilience.
21705 /// ````
21706 ///
21707 /// Sets the *delegate* property to the given value.
21708 pub fn delegate(
21709 mut self,
21710 new_value: &'a mut dyn common::Delegate,
21711 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
21712 self._delegate = Some(new_value);
21713 self
21714 }
21715
21716 /// Set any additional parameter of the query string used in the request.
21717 /// It should be used to set parameters which are not yet available through their own
21718 /// setters.
21719 ///
21720 /// Please note that this method must not be used to set any of the known parameters
21721 /// which have their own setter method. If done anyway, the request will fail.
21722 ///
21723 /// # Additional Parameters
21724 ///
21725 /// * *$.xgafv* (query-string) - V1 error format.
21726 /// * *access_token* (query-string) - OAuth access token.
21727 /// * *alt* (query-string) - Data format for response.
21728 /// * *callback* (query-string) - JSONP
21729 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21730 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21731 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21732 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21733 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21734 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21735 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21736 pub fn param<T>(
21737 mut self,
21738 name: T,
21739 value: T,
21740 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
21741 where
21742 T: AsRef<str>,
21743 {
21744 self._additional_params
21745 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21746 self
21747 }
21748
21749 /// Identifies the authorization scope for the method you are building.
21750 ///
21751 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21752 /// [`Scope::CloudPlatform`].
21753 ///
21754 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21755 /// tokens for more than one scope.
21756 ///
21757 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21758 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21759 /// sufficient, a read-write scope will do as well.
21760 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
21761 where
21762 St: AsRef<str>,
21763 {
21764 self._scopes.insert(String::from(scope.as_ref()));
21765 self
21766 }
21767 /// Identifies the authorization scope(s) for the method you are building.
21768 ///
21769 /// See [`Self::add_scope()`] for details.
21770 pub fn add_scopes<I, St>(
21771 mut self,
21772 scopes: I,
21773 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
21774 where
21775 I: IntoIterator<Item = St>,
21776 St: AsRef<str>,
21777 {
21778 self._scopes
21779 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21780 self
21781 }
21782
21783 /// Removes all scopes, and no default scope will be used either.
21784 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21785 /// for details).
21786 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
21787 self._scopes.clear();
21788 self
21789 }
21790}
21791
21792/// Gets a policy tag.
21793///
21794/// A builder for the *locations.taxonomies.policyTags.get* method supported by a *project* resource.
21795/// It is not used directly, but through a [`ProjectMethods`] instance.
21796///
21797/// # Example
21798///
21799/// Instantiate a resource method builder
21800///
21801/// ```test_harness,no_run
21802/// # extern crate hyper;
21803/// # extern crate hyper_rustls;
21804/// # extern crate google_datacatalog1 as datacatalog1;
21805/// # async fn dox() {
21806/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21807///
21808/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21809/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21810/// # .with_native_roots()
21811/// # .unwrap()
21812/// # .https_only()
21813/// # .enable_http2()
21814/// # .build();
21815///
21816/// # let executor = hyper_util::rt::TokioExecutor::new();
21817/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21818/// # secret,
21819/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21820/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21821/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21822/// # ),
21823/// # ).build().await.unwrap();
21824///
21825/// # let client = hyper_util::client::legacy::Client::builder(
21826/// # hyper_util::rt::TokioExecutor::new()
21827/// # )
21828/// # .build(
21829/// # hyper_rustls::HttpsConnectorBuilder::new()
21830/// # .with_native_roots()
21831/// # .unwrap()
21832/// # .https_or_http()
21833/// # .enable_http2()
21834/// # .build()
21835/// # );
21836/// # let mut hub = DataCatalog::new(client, auth);
21837/// // You can configure optional parameters by calling the respective setters at will, and
21838/// // execute the final call using `doit()`.
21839/// // Values shown here are possibly random and not representative !
21840/// let result = hub.projects().locations_taxonomies_policy_tags_get("name")
21841/// .doit().await;
21842/// # }
21843/// ```
21844pub struct ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
21845where
21846 C: 'a,
21847{
21848 hub: &'a DataCatalog<C>,
21849 _name: String,
21850 _delegate: Option<&'a mut dyn common::Delegate>,
21851 _additional_params: HashMap<String, String>,
21852 _scopes: BTreeSet<String>,
21853}
21854
21855impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {}
21856
21857impl<'a, C> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
21858where
21859 C: common::Connector,
21860{
21861 /// Perform the operation you have build so far.
21862 pub async fn doit(
21863 mut self,
21864 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1PolicyTag)> {
21865 use std::borrow::Cow;
21866 use std::io::{Read, Seek};
21867
21868 use common::{url::Params, ToParts};
21869 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21870
21871 let mut dd = common::DefaultDelegate;
21872 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21873 dlg.begin(common::MethodInfo {
21874 id: "datacatalog.projects.locations.taxonomies.policyTags.get",
21875 http_method: hyper::Method::GET,
21876 });
21877
21878 for &field in ["alt", "name"].iter() {
21879 if self._additional_params.contains_key(field) {
21880 dlg.finished(false);
21881 return Err(common::Error::FieldClash(field));
21882 }
21883 }
21884
21885 let mut params = Params::with_capacity(3 + self._additional_params.len());
21886 params.push("name", self._name);
21887
21888 params.extend(self._additional_params.iter());
21889
21890 params.push("alt", "json");
21891 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21892 if self._scopes.is_empty() {
21893 self._scopes
21894 .insert(Scope::CloudPlatform.as_ref().to_string());
21895 }
21896
21897 #[allow(clippy::single_element_loop)]
21898 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21899 url = params.uri_replacement(url, param_name, find_this, true);
21900 }
21901 {
21902 let to_remove = ["name"];
21903 params.remove_params(&to_remove);
21904 }
21905
21906 let url = params.parse_with_url(&url);
21907
21908 loop {
21909 let token = match self
21910 .hub
21911 .auth
21912 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21913 .await
21914 {
21915 Ok(token) => token,
21916 Err(e) => match dlg.token(e) {
21917 Ok(token) => token,
21918 Err(e) => {
21919 dlg.finished(false);
21920 return Err(common::Error::MissingToken(e));
21921 }
21922 },
21923 };
21924 let mut req_result = {
21925 let client = &self.hub.client;
21926 dlg.pre_request();
21927 let mut req_builder = hyper::Request::builder()
21928 .method(hyper::Method::GET)
21929 .uri(url.as_str())
21930 .header(USER_AGENT, self.hub._user_agent.clone());
21931
21932 if let Some(token) = token.as_ref() {
21933 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21934 }
21935
21936 let request = req_builder
21937 .header(CONTENT_LENGTH, 0_u64)
21938 .body(common::to_body::<String>(None));
21939
21940 client.request(request.unwrap()).await
21941 };
21942
21943 match req_result {
21944 Err(err) => {
21945 if let common::Retry::After(d) = dlg.http_error(&err) {
21946 sleep(d).await;
21947 continue;
21948 }
21949 dlg.finished(false);
21950 return Err(common::Error::HttpError(err));
21951 }
21952 Ok(res) => {
21953 let (mut parts, body) = res.into_parts();
21954 let mut body = common::Body::new(body);
21955 if !parts.status.is_success() {
21956 let bytes = common::to_bytes(body).await.unwrap_or_default();
21957 let error = serde_json::from_str(&common::to_string(&bytes));
21958 let response = common::to_response(parts, bytes.into());
21959
21960 if let common::Retry::After(d) =
21961 dlg.http_failure(&response, error.as_ref().ok())
21962 {
21963 sleep(d).await;
21964 continue;
21965 }
21966
21967 dlg.finished(false);
21968
21969 return Err(match error {
21970 Ok(value) => common::Error::BadRequest(value),
21971 _ => common::Error::Failure(response),
21972 });
21973 }
21974 let response = {
21975 let bytes = common::to_bytes(body).await.unwrap_or_default();
21976 let encoded = common::to_string(&bytes);
21977 match serde_json::from_str(&encoded) {
21978 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21979 Err(error) => {
21980 dlg.response_json_decode_error(&encoded, &error);
21981 return Err(common::Error::JsonDecodeError(
21982 encoded.to_string(),
21983 error,
21984 ));
21985 }
21986 }
21987 };
21988
21989 dlg.finished(true);
21990 return Ok(response);
21991 }
21992 }
21993 }
21994 }
21995
21996 /// Required. Resource name of the policy tag.
21997 ///
21998 /// Sets the *name* path property to the given value.
21999 ///
22000 /// Even though the property as already been set when instantiating this call,
22001 /// we provide this method for API completeness.
22002 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
22003 self._name = new_value.to_string();
22004 self
22005 }
22006 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22007 /// while executing the actual API request.
22008 ///
22009 /// ````text
22010 /// It should be used to handle progress information, and to implement a certain level of resilience.
22011 /// ````
22012 ///
22013 /// Sets the *delegate* property to the given value.
22014 pub fn delegate(
22015 mut self,
22016 new_value: &'a mut dyn common::Delegate,
22017 ) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
22018 self._delegate = Some(new_value);
22019 self
22020 }
22021
22022 /// Set any additional parameter of the query string used in the request.
22023 /// It should be used to set parameters which are not yet available through their own
22024 /// setters.
22025 ///
22026 /// Please note that this method must not be used to set any of the known parameters
22027 /// which have their own setter method. If done anyway, the request will fail.
22028 ///
22029 /// # Additional Parameters
22030 ///
22031 /// * *$.xgafv* (query-string) - V1 error format.
22032 /// * *access_token* (query-string) - OAuth access token.
22033 /// * *alt* (query-string) - Data format for response.
22034 /// * *callback* (query-string) - JSONP
22035 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22036 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22037 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22038 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22039 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22040 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22041 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22042 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
22043 where
22044 T: AsRef<str>,
22045 {
22046 self._additional_params
22047 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22048 self
22049 }
22050
22051 /// Identifies the authorization scope for the method you are building.
22052 ///
22053 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22054 /// [`Scope::CloudPlatform`].
22055 ///
22056 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22057 /// tokens for more than one scope.
22058 ///
22059 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22060 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22061 /// sufficient, a read-write scope will do as well.
22062 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
22063 where
22064 St: AsRef<str>,
22065 {
22066 self._scopes.insert(String::from(scope.as_ref()));
22067 self
22068 }
22069 /// Identifies the authorization scope(s) for the method you are building.
22070 ///
22071 /// See [`Self::add_scope()`] for details.
22072 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
22073 where
22074 I: IntoIterator<Item = St>,
22075 St: AsRef<str>,
22076 {
22077 self._scopes
22078 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22079 self
22080 }
22081
22082 /// Removes all scopes, and no default scope will be used either.
22083 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22084 /// for details).
22085 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
22086 self._scopes.clear();
22087 self
22088 }
22089}
22090
22091/// Gets the IAM policy for a policy tag or a taxonomy.
22092///
22093/// A builder for the *locations.taxonomies.policyTags.getIamPolicy* method supported by a *project* resource.
22094/// It is not used directly, but through a [`ProjectMethods`] instance.
22095///
22096/// # Example
22097///
22098/// Instantiate a resource method builder
22099///
22100/// ```test_harness,no_run
22101/// # extern crate hyper;
22102/// # extern crate hyper_rustls;
22103/// # extern crate google_datacatalog1 as datacatalog1;
22104/// use datacatalog1::api::GetIamPolicyRequest;
22105/// # async fn dox() {
22106/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22107///
22108/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22109/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22110/// # .with_native_roots()
22111/// # .unwrap()
22112/// # .https_only()
22113/// # .enable_http2()
22114/// # .build();
22115///
22116/// # let executor = hyper_util::rt::TokioExecutor::new();
22117/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22118/// # secret,
22119/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22120/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22121/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22122/// # ),
22123/// # ).build().await.unwrap();
22124///
22125/// # let client = hyper_util::client::legacy::Client::builder(
22126/// # hyper_util::rt::TokioExecutor::new()
22127/// # )
22128/// # .build(
22129/// # hyper_rustls::HttpsConnectorBuilder::new()
22130/// # .with_native_roots()
22131/// # .unwrap()
22132/// # .https_or_http()
22133/// # .enable_http2()
22134/// # .build()
22135/// # );
22136/// # let mut hub = DataCatalog::new(client, auth);
22137/// // As the method needs a request, you would usually fill it with the desired information
22138/// // into the respective structure. Some of the parts shown here might not be applicable !
22139/// // Values shown here are possibly random and not representative !
22140/// let mut req = GetIamPolicyRequest::default();
22141///
22142/// // You can configure optional parameters by calling the respective setters at will, and
22143/// // execute the final call using `doit()`.
22144/// // Values shown here are possibly random and not representative !
22145/// let result = hub.projects().locations_taxonomies_policy_tags_get_iam_policy(req, "resource")
22146/// .doit().await;
22147/// # }
22148/// ```
22149pub struct ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
22150where
22151 C: 'a,
22152{
22153 hub: &'a DataCatalog<C>,
22154 _request: GetIamPolicyRequest,
22155 _resource: String,
22156 _delegate: Option<&'a mut dyn common::Delegate>,
22157 _additional_params: HashMap<String, String>,
22158 _scopes: BTreeSet<String>,
22159}
22160
22161impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {}
22162
22163impl<'a, C> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
22164where
22165 C: common::Connector,
22166{
22167 /// Perform the operation you have build so far.
22168 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22169 use std::borrow::Cow;
22170 use std::io::{Read, Seek};
22171
22172 use common::{url::Params, ToParts};
22173 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22174
22175 let mut dd = common::DefaultDelegate;
22176 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22177 dlg.begin(common::MethodInfo {
22178 id: "datacatalog.projects.locations.taxonomies.policyTags.getIamPolicy",
22179 http_method: hyper::Method::POST,
22180 });
22181
22182 for &field in ["alt", "resource"].iter() {
22183 if self._additional_params.contains_key(field) {
22184 dlg.finished(false);
22185 return Err(common::Error::FieldClash(field));
22186 }
22187 }
22188
22189 let mut params = Params::with_capacity(4 + self._additional_params.len());
22190 params.push("resource", self._resource);
22191
22192 params.extend(self._additional_params.iter());
22193
22194 params.push("alt", "json");
22195 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
22196 if self._scopes.is_empty() {
22197 self._scopes
22198 .insert(Scope::CloudPlatform.as_ref().to_string());
22199 }
22200
22201 #[allow(clippy::single_element_loop)]
22202 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22203 url = params.uri_replacement(url, param_name, find_this, true);
22204 }
22205 {
22206 let to_remove = ["resource"];
22207 params.remove_params(&to_remove);
22208 }
22209
22210 let url = params.parse_with_url(&url);
22211
22212 let mut json_mime_type = mime::APPLICATION_JSON;
22213 let mut request_value_reader = {
22214 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22215 common::remove_json_null_values(&mut value);
22216 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22217 serde_json::to_writer(&mut dst, &value).unwrap();
22218 dst
22219 };
22220 let request_size = request_value_reader
22221 .seek(std::io::SeekFrom::End(0))
22222 .unwrap();
22223 request_value_reader
22224 .seek(std::io::SeekFrom::Start(0))
22225 .unwrap();
22226
22227 loop {
22228 let token = match self
22229 .hub
22230 .auth
22231 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22232 .await
22233 {
22234 Ok(token) => token,
22235 Err(e) => match dlg.token(e) {
22236 Ok(token) => token,
22237 Err(e) => {
22238 dlg.finished(false);
22239 return Err(common::Error::MissingToken(e));
22240 }
22241 },
22242 };
22243 request_value_reader
22244 .seek(std::io::SeekFrom::Start(0))
22245 .unwrap();
22246 let mut req_result = {
22247 let client = &self.hub.client;
22248 dlg.pre_request();
22249 let mut req_builder = hyper::Request::builder()
22250 .method(hyper::Method::POST)
22251 .uri(url.as_str())
22252 .header(USER_AGENT, self.hub._user_agent.clone());
22253
22254 if let Some(token) = token.as_ref() {
22255 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22256 }
22257
22258 let request = req_builder
22259 .header(CONTENT_TYPE, json_mime_type.to_string())
22260 .header(CONTENT_LENGTH, request_size as u64)
22261 .body(common::to_body(
22262 request_value_reader.get_ref().clone().into(),
22263 ));
22264
22265 client.request(request.unwrap()).await
22266 };
22267
22268 match req_result {
22269 Err(err) => {
22270 if let common::Retry::After(d) = dlg.http_error(&err) {
22271 sleep(d).await;
22272 continue;
22273 }
22274 dlg.finished(false);
22275 return Err(common::Error::HttpError(err));
22276 }
22277 Ok(res) => {
22278 let (mut parts, body) = res.into_parts();
22279 let mut body = common::Body::new(body);
22280 if !parts.status.is_success() {
22281 let bytes = common::to_bytes(body).await.unwrap_or_default();
22282 let error = serde_json::from_str(&common::to_string(&bytes));
22283 let response = common::to_response(parts, bytes.into());
22284
22285 if let common::Retry::After(d) =
22286 dlg.http_failure(&response, error.as_ref().ok())
22287 {
22288 sleep(d).await;
22289 continue;
22290 }
22291
22292 dlg.finished(false);
22293
22294 return Err(match error {
22295 Ok(value) => common::Error::BadRequest(value),
22296 _ => common::Error::Failure(response),
22297 });
22298 }
22299 let response = {
22300 let bytes = common::to_bytes(body).await.unwrap_or_default();
22301 let encoded = common::to_string(&bytes);
22302 match serde_json::from_str(&encoded) {
22303 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22304 Err(error) => {
22305 dlg.response_json_decode_error(&encoded, &error);
22306 return Err(common::Error::JsonDecodeError(
22307 encoded.to_string(),
22308 error,
22309 ));
22310 }
22311 }
22312 };
22313
22314 dlg.finished(true);
22315 return Ok(response);
22316 }
22317 }
22318 }
22319 }
22320
22321 ///
22322 /// Sets the *request* property to the given value.
22323 ///
22324 /// Even though the property as already been set when instantiating this call,
22325 /// we provide this method for API completeness.
22326 pub fn request(
22327 mut self,
22328 new_value: GetIamPolicyRequest,
22329 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
22330 self._request = new_value;
22331 self
22332 }
22333 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
22334 ///
22335 /// Sets the *resource* path property to the given value.
22336 ///
22337 /// Even though the property as already been set when instantiating this call,
22338 /// we provide this method for API completeness.
22339 pub fn resource(
22340 mut self,
22341 new_value: &str,
22342 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
22343 self._resource = new_value.to_string();
22344 self
22345 }
22346 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22347 /// while executing the actual API request.
22348 ///
22349 /// ````text
22350 /// It should be used to handle progress information, and to implement a certain level of resilience.
22351 /// ````
22352 ///
22353 /// Sets the *delegate* property to the given value.
22354 pub fn delegate(
22355 mut self,
22356 new_value: &'a mut dyn common::Delegate,
22357 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
22358 self._delegate = Some(new_value);
22359 self
22360 }
22361
22362 /// Set any additional parameter of the query string used in the request.
22363 /// It should be used to set parameters which are not yet available through their own
22364 /// setters.
22365 ///
22366 /// Please note that this method must not be used to set any of the known parameters
22367 /// which have their own setter method. If done anyway, the request will fail.
22368 ///
22369 /// # Additional Parameters
22370 ///
22371 /// * *$.xgafv* (query-string) - V1 error format.
22372 /// * *access_token* (query-string) - OAuth access token.
22373 /// * *alt* (query-string) - Data format for response.
22374 /// * *callback* (query-string) - JSONP
22375 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22376 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22377 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22378 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22379 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22380 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22381 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22382 pub fn param<T>(
22383 mut self,
22384 name: T,
22385 value: T,
22386 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
22387 where
22388 T: AsRef<str>,
22389 {
22390 self._additional_params
22391 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22392 self
22393 }
22394
22395 /// Identifies the authorization scope for the method you are building.
22396 ///
22397 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22398 /// [`Scope::CloudPlatform`].
22399 ///
22400 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22401 /// tokens for more than one scope.
22402 ///
22403 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22404 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22405 /// sufficient, a read-write scope will do as well.
22406 pub fn add_scope<St>(
22407 mut self,
22408 scope: St,
22409 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
22410 where
22411 St: AsRef<str>,
22412 {
22413 self._scopes.insert(String::from(scope.as_ref()));
22414 self
22415 }
22416 /// Identifies the authorization scope(s) for the method you are building.
22417 ///
22418 /// See [`Self::add_scope()`] for details.
22419 pub fn add_scopes<I, St>(
22420 mut self,
22421 scopes: I,
22422 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
22423 where
22424 I: IntoIterator<Item = St>,
22425 St: AsRef<str>,
22426 {
22427 self._scopes
22428 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22429 self
22430 }
22431
22432 /// Removes all scopes, and no default scope will be used either.
22433 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22434 /// for details).
22435 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
22436 self._scopes.clear();
22437 self
22438 }
22439}
22440
22441/// Lists all policy tags in a taxonomy.
22442///
22443/// A builder for the *locations.taxonomies.policyTags.list* method supported by a *project* resource.
22444/// It is not used directly, but through a [`ProjectMethods`] instance.
22445///
22446/// # Example
22447///
22448/// Instantiate a resource method builder
22449///
22450/// ```test_harness,no_run
22451/// # extern crate hyper;
22452/// # extern crate hyper_rustls;
22453/// # extern crate google_datacatalog1 as datacatalog1;
22454/// # async fn dox() {
22455/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22456///
22457/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22458/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22459/// # .with_native_roots()
22460/// # .unwrap()
22461/// # .https_only()
22462/// # .enable_http2()
22463/// # .build();
22464///
22465/// # let executor = hyper_util::rt::TokioExecutor::new();
22466/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22467/// # secret,
22468/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22469/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22470/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22471/// # ),
22472/// # ).build().await.unwrap();
22473///
22474/// # let client = hyper_util::client::legacy::Client::builder(
22475/// # hyper_util::rt::TokioExecutor::new()
22476/// # )
22477/// # .build(
22478/// # hyper_rustls::HttpsConnectorBuilder::new()
22479/// # .with_native_roots()
22480/// # .unwrap()
22481/// # .https_or_http()
22482/// # .enable_http2()
22483/// # .build()
22484/// # );
22485/// # let mut hub = DataCatalog::new(client, auth);
22486/// // You can configure optional parameters by calling the respective setters at will, and
22487/// // execute the final call using `doit()`.
22488/// // Values shown here are possibly random and not representative !
22489/// let result = hub.projects().locations_taxonomies_policy_tags_list("parent")
22490/// .page_token("dolore")
22491/// .page_size(-34)
22492/// .doit().await;
22493/// # }
22494/// ```
22495pub struct ProjectLocationTaxonomyPolicyTagListCall<'a, C>
22496where
22497 C: 'a,
22498{
22499 hub: &'a DataCatalog<C>,
22500 _parent: String,
22501 _page_token: Option<String>,
22502 _page_size: Option<i32>,
22503 _delegate: Option<&'a mut dyn common::Delegate>,
22504 _additional_params: HashMap<String, String>,
22505 _scopes: BTreeSet<String>,
22506}
22507
22508impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagListCall<'a, C> {}
22509
22510impl<'a, C> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
22511where
22512 C: common::Connector,
22513{
22514 /// Perform the operation you have build so far.
22515 pub async fn doit(
22516 mut self,
22517 ) -> common::Result<(
22518 common::Response,
22519 GoogleCloudDatacatalogV1ListPolicyTagsResponse,
22520 )> {
22521 use std::borrow::Cow;
22522 use std::io::{Read, Seek};
22523
22524 use common::{url::Params, ToParts};
22525 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22526
22527 let mut dd = common::DefaultDelegate;
22528 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22529 dlg.begin(common::MethodInfo {
22530 id: "datacatalog.projects.locations.taxonomies.policyTags.list",
22531 http_method: hyper::Method::GET,
22532 });
22533
22534 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
22535 if self._additional_params.contains_key(field) {
22536 dlg.finished(false);
22537 return Err(common::Error::FieldClash(field));
22538 }
22539 }
22540
22541 let mut params = Params::with_capacity(5 + self._additional_params.len());
22542 params.push("parent", self._parent);
22543 if let Some(value) = self._page_token.as_ref() {
22544 params.push("pageToken", value);
22545 }
22546 if let Some(value) = self._page_size.as_ref() {
22547 params.push("pageSize", value.to_string());
22548 }
22549
22550 params.extend(self._additional_params.iter());
22551
22552 params.push("alt", "json");
22553 let mut url = self.hub._base_url.clone() + "v1/{+parent}/policyTags";
22554 if self._scopes.is_empty() {
22555 self._scopes
22556 .insert(Scope::CloudPlatform.as_ref().to_string());
22557 }
22558
22559 #[allow(clippy::single_element_loop)]
22560 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22561 url = params.uri_replacement(url, param_name, find_this, true);
22562 }
22563 {
22564 let to_remove = ["parent"];
22565 params.remove_params(&to_remove);
22566 }
22567
22568 let url = params.parse_with_url(&url);
22569
22570 loop {
22571 let token = match self
22572 .hub
22573 .auth
22574 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22575 .await
22576 {
22577 Ok(token) => token,
22578 Err(e) => match dlg.token(e) {
22579 Ok(token) => token,
22580 Err(e) => {
22581 dlg.finished(false);
22582 return Err(common::Error::MissingToken(e));
22583 }
22584 },
22585 };
22586 let mut req_result = {
22587 let client = &self.hub.client;
22588 dlg.pre_request();
22589 let mut req_builder = hyper::Request::builder()
22590 .method(hyper::Method::GET)
22591 .uri(url.as_str())
22592 .header(USER_AGENT, self.hub._user_agent.clone());
22593
22594 if let Some(token) = token.as_ref() {
22595 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22596 }
22597
22598 let request = req_builder
22599 .header(CONTENT_LENGTH, 0_u64)
22600 .body(common::to_body::<String>(None));
22601
22602 client.request(request.unwrap()).await
22603 };
22604
22605 match req_result {
22606 Err(err) => {
22607 if let common::Retry::After(d) = dlg.http_error(&err) {
22608 sleep(d).await;
22609 continue;
22610 }
22611 dlg.finished(false);
22612 return Err(common::Error::HttpError(err));
22613 }
22614 Ok(res) => {
22615 let (mut parts, body) = res.into_parts();
22616 let mut body = common::Body::new(body);
22617 if !parts.status.is_success() {
22618 let bytes = common::to_bytes(body).await.unwrap_or_default();
22619 let error = serde_json::from_str(&common::to_string(&bytes));
22620 let response = common::to_response(parts, bytes.into());
22621
22622 if let common::Retry::After(d) =
22623 dlg.http_failure(&response, error.as_ref().ok())
22624 {
22625 sleep(d).await;
22626 continue;
22627 }
22628
22629 dlg.finished(false);
22630
22631 return Err(match error {
22632 Ok(value) => common::Error::BadRequest(value),
22633 _ => common::Error::Failure(response),
22634 });
22635 }
22636 let response = {
22637 let bytes = common::to_bytes(body).await.unwrap_or_default();
22638 let encoded = common::to_string(&bytes);
22639 match serde_json::from_str(&encoded) {
22640 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22641 Err(error) => {
22642 dlg.response_json_decode_error(&encoded, &error);
22643 return Err(common::Error::JsonDecodeError(
22644 encoded.to_string(),
22645 error,
22646 ));
22647 }
22648 }
22649 };
22650
22651 dlg.finished(true);
22652 return Ok(response);
22653 }
22654 }
22655 }
22656 }
22657
22658 /// Required. Resource name of the taxonomy to list the policy tags of.
22659 ///
22660 /// Sets the *parent* path property to the given value.
22661 ///
22662 /// Even though the property as already been set when instantiating this call,
22663 /// we provide this method for API completeness.
22664 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
22665 self._parent = new_value.to_string();
22666 self
22667 }
22668 /// The pagination token of the next results page. If not set, returns the first page. The token is returned in the response to a previous list request.
22669 ///
22670 /// Sets the *page token* query property to the given value.
22671 pub fn page_token(
22672 mut self,
22673 new_value: &str,
22674 ) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
22675 self._page_token = Some(new_value.to_string());
22676 self
22677 }
22678 /// The maximum number of items to return. Must be a value between 1 and 1000 inclusively. If not set, defaults to 50.
22679 ///
22680 /// Sets the *page size* query property to the given value.
22681 pub fn page_size(mut self, new_value: i32) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
22682 self._page_size = Some(new_value);
22683 self
22684 }
22685 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22686 /// while executing the actual API request.
22687 ///
22688 /// ````text
22689 /// It should be used to handle progress information, and to implement a certain level of resilience.
22690 /// ````
22691 ///
22692 /// Sets the *delegate* property to the given value.
22693 pub fn delegate(
22694 mut self,
22695 new_value: &'a mut dyn common::Delegate,
22696 ) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
22697 self._delegate = Some(new_value);
22698 self
22699 }
22700
22701 /// Set any additional parameter of the query string used in the request.
22702 /// It should be used to set parameters which are not yet available through their own
22703 /// setters.
22704 ///
22705 /// Please note that this method must not be used to set any of the known parameters
22706 /// which have their own setter method. If done anyway, the request will fail.
22707 ///
22708 /// # Additional Parameters
22709 ///
22710 /// * *$.xgafv* (query-string) - V1 error format.
22711 /// * *access_token* (query-string) - OAuth access token.
22712 /// * *alt* (query-string) - Data format for response.
22713 /// * *callback* (query-string) - JSONP
22714 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22715 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22716 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22717 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22718 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22719 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22720 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22721 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
22722 where
22723 T: AsRef<str>,
22724 {
22725 self._additional_params
22726 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22727 self
22728 }
22729
22730 /// Identifies the authorization scope for the method you are building.
22731 ///
22732 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22733 /// [`Scope::CloudPlatform`].
22734 ///
22735 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22736 /// tokens for more than one scope.
22737 ///
22738 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22739 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22740 /// sufficient, a read-write scope will do as well.
22741 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
22742 where
22743 St: AsRef<str>,
22744 {
22745 self._scopes.insert(String::from(scope.as_ref()));
22746 self
22747 }
22748 /// Identifies the authorization scope(s) for the method you are building.
22749 ///
22750 /// See [`Self::add_scope()`] for details.
22751 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
22752 where
22753 I: IntoIterator<Item = St>,
22754 St: AsRef<str>,
22755 {
22756 self._scopes
22757 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22758 self
22759 }
22760
22761 /// Removes all scopes, and no default scope will be used either.
22762 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22763 /// for details).
22764 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
22765 self._scopes.clear();
22766 self
22767 }
22768}
22769
22770/// Updates a policy tag, including its display name, description, and parent policy tag.
22771///
22772/// A builder for the *locations.taxonomies.policyTags.patch* method supported by a *project* resource.
22773/// It is not used directly, but through a [`ProjectMethods`] instance.
22774///
22775/// # Example
22776///
22777/// Instantiate a resource method builder
22778///
22779/// ```test_harness,no_run
22780/// # extern crate hyper;
22781/// # extern crate hyper_rustls;
22782/// # extern crate google_datacatalog1 as datacatalog1;
22783/// use datacatalog1::api::GoogleCloudDatacatalogV1PolicyTag;
22784/// # async fn dox() {
22785/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22786///
22787/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22788/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22789/// # .with_native_roots()
22790/// # .unwrap()
22791/// # .https_only()
22792/// # .enable_http2()
22793/// # .build();
22794///
22795/// # let executor = hyper_util::rt::TokioExecutor::new();
22796/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22797/// # secret,
22798/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22799/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22800/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22801/// # ),
22802/// # ).build().await.unwrap();
22803///
22804/// # let client = hyper_util::client::legacy::Client::builder(
22805/// # hyper_util::rt::TokioExecutor::new()
22806/// # )
22807/// # .build(
22808/// # hyper_rustls::HttpsConnectorBuilder::new()
22809/// # .with_native_roots()
22810/// # .unwrap()
22811/// # .https_or_http()
22812/// # .enable_http2()
22813/// # .build()
22814/// # );
22815/// # let mut hub = DataCatalog::new(client, auth);
22816/// // As the method needs a request, you would usually fill it with the desired information
22817/// // into the respective structure. Some of the parts shown here might not be applicable !
22818/// // Values shown here are possibly random and not representative !
22819/// let mut req = GoogleCloudDatacatalogV1PolicyTag::default();
22820///
22821/// // You can configure optional parameters by calling the respective setters at will, and
22822/// // execute the final call using `doit()`.
22823/// // Values shown here are possibly random and not representative !
22824/// let result = hub.projects().locations_taxonomies_policy_tags_patch(req, "name")
22825/// .update_mask(FieldMask::new::<&str>(&[]))
22826/// .doit().await;
22827/// # }
22828/// ```
22829pub struct ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
22830where
22831 C: 'a,
22832{
22833 hub: &'a DataCatalog<C>,
22834 _request: GoogleCloudDatacatalogV1PolicyTag,
22835 _name: String,
22836 _update_mask: Option<common::FieldMask>,
22837 _delegate: Option<&'a mut dyn common::Delegate>,
22838 _additional_params: HashMap<String, String>,
22839 _scopes: BTreeSet<String>,
22840}
22841
22842impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {}
22843
22844impl<'a, C> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
22845where
22846 C: common::Connector,
22847{
22848 /// Perform the operation you have build so far.
22849 pub async fn doit(
22850 mut self,
22851 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1PolicyTag)> {
22852 use std::borrow::Cow;
22853 use std::io::{Read, Seek};
22854
22855 use common::{url::Params, ToParts};
22856 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22857
22858 let mut dd = common::DefaultDelegate;
22859 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22860 dlg.begin(common::MethodInfo {
22861 id: "datacatalog.projects.locations.taxonomies.policyTags.patch",
22862 http_method: hyper::Method::PATCH,
22863 });
22864
22865 for &field in ["alt", "name", "updateMask"].iter() {
22866 if self._additional_params.contains_key(field) {
22867 dlg.finished(false);
22868 return Err(common::Error::FieldClash(field));
22869 }
22870 }
22871
22872 let mut params = Params::with_capacity(5 + self._additional_params.len());
22873 params.push("name", self._name);
22874 if let Some(value) = self._update_mask.as_ref() {
22875 params.push("updateMask", value.to_string());
22876 }
22877
22878 params.extend(self._additional_params.iter());
22879
22880 params.push("alt", "json");
22881 let mut url = self.hub._base_url.clone() + "v1/{+name}";
22882 if self._scopes.is_empty() {
22883 self._scopes
22884 .insert(Scope::CloudPlatform.as_ref().to_string());
22885 }
22886
22887 #[allow(clippy::single_element_loop)]
22888 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22889 url = params.uri_replacement(url, param_name, find_this, true);
22890 }
22891 {
22892 let to_remove = ["name"];
22893 params.remove_params(&to_remove);
22894 }
22895
22896 let url = params.parse_with_url(&url);
22897
22898 let mut json_mime_type = mime::APPLICATION_JSON;
22899 let mut request_value_reader = {
22900 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22901 common::remove_json_null_values(&mut value);
22902 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22903 serde_json::to_writer(&mut dst, &value).unwrap();
22904 dst
22905 };
22906 let request_size = request_value_reader
22907 .seek(std::io::SeekFrom::End(0))
22908 .unwrap();
22909 request_value_reader
22910 .seek(std::io::SeekFrom::Start(0))
22911 .unwrap();
22912
22913 loop {
22914 let token = match self
22915 .hub
22916 .auth
22917 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22918 .await
22919 {
22920 Ok(token) => token,
22921 Err(e) => match dlg.token(e) {
22922 Ok(token) => token,
22923 Err(e) => {
22924 dlg.finished(false);
22925 return Err(common::Error::MissingToken(e));
22926 }
22927 },
22928 };
22929 request_value_reader
22930 .seek(std::io::SeekFrom::Start(0))
22931 .unwrap();
22932 let mut req_result = {
22933 let client = &self.hub.client;
22934 dlg.pre_request();
22935 let mut req_builder = hyper::Request::builder()
22936 .method(hyper::Method::PATCH)
22937 .uri(url.as_str())
22938 .header(USER_AGENT, self.hub._user_agent.clone());
22939
22940 if let Some(token) = token.as_ref() {
22941 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22942 }
22943
22944 let request = req_builder
22945 .header(CONTENT_TYPE, json_mime_type.to_string())
22946 .header(CONTENT_LENGTH, request_size as u64)
22947 .body(common::to_body(
22948 request_value_reader.get_ref().clone().into(),
22949 ));
22950
22951 client.request(request.unwrap()).await
22952 };
22953
22954 match req_result {
22955 Err(err) => {
22956 if let common::Retry::After(d) = dlg.http_error(&err) {
22957 sleep(d).await;
22958 continue;
22959 }
22960 dlg.finished(false);
22961 return Err(common::Error::HttpError(err));
22962 }
22963 Ok(res) => {
22964 let (mut parts, body) = res.into_parts();
22965 let mut body = common::Body::new(body);
22966 if !parts.status.is_success() {
22967 let bytes = common::to_bytes(body).await.unwrap_or_default();
22968 let error = serde_json::from_str(&common::to_string(&bytes));
22969 let response = common::to_response(parts, bytes.into());
22970
22971 if let common::Retry::After(d) =
22972 dlg.http_failure(&response, error.as_ref().ok())
22973 {
22974 sleep(d).await;
22975 continue;
22976 }
22977
22978 dlg.finished(false);
22979
22980 return Err(match error {
22981 Ok(value) => common::Error::BadRequest(value),
22982 _ => common::Error::Failure(response),
22983 });
22984 }
22985 let response = {
22986 let bytes = common::to_bytes(body).await.unwrap_or_default();
22987 let encoded = common::to_string(&bytes);
22988 match serde_json::from_str(&encoded) {
22989 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22990 Err(error) => {
22991 dlg.response_json_decode_error(&encoded, &error);
22992 return Err(common::Error::JsonDecodeError(
22993 encoded.to_string(),
22994 error,
22995 ));
22996 }
22997 }
22998 };
22999
23000 dlg.finished(true);
23001 return Ok(response);
23002 }
23003 }
23004 }
23005 }
23006
23007 ///
23008 /// Sets the *request* property to the given value.
23009 ///
23010 /// Even though the property as already been set when instantiating this call,
23011 /// we provide this method for API completeness.
23012 pub fn request(
23013 mut self,
23014 new_value: GoogleCloudDatacatalogV1PolicyTag,
23015 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
23016 self._request = new_value;
23017 self
23018 }
23019 /// Identifier. Resource name of this policy tag in the URL format. The policy tag manager generates unique taxonomy IDs and policy tag IDs.
23020 ///
23021 /// Sets the *name* path property to the given value.
23022 ///
23023 /// Even though the property as already been set when instantiating this call,
23024 /// we provide this method for API completeness.
23025 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
23026 self._name = new_value.to_string();
23027 self
23028 }
23029 /// Specifies the fields to update. You can update only display name, description, and parent policy tag. If not set, defaults to all updatable fields. For more information, see [FieldMask] (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask).
23030 ///
23031 /// Sets the *update mask* query property to the given value.
23032 pub fn update_mask(
23033 mut self,
23034 new_value: common::FieldMask,
23035 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
23036 self._update_mask = Some(new_value);
23037 self
23038 }
23039 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23040 /// while executing the actual API request.
23041 ///
23042 /// ````text
23043 /// It should be used to handle progress information, and to implement a certain level of resilience.
23044 /// ````
23045 ///
23046 /// Sets the *delegate* property to the given value.
23047 pub fn delegate(
23048 mut self,
23049 new_value: &'a mut dyn common::Delegate,
23050 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
23051 self._delegate = Some(new_value);
23052 self
23053 }
23054
23055 /// Set any additional parameter of the query string used in the request.
23056 /// It should be used to set parameters which are not yet available through their own
23057 /// setters.
23058 ///
23059 /// Please note that this method must not be used to set any of the known parameters
23060 /// which have their own setter method. If done anyway, the request will fail.
23061 ///
23062 /// # Additional Parameters
23063 ///
23064 /// * *$.xgafv* (query-string) - V1 error format.
23065 /// * *access_token* (query-string) - OAuth access token.
23066 /// * *alt* (query-string) - Data format for response.
23067 /// * *callback* (query-string) - JSONP
23068 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23069 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23070 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23071 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23072 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23073 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23074 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23075 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
23076 where
23077 T: AsRef<str>,
23078 {
23079 self._additional_params
23080 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23081 self
23082 }
23083
23084 /// Identifies the authorization scope for the method you are building.
23085 ///
23086 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23087 /// [`Scope::CloudPlatform`].
23088 ///
23089 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23090 /// tokens for more than one scope.
23091 ///
23092 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23093 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23094 /// sufficient, a read-write scope will do as well.
23095 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
23096 where
23097 St: AsRef<str>,
23098 {
23099 self._scopes.insert(String::from(scope.as_ref()));
23100 self
23101 }
23102 /// Identifies the authorization scope(s) for the method you are building.
23103 ///
23104 /// See [`Self::add_scope()`] for details.
23105 pub fn add_scopes<I, St>(
23106 mut self,
23107 scopes: I,
23108 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
23109 where
23110 I: IntoIterator<Item = St>,
23111 St: AsRef<str>,
23112 {
23113 self._scopes
23114 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23115 self
23116 }
23117
23118 /// Removes all scopes, and no default scope will be used either.
23119 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23120 /// for details).
23121 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
23122 self._scopes.clear();
23123 self
23124 }
23125}
23126
23127/// Sets the IAM policy for a policy tag or a taxonomy.
23128///
23129/// A builder for the *locations.taxonomies.policyTags.setIamPolicy* method supported by a *project* resource.
23130/// It is not used directly, but through a [`ProjectMethods`] instance.
23131///
23132/// # Example
23133///
23134/// Instantiate a resource method builder
23135///
23136/// ```test_harness,no_run
23137/// # extern crate hyper;
23138/// # extern crate hyper_rustls;
23139/// # extern crate google_datacatalog1 as datacatalog1;
23140/// use datacatalog1::api::SetIamPolicyRequest;
23141/// # async fn dox() {
23142/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23143///
23144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23145/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23146/// # .with_native_roots()
23147/// # .unwrap()
23148/// # .https_only()
23149/// # .enable_http2()
23150/// # .build();
23151///
23152/// # let executor = hyper_util::rt::TokioExecutor::new();
23153/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23154/// # secret,
23155/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23156/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23157/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23158/// # ),
23159/// # ).build().await.unwrap();
23160///
23161/// # let client = hyper_util::client::legacy::Client::builder(
23162/// # hyper_util::rt::TokioExecutor::new()
23163/// # )
23164/// # .build(
23165/// # hyper_rustls::HttpsConnectorBuilder::new()
23166/// # .with_native_roots()
23167/// # .unwrap()
23168/// # .https_or_http()
23169/// # .enable_http2()
23170/// # .build()
23171/// # );
23172/// # let mut hub = DataCatalog::new(client, auth);
23173/// // As the method needs a request, you would usually fill it with the desired information
23174/// // into the respective structure. Some of the parts shown here might not be applicable !
23175/// // Values shown here are possibly random and not representative !
23176/// let mut req = SetIamPolicyRequest::default();
23177///
23178/// // You can configure optional parameters by calling the respective setters at will, and
23179/// // execute the final call using `doit()`.
23180/// // Values shown here are possibly random and not representative !
23181/// let result = hub.projects().locations_taxonomies_policy_tags_set_iam_policy(req, "resource")
23182/// .doit().await;
23183/// # }
23184/// ```
23185pub struct ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
23186where
23187 C: 'a,
23188{
23189 hub: &'a DataCatalog<C>,
23190 _request: SetIamPolicyRequest,
23191 _resource: String,
23192 _delegate: Option<&'a mut dyn common::Delegate>,
23193 _additional_params: HashMap<String, String>,
23194 _scopes: BTreeSet<String>,
23195}
23196
23197impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {}
23198
23199impl<'a, C> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
23200where
23201 C: common::Connector,
23202{
23203 /// Perform the operation you have build so far.
23204 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
23205 use std::borrow::Cow;
23206 use std::io::{Read, Seek};
23207
23208 use common::{url::Params, ToParts};
23209 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23210
23211 let mut dd = common::DefaultDelegate;
23212 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23213 dlg.begin(common::MethodInfo {
23214 id: "datacatalog.projects.locations.taxonomies.policyTags.setIamPolicy",
23215 http_method: hyper::Method::POST,
23216 });
23217
23218 for &field in ["alt", "resource"].iter() {
23219 if self._additional_params.contains_key(field) {
23220 dlg.finished(false);
23221 return Err(common::Error::FieldClash(field));
23222 }
23223 }
23224
23225 let mut params = Params::with_capacity(4 + self._additional_params.len());
23226 params.push("resource", self._resource);
23227
23228 params.extend(self._additional_params.iter());
23229
23230 params.push("alt", "json");
23231 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
23232 if self._scopes.is_empty() {
23233 self._scopes
23234 .insert(Scope::CloudPlatform.as_ref().to_string());
23235 }
23236
23237 #[allow(clippy::single_element_loop)]
23238 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23239 url = params.uri_replacement(url, param_name, find_this, true);
23240 }
23241 {
23242 let to_remove = ["resource"];
23243 params.remove_params(&to_remove);
23244 }
23245
23246 let url = params.parse_with_url(&url);
23247
23248 let mut json_mime_type = mime::APPLICATION_JSON;
23249 let mut request_value_reader = {
23250 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23251 common::remove_json_null_values(&mut value);
23252 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23253 serde_json::to_writer(&mut dst, &value).unwrap();
23254 dst
23255 };
23256 let request_size = request_value_reader
23257 .seek(std::io::SeekFrom::End(0))
23258 .unwrap();
23259 request_value_reader
23260 .seek(std::io::SeekFrom::Start(0))
23261 .unwrap();
23262
23263 loop {
23264 let token = match self
23265 .hub
23266 .auth
23267 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23268 .await
23269 {
23270 Ok(token) => token,
23271 Err(e) => match dlg.token(e) {
23272 Ok(token) => token,
23273 Err(e) => {
23274 dlg.finished(false);
23275 return Err(common::Error::MissingToken(e));
23276 }
23277 },
23278 };
23279 request_value_reader
23280 .seek(std::io::SeekFrom::Start(0))
23281 .unwrap();
23282 let mut req_result = {
23283 let client = &self.hub.client;
23284 dlg.pre_request();
23285 let mut req_builder = hyper::Request::builder()
23286 .method(hyper::Method::POST)
23287 .uri(url.as_str())
23288 .header(USER_AGENT, self.hub._user_agent.clone());
23289
23290 if let Some(token) = token.as_ref() {
23291 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23292 }
23293
23294 let request = req_builder
23295 .header(CONTENT_TYPE, json_mime_type.to_string())
23296 .header(CONTENT_LENGTH, request_size as u64)
23297 .body(common::to_body(
23298 request_value_reader.get_ref().clone().into(),
23299 ));
23300
23301 client.request(request.unwrap()).await
23302 };
23303
23304 match req_result {
23305 Err(err) => {
23306 if let common::Retry::After(d) = dlg.http_error(&err) {
23307 sleep(d).await;
23308 continue;
23309 }
23310 dlg.finished(false);
23311 return Err(common::Error::HttpError(err));
23312 }
23313 Ok(res) => {
23314 let (mut parts, body) = res.into_parts();
23315 let mut body = common::Body::new(body);
23316 if !parts.status.is_success() {
23317 let bytes = common::to_bytes(body).await.unwrap_or_default();
23318 let error = serde_json::from_str(&common::to_string(&bytes));
23319 let response = common::to_response(parts, bytes.into());
23320
23321 if let common::Retry::After(d) =
23322 dlg.http_failure(&response, error.as_ref().ok())
23323 {
23324 sleep(d).await;
23325 continue;
23326 }
23327
23328 dlg.finished(false);
23329
23330 return Err(match error {
23331 Ok(value) => common::Error::BadRequest(value),
23332 _ => common::Error::Failure(response),
23333 });
23334 }
23335 let response = {
23336 let bytes = common::to_bytes(body).await.unwrap_or_default();
23337 let encoded = common::to_string(&bytes);
23338 match serde_json::from_str(&encoded) {
23339 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23340 Err(error) => {
23341 dlg.response_json_decode_error(&encoded, &error);
23342 return Err(common::Error::JsonDecodeError(
23343 encoded.to_string(),
23344 error,
23345 ));
23346 }
23347 }
23348 };
23349
23350 dlg.finished(true);
23351 return Ok(response);
23352 }
23353 }
23354 }
23355 }
23356
23357 ///
23358 /// Sets the *request* property to the given value.
23359 ///
23360 /// Even though the property as already been set when instantiating this call,
23361 /// we provide this method for API completeness.
23362 pub fn request(
23363 mut self,
23364 new_value: SetIamPolicyRequest,
23365 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
23366 self._request = new_value;
23367 self
23368 }
23369 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
23370 ///
23371 /// Sets the *resource* path property to the given value.
23372 ///
23373 /// Even though the property as already been set when instantiating this call,
23374 /// we provide this method for API completeness.
23375 pub fn resource(
23376 mut self,
23377 new_value: &str,
23378 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
23379 self._resource = new_value.to_string();
23380 self
23381 }
23382 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23383 /// while executing the actual API request.
23384 ///
23385 /// ````text
23386 /// It should be used to handle progress information, and to implement a certain level of resilience.
23387 /// ````
23388 ///
23389 /// Sets the *delegate* property to the given value.
23390 pub fn delegate(
23391 mut self,
23392 new_value: &'a mut dyn common::Delegate,
23393 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
23394 self._delegate = Some(new_value);
23395 self
23396 }
23397
23398 /// Set any additional parameter of the query string used in the request.
23399 /// It should be used to set parameters which are not yet available through their own
23400 /// setters.
23401 ///
23402 /// Please note that this method must not be used to set any of the known parameters
23403 /// which have their own setter method. If done anyway, the request will fail.
23404 ///
23405 /// # Additional Parameters
23406 ///
23407 /// * *$.xgafv* (query-string) - V1 error format.
23408 /// * *access_token* (query-string) - OAuth access token.
23409 /// * *alt* (query-string) - Data format for response.
23410 /// * *callback* (query-string) - JSONP
23411 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23412 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23413 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23414 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23415 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23416 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23417 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23418 pub fn param<T>(
23419 mut self,
23420 name: T,
23421 value: T,
23422 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
23423 where
23424 T: AsRef<str>,
23425 {
23426 self._additional_params
23427 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23428 self
23429 }
23430
23431 /// Identifies the authorization scope for the method you are building.
23432 ///
23433 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23434 /// [`Scope::CloudPlatform`].
23435 ///
23436 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23437 /// tokens for more than one scope.
23438 ///
23439 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23440 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23441 /// sufficient, a read-write scope will do as well.
23442 pub fn add_scope<St>(
23443 mut self,
23444 scope: St,
23445 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
23446 where
23447 St: AsRef<str>,
23448 {
23449 self._scopes.insert(String::from(scope.as_ref()));
23450 self
23451 }
23452 /// Identifies the authorization scope(s) for the method you are building.
23453 ///
23454 /// See [`Self::add_scope()`] for details.
23455 pub fn add_scopes<I, St>(
23456 mut self,
23457 scopes: I,
23458 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
23459 where
23460 I: IntoIterator<Item = St>,
23461 St: AsRef<str>,
23462 {
23463 self._scopes
23464 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23465 self
23466 }
23467
23468 /// Removes all scopes, and no default scope will be used either.
23469 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23470 /// for details).
23471 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
23472 self._scopes.clear();
23473 self
23474 }
23475}
23476
23477/// Returns your permissions on a specified policy tag or taxonomy.
23478///
23479/// A builder for the *locations.taxonomies.policyTags.testIamPermissions* method supported by a *project* resource.
23480/// It is not used directly, but through a [`ProjectMethods`] instance.
23481///
23482/// # Example
23483///
23484/// Instantiate a resource method builder
23485///
23486/// ```test_harness,no_run
23487/// # extern crate hyper;
23488/// # extern crate hyper_rustls;
23489/// # extern crate google_datacatalog1 as datacatalog1;
23490/// use datacatalog1::api::TestIamPermissionsRequest;
23491/// # async fn dox() {
23492/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23493///
23494/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23495/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23496/// # .with_native_roots()
23497/// # .unwrap()
23498/// # .https_only()
23499/// # .enable_http2()
23500/// # .build();
23501///
23502/// # let executor = hyper_util::rt::TokioExecutor::new();
23503/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23504/// # secret,
23505/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23506/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23507/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23508/// # ),
23509/// # ).build().await.unwrap();
23510///
23511/// # let client = hyper_util::client::legacy::Client::builder(
23512/// # hyper_util::rt::TokioExecutor::new()
23513/// # )
23514/// # .build(
23515/// # hyper_rustls::HttpsConnectorBuilder::new()
23516/// # .with_native_roots()
23517/// # .unwrap()
23518/// # .https_or_http()
23519/// # .enable_http2()
23520/// # .build()
23521/// # );
23522/// # let mut hub = DataCatalog::new(client, auth);
23523/// // As the method needs a request, you would usually fill it with the desired information
23524/// // into the respective structure. Some of the parts shown here might not be applicable !
23525/// // Values shown here are possibly random and not representative !
23526/// let mut req = TestIamPermissionsRequest::default();
23527///
23528/// // You can configure optional parameters by calling the respective setters at will, and
23529/// // execute the final call using `doit()`.
23530/// // Values shown here are possibly random and not representative !
23531/// let result = hub.projects().locations_taxonomies_policy_tags_test_iam_permissions(req, "resource")
23532/// .doit().await;
23533/// # }
23534/// ```
23535pub struct ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
23536where
23537 C: 'a,
23538{
23539 hub: &'a DataCatalog<C>,
23540 _request: TestIamPermissionsRequest,
23541 _resource: String,
23542 _delegate: Option<&'a mut dyn common::Delegate>,
23543 _additional_params: HashMap<String, String>,
23544 _scopes: BTreeSet<String>,
23545}
23546
23547impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {}
23548
23549impl<'a, C> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
23550where
23551 C: common::Connector,
23552{
23553 /// Perform the operation you have build so far.
23554 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
23555 use std::borrow::Cow;
23556 use std::io::{Read, Seek};
23557
23558 use common::{url::Params, ToParts};
23559 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23560
23561 let mut dd = common::DefaultDelegate;
23562 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23563 dlg.begin(common::MethodInfo {
23564 id: "datacatalog.projects.locations.taxonomies.policyTags.testIamPermissions",
23565 http_method: hyper::Method::POST,
23566 });
23567
23568 for &field in ["alt", "resource"].iter() {
23569 if self._additional_params.contains_key(field) {
23570 dlg.finished(false);
23571 return Err(common::Error::FieldClash(field));
23572 }
23573 }
23574
23575 let mut params = Params::with_capacity(4 + self._additional_params.len());
23576 params.push("resource", self._resource);
23577
23578 params.extend(self._additional_params.iter());
23579
23580 params.push("alt", "json");
23581 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
23582 if self._scopes.is_empty() {
23583 self._scopes
23584 .insert(Scope::CloudPlatform.as_ref().to_string());
23585 }
23586
23587 #[allow(clippy::single_element_loop)]
23588 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23589 url = params.uri_replacement(url, param_name, find_this, true);
23590 }
23591 {
23592 let to_remove = ["resource"];
23593 params.remove_params(&to_remove);
23594 }
23595
23596 let url = params.parse_with_url(&url);
23597
23598 let mut json_mime_type = mime::APPLICATION_JSON;
23599 let mut request_value_reader = {
23600 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23601 common::remove_json_null_values(&mut value);
23602 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23603 serde_json::to_writer(&mut dst, &value).unwrap();
23604 dst
23605 };
23606 let request_size = request_value_reader
23607 .seek(std::io::SeekFrom::End(0))
23608 .unwrap();
23609 request_value_reader
23610 .seek(std::io::SeekFrom::Start(0))
23611 .unwrap();
23612
23613 loop {
23614 let token = match self
23615 .hub
23616 .auth
23617 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23618 .await
23619 {
23620 Ok(token) => token,
23621 Err(e) => match dlg.token(e) {
23622 Ok(token) => token,
23623 Err(e) => {
23624 dlg.finished(false);
23625 return Err(common::Error::MissingToken(e));
23626 }
23627 },
23628 };
23629 request_value_reader
23630 .seek(std::io::SeekFrom::Start(0))
23631 .unwrap();
23632 let mut req_result = {
23633 let client = &self.hub.client;
23634 dlg.pre_request();
23635 let mut req_builder = hyper::Request::builder()
23636 .method(hyper::Method::POST)
23637 .uri(url.as_str())
23638 .header(USER_AGENT, self.hub._user_agent.clone());
23639
23640 if let Some(token) = token.as_ref() {
23641 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23642 }
23643
23644 let request = req_builder
23645 .header(CONTENT_TYPE, json_mime_type.to_string())
23646 .header(CONTENT_LENGTH, request_size as u64)
23647 .body(common::to_body(
23648 request_value_reader.get_ref().clone().into(),
23649 ));
23650
23651 client.request(request.unwrap()).await
23652 };
23653
23654 match req_result {
23655 Err(err) => {
23656 if let common::Retry::After(d) = dlg.http_error(&err) {
23657 sleep(d).await;
23658 continue;
23659 }
23660 dlg.finished(false);
23661 return Err(common::Error::HttpError(err));
23662 }
23663 Ok(res) => {
23664 let (mut parts, body) = res.into_parts();
23665 let mut body = common::Body::new(body);
23666 if !parts.status.is_success() {
23667 let bytes = common::to_bytes(body).await.unwrap_or_default();
23668 let error = serde_json::from_str(&common::to_string(&bytes));
23669 let response = common::to_response(parts, bytes.into());
23670
23671 if let common::Retry::After(d) =
23672 dlg.http_failure(&response, error.as_ref().ok())
23673 {
23674 sleep(d).await;
23675 continue;
23676 }
23677
23678 dlg.finished(false);
23679
23680 return Err(match error {
23681 Ok(value) => common::Error::BadRequest(value),
23682 _ => common::Error::Failure(response),
23683 });
23684 }
23685 let response = {
23686 let bytes = common::to_bytes(body).await.unwrap_or_default();
23687 let encoded = common::to_string(&bytes);
23688 match serde_json::from_str(&encoded) {
23689 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23690 Err(error) => {
23691 dlg.response_json_decode_error(&encoded, &error);
23692 return Err(common::Error::JsonDecodeError(
23693 encoded.to_string(),
23694 error,
23695 ));
23696 }
23697 }
23698 };
23699
23700 dlg.finished(true);
23701 return Ok(response);
23702 }
23703 }
23704 }
23705 }
23706
23707 ///
23708 /// Sets the *request* property to the given value.
23709 ///
23710 /// Even though the property as already been set when instantiating this call,
23711 /// we provide this method for API completeness.
23712 pub fn request(
23713 mut self,
23714 new_value: TestIamPermissionsRequest,
23715 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
23716 self._request = new_value;
23717 self
23718 }
23719 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
23720 ///
23721 /// Sets the *resource* path property to the given value.
23722 ///
23723 /// Even though the property as already been set when instantiating this call,
23724 /// we provide this method for API completeness.
23725 pub fn resource(
23726 mut self,
23727 new_value: &str,
23728 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
23729 self._resource = new_value.to_string();
23730 self
23731 }
23732 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23733 /// while executing the actual API request.
23734 ///
23735 /// ````text
23736 /// It should be used to handle progress information, and to implement a certain level of resilience.
23737 /// ````
23738 ///
23739 /// Sets the *delegate* property to the given value.
23740 pub fn delegate(
23741 mut self,
23742 new_value: &'a mut dyn common::Delegate,
23743 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
23744 self._delegate = Some(new_value);
23745 self
23746 }
23747
23748 /// Set any additional parameter of the query string used in the request.
23749 /// It should be used to set parameters which are not yet available through their own
23750 /// setters.
23751 ///
23752 /// Please note that this method must not be used to set any of the known parameters
23753 /// which have their own setter method. If done anyway, the request will fail.
23754 ///
23755 /// # Additional Parameters
23756 ///
23757 /// * *$.xgafv* (query-string) - V1 error format.
23758 /// * *access_token* (query-string) - OAuth access token.
23759 /// * *alt* (query-string) - Data format for response.
23760 /// * *callback* (query-string) - JSONP
23761 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23762 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23763 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23764 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23765 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23766 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23767 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23768 pub fn param<T>(
23769 mut self,
23770 name: T,
23771 value: T,
23772 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
23773 where
23774 T: AsRef<str>,
23775 {
23776 self._additional_params
23777 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23778 self
23779 }
23780
23781 /// Identifies the authorization scope for the method you are building.
23782 ///
23783 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23784 /// [`Scope::CloudPlatform`].
23785 ///
23786 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23787 /// tokens for more than one scope.
23788 ///
23789 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23790 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23791 /// sufficient, a read-write scope will do as well.
23792 pub fn add_scope<St>(
23793 mut self,
23794 scope: St,
23795 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
23796 where
23797 St: AsRef<str>,
23798 {
23799 self._scopes.insert(String::from(scope.as_ref()));
23800 self
23801 }
23802 /// Identifies the authorization scope(s) for the method you are building.
23803 ///
23804 /// See [`Self::add_scope()`] for details.
23805 pub fn add_scopes<I, St>(
23806 mut self,
23807 scopes: I,
23808 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
23809 where
23810 I: IntoIterator<Item = St>,
23811 St: AsRef<str>,
23812 {
23813 self._scopes
23814 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23815 self
23816 }
23817
23818 /// Removes all scopes, and no default scope will be used either.
23819 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23820 /// for details).
23821 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
23822 self._scopes.clear();
23823 self
23824 }
23825}
23826
23827/// Creates a taxonomy in a specified project. The taxonomy is initially empty, that is, it doesn't contain policy tags.
23828///
23829/// A builder for the *locations.taxonomies.create* method supported by a *project* resource.
23830/// It is not used directly, but through a [`ProjectMethods`] instance.
23831///
23832/// # Example
23833///
23834/// Instantiate a resource method builder
23835///
23836/// ```test_harness,no_run
23837/// # extern crate hyper;
23838/// # extern crate hyper_rustls;
23839/// # extern crate google_datacatalog1 as datacatalog1;
23840/// use datacatalog1::api::GoogleCloudDatacatalogV1Taxonomy;
23841/// # async fn dox() {
23842/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23843///
23844/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23845/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23846/// # .with_native_roots()
23847/// # .unwrap()
23848/// # .https_only()
23849/// # .enable_http2()
23850/// # .build();
23851///
23852/// # let executor = hyper_util::rt::TokioExecutor::new();
23853/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23854/// # secret,
23855/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23856/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23857/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23858/// # ),
23859/// # ).build().await.unwrap();
23860///
23861/// # let client = hyper_util::client::legacy::Client::builder(
23862/// # hyper_util::rt::TokioExecutor::new()
23863/// # )
23864/// # .build(
23865/// # hyper_rustls::HttpsConnectorBuilder::new()
23866/// # .with_native_roots()
23867/// # .unwrap()
23868/// # .https_or_http()
23869/// # .enable_http2()
23870/// # .build()
23871/// # );
23872/// # let mut hub = DataCatalog::new(client, auth);
23873/// // As the method needs a request, you would usually fill it with the desired information
23874/// // into the respective structure. Some of the parts shown here might not be applicable !
23875/// // Values shown here are possibly random and not representative !
23876/// let mut req = GoogleCloudDatacatalogV1Taxonomy::default();
23877///
23878/// // You can configure optional parameters by calling the respective setters at will, and
23879/// // execute the final call using `doit()`.
23880/// // Values shown here are possibly random and not representative !
23881/// let result = hub.projects().locations_taxonomies_create(req, "parent")
23882/// .doit().await;
23883/// # }
23884/// ```
23885pub struct ProjectLocationTaxonomyCreateCall<'a, C>
23886where
23887 C: 'a,
23888{
23889 hub: &'a DataCatalog<C>,
23890 _request: GoogleCloudDatacatalogV1Taxonomy,
23891 _parent: String,
23892 _delegate: Option<&'a mut dyn common::Delegate>,
23893 _additional_params: HashMap<String, String>,
23894 _scopes: BTreeSet<String>,
23895}
23896
23897impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyCreateCall<'a, C> {}
23898
23899impl<'a, C> ProjectLocationTaxonomyCreateCall<'a, C>
23900where
23901 C: common::Connector,
23902{
23903 /// Perform the operation you have build so far.
23904 pub async fn doit(
23905 mut self,
23906 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Taxonomy)> {
23907 use std::borrow::Cow;
23908 use std::io::{Read, Seek};
23909
23910 use common::{url::Params, ToParts};
23911 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23912
23913 let mut dd = common::DefaultDelegate;
23914 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23915 dlg.begin(common::MethodInfo {
23916 id: "datacatalog.projects.locations.taxonomies.create",
23917 http_method: hyper::Method::POST,
23918 });
23919
23920 for &field in ["alt", "parent"].iter() {
23921 if self._additional_params.contains_key(field) {
23922 dlg.finished(false);
23923 return Err(common::Error::FieldClash(field));
23924 }
23925 }
23926
23927 let mut params = Params::with_capacity(4 + self._additional_params.len());
23928 params.push("parent", self._parent);
23929
23930 params.extend(self._additional_params.iter());
23931
23932 params.push("alt", "json");
23933 let mut url = self.hub._base_url.clone() + "v1/{+parent}/taxonomies";
23934 if self._scopes.is_empty() {
23935 self._scopes
23936 .insert(Scope::CloudPlatform.as_ref().to_string());
23937 }
23938
23939 #[allow(clippy::single_element_loop)]
23940 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23941 url = params.uri_replacement(url, param_name, find_this, true);
23942 }
23943 {
23944 let to_remove = ["parent"];
23945 params.remove_params(&to_remove);
23946 }
23947
23948 let url = params.parse_with_url(&url);
23949
23950 let mut json_mime_type = mime::APPLICATION_JSON;
23951 let mut request_value_reader = {
23952 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23953 common::remove_json_null_values(&mut value);
23954 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23955 serde_json::to_writer(&mut dst, &value).unwrap();
23956 dst
23957 };
23958 let request_size = request_value_reader
23959 .seek(std::io::SeekFrom::End(0))
23960 .unwrap();
23961 request_value_reader
23962 .seek(std::io::SeekFrom::Start(0))
23963 .unwrap();
23964
23965 loop {
23966 let token = match self
23967 .hub
23968 .auth
23969 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23970 .await
23971 {
23972 Ok(token) => token,
23973 Err(e) => match dlg.token(e) {
23974 Ok(token) => token,
23975 Err(e) => {
23976 dlg.finished(false);
23977 return Err(common::Error::MissingToken(e));
23978 }
23979 },
23980 };
23981 request_value_reader
23982 .seek(std::io::SeekFrom::Start(0))
23983 .unwrap();
23984 let mut req_result = {
23985 let client = &self.hub.client;
23986 dlg.pre_request();
23987 let mut req_builder = hyper::Request::builder()
23988 .method(hyper::Method::POST)
23989 .uri(url.as_str())
23990 .header(USER_AGENT, self.hub._user_agent.clone());
23991
23992 if let Some(token) = token.as_ref() {
23993 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23994 }
23995
23996 let request = req_builder
23997 .header(CONTENT_TYPE, json_mime_type.to_string())
23998 .header(CONTENT_LENGTH, request_size as u64)
23999 .body(common::to_body(
24000 request_value_reader.get_ref().clone().into(),
24001 ));
24002
24003 client.request(request.unwrap()).await
24004 };
24005
24006 match req_result {
24007 Err(err) => {
24008 if let common::Retry::After(d) = dlg.http_error(&err) {
24009 sleep(d).await;
24010 continue;
24011 }
24012 dlg.finished(false);
24013 return Err(common::Error::HttpError(err));
24014 }
24015 Ok(res) => {
24016 let (mut parts, body) = res.into_parts();
24017 let mut body = common::Body::new(body);
24018 if !parts.status.is_success() {
24019 let bytes = common::to_bytes(body).await.unwrap_or_default();
24020 let error = serde_json::from_str(&common::to_string(&bytes));
24021 let response = common::to_response(parts, bytes.into());
24022
24023 if let common::Retry::After(d) =
24024 dlg.http_failure(&response, error.as_ref().ok())
24025 {
24026 sleep(d).await;
24027 continue;
24028 }
24029
24030 dlg.finished(false);
24031
24032 return Err(match error {
24033 Ok(value) => common::Error::BadRequest(value),
24034 _ => common::Error::Failure(response),
24035 });
24036 }
24037 let response = {
24038 let bytes = common::to_bytes(body).await.unwrap_or_default();
24039 let encoded = common::to_string(&bytes);
24040 match serde_json::from_str(&encoded) {
24041 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24042 Err(error) => {
24043 dlg.response_json_decode_error(&encoded, &error);
24044 return Err(common::Error::JsonDecodeError(
24045 encoded.to_string(),
24046 error,
24047 ));
24048 }
24049 }
24050 };
24051
24052 dlg.finished(true);
24053 return Ok(response);
24054 }
24055 }
24056 }
24057 }
24058
24059 ///
24060 /// Sets the *request* property to the given value.
24061 ///
24062 /// Even though the property as already been set when instantiating this call,
24063 /// we provide this method for API completeness.
24064 pub fn request(
24065 mut self,
24066 new_value: GoogleCloudDatacatalogV1Taxonomy,
24067 ) -> ProjectLocationTaxonomyCreateCall<'a, C> {
24068 self._request = new_value;
24069 self
24070 }
24071 /// Required. Resource name of the project that the taxonomy will belong to.
24072 ///
24073 /// Sets the *parent* path property to the given value.
24074 ///
24075 /// Even though the property as already been set when instantiating this call,
24076 /// we provide this method for API completeness.
24077 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyCreateCall<'a, C> {
24078 self._parent = new_value.to_string();
24079 self
24080 }
24081 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24082 /// while executing the actual API request.
24083 ///
24084 /// ````text
24085 /// It should be used to handle progress information, and to implement a certain level of resilience.
24086 /// ````
24087 ///
24088 /// Sets the *delegate* property to the given value.
24089 pub fn delegate(
24090 mut self,
24091 new_value: &'a mut dyn common::Delegate,
24092 ) -> ProjectLocationTaxonomyCreateCall<'a, C> {
24093 self._delegate = Some(new_value);
24094 self
24095 }
24096
24097 /// Set any additional parameter of the query string used in the request.
24098 /// It should be used to set parameters which are not yet available through their own
24099 /// setters.
24100 ///
24101 /// Please note that this method must not be used to set any of the known parameters
24102 /// which have their own setter method. If done anyway, the request will fail.
24103 ///
24104 /// # Additional Parameters
24105 ///
24106 /// * *$.xgafv* (query-string) - V1 error format.
24107 /// * *access_token* (query-string) - OAuth access token.
24108 /// * *alt* (query-string) - Data format for response.
24109 /// * *callback* (query-string) - JSONP
24110 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24111 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24112 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24113 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24114 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24115 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24116 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24117 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyCreateCall<'a, C>
24118 where
24119 T: AsRef<str>,
24120 {
24121 self._additional_params
24122 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24123 self
24124 }
24125
24126 /// Identifies the authorization scope for the method you are building.
24127 ///
24128 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24129 /// [`Scope::CloudPlatform`].
24130 ///
24131 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24132 /// tokens for more than one scope.
24133 ///
24134 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24135 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24136 /// sufficient, a read-write scope will do as well.
24137 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyCreateCall<'a, C>
24138 where
24139 St: AsRef<str>,
24140 {
24141 self._scopes.insert(String::from(scope.as_ref()));
24142 self
24143 }
24144 /// Identifies the authorization scope(s) for the method you are building.
24145 ///
24146 /// See [`Self::add_scope()`] for details.
24147 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyCreateCall<'a, C>
24148 where
24149 I: IntoIterator<Item = St>,
24150 St: AsRef<str>,
24151 {
24152 self._scopes
24153 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24154 self
24155 }
24156
24157 /// Removes all scopes, and no default scope will be used either.
24158 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24159 /// for details).
24160 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyCreateCall<'a, C> {
24161 self._scopes.clear();
24162 self
24163 }
24164}
24165
24166/// Deletes a taxonomy, including all policy tags in this taxonomy, their associated policies, and the policy tags references from BigQuery columns.
24167///
24168/// A builder for the *locations.taxonomies.delete* method supported by a *project* resource.
24169/// It is not used directly, but through a [`ProjectMethods`] instance.
24170///
24171/// # Example
24172///
24173/// Instantiate a resource method builder
24174///
24175/// ```test_harness,no_run
24176/// # extern crate hyper;
24177/// # extern crate hyper_rustls;
24178/// # extern crate google_datacatalog1 as datacatalog1;
24179/// # async fn dox() {
24180/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24181///
24182/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24183/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24184/// # .with_native_roots()
24185/// # .unwrap()
24186/// # .https_only()
24187/// # .enable_http2()
24188/// # .build();
24189///
24190/// # let executor = hyper_util::rt::TokioExecutor::new();
24191/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24192/// # secret,
24193/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24194/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24195/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24196/// # ),
24197/// # ).build().await.unwrap();
24198///
24199/// # let client = hyper_util::client::legacy::Client::builder(
24200/// # hyper_util::rt::TokioExecutor::new()
24201/// # )
24202/// # .build(
24203/// # hyper_rustls::HttpsConnectorBuilder::new()
24204/// # .with_native_roots()
24205/// # .unwrap()
24206/// # .https_or_http()
24207/// # .enable_http2()
24208/// # .build()
24209/// # );
24210/// # let mut hub = DataCatalog::new(client, auth);
24211/// // You can configure optional parameters by calling the respective setters at will, and
24212/// // execute the final call using `doit()`.
24213/// // Values shown here are possibly random and not representative !
24214/// let result = hub.projects().locations_taxonomies_delete("name")
24215/// .doit().await;
24216/// # }
24217/// ```
24218pub struct ProjectLocationTaxonomyDeleteCall<'a, C>
24219where
24220 C: 'a,
24221{
24222 hub: &'a DataCatalog<C>,
24223 _name: String,
24224 _delegate: Option<&'a mut dyn common::Delegate>,
24225 _additional_params: HashMap<String, String>,
24226 _scopes: BTreeSet<String>,
24227}
24228
24229impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyDeleteCall<'a, C> {}
24230
24231impl<'a, C> ProjectLocationTaxonomyDeleteCall<'a, C>
24232where
24233 C: common::Connector,
24234{
24235 /// Perform the operation you have build so far.
24236 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
24237 use std::borrow::Cow;
24238 use std::io::{Read, Seek};
24239
24240 use common::{url::Params, ToParts};
24241 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24242
24243 let mut dd = common::DefaultDelegate;
24244 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24245 dlg.begin(common::MethodInfo {
24246 id: "datacatalog.projects.locations.taxonomies.delete",
24247 http_method: hyper::Method::DELETE,
24248 });
24249
24250 for &field in ["alt", "name"].iter() {
24251 if self._additional_params.contains_key(field) {
24252 dlg.finished(false);
24253 return Err(common::Error::FieldClash(field));
24254 }
24255 }
24256
24257 let mut params = Params::with_capacity(3 + self._additional_params.len());
24258 params.push("name", self._name);
24259
24260 params.extend(self._additional_params.iter());
24261
24262 params.push("alt", "json");
24263 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24264 if self._scopes.is_empty() {
24265 self._scopes
24266 .insert(Scope::CloudPlatform.as_ref().to_string());
24267 }
24268
24269 #[allow(clippy::single_element_loop)]
24270 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24271 url = params.uri_replacement(url, param_name, find_this, true);
24272 }
24273 {
24274 let to_remove = ["name"];
24275 params.remove_params(&to_remove);
24276 }
24277
24278 let url = params.parse_with_url(&url);
24279
24280 loop {
24281 let token = match self
24282 .hub
24283 .auth
24284 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24285 .await
24286 {
24287 Ok(token) => token,
24288 Err(e) => match dlg.token(e) {
24289 Ok(token) => token,
24290 Err(e) => {
24291 dlg.finished(false);
24292 return Err(common::Error::MissingToken(e));
24293 }
24294 },
24295 };
24296 let mut req_result = {
24297 let client = &self.hub.client;
24298 dlg.pre_request();
24299 let mut req_builder = hyper::Request::builder()
24300 .method(hyper::Method::DELETE)
24301 .uri(url.as_str())
24302 .header(USER_AGENT, self.hub._user_agent.clone());
24303
24304 if let Some(token) = token.as_ref() {
24305 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24306 }
24307
24308 let request = req_builder
24309 .header(CONTENT_LENGTH, 0_u64)
24310 .body(common::to_body::<String>(None));
24311
24312 client.request(request.unwrap()).await
24313 };
24314
24315 match req_result {
24316 Err(err) => {
24317 if let common::Retry::After(d) = dlg.http_error(&err) {
24318 sleep(d).await;
24319 continue;
24320 }
24321 dlg.finished(false);
24322 return Err(common::Error::HttpError(err));
24323 }
24324 Ok(res) => {
24325 let (mut parts, body) = res.into_parts();
24326 let mut body = common::Body::new(body);
24327 if !parts.status.is_success() {
24328 let bytes = common::to_bytes(body).await.unwrap_or_default();
24329 let error = serde_json::from_str(&common::to_string(&bytes));
24330 let response = common::to_response(parts, bytes.into());
24331
24332 if let common::Retry::After(d) =
24333 dlg.http_failure(&response, error.as_ref().ok())
24334 {
24335 sleep(d).await;
24336 continue;
24337 }
24338
24339 dlg.finished(false);
24340
24341 return Err(match error {
24342 Ok(value) => common::Error::BadRequest(value),
24343 _ => common::Error::Failure(response),
24344 });
24345 }
24346 let response = {
24347 let bytes = common::to_bytes(body).await.unwrap_or_default();
24348 let encoded = common::to_string(&bytes);
24349 match serde_json::from_str(&encoded) {
24350 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24351 Err(error) => {
24352 dlg.response_json_decode_error(&encoded, &error);
24353 return Err(common::Error::JsonDecodeError(
24354 encoded.to_string(),
24355 error,
24356 ));
24357 }
24358 }
24359 };
24360
24361 dlg.finished(true);
24362 return Ok(response);
24363 }
24364 }
24365 }
24366 }
24367
24368 /// Required. Resource name of the taxonomy to delete. Note: All policy tags in this taxonomy are also deleted.
24369 ///
24370 /// Sets the *name* path property to the given value.
24371 ///
24372 /// Even though the property as already been set when instantiating this call,
24373 /// we provide this method for API completeness.
24374 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
24375 self._name = new_value.to_string();
24376 self
24377 }
24378 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24379 /// while executing the actual API request.
24380 ///
24381 /// ````text
24382 /// It should be used to handle progress information, and to implement a certain level of resilience.
24383 /// ````
24384 ///
24385 /// Sets the *delegate* property to the given value.
24386 pub fn delegate(
24387 mut self,
24388 new_value: &'a mut dyn common::Delegate,
24389 ) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
24390 self._delegate = Some(new_value);
24391 self
24392 }
24393
24394 /// Set any additional parameter of the query string used in the request.
24395 /// It should be used to set parameters which are not yet available through their own
24396 /// setters.
24397 ///
24398 /// Please note that this method must not be used to set any of the known parameters
24399 /// which have their own setter method. If done anyway, the request will fail.
24400 ///
24401 /// # Additional Parameters
24402 ///
24403 /// * *$.xgafv* (query-string) - V1 error format.
24404 /// * *access_token* (query-string) - OAuth access token.
24405 /// * *alt* (query-string) - Data format for response.
24406 /// * *callback* (query-string) - JSONP
24407 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24408 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24409 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24410 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24411 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24412 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24413 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24414 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyDeleteCall<'a, C>
24415 where
24416 T: AsRef<str>,
24417 {
24418 self._additional_params
24419 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24420 self
24421 }
24422
24423 /// Identifies the authorization scope for the method you are building.
24424 ///
24425 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24426 /// [`Scope::CloudPlatform`].
24427 ///
24428 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24429 /// tokens for more than one scope.
24430 ///
24431 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24432 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24433 /// sufficient, a read-write scope will do as well.
24434 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyDeleteCall<'a, C>
24435 where
24436 St: AsRef<str>,
24437 {
24438 self._scopes.insert(String::from(scope.as_ref()));
24439 self
24440 }
24441 /// Identifies the authorization scope(s) for the method you are building.
24442 ///
24443 /// See [`Self::add_scope()`] for details.
24444 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyDeleteCall<'a, C>
24445 where
24446 I: IntoIterator<Item = St>,
24447 St: AsRef<str>,
24448 {
24449 self._scopes
24450 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24451 self
24452 }
24453
24454 /// Removes all scopes, and no default scope will be used either.
24455 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24456 /// for details).
24457 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
24458 self._scopes.clear();
24459 self
24460 }
24461}
24462
24463/// Exports taxonomies in the requested type and returns them, including their policy tags. The requested taxonomies must belong to the same project. This method generates `SerializedTaxonomy` protocol buffers with nested policy tags that can be used as input for `ImportTaxonomies` calls.
24464///
24465/// A builder for the *locations.taxonomies.export* method supported by a *project* resource.
24466/// It is not used directly, but through a [`ProjectMethods`] instance.
24467///
24468/// # Example
24469///
24470/// Instantiate a resource method builder
24471///
24472/// ```test_harness,no_run
24473/// # extern crate hyper;
24474/// # extern crate hyper_rustls;
24475/// # extern crate google_datacatalog1 as datacatalog1;
24476/// # async fn dox() {
24477/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24478///
24479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24480/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24481/// # .with_native_roots()
24482/// # .unwrap()
24483/// # .https_only()
24484/// # .enable_http2()
24485/// # .build();
24486///
24487/// # let executor = hyper_util::rt::TokioExecutor::new();
24488/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24489/// # secret,
24490/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24491/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24492/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24493/// # ),
24494/// # ).build().await.unwrap();
24495///
24496/// # let client = hyper_util::client::legacy::Client::builder(
24497/// # hyper_util::rt::TokioExecutor::new()
24498/// # )
24499/// # .build(
24500/// # hyper_rustls::HttpsConnectorBuilder::new()
24501/// # .with_native_roots()
24502/// # .unwrap()
24503/// # .https_or_http()
24504/// # .enable_http2()
24505/// # .build()
24506/// # );
24507/// # let mut hub = DataCatalog::new(client, auth);
24508/// // You can configure optional parameters by calling the respective setters at will, and
24509/// // execute the final call using `doit()`.
24510/// // Values shown here are possibly random and not representative !
24511/// let result = hub.projects().locations_taxonomies_export("parent")
24512/// .add_taxonomies("invidunt")
24513/// .serialized_taxonomies(true)
24514/// .doit().await;
24515/// # }
24516/// ```
24517pub struct ProjectLocationTaxonomyExportCall<'a, C>
24518where
24519 C: 'a,
24520{
24521 hub: &'a DataCatalog<C>,
24522 _parent: String,
24523 _taxonomies: Vec<String>,
24524 _serialized_taxonomies: Option<bool>,
24525 _delegate: Option<&'a mut dyn common::Delegate>,
24526 _additional_params: HashMap<String, String>,
24527 _scopes: BTreeSet<String>,
24528}
24529
24530impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyExportCall<'a, C> {}
24531
24532impl<'a, C> ProjectLocationTaxonomyExportCall<'a, C>
24533where
24534 C: common::Connector,
24535{
24536 /// Perform the operation you have build so far.
24537 pub async fn doit(
24538 mut self,
24539 ) -> common::Result<(
24540 common::Response,
24541 GoogleCloudDatacatalogV1ExportTaxonomiesResponse,
24542 )> {
24543 use std::borrow::Cow;
24544 use std::io::{Read, Seek};
24545
24546 use common::{url::Params, ToParts};
24547 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24548
24549 let mut dd = common::DefaultDelegate;
24550 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24551 dlg.begin(common::MethodInfo {
24552 id: "datacatalog.projects.locations.taxonomies.export",
24553 http_method: hyper::Method::GET,
24554 });
24555
24556 for &field in ["alt", "parent", "taxonomies", "serializedTaxonomies"].iter() {
24557 if self._additional_params.contains_key(field) {
24558 dlg.finished(false);
24559 return Err(common::Error::FieldClash(field));
24560 }
24561 }
24562
24563 let mut params = Params::with_capacity(5 + self._additional_params.len());
24564 params.push("parent", self._parent);
24565 if !self._taxonomies.is_empty() {
24566 for f in self._taxonomies.iter() {
24567 params.push("taxonomies", f);
24568 }
24569 }
24570 if let Some(value) = self._serialized_taxonomies.as_ref() {
24571 params.push("serializedTaxonomies", value.to_string());
24572 }
24573
24574 params.extend(self._additional_params.iter());
24575
24576 params.push("alt", "json");
24577 let mut url = self.hub._base_url.clone() + "v1/{+parent}/taxonomies:export";
24578 if self._scopes.is_empty() {
24579 self._scopes
24580 .insert(Scope::CloudPlatform.as_ref().to_string());
24581 }
24582
24583 #[allow(clippy::single_element_loop)]
24584 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24585 url = params.uri_replacement(url, param_name, find_this, true);
24586 }
24587 {
24588 let to_remove = ["parent"];
24589 params.remove_params(&to_remove);
24590 }
24591
24592 let url = params.parse_with_url(&url);
24593
24594 loop {
24595 let token = match self
24596 .hub
24597 .auth
24598 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24599 .await
24600 {
24601 Ok(token) => token,
24602 Err(e) => match dlg.token(e) {
24603 Ok(token) => token,
24604 Err(e) => {
24605 dlg.finished(false);
24606 return Err(common::Error::MissingToken(e));
24607 }
24608 },
24609 };
24610 let mut req_result = {
24611 let client = &self.hub.client;
24612 dlg.pre_request();
24613 let mut req_builder = hyper::Request::builder()
24614 .method(hyper::Method::GET)
24615 .uri(url.as_str())
24616 .header(USER_AGENT, self.hub._user_agent.clone());
24617
24618 if let Some(token) = token.as_ref() {
24619 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24620 }
24621
24622 let request = req_builder
24623 .header(CONTENT_LENGTH, 0_u64)
24624 .body(common::to_body::<String>(None));
24625
24626 client.request(request.unwrap()).await
24627 };
24628
24629 match req_result {
24630 Err(err) => {
24631 if let common::Retry::After(d) = dlg.http_error(&err) {
24632 sleep(d).await;
24633 continue;
24634 }
24635 dlg.finished(false);
24636 return Err(common::Error::HttpError(err));
24637 }
24638 Ok(res) => {
24639 let (mut parts, body) = res.into_parts();
24640 let mut body = common::Body::new(body);
24641 if !parts.status.is_success() {
24642 let bytes = common::to_bytes(body).await.unwrap_or_default();
24643 let error = serde_json::from_str(&common::to_string(&bytes));
24644 let response = common::to_response(parts, bytes.into());
24645
24646 if let common::Retry::After(d) =
24647 dlg.http_failure(&response, error.as_ref().ok())
24648 {
24649 sleep(d).await;
24650 continue;
24651 }
24652
24653 dlg.finished(false);
24654
24655 return Err(match error {
24656 Ok(value) => common::Error::BadRequest(value),
24657 _ => common::Error::Failure(response),
24658 });
24659 }
24660 let response = {
24661 let bytes = common::to_bytes(body).await.unwrap_or_default();
24662 let encoded = common::to_string(&bytes);
24663 match serde_json::from_str(&encoded) {
24664 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24665 Err(error) => {
24666 dlg.response_json_decode_error(&encoded, &error);
24667 return Err(common::Error::JsonDecodeError(
24668 encoded.to_string(),
24669 error,
24670 ));
24671 }
24672 }
24673 };
24674
24675 dlg.finished(true);
24676 return Ok(response);
24677 }
24678 }
24679 }
24680 }
24681
24682 /// Required. Resource name of the project that the exported taxonomies belong to.
24683 ///
24684 /// Sets the *parent* path property to the given value.
24685 ///
24686 /// Even though the property as already been set when instantiating this call,
24687 /// we provide this method for API completeness.
24688 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyExportCall<'a, C> {
24689 self._parent = new_value.to_string();
24690 self
24691 }
24692 /// Required. Resource names of the taxonomies to export.
24693 ///
24694 /// Append the given value to the *taxonomies* query property.
24695 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
24696 pub fn add_taxonomies(mut self, new_value: &str) -> ProjectLocationTaxonomyExportCall<'a, C> {
24697 self._taxonomies.push(new_value.to_string());
24698 self
24699 }
24700 /// Serialized export taxonomies that contain all the policy tags as nested protocol buffers.
24701 ///
24702 /// Sets the *serialized taxonomies* query property to the given value.
24703 pub fn serialized_taxonomies(
24704 mut self,
24705 new_value: bool,
24706 ) -> ProjectLocationTaxonomyExportCall<'a, C> {
24707 self._serialized_taxonomies = Some(new_value);
24708 self
24709 }
24710 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24711 /// while executing the actual API request.
24712 ///
24713 /// ````text
24714 /// It should be used to handle progress information, and to implement a certain level of resilience.
24715 /// ````
24716 ///
24717 /// Sets the *delegate* property to the given value.
24718 pub fn delegate(
24719 mut self,
24720 new_value: &'a mut dyn common::Delegate,
24721 ) -> ProjectLocationTaxonomyExportCall<'a, C> {
24722 self._delegate = Some(new_value);
24723 self
24724 }
24725
24726 /// Set any additional parameter of the query string used in the request.
24727 /// It should be used to set parameters which are not yet available through their own
24728 /// setters.
24729 ///
24730 /// Please note that this method must not be used to set any of the known parameters
24731 /// which have their own setter method. If done anyway, the request will fail.
24732 ///
24733 /// # Additional Parameters
24734 ///
24735 /// * *$.xgafv* (query-string) - V1 error format.
24736 /// * *access_token* (query-string) - OAuth access token.
24737 /// * *alt* (query-string) - Data format for response.
24738 /// * *callback* (query-string) - JSONP
24739 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24740 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24741 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24742 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24743 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24744 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24745 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24746 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyExportCall<'a, C>
24747 where
24748 T: AsRef<str>,
24749 {
24750 self._additional_params
24751 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24752 self
24753 }
24754
24755 /// Identifies the authorization scope for the method you are building.
24756 ///
24757 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24758 /// [`Scope::CloudPlatform`].
24759 ///
24760 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24761 /// tokens for more than one scope.
24762 ///
24763 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24764 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24765 /// sufficient, a read-write scope will do as well.
24766 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyExportCall<'a, C>
24767 where
24768 St: AsRef<str>,
24769 {
24770 self._scopes.insert(String::from(scope.as_ref()));
24771 self
24772 }
24773 /// Identifies the authorization scope(s) for the method you are building.
24774 ///
24775 /// See [`Self::add_scope()`] for details.
24776 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyExportCall<'a, C>
24777 where
24778 I: IntoIterator<Item = St>,
24779 St: AsRef<str>,
24780 {
24781 self._scopes
24782 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24783 self
24784 }
24785
24786 /// Removes all scopes, and no default scope will be used either.
24787 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24788 /// for details).
24789 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyExportCall<'a, C> {
24790 self._scopes.clear();
24791 self
24792 }
24793}
24794
24795/// Gets a taxonomy.
24796///
24797/// A builder for the *locations.taxonomies.get* method supported by a *project* resource.
24798/// It is not used directly, but through a [`ProjectMethods`] instance.
24799///
24800/// # Example
24801///
24802/// Instantiate a resource method builder
24803///
24804/// ```test_harness,no_run
24805/// # extern crate hyper;
24806/// # extern crate hyper_rustls;
24807/// # extern crate google_datacatalog1 as datacatalog1;
24808/// # async fn dox() {
24809/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24810///
24811/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24812/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24813/// # .with_native_roots()
24814/// # .unwrap()
24815/// # .https_only()
24816/// # .enable_http2()
24817/// # .build();
24818///
24819/// # let executor = hyper_util::rt::TokioExecutor::new();
24820/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24821/// # secret,
24822/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24823/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24824/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24825/// # ),
24826/// # ).build().await.unwrap();
24827///
24828/// # let client = hyper_util::client::legacy::Client::builder(
24829/// # hyper_util::rt::TokioExecutor::new()
24830/// # )
24831/// # .build(
24832/// # hyper_rustls::HttpsConnectorBuilder::new()
24833/// # .with_native_roots()
24834/// # .unwrap()
24835/// # .https_or_http()
24836/// # .enable_http2()
24837/// # .build()
24838/// # );
24839/// # let mut hub = DataCatalog::new(client, auth);
24840/// // You can configure optional parameters by calling the respective setters at will, and
24841/// // execute the final call using `doit()`.
24842/// // Values shown here are possibly random and not representative !
24843/// let result = hub.projects().locations_taxonomies_get("name")
24844/// .doit().await;
24845/// # }
24846/// ```
24847pub struct ProjectLocationTaxonomyGetCall<'a, C>
24848where
24849 C: 'a,
24850{
24851 hub: &'a DataCatalog<C>,
24852 _name: String,
24853 _delegate: Option<&'a mut dyn common::Delegate>,
24854 _additional_params: HashMap<String, String>,
24855 _scopes: BTreeSet<String>,
24856}
24857
24858impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyGetCall<'a, C> {}
24859
24860impl<'a, C> ProjectLocationTaxonomyGetCall<'a, C>
24861where
24862 C: common::Connector,
24863{
24864 /// Perform the operation you have build so far.
24865 pub async fn doit(
24866 mut self,
24867 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Taxonomy)> {
24868 use std::borrow::Cow;
24869 use std::io::{Read, Seek};
24870
24871 use common::{url::Params, ToParts};
24872 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24873
24874 let mut dd = common::DefaultDelegate;
24875 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24876 dlg.begin(common::MethodInfo {
24877 id: "datacatalog.projects.locations.taxonomies.get",
24878 http_method: hyper::Method::GET,
24879 });
24880
24881 for &field in ["alt", "name"].iter() {
24882 if self._additional_params.contains_key(field) {
24883 dlg.finished(false);
24884 return Err(common::Error::FieldClash(field));
24885 }
24886 }
24887
24888 let mut params = Params::with_capacity(3 + self._additional_params.len());
24889 params.push("name", self._name);
24890
24891 params.extend(self._additional_params.iter());
24892
24893 params.push("alt", "json");
24894 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24895 if self._scopes.is_empty() {
24896 self._scopes
24897 .insert(Scope::CloudPlatform.as_ref().to_string());
24898 }
24899
24900 #[allow(clippy::single_element_loop)]
24901 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24902 url = params.uri_replacement(url, param_name, find_this, true);
24903 }
24904 {
24905 let to_remove = ["name"];
24906 params.remove_params(&to_remove);
24907 }
24908
24909 let url = params.parse_with_url(&url);
24910
24911 loop {
24912 let token = match self
24913 .hub
24914 .auth
24915 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24916 .await
24917 {
24918 Ok(token) => token,
24919 Err(e) => match dlg.token(e) {
24920 Ok(token) => token,
24921 Err(e) => {
24922 dlg.finished(false);
24923 return Err(common::Error::MissingToken(e));
24924 }
24925 },
24926 };
24927 let mut req_result = {
24928 let client = &self.hub.client;
24929 dlg.pre_request();
24930 let mut req_builder = hyper::Request::builder()
24931 .method(hyper::Method::GET)
24932 .uri(url.as_str())
24933 .header(USER_AGENT, self.hub._user_agent.clone());
24934
24935 if let Some(token) = token.as_ref() {
24936 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24937 }
24938
24939 let request = req_builder
24940 .header(CONTENT_LENGTH, 0_u64)
24941 .body(common::to_body::<String>(None));
24942
24943 client.request(request.unwrap()).await
24944 };
24945
24946 match req_result {
24947 Err(err) => {
24948 if let common::Retry::After(d) = dlg.http_error(&err) {
24949 sleep(d).await;
24950 continue;
24951 }
24952 dlg.finished(false);
24953 return Err(common::Error::HttpError(err));
24954 }
24955 Ok(res) => {
24956 let (mut parts, body) = res.into_parts();
24957 let mut body = common::Body::new(body);
24958 if !parts.status.is_success() {
24959 let bytes = common::to_bytes(body).await.unwrap_or_default();
24960 let error = serde_json::from_str(&common::to_string(&bytes));
24961 let response = common::to_response(parts, bytes.into());
24962
24963 if let common::Retry::After(d) =
24964 dlg.http_failure(&response, error.as_ref().ok())
24965 {
24966 sleep(d).await;
24967 continue;
24968 }
24969
24970 dlg.finished(false);
24971
24972 return Err(match error {
24973 Ok(value) => common::Error::BadRequest(value),
24974 _ => common::Error::Failure(response),
24975 });
24976 }
24977 let response = {
24978 let bytes = common::to_bytes(body).await.unwrap_or_default();
24979 let encoded = common::to_string(&bytes);
24980 match serde_json::from_str(&encoded) {
24981 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24982 Err(error) => {
24983 dlg.response_json_decode_error(&encoded, &error);
24984 return Err(common::Error::JsonDecodeError(
24985 encoded.to_string(),
24986 error,
24987 ));
24988 }
24989 }
24990 };
24991
24992 dlg.finished(true);
24993 return Ok(response);
24994 }
24995 }
24996 }
24997 }
24998
24999 /// Required. Resource name of the taxonomy to get.
25000 ///
25001 /// Sets the *name* path property to the given value.
25002 ///
25003 /// Even though the property as already been set when instantiating this call,
25004 /// we provide this method for API completeness.
25005 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyGetCall<'a, C> {
25006 self._name = new_value.to_string();
25007 self
25008 }
25009 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25010 /// while executing the actual API request.
25011 ///
25012 /// ````text
25013 /// It should be used to handle progress information, and to implement a certain level of resilience.
25014 /// ````
25015 ///
25016 /// Sets the *delegate* property to the given value.
25017 pub fn delegate(
25018 mut self,
25019 new_value: &'a mut dyn common::Delegate,
25020 ) -> ProjectLocationTaxonomyGetCall<'a, C> {
25021 self._delegate = Some(new_value);
25022 self
25023 }
25024
25025 /// Set any additional parameter of the query string used in the request.
25026 /// It should be used to set parameters which are not yet available through their own
25027 /// setters.
25028 ///
25029 /// Please note that this method must not be used to set any of the known parameters
25030 /// which have their own setter method. If done anyway, the request will fail.
25031 ///
25032 /// # Additional Parameters
25033 ///
25034 /// * *$.xgafv* (query-string) - V1 error format.
25035 /// * *access_token* (query-string) - OAuth access token.
25036 /// * *alt* (query-string) - Data format for response.
25037 /// * *callback* (query-string) - JSONP
25038 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25039 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25040 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25041 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25042 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25043 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25044 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25045 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyGetCall<'a, C>
25046 where
25047 T: AsRef<str>,
25048 {
25049 self._additional_params
25050 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25051 self
25052 }
25053
25054 /// Identifies the authorization scope for the method you are building.
25055 ///
25056 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25057 /// [`Scope::CloudPlatform`].
25058 ///
25059 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25060 /// tokens for more than one scope.
25061 ///
25062 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25063 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25064 /// sufficient, a read-write scope will do as well.
25065 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyGetCall<'a, C>
25066 where
25067 St: AsRef<str>,
25068 {
25069 self._scopes.insert(String::from(scope.as_ref()));
25070 self
25071 }
25072 /// Identifies the authorization scope(s) for the method you are building.
25073 ///
25074 /// See [`Self::add_scope()`] for details.
25075 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyGetCall<'a, C>
25076 where
25077 I: IntoIterator<Item = St>,
25078 St: AsRef<str>,
25079 {
25080 self._scopes
25081 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25082 self
25083 }
25084
25085 /// Removes all scopes, and no default scope will be used either.
25086 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25087 /// for details).
25088 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyGetCall<'a, C> {
25089 self._scopes.clear();
25090 self
25091 }
25092}
25093
25094/// Gets the IAM policy for a policy tag or a taxonomy.
25095///
25096/// A builder for the *locations.taxonomies.getIamPolicy* method supported by a *project* resource.
25097/// It is not used directly, but through a [`ProjectMethods`] instance.
25098///
25099/// # Example
25100///
25101/// Instantiate a resource method builder
25102///
25103/// ```test_harness,no_run
25104/// # extern crate hyper;
25105/// # extern crate hyper_rustls;
25106/// # extern crate google_datacatalog1 as datacatalog1;
25107/// use datacatalog1::api::GetIamPolicyRequest;
25108/// # async fn dox() {
25109/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25110///
25111/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25112/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25113/// # .with_native_roots()
25114/// # .unwrap()
25115/// # .https_only()
25116/// # .enable_http2()
25117/// # .build();
25118///
25119/// # let executor = hyper_util::rt::TokioExecutor::new();
25120/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25121/// # secret,
25122/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25123/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25124/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25125/// # ),
25126/// # ).build().await.unwrap();
25127///
25128/// # let client = hyper_util::client::legacy::Client::builder(
25129/// # hyper_util::rt::TokioExecutor::new()
25130/// # )
25131/// # .build(
25132/// # hyper_rustls::HttpsConnectorBuilder::new()
25133/// # .with_native_roots()
25134/// # .unwrap()
25135/// # .https_or_http()
25136/// # .enable_http2()
25137/// # .build()
25138/// # );
25139/// # let mut hub = DataCatalog::new(client, auth);
25140/// // As the method needs a request, you would usually fill it with the desired information
25141/// // into the respective structure. Some of the parts shown here might not be applicable !
25142/// // Values shown here are possibly random and not representative !
25143/// let mut req = GetIamPolicyRequest::default();
25144///
25145/// // You can configure optional parameters by calling the respective setters at will, and
25146/// // execute the final call using `doit()`.
25147/// // Values shown here are possibly random and not representative !
25148/// let result = hub.projects().locations_taxonomies_get_iam_policy(req, "resource")
25149/// .doit().await;
25150/// # }
25151/// ```
25152pub struct ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
25153where
25154 C: 'a,
25155{
25156 hub: &'a DataCatalog<C>,
25157 _request: GetIamPolicyRequest,
25158 _resource: String,
25159 _delegate: Option<&'a mut dyn common::Delegate>,
25160 _additional_params: HashMap<String, String>,
25161 _scopes: BTreeSet<String>,
25162}
25163
25164impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {}
25165
25166impl<'a, C> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
25167where
25168 C: common::Connector,
25169{
25170 /// Perform the operation you have build so far.
25171 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
25172 use std::borrow::Cow;
25173 use std::io::{Read, Seek};
25174
25175 use common::{url::Params, ToParts};
25176 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25177
25178 let mut dd = common::DefaultDelegate;
25179 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25180 dlg.begin(common::MethodInfo {
25181 id: "datacatalog.projects.locations.taxonomies.getIamPolicy",
25182 http_method: hyper::Method::POST,
25183 });
25184
25185 for &field in ["alt", "resource"].iter() {
25186 if self._additional_params.contains_key(field) {
25187 dlg.finished(false);
25188 return Err(common::Error::FieldClash(field));
25189 }
25190 }
25191
25192 let mut params = Params::with_capacity(4 + self._additional_params.len());
25193 params.push("resource", self._resource);
25194
25195 params.extend(self._additional_params.iter());
25196
25197 params.push("alt", "json");
25198 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
25199 if self._scopes.is_empty() {
25200 self._scopes
25201 .insert(Scope::CloudPlatform.as_ref().to_string());
25202 }
25203
25204 #[allow(clippy::single_element_loop)]
25205 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25206 url = params.uri_replacement(url, param_name, find_this, true);
25207 }
25208 {
25209 let to_remove = ["resource"];
25210 params.remove_params(&to_remove);
25211 }
25212
25213 let url = params.parse_with_url(&url);
25214
25215 let mut json_mime_type = mime::APPLICATION_JSON;
25216 let mut request_value_reader = {
25217 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25218 common::remove_json_null_values(&mut value);
25219 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25220 serde_json::to_writer(&mut dst, &value).unwrap();
25221 dst
25222 };
25223 let request_size = request_value_reader
25224 .seek(std::io::SeekFrom::End(0))
25225 .unwrap();
25226 request_value_reader
25227 .seek(std::io::SeekFrom::Start(0))
25228 .unwrap();
25229
25230 loop {
25231 let token = match self
25232 .hub
25233 .auth
25234 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25235 .await
25236 {
25237 Ok(token) => token,
25238 Err(e) => match dlg.token(e) {
25239 Ok(token) => token,
25240 Err(e) => {
25241 dlg.finished(false);
25242 return Err(common::Error::MissingToken(e));
25243 }
25244 },
25245 };
25246 request_value_reader
25247 .seek(std::io::SeekFrom::Start(0))
25248 .unwrap();
25249 let mut req_result = {
25250 let client = &self.hub.client;
25251 dlg.pre_request();
25252 let mut req_builder = hyper::Request::builder()
25253 .method(hyper::Method::POST)
25254 .uri(url.as_str())
25255 .header(USER_AGENT, self.hub._user_agent.clone());
25256
25257 if let Some(token) = token.as_ref() {
25258 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25259 }
25260
25261 let request = req_builder
25262 .header(CONTENT_TYPE, json_mime_type.to_string())
25263 .header(CONTENT_LENGTH, request_size as u64)
25264 .body(common::to_body(
25265 request_value_reader.get_ref().clone().into(),
25266 ));
25267
25268 client.request(request.unwrap()).await
25269 };
25270
25271 match req_result {
25272 Err(err) => {
25273 if let common::Retry::After(d) = dlg.http_error(&err) {
25274 sleep(d).await;
25275 continue;
25276 }
25277 dlg.finished(false);
25278 return Err(common::Error::HttpError(err));
25279 }
25280 Ok(res) => {
25281 let (mut parts, body) = res.into_parts();
25282 let mut body = common::Body::new(body);
25283 if !parts.status.is_success() {
25284 let bytes = common::to_bytes(body).await.unwrap_or_default();
25285 let error = serde_json::from_str(&common::to_string(&bytes));
25286 let response = common::to_response(parts, bytes.into());
25287
25288 if let common::Retry::After(d) =
25289 dlg.http_failure(&response, error.as_ref().ok())
25290 {
25291 sleep(d).await;
25292 continue;
25293 }
25294
25295 dlg.finished(false);
25296
25297 return Err(match error {
25298 Ok(value) => common::Error::BadRequest(value),
25299 _ => common::Error::Failure(response),
25300 });
25301 }
25302 let response = {
25303 let bytes = common::to_bytes(body).await.unwrap_or_default();
25304 let encoded = common::to_string(&bytes);
25305 match serde_json::from_str(&encoded) {
25306 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25307 Err(error) => {
25308 dlg.response_json_decode_error(&encoded, &error);
25309 return Err(common::Error::JsonDecodeError(
25310 encoded.to_string(),
25311 error,
25312 ));
25313 }
25314 }
25315 };
25316
25317 dlg.finished(true);
25318 return Ok(response);
25319 }
25320 }
25321 }
25322 }
25323
25324 ///
25325 /// Sets the *request* property to the given value.
25326 ///
25327 /// Even though the property as already been set when instantiating this call,
25328 /// we provide this method for API completeness.
25329 pub fn request(
25330 mut self,
25331 new_value: GetIamPolicyRequest,
25332 ) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
25333 self._request = new_value;
25334 self
25335 }
25336 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
25337 ///
25338 /// Sets the *resource* path property to the given value.
25339 ///
25340 /// Even though the property as already been set when instantiating this call,
25341 /// we provide this method for API completeness.
25342 pub fn resource(mut self, new_value: &str) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
25343 self._resource = new_value.to_string();
25344 self
25345 }
25346 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25347 /// while executing the actual API request.
25348 ///
25349 /// ````text
25350 /// It should be used to handle progress information, and to implement a certain level of resilience.
25351 /// ````
25352 ///
25353 /// Sets the *delegate* property to the given value.
25354 pub fn delegate(
25355 mut self,
25356 new_value: &'a mut dyn common::Delegate,
25357 ) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
25358 self._delegate = Some(new_value);
25359 self
25360 }
25361
25362 /// Set any additional parameter of the query string used in the request.
25363 /// It should be used to set parameters which are not yet available through their own
25364 /// setters.
25365 ///
25366 /// Please note that this method must not be used to set any of the known parameters
25367 /// which have their own setter method. If done anyway, the request will fail.
25368 ///
25369 /// # Additional Parameters
25370 ///
25371 /// * *$.xgafv* (query-string) - V1 error format.
25372 /// * *access_token* (query-string) - OAuth access token.
25373 /// * *alt* (query-string) - Data format for response.
25374 /// * *callback* (query-string) - JSONP
25375 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25376 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25377 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25378 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25379 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25380 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25381 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25382 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
25383 where
25384 T: AsRef<str>,
25385 {
25386 self._additional_params
25387 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25388 self
25389 }
25390
25391 /// Identifies the authorization scope for the method you are building.
25392 ///
25393 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25394 /// [`Scope::CloudPlatform`].
25395 ///
25396 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25397 /// tokens for more than one scope.
25398 ///
25399 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25400 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25401 /// sufficient, a read-write scope will do as well.
25402 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
25403 where
25404 St: AsRef<str>,
25405 {
25406 self._scopes.insert(String::from(scope.as_ref()));
25407 self
25408 }
25409 /// Identifies the authorization scope(s) for the method you are building.
25410 ///
25411 /// See [`Self::add_scope()`] for details.
25412 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
25413 where
25414 I: IntoIterator<Item = St>,
25415 St: AsRef<str>,
25416 {
25417 self._scopes
25418 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25419 self
25420 }
25421
25422 /// Removes all scopes, and no default scope will be used either.
25423 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25424 /// for details).
25425 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
25426 self._scopes.clear();
25427 self
25428 }
25429}
25430
25431/// Creates new taxonomies (including their policy tags) in a given project by importing from inlined or cross-regional sources. For a cross-regional source, new taxonomies are created by copying from a source in another region. For an inlined source, taxonomies and policy tags are created in bulk using nested protocol buffer structures.
25432///
25433/// A builder for the *locations.taxonomies.import* method supported by a *project* resource.
25434/// It is not used directly, but through a [`ProjectMethods`] instance.
25435///
25436/// # Example
25437///
25438/// Instantiate a resource method builder
25439///
25440/// ```test_harness,no_run
25441/// # extern crate hyper;
25442/// # extern crate hyper_rustls;
25443/// # extern crate google_datacatalog1 as datacatalog1;
25444/// use datacatalog1::api::GoogleCloudDatacatalogV1ImportTaxonomiesRequest;
25445/// # async fn dox() {
25446/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25447///
25448/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25449/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25450/// # .with_native_roots()
25451/// # .unwrap()
25452/// # .https_only()
25453/// # .enable_http2()
25454/// # .build();
25455///
25456/// # let executor = hyper_util::rt::TokioExecutor::new();
25457/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25458/// # secret,
25459/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25460/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25461/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25462/// # ),
25463/// # ).build().await.unwrap();
25464///
25465/// # let client = hyper_util::client::legacy::Client::builder(
25466/// # hyper_util::rt::TokioExecutor::new()
25467/// # )
25468/// # .build(
25469/// # hyper_rustls::HttpsConnectorBuilder::new()
25470/// # .with_native_roots()
25471/// # .unwrap()
25472/// # .https_or_http()
25473/// # .enable_http2()
25474/// # .build()
25475/// # );
25476/// # let mut hub = DataCatalog::new(client, auth);
25477/// // As the method needs a request, you would usually fill it with the desired information
25478/// // into the respective structure. Some of the parts shown here might not be applicable !
25479/// // Values shown here are possibly random and not representative !
25480/// let mut req = GoogleCloudDatacatalogV1ImportTaxonomiesRequest::default();
25481///
25482/// // You can configure optional parameters by calling the respective setters at will, and
25483/// // execute the final call using `doit()`.
25484/// // Values shown here are possibly random and not representative !
25485/// let result = hub.projects().locations_taxonomies_import(req, "parent")
25486/// .doit().await;
25487/// # }
25488/// ```
25489pub struct ProjectLocationTaxonomyImportCall<'a, C>
25490where
25491 C: 'a,
25492{
25493 hub: &'a DataCatalog<C>,
25494 _request: GoogleCloudDatacatalogV1ImportTaxonomiesRequest,
25495 _parent: String,
25496 _delegate: Option<&'a mut dyn common::Delegate>,
25497 _additional_params: HashMap<String, String>,
25498 _scopes: BTreeSet<String>,
25499}
25500
25501impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyImportCall<'a, C> {}
25502
25503impl<'a, C> ProjectLocationTaxonomyImportCall<'a, C>
25504where
25505 C: common::Connector,
25506{
25507 /// Perform the operation you have build so far.
25508 pub async fn doit(
25509 mut self,
25510 ) -> common::Result<(
25511 common::Response,
25512 GoogleCloudDatacatalogV1ImportTaxonomiesResponse,
25513 )> {
25514 use std::borrow::Cow;
25515 use std::io::{Read, Seek};
25516
25517 use common::{url::Params, ToParts};
25518 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25519
25520 let mut dd = common::DefaultDelegate;
25521 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25522 dlg.begin(common::MethodInfo {
25523 id: "datacatalog.projects.locations.taxonomies.import",
25524 http_method: hyper::Method::POST,
25525 });
25526
25527 for &field in ["alt", "parent"].iter() {
25528 if self._additional_params.contains_key(field) {
25529 dlg.finished(false);
25530 return Err(common::Error::FieldClash(field));
25531 }
25532 }
25533
25534 let mut params = Params::with_capacity(4 + self._additional_params.len());
25535 params.push("parent", self._parent);
25536
25537 params.extend(self._additional_params.iter());
25538
25539 params.push("alt", "json");
25540 let mut url = self.hub._base_url.clone() + "v1/{+parent}/taxonomies:import";
25541 if self._scopes.is_empty() {
25542 self._scopes
25543 .insert(Scope::CloudPlatform.as_ref().to_string());
25544 }
25545
25546 #[allow(clippy::single_element_loop)]
25547 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25548 url = params.uri_replacement(url, param_name, find_this, true);
25549 }
25550 {
25551 let to_remove = ["parent"];
25552 params.remove_params(&to_remove);
25553 }
25554
25555 let url = params.parse_with_url(&url);
25556
25557 let mut json_mime_type = mime::APPLICATION_JSON;
25558 let mut request_value_reader = {
25559 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25560 common::remove_json_null_values(&mut value);
25561 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25562 serde_json::to_writer(&mut dst, &value).unwrap();
25563 dst
25564 };
25565 let request_size = request_value_reader
25566 .seek(std::io::SeekFrom::End(0))
25567 .unwrap();
25568 request_value_reader
25569 .seek(std::io::SeekFrom::Start(0))
25570 .unwrap();
25571
25572 loop {
25573 let token = match self
25574 .hub
25575 .auth
25576 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25577 .await
25578 {
25579 Ok(token) => token,
25580 Err(e) => match dlg.token(e) {
25581 Ok(token) => token,
25582 Err(e) => {
25583 dlg.finished(false);
25584 return Err(common::Error::MissingToken(e));
25585 }
25586 },
25587 };
25588 request_value_reader
25589 .seek(std::io::SeekFrom::Start(0))
25590 .unwrap();
25591 let mut req_result = {
25592 let client = &self.hub.client;
25593 dlg.pre_request();
25594 let mut req_builder = hyper::Request::builder()
25595 .method(hyper::Method::POST)
25596 .uri(url.as_str())
25597 .header(USER_AGENT, self.hub._user_agent.clone());
25598
25599 if let Some(token) = token.as_ref() {
25600 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25601 }
25602
25603 let request = req_builder
25604 .header(CONTENT_TYPE, json_mime_type.to_string())
25605 .header(CONTENT_LENGTH, request_size as u64)
25606 .body(common::to_body(
25607 request_value_reader.get_ref().clone().into(),
25608 ));
25609
25610 client.request(request.unwrap()).await
25611 };
25612
25613 match req_result {
25614 Err(err) => {
25615 if let common::Retry::After(d) = dlg.http_error(&err) {
25616 sleep(d).await;
25617 continue;
25618 }
25619 dlg.finished(false);
25620 return Err(common::Error::HttpError(err));
25621 }
25622 Ok(res) => {
25623 let (mut parts, body) = res.into_parts();
25624 let mut body = common::Body::new(body);
25625 if !parts.status.is_success() {
25626 let bytes = common::to_bytes(body).await.unwrap_or_default();
25627 let error = serde_json::from_str(&common::to_string(&bytes));
25628 let response = common::to_response(parts, bytes.into());
25629
25630 if let common::Retry::After(d) =
25631 dlg.http_failure(&response, error.as_ref().ok())
25632 {
25633 sleep(d).await;
25634 continue;
25635 }
25636
25637 dlg.finished(false);
25638
25639 return Err(match error {
25640 Ok(value) => common::Error::BadRequest(value),
25641 _ => common::Error::Failure(response),
25642 });
25643 }
25644 let response = {
25645 let bytes = common::to_bytes(body).await.unwrap_or_default();
25646 let encoded = common::to_string(&bytes);
25647 match serde_json::from_str(&encoded) {
25648 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25649 Err(error) => {
25650 dlg.response_json_decode_error(&encoded, &error);
25651 return Err(common::Error::JsonDecodeError(
25652 encoded.to_string(),
25653 error,
25654 ));
25655 }
25656 }
25657 };
25658
25659 dlg.finished(true);
25660 return Ok(response);
25661 }
25662 }
25663 }
25664 }
25665
25666 ///
25667 /// Sets the *request* property to the given value.
25668 ///
25669 /// Even though the property as already been set when instantiating this call,
25670 /// we provide this method for API completeness.
25671 pub fn request(
25672 mut self,
25673 new_value: GoogleCloudDatacatalogV1ImportTaxonomiesRequest,
25674 ) -> ProjectLocationTaxonomyImportCall<'a, C> {
25675 self._request = new_value;
25676 self
25677 }
25678 /// Required. Resource name of project that the imported taxonomies will belong to.
25679 ///
25680 /// Sets the *parent* path property to the given value.
25681 ///
25682 /// Even though the property as already been set when instantiating this call,
25683 /// we provide this method for API completeness.
25684 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyImportCall<'a, C> {
25685 self._parent = new_value.to_string();
25686 self
25687 }
25688 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25689 /// while executing the actual API request.
25690 ///
25691 /// ````text
25692 /// It should be used to handle progress information, and to implement a certain level of resilience.
25693 /// ````
25694 ///
25695 /// Sets the *delegate* property to the given value.
25696 pub fn delegate(
25697 mut self,
25698 new_value: &'a mut dyn common::Delegate,
25699 ) -> ProjectLocationTaxonomyImportCall<'a, C> {
25700 self._delegate = Some(new_value);
25701 self
25702 }
25703
25704 /// Set any additional parameter of the query string used in the request.
25705 /// It should be used to set parameters which are not yet available through their own
25706 /// setters.
25707 ///
25708 /// Please note that this method must not be used to set any of the known parameters
25709 /// which have their own setter method. If done anyway, the request will fail.
25710 ///
25711 /// # Additional Parameters
25712 ///
25713 /// * *$.xgafv* (query-string) - V1 error format.
25714 /// * *access_token* (query-string) - OAuth access token.
25715 /// * *alt* (query-string) - Data format for response.
25716 /// * *callback* (query-string) - JSONP
25717 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25718 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25719 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25720 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25721 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25722 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25723 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25724 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyImportCall<'a, C>
25725 where
25726 T: AsRef<str>,
25727 {
25728 self._additional_params
25729 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25730 self
25731 }
25732
25733 /// Identifies the authorization scope for the method you are building.
25734 ///
25735 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25736 /// [`Scope::CloudPlatform`].
25737 ///
25738 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25739 /// tokens for more than one scope.
25740 ///
25741 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25742 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25743 /// sufficient, a read-write scope will do as well.
25744 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyImportCall<'a, C>
25745 where
25746 St: AsRef<str>,
25747 {
25748 self._scopes.insert(String::from(scope.as_ref()));
25749 self
25750 }
25751 /// Identifies the authorization scope(s) for the method you are building.
25752 ///
25753 /// See [`Self::add_scope()`] for details.
25754 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyImportCall<'a, C>
25755 where
25756 I: IntoIterator<Item = St>,
25757 St: AsRef<str>,
25758 {
25759 self._scopes
25760 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25761 self
25762 }
25763
25764 /// Removes all scopes, and no default scope will be used either.
25765 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25766 /// for details).
25767 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyImportCall<'a, C> {
25768 self._scopes.clear();
25769 self
25770 }
25771}
25772
25773/// Lists all taxonomies in a project in a particular location that you have a permission to view.
25774///
25775/// A builder for the *locations.taxonomies.list* method supported by a *project* resource.
25776/// It is not used directly, but through a [`ProjectMethods`] instance.
25777///
25778/// # Example
25779///
25780/// Instantiate a resource method builder
25781///
25782/// ```test_harness,no_run
25783/// # extern crate hyper;
25784/// # extern crate hyper_rustls;
25785/// # extern crate google_datacatalog1 as datacatalog1;
25786/// # async fn dox() {
25787/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25788///
25789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25790/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25791/// # .with_native_roots()
25792/// # .unwrap()
25793/// # .https_only()
25794/// # .enable_http2()
25795/// # .build();
25796///
25797/// # let executor = hyper_util::rt::TokioExecutor::new();
25798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25799/// # secret,
25800/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25801/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25802/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25803/// # ),
25804/// # ).build().await.unwrap();
25805///
25806/// # let client = hyper_util::client::legacy::Client::builder(
25807/// # hyper_util::rt::TokioExecutor::new()
25808/// # )
25809/// # .build(
25810/// # hyper_rustls::HttpsConnectorBuilder::new()
25811/// # .with_native_roots()
25812/// # .unwrap()
25813/// # .https_or_http()
25814/// # .enable_http2()
25815/// # .build()
25816/// # );
25817/// # let mut hub = DataCatalog::new(client, auth);
25818/// // You can configure optional parameters by calling the respective setters at will, and
25819/// // execute the final call using `doit()`.
25820/// // Values shown here are possibly random and not representative !
25821/// let result = hub.projects().locations_taxonomies_list("parent")
25822/// .page_token("ipsum")
25823/// .page_size(-18)
25824/// .filter("sanctus")
25825/// .doit().await;
25826/// # }
25827/// ```
25828pub struct ProjectLocationTaxonomyListCall<'a, C>
25829where
25830 C: 'a,
25831{
25832 hub: &'a DataCatalog<C>,
25833 _parent: String,
25834 _page_token: Option<String>,
25835 _page_size: Option<i32>,
25836 _filter: Option<String>,
25837 _delegate: Option<&'a mut dyn common::Delegate>,
25838 _additional_params: HashMap<String, String>,
25839 _scopes: BTreeSet<String>,
25840}
25841
25842impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyListCall<'a, C> {}
25843
25844impl<'a, C> ProjectLocationTaxonomyListCall<'a, C>
25845where
25846 C: common::Connector,
25847{
25848 /// Perform the operation you have build so far.
25849 pub async fn doit(
25850 mut self,
25851 ) -> common::Result<(
25852 common::Response,
25853 GoogleCloudDatacatalogV1ListTaxonomiesResponse,
25854 )> {
25855 use std::borrow::Cow;
25856 use std::io::{Read, Seek};
25857
25858 use common::{url::Params, ToParts};
25859 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25860
25861 let mut dd = common::DefaultDelegate;
25862 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25863 dlg.begin(common::MethodInfo {
25864 id: "datacatalog.projects.locations.taxonomies.list",
25865 http_method: hyper::Method::GET,
25866 });
25867
25868 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
25869 if self._additional_params.contains_key(field) {
25870 dlg.finished(false);
25871 return Err(common::Error::FieldClash(field));
25872 }
25873 }
25874
25875 let mut params = Params::with_capacity(6 + self._additional_params.len());
25876 params.push("parent", self._parent);
25877 if let Some(value) = self._page_token.as_ref() {
25878 params.push("pageToken", value);
25879 }
25880 if let Some(value) = self._page_size.as_ref() {
25881 params.push("pageSize", value.to_string());
25882 }
25883 if let Some(value) = self._filter.as_ref() {
25884 params.push("filter", value);
25885 }
25886
25887 params.extend(self._additional_params.iter());
25888
25889 params.push("alt", "json");
25890 let mut url = self.hub._base_url.clone() + "v1/{+parent}/taxonomies";
25891 if self._scopes.is_empty() {
25892 self._scopes
25893 .insert(Scope::CloudPlatform.as_ref().to_string());
25894 }
25895
25896 #[allow(clippy::single_element_loop)]
25897 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25898 url = params.uri_replacement(url, param_name, find_this, true);
25899 }
25900 {
25901 let to_remove = ["parent"];
25902 params.remove_params(&to_remove);
25903 }
25904
25905 let url = params.parse_with_url(&url);
25906
25907 loop {
25908 let token = match self
25909 .hub
25910 .auth
25911 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25912 .await
25913 {
25914 Ok(token) => token,
25915 Err(e) => match dlg.token(e) {
25916 Ok(token) => token,
25917 Err(e) => {
25918 dlg.finished(false);
25919 return Err(common::Error::MissingToken(e));
25920 }
25921 },
25922 };
25923 let mut req_result = {
25924 let client = &self.hub.client;
25925 dlg.pre_request();
25926 let mut req_builder = hyper::Request::builder()
25927 .method(hyper::Method::GET)
25928 .uri(url.as_str())
25929 .header(USER_AGENT, self.hub._user_agent.clone());
25930
25931 if let Some(token) = token.as_ref() {
25932 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25933 }
25934
25935 let request = req_builder
25936 .header(CONTENT_LENGTH, 0_u64)
25937 .body(common::to_body::<String>(None));
25938
25939 client.request(request.unwrap()).await
25940 };
25941
25942 match req_result {
25943 Err(err) => {
25944 if let common::Retry::After(d) = dlg.http_error(&err) {
25945 sleep(d).await;
25946 continue;
25947 }
25948 dlg.finished(false);
25949 return Err(common::Error::HttpError(err));
25950 }
25951 Ok(res) => {
25952 let (mut parts, body) = res.into_parts();
25953 let mut body = common::Body::new(body);
25954 if !parts.status.is_success() {
25955 let bytes = common::to_bytes(body).await.unwrap_or_default();
25956 let error = serde_json::from_str(&common::to_string(&bytes));
25957 let response = common::to_response(parts, bytes.into());
25958
25959 if let common::Retry::After(d) =
25960 dlg.http_failure(&response, error.as_ref().ok())
25961 {
25962 sleep(d).await;
25963 continue;
25964 }
25965
25966 dlg.finished(false);
25967
25968 return Err(match error {
25969 Ok(value) => common::Error::BadRequest(value),
25970 _ => common::Error::Failure(response),
25971 });
25972 }
25973 let response = {
25974 let bytes = common::to_bytes(body).await.unwrap_or_default();
25975 let encoded = common::to_string(&bytes);
25976 match serde_json::from_str(&encoded) {
25977 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25978 Err(error) => {
25979 dlg.response_json_decode_error(&encoded, &error);
25980 return Err(common::Error::JsonDecodeError(
25981 encoded.to_string(),
25982 error,
25983 ));
25984 }
25985 }
25986 };
25987
25988 dlg.finished(true);
25989 return Ok(response);
25990 }
25991 }
25992 }
25993 }
25994
25995 /// Required. Resource name of the project to list the taxonomies of.
25996 ///
25997 /// Sets the *parent* path property to the given value.
25998 ///
25999 /// Even though the property as already been set when instantiating this call,
26000 /// we provide this method for API completeness.
26001 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyListCall<'a, C> {
26002 self._parent = new_value.to_string();
26003 self
26004 }
26005 /// The pagination token of the next results page. If not set, the first page is returned. The token is returned in the response to a previous list request.
26006 ///
26007 /// Sets the *page token* query property to the given value.
26008 pub fn page_token(mut self, new_value: &str) -> ProjectLocationTaxonomyListCall<'a, C> {
26009 self._page_token = Some(new_value.to_string());
26010 self
26011 }
26012 /// The maximum number of items to return. Must be a value between 1 and 1000 inclusively. If not set, defaults to 50.
26013 ///
26014 /// Sets the *page size* query property to the given value.
26015 pub fn page_size(mut self, new_value: i32) -> ProjectLocationTaxonomyListCall<'a, C> {
26016 self._page_size = Some(new_value);
26017 self
26018 }
26019 /// Supported field for filter is 'service' and value is 'dataplex'. Eg: service=dataplex.
26020 ///
26021 /// Sets the *filter* query property to the given value.
26022 pub fn filter(mut self, new_value: &str) -> ProjectLocationTaxonomyListCall<'a, C> {
26023 self._filter = Some(new_value.to_string());
26024 self
26025 }
26026 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26027 /// while executing the actual API request.
26028 ///
26029 /// ````text
26030 /// It should be used to handle progress information, and to implement a certain level of resilience.
26031 /// ````
26032 ///
26033 /// Sets the *delegate* property to the given value.
26034 pub fn delegate(
26035 mut self,
26036 new_value: &'a mut dyn common::Delegate,
26037 ) -> ProjectLocationTaxonomyListCall<'a, C> {
26038 self._delegate = Some(new_value);
26039 self
26040 }
26041
26042 /// Set any additional parameter of the query string used in the request.
26043 /// It should be used to set parameters which are not yet available through their own
26044 /// setters.
26045 ///
26046 /// Please note that this method must not be used to set any of the known parameters
26047 /// which have their own setter method. If done anyway, the request will fail.
26048 ///
26049 /// # Additional Parameters
26050 ///
26051 /// * *$.xgafv* (query-string) - V1 error format.
26052 /// * *access_token* (query-string) - OAuth access token.
26053 /// * *alt* (query-string) - Data format for response.
26054 /// * *callback* (query-string) - JSONP
26055 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26056 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26057 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26058 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26059 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26060 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26061 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26062 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyListCall<'a, C>
26063 where
26064 T: AsRef<str>,
26065 {
26066 self._additional_params
26067 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26068 self
26069 }
26070
26071 /// Identifies the authorization scope for the method you are building.
26072 ///
26073 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26074 /// [`Scope::CloudPlatform`].
26075 ///
26076 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26077 /// tokens for more than one scope.
26078 ///
26079 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26080 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26081 /// sufficient, a read-write scope will do as well.
26082 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyListCall<'a, C>
26083 where
26084 St: AsRef<str>,
26085 {
26086 self._scopes.insert(String::from(scope.as_ref()));
26087 self
26088 }
26089 /// Identifies the authorization scope(s) for the method you are building.
26090 ///
26091 /// See [`Self::add_scope()`] for details.
26092 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyListCall<'a, C>
26093 where
26094 I: IntoIterator<Item = St>,
26095 St: AsRef<str>,
26096 {
26097 self._scopes
26098 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26099 self
26100 }
26101
26102 /// Removes all scopes, and no default scope will be used either.
26103 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26104 /// for details).
26105 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyListCall<'a, C> {
26106 self._scopes.clear();
26107 self
26108 }
26109}
26110
26111/// Updates a taxonomy, including its display name, description, and activated policy types.
26112///
26113/// A builder for the *locations.taxonomies.patch* method supported by a *project* resource.
26114/// It is not used directly, but through a [`ProjectMethods`] instance.
26115///
26116/// # Example
26117///
26118/// Instantiate a resource method builder
26119///
26120/// ```test_harness,no_run
26121/// # extern crate hyper;
26122/// # extern crate hyper_rustls;
26123/// # extern crate google_datacatalog1 as datacatalog1;
26124/// use datacatalog1::api::GoogleCloudDatacatalogV1Taxonomy;
26125/// # async fn dox() {
26126/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26127///
26128/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26129/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26130/// # .with_native_roots()
26131/// # .unwrap()
26132/// # .https_only()
26133/// # .enable_http2()
26134/// # .build();
26135///
26136/// # let executor = hyper_util::rt::TokioExecutor::new();
26137/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26138/// # secret,
26139/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26140/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26141/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26142/// # ),
26143/// # ).build().await.unwrap();
26144///
26145/// # let client = hyper_util::client::legacy::Client::builder(
26146/// # hyper_util::rt::TokioExecutor::new()
26147/// # )
26148/// # .build(
26149/// # hyper_rustls::HttpsConnectorBuilder::new()
26150/// # .with_native_roots()
26151/// # .unwrap()
26152/// # .https_or_http()
26153/// # .enable_http2()
26154/// # .build()
26155/// # );
26156/// # let mut hub = DataCatalog::new(client, auth);
26157/// // As the method needs a request, you would usually fill it with the desired information
26158/// // into the respective structure. Some of the parts shown here might not be applicable !
26159/// // Values shown here are possibly random and not representative !
26160/// let mut req = GoogleCloudDatacatalogV1Taxonomy::default();
26161///
26162/// // You can configure optional parameters by calling the respective setters at will, and
26163/// // execute the final call using `doit()`.
26164/// // Values shown here are possibly random and not representative !
26165/// let result = hub.projects().locations_taxonomies_patch(req, "name")
26166/// .update_mask(FieldMask::new::<&str>(&[]))
26167/// .doit().await;
26168/// # }
26169/// ```
26170pub struct ProjectLocationTaxonomyPatchCall<'a, C>
26171where
26172 C: 'a,
26173{
26174 hub: &'a DataCatalog<C>,
26175 _request: GoogleCloudDatacatalogV1Taxonomy,
26176 _name: String,
26177 _update_mask: Option<common::FieldMask>,
26178 _delegate: Option<&'a mut dyn common::Delegate>,
26179 _additional_params: HashMap<String, String>,
26180 _scopes: BTreeSet<String>,
26181}
26182
26183impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPatchCall<'a, C> {}
26184
26185impl<'a, C> ProjectLocationTaxonomyPatchCall<'a, C>
26186where
26187 C: common::Connector,
26188{
26189 /// Perform the operation you have build so far.
26190 pub async fn doit(
26191 mut self,
26192 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Taxonomy)> {
26193 use std::borrow::Cow;
26194 use std::io::{Read, Seek};
26195
26196 use common::{url::Params, ToParts};
26197 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26198
26199 let mut dd = common::DefaultDelegate;
26200 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26201 dlg.begin(common::MethodInfo {
26202 id: "datacatalog.projects.locations.taxonomies.patch",
26203 http_method: hyper::Method::PATCH,
26204 });
26205
26206 for &field in ["alt", "name", "updateMask"].iter() {
26207 if self._additional_params.contains_key(field) {
26208 dlg.finished(false);
26209 return Err(common::Error::FieldClash(field));
26210 }
26211 }
26212
26213 let mut params = Params::with_capacity(5 + self._additional_params.len());
26214 params.push("name", self._name);
26215 if let Some(value) = self._update_mask.as_ref() {
26216 params.push("updateMask", value.to_string());
26217 }
26218
26219 params.extend(self._additional_params.iter());
26220
26221 params.push("alt", "json");
26222 let mut url = self.hub._base_url.clone() + "v1/{+name}";
26223 if self._scopes.is_empty() {
26224 self._scopes
26225 .insert(Scope::CloudPlatform.as_ref().to_string());
26226 }
26227
26228 #[allow(clippy::single_element_loop)]
26229 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26230 url = params.uri_replacement(url, param_name, find_this, true);
26231 }
26232 {
26233 let to_remove = ["name"];
26234 params.remove_params(&to_remove);
26235 }
26236
26237 let url = params.parse_with_url(&url);
26238
26239 let mut json_mime_type = mime::APPLICATION_JSON;
26240 let mut request_value_reader = {
26241 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26242 common::remove_json_null_values(&mut value);
26243 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26244 serde_json::to_writer(&mut dst, &value).unwrap();
26245 dst
26246 };
26247 let request_size = request_value_reader
26248 .seek(std::io::SeekFrom::End(0))
26249 .unwrap();
26250 request_value_reader
26251 .seek(std::io::SeekFrom::Start(0))
26252 .unwrap();
26253
26254 loop {
26255 let token = match self
26256 .hub
26257 .auth
26258 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26259 .await
26260 {
26261 Ok(token) => token,
26262 Err(e) => match dlg.token(e) {
26263 Ok(token) => token,
26264 Err(e) => {
26265 dlg.finished(false);
26266 return Err(common::Error::MissingToken(e));
26267 }
26268 },
26269 };
26270 request_value_reader
26271 .seek(std::io::SeekFrom::Start(0))
26272 .unwrap();
26273 let mut req_result = {
26274 let client = &self.hub.client;
26275 dlg.pre_request();
26276 let mut req_builder = hyper::Request::builder()
26277 .method(hyper::Method::PATCH)
26278 .uri(url.as_str())
26279 .header(USER_AGENT, self.hub._user_agent.clone());
26280
26281 if let Some(token) = token.as_ref() {
26282 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26283 }
26284
26285 let request = req_builder
26286 .header(CONTENT_TYPE, json_mime_type.to_string())
26287 .header(CONTENT_LENGTH, request_size as u64)
26288 .body(common::to_body(
26289 request_value_reader.get_ref().clone().into(),
26290 ));
26291
26292 client.request(request.unwrap()).await
26293 };
26294
26295 match req_result {
26296 Err(err) => {
26297 if let common::Retry::After(d) = dlg.http_error(&err) {
26298 sleep(d).await;
26299 continue;
26300 }
26301 dlg.finished(false);
26302 return Err(common::Error::HttpError(err));
26303 }
26304 Ok(res) => {
26305 let (mut parts, body) = res.into_parts();
26306 let mut body = common::Body::new(body);
26307 if !parts.status.is_success() {
26308 let bytes = common::to_bytes(body).await.unwrap_or_default();
26309 let error = serde_json::from_str(&common::to_string(&bytes));
26310 let response = common::to_response(parts, bytes.into());
26311
26312 if let common::Retry::After(d) =
26313 dlg.http_failure(&response, error.as_ref().ok())
26314 {
26315 sleep(d).await;
26316 continue;
26317 }
26318
26319 dlg.finished(false);
26320
26321 return Err(match error {
26322 Ok(value) => common::Error::BadRequest(value),
26323 _ => common::Error::Failure(response),
26324 });
26325 }
26326 let response = {
26327 let bytes = common::to_bytes(body).await.unwrap_or_default();
26328 let encoded = common::to_string(&bytes);
26329 match serde_json::from_str(&encoded) {
26330 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26331 Err(error) => {
26332 dlg.response_json_decode_error(&encoded, &error);
26333 return Err(common::Error::JsonDecodeError(
26334 encoded.to_string(),
26335 error,
26336 ));
26337 }
26338 }
26339 };
26340
26341 dlg.finished(true);
26342 return Ok(response);
26343 }
26344 }
26345 }
26346 }
26347
26348 ///
26349 /// Sets the *request* property to the given value.
26350 ///
26351 /// Even though the property as already been set when instantiating this call,
26352 /// we provide this method for API completeness.
26353 pub fn request(
26354 mut self,
26355 new_value: GoogleCloudDatacatalogV1Taxonomy,
26356 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
26357 self._request = new_value;
26358 self
26359 }
26360 /// Identifier. Resource name of this taxonomy in URL format. Note: Policy tag manager generates unique taxonomy IDs.
26361 ///
26362 /// Sets the *name* path property to the given value.
26363 ///
26364 /// Even though the property as already been set when instantiating this call,
26365 /// we provide this method for API completeness.
26366 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPatchCall<'a, C> {
26367 self._name = new_value.to_string();
26368 self
26369 }
26370 /// Specifies fields to update. If not set, defaults to all fields you can update. For more information, see [FieldMask] (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask).
26371 ///
26372 /// Sets the *update mask* query property to the given value.
26373 pub fn update_mask(
26374 mut self,
26375 new_value: common::FieldMask,
26376 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
26377 self._update_mask = Some(new_value);
26378 self
26379 }
26380 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26381 /// while executing the actual API request.
26382 ///
26383 /// ````text
26384 /// It should be used to handle progress information, and to implement a certain level of resilience.
26385 /// ````
26386 ///
26387 /// Sets the *delegate* property to the given value.
26388 pub fn delegate(
26389 mut self,
26390 new_value: &'a mut dyn common::Delegate,
26391 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
26392 self._delegate = Some(new_value);
26393 self
26394 }
26395
26396 /// Set any additional parameter of the query string used in the request.
26397 /// It should be used to set parameters which are not yet available through their own
26398 /// setters.
26399 ///
26400 /// Please note that this method must not be used to set any of the known parameters
26401 /// which have their own setter method. If done anyway, the request will fail.
26402 ///
26403 /// # Additional Parameters
26404 ///
26405 /// * *$.xgafv* (query-string) - V1 error format.
26406 /// * *access_token* (query-string) - OAuth access token.
26407 /// * *alt* (query-string) - Data format for response.
26408 /// * *callback* (query-string) - JSONP
26409 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26410 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26411 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26412 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26413 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26414 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26415 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26416 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPatchCall<'a, C>
26417 where
26418 T: AsRef<str>,
26419 {
26420 self._additional_params
26421 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26422 self
26423 }
26424
26425 /// Identifies the authorization scope for the method you are building.
26426 ///
26427 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26428 /// [`Scope::CloudPlatform`].
26429 ///
26430 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26431 /// tokens for more than one scope.
26432 ///
26433 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26434 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26435 /// sufficient, a read-write scope will do as well.
26436 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPatchCall<'a, C>
26437 where
26438 St: AsRef<str>,
26439 {
26440 self._scopes.insert(String::from(scope.as_ref()));
26441 self
26442 }
26443 /// Identifies the authorization scope(s) for the method you are building.
26444 ///
26445 /// See [`Self::add_scope()`] for details.
26446 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyPatchCall<'a, C>
26447 where
26448 I: IntoIterator<Item = St>,
26449 St: AsRef<str>,
26450 {
26451 self._scopes
26452 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26453 self
26454 }
26455
26456 /// Removes all scopes, and no default scope will be used either.
26457 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26458 /// for details).
26459 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPatchCall<'a, C> {
26460 self._scopes.clear();
26461 self
26462 }
26463}
26464
26465/// Replaces (updates) a taxonomy and all its policy tags. The taxonomy and its entire hierarchy of policy tags must be represented literally by `SerializedTaxonomy` and the nested `SerializedPolicyTag` messages. This operation automatically does the following: - Deletes the existing policy tags that are missing from the `SerializedPolicyTag`. - Creates policy tags that don't have resource names. They are considered new. - Updates policy tags with valid resources names accordingly.
26466///
26467/// A builder for the *locations.taxonomies.replace* method supported by a *project* resource.
26468/// It is not used directly, but through a [`ProjectMethods`] instance.
26469///
26470/// # Example
26471///
26472/// Instantiate a resource method builder
26473///
26474/// ```test_harness,no_run
26475/// # extern crate hyper;
26476/// # extern crate hyper_rustls;
26477/// # extern crate google_datacatalog1 as datacatalog1;
26478/// use datacatalog1::api::GoogleCloudDatacatalogV1ReplaceTaxonomyRequest;
26479/// # async fn dox() {
26480/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26481///
26482/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26483/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26484/// # .with_native_roots()
26485/// # .unwrap()
26486/// # .https_only()
26487/// # .enable_http2()
26488/// # .build();
26489///
26490/// # let executor = hyper_util::rt::TokioExecutor::new();
26491/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26492/// # secret,
26493/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26494/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26495/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26496/// # ),
26497/// # ).build().await.unwrap();
26498///
26499/// # let client = hyper_util::client::legacy::Client::builder(
26500/// # hyper_util::rt::TokioExecutor::new()
26501/// # )
26502/// # .build(
26503/// # hyper_rustls::HttpsConnectorBuilder::new()
26504/// # .with_native_roots()
26505/// # .unwrap()
26506/// # .https_or_http()
26507/// # .enable_http2()
26508/// # .build()
26509/// # );
26510/// # let mut hub = DataCatalog::new(client, auth);
26511/// // As the method needs a request, you would usually fill it with the desired information
26512/// // into the respective structure. Some of the parts shown here might not be applicable !
26513/// // Values shown here are possibly random and not representative !
26514/// let mut req = GoogleCloudDatacatalogV1ReplaceTaxonomyRequest::default();
26515///
26516/// // You can configure optional parameters by calling the respective setters at will, and
26517/// // execute the final call using `doit()`.
26518/// // Values shown here are possibly random and not representative !
26519/// let result = hub.projects().locations_taxonomies_replace(req, "name")
26520/// .doit().await;
26521/// # }
26522/// ```
26523pub struct ProjectLocationTaxonomyReplaceCall<'a, C>
26524where
26525 C: 'a,
26526{
26527 hub: &'a DataCatalog<C>,
26528 _request: GoogleCloudDatacatalogV1ReplaceTaxonomyRequest,
26529 _name: String,
26530 _delegate: Option<&'a mut dyn common::Delegate>,
26531 _additional_params: HashMap<String, String>,
26532 _scopes: BTreeSet<String>,
26533}
26534
26535impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyReplaceCall<'a, C> {}
26536
26537impl<'a, C> ProjectLocationTaxonomyReplaceCall<'a, C>
26538where
26539 C: common::Connector,
26540{
26541 /// Perform the operation you have build so far.
26542 pub async fn doit(
26543 mut self,
26544 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1Taxonomy)> {
26545 use std::borrow::Cow;
26546 use std::io::{Read, Seek};
26547
26548 use common::{url::Params, ToParts};
26549 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26550
26551 let mut dd = common::DefaultDelegate;
26552 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26553 dlg.begin(common::MethodInfo {
26554 id: "datacatalog.projects.locations.taxonomies.replace",
26555 http_method: hyper::Method::POST,
26556 });
26557
26558 for &field in ["alt", "name"].iter() {
26559 if self._additional_params.contains_key(field) {
26560 dlg.finished(false);
26561 return Err(common::Error::FieldClash(field));
26562 }
26563 }
26564
26565 let mut params = Params::with_capacity(4 + self._additional_params.len());
26566 params.push("name", self._name);
26567
26568 params.extend(self._additional_params.iter());
26569
26570 params.push("alt", "json");
26571 let mut url = self.hub._base_url.clone() + "v1/{+name}:replace";
26572 if self._scopes.is_empty() {
26573 self._scopes
26574 .insert(Scope::CloudPlatform.as_ref().to_string());
26575 }
26576
26577 #[allow(clippy::single_element_loop)]
26578 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26579 url = params.uri_replacement(url, param_name, find_this, true);
26580 }
26581 {
26582 let to_remove = ["name"];
26583 params.remove_params(&to_remove);
26584 }
26585
26586 let url = params.parse_with_url(&url);
26587
26588 let mut json_mime_type = mime::APPLICATION_JSON;
26589 let mut request_value_reader = {
26590 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26591 common::remove_json_null_values(&mut value);
26592 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26593 serde_json::to_writer(&mut dst, &value).unwrap();
26594 dst
26595 };
26596 let request_size = request_value_reader
26597 .seek(std::io::SeekFrom::End(0))
26598 .unwrap();
26599 request_value_reader
26600 .seek(std::io::SeekFrom::Start(0))
26601 .unwrap();
26602
26603 loop {
26604 let token = match self
26605 .hub
26606 .auth
26607 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26608 .await
26609 {
26610 Ok(token) => token,
26611 Err(e) => match dlg.token(e) {
26612 Ok(token) => token,
26613 Err(e) => {
26614 dlg.finished(false);
26615 return Err(common::Error::MissingToken(e));
26616 }
26617 },
26618 };
26619 request_value_reader
26620 .seek(std::io::SeekFrom::Start(0))
26621 .unwrap();
26622 let mut req_result = {
26623 let client = &self.hub.client;
26624 dlg.pre_request();
26625 let mut req_builder = hyper::Request::builder()
26626 .method(hyper::Method::POST)
26627 .uri(url.as_str())
26628 .header(USER_AGENT, self.hub._user_agent.clone());
26629
26630 if let Some(token) = token.as_ref() {
26631 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26632 }
26633
26634 let request = req_builder
26635 .header(CONTENT_TYPE, json_mime_type.to_string())
26636 .header(CONTENT_LENGTH, request_size as u64)
26637 .body(common::to_body(
26638 request_value_reader.get_ref().clone().into(),
26639 ));
26640
26641 client.request(request.unwrap()).await
26642 };
26643
26644 match req_result {
26645 Err(err) => {
26646 if let common::Retry::After(d) = dlg.http_error(&err) {
26647 sleep(d).await;
26648 continue;
26649 }
26650 dlg.finished(false);
26651 return Err(common::Error::HttpError(err));
26652 }
26653 Ok(res) => {
26654 let (mut parts, body) = res.into_parts();
26655 let mut body = common::Body::new(body);
26656 if !parts.status.is_success() {
26657 let bytes = common::to_bytes(body).await.unwrap_or_default();
26658 let error = serde_json::from_str(&common::to_string(&bytes));
26659 let response = common::to_response(parts, bytes.into());
26660
26661 if let common::Retry::After(d) =
26662 dlg.http_failure(&response, error.as_ref().ok())
26663 {
26664 sleep(d).await;
26665 continue;
26666 }
26667
26668 dlg.finished(false);
26669
26670 return Err(match error {
26671 Ok(value) => common::Error::BadRequest(value),
26672 _ => common::Error::Failure(response),
26673 });
26674 }
26675 let response = {
26676 let bytes = common::to_bytes(body).await.unwrap_or_default();
26677 let encoded = common::to_string(&bytes);
26678 match serde_json::from_str(&encoded) {
26679 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26680 Err(error) => {
26681 dlg.response_json_decode_error(&encoded, &error);
26682 return Err(common::Error::JsonDecodeError(
26683 encoded.to_string(),
26684 error,
26685 ));
26686 }
26687 }
26688 };
26689
26690 dlg.finished(true);
26691 return Ok(response);
26692 }
26693 }
26694 }
26695 }
26696
26697 ///
26698 /// Sets the *request* property to the given value.
26699 ///
26700 /// Even though the property as already been set when instantiating this call,
26701 /// we provide this method for API completeness.
26702 pub fn request(
26703 mut self,
26704 new_value: GoogleCloudDatacatalogV1ReplaceTaxonomyRequest,
26705 ) -> ProjectLocationTaxonomyReplaceCall<'a, C> {
26706 self._request = new_value;
26707 self
26708 }
26709 /// Required. Resource name of the taxonomy to update.
26710 ///
26711 /// Sets the *name* path property to the given value.
26712 ///
26713 /// Even though the property as already been set when instantiating this call,
26714 /// we provide this method for API completeness.
26715 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyReplaceCall<'a, C> {
26716 self._name = new_value.to_string();
26717 self
26718 }
26719 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26720 /// while executing the actual API request.
26721 ///
26722 /// ````text
26723 /// It should be used to handle progress information, and to implement a certain level of resilience.
26724 /// ````
26725 ///
26726 /// Sets the *delegate* property to the given value.
26727 pub fn delegate(
26728 mut self,
26729 new_value: &'a mut dyn common::Delegate,
26730 ) -> ProjectLocationTaxonomyReplaceCall<'a, C> {
26731 self._delegate = Some(new_value);
26732 self
26733 }
26734
26735 /// Set any additional parameter of the query string used in the request.
26736 /// It should be used to set parameters which are not yet available through their own
26737 /// setters.
26738 ///
26739 /// Please note that this method must not be used to set any of the known parameters
26740 /// which have their own setter method. If done anyway, the request will fail.
26741 ///
26742 /// # Additional Parameters
26743 ///
26744 /// * *$.xgafv* (query-string) - V1 error format.
26745 /// * *access_token* (query-string) - OAuth access token.
26746 /// * *alt* (query-string) - Data format for response.
26747 /// * *callback* (query-string) - JSONP
26748 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26749 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26750 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26751 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26752 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26753 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26754 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26755 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyReplaceCall<'a, C>
26756 where
26757 T: AsRef<str>,
26758 {
26759 self._additional_params
26760 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26761 self
26762 }
26763
26764 /// Identifies the authorization scope for the method you are building.
26765 ///
26766 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26767 /// [`Scope::CloudPlatform`].
26768 ///
26769 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26770 /// tokens for more than one scope.
26771 ///
26772 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26773 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26774 /// sufficient, a read-write scope will do as well.
26775 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyReplaceCall<'a, C>
26776 where
26777 St: AsRef<str>,
26778 {
26779 self._scopes.insert(String::from(scope.as_ref()));
26780 self
26781 }
26782 /// Identifies the authorization scope(s) for the method you are building.
26783 ///
26784 /// See [`Self::add_scope()`] for details.
26785 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyReplaceCall<'a, C>
26786 where
26787 I: IntoIterator<Item = St>,
26788 St: AsRef<str>,
26789 {
26790 self._scopes
26791 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26792 self
26793 }
26794
26795 /// Removes all scopes, and no default scope will be used either.
26796 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26797 /// for details).
26798 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyReplaceCall<'a, C> {
26799 self._scopes.clear();
26800 self
26801 }
26802}
26803
26804/// Sets the IAM policy for a policy tag or a taxonomy.
26805///
26806/// A builder for the *locations.taxonomies.setIamPolicy* method supported by a *project* resource.
26807/// It is not used directly, but through a [`ProjectMethods`] instance.
26808///
26809/// # Example
26810///
26811/// Instantiate a resource method builder
26812///
26813/// ```test_harness,no_run
26814/// # extern crate hyper;
26815/// # extern crate hyper_rustls;
26816/// # extern crate google_datacatalog1 as datacatalog1;
26817/// use datacatalog1::api::SetIamPolicyRequest;
26818/// # async fn dox() {
26819/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26820///
26821/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26822/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26823/// # .with_native_roots()
26824/// # .unwrap()
26825/// # .https_only()
26826/// # .enable_http2()
26827/// # .build();
26828///
26829/// # let executor = hyper_util::rt::TokioExecutor::new();
26830/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26831/// # secret,
26832/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26833/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26834/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26835/// # ),
26836/// # ).build().await.unwrap();
26837///
26838/// # let client = hyper_util::client::legacy::Client::builder(
26839/// # hyper_util::rt::TokioExecutor::new()
26840/// # )
26841/// # .build(
26842/// # hyper_rustls::HttpsConnectorBuilder::new()
26843/// # .with_native_roots()
26844/// # .unwrap()
26845/// # .https_or_http()
26846/// # .enable_http2()
26847/// # .build()
26848/// # );
26849/// # let mut hub = DataCatalog::new(client, auth);
26850/// // As the method needs a request, you would usually fill it with the desired information
26851/// // into the respective structure. Some of the parts shown here might not be applicable !
26852/// // Values shown here are possibly random and not representative !
26853/// let mut req = SetIamPolicyRequest::default();
26854///
26855/// // You can configure optional parameters by calling the respective setters at will, and
26856/// // execute the final call using `doit()`.
26857/// // Values shown here are possibly random and not representative !
26858/// let result = hub.projects().locations_taxonomies_set_iam_policy(req, "resource")
26859/// .doit().await;
26860/// # }
26861/// ```
26862pub struct ProjectLocationTaxonomySetIamPolicyCall<'a, C>
26863where
26864 C: 'a,
26865{
26866 hub: &'a DataCatalog<C>,
26867 _request: SetIamPolicyRequest,
26868 _resource: String,
26869 _delegate: Option<&'a mut dyn common::Delegate>,
26870 _additional_params: HashMap<String, String>,
26871 _scopes: BTreeSet<String>,
26872}
26873
26874impl<'a, C> common::CallBuilder for ProjectLocationTaxonomySetIamPolicyCall<'a, C> {}
26875
26876impl<'a, C> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
26877where
26878 C: common::Connector,
26879{
26880 /// Perform the operation you have build so far.
26881 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
26882 use std::borrow::Cow;
26883 use std::io::{Read, Seek};
26884
26885 use common::{url::Params, ToParts};
26886 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26887
26888 let mut dd = common::DefaultDelegate;
26889 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26890 dlg.begin(common::MethodInfo {
26891 id: "datacatalog.projects.locations.taxonomies.setIamPolicy",
26892 http_method: hyper::Method::POST,
26893 });
26894
26895 for &field in ["alt", "resource"].iter() {
26896 if self._additional_params.contains_key(field) {
26897 dlg.finished(false);
26898 return Err(common::Error::FieldClash(field));
26899 }
26900 }
26901
26902 let mut params = Params::with_capacity(4 + self._additional_params.len());
26903 params.push("resource", self._resource);
26904
26905 params.extend(self._additional_params.iter());
26906
26907 params.push("alt", "json");
26908 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
26909 if self._scopes.is_empty() {
26910 self._scopes
26911 .insert(Scope::CloudPlatform.as_ref().to_string());
26912 }
26913
26914 #[allow(clippy::single_element_loop)]
26915 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
26916 url = params.uri_replacement(url, param_name, find_this, true);
26917 }
26918 {
26919 let to_remove = ["resource"];
26920 params.remove_params(&to_remove);
26921 }
26922
26923 let url = params.parse_with_url(&url);
26924
26925 let mut json_mime_type = mime::APPLICATION_JSON;
26926 let mut request_value_reader = {
26927 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26928 common::remove_json_null_values(&mut value);
26929 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26930 serde_json::to_writer(&mut dst, &value).unwrap();
26931 dst
26932 };
26933 let request_size = request_value_reader
26934 .seek(std::io::SeekFrom::End(0))
26935 .unwrap();
26936 request_value_reader
26937 .seek(std::io::SeekFrom::Start(0))
26938 .unwrap();
26939
26940 loop {
26941 let token = match self
26942 .hub
26943 .auth
26944 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26945 .await
26946 {
26947 Ok(token) => token,
26948 Err(e) => match dlg.token(e) {
26949 Ok(token) => token,
26950 Err(e) => {
26951 dlg.finished(false);
26952 return Err(common::Error::MissingToken(e));
26953 }
26954 },
26955 };
26956 request_value_reader
26957 .seek(std::io::SeekFrom::Start(0))
26958 .unwrap();
26959 let mut req_result = {
26960 let client = &self.hub.client;
26961 dlg.pre_request();
26962 let mut req_builder = hyper::Request::builder()
26963 .method(hyper::Method::POST)
26964 .uri(url.as_str())
26965 .header(USER_AGENT, self.hub._user_agent.clone());
26966
26967 if let Some(token) = token.as_ref() {
26968 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26969 }
26970
26971 let request = req_builder
26972 .header(CONTENT_TYPE, json_mime_type.to_string())
26973 .header(CONTENT_LENGTH, request_size as u64)
26974 .body(common::to_body(
26975 request_value_reader.get_ref().clone().into(),
26976 ));
26977
26978 client.request(request.unwrap()).await
26979 };
26980
26981 match req_result {
26982 Err(err) => {
26983 if let common::Retry::After(d) = dlg.http_error(&err) {
26984 sleep(d).await;
26985 continue;
26986 }
26987 dlg.finished(false);
26988 return Err(common::Error::HttpError(err));
26989 }
26990 Ok(res) => {
26991 let (mut parts, body) = res.into_parts();
26992 let mut body = common::Body::new(body);
26993 if !parts.status.is_success() {
26994 let bytes = common::to_bytes(body).await.unwrap_or_default();
26995 let error = serde_json::from_str(&common::to_string(&bytes));
26996 let response = common::to_response(parts, bytes.into());
26997
26998 if let common::Retry::After(d) =
26999 dlg.http_failure(&response, error.as_ref().ok())
27000 {
27001 sleep(d).await;
27002 continue;
27003 }
27004
27005 dlg.finished(false);
27006
27007 return Err(match error {
27008 Ok(value) => common::Error::BadRequest(value),
27009 _ => common::Error::Failure(response),
27010 });
27011 }
27012 let response = {
27013 let bytes = common::to_bytes(body).await.unwrap_or_default();
27014 let encoded = common::to_string(&bytes);
27015 match serde_json::from_str(&encoded) {
27016 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27017 Err(error) => {
27018 dlg.response_json_decode_error(&encoded, &error);
27019 return Err(common::Error::JsonDecodeError(
27020 encoded.to_string(),
27021 error,
27022 ));
27023 }
27024 }
27025 };
27026
27027 dlg.finished(true);
27028 return Ok(response);
27029 }
27030 }
27031 }
27032 }
27033
27034 ///
27035 /// Sets the *request* property to the given value.
27036 ///
27037 /// Even though the property as already been set when instantiating this call,
27038 /// we provide this method for API completeness.
27039 pub fn request(
27040 mut self,
27041 new_value: SetIamPolicyRequest,
27042 ) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
27043 self._request = new_value;
27044 self
27045 }
27046 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
27047 ///
27048 /// Sets the *resource* path property to the given value.
27049 ///
27050 /// Even though the property as already been set when instantiating this call,
27051 /// we provide this method for API completeness.
27052 pub fn resource(mut self, new_value: &str) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
27053 self._resource = new_value.to_string();
27054 self
27055 }
27056 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27057 /// while executing the actual API request.
27058 ///
27059 /// ````text
27060 /// It should be used to handle progress information, and to implement a certain level of resilience.
27061 /// ````
27062 ///
27063 /// Sets the *delegate* property to the given value.
27064 pub fn delegate(
27065 mut self,
27066 new_value: &'a mut dyn common::Delegate,
27067 ) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
27068 self._delegate = Some(new_value);
27069 self
27070 }
27071
27072 /// Set any additional parameter of the query string used in the request.
27073 /// It should be used to set parameters which are not yet available through their own
27074 /// setters.
27075 ///
27076 /// Please note that this method must not be used to set any of the known parameters
27077 /// which have their own setter method. If done anyway, the request will fail.
27078 ///
27079 /// # Additional Parameters
27080 ///
27081 /// * *$.xgafv* (query-string) - V1 error format.
27082 /// * *access_token* (query-string) - OAuth access token.
27083 /// * *alt* (query-string) - Data format for response.
27084 /// * *callback* (query-string) - JSONP
27085 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27086 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27087 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27088 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27089 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27090 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27091 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27092 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
27093 where
27094 T: AsRef<str>,
27095 {
27096 self._additional_params
27097 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27098 self
27099 }
27100
27101 /// Identifies the authorization scope for the method you are building.
27102 ///
27103 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27104 /// [`Scope::CloudPlatform`].
27105 ///
27106 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27107 /// tokens for more than one scope.
27108 ///
27109 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27110 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27111 /// sufficient, a read-write scope will do as well.
27112 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
27113 where
27114 St: AsRef<str>,
27115 {
27116 self._scopes.insert(String::from(scope.as_ref()));
27117 self
27118 }
27119 /// Identifies the authorization scope(s) for the method you are building.
27120 ///
27121 /// See [`Self::add_scope()`] for details.
27122 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
27123 where
27124 I: IntoIterator<Item = St>,
27125 St: AsRef<str>,
27126 {
27127 self._scopes
27128 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27129 self
27130 }
27131
27132 /// Removes all scopes, and no default scope will be used either.
27133 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27134 /// for details).
27135 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
27136 self._scopes.clear();
27137 self
27138 }
27139}
27140
27141/// Returns your permissions on a specified policy tag or taxonomy.
27142///
27143/// A builder for the *locations.taxonomies.testIamPermissions* method supported by a *project* resource.
27144/// It is not used directly, but through a [`ProjectMethods`] instance.
27145///
27146/// # Example
27147///
27148/// Instantiate a resource method builder
27149///
27150/// ```test_harness,no_run
27151/// # extern crate hyper;
27152/// # extern crate hyper_rustls;
27153/// # extern crate google_datacatalog1 as datacatalog1;
27154/// use datacatalog1::api::TestIamPermissionsRequest;
27155/// # async fn dox() {
27156/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27157///
27158/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27159/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27160/// # .with_native_roots()
27161/// # .unwrap()
27162/// # .https_only()
27163/// # .enable_http2()
27164/// # .build();
27165///
27166/// # let executor = hyper_util::rt::TokioExecutor::new();
27167/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27168/// # secret,
27169/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27170/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27171/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27172/// # ),
27173/// # ).build().await.unwrap();
27174///
27175/// # let client = hyper_util::client::legacy::Client::builder(
27176/// # hyper_util::rt::TokioExecutor::new()
27177/// # )
27178/// # .build(
27179/// # hyper_rustls::HttpsConnectorBuilder::new()
27180/// # .with_native_roots()
27181/// # .unwrap()
27182/// # .https_or_http()
27183/// # .enable_http2()
27184/// # .build()
27185/// # );
27186/// # let mut hub = DataCatalog::new(client, auth);
27187/// // As the method needs a request, you would usually fill it with the desired information
27188/// // into the respective structure. Some of the parts shown here might not be applicable !
27189/// // Values shown here are possibly random and not representative !
27190/// let mut req = TestIamPermissionsRequest::default();
27191///
27192/// // You can configure optional parameters by calling the respective setters at will, and
27193/// // execute the final call using `doit()`.
27194/// // Values shown here are possibly random and not representative !
27195/// let result = hub.projects().locations_taxonomies_test_iam_permissions(req, "resource")
27196/// .doit().await;
27197/// # }
27198/// ```
27199pub struct ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
27200where
27201 C: 'a,
27202{
27203 hub: &'a DataCatalog<C>,
27204 _request: TestIamPermissionsRequest,
27205 _resource: String,
27206 _delegate: Option<&'a mut dyn common::Delegate>,
27207 _additional_params: HashMap<String, String>,
27208 _scopes: BTreeSet<String>,
27209}
27210
27211impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {}
27212
27213impl<'a, C> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
27214where
27215 C: common::Connector,
27216{
27217 /// Perform the operation you have build so far.
27218 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
27219 use std::borrow::Cow;
27220 use std::io::{Read, Seek};
27221
27222 use common::{url::Params, ToParts};
27223 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27224
27225 let mut dd = common::DefaultDelegate;
27226 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27227 dlg.begin(common::MethodInfo {
27228 id: "datacatalog.projects.locations.taxonomies.testIamPermissions",
27229 http_method: hyper::Method::POST,
27230 });
27231
27232 for &field in ["alt", "resource"].iter() {
27233 if self._additional_params.contains_key(field) {
27234 dlg.finished(false);
27235 return Err(common::Error::FieldClash(field));
27236 }
27237 }
27238
27239 let mut params = Params::with_capacity(4 + self._additional_params.len());
27240 params.push("resource", self._resource);
27241
27242 params.extend(self._additional_params.iter());
27243
27244 params.push("alt", "json");
27245 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
27246 if self._scopes.is_empty() {
27247 self._scopes
27248 .insert(Scope::CloudPlatform.as_ref().to_string());
27249 }
27250
27251 #[allow(clippy::single_element_loop)]
27252 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
27253 url = params.uri_replacement(url, param_name, find_this, true);
27254 }
27255 {
27256 let to_remove = ["resource"];
27257 params.remove_params(&to_remove);
27258 }
27259
27260 let url = params.parse_with_url(&url);
27261
27262 let mut json_mime_type = mime::APPLICATION_JSON;
27263 let mut request_value_reader = {
27264 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27265 common::remove_json_null_values(&mut value);
27266 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27267 serde_json::to_writer(&mut dst, &value).unwrap();
27268 dst
27269 };
27270 let request_size = request_value_reader
27271 .seek(std::io::SeekFrom::End(0))
27272 .unwrap();
27273 request_value_reader
27274 .seek(std::io::SeekFrom::Start(0))
27275 .unwrap();
27276
27277 loop {
27278 let token = match self
27279 .hub
27280 .auth
27281 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27282 .await
27283 {
27284 Ok(token) => token,
27285 Err(e) => match dlg.token(e) {
27286 Ok(token) => token,
27287 Err(e) => {
27288 dlg.finished(false);
27289 return Err(common::Error::MissingToken(e));
27290 }
27291 },
27292 };
27293 request_value_reader
27294 .seek(std::io::SeekFrom::Start(0))
27295 .unwrap();
27296 let mut req_result = {
27297 let client = &self.hub.client;
27298 dlg.pre_request();
27299 let mut req_builder = hyper::Request::builder()
27300 .method(hyper::Method::POST)
27301 .uri(url.as_str())
27302 .header(USER_AGENT, self.hub._user_agent.clone());
27303
27304 if let Some(token) = token.as_ref() {
27305 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27306 }
27307
27308 let request = req_builder
27309 .header(CONTENT_TYPE, json_mime_type.to_string())
27310 .header(CONTENT_LENGTH, request_size as u64)
27311 .body(common::to_body(
27312 request_value_reader.get_ref().clone().into(),
27313 ));
27314
27315 client.request(request.unwrap()).await
27316 };
27317
27318 match req_result {
27319 Err(err) => {
27320 if let common::Retry::After(d) = dlg.http_error(&err) {
27321 sleep(d).await;
27322 continue;
27323 }
27324 dlg.finished(false);
27325 return Err(common::Error::HttpError(err));
27326 }
27327 Ok(res) => {
27328 let (mut parts, body) = res.into_parts();
27329 let mut body = common::Body::new(body);
27330 if !parts.status.is_success() {
27331 let bytes = common::to_bytes(body).await.unwrap_or_default();
27332 let error = serde_json::from_str(&common::to_string(&bytes));
27333 let response = common::to_response(parts, bytes.into());
27334
27335 if let common::Retry::After(d) =
27336 dlg.http_failure(&response, error.as_ref().ok())
27337 {
27338 sleep(d).await;
27339 continue;
27340 }
27341
27342 dlg.finished(false);
27343
27344 return Err(match error {
27345 Ok(value) => common::Error::BadRequest(value),
27346 _ => common::Error::Failure(response),
27347 });
27348 }
27349 let response = {
27350 let bytes = common::to_bytes(body).await.unwrap_or_default();
27351 let encoded = common::to_string(&bytes);
27352 match serde_json::from_str(&encoded) {
27353 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27354 Err(error) => {
27355 dlg.response_json_decode_error(&encoded, &error);
27356 return Err(common::Error::JsonDecodeError(
27357 encoded.to_string(),
27358 error,
27359 ));
27360 }
27361 }
27362 };
27363
27364 dlg.finished(true);
27365 return Ok(response);
27366 }
27367 }
27368 }
27369 }
27370
27371 ///
27372 /// Sets the *request* property to the given value.
27373 ///
27374 /// Even though the property as already been set when instantiating this call,
27375 /// we provide this method for API completeness.
27376 pub fn request(
27377 mut self,
27378 new_value: TestIamPermissionsRequest,
27379 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
27380 self._request = new_value;
27381 self
27382 }
27383 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
27384 ///
27385 /// Sets the *resource* path property to the given value.
27386 ///
27387 /// Even though the property as already been set when instantiating this call,
27388 /// we provide this method for API completeness.
27389 pub fn resource(
27390 mut self,
27391 new_value: &str,
27392 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
27393 self._resource = new_value.to_string();
27394 self
27395 }
27396 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27397 /// while executing the actual API request.
27398 ///
27399 /// ````text
27400 /// It should be used to handle progress information, and to implement a certain level of resilience.
27401 /// ````
27402 ///
27403 /// Sets the *delegate* property to the given value.
27404 pub fn delegate(
27405 mut self,
27406 new_value: &'a mut dyn common::Delegate,
27407 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
27408 self._delegate = Some(new_value);
27409 self
27410 }
27411
27412 /// Set any additional parameter of the query string used in the request.
27413 /// It should be used to set parameters which are not yet available through their own
27414 /// setters.
27415 ///
27416 /// Please note that this method must not be used to set any of the known parameters
27417 /// which have their own setter method. If done anyway, the request will fail.
27418 ///
27419 /// # Additional Parameters
27420 ///
27421 /// * *$.xgafv* (query-string) - V1 error format.
27422 /// * *access_token* (query-string) - OAuth access token.
27423 /// * *alt* (query-string) - Data format for response.
27424 /// * *callback* (query-string) - JSONP
27425 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27426 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27427 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27428 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27429 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27430 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27431 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27432 pub fn param<T>(
27433 mut self,
27434 name: T,
27435 value: T,
27436 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
27437 where
27438 T: AsRef<str>,
27439 {
27440 self._additional_params
27441 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27442 self
27443 }
27444
27445 /// Identifies the authorization scope for the method you are building.
27446 ///
27447 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27448 /// [`Scope::CloudPlatform`].
27449 ///
27450 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27451 /// tokens for more than one scope.
27452 ///
27453 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27454 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27455 /// sufficient, a read-write scope will do as well.
27456 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
27457 where
27458 St: AsRef<str>,
27459 {
27460 self._scopes.insert(String::from(scope.as_ref()));
27461 self
27462 }
27463 /// Identifies the authorization scope(s) for the method you are building.
27464 ///
27465 /// See [`Self::add_scope()`] for details.
27466 pub fn add_scopes<I, St>(
27467 mut self,
27468 scopes: I,
27469 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
27470 where
27471 I: IntoIterator<Item = St>,
27472 St: AsRef<str>,
27473 {
27474 self._scopes
27475 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27476 self
27477 }
27478
27479 /// Removes all scopes, and no default scope will be used either.
27480 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27481 /// for details).
27482 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
27483 self._scopes.clear();
27484 self
27485 }
27486}
27487
27488/// Retrieves the effective configuration related to the migration from Data Catalog to Dataplex Universal Catalog for a specific organization or project. If there is no specific configuration set for the resource, the setting is checked hierarchicahlly through the ancestors of the resource, starting from the resource itself.
27489///
27490/// A builder for the *locations.retrieveEffectiveConfig* method supported by a *project* resource.
27491/// It is not used directly, but through a [`ProjectMethods`] instance.
27492///
27493/// # Example
27494///
27495/// Instantiate a resource method builder
27496///
27497/// ```test_harness,no_run
27498/// # extern crate hyper;
27499/// # extern crate hyper_rustls;
27500/// # extern crate google_datacatalog1 as datacatalog1;
27501/// # async fn dox() {
27502/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27503///
27504/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27505/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27506/// # .with_native_roots()
27507/// # .unwrap()
27508/// # .https_only()
27509/// # .enable_http2()
27510/// # .build();
27511///
27512/// # let executor = hyper_util::rt::TokioExecutor::new();
27513/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27514/// # secret,
27515/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27516/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27517/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27518/// # ),
27519/// # ).build().await.unwrap();
27520///
27521/// # let client = hyper_util::client::legacy::Client::builder(
27522/// # hyper_util::rt::TokioExecutor::new()
27523/// # )
27524/// # .build(
27525/// # hyper_rustls::HttpsConnectorBuilder::new()
27526/// # .with_native_roots()
27527/// # .unwrap()
27528/// # .https_or_http()
27529/// # .enable_http2()
27530/// # .build()
27531/// # );
27532/// # let mut hub = DataCatalog::new(client, auth);
27533/// // You can configure optional parameters by calling the respective setters at will, and
27534/// // execute the final call using `doit()`.
27535/// // Values shown here are possibly random and not representative !
27536/// let result = hub.projects().locations_retrieve_effective_config("name")
27537/// .doit().await;
27538/// # }
27539/// ```
27540pub struct ProjectLocationRetrieveEffectiveConfigCall<'a, C>
27541where
27542 C: 'a,
27543{
27544 hub: &'a DataCatalog<C>,
27545 _name: String,
27546 _delegate: Option<&'a mut dyn common::Delegate>,
27547 _additional_params: HashMap<String, String>,
27548 _scopes: BTreeSet<String>,
27549}
27550
27551impl<'a, C> common::CallBuilder for ProjectLocationRetrieveEffectiveConfigCall<'a, C> {}
27552
27553impl<'a, C> ProjectLocationRetrieveEffectiveConfigCall<'a, C>
27554where
27555 C: common::Connector,
27556{
27557 /// Perform the operation you have build so far.
27558 pub async fn doit(
27559 mut self,
27560 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1MigrationConfig)> {
27561 use std::borrow::Cow;
27562 use std::io::{Read, Seek};
27563
27564 use common::{url::Params, ToParts};
27565 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27566
27567 let mut dd = common::DefaultDelegate;
27568 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27569 dlg.begin(common::MethodInfo {
27570 id: "datacatalog.projects.locations.retrieveEffectiveConfig",
27571 http_method: hyper::Method::GET,
27572 });
27573
27574 for &field in ["alt", "name"].iter() {
27575 if self._additional_params.contains_key(field) {
27576 dlg.finished(false);
27577 return Err(common::Error::FieldClash(field));
27578 }
27579 }
27580
27581 let mut params = Params::with_capacity(3 + self._additional_params.len());
27582 params.push("name", self._name);
27583
27584 params.extend(self._additional_params.iter());
27585
27586 params.push("alt", "json");
27587 let mut url = self.hub._base_url.clone() + "v1/{+name}:retrieveEffectiveConfig";
27588 if self._scopes.is_empty() {
27589 self._scopes
27590 .insert(Scope::CloudPlatform.as_ref().to_string());
27591 }
27592
27593 #[allow(clippy::single_element_loop)]
27594 for &(find_this, param_name) in [("{+name}", "name")].iter() {
27595 url = params.uri_replacement(url, param_name, find_this, true);
27596 }
27597 {
27598 let to_remove = ["name"];
27599 params.remove_params(&to_remove);
27600 }
27601
27602 let url = params.parse_with_url(&url);
27603
27604 loop {
27605 let token = match self
27606 .hub
27607 .auth
27608 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27609 .await
27610 {
27611 Ok(token) => token,
27612 Err(e) => match dlg.token(e) {
27613 Ok(token) => token,
27614 Err(e) => {
27615 dlg.finished(false);
27616 return Err(common::Error::MissingToken(e));
27617 }
27618 },
27619 };
27620 let mut req_result = {
27621 let client = &self.hub.client;
27622 dlg.pre_request();
27623 let mut req_builder = hyper::Request::builder()
27624 .method(hyper::Method::GET)
27625 .uri(url.as_str())
27626 .header(USER_AGENT, self.hub._user_agent.clone());
27627
27628 if let Some(token) = token.as_ref() {
27629 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27630 }
27631
27632 let request = req_builder
27633 .header(CONTENT_LENGTH, 0_u64)
27634 .body(common::to_body::<String>(None));
27635
27636 client.request(request.unwrap()).await
27637 };
27638
27639 match req_result {
27640 Err(err) => {
27641 if let common::Retry::After(d) = dlg.http_error(&err) {
27642 sleep(d).await;
27643 continue;
27644 }
27645 dlg.finished(false);
27646 return Err(common::Error::HttpError(err));
27647 }
27648 Ok(res) => {
27649 let (mut parts, body) = res.into_parts();
27650 let mut body = common::Body::new(body);
27651 if !parts.status.is_success() {
27652 let bytes = common::to_bytes(body).await.unwrap_or_default();
27653 let error = serde_json::from_str(&common::to_string(&bytes));
27654 let response = common::to_response(parts, bytes.into());
27655
27656 if let common::Retry::After(d) =
27657 dlg.http_failure(&response, error.as_ref().ok())
27658 {
27659 sleep(d).await;
27660 continue;
27661 }
27662
27663 dlg.finished(false);
27664
27665 return Err(match error {
27666 Ok(value) => common::Error::BadRequest(value),
27667 _ => common::Error::Failure(response),
27668 });
27669 }
27670 let response = {
27671 let bytes = common::to_bytes(body).await.unwrap_or_default();
27672 let encoded = common::to_string(&bytes);
27673 match serde_json::from_str(&encoded) {
27674 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27675 Err(error) => {
27676 dlg.response_json_decode_error(&encoded, &error);
27677 return Err(common::Error::JsonDecodeError(
27678 encoded.to_string(),
27679 error,
27680 ));
27681 }
27682 }
27683 };
27684
27685 dlg.finished(true);
27686 return Ok(response);
27687 }
27688 }
27689 }
27690 }
27691
27692 /// Required. The resource whose effective config is being retrieved.
27693 ///
27694 /// Sets the *name* path property to the given value.
27695 ///
27696 /// Even though the property as already been set when instantiating this call,
27697 /// we provide this method for API completeness.
27698 pub fn name(mut self, new_value: &str) -> ProjectLocationRetrieveEffectiveConfigCall<'a, C> {
27699 self._name = new_value.to_string();
27700 self
27701 }
27702 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27703 /// while executing the actual API request.
27704 ///
27705 /// ````text
27706 /// It should be used to handle progress information, and to implement a certain level of resilience.
27707 /// ````
27708 ///
27709 /// Sets the *delegate* property to the given value.
27710 pub fn delegate(
27711 mut self,
27712 new_value: &'a mut dyn common::Delegate,
27713 ) -> ProjectLocationRetrieveEffectiveConfigCall<'a, C> {
27714 self._delegate = Some(new_value);
27715 self
27716 }
27717
27718 /// Set any additional parameter of the query string used in the request.
27719 /// It should be used to set parameters which are not yet available through their own
27720 /// setters.
27721 ///
27722 /// Please note that this method must not be used to set any of the known parameters
27723 /// which have their own setter method. If done anyway, the request will fail.
27724 ///
27725 /// # Additional Parameters
27726 ///
27727 /// * *$.xgafv* (query-string) - V1 error format.
27728 /// * *access_token* (query-string) - OAuth access token.
27729 /// * *alt* (query-string) - Data format for response.
27730 /// * *callback* (query-string) - JSONP
27731 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27732 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27733 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27734 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27735 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27736 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27737 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27738 pub fn param<T>(
27739 mut self,
27740 name: T,
27741 value: T,
27742 ) -> ProjectLocationRetrieveEffectiveConfigCall<'a, C>
27743 where
27744 T: AsRef<str>,
27745 {
27746 self._additional_params
27747 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27748 self
27749 }
27750
27751 /// Identifies the authorization scope for the method you are building.
27752 ///
27753 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27754 /// [`Scope::CloudPlatform`].
27755 ///
27756 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27757 /// tokens for more than one scope.
27758 ///
27759 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27760 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27761 /// sufficient, a read-write scope will do as well.
27762 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRetrieveEffectiveConfigCall<'a, C>
27763 where
27764 St: AsRef<str>,
27765 {
27766 self._scopes.insert(String::from(scope.as_ref()));
27767 self
27768 }
27769 /// Identifies the authorization scope(s) for the method you are building.
27770 ///
27771 /// See [`Self::add_scope()`] for details.
27772 pub fn add_scopes<I, St>(
27773 mut self,
27774 scopes: I,
27775 ) -> ProjectLocationRetrieveEffectiveConfigCall<'a, C>
27776 where
27777 I: IntoIterator<Item = St>,
27778 St: AsRef<str>,
27779 {
27780 self._scopes
27781 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27782 self
27783 }
27784
27785 /// Removes all scopes, and no default scope will be used either.
27786 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27787 /// for details).
27788 pub fn clear_scopes(mut self) -> ProjectLocationRetrieveEffectiveConfigCall<'a, C> {
27789 self._scopes.clear();
27790 self
27791 }
27792}
27793
27794/// Sets the configuration related to the migration to Dataplex Universal Catalog for an organization or project.
27795///
27796/// A builder for the *locations.setConfig* method supported by a *project* resource.
27797/// It is not used directly, but through a [`ProjectMethods`] instance.
27798///
27799/// # Example
27800///
27801/// Instantiate a resource method builder
27802///
27803/// ```test_harness,no_run
27804/// # extern crate hyper;
27805/// # extern crate hyper_rustls;
27806/// # extern crate google_datacatalog1 as datacatalog1;
27807/// use datacatalog1::api::GoogleCloudDatacatalogV1SetConfigRequest;
27808/// # async fn dox() {
27809/// # use datacatalog1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27810///
27811/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27812/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27813/// # .with_native_roots()
27814/// # .unwrap()
27815/// # .https_only()
27816/// # .enable_http2()
27817/// # .build();
27818///
27819/// # let executor = hyper_util::rt::TokioExecutor::new();
27820/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27821/// # secret,
27822/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27823/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27824/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27825/// # ),
27826/// # ).build().await.unwrap();
27827///
27828/// # let client = hyper_util::client::legacy::Client::builder(
27829/// # hyper_util::rt::TokioExecutor::new()
27830/// # )
27831/// # .build(
27832/// # hyper_rustls::HttpsConnectorBuilder::new()
27833/// # .with_native_roots()
27834/// # .unwrap()
27835/// # .https_or_http()
27836/// # .enable_http2()
27837/// # .build()
27838/// # );
27839/// # let mut hub = DataCatalog::new(client, auth);
27840/// // As the method needs a request, you would usually fill it with the desired information
27841/// // into the respective structure. Some of the parts shown here might not be applicable !
27842/// // Values shown here are possibly random and not representative !
27843/// let mut req = GoogleCloudDatacatalogV1SetConfigRequest::default();
27844///
27845/// // You can configure optional parameters by calling the respective setters at will, and
27846/// // execute the final call using `doit()`.
27847/// // Values shown here are possibly random and not representative !
27848/// let result = hub.projects().locations_set_config(req, "name")
27849/// .doit().await;
27850/// # }
27851/// ```
27852pub struct ProjectLocationSetConfigCall<'a, C>
27853where
27854 C: 'a,
27855{
27856 hub: &'a DataCatalog<C>,
27857 _request: GoogleCloudDatacatalogV1SetConfigRequest,
27858 _name: String,
27859 _delegate: Option<&'a mut dyn common::Delegate>,
27860 _additional_params: HashMap<String, String>,
27861 _scopes: BTreeSet<String>,
27862}
27863
27864impl<'a, C> common::CallBuilder for ProjectLocationSetConfigCall<'a, C> {}
27865
27866impl<'a, C> ProjectLocationSetConfigCall<'a, C>
27867where
27868 C: common::Connector,
27869{
27870 /// Perform the operation you have build so far.
27871 pub async fn doit(
27872 mut self,
27873 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1MigrationConfig)> {
27874 use std::borrow::Cow;
27875 use std::io::{Read, Seek};
27876
27877 use common::{url::Params, ToParts};
27878 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27879
27880 let mut dd = common::DefaultDelegate;
27881 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27882 dlg.begin(common::MethodInfo {
27883 id: "datacatalog.projects.locations.setConfig",
27884 http_method: hyper::Method::POST,
27885 });
27886
27887 for &field in ["alt", "name"].iter() {
27888 if self._additional_params.contains_key(field) {
27889 dlg.finished(false);
27890 return Err(common::Error::FieldClash(field));
27891 }
27892 }
27893
27894 let mut params = Params::with_capacity(4 + self._additional_params.len());
27895 params.push("name", self._name);
27896
27897 params.extend(self._additional_params.iter());
27898
27899 params.push("alt", "json");
27900 let mut url = self.hub._base_url.clone() + "v1/{+name}:setConfig";
27901 if self._scopes.is_empty() {
27902 self._scopes
27903 .insert(Scope::CloudPlatform.as_ref().to_string());
27904 }
27905
27906 #[allow(clippy::single_element_loop)]
27907 for &(find_this, param_name) in [("{+name}", "name")].iter() {
27908 url = params.uri_replacement(url, param_name, find_this, true);
27909 }
27910 {
27911 let to_remove = ["name"];
27912 params.remove_params(&to_remove);
27913 }
27914
27915 let url = params.parse_with_url(&url);
27916
27917 let mut json_mime_type = mime::APPLICATION_JSON;
27918 let mut request_value_reader = {
27919 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27920 common::remove_json_null_values(&mut value);
27921 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27922 serde_json::to_writer(&mut dst, &value).unwrap();
27923 dst
27924 };
27925 let request_size = request_value_reader
27926 .seek(std::io::SeekFrom::End(0))
27927 .unwrap();
27928 request_value_reader
27929 .seek(std::io::SeekFrom::Start(0))
27930 .unwrap();
27931
27932 loop {
27933 let token = match self
27934 .hub
27935 .auth
27936 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27937 .await
27938 {
27939 Ok(token) => token,
27940 Err(e) => match dlg.token(e) {
27941 Ok(token) => token,
27942 Err(e) => {
27943 dlg.finished(false);
27944 return Err(common::Error::MissingToken(e));
27945 }
27946 },
27947 };
27948 request_value_reader
27949 .seek(std::io::SeekFrom::Start(0))
27950 .unwrap();
27951 let mut req_result = {
27952 let client = &self.hub.client;
27953 dlg.pre_request();
27954 let mut req_builder = hyper::Request::builder()
27955 .method(hyper::Method::POST)
27956 .uri(url.as_str())
27957 .header(USER_AGENT, self.hub._user_agent.clone());
27958
27959 if let Some(token) = token.as_ref() {
27960 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27961 }
27962
27963 let request = req_builder
27964 .header(CONTENT_TYPE, json_mime_type.to_string())
27965 .header(CONTENT_LENGTH, request_size as u64)
27966 .body(common::to_body(
27967 request_value_reader.get_ref().clone().into(),
27968 ));
27969
27970 client.request(request.unwrap()).await
27971 };
27972
27973 match req_result {
27974 Err(err) => {
27975 if let common::Retry::After(d) = dlg.http_error(&err) {
27976 sleep(d).await;
27977 continue;
27978 }
27979 dlg.finished(false);
27980 return Err(common::Error::HttpError(err));
27981 }
27982 Ok(res) => {
27983 let (mut parts, body) = res.into_parts();
27984 let mut body = common::Body::new(body);
27985 if !parts.status.is_success() {
27986 let bytes = common::to_bytes(body).await.unwrap_or_default();
27987 let error = serde_json::from_str(&common::to_string(&bytes));
27988 let response = common::to_response(parts, bytes.into());
27989
27990 if let common::Retry::After(d) =
27991 dlg.http_failure(&response, error.as_ref().ok())
27992 {
27993 sleep(d).await;
27994 continue;
27995 }
27996
27997 dlg.finished(false);
27998
27999 return Err(match error {
28000 Ok(value) => common::Error::BadRequest(value),
28001 _ => common::Error::Failure(response),
28002 });
28003 }
28004 let response = {
28005 let bytes = common::to_bytes(body).await.unwrap_or_default();
28006 let encoded = common::to_string(&bytes);
28007 match serde_json::from_str(&encoded) {
28008 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28009 Err(error) => {
28010 dlg.response_json_decode_error(&encoded, &error);
28011 return Err(common::Error::JsonDecodeError(
28012 encoded.to_string(),
28013 error,
28014 ));
28015 }
28016 }
28017 };
28018
28019 dlg.finished(true);
28020 return Ok(response);
28021 }
28022 }
28023 }
28024 }
28025
28026 ///
28027 /// Sets the *request* property to the given value.
28028 ///
28029 /// Even though the property as already been set when instantiating this call,
28030 /// we provide this method for API completeness.
28031 pub fn request(
28032 mut self,
28033 new_value: GoogleCloudDatacatalogV1SetConfigRequest,
28034 ) -> ProjectLocationSetConfigCall<'a, C> {
28035 self._request = new_value;
28036 self
28037 }
28038 /// Required. The organization or project whose config is being specified.
28039 ///
28040 /// Sets the *name* path property to the given value.
28041 ///
28042 /// Even though the property as already been set when instantiating this call,
28043 /// we provide this method for API completeness.
28044 pub fn name(mut self, new_value: &str) -> ProjectLocationSetConfigCall<'a, C> {
28045 self._name = new_value.to_string();
28046 self
28047 }
28048 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28049 /// while executing the actual API request.
28050 ///
28051 /// ````text
28052 /// It should be used to handle progress information, and to implement a certain level of resilience.
28053 /// ````
28054 ///
28055 /// Sets the *delegate* property to the given value.
28056 pub fn delegate(
28057 mut self,
28058 new_value: &'a mut dyn common::Delegate,
28059 ) -> ProjectLocationSetConfigCall<'a, C> {
28060 self._delegate = Some(new_value);
28061 self
28062 }
28063
28064 /// Set any additional parameter of the query string used in the request.
28065 /// It should be used to set parameters which are not yet available through their own
28066 /// setters.
28067 ///
28068 /// Please note that this method must not be used to set any of the known parameters
28069 /// which have their own setter method. If done anyway, the request will fail.
28070 ///
28071 /// # Additional Parameters
28072 ///
28073 /// * *$.xgafv* (query-string) - V1 error format.
28074 /// * *access_token* (query-string) - OAuth access token.
28075 /// * *alt* (query-string) - Data format for response.
28076 /// * *callback* (query-string) - JSONP
28077 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28078 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28079 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28080 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28081 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28082 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28083 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28084 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSetConfigCall<'a, C>
28085 where
28086 T: AsRef<str>,
28087 {
28088 self._additional_params
28089 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28090 self
28091 }
28092
28093 /// Identifies the authorization scope for the method you are building.
28094 ///
28095 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28096 /// [`Scope::CloudPlatform`].
28097 ///
28098 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28099 /// tokens for more than one scope.
28100 ///
28101 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28102 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28103 /// sufficient, a read-write scope will do as well.
28104 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSetConfigCall<'a, C>
28105 where
28106 St: AsRef<str>,
28107 {
28108 self._scopes.insert(String::from(scope.as_ref()));
28109 self
28110 }
28111 /// Identifies the authorization scope(s) for the method you are building.
28112 ///
28113 /// See [`Self::add_scope()`] for details.
28114 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSetConfigCall<'a, C>
28115 where
28116 I: IntoIterator<Item = St>,
28117 St: AsRef<str>,
28118 {
28119 self._scopes
28120 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28121 self
28122 }
28123
28124 /// Removes all scopes, and no default scope will be used either.
28125 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28126 /// for details).
28127 pub fn clear_scopes(mut self) -> ProjectLocationSetConfigCall<'a, C> {
28128 self._scopes.clear();
28129 self
28130 }
28131}