google_datacatalog1_beta1/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_beta1 as datacatalog1_beta1;
49/// use datacatalog1_beta1::api::GetIamPolicyRequest;
50/// use datacatalog1_beta1::{Result, Error};
51/// # async fn dox() {
52/// use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = DataCatalog::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = GetIamPolicyRequest::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_entry_groups_entries_get_iam_policy(req, "resource")
99/// .doit().await;
100///
101/// match result {
102/// Err(e) => match e {
103/// // The Error enum provides details about what exactly happened.
104/// // You can also just use its `Debug`, `Display` or `Error` traits
105/// Error::HttpError(_)
106/// |Error::Io(_)
107/// |Error::MissingAPIKey
108/// |Error::MissingToken(_)
109/// |Error::Cancelled
110/// |Error::UploadSizeLimitExceeded(_, _)
111/// |Error::Failure(_)
112/// |Error::BadRequest(_)
113/// |Error::FieldClash(_)
114/// |Error::JsonDecodeError(_, _) => println!("{}", e),
115/// },
116/// Ok(res) => println!("Success: {:?}", res),
117/// }
118/// # }
119/// ```
120#[derive(Clone)]
121pub struct DataCatalog<C> {
122 pub client: common::Client<C>,
123 pub auth: Box<dyn common::GetToken>,
124 _user_agent: String,
125 _base_url: String,
126 _root_url: String,
127}
128
129impl<C> common::Hub for DataCatalog<C> {}
130
131impl<'a, C> DataCatalog<C> {
132 pub fn new<A: 'static + common::GetToken>(
133 client: common::Client<C>,
134 auth: A,
135 ) -> DataCatalog<C> {
136 DataCatalog {
137 client,
138 auth: Box::new(auth),
139 _user_agent: "google-api-rust-client/7.0.0".to_string(),
140 _base_url: "https://datacatalog.googleapis.com/".to_string(),
141 _root_url: "https://datacatalog.googleapis.com/".to_string(),
142 }
143 }
144
145 pub fn catalog(&'a self) -> CatalogMethods<'a, C> {
146 CatalogMethods { hub: self }
147 }
148 pub fn entries(&'a self) -> EntryMethods<'a, C> {
149 EntryMethods { hub: self }
150 }
151 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
152 ProjectMethods { hub: self }
153 }
154
155 /// Set the user-agent header field to use in all requests to the server.
156 /// It defaults to `google-api-rust-client/7.0.0`.
157 ///
158 /// Returns the previously set user-agent.
159 pub fn user_agent(&mut self, agent_name: String) -> String {
160 std::mem::replace(&mut self._user_agent, agent_name)
161 }
162
163 /// Set the base url to use in all requests to the server.
164 /// It defaults to `https://datacatalog.googleapis.com/`.
165 ///
166 /// Returns the previously set base url.
167 pub fn base_url(&mut self, new_base_url: String) -> String {
168 std::mem::replace(&mut self._base_url, new_base_url)
169 }
170
171 /// Set the root url to use in all requests to the server.
172 /// It defaults to `https://datacatalog.googleapis.com/`.
173 ///
174 /// Returns the previously set root url.
175 pub fn root_url(&mut self, new_root_url: String) -> String {
176 std::mem::replace(&mut self._root_url, new_root_url)
177 }
178}
179
180// ############
181// SCHEMAS ###
182// ##########
183/// Associates `members`, or principals, with a `role`.
184///
185/// This type is not used in any activity, and only used as *part* of another schema.
186///
187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
188#[serde_with::serde_as]
189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
190pub struct Binding {
191 /// 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).
192 pub condition: Option<Expr>,
193 /// 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`.
194 pub members: Option<Vec<String>>,
195 /// 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).
196 pub role: Option<String>,
197}
198
199impl common::Part for Binding {}
200
201/// 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); }
202///
203/// # Activities
204///
205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
207///
208/// * [locations entry groups entries tags delete projects](ProjectLocationEntryGroupEntryTagDeleteCall) (response)
209/// * [locations entry groups entries delete projects](ProjectLocationEntryGroupEntryDeleteCall) (response)
210/// * [locations entry groups tags delete projects](ProjectLocationEntryGroupTagDeleteCall) (response)
211/// * [locations entry groups delete projects](ProjectLocationEntryGroupDeleteCall) (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/// Spec for a group of BigQuery tables with name pattern `[prefix]YYYYMMDD`. Context: https://cloud.google.com/bigquery/docs/partitioned-tables#partitioning_versus_sharding
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 GoogleCloudDatacatalogV1beta1BigQueryDateShardedSpec {
290 /// 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}`.
291 pub dataset: Option<String>,
292 /// Output only. Total number of shards.
293 #[serde(rename = "shardCount")]
294 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
295 pub shard_count: Option<i64>,
296 /// Output only. The table name prefix of the shards. The name of any given shard is `[table_prefix]YYYYMMDD`, for example, for shard `MyTable20180101`, the `table_prefix` is `MyTable`.
297 #[serde(rename = "tablePrefix")]
298 pub table_prefix: Option<String>,
299}
300
301impl common::Part for GoogleCloudDatacatalogV1beta1BigQueryDateShardedSpec {}
302
303/// Describes a BigQuery table.
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 GoogleCloudDatacatalogV1beta1BigQueryTableSpec {
311 /// Output only. The table source type.
312 #[serde(rename = "tableSourceType")]
313 pub table_source_type: Option<String>,
314 /// Spec of a BigQuery table. This field should only be populated if `table_source_type` is `BIGQUERY_TABLE`.
315 #[serde(rename = "tableSpec")]
316 pub table_spec: Option<GoogleCloudDatacatalogV1beta1TableSpec>,
317 /// Table view specification. This field should only be populated if `table_source_type` is `BIGQUERY_VIEW`.
318 #[serde(rename = "viewSpec")]
319 pub view_spec: Option<GoogleCloudDatacatalogV1beta1ViewSpec>,
320}
321
322impl common::Part for GoogleCloudDatacatalogV1beta1BigQueryTableSpec {}
323
324/// Representation of a column within a schema. Columns could be nested inside other columns.
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct GoogleCloudDatacatalogV1beta1ColumnSchema {
332 /// Required. Name of the column.
333 pub column: Option<String>,
334 /// Optional. Description of the column. Default value is an empty string.
335 pub description: Option<String>,
336 /// Optional. A column's mode indicates whether the values in this column are required, nullable, etc. Only `NULLABLE`, `REQUIRED` and `REPEATED` are supported. Default mode is `NULLABLE`.
337 pub mode: Option<String>,
338 /// Optional. Schema of sub-columns. A column can have zero or more sub-columns.
339 pub subcolumns: Option<Vec<GoogleCloudDatacatalogV1beta1ColumnSchema>>,
340 /// Required. Type of the column.
341 #[serde(rename = "type")]
342 pub type_: Option<String>,
343}
344
345impl common::Part for GoogleCloudDatacatalogV1beta1ColumnSchema {}
346
347/// Entry Metadata. A Data Catalog Entry resource represents another resource in Google Cloud Platform (such as a BigQuery dataset or a Pub/Sub topic), or outside of Google Cloud Platform. Clients 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, such as its schema. An Entry can also be used to attach flexible metadata, such as a Tag.
348///
349/// # Activities
350///
351/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
352/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
353///
354/// * [lookup entries](EntryLookupCall) (response)
355/// * [locations entry groups entries create projects](ProjectLocationEntryGroupEntryCreateCall) (request|response)
356/// * [locations entry groups entries get projects](ProjectLocationEntryGroupEntryGetCall) (response)
357/// * [locations entry groups entries patch projects](ProjectLocationEntryGroupEntryPatchCall) (request|response)
358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
359#[serde_with::serde_as]
360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
361pub struct GoogleCloudDatacatalogV1beta1Entry {
362 /// Specification for a group of BigQuery tables with name pattern `[prefix]YYYYMMDD`. Context: https://cloud.google.com/bigquery/docs/partitioned-tables#partitioning_versus_sharding.
363 #[serde(rename = "bigqueryDateShardedSpec")]
364 pub bigquery_date_sharded_spec: Option<GoogleCloudDatacatalogV1beta1BigQueryDateShardedSpec>,
365 /// Specification that applies to a BigQuery table. This is only valid on entries of type `TABLE`.
366 #[serde(rename = "bigqueryTableSpec")]
367 pub bigquery_table_spec: Option<GoogleCloudDatacatalogV1beta1BigQueryTableSpec>,
368 /// Entry description, which can consist of several sentences or paragraphs that describe entry contents. Default value is an empty string.
369 pub description: Option<String>,
370 /// Display information such as title and description. A short name to identify the entry, for example, "Analytics Data - Jan 2011". Default value is an empty string.
371 #[serde(rename = "displayName")]
372 pub display_name: Option<String>,
373 /// Specification that applies to a Cloud Storage fileset. This is only valid on entries of type FILESET.
374 #[serde(rename = "gcsFilesetSpec")]
375 pub gcs_fileset_spec: Option<GoogleCloudDatacatalogV1beta1GcsFilesetSpec>,
376 /// Output only. This field indicates the entry's source system that Data Catalog integrates with, such as BigQuery or Pub/Sub.
377 #[serde(rename = "integratedSystem")]
378 pub integrated_system: Option<String>,
379 /// The resource this metadata entry refers to. For Google Cloud Platform resources, `linked_resource` is the [full name of the resource](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/projectId/datasets/datasetId/tables/tableId Output only when Entry is of type in the EntryType enum. For entries with user_specified_type, this field is optional and defaults to an empty string.
380 #[serde(rename = "linkedResource")]
381 pub linked_resource: Option<String>,
382 /// Output only. Identifier. The Data Catalog resource name of the entry in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id} Note that this Entry and its child resources may not actually be stored in the location in this name.
383 pub name: Option<String>,
384 /// Schema of the entry. An entry might not have any schema attached to it.
385 pub schema: Option<GoogleCloudDatacatalogV1beta1Schema>,
386 /// Output only. Timestamps about the underlying resource, not about this Data Catalog entry. Output only when Entry is of type in the EntryType enum. For entries with user_specified_type, this field is optional and defaults to an empty timestamp.
387 #[serde(rename = "sourceSystemTimestamps")]
388 pub source_system_timestamps: Option<GoogleCloudDatacatalogV1beta1SystemTimestamps>,
389 /// The type of the entry. Only used for Entries with types in the EntryType enum.
390 #[serde(rename = "type")]
391 pub type_: Option<String>,
392 /// Output only. Statistics on the usage level of the resource.
393 #[serde(rename = "usageSignal")]
394 pub usage_signal: Option<GoogleCloudDatacatalogV1beta1UsageSignal>,
395 /// This field indicates the entry's source system that Data Catalog does not integrate with. `user_specified_system` strings must begin with a letter or underscore and can only contain letters, numbers, and underscores; are case insensitive; must be at least 1 character and at most 64 characters long.
396 #[serde(rename = "userSpecifiedSystem")]
397 pub user_specified_system: Option<String>,
398 /// Entry type if it does not fit any of the input-allowed values listed in `EntryType` enum above. When creating an entry, users should check the enum values first, if nothing matches the entry to be created, then provide a custom value, for example "my_special_type". `user_specified_type` strings must begin with a letter or underscore and can only contain letters, numbers, and underscores; are case insensitive; must be at least 1 character and at most 64 characters long. Currently, only FILESET enum value is allowed. All other entries created through Data Catalog must use `user_specified_type`.
399 #[serde(rename = "userSpecifiedType")]
400 pub user_specified_type: Option<String>,
401}
402
403impl common::RequestValue for GoogleCloudDatacatalogV1beta1Entry {}
404impl common::ResponseResult for GoogleCloudDatacatalogV1beta1Entry {}
405
406/// EntryGroup Metadata. An EntryGroup resource represents a logical grouping of zero or more Data Catalog Entry resources.
407///
408/// # Activities
409///
410/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
411/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
412///
413/// * [locations entry groups create projects](ProjectLocationEntryGroupCreateCall) (request|response)
414/// * [locations entry groups get projects](ProjectLocationEntryGroupGetCall) (response)
415/// * [locations entry groups patch projects](ProjectLocationEntryGroupPatchCall) (request|response)
416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
417#[serde_with::serde_as]
418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
419pub struct GoogleCloudDatacatalogV1beta1EntryGroup {
420 /// Output only. Timestamps about this EntryGroup. Default value is empty timestamps.
421 #[serde(rename = "dataCatalogTimestamps")]
422 pub data_catalog_timestamps: Option<GoogleCloudDatacatalogV1beta1SystemTimestamps>,
423 /// Entry group description, which can consist of several sentences or paragraphs that describe entry group contents. Default value is an empty string.
424 pub description: Option<String>,
425 /// A short name to identify the entry group, for example, "analytics data - jan 2011". Default value is an empty string.
426 #[serde(rename = "displayName")]
427 pub display_name: Option<String>,
428 /// Identifier. The resource name of the entry group in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} Note that this EntryGroup and its child resources may not actually be stored in the location in this name.
429 pub name: Option<String>,
430}
431
432impl common::RequestValue for GoogleCloudDatacatalogV1beta1EntryGroup {}
433impl common::ResponseResult for GoogleCloudDatacatalogV1beta1EntryGroup {}
434
435/// Response message for ExportTaxonomies.
436///
437/// # Activities
438///
439/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
440/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
441///
442/// * [locations taxonomies export projects](ProjectLocationTaxonomyExportCall) (response)
443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
444#[serde_with::serde_as]
445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
446pub struct GoogleCloudDatacatalogV1beta1ExportTaxonomiesResponse {
447 /// List of taxonomies and policy tags in a tree structure.
448 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1beta1SerializedTaxonomy>>,
449}
450
451impl common::ResponseResult for GoogleCloudDatacatalogV1beta1ExportTaxonomiesResponse {}
452
453/// There is no detailed description.
454///
455/// This type is not used in any activity, and only used as *part* of another schema.
456///
457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
458#[serde_with::serde_as]
459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
460pub struct GoogleCloudDatacatalogV1beta1FieldType {
461 /// Represents an enum type.
462 #[serde(rename = "enumType")]
463 pub enum_type: Option<GoogleCloudDatacatalogV1beta1FieldTypeEnumType>,
464 /// Represents primitive types - string, bool etc.
465 #[serde(rename = "primitiveType")]
466 pub primitive_type: Option<String>,
467}
468
469impl common::Part for GoogleCloudDatacatalogV1beta1FieldType {}
470
471/// There is no detailed description.
472///
473/// This type is not used in any activity, and only used as *part* of another schema.
474///
475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
476#[serde_with::serde_as]
477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
478pub struct GoogleCloudDatacatalogV1beta1FieldTypeEnumType {
479 /// no description provided
480 #[serde(rename = "allowedValues")]
481 pub allowed_values: Option<Vec<GoogleCloudDatacatalogV1beta1FieldTypeEnumTypeEnumValue>>,
482}
483
484impl common::Part for GoogleCloudDatacatalogV1beta1FieldTypeEnumType {}
485
486/// There is no detailed description.
487///
488/// This type is not used in any activity, and only used as *part* of another schema.
489///
490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
491#[serde_with::serde_as]
492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
493pub struct GoogleCloudDatacatalogV1beta1FieldTypeEnumTypeEnumValue {
494 /// Required. The display name of the enum value. Must not be an empty string.
495 #[serde(rename = "displayName")]
496 pub display_name: Option<String>,
497}
498
499impl common::Part for GoogleCloudDatacatalogV1beta1FieldTypeEnumTypeEnumValue {}
500
501/// Specifications of a single file in Cloud Storage.
502///
503/// This type is not used in any activity, and only used as *part* of another schema.
504///
505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
506#[serde_with::serde_as]
507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
508pub struct GoogleCloudDatacatalogV1beta1GcsFileSpec {
509 /// Required. The full file path. Example: `gs://bucket_name/a/b.txt`.
510 #[serde(rename = "filePath")]
511 pub file_path: Option<String>,
512 /// Output only. Timestamps about the Cloud Storage file.
513 #[serde(rename = "gcsTimestamps")]
514 pub gcs_timestamps: Option<GoogleCloudDatacatalogV1beta1SystemTimestamps>,
515 /// Output only. The size of the file, in bytes.
516 #[serde(rename = "sizeBytes")]
517 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
518 pub size_bytes: Option<i64>,
519}
520
521impl common::Part for GoogleCloudDatacatalogV1beta1GcsFileSpec {}
522
523/// Describes a Cloud Storage fileset entry.
524///
525/// This type is not used in any activity, and only used as *part* of another schema.
526///
527#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
528#[serde_with::serde_as]
529#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
530pub struct GoogleCloudDatacatalogV1beta1GcsFilesetSpec {
531 /// Required. Patterns to identify a set of files in Google Cloud Storage. See [Cloud Storage documentation](https://cloud.google.com/storage/docs/wildcards) for more information. Note that bucket wildcards are currently not supported. Examples of valid file_patterns: * `gs://bucket_name/dir/*`: matches all files within `bucket_name/dir` directory. * `gs://bucket_name/dir/**`: matches all files in `bucket_name/dir` spanning 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 `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 provide more powerful matches, for example: * `gs://bucket_name/[a-m]??.j*g`
532 #[serde(rename = "filePatterns")]
533 pub file_patterns: Option<Vec<String>>,
534 /// Output only. Sample files contained in this fileset, not all files contained in this fileset are represented here.
535 #[serde(rename = "sampleGcsFileSpecs")]
536 pub sample_gcs_file_specs: Option<Vec<GoogleCloudDatacatalogV1beta1GcsFileSpec>>,
537}
538
539impl common::Part for GoogleCloudDatacatalogV1beta1GcsFilesetSpec {}
540
541/// Request message for ImportTaxonomies.
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 taxonomies import projects](ProjectLocationTaxonomyImportCall) (request)
549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
550#[serde_with::serde_as]
551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
552pub struct GoogleCloudDatacatalogV1beta1ImportTaxonomiesRequest {
553 /// Inline source used for taxonomies to be imported.
554 #[serde(rename = "inlineSource")]
555 pub inline_source: Option<GoogleCloudDatacatalogV1beta1InlineSource>,
556}
557
558impl common::RequestValue for GoogleCloudDatacatalogV1beta1ImportTaxonomiesRequest {}
559
560/// Response message for ImportTaxonomies.
561///
562/// # Activities
563///
564/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
565/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
566///
567/// * [locations taxonomies import projects](ProjectLocationTaxonomyImportCall) (response)
568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
569#[serde_with::serde_as]
570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
571pub struct GoogleCloudDatacatalogV1beta1ImportTaxonomiesResponse {
572 /// Taxonomies that were imported.
573 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1beta1Taxonomy>>,
574}
575
576impl common::ResponseResult for GoogleCloudDatacatalogV1beta1ImportTaxonomiesResponse {}
577
578/// Inline source used for taxonomies import.
579///
580/// This type is not used in any activity, and only used as *part* of another schema.
581///
582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
583#[serde_with::serde_as]
584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
585pub struct GoogleCloudDatacatalogV1beta1InlineSource {
586 /// Required. Taxonomies to be imported.
587 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1beta1SerializedTaxonomy>>,
588}
589
590impl common::Part for GoogleCloudDatacatalogV1beta1InlineSource {}
591
592/// Response message for ListEntries.
593///
594/// # Activities
595///
596/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
597/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
598///
599/// * [locations entry groups entries list projects](ProjectLocationEntryGroupEntryListCall) (response)
600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
601#[serde_with::serde_as]
602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
603pub struct GoogleCloudDatacatalogV1beta1ListEntriesResponse {
604 /// Entry details.
605 pub entries: Option<Vec<GoogleCloudDatacatalogV1beta1Entry>>,
606 /// Token to retrieve the next page of results. It is set to empty if no items remain in results.
607 #[serde(rename = "nextPageToken")]
608 pub next_page_token: Option<String>,
609}
610
611impl common::ResponseResult for GoogleCloudDatacatalogV1beta1ListEntriesResponse {}
612
613/// Response message for ListEntryGroups.
614///
615/// # Activities
616///
617/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
618/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
619///
620/// * [locations entry groups list projects](ProjectLocationEntryGroupListCall) (response)
621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
622#[serde_with::serde_as]
623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
624pub struct GoogleCloudDatacatalogV1beta1ListEntryGroupsResponse {
625 /// EntryGroup details.
626 #[serde(rename = "entryGroups")]
627 pub entry_groups: Option<Vec<GoogleCloudDatacatalogV1beta1EntryGroup>>,
628 /// Token to retrieve the next page of results. It is set to empty if no items remain in results.
629 #[serde(rename = "nextPageToken")]
630 pub next_page_token: Option<String>,
631}
632
633impl common::ResponseResult for GoogleCloudDatacatalogV1beta1ListEntryGroupsResponse {}
634
635/// Response message for ListPolicyTags.
636///
637/// # Activities
638///
639/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
640/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
641///
642/// * [locations taxonomies policy tags list projects](ProjectLocationTaxonomyPolicyTagListCall) (response)
643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
644#[serde_with::serde_as]
645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
646pub struct GoogleCloudDatacatalogV1beta1ListPolicyTagsResponse {
647 /// Token used to retrieve the next page of results, or empty if there are no more results in the list.
648 #[serde(rename = "nextPageToken")]
649 pub next_page_token: Option<String>,
650 /// The policy tags that are in the requested taxonomy.
651 #[serde(rename = "policyTags")]
652 pub policy_tags: Option<Vec<GoogleCloudDatacatalogV1beta1PolicyTag>>,
653}
654
655impl common::ResponseResult for GoogleCloudDatacatalogV1beta1ListPolicyTagsResponse {}
656
657/// Response message for ListTags.
658///
659/// # Activities
660///
661/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
662/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
663///
664/// * [locations entry groups entries tags list projects](ProjectLocationEntryGroupEntryTagListCall) (response)
665/// * [locations entry groups tags list projects](ProjectLocationEntryGroupTagListCall) (response)
666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
667#[serde_with::serde_as]
668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
669pub struct GoogleCloudDatacatalogV1beta1ListTagsResponse {
670 /// Token to retrieve the next page of results. It is set to empty if no items remain in results.
671 #[serde(rename = "nextPageToken")]
672 pub next_page_token: Option<String>,
673 /// Tag details.
674 pub tags: Option<Vec<GoogleCloudDatacatalogV1beta1Tag>>,
675}
676
677impl common::ResponseResult for GoogleCloudDatacatalogV1beta1ListTagsResponse {}
678
679/// Response message for ListTaxonomies.
680///
681/// # Activities
682///
683/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
684/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
685///
686/// * [locations taxonomies list projects](ProjectLocationTaxonomyListCall) (response)
687#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
688#[serde_with::serde_as]
689#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
690pub struct GoogleCloudDatacatalogV1beta1ListTaxonomiesResponse {
691 /// Token used to retrieve the next page of results, or empty if there are no more results in the list.
692 #[serde(rename = "nextPageToken")]
693 pub next_page_token: Option<String>,
694 /// Taxonomies that the project contains.
695 pub taxonomies: Option<Vec<GoogleCloudDatacatalogV1beta1Taxonomy>>,
696}
697
698impl common::ResponseResult for GoogleCloudDatacatalogV1beta1ListTaxonomiesResponse {}
699
700/// Denotes one policy tag in a taxonomy (e.g. ssn). Policy Tags can be defined in a hierarchy. For example, consider the following hierarchy: Geolocation -> (LatLong, City, ZipCode). PolicyTag “Geolocation” contains three child policy tags: “LatLong”, “City”, and “ZipCode”.
701///
702/// # Activities
703///
704/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
705/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
706///
707/// * [locations taxonomies policy tags create projects](ProjectLocationTaxonomyPolicyTagCreateCall) (request|response)
708/// * [locations taxonomies policy tags get projects](ProjectLocationTaxonomyPolicyTagGetCall) (response)
709/// * [locations taxonomies policy tags patch projects](ProjectLocationTaxonomyPolicyTagPatchCall) (request|response)
710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
711#[serde_with::serde_as]
712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
713pub struct GoogleCloudDatacatalogV1beta1PolicyTag {
714 /// Output only. Resource names of child policy tags of this policy tag.
715 #[serde(rename = "childPolicyTags")]
716 pub child_policy_tags: Option<Vec<String>>,
717 /// Description of this policy tag. It must: contain only unicode characters, tabs, newlines, carriage returns and page breaks; and be at most 2000 bytes long when encoded in UTF-8. If not set, defaults to an empty description. If not set, defaults to an empty description.
718 pub description: Option<String>,
719 /// Required. User defined name of this policy tag. It must: be unique within the parent taxonomy; contain only unicode letters, numbers, underscores, dashes and spaces; not start or end with spaces; and be at most 200 bytes long when encoded in UTF-8.
720 #[serde(rename = "displayName")]
721 pub display_name: Option<String>,
722 /// Identifier. Resource name of this policy tag, whose format is: "projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{id}".
723 pub name: Option<String>,
724 /// Resource name of this policy tag's parent policy tag (e.g. for the "LatLong" policy tag in the example above, this field contains the resource name of the "Geolocation" policy tag). If empty, it means this policy tag is a top level policy tag (e.g. this field is empty for the "Geolocation" policy tag in the example above). If not set, defaults to an empty string.
725 #[serde(rename = "parentPolicyTag")]
726 pub parent_policy_tag: Option<String>,
727}
728
729impl common::RequestValue for GoogleCloudDatacatalogV1beta1PolicyTag {}
730impl common::ResponseResult for GoogleCloudDatacatalogV1beta1PolicyTag {}
731
732/// Request message for RenameTagTemplateFieldEnumValue.
733///
734/// # Activities
735///
736/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
737/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
738///
739/// * [locations tag templates fields enum values rename projects](ProjectLocationTagTemplateFieldEnumValueRenameCall) (request)
740#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
741#[serde_with::serde_as]
742#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
743pub struct GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldEnumValueRequest {
744 /// Required. The new display name of the enum value. For example, `my_new_enum_value`.
745 #[serde(rename = "newEnumValueDisplayName")]
746 pub new_enum_value_display_name: Option<String>,
747}
748
749impl common::RequestValue for GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldEnumValueRequest {}
750
751/// Request message for RenameTagTemplateField.
752///
753/// # Activities
754///
755/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
756/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
757///
758/// * [locations tag templates fields rename projects](ProjectLocationTagTemplateFieldRenameCall) (request)
759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
760#[serde_with::serde_as]
761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
762pub struct GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldRequest {
763 /// Required. The new ID of this tag template field. For example, `my_new_field`.
764 #[serde(rename = "newTagTemplateFieldId")]
765 pub new_tag_template_field_id: Option<String>,
766}
767
768impl common::RequestValue for GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldRequest {}
769
770/// Represents a schema (e.g. BigQuery, GoogleSQL, Avro schema).
771///
772/// This type is not used in any activity, and only used as *part* of another schema.
773///
774#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
775#[serde_with::serde_as]
776#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
777pub struct GoogleCloudDatacatalogV1beta1Schema {
778 /// Required. Schema of columns. A maximum of 10,000 columns and sub-columns can be specified.
779 pub columns: Option<Vec<GoogleCloudDatacatalogV1beta1ColumnSchema>>,
780}
781
782impl common::Part for GoogleCloudDatacatalogV1beta1Schema {}
783
784/// Request message for SearchCatalog.
785///
786/// # Activities
787///
788/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
789/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
790///
791/// * [search catalog](CatalogSearchCall) (request)
792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
793#[serde_with::serde_as]
794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
795pub struct GoogleCloudDatacatalogV1beta1SearchCatalogRequest {
796 /// Specifies the ordering of results, currently supported case-sensitive choices are: * `relevance`, only supports descending * `last_modified_timestamp [asc|desc]`, defaults to descending if not specified * `default` that can only be descending If not specified, defaults to `relevance` descending.
797 #[serde(rename = "orderBy")]
798 pub order_by: Option<String>,
799 /// Number of results in the search page. If <=0 then defaults to 10. Max limit for page_size is 1000. Throws an invalid argument for page_size > 1000.
800 #[serde(rename = "pageSize")]
801 pub page_size: Option<i32>,
802 /// Optional. Pagination token returned in an earlier SearchCatalogResponse.next_page_token, which indicates that this is a continuation of a prior SearchCatalogRequest call, and that the system should return the next page of data. If empty, the first page is returned.
803 #[serde(rename = "pageToken")]
804 pub page_token: Option<String>,
805 /// Optional. The query string in search query syntax. An empty query string will result in all data assets (in the specified scope) that the user has access to. Query strings can be simple as "x" or more qualified as: * name:x * column:x * description:y Note: Query tokens need to have a minimum of 3 characters for substring matching to work correctly. See [Data Catalog Search Syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference) for more information.
806 pub query: Option<String>,
807 /// Required. The scope of this search request. A `scope` that has empty `include_org_ids`, `include_project_ids` AND false `include_gcp_public_datasets` is considered invalid. Data Catalog will return an error in such a case.
808 pub scope: Option<GoogleCloudDatacatalogV1beta1SearchCatalogRequestScope>,
809}
810
811impl common::RequestValue for GoogleCloudDatacatalogV1beta1SearchCatalogRequest {}
812
813/// The criteria that select the subspace used for query matching.
814///
815/// This type is not used in any activity, and only used as *part* of another schema.
816///
817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
818#[serde_with::serde_as]
819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
820pub struct GoogleCloudDatacatalogV1beta1SearchCatalogRequestScope {
821 /// If `true`, include Google Cloud public datasets in the search results. Info on Google Cloud public datasets is available at https://cloud.google.com/public-datasets/. By default, Google Cloud public datasets are excluded.
822 #[serde(rename = "includeGcpPublicDatasets")]
823 pub include_gcp_public_datasets: Option<bool>,
824 /// The list of organization IDs to search within. To find your organization ID, follow instructions in https://cloud.google.com/resource-manager/docs/creating-managing-organization.
825 #[serde(rename = "includeOrgIds")]
826 pub include_org_ids: Option<Vec<String>>,
827 /// The list of project IDs to search within. To learn more about the distinction between project names/IDs/numbers, go to https://cloud.google.com/docs/overview/#projects.
828 #[serde(rename = "includeProjectIds")]
829 pub include_project_ids: Option<Vec<String>>,
830 /// Optional. The list of locations to search within. 1. If empty, search will be performed in all locations; 2. If any of the locations are NOT in the valid locations list, error will be returned; 3. Otherwise, search only the given locations for matching results. Typical usage is to leave this field empty. When a location is unreachable as returned in the `SearchCatalogResponse.unreachable` field, users can repeat the search request with this parameter set to get additional information on the error. Valid locations: * asia-east1 * asia-east2 * asia-northeast1 * asia-northeast2 * asia-northeast3 * asia-south1 * asia-southeast1 * australia-southeast1 * eu * europe-north1 * europe-west1 * europe-west2 * europe-west3 * europe-west4 * europe-west6 * global * northamerica-northeast1 * southamerica-east1 * us * us-central1 * us-east1 * us-east4 * us-west1 * us-west2
831 #[serde(rename = "restrictedLocations")]
832 pub restricted_locations: Option<Vec<String>>,
833}
834
835impl common::Part for GoogleCloudDatacatalogV1beta1SearchCatalogRequestScope {}
836
837/// Response message for SearchCatalog.
838///
839/// # Activities
840///
841/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
842/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
843///
844/// * [search catalog](CatalogSearchCall) (response)
845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
846#[serde_with::serde_as]
847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
848pub struct GoogleCloudDatacatalogV1beta1SearchCatalogResponse {
849 /// The token that can be used to retrieve the next page of results.
850 #[serde(rename = "nextPageToken")]
851 pub next_page_token: Option<String>,
852 /// Search results.
853 pub results: Option<Vec<GoogleCloudDatacatalogV1beta1SearchCatalogResult>>,
854 /// The approximate total number of entries matched by the query.
855 #[serde(rename = "totalSize")]
856 pub total_size: Option<i32>,
857 /// Unreachable locations. Search result does not include data from those locations. Users can get additional information on the error by repeating the search request with a more restrictive parameter -- setting the value for `SearchDataCatalogRequest.scope.restricted_locations`.
858 pub unreachable: Option<Vec<String>>,
859}
860
861impl common::ResponseResult for GoogleCloudDatacatalogV1beta1SearchCatalogResponse {}
862
863/// A result that appears in the response of a search request. Each result captures details of one entry that matches the search.
864///
865/// This type is not used in any activity, and only used as *part* of another schema.
866///
867#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
868#[serde_with::serde_as]
869#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
870pub struct GoogleCloudDatacatalogV1beta1SearchCatalogResult {
871 /// The full name of the cloud resource the entry belongs to. See: https://cloud.google.com/apis/design/resource_names#full_resource_name. Example: * `//bigquery.googleapis.com/projects/projectId/datasets/datasetId/tables/tableId`
872 #[serde(rename = "linkedResource")]
873 pub linked_resource: Option<String>,
874 /// Last-modified timestamp of the entry from the managing system.
875 #[serde(rename = "modifyTime")]
876 pub modify_time: Option<chrono::DateTime<chrono::offset::Utc>>,
877 /// The relative resource 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}`
878 #[serde(rename = "relativeResourceName")]
879 pub relative_resource_name: Option<String>,
880 /// Sub-type of the search result. This is a dot-delimited description of the resource's full type, and is the same as the value callers would provide in the "type" search facet. Examples: `entry.table`, `entry.dataStream`, `tagTemplate`.
881 #[serde(rename = "searchResultSubtype")]
882 pub search_result_subtype: Option<String>,
883 /// Type of the search result. This field can be used to determine which Get method to call to fetch the full resource.
884 #[serde(rename = "searchResultType")]
885 pub search_result_type: Option<String>,
886}
887
888impl common::Part for GoogleCloudDatacatalogV1beta1SearchCatalogResult {}
889
890/// Message representing one policy tag when exported as a nested proto.
891///
892/// This type is not used in any activity, and only used as *part* of another schema.
893///
894#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
895#[serde_with::serde_as]
896#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
897pub struct GoogleCloudDatacatalogV1beta1SerializedPolicyTag {
898 /// Children of the policy tag if any.
899 #[serde(rename = "childPolicyTags")]
900 pub child_policy_tags: Option<Vec<GoogleCloudDatacatalogV1beta1SerializedPolicyTag>>,
901 /// Description of the serialized policy tag. The length of the description is limited to 2000 bytes when encoded in UTF-8. If not set, defaults to an empty description.
902 pub description: Option<String>,
903 /// Required. Display name of the policy tag. Max 200 bytes when encoded in UTF-8.
904 #[serde(rename = "displayName")]
905 pub display_name: Option<String>,
906 /// Resource name of the policy tag. This field will be ignored when calling ImportTaxonomies.
907 #[serde(rename = "policyTag")]
908 pub policy_tag: Option<String>,
909}
910
911impl common::Part for GoogleCloudDatacatalogV1beta1SerializedPolicyTag {}
912
913/// Message capturing a taxonomy and its policy tag hierarchy as a nested proto. Used for taxonomy import/export and mutation.
914///
915/// This type is not used in any activity, and only used as *part* of another schema.
916///
917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
918#[serde_with::serde_as]
919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
920pub struct GoogleCloudDatacatalogV1beta1SerializedTaxonomy {
921 /// A list of policy types that are activated for a taxonomy.
922 #[serde(rename = "activatedPolicyTypes")]
923 pub activated_policy_types: Option<Vec<String>>,
924 /// Description of the serialized taxonomy. The length of the description is limited to 2000 bytes when encoded in UTF-8. If not set, defaults to an empty description.
925 pub description: Option<String>,
926 /// Required. Display name of the taxonomy. Max 200 bytes when encoded in UTF-8.
927 #[serde(rename = "displayName")]
928 pub display_name: Option<String>,
929 /// Top level policy tags associated with the taxonomy if any.
930 #[serde(rename = "policyTags")]
931 pub policy_tags: Option<Vec<GoogleCloudDatacatalogV1beta1SerializedPolicyTag>>,
932}
933
934impl common::Part for GoogleCloudDatacatalogV1beta1SerializedTaxonomy {}
935
936/// Timestamps about this resource according to a particular system.
937///
938/// This type is not used in any activity, and only used as *part* of another schema.
939///
940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
941#[serde_with::serde_as]
942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
943pub struct GoogleCloudDatacatalogV1beta1SystemTimestamps {
944 /// The creation time of the resource within the given system.
945 #[serde(rename = "createTime")]
946 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
947 /// Output only. The expiration time of the resource within the given system. Currently only apllicable to BigQuery resources.
948 #[serde(rename = "expireTime")]
949 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
950 /// The last-modified time of the resource within the given system.
951 #[serde(rename = "updateTime")]
952 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
953}
954
955impl common::Part for GoogleCloudDatacatalogV1beta1SystemTimestamps {}
956
957/// Normal BigQuery table spec.
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 GoogleCloudDatacatalogV1beta1TableSpec {
965 /// Output only. If the table is a dated shard, i.e., with name pattern `[prefix]YYYYMMDD`, `grouped_entry` 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.
966 #[serde(rename = "groupedEntry")]
967 pub grouped_entry: Option<String>,
968}
969
970impl common::Part for GoogleCloudDatacatalogV1beta1TableSpec {}
971
972/// Tags are used to attach custom metadata to Data Catalog resources. Tags conform to the specifications within 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.
973///
974/// # Activities
975///
976/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
977/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
978///
979/// * [locations entry groups entries tags create projects](ProjectLocationEntryGroupEntryTagCreateCall) (request|response)
980/// * [locations entry groups entries tags patch projects](ProjectLocationEntryGroupEntryTagPatchCall) (request|response)
981/// * [locations entry groups tags create projects](ProjectLocationEntryGroupTagCreateCall) (request|response)
982/// * [locations entry groups tags patch projects](ProjectLocationEntryGroupTagPatchCall) (request|response)
983#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
984#[serde_with::serde_as]
985#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
986pub struct GoogleCloudDatacatalogV1beta1Tag {
987 /// Resources like Entry can have schemas associated with them. This scope allows users to attach tags to an individual column based on that schema. For attaching a tag to a nested column, use `.` to separate the column names. Example: * `outer_column.inner_column`
988 pub column: Option<String>,
989 /// Required. This maps the ID of a tag field to the value of and additional information about that field. Valid field IDs are defined by the tag's template. A tag must have at least 1 field and at most 500 fields.
990 pub fields: Option<HashMap<String, GoogleCloudDatacatalogV1beta1TagField>>,
991 /// Identifier. The resource name of the tag in URL format. Example: * projects/{project_id}/locations/{location}/entrygroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id} where `tag_id` is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name.
992 pub name: Option<String>,
993 /// Required. The resource name of the tag template that this tag uses. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id} This field cannot be modified after creation.
994 pub template: Option<String>,
995 /// Output only. The display name of the tag template.
996 #[serde(rename = "templateDisplayName")]
997 pub template_display_name: Option<String>,
998}
999
1000impl common::RequestValue for GoogleCloudDatacatalogV1beta1Tag {}
1001impl common::ResponseResult for GoogleCloudDatacatalogV1beta1Tag {}
1002
1003/// Contains the value and supporting information for a field within a Tag.
1004///
1005/// This type is not used in any activity, and only used as *part* of another schema.
1006///
1007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1008#[serde_with::serde_as]
1009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1010pub struct GoogleCloudDatacatalogV1beta1TagField {
1011 /// Holds the value for a tag field with boolean type.
1012 #[serde(rename = "boolValue")]
1013 pub bool_value: Option<bool>,
1014 /// Output only. The display name of this field.
1015 #[serde(rename = "displayName")]
1016 pub display_name: Option<String>,
1017 /// Holds the value for a tag field with double type.
1018 #[serde(rename = "doubleValue")]
1019 pub double_value: Option<f64>,
1020 /// Holds the value for a tag field with enum type. This value must be one of the allowed values in the definition of this enum.
1021 #[serde(rename = "enumValue")]
1022 pub enum_value: Option<GoogleCloudDatacatalogV1beta1TagFieldEnumValue>,
1023 /// Output only. The order of this field with respect to other fields in this tag. It can be set in 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 do not have to be sequential.
1024 pub order: Option<i32>,
1025 /// Holds the value for a tag field with string type.
1026 #[serde(rename = "stringValue")]
1027 pub string_value: Option<String>,
1028 /// Holds the value for a tag field with timestamp type.
1029 #[serde(rename = "timestampValue")]
1030 pub timestamp_value: Option<chrono::DateTime<chrono::offset::Utc>>,
1031}
1032
1033impl common::Part for GoogleCloudDatacatalogV1beta1TagField {}
1034
1035/// Holds an enum value.
1036///
1037/// This type is not used in any activity, and only used as *part* of another schema.
1038///
1039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1040#[serde_with::serde_as]
1041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1042pub struct GoogleCloudDatacatalogV1beta1TagFieldEnumValue {
1043 /// The display name of the enum value.
1044 #[serde(rename = "displayName")]
1045 pub display_name: Option<String>,
1046}
1047
1048impl common::Part for GoogleCloudDatacatalogV1beta1TagFieldEnumValue {}
1049
1050/// A tag template defines a tag, which can have one or more typed fields. The template is used to create and attach the tag 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. See, for example, the [TagTemplate User](https://cloud.google.com/data-catalog/docs/how-to/template-user) role, which includes permission to use the tag template to tag resources.
1051///
1052/// # Activities
1053///
1054/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1055/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1056///
1057/// * [locations tag templates create projects](ProjectLocationTagTemplateCreateCall) (request|response)
1058/// * [locations tag templates get projects](ProjectLocationTagTemplateGetCall) (response)
1059/// * [locations tag templates patch projects](ProjectLocationTagTemplatePatchCall) (request|response)
1060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1061#[serde_with::serde_as]
1062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1063pub struct GoogleCloudDatacatalogV1beta1TagTemplate {
1064 /// Output only. Transfer status of the TagTemplate
1065 #[serde(rename = "dataplexTransferStatus")]
1066 pub dataplex_transfer_status: Option<String>,
1067 /// The display name for this template. Defaults to an empty string.
1068 #[serde(rename = "displayName")]
1069 pub display_name: Option<String>,
1070 /// Required. Map of tag template field IDs to the settings for the field. This map is an exhaustive list of the allowed fields. This map must contain at least one field and at most 500 fields. The keys to this map are tag template field IDs. Field IDs can contain letters (both uppercase and lowercase), numbers (0-9) and underscores (_). Field IDs must be at least 1 character long and at most 64 characters long. Field IDs must start with a letter or underscore.
1071 pub fields: Option<HashMap<String, GoogleCloudDatacatalogV1beta1TagTemplateField>>,
1072 /// Identifier. The resource name of the tag template in URL format. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id} Note that this TagTemplate and its child resources may not actually be stored in the location in this name.
1073 pub name: Option<String>,
1074}
1075
1076impl common::RequestValue for GoogleCloudDatacatalogV1beta1TagTemplate {}
1077impl common::ResponseResult for GoogleCloudDatacatalogV1beta1TagTemplate {}
1078
1079/// The template for an individual field within a tag template.
1080///
1081/// # Activities
1082///
1083/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1084/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1085///
1086/// * [locations tag templates fields enum values rename projects](ProjectLocationTagTemplateFieldEnumValueRenameCall) (response)
1087/// * [locations tag templates fields create projects](ProjectLocationTagTemplateFieldCreateCall) (request|response)
1088/// * [locations tag templates fields patch projects](ProjectLocationTagTemplateFieldPatchCall) (request|response)
1089/// * [locations tag templates fields rename projects](ProjectLocationTagTemplateFieldRenameCall) (response)
1090#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1091#[serde_with::serde_as]
1092#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1093pub struct GoogleCloudDatacatalogV1beta1TagTemplateField {
1094 /// The description for this field. Defaults to an empty string.
1095 pub description: Option<String>,
1096 /// The display name for this field. Defaults to an empty string.
1097 #[serde(rename = "displayName")]
1098 pub display_name: Option<String>,
1099 /// Whether this is a required field. Defaults to false.
1100 #[serde(rename = "isRequired")]
1101 pub is_required: Option<bool>,
1102 /// Output only. Identifier. The resource name of the tag template field in URL format. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template}/fields/{field} Note that this TagTemplateField may not actually be stored in the location in this name.
1103 pub name: Option<String>,
1104 /// The order of this field with respect to other fields in this tag template. A higher value indicates a more important field. The value can be negative. Multiple fields can have the same order, and field orders within a tag do not have to be sequential.
1105 pub order: Option<i32>,
1106 /// Required. The type of value this tag field can contain.
1107 #[serde(rename = "type")]
1108 pub type_: Option<GoogleCloudDatacatalogV1beta1FieldType>,
1109}
1110
1111impl common::RequestValue for GoogleCloudDatacatalogV1beta1TagTemplateField {}
1112impl common::ResponseResult for GoogleCloudDatacatalogV1beta1TagTemplateField {}
1113
1114/// A taxonomy is a collection of policy tags that classify data along a common axis. For instance a data *sensitivity* taxonomy could contain policy tags denoting PII such as age, zipcode, and SSN. A data *origin* taxonomy could contain policy tags to distinguish user data, employee data, partner data, public data.
1115///
1116/// # Activities
1117///
1118/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1119/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1120///
1121/// * [locations taxonomies create projects](ProjectLocationTaxonomyCreateCall) (request|response)
1122/// * [locations taxonomies get projects](ProjectLocationTaxonomyGetCall) (response)
1123/// * [locations taxonomies patch projects](ProjectLocationTaxonomyPatchCall) (request|response)
1124#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1125#[serde_with::serde_as]
1126#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1127pub struct GoogleCloudDatacatalogV1beta1Taxonomy {
1128 /// Optional. A list of policy types that are activated for this taxonomy. If not set, defaults to an empty list.
1129 #[serde(rename = "activatedPolicyTypes")]
1130 pub activated_policy_types: Option<Vec<String>>,
1131 /// Optional. Description of this taxonomy. It must: contain only unicode characters, tabs, newlines, carriage returns and page breaks; and be at most 2000 bytes long when encoded in UTF-8. If not set, defaults to an empty description.
1132 pub description: Option<String>,
1133 /// Required. User defined name of this taxonomy. It must: contain only unicode letters, numbers, underscores, dashes and spaces; not start or end with spaces; and be at most 200 bytes long when encoded in UTF-8. The taxonomy display name must be unique within an organization.
1134 #[serde(rename = "displayName")]
1135 pub display_name: Option<String>,
1136 /// Identifier. Resource name of this taxonomy, whose format is: "projects/{project_number}/locations/{location_id}/taxonomies/{id}".
1137 pub name: Option<String>,
1138 /// Output only. Number of policy tags contained in this taxonomy.
1139 #[serde(rename = "policyTagCount")]
1140 pub policy_tag_count: Option<i32>,
1141 /// 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.
1142 pub service: Option<GoogleCloudDatacatalogV1beta1TaxonomyService>,
1143 /// Output only. Timestamps about this taxonomy. Only create_time and update_time are used.
1144 #[serde(rename = "taxonomyTimestamps")]
1145 pub taxonomy_timestamps: Option<GoogleCloudDatacatalogV1beta1SystemTimestamps>,
1146}
1147
1148impl common::RequestValue for GoogleCloudDatacatalogV1beta1Taxonomy {}
1149impl common::ResponseResult for GoogleCloudDatacatalogV1beta1Taxonomy {}
1150
1151/// The source system of the Taxonomy.
1152///
1153/// This type is not used in any activity, and only used as *part* of another schema.
1154///
1155#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1156#[serde_with::serde_as]
1157#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1158pub struct GoogleCloudDatacatalogV1beta1TaxonomyService {
1159 /// The service agent for the service.
1160 pub identity: Option<String>,
1161 /// The Google Cloud service name.
1162 pub name: Option<String>,
1163}
1164
1165impl common::Part for GoogleCloudDatacatalogV1beta1TaxonomyService {}
1166
1167/// The set of all usage signals that we store in Data Catalog.
1168///
1169/// This type is not used in any activity, and only used as *part* of another schema.
1170///
1171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1172#[serde_with::serde_as]
1173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1174pub struct GoogleCloudDatacatalogV1beta1UsageSignal {
1175 /// The timestamp of the end of the usage statistics duration.
1176 #[serde(rename = "updateTime")]
1177 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1178 /// Usage statistics over each of the pre-defined time ranges, supported strings for time ranges are {"24H", "7D", "30D"}.
1179 #[serde(rename = "usageWithinTimeRange")]
1180 pub usage_within_time_range: Option<HashMap<String, GoogleCloudDatacatalogV1beta1UsageStats>>,
1181}
1182
1183impl common::Part for GoogleCloudDatacatalogV1beta1UsageSignal {}
1184
1185/// Detailed counts on the entry's usage. Caveats: - Only BigQuery tables have usage stats - The usage stats only include BigQuery query jobs - The usage stats might be underestimated, e.g. wildcard table references are not yet counted in usage computation https://cloud.google.com/bigquery/docs/querying-wildcard-tables
1186///
1187/// This type is not used in any activity, and only used as *part* of another schema.
1188///
1189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1190#[serde_with::serde_as]
1191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1192pub struct GoogleCloudDatacatalogV1beta1UsageStats {
1193 /// The number of times that the underlying entry was attempted to be used but was cancelled by the user.
1194 #[serde(rename = "totalCancellations")]
1195 pub total_cancellations: Option<f32>,
1196 /// The number of times that the underlying entry was successfully used.
1197 #[serde(rename = "totalCompletions")]
1198 pub total_completions: Option<f32>,
1199 /// Total time spent (in milliseconds) during uses the resulted in completions.
1200 #[serde(rename = "totalExecutionTimeForCompletionsMillis")]
1201 pub total_execution_time_for_completions_millis: Option<f32>,
1202 /// The number of times that the underlying entry was attempted to be used but failed.
1203 #[serde(rename = "totalFailures")]
1204 pub total_failures: Option<f32>,
1205}
1206
1207impl common::Part for GoogleCloudDatacatalogV1beta1UsageStats {}
1208
1209/// Table view specification.
1210///
1211/// This type is not used in any activity, and only used as *part* of another schema.
1212///
1213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1214#[serde_with::serde_as]
1215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1216pub struct GoogleCloudDatacatalogV1beta1ViewSpec {
1217 /// Output only. The query that defines the table view.
1218 #[serde(rename = "viewQuery")]
1219 pub view_query: Option<String>,
1220}
1221
1222impl common::Part for GoogleCloudDatacatalogV1beta1ViewSpec {}
1223
1224/// 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/).
1225///
1226/// # Activities
1227///
1228/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1229/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1230///
1231/// * [locations entry groups entries get iam policy projects](ProjectLocationEntryGroupEntryGetIamPolicyCall) (response)
1232/// * [locations entry groups get iam policy projects](ProjectLocationEntryGroupGetIamPolicyCall) (response)
1233/// * [locations entry groups set iam policy projects](ProjectLocationEntryGroupSetIamPolicyCall) (response)
1234/// * [locations tag templates get iam policy projects](ProjectLocationTagTemplateGetIamPolicyCall) (response)
1235/// * [locations tag templates set iam policy projects](ProjectLocationTagTemplateSetIamPolicyCall) (response)
1236/// * [locations taxonomies policy tags get iam policy projects](ProjectLocationTaxonomyPolicyTagGetIamPolicyCall) (response)
1237/// * [locations taxonomies policy tags set iam policy projects](ProjectLocationTaxonomyPolicyTagSetIamPolicyCall) (response)
1238/// * [locations taxonomies get iam policy projects](ProjectLocationTaxonomyGetIamPolicyCall) (response)
1239/// * [locations taxonomies set iam policy projects](ProjectLocationTaxonomySetIamPolicyCall) (response)
1240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1241#[serde_with::serde_as]
1242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1243pub struct Policy {
1244 /// 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`.
1245 pub bindings: Option<Vec<Binding>>,
1246 /// `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.
1247 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1248 pub etag: Option<Vec<u8>>,
1249 /// 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).
1250 pub version: Option<i32>,
1251}
1252
1253impl common::ResponseResult for Policy {}
1254
1255/// Request message for `SetIamPolicy` method.
1256///
1257/// # Activities
1258///
1259/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1260/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1261///
1262/// * [locations entry groups set iam policy projects](ProjectLocationEntryGroupSetIamPolicyCall) (request)
1263/// * [locations tag templates set iam policy projects](ProjectLocationTagTemplateSetIamPolicyCall) (request)
1264/// * [locations taxonomies policy tags set iam policy projects](ProjectLocationTaxonomyPolicyTagSetIamPolicyCall) (request)
1265/// * [locations taxonomies set iam policy projects](ProjectLocationTaxonomySetIamPolicyCall) (request)
1266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1267#[serde_with::serde_as]
1268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1269pub struct SetIamPolicyRequest {
1270 /// 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.
1271 pub policy: Option<Policy>,
1272}
1273
1274impl common::RequestValue for SetIamPolicyRequest {}
1275
1276/// Request message for `TestIamPermissions` method.
1277///
1278/// # Activities
1279///
1280/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1281/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1282///
1283/// * [locations entry groups entries test iam permissions projects](ProjectLocationEntryGroupEntryTestIamPermissionCall) (request)
1284/// * [locations entry groups test iam permissions projects](ProjectLocationEntryGroupTestIamPermissionCall) (request)
1285/// * [locations tag templates test iam permissions projects](ProjectLocationTagTemplateTestIamPermissionCall) (request)
1286/// * [locations taxonomies policy tags test iam permissions projects](ProjectLocationTaxonomyPolicyTagTestIamPermissionCall) (request)
1287/// * [locations taxonomies test iam permissions projects](ProjectLocationTaxonomyTestIamPermissionCall) (request)
1288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1289#[serde_with::serde_as]
1290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1291pub struct TestIamPermissionsRequest {
1292 /// 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).
1293 pub permissions: Option<Vec<String>>,
1294}
1295
1296impl common::RequestValue for TestIamPermissionsRequest {}
1297
1298/// Response message for `TestIamPermissions` method.
1299///
1300/// # Activities
1301///
1302/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1303/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1304///
1305/// * [locations entry groups entries test iam permissions projects](ProjectLocationEntryGroupEntryTestIamPermissionCall) (response)
1306/// * [locations entry groups test iam permissions projects](ProjectLocationEntryGroupTestIamPermissionCall) (response)
1307/// * [locations tag templates test iam permissions projects](ProjectLocationTagTemplateTestIamPermissionCall) (response)
1308/// * [locations taxonomies policy tags test iam permissions projects](ProjectLocationTaxonomyPolicyTagTestIamPermissionCall) (response)
1309/// * [locations taxonomies test iam permissions projects](ProjectLocationTaxonomyTestIamPermissionCall) (response)
1310#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1311#[serde_with::serde_as]
1312#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1313pub struct TestIamPermissionsResponse {
1314 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1315 pub permissions: Option<Vec<String>>,
1316}
1317
1318impl common::ResponseResult for TestIamPermissionsResponse {}
1319
1320// ###################
1321// MethodBuilders ###
1322// #################
1323
1324/// A builder providing access to all methods supported on *catalog* resources.
1325/// It is not used directly, but through the [`DataCatalog`] hub.
1326///
1327/// # Example
1328///
1329/// Instantiate a resource builder
1330///
1331/// ```test_harness,no_run
1332/// extern crate hyper;
1333/// extern crate hyper_rustls;
1334/// extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
1335///
1336/// # async fn dox() {
1337/// use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1338///
1339/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1340/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1341/// .with_native_roots()
1342/// .unwrap()
1343/// .https_only()
1344/// .enable_http2()
1345/// .build();
1346///
1347/// let executor = hyper_util::rt::TokioExecutor::new();
1348/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1349/// secret,
1350/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1351/// yup_oauth2::client::CustomHyperClientBuilder::from(
1352/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1353/// ),
1354/// ).build().await.unwrap();
1355///
1356/// let client = hyper_util::client::legacy::Client::builder(
1357/// hyper_util::rt::TokioExecutor::new()
1358/// )
1359/// .build(
1360/// hyper_rustls::HttpsConnectorBuilder::new()
1361/// .with_native_roots()
1362/// .unwrap()
1363/// .https_or_http()
1364/// .enable_http2()
1365/// .build()
1366/// );
1367/// let mut hub = DataCatalog::new(client, auth);
1368/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1369/// // like `search(...)`
1370/// // to build up your call.
1371/// let rb = hub.catalog();
1372/// # }
1373/// ```
1374pub struct CatalogMethods<'a, C>
1375where
1376 C: 'a,
1377{
1378 hub: &'a DataCatalog<C>,
1379}
1380
1381impl<'a, C> common::MethodsBuilder for CatalogMethods<'a, C> {}
1382
1383impl<'a, C> CatalogMethods<'a, C> {
1384 /// Create a builder to help you perform the following task:
1385 ///
1386 /// Searches Data Catalog for multiple resources like entries, tags that match a query. This is a custom method (https://cloud.google.com/apis/design/custom_methods) and does not return the complete resource, only the resource identifier and high level fields. Clients can subsequently call `Get` methods. Note that Data Catalog search queries do not guarantee full recall. Query results that match your query may not be returned, even in subsequent result pages. Also note that results returned (and not returned) can vary across repeated search queries. See [Data Catalog Search Syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference) for more information.
1387 ///
1388 /// # Arguments
1389 ///
1390 /// * `request` - No description provided.
1391 pub fn search(
1392 &self,
1393 request: GoogleCloudDatacatalogV1beta1SearchCatalogRequest,
1394 ) -> CatalogSearchCall<'a, C> {
1395 CatalogSearchCall {
1396 hub: self.hub,
1397 _request: request,
1398 _delegate: Default::default(),
1399 _additional_params: Default::default(),
1400 _scopes: Default::default(),
1401 }
1402 }
1403}
1404
1405/// A builder providing access to all methods supported on *entry* resources.
1406/// It is not used directly, but through the [`DataCatalog`] hub.
1407///
1408/// # Example
1409///
1410/// Instantiate a resource builder
1411///
1412/// ```test_harness,no_run
1413/// extern crate hyper;
1414/// extern crate hyper_rustls;
1415/// extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
1416///
1417/// # async fn dox() {
1418/// use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1419///
1420/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1421/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1422/// .with_native_roots()
1423/// .unwrap()
1424/// .https_only()
1425/// .enable_http2()
1426/// .build();
1427///
1428/// let executor = hyper_util::rt::TokioExecutor::new();
1429/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1430/// secret,
1431/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1432/// yup_oauth2::client::CustomHyperClientBuilder::from(
1433/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1434/// ),
1435/// ).build().await.unwrap();
1436///
1437/// let client = hyper_util::client::legacy::Client::builder(
1438/// hyper_util::rt::TokioExecutor::new()
1439/// )
1440/// .build(
1441/// hyper_rustls::HttpsConnectorBuilder::new()
1442/// .with_native_roots()
1443/// .unwrap()
1444/// .https_or_http()
1445/// .enable_http2()
1446/// .build()
1447/// );
1448/// let mut hub = DataCatalog::new(client, auth);
1449/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1450/// // like `lookup(...)`
1451/// // to build up your call.
1452/// let rb = hub.entries();
1453/// # }
1454/// ```
1455pub struct EntryMethods<'a, C>
1456where
1457 C: 'a,
1458{
1459 hub: &'a DataCatalog<C>,
1460}
1461
1462impl<'a, C> common::MethodsBuilder for EntryMethods<'a, C> {}
1463
1464impl<'a, C> EntryMethods<'a, C> {
1465 /// Create a builder to help you perform the following task:
1466 ///
1467 /// Get an entry by target resource name. This method allows clients to use the resource name from the source Google Cloud Platform service to get the Data Catalog Entry.
1468 pub fn lookup(&self) -> EntryLookupCall<'a, C> {
1469 EntryLookupCall {
1470 hub: self.hub,
1471 _sql_resource: Default::default(),
1472 _linked_resource: Default::default(),
1473 _delegate: Default::default(),
1474 _additional_params: Default::default(),
1475 _scopes: Default::default(),
1476 }
1477 }
1478}
1479
1480/// A builder providing access to all methods supported on *project* resources.
1481/// It is not used directly, but through the [`DataCatalog`] hub.
1482///
1483/// # Example
1484///
1485/// Instantiate a resource builder
1486///
1487/// ```test_harness,no_run
1488/// extern crate hyper;
1489/// extern crate hyper_rustls;
1490/// extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
1491///
1492/// # async fn dox() {
1493/// use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1494///
1495/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1496/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1497/// .with_native_roots()
1498/// .unwrap()
1499/// .https_only()
1500/// .enable_http2()
1501/// .build();
1502///
1503/// let executor = hyper_util::rt::TokioExecutor::new();
1504/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1505/// secret,
1506/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1507/// yup_oauth2::client::CustomHyperClientBuilder::from(
1508/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1509/// ),
1510/// ).build().await.unwrap();
1511///
1512/// let client = hyper_util::client::legacy::Client::builder(
1513/// hyper_util::rt::TokioExecutor::new()
1514/// )
1515/// .build(
1516/// hyper_rustls::HttpsConnectorBuilder::new()
1517/// .with_native_roots()
1518/// .unwrap()
1519/// .https_or_http()
1520/// .enable_http2()
1521/// .build()
1522/// );
1523/// let mut hub = DataCatalog::new(client, auth);
1524/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1525/// // 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_list(...)`, `locations_entry_groups_entries_patch(...)`, `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_test_iam_permissions(...)`, `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_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_set_iam_policy(...)` and `locations_taxonomies_test_iam_permissions(...)`
1526/// // to build up your call.
1527/// let rb = hub.projects();
1528/// # }
1529/// ```
1530pub struct ProjectMethods<'a, C>
1531where
1532 C: 'a,
1533{
1534 hub: &'a DataCatalog<C>,
1535}
1536
1537impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1538
1539impl<'a, C> ProjectMethods<'a, C> {
1540 /// Create a builder to help you perform the following task:
1541 ///
1542 /// Creates a tag on an Entry. Note: The project identified by the `parent` parameter for the [tag](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be from the same organization.
1543 ///
1544 /// # Arguments
1545 ///
1546 /// * `request` - No description provided.
1547 /// * `parent` - Required. The name of the resource to attach this tag to. Tags can be attached to Entries. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id} Note that this Tag and its child resources may not actually be stored in the location in this name.
1548 pub fn locations_entry_groups_entries_tags_create(
1549 &self,
1550 request: GoogleCloudDatacatalogV1beta1Tag,
1551 parent: &str,
1552 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
1553 ProjectLocationEntryGroupEntryTagCreateCall {
1554 hub: self.hub,
1555 _request: request,
1556 _parent: parent.to_string(),
1557 _delegate: Default::default(),
1558 _additional_params: Default::default(),
1559 _scopes: Default::default(),
1560 }
1561 }
1562
1563 /// Create a builder to help you perform the following task:
1564 ///
1565 /// Deletes a tag.
1566 ///
1567 /// # Arguments
1568 ///
1569 /// * `name` - Required. The name of the tag to delete. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id}
1570 pub fn locations_entry_groups_entries_tags_delete(
1571 &self,
1572 name: &str,
1573 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
1574 ProjectLocationEntryGroupEntryTagDeleteCall {
1575 hub: self.hub,
1576 _name: name.to_string(),
1577 _delegate: Default::default(),
1578 _additional_params: Default::default(),
1579 _scopes: Default::default(),
1580 }
1581 }
1582
1583 /// Create a builder to help you perform the following task:
1584 ///
1585 /// Lists tags assigned to an Entry. The columns in the response are lowercased.
1586 ///
1587 /// # Arguments
1588 ///
1589 /// * `parent` - Required. The name of the Data Catalog resource to list the tags of. The resource could be an Entry or an EntryGroup. Examples: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
1590 pub fn locations_entry_groups_entries_tags_list(
1591 &self,
1592 parent: &str,
1593 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
1594 ProjectLocationEntryGroupEntryTagListCall {
1595 hub: self.hub,
1596 _parent: parent.to_string(),
1597 _page_token: Default::default(),
1598 _page_size: Default::default(),
1599 _delegate: Default::default(),
1600 _additional_params: Default::default(),
1601 _scopes: Default::default(),
1602 }
1603 }
1604
1605 /// Create a builder to help you perform the following task:
1606 ///
1607 /// Updates an existing tag.
1608 ///
1609 /// # Arguments
1610 ///
1611 /// * `request` - No description provided.
1612 /// * `name` - Identifier. The resource name of the tag in URL format. Example: * projects/{project_id}/locations/{location}/entrygroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id} where `tag_id` is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name.
1613 pub fn locations_entry_groups_entries_tags_patch(
1614 &self,
1615 request: GoogleCloudDatacatalogV1beta1Tag,
1616 name: &str,
1617 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
1618 ProjectLocationEntryGroupEntryTagPatchCall {
1619 hub: self.hub,
1620 _request: request,
1621 _name: name.to_string(),
1622 _update_mask: Default::default(),
1623 _delegate: Default::default(),
1624 _additional_params: Default::default(),
1625 _scopes: Default::default(),
1626 }
1627 }
1628
1629 /// Create a builder to help you perform the following task:
1630 ///
1631 /// Creates an entry. Only entries of 'FILESET' type or user-specified type can be created. Users should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information). A maximum of 100,000 entries may be created per entry group.
1632 ///
1633 /// # Arguments
1634 ///
1635 /// * `request` - No description provided.
1636 /// * `parent` - Required. The name of the entry group this entry is in. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} Note that this Entry and its child resources may not actually be stored in the location in this name.
1637 pub fn locations_entry_groups_entries_create(
1638 &self,
1639 request: GoogleCloudDatacatalogV1beta1Entry,
1640 parent: &str,
1641 ) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
1642 ProjectLocationEntryGroupEntryCreateCall {
1643 hub: self.hub,
1644 _request: request,
1645 _parent: parent.to_string(),
1646 _entry_id: Default::default(),
1647 _delegate: Default::default(),
1648 _additional_params: Default::default(),
1649 _scopes: Default::default(),
1650 }
1651 }
1652
1653 /// Create a builder to help you perform the following task:
1654 ///
1655 /// Deletes an existing entry. Only entries created through CreateEntry method can be deleted. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
1656 ///
1657 /// # Arguments
1658 ///
1659 /// * `name` - Required. The name of the entry. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
1660 pub fn locations_entry_groups_entries_delete(
1661 &self,
1662 name: &str,
1663 ) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
1664 ProjectLocationEntryGroupEntryDeleteCall {
1665 hub: self.hub,
1666 _name: name.to_string(),
1667 _delegate: Default::default(),
1668 _additional_params: Default::default(),
1669 _scopes: Default::default(),
1670 }
1671 }
1672
1673 /// Create a builder to help you perform the following task:
1674 ///
1675 /// Gets an entry.
1676 ///
1677 /// # Arguments
1678 ///
1679 /// * `name` - Required. The name of the entry. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
1680 pub fn locations_entry_groups_entries_get(
1681 &self,
1682 name: &str,
1683 ) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
1684 ProjectLocationEntryGroupEntryGetCall {
1685 hub: self.hub,
1686 _name: name.to_string(),
1687 _delegate: Default::default(),
1688 _additional_params: Default::default(),
1689 _scopes: Default::default(),
1690 }
1691 }
1692
1693 /// Create a builder to help you perform the following task:
1694 ///
1695 /// Gets the access control policy for a resource. A `NOT_FOUND` error is returned if the resource does not exist. An empty policy is returned if the resource exists but does not have a policy set on it. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entries.getIamPolicy` to get policies on entries. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
1696 ///
1697 /// # Arguments
1698 ///
1699 /// * `request` - No description provided.
1700 /// * `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.
1701 pub fn locations_entry_groups_entries_get_iam_policy(
1702 &self,
1703 request: GetIamPolicyRequest,
1704 resource: &str,
1705 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
1706 ProjectLocationEntryGroupEntryGetIamPolicyCall {
1707 hub: self.hub,
1708 _request: request,
1709 _resource: resource.to_string(),
1710 _delegate: Default::default(),
1711 _additional_params: Default::default(),
1712 _scopes: Default::default(),
1713 }
1714 }
1715
1716 /// Create a builder to help you perform the following task:
1717 ///
1718 /// Lists entries.
1719 ///
1720 /// # Arguments
1721 ///
1722 /// * `parent` - Required. The name of the entry group that contains the entries, which can be provided in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}
1723 pub fn locations_entry_groups_entries_list(
1724 &self,
1725 parent: &str,
1726 ) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
1727 ProjectLocationEntryGroupEntryListCall {
1728 hub: self.hub,
1729 _parent: parent.to_string(),
1730 _read_mask: Default::default(),
1731 _page_token: Default::default(),
1732 _page_size: Default::default(),
1733 _delegate: Default::default(),
1734 _additional_params: Default::default(),
1735 _scopes: Default::default(),
1736 }
1737 }
1738
1739 /// Create a builder to help you perform the following task:
1740 ///
1741 /// Updates an existing entry. Users should enable the Data Catalog API in the project identified by the `entry.name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
1742 ///
1743 /// # Arguments
1744 ///
1745 /// * `request` - No description provided.
1746 /// * `name` - Output only. Identifier. The Data Catalog resource name of the entry in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id} Note that this Entry and its child resources may not actually be stored in the location in this name.
1747 pub fn locations_entry_groups_entries_patch(
1748 &self,
1749 request: GoogleCloudDatacatalogV1beta1Entry,
1750 name: &str,
1751 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
1752 ProjectLocationEntryGroupEntryPatchCall {
1753 hub: self.hub,
1754 _request: request,
1755 _name: name.to_string(),
1756 _update_mask: Default::default(),
1757 _delegate: Default::default(),
1758 _additional_params: Default::default(),
1759 _scopes: Default::default(),
1760 }
1761 }
1762
1763 /// Create a builder to help you perform the following task:
1764 ///
1765 /// Returns the caller's permissions on a resource. If the resource does not exist, an empty set of permissions is returned (We don't return a `NOT_FOUND` error). Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. A caller is not required to have Google IAM permission to make this request.
1766 ///
1767 /// # Arguments
1768 ///
1769 /// * `request` - No description provided.
1770 /// * `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.
1771 pub fn locations_entry_groups_entries_test_iam_permissions(
1772 &self,
1773 request: TestIamPermissionsRequest,
1774 resource: &str,
1775 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
1776 ProjectLocationEntryGroupEntryTestIamPermissionCall {
1777 hub: self.hub,
1778 _request: request,
1779 _resource: resource.to_string(),
1780 _delegate: Default::default(),
1781 _additional_params: Default::default(),
1782 _scopes: Default::default(),
1783 }
1784 }
1785
1786 /// Create a builder to help you perform the following task:
1787 ///
1788 /// Creates a tag on an Entry. Note: The project identified by the `parent` parameter for the [tag](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be from the same organization.
1789 ///
1790 /// # Arguments
1791 ///
1792 /// * `request` - No description provided.
1793 /// * `parent` - Required. The name of the resource to attach this tag to. Tags can be attached to Entries. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id} Note that this Tag and its child resources may not actually be stored in the location in this name.
1794 pub fn locations_entry_groups_tags_create(
1795 &self,
1796 request: GoogleCloudDatacatalogV1beta1Tag,
1797 parent: &str,
1798 ) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
1799 ProjectLocationEntryGroupTagCreateCall {
1800 hub: self.hub,
1801 _request: request,
1802 _parent: parent.to_string(),
1803 _delegate: Default::default(),
1804 _additional_params: Default::default(),
1805 _scopes: Default::default(),
1806 }
1807 }
1808
1809 /// Create a builder to help you perform the following task:
1810 ///
1811 /// Deletes a tag.
1812 ///
1813 /// # Arguments
1814 ///
1815 /// * `name` - Required. The name of the tag to delete. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id}
1816 pub fn locations_entry_groups_tags_delete(
1817 &self,
1818 name: &str,
1819 ) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
1820 ProjectLocationEntryGroupTagDeleteCall {
1821 hub: self.hub,
1822 _name: name.to_string(),
1823 _delegate: Default::default(),
1824 _additional_params: Default::default(),
1825 _scopes: Default::default(),
1826 }
1827 }
1828
1829 /// Create a builder to help you perform the following task:
1830 ///
1831 /// Lists tags assigned to an Entry. The columns in the response are lowercased.
1832 ///
1833 /// # Arguments
1834 ///
1835 /// * `parent` - Required. The name of the Data Catalog resource to list the tags of. The resource could be an Entry or an EntryGroup. Examples: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
1836 pub fn locations_entry_groups_tags_list(
1837 &self,
1838 parent: &str,
1839 ) -> ProjectLocationEntryGroupTagListCall<'a, C> {
1840 ProjectLocationEntryGroupTagListCall {
1841 hub: self.hub,
1842 _parent: parent.to_string(),
1843 _page_token: Default::default(),
1844 _page_size: Default::default(),
1845 _delegate: Default::default(),
1846 _additional_params: Default::default(),
1847 _scopes: Default::default(),
1848 }
1849 }
1850
1851 /// Create a builder to help you perform the following task:
1852 ///
1853 /// Updates an existing tag.
1854 ///
1855 /// # Arguments
1856 ///
1857 /// * `request` - No description provided.
1858 /// * `name` - Identifier. The resource name of the tag in URL format. Example: * projects/{project_id}/locations/{location}/entrygroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id} where `tag_id` is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name.
1859 pub fn locations_entry_groups_tags_patch(
1860 &self,
1861 request: GoogleCloudDatacatalogV1beta1Tag,
1862 name: &str,
1863 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
1864 ProjectLocationEntryGroupTagPatchCall {
1865 hub: self.hub,
1866 _request: request,
1867 _name: name.to_string(),
1868 _update_mask: Default::default(),
1869 _delegate: Default::default(),
1870 _additional_params: Default::default(),
1871 _scopes: Default::default(),
1872 }
1873 }
1874
1875 /// Create a builder to help you perform the following task:
1876 ///
1877 /// A maximum of 10,000 entry groups may be created per organization across all locations. Users should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
1878 ///
1879 /// # Arguments
1880 ///
1881 /// * `request` - No description provided.
1882 /// * `parent` - Required. The name of the project this entry group is in. Example: * projects/{project_id}/locations/{location} Note that this EntryGroup and its child resources may not actually be stored in the location in this name.
1883 pub fn locations_entry_groups_create(
1884 &self,
1885 request: GoogleCloudDatacatalogV1beta1EntryGroup,
1886 parent: &str,
1887 ) -> ProjectLocationEntryGroupCreateCall<'a, C> {
1888 ProjectLocationEntryGroupCreateCall {
1889 hub: self.hub,
1890 _request: request,
1891 _parent: parent.to_string(),
1892 _entry_group_id: Default::default(),
1893 _delegate: Default::default(),
1894 _additional_params: Default::default(),
1895 _scopes: Default::default(),
1896 }
1897 }
1898
1899 /// Create a builder to help you perform the following task:
1900 ///
1901 /// Deletes an EntryGroup. Only entry groups that do not contain entries can be deleted. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
1902 ///
1903 /// # Arguments
1904 ///
1905 /// * `name` - Required. The name of the entry group. For example, `projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}`.
1906 pub fn locations_entry_groups_delete(
1907 &self,
1908 name: &str,
1909 ) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
1910 ProjectLocationEntryGroupDeleteCall {
1911 hub: self.hub,
1912 _name: name.to_string(),
1913 _force: Default::default(),
1914 _delegate: Default::default(),
1915 _additional_params: Default::default(),
1916 _scopes: Default::default(),
1917 }
1918 }
1919
1920 /// Create a builder to help you perform the following task:
1921 ///
1922 /// Gets an EntryGroup.
1923 ///
1924 /// # Arguments
1925 ///
1926 /// * `name` - Required. The name of the entry group. For example, `projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}`.
1927 pub fn locations_entry_groups_get(
1928 &self,
1929 name: &str,
1930 ) -> ProjectLocationEntryGroupGetCall<'a, C> {
1931 ProjectLocationEntryGroupGetCall {
1932 hub: self.hub,
1933 _name: name.to_string(),
1934 _read_mask: Default::default(),
1935 _delegate: Default::default(),
1936 _additional_params: Default::default(),
1937 _scopes: Default::default(),
1938 }
1939 }
1940
1941 /// Create a builder to help you perform the following task:
1942 ///
1943 /// Gets the access control policy for a resource. A `NOT_FOUND` error is returned if the resource does not exist. An empty policy is returned if the resource exists but does not have a policy set on it. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entries.getIamPolicy` to get policies on entries. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
1944 ///
1945 /// # Arguments
1946 ///
1947 /// * `request` - No description provided.
1948 /// * `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.
1949 pub fn locations_entry_groups_get_iam_policy(
1950 &self,
1951 request: GetIamPolicyRequest,
1952 resource: &str,
1953 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
1954 ProjectLocationEntryGroupGetIamPolicyCall {
1955 hub: self.hub,
1956 _request: request,
1957 _resource: resource.to_string(),
1958 _delegate: Default::default(),
1959 _additional_params: Default::default(),
1960 _scopes: Default::default(),
1961 }
1962 }
1963
1964 /// Create a builder to help you perform the following task:
1965 ///
1966 /// Lists entry groups.
1967 ///
1968 /// # Arguments
1969 ///
1970 /// * `parent` - Required. The name of the location that contains the entry groups, which can be provided in URL format. Example: * projects/{project_id}/locations/{location}
1971 pub fn locations_entry_groups_list(
1972 &self,
1973 parent: &str,
1974 ) -> ProjectLocationEntryGroupListCall<'a, C> {
1975 ProjectLocationEntryGroupListCall {
1976 hub: self.hub,
1977 _parent: parent.to_string(),
1978 _page_token: Default::default(),
1979 _page_size: Default::default(),
1980 _delegate: Default::default(),
1981 _additional_params: Default::default(),
1982 _scopes: Default::default(),
1983 }
1984 }
1985
1986 /// Create a builder to help you perform the following task:
1987 ///
1988 /// Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by the `entry_group.name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
1989 ///
1990 /// # Arguments
1991 ///
1992 /// * `request` - No description provided.
1993 /// * `name` - Identifier. The resource name of the entry group in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} Note that this EntryGroup and its child resources may not actually be stored in the location in this name.
1994 pub fn locations_entry_groups_patch(
1995 &self,
1996 request: GoogleCloudDatacatalogV1beta1EntryGroup,
1997 name: &str,
1998 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
1999 ProjectLocationEntryGroupPatchCall {
2000 hub: self.hub,
2001 _request: request,
2002 _name: name.to_string(),
2003 _update_mask: Default::default(),
2004 _delegate: Default::default(),
2005 _additional_params: Default::default(),
2006 _scopes: Default::default(),
2007 }
2008 }
2009
2010 /// Create a builder to help you perform the following task:
2011 ///
2012 /// Sets the access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entries.setIamPolicy` to set policies on entries. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
2013 ///
2014 /// # Arguments
2015 ///
2016 /// * `request` - No description provided.
2017 /// * `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.
2018 pub fn locations_entry_groups_set_iam_policy(
2019 &self,
2020 request: SetIamPolicyRequest,
2021 resource: &str,
2022 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
2023 ProjectLocationEntryGroupSetIamPolicyCall {
2024 hub: self.hub,
2025 _request: request,
2026 _resource: resource.to_string(),
2027 _delegate: Default::default(),
2028 _additional_params: Default::default(),
2029 _scopes: Default::default(),
2030 }
2031 }
2032
2033 /// Create a builder to help you perform the following task:
2034 ///
2035 /// Returns the caller's permissions on a resource. If the resource does not exist, an empty set of permissions is returned (We don't return a `NOT_FOUND` error). Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. A caller is not required to have Google IAM permission to make this request.
2036 ///
2037 /// # Arguments
2038 ///
2039 /// * `request` - No description provided.
2040 /// * `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.
2041 pub fn locations_entry_groups_test_iam_permissions(
2042 &self,
2043 request: TestIamPermissionsRequest,
2044 resource: &str,
2045 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
2046 ProjectLocationEntryGroupTestIamPermissionCall {
2047 hub: self.hub,
2048 _request: request,
2049 _resource: resource.to_string(),
2050 _delegate: Default::default(),
2051 _additional_params: Default::default(),
2052 _scopes: Default::default(),
2053 }
2054 }
2055
2056 /// Create a builder to help you perform the following task:
2057 ///
2058 /// Renames an enum value in a tag template. The enum values have to be unique within one enum field. Thus, an enum value cannot be renamed with a name used in any other enum value within the same enum field.
2059 ///
2060 /// # Arguments
2061 ///
2062 /// * `request` - No description provided.
2063 /// * `name` - Required. The name of the enum field value. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}/enumValues/{enum_value_display_name}
2064 pub fn locations_tag_templates_fields_enum_values_rename(
2065 &self,
2066 request: GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldEnumValueRequest,
2067 name: &str,
2068 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
2069 ProjectLocationTagTemplateFieldEnumValueRenameCall {
2070 hub: self.hub,
2071 _request: request,
2072 _name: name.to_string(),
2073 _delegate: Default::default(),
2074 _additional_params: Default::default(),
2075 _scopes: Default::default(),
2076 }
2077 }
2078
2079 /// Create a builder to help you perform the following task:
2080 ///
2081 /// Creates a field in a tag template. The user should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
2082 ///
2083 /// # Arguments
2084 ///
2085 /// * `request` - No description provided.
2086 /// * `parent` - Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions). Example: * projects/{project_id}/locations/us-central1/tagTemplates/{tag_template_id}
2087 pub fn locations_tag_templates_fields_create(
2088 &self,
2089 request: GoogleCloudDatacatalogV1beta1TagTemplateField,
2090 parent: &str,
2091 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
2092 ProjectLocationTagTemplateFieldCreateCall {
2093 hub: self.hub,
2094 _request: request,
2095 _parent: parent.to_string(),
2096 _tag_template_field_id: Default::default(),
2097 _delegate: Default::default(),
2098 _additional_params: Default::default(),
2099 _scopes: Default::default(),
2100 }
2101 }
2102
2103 /// Create a builder to help you perform the following task:
2104 ///
2105 /// Deletes a field in a tag template and all uses of that field. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
2106 ///
2107 /// # Arguments
2108 ///
2109 /// * `name` - Required. The name of the tag template field to delete. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
2110 pub fn locations_tag_templates_fields_delete(
2111 &self,
2112 name: &str,
2113 ) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
2114 ProjectLocationTagTemplateFieldDeleteCall {
2115 hub: self.hub,
2116 _name: name.to_string(),
2117 _force: Default::default(),
2118 _delegate: Default::default(),
2119 _additional_params: Default::default(),
2120 _scopes: Default::default(),
2121 }
2122 }
2123
2124 /// Create a builder to help you perform the following task:
2125 ///
2126 /// Updates a field in a tag template. This method cannot be used to update the field type. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
2127 ///
2128 /// # Arguments
2129 ///
2130 /// * `request` - No description provided.
2131 /// * `name` - Required. The name of the tag template field. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
2132 pub fn locations_tag_templates_fields_patch(
2133 &self,
2134 request: GoogleCloudDatacatalogV1beta1TagTemplateField,
2135 name: &str,
2136 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
2137 ProjectLocationTagTemplateFieldPatchCall {
2138 hub: self.hub,
2139 _request: request,
2140 _name: name.to_string(),
2141 _update_mask: Default::default(),
2142 _delegate: Default::default(),
2143 _additional_params: Default::default(),
2144 _scopes: Default::default(),
2145 }
2146 }
2147
2148 /// Create a builder to help you perform the following task:
2149 ///
2150 /// Renames a field in a tag template. The user should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
2151 ///
2152 /// # Arguments
2153 ///
2154 /// * `request` - No description provided.
2155 /// * `name` - Required. The name of the tag template. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
2156 pub fn locations_tag_templates_fields_rename(
2157 &self,
2158 request: GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldRequest,
2159 name: &str,
2160 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
2161 ProjectLocationTagTemplateFieldRenameCall {
2162 hub: self.hub,
2163 _request: request,
2164 _name: name.to_string(),
2165 _delegate: Default::default(),
2166 _additional_params: Default::default(),
2167 _scopes: Default::default(),
2168 }
2169 }
2170
2171 /// Create a builder to help you perform the following task:
2172 ///
2173 /// Creates a tag template. The user should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
2174 ///
2175 /// # Arguments
2176 ///
2177 /// * `request` - No description provided.
2178 /// * `parent` - Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions. Example: * projects/{project_id}/locations/us-central1
2179 pub fn locations_tag_templates_create(
2180 &self,
2181 request: GoogleCloudDatacatalogV1beta1TagTemplate,
2182 parent: &str,
2183 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
2184 ProjectLocationTagTemplateCreateCall {
2185 hub: self.hub,
2186 _request: request,
2187 _parent: parent.to_string(),
2188 _tag_template_id: Default::default(),
2189 _delegate: Default::default(),
2190 _additional_params: Default::default(),
2191 _scopes: Default::default(),
2192 }
2193 }
2194
2195 /// Create a builder to help you perform the following task:
2196 ///
2197 /// Deletes a tag template and all tags using the template. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
2198 ///
2199 /// # Arguments
2200 ///
2201 /// * `name` - Required. The name of the tag template to delete. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}
2202 pub fn locations_tag_templates_delete(
2203 &self,
2204 name: &str,
2205 ) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
2206 ProjectLocationTagTemplateDeleteCall {
2207 hub: self.hub,
2208 _name: name.to_string(),
2209 _force: Default::default(),
2210 _delegate: Default::default(),
2211 _additional_params: Default::default(),
2212 _scopes: Default::default(),
2213 }
2214 }
2215
2216 /// Create a builder to help you perform the following task:
2217 ///
2218 /// Gets a tag template.
2219 ///
2220 /// # Arguments
2221 ///
2222 /// * `name` - Required. The name of the tag template. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}
2223 pub fn locations_tag_templates_get(
2224 &self,
2225 name: &str,
2226 ) -> ProjectLocationTagTemplateGetCall<'a, C> {
2227 ProjectLocationTagTemplateGetCall {
2228 hub: self.hub,
2229 _name: name.to_string(),
2230 _delegate: Default::default(),
2231 _additional_params: Default::default(),
2232 _scopes: Default::default(),
2233 }
2234 }
2235
2236 /// Create a builder to help you perform the following task:
2237 ///
2238 /// Gets the access control policy for a resource. A `NOT_FOUND` error is returned if the resource does not exist. An empty policy is returned if the resource exists but does not have a policy set on it. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entries.getIamPolicy` to get policies on entries. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
2239 ///
2240 /// # Arguments
2241 ///
2242 /// * `request` - No description provided.
2243 /// * `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.
2244 pub fn locations_tag_templates_get_iam_policy(
2245 &self,
2246 request: GetIamPolicyRequest,
2247 resource: &str,
2248 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
2249 ProjectLocationTagTemplateGetIamPolicyCall {
2250 hub: self.hub,
2251 _request: request,
2252 _resource: resource.to_string(),
2253 _delegate: Default::default(),
2254 _additional_params: Default::default(),
2255 _scopes: Default::default(),
2256 }
2257 }
2258
2259 /// Create a builder to help you perform the following task:
2260 ///
2261 /// Updates a tag template. This method cannot be used to update the fields of a template. The tag template fields are represented as separate resources and should be updated using their own create/update/delete methods. Users should enable the Data Catalog API in the project identified by the `tag_template.name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
2262 ///
2263 /// # Arguments
2264 ///
2265 /// * `request` - No description provided.
2266 /// * `name` - Identifier. The resource name of the tag template in URL format. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id} Note that this TagTemplate and its child resources may not actually be stored in the location in this name.
2267 pub fn locations_tag_templates_patch(
2268 &self,
2269 request: GoogleCloudDatacatalogV1beta1TagTemplate,
2270 name: &str,
2271 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
2272 ProjectLocationTagTemplatePatchCall {
2273 hub: self.hub,
2274 _request: request,
2275 _name: name.to_string(),
2276 _update_mask: Default::default(),
2277 _delegate: Default::default(),
2278 _additional_params: Default::default(),
2279 _scopes: Default::default(),
2280 }
2281 }
2282
2283 /// Create a builder to help you perform the following task:
2284 ///
2285 /// Sets the access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entries.setIamPolicy` to set policies on entries. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
2286 ///
2287 /// # Arguments
2288 ///
2289 /// * `request` - No description provided.
2290 /// * `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.
2291 pub fn locations_tag_templates_set_iam_policy(
2292 &self,
2293 request: SetIamPolicyRequest,
2294 resource: &str,
2295 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
2296 ProjectLocationTagTemplateSetIamPolicyCall {
2297 hub: self.hub,
2298 _request: request,
2299 _resource: resource.to_string(),
2300 _delegate: Default::default(),
2301 _additional_params: Default::default(),
2302 _scopes: Default::default(),
2303 }
2304 }
2305
2306 /// Create a builder to help you perform the following task:
2307 ///
2308 /// Returns the caller's permissions on a resource. If the resource does not exist, an empty set of permissions is returned (We don't return a `NOT_FOUND` error). Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. A caller is not required to have Google IAM permission to make this request.
2309 ///
2310 /// # Arguments
2311 ///
2312 /// * `request` - No description provided.
2313 /// * `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.
2314 pub fn locations_tag_templates_test_iam_permissions(
2315 &self,
2316 request: TestIamPermissionsRequest,
2317 resource: &str,
2318 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
2319 ProjectLocationTagTemplateTestIamPermissionCall {
2320 hub: self.hub,
2321 _request: request,
2322 _resource: resource.to_string(),
2323 _delegate: Default::default(),
2324 _additional_params: Default::default(),
2325 _scopes: Default::default(),
2326 }
2327 }
2328
2329 /// Create a builder to help you perform the following task:
2330 ///
2331 /// Creates a policy tag in the specified taxonomy.
2332 ///
2333 /// # Arguments
2334 ///
2335 /// * `request` - No description provided.
2336 /// * `parent` - Required. Resource name of the taxonomy that the policy tag will belong to.
2337 pub fn locations_taxonomies_policy_tags_create(
2338 &self,
2339 request: GoogleCloudDatacatalogV1beta1PolicyTag,
2340 parent: &str,
2341 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
2342 ProjectLocationTaxonomyPolicyTagCreateCall {
2343 hub: self.hub,
2344 _request: request,
2345 _parent: parent.to_string(),
2346 _delegate: Default::default(),
2347 _additional_params: Default::default(),
2348 _scopes: Default::default(),
2349 }
2350 }
2351
2352 /// Create a builder to help you perform the following task:
2353 ///
2354 /// Deletes a policy tag. Also deletes all of its descendant policy tags.
2355 ///
2356 /// # Arguments
2357 ///
2358 /// * `name` - Required. Resource name of the policy tag to be deleted. All of its descendant policy tags will also be deleted.
2359 pub fn locations_taxonomies_policy_tags_delete(
2360 &self,
2361 name: &str,
2362 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
2363 ProjectLocationTaxonomyPolicyTagDeleteCall {
2364 hub: self.hub,
2365 _name: name.to_string(),
2366 _delegate: Default::default(),
2367 _additional_params: Default::default(),
2368 _scopes: Default::default(),
2369 }
2370 }
2371
2372 /// Create a builder to help you perform the following task:
2373 ///
2374 /// Gets a policy tag.
2375 ///
2376 /// # Arguments
2377 ///
2378 /// * `name` - Required. Resource name of the requested policy tag.
2379 pub fn locations_taxonomies_policy_tags_get(
2380 &self,
2381 name: &str,
2382 ) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
2383 ProjectLocationTaxonomyPolicyTagGetCall {
2384 hub: self.hub,
2385 _name: name.to_string(),
2386 _delegate: Default::default(),
2387 _additional_params: Default::default(),
2388 _scopes: Default::default(),
2389 }
2390 }
2391
2392 /// Create a builder to help you perform the following task:
2393 ///
2394 /// Gets the IAM policy for a taxonomy or a policy tag.
2395 ///
2396 /// # Arguments
2397 ///
2398 /// * `request` - No description provided.
2399 /// * `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.
2400 pub fn locations_taxonomies_policy_tags_get_iam_policy(
2401 &self,
2402 request: GetIamPolicyRequest,
2403 resource: &str,
2404 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
2405 ProjectLocationTaxonomyPolicyTagGetIamPolicyCall {
2406 hub: self.hub,
2407 _request: request,
2408 _resource: resource.to_string(),
2409 _delegate: Default::default(),
2410 _additional_params: Default::default(),
2411 _scopes: Default::default(),
2412 }
2413 }
2414
2415 /// Create a builder to help you perform the following task:
2416 ///
2417 /// Lists all policy tags in a taxonomy.
2418 ///
2419 /// # Arguments
2420 ///
2421 /// * `parent` - Required. Resource name of the taxonomy to list the policy tags of.
2422 pub fn locations_taxonomies_policy_tags_list(
2423 &self,
2424 parent: &str,
2425 ) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
2426 ProjectLocationTaxonomyPolicyTagListCall {
2427 hub: self.hub,
2428 _parent: parent.to_string(),
2429 _page_token: Default::default(),
2430 _page_size: Default::default(),
2431 _delegate: Default::default(),
2432 _additional_params: Default::default(),
2433 _scopes: Default::default(),
2434 }
2435 }
2436
2437 /// Create a builder to help you perform the following task:
2438 ///
2439 /// Updates a policy tag.
2440 ///
2441 /// # Arguments
2442 ///
2443 /// * `request` - No description provided.
2444 /// * `name` - Identifier. Resource name of this policy tag, whose format is: "projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{id}".
2445 pub fn locations_taxonomies_policy_tags_patch(
2446 &self,
2447 request: GoogleCloudDatacatalogV1beta1PolicyTag,
2448 name: &str,
2449 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
2450 ProjectLocationTaxonomyPolicyTagPatchCall {
2451 hub: self.hub,
2452 _request: request,
2453 _name: name.to_string(),
2454 _update_mask: Default::default(),
2455 _delegate: Default::default(),
2456 _additional_params: Default::default(),
2457 _scopes: Default::default(),
2458 }
2459 }
2460
2461 /// Create a builder to help you perform the following task:
2462 ///
2463 /// Sets the IAM policy for a taxonomy or a policy tag.
2464 ///
2465 /// # Arguments
2466 ///
2467 /// * `request` - No description provided.
2468 /// * `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.
2469 pub fn locations_taxonomies_policy_tags_set_iam_policy(
2470 &self,
2471 request: SetIamPolicyRequest,
2472 resource: &str,
2473 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
2474 ProjectLocationTaxonomyPolicyTagSetIamPolicyCall {
2475 hub: self.hub,
2476 _request: request,
2477 _resource: resource.to_string(),
2478 _delegate: Default::default(),
2479 _additional_params: Default::default(),
2480 _scopes: Default::default(),
2481 }
2482 }
2483
2484 /// Create a builder to help you perform the following task:
2485 ///
2486 /// Returns the permissions that a caller has on the specified taxonomy or policy tag.
2487 ///
2488 /// # Arguments
2489 ///
2490 /// * `request` - No description provided.
2491 /// * `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.
2492 pub fn locations_taxonomies_policy_tags_test_iam_permissions(
2493 &self,
2494 request: TestIamPermissionsRequest,
2495 resource: &str,
2496 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
2497 ProjectLocationTaxonomyPolicyTagTestIamPermissionCall {
2498 hub: self.hub,
2499 _request: request,
2500 _resource: resource.to_string(),
2501 _delegate: Default::default(),
2502 _additional_params: Default::default(),
2503 _scopes: Default::default(),
2504 }
2505 }
2506
2507 /// Create a builder to help you perform the following task:
2508 ///
2509 /// Creates a taxonomy in the specified project.
2510 ///
2511 /// # Arguments
2512 ///
2513 /// * `request` - No description provided.
2514 /// * `parent` - Required. Resource name of the project that the taxonomy will belong to.
2515 pub fn locations_taxonomies_create(
2516 &self,
2517 request: GoogleCloudDatacatalogV1beta1Taxonomy,
2518 parent: &str,
2519 ) -> ProjectLocationTaxonomyCreateCall<'a, C> {
2520 ProjectLocationTaxonomyCreateCall {
2521 hub: self.hub,
2522 _request: request,
2523 _parent: parent.to_string(),
2524 _delegate: Default::default(),
2525 _additional_params: Default::default(),
2526 _scopes: Default::default(),
2527 }
2528 }
2529
2530 /// Create a builder to help you perform the following task:
2531 ///
2532 /// Deletes a taxonomy. This operation will also delete all policy tags in this taxonomy along with their associated policies.
2533 ///
2534 /// # Arguments
2535 ///
2536 /// * `name` - Required. Resource name of the taxonomy to be deleted. All policy tags in this taxonomy will also be deleted.
2537 pub fn locations_taxonomies_delete(
2538 &self,
2539 name: &str,
2540 ) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
2541 ProjectLocationTaxonomyDeleteCall {
2542 hub: self.hub,
2543 _name: name.to_string(),
2544 _delegate: Default::default(),
2545 _additional_params: Default::default(),
2546 _scopes: Default::default(),
2547 }
2548 }
2549
2550 /// Create a builder to help you perform the following task:
2551 ///
2552 /// Exports all taxonomies and their policy tags in a project. This method generates SerializedTaxonomy protos with nested policy tags that can be used as an input for future ImportTaxonomies calls.
2553 ///
2554 /// # Arguments
2555 ///
2556 /// * `parent` - Required. Resource name of the project that taxonomies to be exported will share.
2557 pub fn locations_taxonomies_export(
2558 &self,
2559 parent: &str,
2560 ) -> ProjectLocationTaxonomyExportCall<'a, C> {
2561 ProjectLocationTaxonomyExportCall {
2562 hub: self.hub,
2563 _parent: parent.to_string(),
2564 _taxonomies: Default::default(),
2565 _serialized_taxonomies: Default::default(),
2566 _delegate: Default::default(),
2567 _additional_params: Default::default(),
2568 _scopes: Default::default(),
2569 }
2570 }
2571
2572 /// Create a builder to help you perform the following task:
2573 ///
2574 /// Gets a taxonomy.
2575 ///
2576 /// # Arguments
2577 ///
2578 /// * `name` - Required. Resource name of the requested taxonomy.
2579 pub fn locations_taxonomies_get(&self, name: &str) -> ProjectLocationTaxonomyGetCall<'a, C> {
2580 ProjectLocationTaxonomyGetCall {
2581 hub: self.hub,
2582 _name: name.to_string(),
2583 _delegate: Default::default(),
2584 _additional_params: Default::default(),
2585 _scopes: Default::default(),
2586 }
2587 }
2588
2589 /// Create a builder to help you perform the following task:
2590 ///
2591 /// Gets the IAM policy for a taxonomy or a policy tag.
2592 ///
2593 /// # Arguments
2594 ///
2595 /// * `request` - No description provided.
2596 /// * `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.
2597 pub fn locations_taxonomies_get_iam_policy(
2598 &self,
2599 request: GetIamPolicyRequest,
2600 resource: &str,
2601 ) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
2602 ProjectLocationTaxonomyGetIamPolicyCall {
2603 hub: self.hub,
2604 _request: request,
2605 _resource: resource.to_string(),
2606 _delegate: Default::default(),
2607 _additional_params: Default::default(),
2608 _scopes: Default::default(),
2609 }
2610 }
2611
2612 /// Create a builder to help you perform the following task:
2613 ///
2614 /// Imports all taxonomies and their policy tags to a project as new taxonomies. This method provides a bulk taxonomy / policy tag creation using nested proto structure.
2615 ///
2616 /// # Arguments
2617 ///
2618 /// * `request` - No description provided.
2619 /// * `parent` - Required. Resource name of project that the imported taxonomies will belong to.
2620 pub fn locations_taxonomies_import(
2621 &self,
2622 request: GoogleCloudDatacatalogV1beta1ImportTaxonomiesRequest,
2623 parent: &str,
2624 ) -> ProjectLocationTaxonomyImportCall<'a, C> {
2625 ProjectLocationTaxonomyImportCall {
2626 hub: self.hub,
2627 _request: request,
2628 _parent: parent.to_string(),
2629 _delegate: Default::default(),
2630 _additional_params: Default::default(),
2631 _scopes: Default::default(),
2632 }
2633 }
2634
2635 /// Create a builder to help you perform the following task:
2636 ///
2637 /// Lists all taxonomies in a project in a particular location that the caller has permission to view.
2638 ///
2639 /// # Arguments
2640 ///
2641 /// * `parent` - Required. Resource name of the project to list the taxonomies of.
2642 pub fn locations_taxonomies_list(
2643 &self,
2644 parent: &str,
2645 ) -> ProjectLocationTaxonomyListCall<'a, C> {
2646 ProjectLocationTaxonomyListCall {
2647 hub: self.hub,
2648 _parent: parent.to_string(),
2649 _page_token: Default::default(),
2650 _page_size: Default::default(),
2651 _filter: Default::default(),
2652 _delegate: Default::default(),
2653 _additional_params: Default::default(),
2654 _scopes: Default::default(),
2655 }
2656 }
2657
2658 /// Create a builder to help you perform the following task:
2659 ///
2660 /// Updates a taxonomy.
2661 ///
2662 /// # Arguments
2663 ///
2664 /// * `request` - No description provided.
2665 /// * `name` - Identifier. Resource name of this taxonomy, whose format is: "projects/{project_number}/locations/{location_id}/taxonomies/{id}".
2666 pub fn locations_taxonomies_patch(
2667 &self,
2668 request: GoogleCloudDatacatalogV1beta1Taxonomy,
2669 name: &str,
2670 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
2671 ProjectLocationTaxonomyPatchCall {
2672 hub: self.hub,
2673 _request: request,
2674 _name: name.to_string(),
2675 _update_mask: Default::default(),
2676 _delegate: Default::default(),
2677 _additional_params: Default::default(),
2678 _scopes: Default::default(),
2679 }
2680 }
2681
2682 /// Create a builder to help you perform the following task:
2683 ///
2684 /// Sets the IAM policy for a taxonomy or a policy tag.
2685 ///
2686 /// # Arguments
2687 ///
2688 /// * `request` - No description provided.
2689 /// * `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.
2690 pub fn locations_taxonomies_set_iam_policy(
2691 &self,
2692 request: SetIamPolicyRequest,
2693 resource: &str,
2694 ) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
2695 ProjectLocationTaxonomySetIamPolicyCall {
2696 hub: self.hub,
2697 _request: request,
2698 _resource: resource.to_string(),
2699 _delegate: Default::default(),
2700 _additional_params: Default::default(),
2701 _scopes: Default::default(),
2702 }
2703 }
2704
2705 /// Create a builder to help you perform the following task:
2706 ///
2707 /// Returns the permissions that a caller has on the specified taxonomy or policy tag.
2708 ///
2709 /// # Arguments
2710 ///
2711 /// * `request` - No description provided.
2712 /// * `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.
2713 pub fn locations_taxonomies_test_iam_permissions(
2714 &self,
2715 request: TestIamPermissionsRequest,
2716 resource: &str,
2717 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
2718 ProjectLocationTaxonomyTestIamPermissionCall {
2719 hub: self.hub,
2720 _request: request,
2721 _resource: resource.to_string(),
2722 _delegate: Default::default(),
2723 _additional_params: Default::default(),
2724 _scopes: Default::default(),
2725 }
2726 }
2727}
2728
2729// ###################
2730// CallBuilders ###
2731// #################
2732
2733/// Searches Data Catalog for multiple resources like entries, tags that match a query. This is a custom method (https://cloud.google.com/apis/design/custom_methods) and does not return the complete resource, only the resource identifier and high level fields. Clients can subsequently call `Get` methods. Note that Data Catalog search queries do not guarantee full recall. Query results that match your query may not be returned, even in subsequent result pages. Also note that results returned (and not returned) can vary across repeated search queries. See [Data Catalog Search Syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference) for more information.
2734///
2735/// A builder for the *search* method supported by a *catalog* resource.
2736/// It is not used directly, but through a [`CatalogMethods`] instance.
2737///
2738/// # Example
2739///
2740/// Instantiate a resource method builder
2741///
2742/// ```test_harness,no_run
2743/// # extern crate hyper;
2744/// # extern crate hyper_rustls;
2745/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
2746/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1SearchCatalogRequest;
2747/// # async fn dox() {
2748/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2749///
2750/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2751/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2752/// # .with_native_roots()
2753/// # .unwrap()
2754/// # .https_only()
2755/// # .enable_http2()
2756/// # .build();
2757///
2758/// # let executor = hyper_util::rt::TokioExecutor::new();
2759/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2760/// # secret,
2761/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2762/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2763/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2764/// # ),
2765/// # ).build().await.unwrap();
2766///
2767/// # let client = hyper_util::client::legacy::Client::builder(
2768/// # hyper_util::rt::TokioExecutor::new()
2769/// # )
2770/// # .build(
2771/// # hyper_rustls::HttpsConnectorBuilder::new()
2772/// # .with_native_roots()
2773/// # .unwrap()
2774/// # .https_or_http()
2775/// # .enable_http2()
2776/// # .build()
2777/// # );
2778/// # let mut hub = DataCatalog::new(client, auth);
2779/// // As the method needs a request, you would usually fill it with the desired information
2780/// // into the respective structure. Some of the parts shown here might not be applicable !
2781/// // Values shown here are possibly random and not representative !
2782/// let mut req = GoogleCloudDatacatalogV1beta1SearchCatalogRequest::default();
2783///
2784/// // You can configure optional parameters by calling the respective setters at will, and
2785/// // execute the final call using `doit()`.
2786/// // Values shown here are possibly random and not representative !
2787/// let result = hub.catalog().search(req)
2788/// .doit().await;
2789/// # }
2790/// ```
2791pub struct CatalogSearchCall<'a, C>
2792where
2793 C: 'a,
2794{
2795 hub: &'a DataCatalog<C>,
2796 _request: GoogleCloudDatacatalogV1beta1SearchCatalogRequest,
2797 _delegate: Option<&'a mut dyn common::Delegate>,
2798 _additional_params: HashMap<String, String>,
2799 _scopes: BTreeSet<String>,
2800}
2801
2802impl<'a, C> common::CallBuilder for CatalogSearchCall<'a, C> {}
2803
2804impl<'a, C> CatalogSearchCall<'a, C>
2805where
2806 C: common::Connector,
2807{
2808 /// Perform the operation you have build so far.
2809 pub async fn doit(
2810 mut self,
2811 ) -> common::Result<(
2812 common::Response,
2813 GoogleCloudDatacatalogV1beta1SearchCatalogResponse,
2814 )> {
2815 use std::borrow::Cow;
2816 use std::io::{Read, Seek};
2817
2818 use common::{url::Params, ToParts};
2819 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2820
2821 let mut dd = common::DefaultDelegate;
2822 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2823 dlg.begin(common::MethodInfo {
2824 id: "datacatalog.catalog.search",
2825 http_method: hyper::Method::POST,
2826 });
2827
2828 for &field in ["alt"].iter() {
2829 if self._additional_params.contains_key(field) {
2830 dlg.finished(false);
2831 return Err(common::Error::FieldClash(field));
2832 }
2833 }
2834
2835 let mut params = Params::with_capacity(3 + self._additional_params.len());
2836
2837 params.extend(self._additional_params.iter());
2838
2839 params.push("alt", "json");
2840 let mut url = self.hub._base_url.clone() + "v1beta1/catalog:search";
2841 if self._scopes.is_empty() {
2842 self._scopes
2843 .insert(Scope::CloudPlatform.as_ref().to_string());
2844 }
2845
2846 let url = params.parse_with_url(&url);
2847
2848 let mut json_mime_type = mime::APPLICATION_JSON;
2849 let mut request_value_reader = {
2850 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2851 common::remove_json_null_values(&mut value);
2852 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2853 serde_json::to_writer(&mut dst, &value).unwrap();
2854 dst
2855 };
2856 let request_size = request_value_reader
2857 .seek(std::io::SeekFrom::End(0))
2858 .unwrap();
2859 request_value_reader
2860 .seek(std::io::SeekFrom::Start(0))
2861 .unwrap();
2862
2863 loop {
2864 let token = match self
2865 .hub
2866 .auth
2867 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2868 .await
2869 {
2870 Ok(token) => token,
2871 Err(e) => match dlg.token(e) {
2872 Ok(token) => token,
2873 Err(e) => {
2874 dlg.finished(false);
2875 return Err(common::Error::MissingToken(e));
2876 }
2877 },
2878 };
2879 request_value_reader
2880 .seek(std::io::SeekFrom::Start(0))
2881 .unwrap();
2882 let mut req_result = {
2883 let client = &self.hub.client;
2884 dlg.pre_request();
2885 let mut req_builder = hyper::Request::builder()
2886 .method(hyper::Method::POST)
2887 .uri(url.as_str())
2888 .header(USER_AGENT, self.hub._user_agent.clone());
2889
2890 if let Some(token) = token.as_ref() {
2891 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2892 }
2893
2894 let request = req_builder
2895 .header(CONTENT_TYPE, json_mime_type.to_string())
2896 .header(CONTENT_LENGTH, request_size as u64)
2897 .body(common::to_body(
2898 request_value_reader.get_ref().clone().into(),
2899 ));
2900
2901 client.request(request.unwrap()).await
2902 };
2903
2904 match req_result {
2905 Err(err) => {
2906 if let common::Retry::After(d) = dlg.http_error(&err) {
2907 sleep(d).await;
2908 continue;
2909 }
2910 dlg.finished(false);
2911 return Err(common::Error::HttpError(err));
2912 }
2913 Ok(res) => {
2914 let (mut parts, body) = res.into_parts();
2915 let mut body = common::Body::new(body);
2916 if !parts.status.is_success() {
2917 let bytes = common::to_bytes(body).await.unwrap_or_default();
2918 let error = serde_json::from_str(&common::to_string(&bytes));
2919 let response = common::to_response(parts, bytes.into());
2920
2921 if let common::Retry::After(d) =
2922 dlg.http_failure(&response, error.as_ref().ok())
2923 {
2924 sleep(d).await;
2925 continue;
2926 }
2927
2928 dlg.finished(false);
2929
2930 return Err(match error {
2931 Ok(value) => common::Error::BadRequest(value),
2932 _ => common::Error::Failure(response),
2933 });
2934 }
2935 let response = {
2936 let bytes = common::to_bytes(body).await.unwrap_or_default();
2937 let encoded = common::to_string(&bytes);
2938 match serde_json::from_str(&encoded) {
2939 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2940 Err(error) => {
2941 dlg.response_json_decode_error(&encoded, &error);
2942 return Err(common::Error::JsonDecodeError(
2943 encoded.to_string(),
2944 error,
2945 ));
2946 }
2947 }
2948 };
2949
2950 dlg.finished(true);
2951 return Ok(response);
2952 }
2953 }
2954 }
2955 }
2956
2957 ///
2958 /// Sets the *request* property to the given value.
2959 ///
2960 /// Even though the property as already been set when instantiating this call,
2961 /// we provide this method for API completeness.
2962 pub fn request(
2963 mut self,
2964 new_value: GoogleCloudDatacatalogV1beta1SearchCatalogRequest,
2965 ) -> CatalogSearchCall<'a, C> {
2966 self._request = new_value;
2967 self
2968 }
2969 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2970 /// while executing the actual API request.
2971 ///
2972 /// ````text
2973 /// It should be used to handle progress information, and to implement a certain level of resilience.
2974 /// ````
2975 ///
2976 /// Sets the *delegate* property to the given value.
2977 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CatalogSearchCall<'a, C> {
2978 self._delegate = Some(new_value);
2979 self
2980 }
2981
2982 /// Set any additional parameter of the query string used in the request.
2983 /// It should be used to set parameters which are not yet available through their own
2984 /// setters.
2985 ///
2986 /// Please note that this method must not be used to set any of the known parameters
2987 /// which have their own setter method. If done anyway, the request will fail.
2988 ///
2989 /// # Additional Parameters
2990 ///
2991 /// * *$.xgafv* (query-string) - V1 error format.
2992 /// * *access_token* (query-string) - OAuth access token.
2993 /// * *alt* (query-string) - Data format for response.
2994 /// * *callback* (query-string) - JSONP
2995 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2996 /// * *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.
2997 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2998 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2999 /// * *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.
3000 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3001 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3002 pub fn param<T>(mut self, name: T, value: T) -> CatalogSearchCall<'a, C>
3003 where
3004 T: AsRef<str>,
3005 {
3006 self._additional_params
3007 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3008 self
3009 }
3010
3011 /// Identifies the authorization scope for the method you are building.
3012 ///
3013 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3014 /// [`Scope::CloudPlatform`].
3015 ///
3016 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3017 /// tokens for more than one scope.
3018 ///
3019 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3020 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3021 /// sufficient, a read-write scope will do as well.
3022 pub fn add_scope<St>(mut self, scope: St) -> CatalogSearchCall<'a, C>
3023 where
3024 St: AsRef<str>,
3025 {
3026 self._scopes.insert(String::from(scope.as_ref()));
3027 self
3028 }
3029 /// Identifies the authorization scope(s) for the method you are building.
3030 ///
3031 /// See [`Self::add_scope()`] for details.
3032 pub fn add_scopes<I, St>(mut self, scopes: I) -> CatalogSearchCall<'a, C>
3033 where
3034 I: IntoIterator<Item = St>,
3035 St: AsRef<str>,
3036 {
3037 self._scopes
3038 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3039 self
3040 }
3041
3042 /// Removes all scopes, and no default scope will be used either.
3043 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3044 /// for details).
3045 pub fn clear_scopes(mut self) -> CatalogSearchCall<'a, C> {
3046 self._scopes.clear();
3047 self
3048 }
3049}
3050
3051/// Get an entry by target resource name. This method allows clients to use the resource name from the source Google Cloud Platform service to get the Data Catalog Entry.
3052///
3053/// A builder for the *lookup* method supported by a *entry* resource.
3054/// It is not used directly, but through a [`EntryMethods`] instance.
3055///
3056/// # Example
3057///
3058/// Instantiate a resource method builder
3059///
3060/// ```test_harness,no_run
3061/// # extern crate hyper;
3062/// # extern crate hyper_rustls;
3063/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
3064/// # async fn dox() {
3065/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3066///
3067/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3068/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3069/// # .with_native_roots()
3070/// # .unwrap()
3071/// # .https_only()
3072/// # .enable_http2()
3073/// # .build();
3074///
3075/// # let executor = hyper_util::rt::TokioExecutor::new();
3076/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3077/// # secret,
3078/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3079/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3080/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3081/// # ),
3082/// # ).build().await.unwrap();
3083///
3084/// # let client = hyper_util::client::legacy::Client::builder(
3085/// # hyper_util::rt::TokioExecutor::new()
3086/// # )
3087/// # .build(
3088/// # hyper_rustls::HttpsConnectorBuilder::new()
3089/// # .with_native_roots()
3090/// # .unwrap()
3091/// # .https_or_http()
3092/// # .enable_http2()
3093/// # .build()
3094/// # );
3095/// # let mut hub = DataCatalog::new(client, auth);
3096/// // You can configure optional parameters by calling the respective setters at will, and
3097/// // execute the final call using `doit()`.
3098/// // Values shown here are possibly random and not representative !
3099/// let result = hub.entries().lookup()
3100/// .sql_resource("ipsum")
3101/// .linked_resource("voluptua.")
3102/// .doit().await;
3103/// # }
3104/// ```
3105pub struct EntryLookupCall<'a, C>
3106where
3107 C: 'a,
3108{
3109 hub: &'a DataCatalog<C>,
3110 _sql_resource: Option<String>,
3111 _linked_resource: Option<String>,
3112 _delegate: Option<&'a mut dyn common::Delegate>,
3113 _additional_params: HashMap<String, String>,
3114 _scopes: BTreeSet<String>,
3115}
3116
3117impl<'a, C> common::CallBuilder for EntryLookupCall<'a, C> {}
3118
3119impl<'a, C> EntryLookupCall<'a, C>
3120where
3121 C: common::Connector,
3122{
3123 /// Perform the operation you have build so far.
3124 pub async fn doit(
3125 mut self,
3126 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Entry)> {
3127 use std::borrow::Cow;
3128 use std::io::{Read, Seek};
3129
3130 use common::{url::Params, ToParts};
3131 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3132
3133 let mut dd = common::DefaultDelegate;
3134 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3135 dlg.begin(common::MethodInfo {
3136 id: "datacatalog.entries.lookup",
3137 http_method: hyper::Method::GET,
3138 });
3139
3140 for &field in ["alt", "sqlResource", "linkedResource"].iter() {
3141 if self._additional_params.contains_key(field) {
3142 dlg.finished(false);
3143 return Err(common::Error::FieldClash(field));
3144 }
3145 }
3146
3147 let mut params = Params::with_capacity(4 + self._additional_params.len());
3148 if let Some(value) = self._sql_resource.as_ref() {
3149 params.push("sqlResource", value);
3150 }
3151 if let Some(value) = self._linked_resource.as_ref() {
3152 params.push("linkedResource", value);
3153 }
3154
3155 params.extend(self._additional_params.iter());
3156
3157 params.push("alt", "json");
3158 let mut url = self.hub._base_url.clone() + "v1beta1/entries:lookup";
3159 if self._scopes.is_empty() {
3160 self._scopes
3161 .insert(Scope::CloudPlatform.as_ref().to_string());
3162 }
3163
3164 let url = params.parse_with_url(&url);
3165
3166 loop {
3167 let token = match self
3168 .hub
3169 .auth
3170 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3171 .await
3172 {
3173 Ok(token) => token,
3174 Err(e) => match dlg.token(e) {
3175 Ok(token) => token,
3176 Err(e) => {
3177 dlg.finished(false);
3178 return Err(common::Error::MissingToken(e));
3179 }
3180 },
3181 };
3182 let mut req_result = {
3183 let client = &self.hub.client;
3184 dlg.pre_request();
3185 let mut req_builder = hyper::Request::builder()
3186 .method(hyper::Method::GET)
3187 .uri(url.as_str())
3188 .header(USER_AGENT, self.hub._user_agent.clone());
3189
3190 if let Some(token) = token.as_ref() {
3191 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3192 }
3193
3194 let request = req_builder
3195 .header(CONTENT_LENGTH, 0_u64)
3196 .body(common::to_body::<String>(None));
3197
3198 client.request(request.unwrap()).await
3199 };
3200
3201 match req_result {
3202 Err(err) => {
3203 if let common::Retry::After(d) = dlg.http_error(&err) {
3204 sleep(d).await;
3205 continue;
3206 }
3207 dlg.finished(false);
3208 return Err(common::Error::HttpError(err));
3209 }
3210 Ok(res) => {
3211 let (mut parts, body) = res.into_parts();
3212 let mut body = common::Body::new(body);
3213 if !parts.status.is_success() {
3214 let bytes = common::to_bytes(body).await.unwrap_or_default();
3215 let error = serde_json::from_str(&common::to_string(&bytes));
3216 let response = common::to_response(parts, bytes.into());
3217
3218 if let common::Retry::After(d) =
3219 dlg.http_failure(&response, error.as_ref().ok())
3220 {
3221 sleep(d).await;
3222 continue;
3223 }
3224
3225 dlg.finished(false);
3226
3227 return Err(match error {
3228 Ok(value) => common::Error::BadRequest(value),
3229 _ => common::Error::Failure(response),
3230 });
3231 }
3232 let response = {
3233 let bytes = common::to_bytes(body).await.unwrap_or_default();
3234 let encoded = common::to_string(&bytes);
3235 match serde_json::from_str(&encoded) {
3236 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3237 Err(error) => {
3238 dlg.response_json_decode_error(&encoded, &error);
3239 return Err(common::Error::JsonDecodeError(
3240 encoded.to_string(),
3241 error,
3242 ));
3243 }
3244 }
3245 };
3246
3247 dlg.finished(true);
3248 return Ok(response);
3249 }
3250 }
3251 }
3252 }
3253
3254 /// The SQL name of the entry. SQL names are case-sensitive. Examples: * `pubsub.project_id.topic_id` * ``pubsub.project_id.`topic.id.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` `*_id`s should satisfy the GoogleSQL rules for identifiers. https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical.
3255 ///
3256 /// Sets the *sql resource* query property to the given value.
3257 pub fn sql_resource(mut self, new_value: &str) -> EntryLookupCall<'a, C> {
3258 self._sql_resource = Some(new_value.to_string());
3259 self
3260 }
3261 /// The full name of the Google Cloud Platform resource the Data Catalog entry represents. See: https://cloud.google.com/apis/design/resource_names#full_resource_name. Full names are case-sensitive. Examples: * //bigquery.googleapis.com/projects/projectId/datasets/datasetId/tables/tableId * //pubsub.googleapis.com/projects/projectId/topics/topicId
3262 ///
3263 /// Sets the *linked resource* query property to the given value.
3264 pub fn linked_resource(mut self, new_value: &str) -> EntryLookupCall<'a, C> {
3265 self._linked_resource = Some(new_value.to_string());
3266 self
3267 }
3268 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3269 /// while executing the actual API request.
3270 ///
3271 /// ````text
3272 /// It should be used to handle progress information, and to implement a certain level of resilience.
3273 /// ````
3274 ///
3275 /// Sets the *delegate* property to the given value.
3276 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EntryLookupCall<'a, C> {
3277 self._delegate = Some(new_value);
3278 self
3279 }
3280
3281 /// Set any additional parameter of the query string used in the request.
3282 /// It should be used to set parameters which are not yet available through their own
3283 /// setters.
3284 ///
3285 /// Please note that this method must not be used to set any of the known parameters
3286 /// which have their own setter method. If done anyway, the request will fail.
3287 ///
3288 /// # Additional Parameters
3289 ///
3290 /// * *$.xgafv* (query-string) - V1 error format.
3291 /// * *access_token* (query-string) - OAuth access token.
3292 /// * *alt* (query-string) - Data format for response.
3293 /// * *callback* (query-string) - JSONP
3294 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3295 /// * *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.
3296 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3297 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3298 /// * *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.
3299 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3300 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3301 pub fn param<T>(mut self, name: T, value: T) -> EntryLookupCall<'a, C>
3302 where
3303 T: AsRef<str>,
3304 {
3305 self._additional_params
3306 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3307 self
3308 }
3309
3310 /// Identifies the authorization scope for the method you are building.
3311 ///
3312 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3313 /// [`Scope::CloudPlatform`].
3314 ///
3315 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3316 /// tokens for more than one scope.
3317 ///
3318 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3319 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3320 /// sufficient, a read-write scope will do as well.
3321 pub fn add_scope<St>(mut self, scope: St) -> EntryLookupCall<'a, C>
3322 where
3323 St: AsRef<str>,
3324 {
3325 self._scopes.insert(String::from(scope.as_ref()));
3326 self
3327 }
3328 /// Identifies the authorization scope(s) for the method you are building.
3329 ///
3330 /// See [`Self::add_scope()`] for details.
3331 pub fn add_scopes<I, St>(mut self, scopes: I) -> EntryLookupCall<'a, C>
3332 where
3333 I: IntoIterator<Item = St>,
3334 St: AsRef<str>,
3335 {
3336 self._scopes
3337 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3338 self
3339 }
3340
3341 /// Removes all scopes, and no default scope will be used either.
3342 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3343 /// for details).
3344 pub fn clear_scopes(mut self) -> EntryLookupCall<'a, C> {
3345 self._scopes.clear();
3346 self
3347 }
3348}
3349
3350/// Creates a tag on an Entry. Note: The project identified by the `parent` parameter for the [tag](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be from the same organization.
3351///
3352/// A builder for the *locations.entryGroups.entries.tags.create* method supported by a *project* resource.
3353/// It is not used directly, but through a [`ProjectMethods`] instance.
3354///
3355/// # Example
3356///
3357/// Instantiate a resource method builder
3358///
3359/// ```test_harness,no_run
3360/// # extern crate hyper;
3361/// # extern crate hyper_rustls;
3362/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
3363/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Tag;
3364/// # async fn dox() {
3365/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3366///
3367/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3368/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3369/// # .with_native_roots()
3370/// # .unwrap()
3371/// # .https_only()
3372/// # .enable_http2()
3373/// # .build();
3374///
3375/// # let executor = hyper_util::rt::TokioExecutor::new();
3376/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3377/// # secret,
3378/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3379/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3380/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3381/// # ),
3382/// # ).build().await.unwrap();
3383///
3384/// # let client = hyper_util::client::legacy::Client::builder(
3385/// # hyper_util::rt::TokioExecutor::new()
3386/// # )
3387/// # .build(
3388/// # hyper_rustls::HttpsConnectorBuilder::new()
3389/// # .with_native_roots()
3390/// # .unwrap()
3391/// # .https_or_http()
3392/// # .enable_http2()
3393/// # .build()
3394/// # );
3395/// # let mut hub = DataCatalog::new(client, auth);
3396/// // As the method needs a request, you would usually fill it with the desired information
3397/// // into the respective structure. Some of the parts shown here might not be applicable !
3398/// // Values shown here are possibly random and not representative !
3399/// let mut req = GoogleCloudDatacatalogV1beta1Tag::default();
3400///
3401/// // You can configure optional parameters by calling the respective setters at will, and
3402/// // execute the final call using `doit()`.
3403/// // Values shown here are possibly random and not representative !
3404/// let result = hub.projects().locations_entry_groups_entries_tags_create(req, "parent")
3405/// .doit().await;
3406/// # }
3407/// ```
3408pub struct ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
3409where
3410 C: 'a,
3411{
3412 hub: &'a DataCatalog<C>,
3413 _request: GoogleCloudDatacatalogV1beta1Tag,
3414 _parent: String,
3415 _delegate: Option<&'a mut dyn common::Delegate>,
3416 _additional_params: HashMap<String, String>,
3417 _scopes: BTreeSet<String>,
3418}
3419
3420impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {}
3421
3422impl<'a, C> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
3423where
3424 C: common::Connector,
3425{
3426 /// Perform the operation you have build so far.
3427 pub async fn doit(
3428 mut self,
3429 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Tag)> {
3430 use std::borrow::Cow;
3431 use std::io::{Read, Seek};
3432
3433 use common::{url::Params, ToParts};
3434 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3435
3436 let mut dd = common::DefaultDelegate;
3437 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3438 dlg.begin(common::MethodInfo {
3439 id: "datacatalog.projects.locations.entryGroups.entries.tags.create",
3440 http_method: hyper::Method::POST,
3441 });
3442
3443 for &field in ["alt", "parent"].iter() {
3444 if self._additional_params.contains_key(field) {
3445 dlg.finished(false);
3446 return Err(common::Error::FieldClash(field));
3447 }
3448 }
3449
3450 let mut params = Params::with_capacity(4 + self._additional_params.len());
3451 params.push("parent", self._parent);
3452
3453 params.extend(self._additional_params.iter());
3454
3455 params.push("alt", "json");
3456 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/tags";
3457 if self._scopes.is_empty() {
3458 self._scopes
3459 .insert(Scope::CloudPlatform.as_ref().to_string());
3460 }
3461
3462 #[allow(clippy::single_element_loop)]
3463 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3464 url = params.uri_replacement(url, param_name, find_this, true);
3465 }
3466 {
3467 let to_remove = ["parent"];
3468 params.remove_params(&to_remove);
3469 }
3470
3471 let url = params.parse_with_url(&url);
3472
3473 let mut json_mime_type = mime::APPLICATION_JSON;
3474 let mut request_value_reader = {
3475 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3476 common::remove_json_null_values(&mut value);
3477 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3478 serde_json::to_writer(&mut dst, &value).unwrap();
3479 dst
3480 };
3481 let request_size = request_value_reader
3482 .seek(std::io::SeekFrom::End(0))
3483 .unwrap();
3484 request_value_reader
3485 .seek(std::io::SeekFrom::Start(0))
3486 .unwrap();
3487
3488 loop {
3489 let token = match self
3490 .hub
3491 .auth
3492 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3493 .await
3494 {
3495 Ok(token) => token,
3496 Err(e) => match dlg.token(e) {
3497 Ok(token) => token,
3498 Err(e) => {
3499 dlg.finished(false);
3500 return Err(common::Error::MissingToken(e));
3501 }
3502 },
3503 };
3504 request_value_reader
3505 .seek(std::io::SeekFrom::Start(0))
3506 .unwrap();
3507 let mut req_result = {
3508 let client = &self.hub.client;
3509 dlg.pre_request();
3510 let mut req_builder = hyper::Request::builder()
3511 .method(hyper::Method::POST)
3512 .uri(url.as_str())
3513 .header(USER_AGENT, self.hub._user_agent.clone());
3514
3515 if let Some(token) = token.as_ref() {
3516 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3517 }
3518
3519 let request = req_builder
3520 .header(CONTENT_TYPE, json_mime_type.to_string())
3521 .header(CONTENT_LENGTH, request_size as u64)
3522 .body(common::to_body(
3523 request_value_reader.get_ref().clone().into(),
3524 ));
3525
3526 client.request(request.unwrap()).await
3527 };
3528
3529 match req_result {
3530 Err(err) => {
3531 if let common::Retry::After(d) = dlg.http_error(&err) {
3532 sleep(d).await;
3533 continue;
3534 }
3535 dlg.finished(false);
3536 return Err(common::Error::HttpError(err));
3537 }
3538 Ok(res) => {
3539 let (mut parts, body) = res.into_parts();
3540 let mut body = common::Body::new(body);
3541 if !parts.status.is_success() {
3542 let bytes = common::to_bytes(body).await.unwrap_or_default();
3543 let error = serde_json::from_str(&common::to_string(&bytes));
3544 let response = common::to_response(parts, bytes.into());
3545
3546 if let common::Retry::After(d) =
3547 dlg.http_failure(&response, error.as_ref().ok())
3548 {
3549 sleep(d).await;
3550 continue;
3551 }
3552
3553 dlg.finished(false);
3554
3555 return Err(match error {
3556 Ok(value) => common::Error::BadRequest(value),
3557 _ => common::Error::Failure(response),
3558 });
3559 }
3560 let response = {
3561 let bytes = common::to_bytes(body).await.unwrap_or_default();
3562 let encoded = common::to_string(&bytes);
3563 match serde_json::from_str(&encoded) {
3564 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3565 Err(error) => {
3566 dlg.response_json_decode_error(&encoded, &error);
3567 return Err(common::Error::JsonDecodeError(
3568 encoded.to_string(),
3569 error,
3570 ));
3571 }
3572 }
3573 };
3574
3575 dlg.finished(true);
3576 return Ok(response);
3577 }
3578 }
3579 }
3580 }
3581
3582 ///
3583 /// Sets the *request* property to the given value.
3584 ///
3585 /// Even though the property as already been set when instantiating this call,
3586 /// we provide this method for API completeness.
3587 pub fn request(
3588 mut self,
3589 new_value: GoogleCloudDatacatalogV1beta1Tag,
3590 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
3591 self._request = new_value;
3592 self
3593 }
3594 /// Required. The name of the resource to attach this tag to. Tags can be attached to Entries. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id} Note that this Tag and its child resources may not actually be stored in the location in this name.
3595 ///
3596 /// Sets the *parent* path property to the given value.
3597 ///
3598 /// Even though the property as already been set when instantiating this call,
3599 /// we provide this method for API completeness.
3600 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
3601 self._parent = new_value.to_string();
3602 self
3603 }
3604 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3605 /// while executing the actual API request.
3606 ///
3607 /// ````text
3608 /// It should be used to handle progress information, and to implement a certain level of resilience.
3609 /// ````
3610 ///
3611 /// Sets the *delegate* property to the given value.
3612 pub fn delegate(
3613 mut self,
3614 new_value: &'a mut dyn common::Delegate,
3615 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
3616 self._delegate = Some(new_value);
3617 self
3618 }
3619
3620 /// Set any additional parameter of the query string used in the request.
3621 /// It should be used to set parameters which are not yet available through their own
3622 /// setters.
3623 ///
3624 /// Please note that this method must not be used to set any of the known parameters
3625 /// which have their own setter method. If done anyway, the request will fail.
3626 ///
3627 /// # Additional Parameters
3628 ///
3629 /// * *$.xgafv* (query-string) - V1 error format.
3630 /// * *access_token* (query-string) - OAuth access token.
3631 /// * *alt* (query-string) - Data format for response.
3632 /// * *callback* (query-string) - JSONP
3633 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3634 /// * *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.
3635 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3636 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3637 /// * *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.
3638 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3639 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3640 pub fn param<T>(
3641 mut self,
3642 name: T,
3643 value: T,
3644 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
3645 where
3646 T: AsRef<str>,
3647 {
3648 self._additional_params
3649 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3650 self
3651 }
3652
3653 /// Identifies the authorization scope for the method you are building.
3654 ///
3655 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3656 /// [`Scope::CloudPlatform`].
3657 ///
3658 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3659 /// tokens for more than one scope.
3660 ///
3661 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3662 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3663 /// sufficient, a read-write scope will do as well.
3664 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
3665 where
3666 St: AsRef<str>,
3667 {
3668 self._scopes.insert(String::from(scope.as_ref()));
3669 self
3670 }
3671 /// Identifies the authorization scope(s) for the method you are building.
3672 ///
3673 /// See [`Self::add_scope()`] for details.
3674 pub fn add_scopes<I, St>(
3675 mut self,
3676 scopes: I,
3677 ) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C>
3678 where
3679 I: IntoIterator<Item = St>,
3680 St: AsRef<str>,
3681 {
3682 self._scopes
3683 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3684 self
3685 }
3686
3687 /// Removes all scopes, and no default scope will be used either.
3688 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3689 /// for details).
3690 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagCreateCall<'a, C> {
3691 self._scopes.clear();
3692 self
3693 }
3694}
3695
3696/// Deletes a tag.
3697///
3698/// A builder for the *locations.entryGroups.entries.tags.delete* method supported by a *project* resource.
3699/// It is not used directly, but through a [`ProjectMethods`] instance.
3700///
3701/// # Example
3702///
3703/// Instantiate a resource method builder
3704///
3705/// ```test_harness,no_run
3706/// # extern crate hyper;
3707/// # extern crate hyper_rustls;
3708/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
3709/// # async fn dox() {
3710/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3711///
3712/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3713/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3714/// # .with_native_roots()
3715/// # .unwrap()
3716/// # .https_only()
3717/// # .enable_http2()
3718/// # .build();
3719///
3720/// # let executor = hyper_util::rt::TokioExecutor::new();
3721/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3722/// # secret,
3723/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3724/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3725/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3726/// # ),
3727/// # ).build().await.unwrap();
3728///
3729/// # let client = hyper_util::client::legacy::Client::builder(
3730/// # hyper_util::rt::TokioExecutor::new()
3731/// # )
3732/// # .build(
3733/// # hyper_rustls::HttpsConnectorBuilder::new()
3734/// # .with_native_roots()
3735/// # .unwrap()
3736/// # .https_or_http()
3737/// # .enable_http2()
3738/// # .build()
3739/// # );
3740/// # let mut hub = DataCatalog::new(client, auth);
3741/// // You can configure optional parameters by calling the respective setters at will, and
3742/// // execute the final call using `doit()`.
3743/// // Values shown here are possibly random and not representative !
3744/// let result = hub.projects().locations_entry_groups_entries_tags_delete("name")
3745/// .doit().await;
3746/// # }
3747/// ```
3748pub struct ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
3749where
3750 C: 'a,
3751{
3752 hub: &'a DataCatalog<C>,
3753 _name: String,
3754 _delegate: Option<&'a mut dyn common::Delegate>,
3755 _additional_params: HashMap<String, String>,
3756 _scopes: BTreeSet<String>,
3757}
3758
3759impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {}
3760
3761impl<'a, C> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
3762where
3763 C: common::Connector,
3764{
3765 /// Perform the operation you have build so far.
3766 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3767 use std::borrow::Cow;
3768 use std::io::{Read, Seek};
3769
3770 use common::{url::Params, ToParts};
3771 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3772
3773 let mut dd = common::DefaultDelegate;
3774 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3775 dlg.begin(common::MethodInfo {
3776 id: "datacatalog.projects.locations.entryGroups.entries.tags.delete",
3777 http_method: hyper::Method::DELETE,
3778 });
3779
3780 for &field in ["alt", "name"].iter() {
3781 if self._additional_params.contains_key(field) {
3782 dlg.finished(false);
3783 return Err(common::Error::FieldClash(field));
3784 }
3785 }
3786
3787 let mut params = Params::with_capacity(3 + self._additional_params.len());
3788 params.push("name", self._name);
3789
3790 params.extend(self._additional_params.iter());
3791
3792 params.push("alt", "json");
3793 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3794 if self._scopes.is_empty() {
3795 self._scopes
3796 .insert(Scope::CloudPlatform.as_ref().to_string());
3797 }
3798
3799 #[allow(clippy::single_element_loop)]
3800 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3801 url = params.uri_replacement(url, param_name, find_this, true);
3802 }
3803 {
3804 let to_remove = ["name"];
3805 params.remove_params(&to_remove);
3806 }
3807
3808 let url = params.parse_with_url(&url);
3809
3810 loop {
3811 let token = match self
3812 .hub
3813 .auth
3814 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3815 .await
3816 {
3817 Ok(token) => token,
3818 Err(e) => match dlg.token(e) {
3819 Ok(token) => token,
3820 Err(e) => {
3821 dlg.finished(false);
3822 return Err(common::Error::MissingToken(e));
3823 }
3824 },
3825 };
3826 let mut req_result = {
3827 let client = &self.hub.client;
3828 dlg.pre_request();
3829 let mut req_builder = hyper::Request::builder()
3830 .method(hyper::Method::DELETE)
3831 .uri(url.as_str())
3832 .header(USER_AGENT, self.hub._user_agent.clone());
3833
3834 if let Some(token) = token.as_ref() {
3835 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3836 }
3837
3838 let request = req_builder
3839 .header(CONTENT_LENGTH, 0_u64)
3840 .body(common::to_body::<String>(None));
3841
3842 client.request(request.unwrap()).await
3843 };
3844
3845 match req_result {
3846 Err(err) => {
3847 if let common::Retry::After(d) = dlg.http_error(&err) {
3848 sleep(d).await;
3849 continue;
3850 }
3851 dlg.finished(false);
3852 return Err(common::Error::HttpError(err));
3853 }
3854 Ok(res) => {
3855 let (mut parts, body) = res.into_parts();
3856 let mut body = common::Body::new(body);
3857 if !parts.status.is_success() {
3858 let bytes = common::to_bytes(body).await.unwrap_or_default();
3859 let error = serde_json::from_str(&common::to_string(&bytes));
3860 let response = common::to_response(parts, bytes.into());
3861
3862 if let common::Retry::After(d) =
3863 dlg.http_failure(&response, error.as_ref().ok())
3864 {
3865 sleep(d).await;
3866 continue;
3867 }
3868
3869 dlg.finished(false);
3870
3871 return Err(match error {
3872 Ok(value) => common::Error::BadRequest(value),
3873 _ => common::Error::Failure(response),
3874 });
3875 }
3876 let response = {
3877 let bytes = common::to_bytes(body).await.unwrap_or_default();
3878 let encoded = common::to_string(&bytes);
3879 match serde_json::from_str(&encoded) {
3880 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3881 Err(error) => {
3882 dlg.response_json_decode_error(&encoded, &error);
3883 return Err(common::Error::JsonDecodeError(
3884 encoded.to_string(),
3885 error,
3886 ));
3887 }
3888 }
3889 };
3890
3891 dlg.finished(true);
3892 return Ok(response);
3893 }
3894 }
3895 }
3896 }
3897
3898 /// Required. The name of the tag to delete. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id}
3899 ///
3900 /// Sets the *name* path property to the given value.
3901 ///
3902 /// Even though the property as already been set when instantiating this call,
3903 /// we provide this method for API completeness.
3904 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
3905 self._name = new_value.to_string();
3906 self
3907 }
3908 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3909 /// while executing the actual API request.
3910 ///
3911 /// ````text
3912 /// It should be used to handle progress information, and to implement a certain level of resilience.
3913 /// ````
3914 ///
3915 /// Sets the *delegate* property to the given value.
3916 pub fn delegate(
3917 mut self,
3918 new_value: &'a mut dyn common::Delegate,
3919 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
3920 self._delegate = Some(new_value);
3921 self
3922 }
3923
3924 /// Set any additional parameter of the query string used in the request.
3925 /// It should be used to set parameters which are not yet available through their own
3926 /// setters.
3927 ///
3928 /// Please note that this method must not be used to set any of the known parameters
3929 /// which have their own setter method. If done anyway, the request will fail.
3930 ///
3931 /// # Additional Parameters
3932 ///
3933 /// * *$.xgafv* (query-string) - V1 error format.
3934 /// * *access_token* (query-string) - OAuth access token.
3935 /// * *alt* (query-string) - Data format for response.
3936 /// * *callback* (query-string) - JSONP
3937 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3938 /// * *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.
3939 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3940 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3941 /// * *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.
3942 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3943 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3944 pub fn param<T>(
3945 mut self,
3946 name: T,
3947 value: T,
3948 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
3949 where
3950 T: AsRef<str>,
3951 {
3952 self._additional_params
3953 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3954 self
3955 }
3956
3957 /// Identifies the authorization scope for the method you are building.
3958 ///
3959 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3960 /// [`Scope::CloudPlatform`].
3961 ///
3962 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3963 /// tokens for more than one scope.
3964 ///
3965 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3966 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3967 /// sufficient, a read-write scope will do as well.
3968 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
3969 where
3970 St: AsRef<str>,
3971 {
3972 self._scopes.insert(String::from(scope.as_ref()));
3973 self
3974 }
3975 /// Identifies the authorization scope(s) for the method you are building.
3976 ///
3977 /// See [`Self::add_scope()`] for details.
3978 pub fn add_scopes<I, St>(
3979 mut self,
3980 scopes: I,
3981 ) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C>
3982 where
3983 I: IntoIterator<Item = St>,
3984 St: AsRef<str>,
3985 {
3986 self._scopes
3987 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3988 self
3989 }
3990
3991 /// Removes all scopes, and no default scope will be used either.
3992 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3993 /// for details).
3994 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagDeleteCall<'a, C> {
3995 self._scopes.clear();
3996 self
3997 }
3998}
3999
4000/// Lists tags assigned to an Entry. The columns in the response are lowercased.
4001///
4002/// A builder for the *locations.entryGroups.entries.tags.list* method supported by a *project* resource.
4003/// It is not used directly, but through a [`ProjectMethods`] instance.
4004///
4005/// # Example
4006///
4007/// Instantiate a resource method builder
4008///
4009/// ```test_harness,no_run
4010/// # extern crate hyper;
4011/// # extern crate hyper_rustls;
4012/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
4013/// # async fn dox() {
4014/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4015///
4016/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4017/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4018/// # .with_native_roots()
4019/// # .unwrap()
4020/// # .https_only()
4021/// # .enable_http2()
4022/// # .build();
4023///
4024/// # let executor = hyper_util::rt::TokioExecutor::new();
4025/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4026/// # secret,
4027/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4028/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4029/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4030/// # ),
4031/// # ).build().await.unwrap();
4032///
4033/// # let client = hyper_util::client::legacy::Client::builder(
4034/// # hyper_util::rt::TokioExecutor::new()
4035/// # )
4036/// # .build(
4037/// # hyper_rustls::HttpsConnectorBuilder::new()
4038/// # .with_native_roots()
4039/// # .unwrap()
4040/// # .https_or_http()
4041/// # .enable_http2()
4042/// # .build()
4043/// # );
4044/// # let mut hub = DataCatalog::new(client, auth);
4045/// // You can configure optional parameters by calling the respective setters at will, and
4046/// // execute the final call using `doit()`.
4047/// // Values shown here are possibly random and not representative !
4048/// let result = hub.projects().locations_entry_groups_entries_tags_list("parent")
4049/// .page_token("amet.")
4050/// .page_size(-59)
4051/// .doit().await;
4052/// # }
4053/// ```
4054pub struct ProjectLocationEntryGroupEntryTagListCall<'a, C>
4055where
4056 C: 'a,
4057{
4058 hub: &'a DataCatalog<C>,
4059 _parent: String,
4060 _page_token: Option<String>,
4061 _page_size: Option<i32>,
4062 _delegate: Option<&'a mut dyn common::Delegate>,
4063 _additional_params: HashMap<String, String>,
4064 _scopes: BTreeSet<String>,
4065}
4066
4067impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagListCall<'a, C> {}
4068
4069impl<'a, C> ProjectLocationEntryGroupEntryTagListCall<'a, C>
4070where
4071 C: common::Connector,
4072{
4073 /// Perform the operation you have build so far.
4074 pub async fn doit(
4075 mut self,
4076 ) -> common::Result<(
4077 common::Response,
4078 GoogleCloudDatacatalogV1beta1ListTagsResponse,
4079 )> {
4080 use std::borrow::Cow;
4081 use std::io::{Read, Seek};
4082
4083 use common::{url::Params, ToParts};
4084 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4085
4086 let mut dd = common::DefaultDelegate;
4087 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4088 dlg.begin(common::MethodInfo {
4089 id: "datacatalog.projects.locations.entryGroups.entries.tags.list",
4090 http_method: hyper::Method::GET,
4091 });
4092
4093 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4094 if self._additional_params.contains_key(field) {
4095 dlg.finished(false);
4096 return Err(common::Error::FieldClash(field));
4097 }
4098 }
4099
4100 let mut params = Params::with_capacity(5 + self._additional_params.len());
4101 params.push("parent", self._parent);
4102 if let Some(value) = self._page_token.as_ref() {
4103 params.push("pageToken", value);
4104 }
4105 if let Some(value) = self._page_size.as_ref() {
4106 params.push("pageSize", value.to_string());
4107 }
4108
4109 params.extend(self._additional_params.iter());
4110
4111 params.push("alt", "json");
4112 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/tags";
4113 if self._scopes.is_empty() {
4114 self._scopes
4115 .insert(Scope::CloudPlatform.as_ref().to_string());
4116 }
4117
4118 #[allow(clippy::single_element_loop)]
4119 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4120 url = params.uri_replacement(url, param_name, find_this, true);
4121 }
4122 {
4123 let to_remove = ["parent"];
4124 params.remove_params(&to_remove);
4125 }
4126
4127 let url = params.parse_with_url(&url);
4128
4129 loop {
4130 let token = match self
4131 .hub
4132 .auth
4133 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4134 .await
4135 {
4136 Ok(token) => token,
4137 Err(e) => match dlg.token(e) {
4138 Ok(token) => token,
4139 Err(e) => {
4140 dlg.finished(false);
4141 return Err(common::Error::MissingToken(e));
4142 }
4143 },
4144 };
4145 let mut req_result = {
4146 let client = &self.hub.client;
4147 dlg.pre_request();
4148 let mut req_builder = hyper::Request::builder()
4149 .method(hyper::Method::GET)
4150 .uri(url.as_str())
4151 .header(USER_AGENT, self.hub._user_agent.clone());
4152
4153 if let Some(token) = token.as_ref() {
4154 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4155 }
4156
4157 let request = req_builder
4158 .header(CONTENT_LENGTH, 0_u64)
4159 .body(common::to_body::<String>(None));
4160
4161 client.request(request.unwrap()).await
4162 };
4163
4164 match req_result {
4165 Err(err) => {
4166 if let common::Retry::After(d) = dlg.http_error(&err) {
4167 sleep(d).await;
4168 continue;
4169 }
4170 dlg.finished(false);
4171 return Err(common::Error::HttpError(err));
4172 }
4173 Ok(res) => {
4174 let (mut parts, body) = res.into_parts();
4175 let mut body = common::Body::new(body);
4176 if !parts.status.is_success() {
4177 let bytes = common::to_bytes(body).await.unwrap_or_default();
4178 let error = serde_json::from_str(&common::to_string(&bytes));
4179 let response = common::to_response(parts, bytes.into());
4180
4181 if let common::Retry::After(d) =
4182 dlg.http_failure(&response, error.as_ref().ok())
4183 {
4184 sleep(d).await;
4185 continue;
4186 }
4187
4188 dlg.finished(false);
4189
4190 return Err(match error {
4191 Ok(value) => common::Error::BadRequest(value),
4192 _ => common::Error::Failure(response),
4193 });
4194 }
4195 let response = {
4196 let bytes = common::to_bytes(body).await.unwrap_or_default();
4197 let encoded = common::to_string(&bytes);
4198 match serde_json::from_str(&encoded) {
4199 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4200 Err(error) => {
4201 dlg.response_json_decode_error(&encoded, &error);
4202 return Err(common::Error::JsonDecodeError(
4203 encoded.to_string(),
4204 error,
4205 ));
4206 }
4207 }
4208 };
4209
4210 dlg.finished(true);
4211 return Ok(response);
4212 }
4213 }
4214 }
4215 }
4216
4217 /// Required. The name of the Data Catalog resource to list the tags of. The resource could be an Entry or an EntryGroup. Examples: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
4218 ///
4219 /// Sets the *parent* path property to the given value.
4220 ///
4221 /// Even though the property as already been set when instantiating this call,
4222 /// we provide this method for API completeness.
4223 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
4224 self._parent = new_value.to_string();
4225 self
4226 }
4227 /// Token that specifies which page is requested. If empty, the first page is returned.
4228 ///
4229 /// Sets the *page token* query property to the given value.
4230 pub fn page_token(
4231 mut self,
4232 new_value: &str,
4233 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
4234 self._page_token = Some(new_value.to_string());
4235 self
4236 }
4237 /// The maximum number of tags to return. Default is 10. Max limit is 1000.
4238 ///
4239 /// Sets the *page size* query property to the given value.
4240 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
4241 self._page_size = Some(new_value);
4242 self
4243 }
4244 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4245 /// while executing the actual API request.
4246 ///
4247 /// ````text
4248 /// It should be used to handle progress information, and to implement a certain level of resilience.
4249 /// ````
4250 ///
4251 /// Sets the *delegate* property to the given value.
4252 pub fn delegate(
4253 mut self,
4254 new_value: &'a mut dyn common::Delegate,
4255 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
4256 self._delegate = Some(new_value);
4257 self
4258 }
4259
4260 /// Set any additional parameter of the query string used in the request.
4261 /// It should be used to set parameters which are not yet available through their own
4262 /// setters.
4263 ///
4264 /// Please note that this method must not be used to set any of the known parameters
4265 /// which have their own setter method. If done anyway, the request will fail.
4266 ///
4267 /// # Additional Parameters
4268 ///
4269 /// * *$.xgafv* (query-string) - V1 error format.
4270 /// * *access_token* (query-string) - OAuth access token.
4271 /// * *alt* (query-string) - Data format for response.
4272 /// * *callback* (query-string) - JSONP
4273 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4274 /// * *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.
4275 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4276 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4277 /// * *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.
4278 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4279 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4280 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryTagListCall<'a, C>
4281 where
4282 T: AsRef<str>,
4283 {
4284 self._additional_params
4285 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4286 self
4287 }
4288
4289 /// Identifies the authorization scope for the method you are building.
4290 ///
4291 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4292 /// [`Scope::CloudPlatform`].
4293 ///
4294 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4295 /// tokens for more than one scope.
4296 ///
4297 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4298 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4299 /// sufficient, a read-write scope will do as well.
4300 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagListCall<'a, C>
4301 where
4302 St: AsRef<str>,
4303 {
4304 self._scopes.insert(String::from(scope.as_ref()));
4305 self
4306 }
4307 /// Identifies the authorization scope(s) for the method you are building.
4308 ///
4309 /// See [`Self::add_scope()`] for details.
4310 pub fn add_scopes<I, St>(
4311 mut self,
4312 scopes: I,
4313 ) -> ProjectLocationEntryGroupEntryTagListCall<'a, C>
4314 where
4315 I: IntoIterator<Item = St>,
4316 St: AsRef<str>,
4317 {
4318 self._scopes
4319 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4320 self
4321 }
4322
4323 /// Removes all scopes, and no default scope will be used either.
4324 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4325 /// for details).
4326 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagListCall<'a, C> {
4327 self._scopes.clear();
4328 self
4329 }
4330}
4331
4332/// Updates an existing tag.
4333///
4334/// A builder for the *locations.entryGroups.entries.tags.patch* method supported by a *project* resource.
4335/// It is not used directly, but through a [`ProjectMethods`] instance.
4336///
4337/// # Example
4338///
4339/// Instantiate a resource method builder
4340///
4341/// ```test_harness,no_run
4342/// # extern crate hyper;
4343/// # extern crate hyper_rustls;
4344/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
4345/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Tag;
4346/// # async fn dox() {
4347/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4348///
4349/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4350/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4351/// # .with_native_roots()
4352/// # .unwrap()
4353/// # .https_only()
4354/// # .enable_http2()
4355/// # .build();
4356///
4357/// # let executor = hyper_util::rt::TokioExecutor::new();
4358/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4359/// # secret,
4360/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4361/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4362/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4363/// # ),
4364/// # ).build().await.unwrap();
4365///
4366/// # let client = hyper_util::client::legacy::Client::builder(
4367/// # hyper_util::rt::TokioExecutor::new()
4368/// # )
4369/// # .build(
4370/// # hyper_rustls::HttpsConnectorBuilder::new()
4371/// # .with_native_roots()
4372/// # .unwrap()
4373/// # .https_or_http()
4374/// # .enable_http2()
4375/// # .build()
4376/// # );
4377/// # let mut hub = DataCatalog::new(client, auth);
4378/// // As the method needs a request, you would usually fill it with the desired information
4379/// // into the respective structure. Some of the parts shown here might not be applicable !
4380/// // Values shown here are possibly random and not representative !
4381/// let mut req = GoogleCloudDatacatalogV1beta1Tag::default();
4382///
4383/// // You can configure optional parameters by calling the respective setters at will, and
4384/// // execute the final call using `doit()`.
4385/// // Values shown here are possibly random and not representative !
4386/// let result = hub.projects().locations_entry_groups_entries_tags_patch(req, "name")
4387/// .update_mask(FieldMask::new::<&str>(&[]))
4388/// .doit().await;
4389/// # }
4390/// ```
4391pub struct ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
4392where
4393 C: 'a,
4394{
4395 hub: &'a DataCatalog<C>,
4396 _request: GoogleCloudDatacatalogV1beta1Tag,
4397 _name: String,
4398 _update_mask: Option<common::FieldMask>,
4399 _delegate: Option<&'a mut dyn common::Delegate>,
4400 _additional_params: HashMap<String, String>,
4401 _scopes: BTreeSet<String>,
4402}
4403
4404impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {}
4405
4406impl<'a, C> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
4407where
4408 C: common::Connector,
4409{
4410 /// Perform the operation you have build so far.
4411 pub async fn doit(
4412 mut self,
4413 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Tag)> {
4414 use std::borrow::Cow;
4415 use std::io::{Read, Seek};
4416
4417 use common::{url::Params, ToParts};
4418 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4419
4420 let mut dd = common::DefaultDelegate;
4421 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4422 dlg.begin(common::MethodInfo {
4423 id: "datacatalog.projects.locations.entryGroups.entries.tags.patch",
4424 http_method: hyper::Method::PATCH,
4425 });
4426
4427 for &field in ["alt", "name", "updateMask"].iter() {
4428 if self._additional_params.contains_key(field) {
4429 dlg.finished(false);
4430 return Err(common::Error::FieldClash(field));
4431 }
4432 }
4433
4434 let mut params = Params::with_capacity(5 + self._additional_params.len());
4435 params.push("name", self._name);
4436 if let Some(value) = self._update_mask.as_ref() {
4437 params.push("updateMask", value.to_string());
4438 }
4439
4440 params.extend(self._additional_params.iter());
4441
4442 params.push("alt", "json");
4443 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4444 if self._scopes.is_empty() {
4445 self._scopes
4446 .insert(Scope::CloudPlatform.as_ref().to_string());
4447 }
4448
4449 #[allow(clippy::single_element_loop)]
4450 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4451 url = params.uri_replacement(url, param_name, find_this, true);
4452 }
4453 {
4454 let to_remove = ["name"];
4455 params.remove_params(&to_remove);
4456 }
4457
4458 let url = params.parse_with_url(&url);
4459
4460 let mut json_mime_type = mime::APPLICATION_JSON;
4461 let mut request_value_reader = {
4462 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4463 common::remove_json_null_values(&mut value);
4464 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4465 serde_json::to_writer(&mut dst, &value).unwrap();
4466 dst
4467 };
4468 let request_size = request_value_reader
4469 .seek(std::io::SeekFrom::End(0))
4470 .unwrap();
4471 request_value_reader
4472 .seek(std::io::SeekFrom::Start(0))
4473 .unwrap();
4474
4475 loop {
4476 let token = match self
4477 .hub
4478 .auth
4479 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4480 .await
4481 {
4482 Ok(token) => token,
4483 Err(e) => match dlg.token(e) {
4484 Ok(token) => token,
4485 Err(e) => {
4486 dlg.finished(false);
4487 return Err(common::Error::MissingToken(e));
4488 }
4489 },
4490 };
4491 request_value_reader
4492 .seek(std::io::SeekFrom::Start(0))
4493 .unwrap();
4494 let mut req_result = {
4495 let client = &self.hub.client;
4496 dlg.pre_request();
4497 let mut req_builder = hyper::Request::builder()
4498 .method(hyper::Method::PATCH)
4499 .uri(url.as_str())
4500 .header(USER_AGENT, self.hub._user_agent.clone());
4501
4502 if let Some(token) = token.as_ref() {
4503 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4504 }
4505
4506 let request = req_builder
4507 .header(CONTENT_TYPE, json_mime_type.to_string())
4508 .header(CONTENT_LENGTH, request_size as u64)
4509 .body(common::to_body(
4510 request_value_reader.get_ref().clone().into(),
4511 ));
4512
4513 client.request(request.unwrap()).await
4514 };
4515
4516 match req_result {
4517 Err(err) => {
4518 if let common::Retry::After(d) = dlg.http_error(&err) {
4519 sleep(d).await;
4520 continue;
4521 }
4522 dlg.finished(false);
4523 return Err(common::Error::HttpError(err));
4524 }
4525 Ok(res) => {
4526 let (mut parts, body) = res.into_parts();
4527 let mut body = common::Body::new(body);
4528 if !parts.status.is_success() {
4529 let bytes = common::to_bytes(body).await.unwrap_or_default();
4530 let error = serde_json::from_str(&common::to_string(&bytes));
4531 let response = common::to_response(parts, bytes.into());
4532
4533 if let common::Retry::After(d) =
4534 dlg.http_failure(&response, error.as_ref().ok())
4535 {
4536 sleep(d).await;
4537 continue;
4538 }
4539
4540 dlg.finished(false);
4541
4542 return Err(match error {
4543 Ok(value) => common::Error::BadRequest(value),
4544 _ => common::Error::Failure(response),
4545 });
4546 }
4547 let response = {
4548 let bytes = common::to_bytes(body).await.unwrap_or_default();
4549 let encoded = common::to_string(&bytes);
4550 match serde_json::from_str(&encoded) {
4551 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4552 Err(error) => {
4553 dlg.response_json_decode_error(&encoded, &error);
4554 return Err(common::Error::JsonDecodeError(
4555 encoded.to_string(),
4556 error,
4557 ));
4558 }
4559 }
4560 };
4561
4562 dlg.finished(true);
4563 return Ok(response);
4564 }
4565 }
4566 }
4567 }
4568
4569 ///
4570 /// Sets the *request* property to the given value.
4571 ///
4572 /// Even though the property as already been set when instantiating this call,
4573 /// we provide this method for API completeness.
4574 pub fn request(
4575 mut self,
4576 new_value: GoogleCloudDatacatalogV1beta1Tag,
4577 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
4578 self._request = new_value;
4579 self
4580 }
4581 /// Identifier. The resource name of the tag in URL format. Example: * projects/{project_id}/locations/{location}/entrygroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id} where `tag_id` is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name.
4582 ///
4583 /// Sets the *name* path property to the given value.
4584 ///
4585 /// Even though the property as already been set when instantiating this call,
4586 /// we provide this method for API completeness.
4587 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
4588 self._name = new_value.to_string();
4589 self
4590 }
4591 /// Note: Currently, this parameter can only take `"fields"` as value. 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.
4592 ///
4593 /// Sets the *update mask* query property to the given value.
4594 pub fn update_mask(
4595 mut self,
4596 new_value: common::FieldMask,
4597 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
4598 self._update_mask = Some(new_value);
4599 self
4600 }
4601 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4602 /// while executing the actual API request.
4603 ///
4604 /// ````text
4605 /// It should be used to handle progress information, and to implement a certain level of resilience.
4606 /// ````
4607 ///
4608 /// Sets the *delegate* property to the given value.
4609 pub fn delegate(
4610 mut self,
4611 new_value: &'a mut dyn common::Delegate,
4612 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
4613 self._delegate = Some(new_value);
4614 self
4615 }
4616
4617 /// Set any additional parameter of the query string used in the request.
4618 /// It should be used to set parameters which are not yet available through their own
4619 /// setters.
4620 ///
4621 /// Please note that this method must not be used to set any of the known parameters
4622 /// which have their own setter method. If done anyway, the request will fail.
4623 ///
4624 /// # Additional Parameters
4625 ///
4626 /// * *$.xgafv* (query-string) - V1 error format.
4627 /// * *access_token* (query-string) - OAuth access token.
4628 /// * *alt* (query-string) - Data format for response.
4629 /// * *callback* (query-string) - JSONP
4630 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4631 /// * *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.
4632 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4633 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4634 /// * *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.
4635 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4636 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4637 pub fn param<T>(
4638 mut self,
4639 name: T,
4640 value: T,
4641 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
4642 where
4643 T: AsRef<str>,
4644 {
4645 self._additional_params
4646 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4647 self
4648 }
4649
4650 /// Identifies the authorization scope for the method you are building.
4651 ///
4652 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4653 /// [`Scope::CloudPlatform`].
4654 ///
4655 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4656 /// tokens for more than one scope.
4657 ///
4658 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4659 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4660 /// sufficient, a read-write scope will do as well.
4661 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
4662 where
4663 St: AsRef<str>,
4664 {
4665 self._scopes.insert(String::from(scope.as_ref()));
4666 self
4667 }
4668 /// Identifies the authorization scope(s) for the method you are building.
4669 ///
4670 /// See [`Self::add_scope()`] for details.
4671 pub fn add_scopes<I, St>(
4672 mut self,
4673 scopes: I,
4674 ) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C>
4675 where
4676 I: IntoIterator<Item = St>,
4677 St: AsRef<str>,
4678 {
4679 self._scopes
4680 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4681 self
4682 }
4683
4684 /// Removes all scopes, and no default scope will be used either.
4685 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4686 /// for details).
4687 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTagPatchCall<'a, C> {
4688 self._scopes.clear();
4689 self
4690 }
4691}
4692
4693/// Creates an entry. Only entries of 'FILESET' type or user-specified type can be created. Users should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information). A maximum of 100,000 entries may be created per entry group.
4694///
4695/// A builder for the *locations.entryGroups.entries.create* method supported by a *project* resource.
4696/// It is not used directly, but through a [`ProjectMethods`] instance.
4697///
4698/// # Example
4699///
4700/// Instantiate a resource method builder
4701///
4702/// ```test_harness,no_run
4703/// # extern crate hyper;
4704/// # extern crate hyper_rustls;
4705/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
4706/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Entry;
4707/// # async fn dox() {
4708/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4709///
4710/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4711/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4712/// # .with_native_roots()
4713/// # .unwrap()
4714/// # .https_only()
4715/// # .enable_http2()
4716/// # .build();
4717///
4718/// # let executor = hyper_util::rt::TokioExecutor::new();
4719/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4720/// # secret,
4721/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4722/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4723/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4724/// # ),
4725/// # ).build().await.unwrap();
4726///
4727/// # let client = hyper_util::client::legacy::Client::builder(
4728/// # hyper_util::rt::TokioExecutor::new()
4729/// # )
4730/// # .build(
4731/// # hyper_rustls::HttpsConnectorBuilder::new()
4732/// # .with_native_roots()
4733/// # .unwrap()
4734/// # .https_or_http()
4735/// # .enable_http2()
4736/// # .build()
4737/// # );
4738/// # let mut hub = DataCatalog::new(client, auth);
4739/// // As the method needs a request, you would usually fill it with the desired information
4740/// // into the respective structure. Some of the parts shown here might not be applicable !
4741/// // Values shown here are possibly random and not representative !
4742/// let mut req = GoogleCloudDatacatalogV1beta1Entry::default();
4743///
4744/// // You can configure optional parameters by calling the respective setters at will, and
4745/// // execute the final call using `doit()`.
4746/// // Values shown here are possibly random and not representative !
4747/// let result = hub.projects().locations_entry_groups_entries_create(req, "parent")
4748/// .entry_id("ipsum")
4749/// .doit().await;
4750/// # }
4751/// ```
4752pub struct ProjectLocationEntryGroupEntryCreateCall<'a, C>
4753where
4754 C: 'a,
4755{
4756 hub: &'a DataCatalog<C>,
4757 _request: GoogleCloudDatacatalogV1beta1Entry,
4758 _parent: String,
4759 _entry_id: Option<String>,
4760 _delegate: Option<&'a mut dyn common::Delegate>,
4761 _additional_params: HashMap<String, String>,
4762 _scopes: BTreeSet<String>,
4763}
4764
4765impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryCreateCall<'a, C> {}
4766
4767impl<'a, C> ProjectLocationEntryGroupEntryCreateCall<'a, C>
4768where
4769 C: common::Connector,
4770{
4771 /// Perform the operation you have build so far.
4772 pub async fn doit(
4773 mut self,
4774 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Entry)> {
4775 use std::borrow::Cow;
4776 use std::io::{Read, Seek};
4777
4778 use common::{url::Params, ToParts};
4779 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4780
4781 let mut dd = common::DefaultDelegate;
4782 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4783 dlg.begin(common::MethodInfo {
4784 id: "datacatalog.projects.locations.entryGroups.entries.create",
4785 http_method: hyper::Method::POST,
4786 });
4787
4788 for &field in ["alt", "parent", "entryId"].iter() {
4789 if self._additional_params.contains_key(field) {
4790 dlg.finished(false);
4791 return Err(common::Error::FieldClash(field));
4792 }
4793 }
4794
4795 let mut params = Params::with_capacity(5 + self._additional_params.len());
4796 params.push("parent", self._parent);
4797 if let Some(value) = self._entry_id.as_ref() {
4798 params.push("entryId", value);
4799 }
4800
4801 params.extend(self._additional_params.iter());
4802
4803 params.push("alt", "json");
4804 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/entries";
4805 if self._scopes.is_empty() {
4806 self._scopes
4807 .insert(Scope::CloudPlatform.as_ref().to_string());
4808 }
4809
4810 #[allow(clippy::single_element_loop)]
4811 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4812 url = params.uri_replacement(url, param_name, find_this, true);
4813 }
4814 {
4815 let to_remove = ["parent"];
4816 params.remove_params(&to_remove);
4817 }
4818
4819 let url = params.parse_with_url(&url);
4820
4821 let mut json_mime_type = mime::APPLICATION_JSON;
4822 let mut request_value_reader = {
4823 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4824 common::remove_json_null_values(&mut value);
4825 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4826 serde_json::to_writer(&mut dst, &value).unwrap();
4827 dst
4828 };
4829 let request_size = request_value_reader
4830 .seek(std::io::SeekFrom::End(0))
4831 .unwrap();
4832 request_value_reader
4833 .seek(std::io::SeekFrom::Start(0))
4834 .unwrap();
4835
4836 loop {
4837 let token = match self
4838 .hub
4839 .auth
4840 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4841 .await
4842 {
4843 Ok(token) => token,
4844 Err(e) => match dlg.token(e) {
4845 Ok(token) => token,
4846 Err(e) => {
4847 dlg.finished(false);
4848 return Err(common::Error::MissingToken(e));
4849 }
4850 },
4851 };
4852 request_value_reader
4853 .seek(std::io::SeekFrom::Start(0))
4854 .unwrap();
4855 let mut req_result = {
4856 let client = &self.hub.client;
4857 dlg.pre_request();
4858 let mut req_builder = hyper::Request::builder()
4859 .method(hyper::Method::POST)
4860 .uri(url.as_str())
4861 .header(USER_AGENT, self.hub._user_agent.clone());
4862
4863 if let Some(token) = token.as_ref() {
4864 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4865 }
4866
4867 let request = req_builder
4868 .header(CONTENT_TYPE, json_mime_type.to_string())
4869 .header(CONTENT_LENGTH, request_size as u64)
4870 .body(common::to_body(
4871 request_value_reader.get_ref().clone().into(),
4872 ));
4873
4874 client.request(request.unwrap()).await
4875 };
4876
4877 match req_result {
4878 Err(err) => {
4879 if let common::Retry::After(d) = dlg.http_error(&err) {
4880 sleep(d).await;
4881 continue;
4882 }
4883 dlg.finished(false);
4884 return Err(common::Error::HttpError(err));
4885 }
4886 Ok(res) => {
4887 let (mut parts, body) = res.into_parts();
4888 let mut body = common::Body::new(body);
4889 if !parts.status.is_success() {
4890 let bytes = common::to_bytes(body).await.unwrap_or_default();
4891 let error = serde_json::from_str(&common::to_string(&bytes));
4892 let response = common::to_response(parts, bytes.into());
4893
4894 if let common::Retry::After(d) =
4895 dlg.http_failure(&response, error.as_ref().ok())
4896 {
4897 sleep(d).await;
4898 continue;
4899 }
4900
4901 dlg.finished(false);
4902
4903 return Err(match error {
4904 Ok(value) => common::Error::BadRequest(value),
4905 _ => common::Error::Failure(response),
4906 });
4907 }
4908 let response = {
4909 let bytes = common::to_bytes(body).await.unwrap_or_default();
4910 let encoded = common::to_string(&bytes);
4911 match serde_json::from_str(&encoded) {
4912 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4913 Err(error) => {
4914 dlg.response_json_decode_error(&encoded, &error);
4915 return Err(common::Error::JsonDecodeError(
4916 encoded.to_string(),
4917 error,
4918 ));
4919 }
4920 }
4921 };
4922
4923 dlg.finished(true);
4924 return Ok(response);
4925 }
4926 }
4927 }
4928 }
4929
4930 ///
4931 /// Sets the *request* property to the given value.
4932 ///
4933 /// Even though the property as already been set when instantiating this call,
4934 /// we provide this method for API completeness.
4935 pub fn request(
4936 mut self,
4937 new_value: GoogleCloudDatacatalogV1beta1Entry,
4938 ) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
4939 self._request = new_value;
4940 self
4941 }
4942 /// Required. The name of the entry group this entry is in. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} Note that this Entry and its child resources may not actually be stored in the location in this name.
4943 ///
4944 /// Sets the *parent* path property to the given value.
4945 ///
4946 /// Even though the property as already been set when instantiating this call,
4947 /// we provide this method for API completeness.
4948 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
4949 self._parent = new_value.to_string();
4950 self
4951 }
4952 /// Required. The id of the entry to create.
4953 ///
4954 /// Sets the *entry id* query property to the given value.
4955 pub fn entry_id(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
4956 self._entry_id = Some(new_value.to_string());
4957 self
4958 }
4959 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4960 /// while executing the actual API request.
4961 ///
4962 /// ````text
4963 /// It should be used to handle progress information, and to implement a certain level of resilience.
4964 /// ````
4965 ///
4966 /// Sets the *delegate* property to the given value.
4967 pub fn delegate(
4968 mut self,
4969 new_value: &'a mut dyn common::Delegate,
4970 ) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
4971 self._delegate = Some(new_value);
4972 self
4973 }
4974
4975 /// Set any additional parameter of the query string used in the request.
4976 /// It should be used to set parameters which are not yet available through their own
4977 /// setters.
4978 ///
4979 /// Please note that this method must not be used to set any of the known parameters
4980 /// which have their own setter method. If done anyway, the request will fail.
4981 ///
4982 /// # Additional Parameters
4983 ///
4984 /// * *$.xgafv* (query-string) - V1 error format.
4985 /// * *access_token* (query-string) - OAuth access token.
4986 /// * *alt* (query-string) - Data format for response.
4987 /// * *callback* (query-string) - JSONP
4988 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4989 /// * *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.
4990 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4991 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4992 /// * *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.
4993 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4994 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4995 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryCreateCall<'a, C>
4996 where
4997 T: AsRef<str>,
4998 {
4999 self._additional_params
5000 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5001 self
5002 }
5003
5004 /// Identifies the authorization scope for the method you are building.
5005 ///
5006 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5007 /// [`Scope::CloudPlatform`].
5008 ///
5009 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5010 /// tokens for more than one scope.
5011 ///
5012 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5013 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5014 /// sufficient, a read-write scope will do as well.
5015 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryCreateCall<'a, C>
5016 where
5017 St: AsRef<str>,
5018 {
5019 self._scopes.insert(String::from(scope.as_ref()));
5020 self
5021 }
5022 /// Identifies the authorization scope(s) for the method you are building.
5023 ///
5024 /// See [`Self::add_scope()`] for details.
5025 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryCreateCall<'a, C>
5026 where
5027 I: IntoIterator<Item = St>,
5028 St: AsRef<str>,
5029 {
5030 self._scopes
5031 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5032 self
5033 }
5034
5035 /// Removes all scopes, and no default scope will be used either.
5036 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5037 /// for details).
5038 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryCreateCall<'a, C> {
5039 self._scopes.clear();
5040 self
5041 }
5042}
5043
5044/// Deletes an existing entry. Only entries created through CreateEntry method can be deleted. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
5045///
5046/// A builder for the *locations.entryGroups.entries.delete* method supported by a *project* resource.
5047/// It is not used directly, but through a [`ProjectMethods`] instance.
5048///
5049/// # Example
5050///
5051/// Instantiate a resource method builder
5052///
5053/// ```test_harness,no_run
5054/// # extern crate hyper;
5055/// # extern crate hyper_rustls;
5056/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
5057/// # async fn dox() {
5058/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5059///
5060/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5061/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5062/// # .with_native_roots()
5063/// # .unwrap()
5064/// # .https_only()
5065/// # .enable_http2()
5066/// # .build();
5067///
5068/// # let executor = hyper_util::rt::TokioExecutor::new();
5069/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5070/// # secret,
5071/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5072/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5073/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5074/// # ),
5075/// # ).build().await.unwrap();
5076///
5077/// # let client = hyper_util::client::legacy::Client::builder(
5078/// # hyper_util::rt::TokioExecutor::new()
5079/// # )
5080/// # .build(
5081/// # hyper_rustls::HttpsConnectorBuilder::new()
5082/// # .with_native_roots()
5083/// # .unwrap()
5084/// # .https_or_http()
5085/// # .enable_http2()
5086/// # .build()
5087/// # );
5088/// # let mut hub = DataCatalog::new(client, auth);
5089/// // You can configure optional parameters by calling the respective setters at will, and
5090/// // execute the final call using `doit()`.
5091/// // Values shown here are possibly random and not representative !
5092/// let result = hub.projects().locations_entry_groups_entries_delete("name")
5093/// .doit().await;
5094/// # }
5095/// ```
5096pub struct ProjectLocationEntryGroupEntryDeleteCall<'a, C>
5097where
5098 C: 'a,
5099{
5100 hub: &'a DataCatalog<C>,
5101 _name: String,
5102 _delegate: Option<&'a mut dyn common::Delegate>,
5103 _additional_params: HashMap<String, String>,
5104 _scopes: BTreeSet<String>,
5105}
5106
5107impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryDeleteCall<'a, C> {}
5108
5109impl<'a, C> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
5110where
5111 C: common::Connector,
5112{
5113 /// Perform the operation you have build so far.
5114 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5115 use std::borrow::Cow;
5116 use std::io::{Read, Seek};
5117
5118 use common::{url::Params, ToParts};
5119 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5120
5121 let mut dd = common::DefaultDelegate;
5122 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5123 dlg.begin(common::MethodInfo {
5124 id: "datacatalog.projects.locations.entryGroups.entries.delete",
5125 http_method: hyper::Method::DELETE,
5126 });
5127
5128 for &field in ["alt", "name"].iter() {
5129 if self._additional_params.contains_key(field) {
5130 dlg.finished(false);
5131 return Err(common::Error::FieldClash(field));
5132 }
5133 }
5134
5135 let mut params = Params::with_capacity(3 + self._additional_params.len());
5136 params.push("name", self._name);
5137
5138 params.extend(self._additional_params.iter());
5139
5140 params.push("alt", "json");
5141 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5142 if self._scopes.is_empty() {
5143 self._scopes
5144 .insert(Scope::CloudPlatform.as_ref().to_string());
5145 }
5146
5147 #[allow(clippy::single_element_loop)]
5148 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5149 url = params.uri_replacement(url, param_name, find_this, true);
5150 }
5151 {
5152 let to_remove = ["name"];
5153 params.remove_params(&to_remove);
5154 }
5155
5156 let url = params.parse_with_url(&url);
5157
5158 loop {
5159 let token = match self
5160 .hub
5161 .auth
5162 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5163 .await
5164 {
5165 Ok(token) => token,
5166 Err(e) => match dlg.token(e) {
5167 Ok(token) => token,
5168 Err(e) => {
5169 dlg.finished(false);
5170 return Err(common::Error::MissingToken(e));
5171 }
5172 },
5173 };
5174 let mut req_result = {
5175 let client = &self.hub.client;
5176 dlg.pre_request();
5177 let mut req_builder = hyper::Request::builder()
5178 .method(hyper::Method::DELETE)
5179 .uri(url.as_str())
5180 .header(USER_AGENT, self.hub._user_agent.clone());
5181
5182 if let Some(token) = token.as_ref() {
5183 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5184 }
5185
5186 let request = req_builder
5187 .header(CONTENT_LENGTH, 0_u64)
5188 .body(common::to_body::<String>(None));
5189
5190 client.request(request.unwrap()).await
5191 };
5192
5193 match req_result {
5194 Err(err) => {
5195 if let common::Retry::After(d) = dlg.http_error(&err) {
5196 sleep(d).await;
5197 continue;
5198 }
5199 dlg.finished(false);
5200 return Err(common::Error::HttpError(err));
5201 }
5202 Ok(res) => {
5203 let (mut parts, body) = res.into_parts();
5204 let mut body = common::Body::new(body);
5205 if !parts.status.is_success() {
5206 let bytes = common::to_bytes(body).await.unwrap_or_default();
5207 let error = serde_json::from_str(&common::to_string(&bytes));
5208 let response = common::to_response(parts, bytes.into());
5209
5210 if let common::Retry::After(d) =
5211 dlg.http_failure(&response, error.as_ref().ok())
5212 {
5213 sleep(d).await;
5214 continue;
5215 }
5216
5217 dlg.finished(false);
5218
5219 return Err(match error {
5220 Ok(value) => common::Error::BadRequest(value),
5221 _ => common::Error::Failure(response),
5222 });
5223 }
5224 let response = {
5225 let bytes = common::to_bytes(body).await.unwrap_or_default();
5226 let encoded = common::to_string(&bytes);
5227 match serde_json::from_str(&encoded) {
5228 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5229 Err(error) => {
5230 dlg.response_json_decode_error(&encoded, &error);
5231 return Err(common::Error::JsonDecodeError(
5232 encoded.to_string(),
5233 error,
5234 ));
5235 }
5236 }
5237 };
5238
5239 dlg.finished(true);
5240 return Ok(response);
5241 }
5242 }
5243 }
5244 }
5245
5246 /// Required. The name of the entry. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
5247 ///
5248 /// Sets the *name* path property to the given value.
5249 ///
5250 /// Even though the property as already been set when instantiating this call,
5251 /// we provide this method for API completeness.
5252 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
5253 self._name = new_value.to_string();
5254 self
5255 }
5256 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5257 /// while executing the actual API request.
5258 ///
5259 /// ````text
5260 /// It should be used to handle progress information, and to implement a certain level of resilience.
5261 /// ````
5262 ///
5263 /// Sets the *delegate* property to the given value.
5264 pub fn delegate(
5265 mut self,
5266 new_value: &'a mut dyn common::Delegate,
5267 ) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
5268 self._delegate = Some(new_value);
5269 self
5270 }
5271
5272 /// Set any additional parameter of the query string used in the request.
5273 /// It should be used to set parameters which are not yet available through their own
5274 /// setters.
5275 ///
5276 /// Please note that this method must not be used to set any of the known parameters
5277 /// which have their own setter method. If done anyway, the request will fail.
5278 ///
5279 /// # Additional Parameters
5280 ///
5281 /// * *$.xgafv* (query-string) - V1 error format.
5282 /// * *access_token* (query-string) - OAuth access token.
5283 /// * *alt* (query-string) - Data format for response.
5284 /// * *callback* (query-string) - JSONP
5285 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5286 /// * *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.
5287 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5288 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5289 /// * *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.
5290 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5291 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5292 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
5293 where
5294 T: AsRef<str>,
5295 {
5296 self._additional_params
5297 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5298 self
5299 }
5300
5301 /// Identifies the authorization scope for the method you are building.
5302 ///
5303 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5304 /// [`Scope::CloudPlatform`].
5305 ///
5306 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5307 /// tokens for more than one scope.
5308 ///
5309 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5310 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5311 /// sufficient, a read-write scope will do as well.
5312 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
5313 where
5314 St: AsRef<str>,
5315 {
5316 self._scopes.insert(String::from(scope.as_ref()));
5317 self
5318 }
5319 /// Identifies the authorization scope(s) for the method you are building.
5320 ///
5321 /// See [`Self::add_scope()`] for details.
5322 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C>
5323 where
5324 I: IntoIterator<Item = St>,
5325 St: AsRef<str>,
5326 {
5327 self._scopes
5328 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5329 self
5330 }
5331
5332 /// Removes all scopes, and no default scope will be used either.
5333 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5334 /// for details).
5335 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryDeleteCall<'a, C> {
5336 self._scopes.clear();
5337 self
5338 }
5339}
5340
5341/// Gets an entry.
5342///
5343/// A builder for the *locations.entryGroups.entries.get* method supported by a *project* resource.
5344/// It is not used directly, but through a [`ProjectMethods`] instance.
5345///
5346/// # Example
5347///
5348/// Instantiate a resource method builder
5349///
5350/// ```test_harness,no_run
5351/// # extern crate hyper;
5352/// # extern crate hyper_rustls;
5353/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
5354/// # async fn dox() {
5355/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5356///
5357/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5358/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5359/// # .with_native_roots()
5360/// # .unwrap()
5361/// # .https_only()
5362/// # .enable_http2()
5363/// # .build();
5364///
5365/// # let executor = hyper_util::rt::TokioExecutor::new();
5366/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5367/// # secret,
5368/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5369/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5370/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5371/// # ),
5372/// # ).build().await.unwrap();
5373///
5374/// # let client = hyper_util::client::legacy::Client::builder(
5375/// # hyper_util::rt::TokioExecutor::new()
5376/// # )
5377/// # .build(
5378/// # hyper_rustls::HttpsConnectorBuilder::new()
5379/// # .with_native_roots()
5380/// # .unwrap()
5381/// # .https_or_http()
5382/// # .enable_http2()
5383/// # .build()
5384/// # );
5385/// # let mut hub = DataCatalog::new(client, auth);
5386/// // You can configure optional parameters by calling the respective setters at will, and
5387/// // execute the final call using `doit()`.
5388/// // Values shown here are possibly random and not representative !
5389/// let result = hub.projects().locations_entry_groups_entries_get("name")
5390/// .doit().await;
5391/// # }
5392/// ```
5393pub struct ProjectLocationEntryGroupEntryGetCall<'a, C>
5394where
5395 C: 'a,
5396{
5397 hub: &'a DataCatalog<C>,
5398 _name: String,
5399 _delegate: Option<&'a mut dyn common::Delegate>,
5400 _additional_params: HashMap<String, String>,
5401 _scopes: BTreeSet<String>,
5402}
5403
5404impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryGetCall<'a, C> {}
5405
5406impl<'a, C> ProjectLocationEntryGroupEntryGetCall<'a, C>
5407where
5408 C: common::Connector,
5409{
5410 /// Perform the operation you have build so far.
5411 pub async fn doit(
5412 mut self,
5413 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Entry)> {
5414 use std::borrow::Cow;
5415 use std::io::{Read, Seek};
5416
5417 use common::{url::Params, ToParts};
5418 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5419
5420 let mut dd = common::DefaultDelegate;
5421 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5422 dlg.begin(common::MethodInfo {
5423 id: "datacatalog.projects.locations.entryGroups.entries.get",
5424 http_method: hyper::Method::GET,
5425 });
5426
5427 for &field in ["alt", "name"].iter() {
5428 if self._additional_params.contains_key(field) {
5429 dlg.finished(false);
5430 return Err(common::Error::FieldClash(field));
5431 }
5432 }
5433
5434 let mut params = Params::with_capacity(3 + self._additional_params.len());
5435 params.push("name", self._name);
5436
5437 params.extend(self._additional_params.iter());
5438
5439 params.push("alt", "json");
5440 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5441 if self._scopes.is_empty() {
5442 self._scopes
5443 .insert(Scope::CloudPlatform.as_ref().to_string());
5444 }
5445
5446 #[allow(clippy::single_element_loop)]
5447 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5448 url = params.uri_replacement(url, param_name, find_this, true);
5449 }
5450 {
5451 let to_remove = ["name"];
5452 params.remove_params(&to_remove);
5453 }
5454
5455 let url = params.parse_with_url(&url);
5456
5457 loop {
5458 let token = match self
5459 .hub
5460 .auth
5461 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5462 .await
5463 {
5464 Ok(token) => token,
5465 Err(e) => match dlg.token(e) {
5466 Ok(token) => token,
5467 Err(e) => {
5468 dlg.finished(false);
5469 return Err(common::Error::MissingToken(e));
5470 }
5471 },
5472 };
5473 let mut req_result = {
5474 let client = &self.hub.client;
5475 dlg.pre_request();
5476 let mut req_builder = hyper::Request::builder()
5477 .method(hyper::Method::GET)
5478 .uri(url.as_str())
5479 .header(USER_AGENT, self.hub._user_agent.clone());
5480
5481 if let Some(token) = token.as_ref() {
5482 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5483 }
5484
5485 let request = req_builder
5486 .header(CONTENT_LENGTH, 0_u64)
5487 .body(common::to_body::<String>(None));
5488
5489 client.request(request.unwrap()).await
5490 };
5491
5492 match req_result {
5493 Err(err) => {
5494 if let common::Retry::After(d) = dlg.http_error(&err) {
5495 sleep(d).await;
5496 continue;
5497 }
5498 dlg.finished(false);
5499 return Err(common::Error::HttpError(err));
5500 }
5501 Ok(res) => {
5502 let (mut parts, body) = res.into_parts();
5503 let mut body = common::Body::new(body);
5504 if !parts.status.is_success() {
5505 let bytes = common::to_bytes(body).await.unwrap_or_default();
5506 let error = serde_json::from_str(&common::to_string(&bytes));
5507 let response = common::to_response(parts, bytes.into());
5508
5509 if let common::Retry::After(d) =
5510 dlg.http_failure(&response, error.as_ref().ok())
5511 {
5512 sleep(d).await;
5513 continue;
5514 }
5515
5516 dlg.finished(false);
5517
5518 return Err(match error {
5519 Ok(value) => common::Error::BadRequest(value),
5520 _ => common::Error::Failure(response),
5521 });
5522 }
5523 let response = {
5524 let bytes = common::to_bytes(body).await.unwrap_or_default();
5525 let encoded = common::to_string(&bytes);
5526 match serde_json::from_str(&encoded) {
5527 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5528 Err(error) => {
5529 dlg.response_json_decode_error(&encoded, &error);
5530 return Err(common::Error::JsonDecodeError(
5531 encoded.to_string(),
5532 error,
5533 ));
5534 }
5535 }
5536 };
5537
5538 dlg.finished(true);
5539 return Ok(response);
5540 }
5541 }
5542 }
5543 }
5544
5545 /// Required. The name of the entry. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
5546 ///
5547 /// Sets the *name* path property to the given value.
5548 ///
5549 /// Even though the property as already been set when instantiating this call,
5550 /// we provide this method for API completeness.
5551 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
5552 self._name = new_value.to_string();
5553 self
5554 }
5555 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5556 /// while executing the actual API request.
5557 ///
5558 /// ````text
5559 /// It should be used to handle progress information, and to implement a certain level of resilience.
5560 /// ````
5561 ///
5562 /// Sets the *delegate* property to the given value.
5563 pub fn delegate(
5564 mut self,
5565 new_value: &'a mut dyn common::Delegate,
5566 ) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
5567 self._delegate = Some(new_value);
5568 self
5569 }
5570
5571 /// Set any additional parameter of the query string used in the request.
5572 /// It should be used to set parameters which are not yet available through their own
5573 /// setters.
5574 ///
5575 /// Please note that this method must not be used to set any of the known parameters
5576 /// which have their own setter method. If done anyway, the request will fail.
5577 ///
5578 /// # Additional Parameters
5579 ///
5580 /// * *$.xgafv* (query-string) - V1 error format.
5581 /// * *access_token* (query-string) - OAuth access token.
5582 /// * *alt* (query-string) - Data format for response.
5583 /// * *callback* (query-string) - JSONP
5584 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5585 /// * *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.
5586 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5587 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5588 /// * *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.
5589 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5590 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5591 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryGetCall<'a, C>
5592 where
5593 T: AsRef<str>,
5594 {
5595 self._additional_params
5596 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5597 self
5598 }
5599
5600 /// Identifies the authorization scope for the method you are building.
5601 ///
5602 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5603 /// [`Scope::CloudPlatform`].
5604 ///
5605 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5606 /// tokens for more than one scope.
5607 ///
5608 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5609 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5610 /// sufficient, a read-write scope will do as well.
5611 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryGetCall<'a, C>
5612 where
5613 St: AsRef<str>,
5614 {
5615 self._scopes.insert(String::from(scope.as_ref()));
5616 self
5617 }
5618 /// Identifies the authorization scope(s) for the method you are building.
5619 ///
5620 /// See [`Self::add_scope()`] for details.
5621 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryGetCall<'a, C>
5622 where
5623 I: IntoIterator<Item = St>,
5624 St: AsRef<str>,
5625 {
5626 self._scopes
5627 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5628 self
5629 }
5630
5631 /// Removes all scopes, and no default scope will be used either.
5632 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5633 /// for details).
5634 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryGetCall<'a, C> {
5635 self._scopes.clear();
5636 self
5637 }
5638}
5639
5640/// Gets the access control policy for a resource. A `NOT_FOUND` error is returned if the resource does not exist. An empty policy is returned if the resource exists but does not have a policy set on it. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entries.getIamPolicy` to get policies on entries. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
5641///
5642/// A builder for the *locations.entryGroups.entries.getIamPolicy* method supported by a *project* resource.
5643/// It is not used directly, but through a [`ProjectMethods`] instance.
5644///
5645/// # Example
5646///
5647/// Instantiate a resource method builder
5648///
5649/// ```test_harness,no_run
5650/// # extern crate hyper;
5651/// # extern crate hyper_rustls;
5652/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
5653/// use datacatalog1_beta1::api::GetIamPolicyRequest;
5654/// # async fn dox() {
5655/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5656///
5657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5658/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5659/// # .with_native_roots()
5660/// # .unwrap()
5661/// # .https_only()
5662/// # .enable_http2()
5663/// # .build();
5664///
5665/// # let executor = hyper_util::rt::TokioExecutor::new();
5666/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5667/// # secret,
5668/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5669/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5670/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5671/// # ),
5672/// # ).build().await.unwrap();
5673///
5674/// # let client = hyper_util::client::legacy::Client::builder(
5675/// # hyper_util::rt::TokioExecutor::new()
5676/// # )
5677/// # .build(
5678/// # hyper_rustls::HttpsConnectorBuilder::new()
5679/// # .with_native_roots()
5680/// # .unwrap()
5681/// # .https_or_http()
5682/// # .enable_http2()
5683/// # .build()
5684/// # );
5685/// # let mut hub = DataCatalog::new(client, auth);
5686/// // As the method needs a request, you would usually fill it with the desired information
5687/// // into the respective structure. Some of the parts shown here might not be applicable !
5688/// // Values shown here are possibly random and not representative !
5689/// let mut req = GetIamPolicyRequest::default();
5690///
5691/// // You can configure optional parameters by calling the respective setters at will, and
5692/// // execute the final call using `doit()`.
5693/// // Values shown here are possibly random and not representative !
5694/// let result = hub.projects().locations_entry_groups_entries_get_iam_policy(req, "resource")
5695/// .doit().await;
5696/// # }
5697/// ```
5698pub struct ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
5699where
5700 C: 'a,
5701{
5702 hub: &'a DataCatalog<C>,
5703 _request: GetIamPolicyRequest,
5704 _resource: String,
5705 _delegate: Option<&'a mut dyn common::Delegate>,
5706 _additional_params: HashMap<String, String>,
5707 _scopes: BTreeSet<String>,
5708}
5709
5710impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {}
5711
5712impl<'a, C> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
5713where
5714 C: common::Connector,
5715{
5716 /// Perform the operation you have build so far.
5717 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5718 use std::borrow::Cow;
5719 use std::io::{Read, Seek};
5720
5721 use common::{url::Params, ToParts};
5722 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5723
5724 let mut dd = common::DefaultDelegate;
5725 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5726 dlg.begin(common::MethodInfo {
5727 id: "datacatalog.projects.locations.entryGroups.entries.getIamPolicy",
5728 http_method: hyper::Method::POST,
5729 });
5730
5731 for &field in ["alt", "resource"].iter() {
5732 if self._additional_params.contains_key(field) {
5733 dlg.finished(false);
5734 return Err(common::Error::FieldClash(field));
5735 }
5736 }
5737
5738 let mut params = Params::with_capacity(4 + self._additional_params.len());
5739 params.push("resource", self._resource);
5740
5741 params.extend(self._additional_params.iter());
5742
5743 params.push("alt", "json");
5744 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
5745 if self._scopes.is_empty() {
5746 self._scopes
5747 .insert(Scope::CloudPlatform.as_ref().to_string());
5748 }
5749
5750 #[allow(clippy::single_element_loop)]
5751 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5752 url = params.uri_replacement(url, param_name, find_this, true);
5753 }
5754 {
5755 let to_remove = ["resource"];
5756 params.remove_params(&to_remove);
5757 }
5758
5759 let url = params.parse_with_url(&url);
5760
5761 let mut json_mime_type = mime::APPLICATION_JSON;
5762 let mut request_value_reader = {
5763 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5764 common::remove_json_null_values(&mut value);
5765 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5766 serde_json::to_writer(&mut dst, &value).unwrap();
5767 dst
5768 };
5769 let request_size = request_value_reader
5770 .seek(std::io::SeekFrom::End(0))
5771 .unwrap();
5772 request_value_reader
5773 .seek(std::io::SeekFrom::Start(0))
5774 .unwrap();
5775
5776 loop {
5777 let token = match self
5778 .hub
5779 .auth
5780 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5781 .await
5782 {
5783 Ok(token) => token,
5784 Err(e) => match dlg.token(e) {
5785 Ok(token) => token,
5786 Err(e) => {
5787 dlg.finished(false);
5788 return Err(common::Error::MissingToken(e));
5789 }
5790 },
5791 };
5792 request_value_reader
5793 .seek(std::io::SeekFrom::Start(0))
5794 .unwrap();
5795 let mut req_result = {
5796 let client = &self.hub.client;
5797 dlg.pre_request();
5798 let mut req_builder = hyper::Request::builder()
5799 .method(hyper::Method::POST)
5800 .uri(url.as_str())
5801 .header(USER_AGENT, self.hub._user_agent.clone());
5802
5803 if let Some(token) = token.as_ref() {
5804 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5805 }
5806
5807 let request = req_builder
5808 .header(CONTENT_TYPE, json_mime_type.to_string())
5809 .header(CONTENT_LENGTH, request_size as u64)
5810 .body(common::to_body(
5811 request_value_reader.get_ref().clone().into(),
5812 ));
5813
5814 client.request(request.unwrap()).await
5815 };
5816
5817 match req_result {
5818 Err(err) => {
5819 if let common::Retry::After(d) = dlg.http_error(&err) {
5820 sleep(d).await;
5821 continue;
5822 }
5823 dlg.finished(false);
5824 return Err(common::Error::HttpError(err));
5825 }
5826 Ok(res) => {
5827 let (mut parts, body) = res.into_parts();
5828 let mut body = common::Body::new(body);
5829 if !parts.status.is_success() {
5830 let bytes = common::to_bytes(body).await.unwrap_or_default();
5831 let error = serde_json::from_str(&common::to_string(&bytes));
5832 let response = common::to_response(parts, bytes.into());
5833
5834 if let common::Retry::After(d) =
5835 dlg.http_failure(&response, error.as_ref().ok())
5836 {
5837 sleep(d).await;
5838 continue;
5839 }
5840
5841 dlg.finished(false);
5842
5843 return Err(match error {
5844 Ok(value) => common::Error::BadRequest(value),
5845 _ => common::Error::Failure(response),
5846 });
5847 }
5848 let response = {
5849 let bytes = common::to_bytes(body).await.unwrap_or_default();
5850 let encoded = common::to_string(&bytes);
5851 match serde_json::from_str(&encoded) {
5852 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5853 Err(error) => {
5854 dlg.response_json_decode_error(&encoded, &error);
5855 return Err(common::Error::JsonDecodeError(
5856 encoded.to_string(),
5857 error,
5858 ));
5859 }
5860 }
5861 };
5862
5863 dlg.finished(true);
5864 return Ok(response);
5865 }
5866 }
5867 }
5868 }
5869
5870 ///
5871 /// Sets the *request* property to the given value.
5872 ///
5873 /// Even though the property as already been set when instantiating this call,
5874 /// we provide this method for API completeness.
5875 pub fn request(
5876 mut self,
5877 new_value: GetIamPolicyRequest,
5878 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
5879 self._request = new_value;
5880 self
5881 }
5882 /// 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.
5883 ///
5884 /// Sets the *resource* path property to the given value.
5885 ///
5886 /// Even though the property as already been set when instantiating this call,
5887 /// we provide this method for API completeness.
5888 pub fn resource(
5889 mut self,
5890 new_value: &str,
5891 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
5892 self._resource = new_value.to_string();
5893 self
5894 }
5895 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5896 /// while executing the actual API request.
5897 ///
5898 /// ````text
5899 /// It should be used to handle progress information, and to implement a certain level of resilience.
5900 /// ````
5901 ///
5902 /// Sets the *delegate* property to the given value.
5903 pub fn delegate(
5904 mut self,
5905 new_value: &'a mut dyn common::Delegate,
5906 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
5907 self._delegate = Some(new_value);
5908 self
5909 }
5910
5911 /// Set any additional parameter of the query string used in the request.
5912 /// It should be used to set parameters which are not yet available through their own
5913 /// setters.
5914 ///
5915 /// Please note that this method must not be used to set any of the known parameters
5916 /// which have their own setter method. If done anyway, the request will fail.
5917 ///
5918 /// # Additional Parameters
5919 ///
5920 /// * *$.xgafv* (query-string) - V1 error format.
5921 /// * *access_token* (query-string) - OAuth access token.
5922 /// * *alt* (query-string) - Data format for response.
5923 /// * *callback* (query-string) - JSONP
5924 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5925 /// * *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.
5926 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5927 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5928 /// * *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.
5929 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5930 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5931 pub fn param<T>(
5932 mut self,
5933 name: T,
5934 value: T,
5935 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
5936 where
5937 T: AsRef<str>,
5938 {
5939 self._additional_params
5940 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5941 self
5942 }
5943
5944 /// Identifies the authorization scope for the method you are building.
5945 ///
5946 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5947 /// [`Scope::CloudPlatform`].
5948 ///
5949 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5950 /// tokens for more than one scope.
5951 ///
5952 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5953 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5954 /// sufficient, a read-write scope will do as well.
5955 pub fn add_scope<St>(
5956 mut self,
5957 scope: St,
5958 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
5959 where
5960 St: AsRef<str>,
5961 {
5962 self._scopes.insert(String::from(scope.as_ref()));
5963 self
5964 }
5965 /// Identifies the authorization scope(s) for the method you are building.
5966 ///
5967 /// See [`Self::add_scope()`] for details.
5968 pub fn add_scopes<I, St>(
5969 mut self,
5970 scopes: I,
5971 ) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C>
5972 where
5973 I: IntoIterator<Item = St>,
5974 St: AsRef<str>,
5975 {
5976 self._scopes
5977 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5978 self
5979 }
5980
5981 /// Removes all scopes, and no default scope will be used either.
5982 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5983 /// for details).
5984 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryGetIamPolicyCall<'a, C> {
5985 self._scopes.clear();
5986 self
5987 }
5988}
5989
5990/// Lists entries.
5991///
5992/// A builder for the *locations.entryGroups.entries.list* method supported by a *project* resource.
5993/// It is not used directly, but through a [`ProjectMethods`] instance.
5994///
5995/// # Example
5996///
5997/// Instantiate a resource method builder
5998///
5999/// ```test_harness,no_run
6000/// # extern crate hyper;
6001/// # extern crate hyper_rustls;
6002/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
6003/// # async fn dox() {
6004/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6005///
6006/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6007/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6008/// # .with_native_roots()
6009/// # .unwrap()
6010/// # .https_only()
6011/// # .enable_http2()
6012/// # .build();
6013///
6014/// # let executor = hyper_util::rt::TokioExecutor::new();
6015/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6016/// # secret,
6017/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6018/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6019/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6020/// # ),
6021/// # ).build().await.unwrap();
6022///
6023/// # let client = hyper_util::client::legacy::Client::builder(
6024/// # hyper_util::rt::TokioExecutor::new()
6025/// # )
6026/// # .build(
6027/// # hyper_rustls::HttpsConnectorBuilder::new()
6028/// # .with_native_roots()
6029/// # .unwrap()
6030/// # .https_or_http()
6031/// # .enable_http2()
6032/// # .build()
6033/// # );
6034/// # let mut hub = DataCatalog::new(client, auth);
6035/// // You can configure optional parameters by calling the respective setters at will, and
6036/// // execute the final call using `doit()`.
6037/// // Values shown here are possibly random and not representative !
6038/// let result = hub.projects().locations_entry_groups_entries_list("parent")
6039/// .read_mask(FieldMask::new::<&str>(&[]))
6040/// .page_token("dolor")
6041/// .page_size(-17)
6042/// .doit().await;
6043/// # }
6044/// ```
6045pub struct ProjectLocationEntryGroupEntryListCall<'a, C>
6046where
6047 C: 'a,
6048{
6049 hub: &'a DataCatalog<C>,
6050 _parent: String,
6051 _read_mask: Option<common::FieldMask>,
6052 _page_token: Option<String>,
6053 _page_size: Option<i32>,
6054 _delegate: Option<&'a mut dyn common::Delegate>,
6055 _additional_params: HashMap<String, String>,
6056 _scopes: BTreeSet<String>,
6057}
6058
6059impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryListCall<'a, C> {}
6060
6061impl<'a, C> ProjectLocationEntryGroupEntryListCall<'a, C>
6062where
6063 C: common::Connector,
6064{
6065 /// Perform the operation you have build so far.
6066 pub async fn doit(
6067 mut self,
6068 ) -> common::Result<(
6069 common::Response,
6070 GoogleCloudDatacatalogV1beta1ListEntriesResponse,
6071 )> {
6072 use std::borrow::Cow;
6073 use std::io::{Read, Seek};
6074
6075 use common::{url::Params, ToParts};
6076 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6077
6078 let mut dd = common::DefaultDelegate;
6079 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6080 dlg.begin(common::MethodInfo {
6081 id: "datacatalog.projects.locations.entryGroups.entries.list",
6082 http_method: hyper::Method::GET,
6083 });
6084
6085 for &field in ["alt", "parent", "readMask", "pageToken", "pageSize"].iter() {
6086 if self._additional_params.contains_key(field) {
6087 dlg.finished(false);
6088 return Err(common::Error::FieldClash(field));
6089 }
6090 }
6091
6092 let mut params = Params::with_capacity(6 + self._additional_params.len());
6093 params.push("parent", self._parent);
6094 if let Some(value) = self._read_mask.as_ref() {
6095 params.push("readMask", value.to_string());
6096 }
6097 if let Some(value) = self._page_token.as_ref() {
6098 params.push("pageToken", value);
6099 }
6100 if let Some(value) = self._page_size.as_ref() {
6101 params.push("pageSize", value.to_string());
6102 }
6103
6104 params.extend(self._additional_params.iter());
6105
6106 params.push("alt", "json");
6107 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/entries";
6108 if self._scopes.is_empty() {
6109 self._scopes
6110 .insert(Scope::CloudPlatform.as_ref().to_string());
6111 }
6112
6113 #[allow(clippy::single_element_loop)]
6114 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6115 url = params.uri_replacement(url, param_name, find_this, true);
6116 }
6117 {
6118 let to_remove = ["parent"];
6119 params.remove_params(&to_remove);
6120 }
6121
6122 let url = params.parse_with_url(&url);
6123
6124 loop {
6125 let token = match self
6126 .hub
6127 .auth
6128 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6129 .await
6130 {
6131 Ok(token) => token,
6132 Err(e) => match dlg.token(e) {
6133 Ok(token) => token,
6134 Err(e) => {
6135 dlg.finished(false);
6136 return Err(common::Error::MissingToken(e));
6137 }
6138 },
6139 };
6140 let mut req_result = {
6141 let client = &self.hub.client;
6142 dlg.pre_request();
6143 let mut req_builder = hyper::Request::builder()
6144 .method(hyper::Method::GET)
6145 .uri(url.as_str())
6146 .header(USER_AGENT, self.hub._user_agent.clone());
6147
6148 if let Some(token) = token.as_ref() {
6149 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6150 }
6151
6152 let request = req_builder
6153 .header(CONTENT_LENGTH, 0_u64)
6154 .body(common::to_body::<String>(None));
6155
6156 client.request(request.unwrap()).await
6157 };
6158
6159 match req_result {
6160 Err(err) => {
6161 if let common::Retry::After(d) = dlg.http_error(&err) {
6162 sleep(d).await;
6163 continue;
6164 }
6165 dlg.finished(false);
6166 return Err(common::Error::HttpError(err));
6167 }
6168 Ok(res) => {
6169 let (mut parts, body) = res.into_parts();
6170 let mut body = common::Body::new(body);
6171 if !parts.status.is_success() {
6172 let bytes = common::to_bytes(body).await.unwrap_or_default();
6173 let error = serde_json::from_str(&common::to_string(&bytes));
6174 let response = common::to_response(parts, bytes.into());
6175
6176 if let common::Retry::After(d) =
6177 dlg.http_failure(&response, error.as_ref().ok())
6178 {
6179 sleep(d).await;
6180 continue;
6181 }
6182
6183 dlg.finished(false);
6184
6185 return Err(match error {
6186 Ok(value) => common::Error::BadRequest(value),
6187 _ => common::Error::Failure(response),
6188 });
6189 }
6190 let response = {
6191 let bytes = common::to_bytes(body).await.unwrap_or_default();
6192 let encoded = common::to_string(&bytes);
6193 match serde_json::from_str(&encoded) {
6194 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6195 Err(error) => {
6196 dlg.response_json_decode_error(&encoded, &error);
6197 return Err(common::Error::JsonDecodeError(
6198 encoded.to_string(),
6199 error,
6200 ));
6201 }
6202 }
6203 };
6204
6205 dlg.finished(true);
6206 return Ok(response);
6207 }
6208 }
6209 }
6210 }
6211
6212 /// Required. The name of the entry group that contains the entries, which can be provided in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}
6213 ///
6214 /// Sets the *parent* path property to the given value.
6215 ///
6216 /// Even though the property as already been set when instantiating this call,
6217 /// we provide this method for API completeness.
6218 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
6219 self._parent = new_value.to_string();
6220 self
6221 }
6222 /// The fields to return for each Entry. If not set or empty, all fields are returned. For example, setting read_mask to contain only one path "name" will cause ListEntries to return a list of Entries with only "name" field.
6223 ///
6224 /// Sets the *read mask* query property to the given value.
6225 pub fn read_mask(
6226 mut self,
6227 new_value: common::FieldMask,
6228 ) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
6229 self._read_mask = Some(new_value);
6230 self
6231 }
6232 /// Token that specifies which page is requested. If empty, the first page is returned.
6233 ///
6234 /// Sets the *page token* query property to the given value.
6235 pub fn page_token(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
6236 self._page_token = Some(new_value.to_string());
6237 self
6238 }
6239 /// The maximum number of items to return. Default is 10. Max limit is 1000. Throws an invalid argument for `page_size > 1000`.
6240 ///
6241 /// Sets the *page size* query property to the given value.
6242 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
6243 self._page_size = Some(new_value);
6244 self
6245 }
6246 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6247 /// while executing the actual API request.
6248 ///
6249 /// ````text
6250 /// It should be used to handle progress information, and to implement a certain level of resilience.
6251 /// ````
6252 ///
6253 /// Sets the *delegate* property to the given value.
6254 pub fn delegate(
6255 mut self,
6256 new_value: &'a mut dyn common::Delegate,
6257 ) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
6258 self._delegate = Some(new_value);
6259 self
6260 }
6261
6262 /// Set any additional parameter of the query string used in the request.
6263 /// It should be used to set parameters which are not yet available through their own
6264 /// setters.
6265 ///
6266 /// Please note that this method must not be used to set any of the known parameters
6267 /// which have their own setter method. If done anyway, the request will fail.
6268 ///
6269 /// # Additional Parameters
6270 ///
6271 /// * *$.xgafv* (query-string) - V1 error format.
6272 /// * *access_token* (query-string) - OAuth access token.
6273 /// * *alt* (query-string) - Data format for response.
6274 /// * *callback* (query-string) - JSONP
6275 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6276 /// * *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.
6277 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6278 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6279 /// * *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.
6280 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6281 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6282 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryListCall<'a, C>
6283 where
6284 T: AsRef<str>,
6285 {
6286 self._additional_params
6287 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6288 self
6289 }
6290
6291 /// Identifies the authorization scope for the method you are building.
6292 ///
6293 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6294 /// [`Scope::CloudPlatform`].
6295 ///
6296 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6297 /// tokens for more than one scope.
6298 ///
6299 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6300 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6301 /// sufficient, a read-write scope will do as well.
6302 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryListCall<'a, C>
6303 where
6304 St: AsRef<str>,
6305 {
6306 self._scopes.insert(String::from(scope.as_ref()));
6307 self
6308 }
6309 /// Identifies the authorization scope(s) for the method you are building.
6310 ///
6311 /// See [`Self::add_scope()`] for details.
6312 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryListCall<'a, C>
6313 where
6314 I: IntoIterator<Item = St>,
6315 St: AsRef<str>,
6316 {
6317 self._scopes
6318 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6319 self
6320 }
6321
6322 /// Removes all scopes, and no default scope will be used either.
6323 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6324 /// for details).
6325 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryListCall<'a, C> {
6326 self._scopes.clear();
6327 self
6328 }
6329}
6330
6331/// Updates an existing entry. Users should enable the Data Catalog API in the project identified by the `entry.name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
6332///
6333/// A builder for the *locations.entryGroups.entries.patch* method supported by a *project* resource.
6334/// It is not used directly, but through a [`ProjectMethods`] instance.
6335///
6336/// # Example
6337///
6338/// Instantiate a resource method builder
6339///
6340/// ```test_harness,no_run
6341/// # extern crate hyper;
6342/// # extern crate hyper_rustls;
6343/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
6344/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Entry;
6345/// # async fn dox() {
6346/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6347///
6348/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6349/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6350/// # .with_native_roots()
6351/// # .unwrap()
6352/// # .https_only()
6353/// # .enable_http2()
6354/// # .build();
6355///
6356/// # let executor = hyper_util::rt::TokioExecutor::new();
6357/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6358/// # secret,
6359/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6360/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6361/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6362/// # ),
6363/// # ).build().await.unwrap();
6364///
6365/// # let client = hyper_util::client::legacy::Client::builder(
6366/// # hyper_util::rt::TokioExecutor::new()
6367/// # )
6368/// # .build(
6369/// # hyper_rustls::HttpsConnectorBuilder::new()
6370/// # .with_native_roots()
6371/// # .unwrap()
6372/// # .https_or_http()
6373/// # .enable_http2()
6374/// # .build()
6375/// # );
6376/// # let mut hub = DataCatalog::new(client, auth);
6377/// // As the method needs a request, you would usually fill it with the desired information
6378/// // into the respective structure. Some of the parts shown here might not be applicable !
6379/// // Values shown here are possibly random and not representative !
6380/// let mut req = GoogleCloudDatacatalogV1beta1Entry::default();
6381///
6382/// // You can configure optional parameters by calling the respective setters at will, and
6383/// // execute the final call using `doit()`.
6384/// // Values shown here are possibly random and not representative !
6385/// let result = hub.projects().locations_entry_groups_entries_patch(req, "name")
6386/// .update_mask(FieldMask::new::<&str>(&[]))
6387/// .doit().await;
6388/// # }
6389/// ```
6390pub struct ProjectLocationEntryGroupEntryPatchCall<'a, C>
6391where
6392 C: 'a,
6393{
6394 hub: &'a DataCatalog<C>,
6395 _request: GoogleCloudDatacatalogV1beta1Entry,
6396 _name: String,
6397 _update_mask: Option<common::FieldMask>,
6398 _delegate: Option<&'a mut dyn common::Delegate>,
6399 _additional_params: HashMap<String, String>,
6400 _scopes: BTreeSet<String>,
6401}
6402
6403impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryPatchCall<'a, C> {}
6404
6405impl<'a, C> ProjectLocationEntryGroupEntryPatchCall<'a, C>
6406where
6407 C: common::Connector,
6408{
6409 /// Perform the operation you have build so far.
6410 pub async fn doit(
6411 mut self,
6412 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Entry)> {
6413 use std::borrow::Cow;
6414 use std::io::{Read, Seek};
6415
6416 use common::{url::Params, ToParts};
6417 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6418
6419 let mut dd = common::DefaultDelegate;
6420 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6421 dlg.begin(common::MethodInfo {
6422 id: "datacatalog.projects.locations.entryGroups.entries.patch",
6423 http_method: hyper::Method::PATCH,
6424 });
6425
6426 for &field in ["alt", "name", "updateMask"].iter() {
6427 if self._additional_params.contains_key(field) {
6428 dlg.finished(false);
6429 return Err(common::Error::FieldClash(field));
6430 }
6431 }
6432
6433 let mut params = Params::with_capacity(5 + self._additional_params.len());
6434 params.push("name", self._name);
6435 if let Some(value) = self._update_mask.as_ref() {
6436 params.push("updateMask", value.to_string());
6437 }
6438
6439 params.extend(self._additional_params.iter());
6440
6441 params.push("alt", "json");
6442 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6443 if self._scopes.is_empty() {
6444 self._scopes
6445 .insert(Scope::CloudPlatform.as_ref().to_string());
6446 }
6447
6448 #[allow(clippy::single_element_loop)]
6449 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6450 url = params.uri_replacement(url, param_name, find_this, true);
6451 }
6452 {
6453 let to_remove = ["name"];
6454 params.remove_params(&to_remove);
6455 }
6456
6457 let url = params.parse_with_url(&url);
6458
6459 let mut json_mime_type = mime::APPLICATION_JSON;
6460 let mut request_value_reader = {
6461 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6462 common::remove_json_null_values(&mut value);
6463 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6464 serde_json::to_writer(&mut dst, &value).unwrap();
6465 dst
6466 };
6467 let request_size = request_value_reader
6468 .seek(std::io::SeekFrom::End(0))
6469 .unwrap();
6470 request_value_reader
6471 .seek(std::io::SeekFrom::Start(0))
6472 .unwrap();
6473
6474 loop {
6475 let token = match self
6476 .hub
6477 .auth
6478 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6479 .await
6480 {
6481 Ok(token) => token,
6482 Err(e) => match dlg.token(e) {
6483 Ok(token) => token,
6484 Err(e) => {
6485 dlg.finished(false);
6486 return Err(common::Error::MissingToken(e));
6487 }
6488 },
6489 };
6490 request_value_reader
6491 .seek(std::io::SeekFrom::Start(0))
6492 .unwrap();
6493 let mut req_result = {
6494 let client = &self.hub.client;
6495 dlg.pre_request();
6496 let mut req_builder = hyper::Request::builder()
6497 .method(hyper::Method::PATCH)
6498 .uri(url.as_str())
6499 .header(USER_AGENT, self.hub._user_agent.clone());
6500
6501 if let Some(token) = token.as_ref() {
6502 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6503 }
6504
6505 let request = req_builder
6506 .header(CONTENT_TYPE, json_mime_type.to_string())
6507 .header(CONTENT_LENGTH, request_size as u64)
6508 .body(common::to_body(
6509 request_value_reader.get_ref().clone().into(),
6510 ));
6511
6512 client.request(request.unwrap()).await
6513 };
6514
6515 match req_result {
6516 Err(err) => {
6517 if let common::Retry::After(d) = dlg.http_error(&err) {
6518 sleep(d).await;
6519 continue;
6520 }
6521 dlg.finished(false);
6522 return Err(common::Error::HttpError(err));
6523 }
6524 Ok(res) => {
6525 let (mut parts, body) = res.into_parts();
6526 let mut body = common::Body::new(body);
6527 if !parts.status.is_success() {
6528 let bytes = common::to_bytes(body).await.unwrap_or_default();
6529 let error = serde_json::from_str(&common::to_string(&bytes));
6530 let response = common::to_response(parts, bytes.into());
6531
6532 if let common::Retry::After(d) =
6533 dlg.http_failure(&response, error.as_ref().ok())
6534 {
6535 sleep(d).await;
6536 continue;
6537 }
6538
6539 dlg.finished(false);
6540
6541 return Err(match error {
6542 Ok(value) => common::Error::BadRequest(value),
6543 _ => common::Error::Failure(response),
6544 });
6545 }
6546 let response = {
6547 let bytes = common::to_bytes(body).await.unwrap_or_default();
6548 let encoded = common::to_string(&bytes);
6549 match serde_json::from_str(&encoded) {
6550 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6551 Err(error) => {
6552 dlg.response_json_decode_error(&encoded, &error);
6553 return Err(common::Error::JsonDecodeError(
6554 encoded.to_string(),
6555 error,
6556 ));
6557 }
6558 }
6559 };
6560
6561 dlg.finished(true);
6562 return Ok(response);
6563 }
6564 }
6565 }
6566 }
6567
6568 ///
6569 /// Sets the *request* property to the given value.
6570 ///
6571 /// Even though the property as already been set when instantiating this call,
6572 /// we provide this method for API completeness.
6573 pub fn request(
6574 mut self,
6575 new_value: GoogleCloudDatacatalogV1beta1Entry,
6576 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
6577 self._request = new_value;
6578 self
6579 }
6580 /// Output only. Identifier. The Data Catalog resource name of the entry in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id} Note that this Entry and its child resources may not actually be stored in the location in this name.
6581 ///
6582 /// Sets the *name* path property to the given value.
6583 ///
6584 /// Even though the property as already been set when instantiating this call,
6585 /// we provide this method for API completeness.
6586 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
6587 self._name = new_value.to_string();
6588 self
6589 }
6590 /// 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. The following fields are modifiable: * 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`
6591 ///
6592 /// Sets the *update mask* query property to the given value.
6593 pub fn update_mask(
6594 mut self,
6595 new_value: common::FieldMask,
6596 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
6597 self._update_mask = Some(new_value);
6598 self
6599 }
6600 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6601 /// while executing the actual API request.
6602 ///
6603 /// ````text
6604 /// It should be used to handle progress information, and to implement a certain level of resilience.
6605 /// ````
6606 ///
6607 /// Sets the *delegate* property to the given value.
6608 pub fn delegate(
6609 mut self,
6610 new_value: &'a mut dyn common::Delegate,
6611 ) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
6612 self._delegate = Some(new_value);
6613 self
6614 }
6615
6616 /// Set any additional parameter of the query string used in the request.
6617 /// It should be used to set parameters which are not yet available through their own
6618 /// setters.
6619 ///
6620 /// Please note that this method must not be used to set any of the known parameters
6621 /// which have their own setter method. If done anyway, the request will fail.
6622 ///
6623 /// # Additional Parameters
6624 ///
6625 /// * *$.xgafv* (query-string) - V1 error format.
6626 /// * *access_token* (query-string) - OAuth access token.
6627 /// * *alt* (query-string) - Data format for response.
6628 /// * *callback* (query-string) - JSONP
6629 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6630 /// * *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.
6631 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6632 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6633 /// * *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.
6634 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6635 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6636 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupEntryPatchCall<'a, C>
6637 where
6638 T: AsRef<str>,
6639 {
6640 self._additional_params
6641 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6642 self
6643 }
6644
6645 /// Identifies the authorization scope for the method you are building.
6646 ///
6647 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6648 /// [`Scope::CloudPlatform`].
6649 ///
6650 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6651 /// tokens for more than one scope.
6652 ///
6653 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6654 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6655 /// sufficient, a read-write scope will do as well.
6656 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupEntryPatchCall<'a, C>
6657 where
6658 St: AsRef<str>,
6659 {
6660 self._scopes.insert(String::from(scope.as_ref()));
6661 self
6662 }
6663 /// Identifies the authorization scope(s) for the method you are building.
6664 ///
6665 /// See [`Self::add_scope()`] for details.
6666 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupEntryPatchCall<'a, C>
6667 where
6668 I: IntoIterator<Item = St>,
6669 St: AsRef<str>,
6670 {
6671 self._scopes
6672 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6673 self
6674 }
6675
6676 /// Removes all scopes, and no default scope will be used either.
6677 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6678 /// for details).
6679 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryPatchCall<'a, C> {
6680 self._scopes.clear();
6681 self
6682 }
6683}
6684
6685/// Returns the caller's permissions on a resource. If the resource does not exist, an empty set of permissions is returned (We don't return a `NOT_FOUND` error). Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. A caller is not required to have Google IAM permission to make this request.
6686///
6687/// A builder for the *locations.entryGroups.entries.testIamPermissions* method supported by a *project* resource.
6688/// It is not used directly, but through a [`ProjectMethods`] instance.
6689///
6690/// # Example
6691///
6692/// Instantiate a resource method builder
6693///
6694/// ```test_harness,no_run
6695/// # extern crate hyper;
6696/// # extern crate hyper_rustls;
6697/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
6698/// use datacatalog1_beta1::api::TestIamPermissionsRequest;
6699/// # async fn dox() {
6700/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6701///
6702/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6703/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6704/// # .with_native_roots()
6705/// # .unwrap()
6706/// # .https_only()
6707/// # .enable_http2()
6708/// # .build();
6709///
6710/// # let executor = hyper_util::rt::TokioExecutor::new();
6711/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6712/// # secret,
6713/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6714/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6715/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6716/// # ),
6717/// # ).build().await.unwrap();
6718///
6719/// # let client = hyper_util::client::legacy::Client::builder(
6720/// # hyper_util::rt::TokioExecutor::new()
6721/// # )
6722/// # .build(
6723/// # hyper_rustls::HttpsConnectorBuilder::new()
6724/// # .with_native_roots()
6725/// # .unwrap()
6726/// # .https_or_http()
6727/// # .enable_http2()
6728/// # .build()
6729/// # );
6730/// # let mut hub = DataCatalog::new(client, auth);
6731/// // As the method needs a request, you would usually fill it with the desired information
6732/// // into the respective structure. Some of the parts shown here might not be applicable !
6733/// // Values shown here are possibly random and not representative !
6734/// let mut req = TestIamPermissionsRequest::default();
6735///
6736/// // You can configure optional parameters by calling the respective setters at will, and
6737/// // execute the final call using `doit()`.
6738/// // Values shown here are possibly random and not representative !
6739/// let result = hub.projects().locations_entry_groups_entries_test_iam_permissions(req, "resource")
6740/// .doit().await;
6741/// # }
6742/// ```
6743pub struct ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
6744where
6745 C: 'a,
6746{
6747 hub: &'a DataCatalog<C>,
6748 _request: TestIamPermissionsRequest,
6749 _resource: String,
6750 _delegate: Option<&'a mut dyn common::Delegate>,
6751 _additional_params: HashMap<String, String>,
6752 _scopes: BTreeSet<String>,
6753}
6754
6755impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {}
6756
6757impl<'a, C> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
6758where
6759 C: common::Connector,
6760{
6761 /// Perform the operation you have build so far.
6762 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
6763 use std::borrow::Cow;
6764 use std::io::{Read, Seek};
6765
6766 use common::{url::Params, ToParts};
6767 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6768
6769 let mut dd = common::DefaultDelegate;
6770 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6771 dlg.begin(common::MethodInfo {
6772 id: "datacatalog.projects.locations.entryGroups.entries.testIamPermissions",
6773 http_method: hyper::Method::POST,
6774 });
6775
6776 for &field in ["alt", "resource"].iter() {
6777 if self._additional_params.contains_key(field) {
6778 dlg.finished(false);
6779 return Err(common::Error::FieldClash(field));
6780 }
6781 }
6782
6783 let mut params = Params::with_capacity(4 + self._additional_params.len());
6784 params.push("resource", self._resource);
6785
6786 params.extend(self._additional_params.iter());
6787
6788 params.push("alt", "json");
6789 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
6790 if self._scopes.is_empty() {
6791 self._scopes
6792 .insert(Scope::CloudPlatform.as_ref().to_string());
6793 }
6794
6795 #[allow(clippy::single_element_loop)]
6796 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6797 url = params.uri_replacement(url, param_name, find_this, true);
6798 }
6799 {
6800 let to_remove = ["resource"];
6801 params.remove_params(&to_remove);
6802 }
6803
6804 let url = params.parse_with_url(&url);
6805
6806 let mut json_mime_type = mime::APPLICATION_JSON;
6807 let mut request_value_reader = {
6808 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6809 common::remove_json_null_values(&mut value);
6810 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6811 serde_json::to_writer(&mut dst, &value).unwrap();
6812 dst
6813 };
6814 let request_size = request_value_reader
6815 .seek(std::io::SeekFrom::End(0))
6816 .unwrap();
6817 request_value_reader
6818 .seek(std::io::SeekFrom::Start(0))
6819 .unwrap();
6820
6821 loop {
6822 let token = match self
6823 .hub
6824 .auth
6825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6826 .await
6827 {
6828 Ok(token) => token,
6829 Err(e) => match dlg.token(e) {
6830 Ok(token) => token,
6831 Err(e) => {
6832 dlg.finished(false);
6833 return Err(common::Error::MissingToken(e));
6834 }
6835 },
6836 };
6837 request_value_reader
6838 .seek(std::io::SeekFrom::Start(0))
6839 .unwrap();
6840 let mut req_result = {
6841 let client = &self.hub.client;
6842 dlg.pre_request();
6843 let mut req_builder = hyper::Request::builder()
6844 .method(hyper::Method::POST)
6845 .uri(url.as_str())
6846 .header(USER_AGENT, self.hub._user_agent.clone());
6847
6848 if let Some(token) = token.as_ref() {
6849 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6850 }
6851
6852 let request = req_builder
6853 .header(CONTENT_TYPE, json_mime_type.to_string())
6854 .header(CONTENT_LENGTH, request_size as u64)
6855 .body(common::to_body(
6856 request_value_reader.get_ref().clone().into(),
6857 ));
6858
6859 client.request(request.unwrap()).await
6860 };
6861
6862 match req_result {
6863 Err(err) => {
6864 if let common::Retry::After(d) = dlg.http_error(&err) {
6865 sleep(d).await;
6866 continue;
6867 }
6868 dlg.finished(false);
6869 return Err(common::Error::HttpError(err));
6870 }
6871 Ok(res) => {
6872 let (mut parts, body) = res.into_parts();
6873 let mut body = common::Body::new(body);
6874 if !parts.status.is_success() {
6875 let bytes = common::to_bytes(body).await.unwrap_or_default();
6876 let error = serde_json::from_str(&common::to_string(&bytes));
6877 let response = common::to_response(parts, bytes.into());
6878
6879 if let common::Retry::After(d) =
6880 dlg.http_failure(&response, error.as_ref().ok())
6881 {
6882 sleep(d).await;
6883 continue;
6884 }
6885
6886 dlg.finished(false);
6887
6888 return Err(match error {
6889 Ok(value) => common::Error::BadRequest(value),
6890 _ => common::Error::Failure(response),
6891 });
6892 }
6893 let response = {
6894 let bytes = common::to_bytes(body).await.unwrap_or_default();
6895 let encoded = common::to_string(&bytes);
6896 match serde_json::from_str(&encoded) {
6897 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6898 Err(error) => {
6899 dlg.response_json_decode_error(&encoded, &error);
6900 return Err(common::Error::JsonDecodeError(
6901 encoded.to_string(),
6902 error,
6903 ));
6904 }
6905 }
6906 };
6907
6908 dlg.finished(true);
6909 return Ok(response);
6910 }
6911 }
6912 }
6913 }
6914
6915 ///
6916 /// Sets the *request* property to the given value.
6917 ///
6918 /// Even though the property as already been set when instantiating this call,
6919 /// we provide this method for API completeness.
6920 pub fn request(
6921 mut self,
6922 new_value: TestIamPermissionsRequest,
6923 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
6924 self._request = new_value;
6925 self
6926 }
6927 /// 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.
6928 ///
6929 /// Sets the *resource* path property to the given value.
6930 ///
6931 /// Even though the property as already been set when instantiating this call,
6932 /// we provide this method for API completeness.
6933 pub fn resource(
6934 mut self,
6935 new_value: &str,
6936 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
6937 self._resource = new_value.to_string();
6938 self
6939 }
6940 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6941 /// while executing the actual API request.
6942 ///
6943 /// ````text
6944 /// It should be used to handle progress information, and to implement a certain level of resilience.
6945 /// ````
6946 ///
6947 /// Sets the *delegate* property to the given value.
6948 pub fn delegate(
6949 mut self,
6950 new_value: &'a mut dyn common::Delegate,
6951 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
6952 self._delegate = Some(new_value);
6953 self
6954 }
6955
6956 /// Set any additional parameter of the query string used in the request.
6957 /// It should be used to set parameters which are not yet available through their own
6958 /// setters.
6959 ///
6960 /// Please note that this method must not be used to set any of the known parameters
6961 /// which have their own setter method. If done anyway, the request will fail.
6962 ///
6963 /// # Additional Parameters
6964 ///
6965 /// * *$.xgafv* (query-string) - V1 error format.
6966 /// * *access_token* (query-string) - OAuth access token.
6967 /// * *alt* (query-string) - Data format for response.
6968 /// * *callback* (query-string) - JSONP
6969 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6970 /// * *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.
6971 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6972 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6973 /// * *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.
6974 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6975 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6976 pub fn param<T>(
6977 mut self,
6978 name: T,
6979 value: T,
6980 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
6981 where
6982 T: AsRef<str>,
6983 {
6984 self._additional_params
6985 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6986 self
6987 }
6988
6989 /// Identifies the authorization scope for the method you are building.
6990 ///
6991 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6992 /// [`Scope::CloudPlatform`].
6993 ///
6994 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6995 /// tokens for more than one scope.
6996 ///
6997 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6998 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6999 /// sufficient, a read-write scope will do as well.
7000 pub fn add_scope<St>(
7001 mut self,
7002 scope: St,
7003 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
7004 where
7005 St: AsRef<str>,
7006 {
7007 self._scopes.insert(String::from(scope.as_ref()));
7008 self
7009 }
7010 /// Identifies the authorization scope(s) for the method you are building.
7011 ///
7012 /// See [`Self::add_scope()`] for details.
7013 pub fn add_scopes<I, St>(
7014 mut self,
7015 scopes: I,
7016 ) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C>
7017 where
7018 I: IntoIterator<Item = St>,
7019 St: AsRef<str>,
7020 {
7021 self._scopes
7022 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7023 self
7024 }
7025
7026 /// Removes all scopes, and no default scope will be used either.
7027 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7028 /// for details).
7029 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupEntryTestIamPermissionCall<'a, C> {
7030 self._scopes.clear();
7031 self
7032 }
7033}
7034
7035/// Creates a tag on an Entry. Note: The project identified by the `parent` parameter for the [tag](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.entryGroups.entries.tags/create#path-parameters) and the [tag template](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.tagTemplates/create#path-parameters) used to create the tag must be from the same organization.
7036///
7037/// A builder for the *locations.entryGroups.tags.create* method supported by a *project* resource.
7038/// It is not used directly, but through a [`ProjectMethods`] instance.
7039///
7040/// # Example
7041///
7042/// Instantiate a resource method builder
7043///
7044/// ```test_harness,no_run
7045/// # extern crate hyper;
7046/// # extern crate hyper_rustls;
7047/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
7048/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Tag;
7049/// # async fn dox() {
7050/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7051///
7052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7053/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7054/// # .with_native_roots()
7055/// # .unwrap()
7056/// # .https_only()
7057/// # .enable_http2()
7058/// # .build();
7059///
7060/// # let executor = hyper_util::rt::TokioExecutor::new();
7061/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7062/// # secret,
7063/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7064/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7065/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7066/// # ),
7067/// # ).build().await.unwrap();
7068///
7069/// # let client = hyper_util::client::legacy::Client::builder(
7070/// # hyper_util::rt::TokioExecutor::new()
7071/// # )
7072/// # .build(
7073/// # hyper_rustls::HttpsConnectorBuilder::new()
7074/// # .with_native_roots()
7075/// # .unwrap()
7076/// # .https_or_http()
7077/// # .enable_http2()
7078/// # .build()
7079/// # );
7080/// # let mut hub = DataCatalog::new(client, auth);
7081/// // As the method needs a request, you would usually fill it with the desired information
7082/// // into the respective structure. Some of the parts shown here might not be applicable !
7083/// // Values shown here are possibly random and not representative !
7084/// let mut req = GoogleCloudDatacatalogV1beta1Tag::default();
7085///
7086/// // You can configure optional parameters by calling the respective setters at will, and
7087/// // execute the final call using `doit()`.
7088/// // Values shown here are possibly random and not representative !
7089/// let result = hub.projects().locations_entry_groups_tags_create(req, "parent")
7090/// .doit().await;
7091/// # }
7092/// ```
7093pub struct ProjectLocationEntryGroupTagCreateCall<'a, C>
7094where
7095 C: 'a,
7096{
7097 hub: &'a DataCatalog<C>,
7098 _request: GoogleCloudDatacatalogV1beta1Tag,
7099 _parent: String,
7100 _delegate: Option<&'a mut dyn common::Delegate>,
7101 _additional_params: HashMap<String, String>,
7102 _scopes: BTreeSet<String>,
7103}
7104
7105impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagCreateCall<'a, C> {}
7106
7107impl<'a, C> ProjectLocationEntryGroupTagCreateCall<'a, C>
7108where
7109 C: common::Connector,
7110{
7111 /// Perform the operation you have build so far.
7112 pub async fn doit(
7113 mut self,
7114 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Tag)> {
7115 use std::borrow::Cow;
7116 use std::io::{Read, Seek};
7117
7118 use common::{url::Params, ToParts};
7119 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7120
7121 let mut dd = common::DefaultDelegate;
7122 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7123 dlg.begin(common::MethodInfo {
7124 id: "datacatalog.projects.locations.entryGroups.tags.create",
7125 http_method: hyper::Method::POST,
7126 });
7127
7128 for &field in ["alt", "parent"].iter() {
7129 if self._additional_params.contains_key(field) {
7130 dlg.finished(false);
7131 return Err(common::Error::FieldClash(field));
7132 }
7133 }
7134
7135 let mut params = Params::with_capacity(4 + self._additional_params.len());
7136 params.push("parent", self._parent);
7137
7138 params.extend(self._additional_params.iter());
7139
7140 params.push("alt", "json");
7141 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/tags";
7142 if self._scopes.is_empty() {
7143 self._scopes
7144 .insert(Scope::CloudPlatform.as_ref().to_string());
7145 }
7146
7147 #[allow(clippy::single_element_loop)]
7148 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7149 url = params.uri_replacement(url, param_name, find_this, true);
7150 }
7151 {
7152 let to_remove = ["parent"];
7153 params.remove_params(&to_remove);
7154 }
7155
7156 let url = params.parse_with_url(&url);
7157
7158 let mut json_mime_type = mime::APPLICATION_JSON;
7159 let mut request_value_reader = {
7160 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7161 common::remove_json_null_values(&mut value);
7162 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7163 serde_json::to_writer(&mut dst, &value).unwrap();
7164 dst
7165 };
7166 let request_size = request_value_reader
7167 .seek(std::io::SeekFrom::End(0))
7168 .unwrap();
7169 request_value_reader
7170 .seek(std::io::SeekFrom::Start(0))
7171 .unwrap();
7172
7173 loop {
7174 let token = match self
7175 .hub
7176 .auth
7177 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7178 .await
7179 {
7180 Ok(token) => token,
7181 Err(e) => match dlg.token(e) {
7182 Ok(token) => token,
7183 Err(e) => {
7184 dlg.finished(false);
7185 return Err(common::Error::MissingToken(e));
7186 }
7187 },
7188 };
7189 request_value_reader
7190 .seek(std::io::SeekFrom::Start(0))
7191 .unwrap();
7192 let mut req_result = {
7193 let client = &self.hub.client;
7194 dlg.pre_request();
7195 let mut req_builder = hyper::Request::builder()
7196 .method(hyper::Method::POST)
7197 .uri(url.as_str())
7198 .header(USER_AGENT, self.hub._user_agent.clone());
7199
7200 if let Some(token) = token.as_ref() {
7201 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7202 }
7203
7204 let request = req_builder
7205 .header(CONTENT_TYPE, json_mime_type.to_string())
7206 .header(CONTENT_LENGTH, request_size as u64)
7207 .body(common::to_body(
7208 request_value_reader.get_ref().clone().into(),
7209 ));
7210
7211 client.request(request.unwrap()).await
7212 };
7213
7214 match req_result {
7215 Err(err) => {
7216 if let common::Retry::After(d) = dlg.http_error(&err) {
7217 sleep(d).await;
7218 continue;
7219 }
7220 dlg.finished(false);
7221 return Err(common::Error::HttpError(err));
7222 }
7223 Ok(res) => {
7224 let (mut parts, body) = res.into_parts();
7225 let mut body = common::Body::new(body);
7226 if !parts.status.is_success() {
7227 let bytes = common::to_bytes(body).await.unwrap_or_default();
7228 let error = serde_json::from_str(&common::to_string(&bytes));
7229 let response = common::to_response(parts, bytes.into());
7230
7231 if let common::Retry::After(d) =
7232 dlg.http_failure(&response, error.as_ref().ok())
7233 {
7234 sleep(d).await;
7235 continue;
7236 }
7237
7238 dlg.finished(false);
7239
7240 return Err(match error {
7241 Ok(value) => common::Error::BadRequest(value),
7242 _ => common::Error::Failure(response),
7243 });
7244 }
7245 let response = {
7246 let bytes = common::to_bytes(body).await.unwrap_or_default();
7247 let encoded = common::to_string(&bytes);
7248 match serde_json::from_str(&encoded) {
7249 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7250 Err(error) => {
7251 dlg.response_json_decode_error(&encoded, &error);
7252 return Err(common::Error::JsonDecodeError(
7253 encoded.to_string(),
7254 error,
7255 ));
7256 }
7257 }
7258 };
7259
7260 dlg.finished(true);
7261 return Ok(response);
7262 }
7263 }
7264 }
7265 }
7266
7267 ///
7268 /// Sets the *request* property to the given value.
7269 ///
7270 /// Even though the property as already been set when instantiating this call,
7271 /// we provide this method for API completeness.
7272 pub fn request(
7273 mut self,
7274 new_value: GoogleCloudDatacatalogV1beta1Tag,
7275 ) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
7276 self._request = new_value;
7277 self
7278 }
7279 /// Required. The name of the resource to attach this tag to. Tags can be attached to Entries. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id} Note that this Tag and its child resources may not actually be stored in the location in this name.
7280 ///
7281 /// Sets the *parent* path property to the given value.
7282 ///
7283 /// Even though the property as already been set when instantiating this call,
7284 /// we provide this method for API completeness.
7285 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
7286 self._parent = new_value.to_string();
7287 self
7288 }
7289 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7290 /// while executing the actual API request.
7291 ///
7292 /// ````text
7293 /// It should be used to handle progress information, and to implement a certain level of resilience.
7294 /// ````
7295 ///
7296 /// Sets the *delegate* property to the given value.
7297 pub fn delegate(
7298 mut self,
7299 new_value: &'a mut dyn common::Delegate,
7300 ) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
7301 self._delegate = Some(new_value);
7302 self
7303 }
7304
7305 /// Set any additional parameter of the query string used in the request.
7306 /// It should be used to set parameters which are not yet available through their own
7307 /// setters.
7308 ///
7309 /// Please note that this method must not be used to set any of the known parameters
7310 /// which have their own setter method. If done anyway, the request will fail.
7311 ///
7312 /// # Additional Parameters
7313 ///
7314 /// * *$.xgafv* (query-string) - V1 error format.
7315 /// * *access_token* (query-string) - OAuth access token.
7316 /// * *alt* (query-string) - Data format for response.
7317 /// * *callback* (query-string) - JSONP
7318 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7319 /// * *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.
7320 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7321 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7322 /// * *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.
7323 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7324 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7325 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagCreateCall<'a, C>
7326 where
7327 T: AsRef<str>,
7328 {
7329 self._additional_params
7330 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7331 self
7332 }
7333
7334 /// Identifies the authorization scope for the method you are building.
7335 ///
7336 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7337 /// [`Scope::CloudPlatform`].
7338 ///
7339 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7340 /// tokens for more than one scope.
7341 ///
7342 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7343 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7344 /// sufficient, a read-write scope will do as well.
7345 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagCreateCall<'a, C>
7346 where
7347 St: AsRef<str>,
7348 {
7349 self._scopes.insert(String::from(scope.as_ref()));
7350 self
7351 }
7352 /// Identifies the authorization scope(s) for the method you are building.
7353 ///
7354 /// See [`Self::add_scope()`] for details.
7355 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagCreateCall<'a, C>
7356 where
7357 I: IntoIterator<Item = St>,
7358 St: AsRef<str>,
7359 {
7360 self._scopes
7361 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7362 self
7363 }
7364
7365 /// Removes all scopes, and no default scope will be used either.
7366 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7367 /// for details).
7368 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagCreateCall<'a, C> {
7369 self._scopes.clear();
7370 self
7371 }
7372}
7373
7374/// Deletes a tag.
7375///
7376/// A builder for the *locations.entryGroups.tags.delete* method supported by a *project* resource.
7377/// It is not used directly, but through a [`ProjectMethods`] instance.
7378///
7379/// # Example
7380///
7381/// Instantiate a resource method builder
7382///
7383/// ```test_harness,no_run
7384/// # extern crate hyper;
7385/// # extern crate hyper_rustls;
7386/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
7387/// # async fn dox() {
7388/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7389///
7390/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7391/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7392/// # .with_native_roots()
7393/// # .unwrap()
7394/// # .https_only()
7395/// # .enable_http2()
7396/// # .build();
7397///
7398/// # let executor = hyper_util::rt::TokioExecutor::new();
7399/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7400/// # secret,
7401/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7402/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7403/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7404/// # ),
7405/// # ).build().await.unwrap();
7406///
7407/// # let client = hyper_util::client::legacy::Client::builder(
7408/// # hyper_util::rt::TokioExecutor::new()
7409/// # )
7410/// # .build(
7411/// # hyper_rustls::HttpsConnectorBuilder::new()
7412/// # .with_native_roots()
7413/// # .unwrap()
7414/// # .https_or_http()
7415/// # .enable_http2()
7416/// # .build()
7417/// # );
7418/// # let mut hub = DataCatalog::new(client, auth);
7419/// // You can configure optional parameters by calling the respective setters at will, and
7420/// // execute the final call using `doit()`.
7421/// // Values shown here are possibly random and not representative !
7422/// let result = hub.projects().locations_entry_groups_tags_delete("name")
7423/// .doit().await;
7424/// # }
7425/// ```
7426pub struct ProjectLocationEntryGroupTagDeleteCall<'a, C>
7427where
7428 C: 'a,
7429{
7430 hub: &'a DataCatalog<C>,
7431 _name: String,
7432 _delegate: Option<&'a mut dyn common::Delegate>,
7433 _additional_params: HashMap<String, String>,
7434 _scopes: BTreeSet<String>,
7435}
7436
7437impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagDeleteCall<'a, C> {}
7438
7439impl<'a, C> ProjectLocationEntryGroupTagDeleteCall<'a, C>
7440where
7441 C: common::Connector,
7442{
7443 /// Perform the operation you have build so far.
7444 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7445 use std::borrow::Cow;
7446 use std::io::{Read, Seek};
7447
7448 use common::{url::Params, ToParts};
7449 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7450
7451 let mut dd = common::DefaultDelegate;
7452 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7453 dlg.begin(common::MethodInfo {
7454 id: "datacatalog.projects.locations.entryGroups.tags.delete",
7455 http_method: hyper::Method::DELETE,
7456 });
7457
7458 for &field in ["alt", "name"].iter() {
7459 if self._additional_params.contains_key(field) {
7460 dlg.finished(false);
7461 return Err(common::Error::FieldClash(field));
7462 }
7463 }
7464
7465 let mut params = Params::with_capacity(3 + self._additional_params.len());
7466 params.push("name", self._name);
7467
7468 params.extend(self._additional_params.iter());
7469
7470 params.push("alt", "json");
7471 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7472 if self._scopes.is_empty() {
7473 self._scopes
7474 .insert(Scope::CloudPlatform.as_ref().to_string());
7475 }
7476
7477 #[allow(clippy::single_element_loop)]
7478 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7479 url = params.uri_replacement(url, param_name, find_this, true);
7480 }
7481 {
7482 let to_remove = ["name"];
7483 params.remove_params(&to_remove);
7484 }
7485
7486 let url = params.parse_with_url(&url);
7487
7488 loop {
7489 let token = match self
7490 .hub
7491 .auth
7492 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7493 .await
7494 {
7495 Ok(token) => token,
7496 Err(e) => match dlg.token(e) {
7497 Ok(token) => token,
7498 Err(e) => {
7499 dlg.finished(false);
7500 return Err(common::Error::MissingToken(e));
7501 }
7502 },
7503 };
7504 let mut req_result = {
7505 let client = &self.hub.client;
7506 dlg.pre_request();
7507 let mut req_builder = hyper::Request::builder()
7508 .method(hyper::Method::DELETE)
7509 .uri(url.as_str())
7510 .header(USER_AGENT, self.hub._user_agent.clone());
7511
7512 if let Some(token) = token.as_ref() {
7513 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7514 }
7515
7516 let request = req_builder
7517 .header(CONTENT_LENGTH, 0_u64)
7518 .body(common::to_body::<String>(None));
7519
7520 client.request(request.unwrap()).await
7521 };
7522
7523 match req_result {
7524 Err(err) => {
7525 if let common::Retry::After(d) = dlg.http_error(&err) {
7526 sleep(d).await;
7527 continue;
7528 }
7529 dlg.finished(false);
7530 return Err(common::Error::HttpError(err));
7531 }
7532 Ok(res) => {
7533 let (mut parts, body) = res.into_parts();
7534 let mut body = common::Body::new(body);
7535 if !parts.status.is_success() {
7536 let bytes = common::to_bytes(body).await.unwrap_or_default();
7537 let error = serde_json::from_str(&common::to_string(&bytes));
7538 let response = common::to_response(parts, bytes.into());
7539
7540 if let common::Retry::After(d) =
7541 dlg.http_failure(&response, error.as_ref().ok())
7542 {
7543 sleep(d).await;
7544 continue;
7545 }
7546
7547 dlg.finished(false);
7548
7549 return Err(match error {
7550 Ok(value) => common::Error::BadRequest(value),
7551 _ => common::Error::Failure(response),
7552 });
7553 }
7554 let response = {
7555 let bytes = common::to_bytes(body).await.unwrap_or_default();
7556 let encoded = common::to_string(&bytes);
7557 match serde_json::from_str(&encoded) {
7558 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7559 Err(error) => {
7560 dlg.response_json_decode_error(&encoded, &error);
7561 return Err(common::Error::JsonDecodeError(
7562 encoded.to_string(),
7563 error,
7564 ));
7565 }
7566 }
7567 };
7568
7569 dlg.finished(true);
7570 return Ok(response);
7571 }
7572 }
7573 }
7574 }
7575
7576 /// Required. The name of the tag to delete. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id}
7577 ///
7578 /// Sets the *name* path property to the given value.
7579 ///
7580 /// Even though the property as already been set when instantiating this call,
7581 /// we provide this method for API completeness.
7582 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
7583 self._name = new_value.to_string();
7584 self
7585 }
7586 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7587 /// while executing the actual API request.
7588 ///
7589 /// ````text
7590 /// It should be used to handle progress information, and to implement a certain level of resilience.
7591 /// ````
7592 ///
7593 /// Sets the *delegate* property to the given value.
7594 pub fn delegate(
7595 mut self,
7596 new_value: &'a mut dyn common::Delegate,
7597 ) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
7598 self._delegate = Some(new_value);
7599 self
7600 }
7601
7602 /// Set any additional parameter of the query string used in the request.
7603 /// It should be used to set parameters which are not yet available through their own
7604 /// setters.
7605 ///
7606 /// Please note that this method must not be used to set any of the known parameters
7607 /// which have their own setter method. If done anyway, the request will fail.
7608 ///
7609 /// # Additional Parameters
7610 ///
7611 /// * *$.xgafv* (query-string) - V1 error format.
7612 /// * *access_token* (query-string) - OAuth access token.
7613 /// * *alt* (query-string) - Data format for response.
7614 /// * *callback* (query-string) - JSONP
7615 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7616 /// * *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.
7617 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7618 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7619 /// * *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.
7620 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7621 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7622 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagDeleteCall<'a, C>
7623 where
7624 T: AsRef<str>,
7625 {
7626 self._additional_params
7627 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7628 self
7629 }
7630
7631 /// Identifies the authorization scope for the method you are building.
7632 ///
7633 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7634 /// [`Scope::CloudPlatform`].
7635 ///
7636 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7637 /// tokens for more than one scope.
7638 ///
7639 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7640 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7641 /// sufficient, a read-write scope will do as well.
7642 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagDeleteCall<'a, C>
7643 where
7644 St: AsRef<str>,
7645 {
7646 self._scopes.insert(String::from(scope.as_ref()));
7647 self
7648 }
7649 /// Identifies the authorization scope(s) for the method you are building.
7650 ///
7651 /// See [`Self::add_scope()`] for details.
7652 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagDeleteCall<'a, C>
7653 where
7654 I: IntoIterator<Item = St>,
7655 St: AsRef<str>,
7656 {
7657 self._scopes
7658 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7659 self
7660 }
7661
7662 /// Removes all scopes, and no default scope will be used either.
7663 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7664 /// for details).
7665 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagDeleteCall<'a, C> {
7666 self._scopes.clear();
7667 self
7668 }
7669}
7670
7671/// Lists tags assigned to an Entry. The columns in the response are lowercased.
7672///
7673/// A builder for the *locations.entryGroups.tags.list* method supported by a *project* resource.
7674/// It is not used directly, but through a [`ProjectMethods`] instance.
7675///
7676/// # Example
7677///
7678/// Instantiate a resource method builder
7679///
7680/// ```test_harness,no_run
7681/// # extern crate hyper;
7682/// # extern crate hyper_rustls;
7683/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
7684/// # async fn dox() {
7685/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7686///
7687/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7688/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7689/// # .with_native_roots()
7690/// # .unwrap()
7691/// # .https_only()
7692/// # .enable_http2()
7693/// # .build();
7694///
7695/// # let executor = hyper_util::rt::TokioExecutor::new();
7696/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7697/// # secret,
7698/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7699/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7700/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7701/// # ),
7702/// # ).build().await.unwrap();
7703///
7704/// # let client = hyper_util::client::legacy::Client::builder(
7705/// # hyper_util::rt::TokioExecutor::new()
7706/// # )
7707/// # .build(
7708/// # hyper_rustls::HttpsConnectorBuilder::new()
7709/// # .with_native_roots()
7710/// # .unwrap()
7711/// # .https_or_http()
7712/// # .enable_http2()
7713/// # .build()
7714/// # );
7715/// # let mut hub = DataCatalog::new(client, auth);
7716/// // You can configure optional parameters by calling the respective setters at will, and
7717/// // execute the final call using `doit()`.
7718/// // Values shown here are possibly random and not representative !
7719/// let result = hub.projects().locations_entry_groups_tags_list("parent")
7720/// .page_token("sed")
7721/// .page_size(-37)
7722/// .doit().await;
7723/// # }
7724/// ```
7725pub struct ProjectLocationEntryGroupTagListCall<'a, C>
7726where
7727 C: 'a,
7728{
7729 hub: &'a DataCatalog<C>,
7730 _parent: String,
7731 _page_token: Option<String>,
7732 _page_size: Option<i32>,
7733 _delegate: Option<&'a mut dyn common::Delegate>,
7734 _additional_params: HashMap<String, String>,
7735 _scopes: BTreeSet<String>,
7736}
7737
7738impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagListCall<'a, C> {}
7739
7740impl<'a, C> ProjectLocationEntryGroupTagListCall<'a, C>
7741where
7742 C: common::Connector,
7743{
7744 /// Perform the operation you have build so far.
7745 pub async fn doit(
7746 mut self,
7747 ) -> common::Result<(
7748 common::Response,
7749 GoogleCloudDatacatalogV1beta1ListTagsResponse,
7750 )> {
7751 use std::borrow::Cow;
7752 use std::io::{Read, Seek};
7753
7754 use common::{url::Params, ToParts};
7755 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7756
7757 let mut dd = common::DefaultDelegate;
7758 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7759 dlg.begin(common::MethodInfo {
7760 id: "datacatalog.projects.locations.entryGroups.tags.list",
7761 http_method: hyper::Method::GET,
7762 });
7763
7764 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
7765 if self._additional_params.contains_key(field) {
7766 dlg.finished(false);
7767 return Err(common::Error::FieldClash(field));
7768 }
7769 }
7770
7771 let mut params = Params::with_capacity(5 + self._additional_params.len());
7772 params.push("parent", self._parent);
7773 if let Some(value) = self._page_token.as_ref() {
7774 params.push("pageToken", value);
7775 }
7776 if let Some(value) = self._page_size.as_ref() {
7777 params.push("pageSize", value.to_string());
7778 }
7779
7780 params.extend(self._additional_params.iter());
7781
7782 params.push("alt", "json");
7783 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/tags";
7784 if self._scopes.is_empty() {
7785 self._scopes
7786 .insert(Scope::CloudPlatform.as_ref().to_string());
7787 }
7788
7789 #[allow(clippy::single_element_loop)]
7790 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7791 url = params.uri_replacement(url, param_name, find_this, true);
7792 }
7793 {
7794 let to_remove = ["parent"];
7795 params.remove_params(&to_remove);
7796 }
7797
7798 let url = params.parse_with_url(&url);
7799
7800 loop {
7801 let token = match self
7802 .hub
7803 .auth
7804 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7805 .await
7806 {
7807 Ok(token) => token,
7808 Err(e) => match dlg.token(e) {
7809 Ok(token) => token,
7810 Err(e) => {
7811 dlg.finished(false);
7812 return Err(common::Error::MissingToken(e));
7813 }
7814 },
7815 };
7816 let mut req_result = {
7817 let client = &self.hub.client;
7818 dlg.pre_request();
7819 let mut req_builder = hyper::Request::builder()
7820 .method(hyper::Method::GET)
7821 .uri(url.as_str())
7822 .header(USER_AGENT, self.hub._user_agent.clone());
7823
7824 if let Some(token) = token.as_ref() {
7825 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7826 }
7827
7828 let request = req_builder
7829 .header(CONTENT_LENGTH, 0_u64)
7830 .body(common::to_body::<String>(None));
7831
7832 client.request(request.unwrap()).await
7833 };
7834
7835 match req_result {
7836 Err(err) => {
7837 if let common::Retry::After(d) = dlg.http_error(&err) {
7838 sleep(d).await;
7839 continue;
7840 }
7841 dlg.finished(false);
7842 return Err(common::Error::HttpError(err));
7843 }
7844 Ok(res) => {
7845 let (mut parts, body) = res.into_parts();
7846 let mut body = common::Body::new(body);
7847 if !parts.status.is_success() {
7848 let bytes = common::to_bytes(body).await.unwrap_or_default();
7849 let error = serde_json::from_str(&common::to_string(&bytes));
7850 let response = common::to_response(parts, bytes.into());
7851
7852 if let common::Retry::After(d) =
7853 dlg.http_failure(&response, error.as_ref().ok())
7854 {
7855 sleep(d).await;
7856 continue;
7857 }
7858
7859 dlg.finished(false);
7860
7861 return Err(match error {
7862 Ok(value) => common::Error::BadRequest(value),
7863 _ => common::Error::Failure(response),
7864 });
7865 }
7866 let response = {
7867 let bytes = common::to_bytes(body).await.unwrap_or_default();
7868 let encoded = common::to_string(&bytes);
7869 match serde_json::from_str(&encoded) {
7870 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7871 Err(error) => {
7872 dlg.response_json_decode_error(&encoded, &error);
7873 return Err(common::Error::JsonDecodeError(
7874 encoded.to_string(),
7875 error,
7876 ));
7877 }
7878 }
7879 };
7880
7881 dlg.finished(true);
7882 return Ok(response);
7883 }
7884 }
7885 }
7886 }
7887
7888 /// Required. The name of the Data Catalog resource to list the tags of. The resource could be an Entry or an EntryGroup. Examples: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
7889 ///
7890 /// Sets the *parent* path property to the given value.
7891 ///
7892 /// Even though the property as already been set when instantiating this call,
7893 /// we provide this method for API completeness.
7894 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupTagListCall<'a, C> {
7895 self._parent = new_value.to_string();
7896 self
7897 }
7898 /// Token that specifies which page is requested. If empty, the first page is returned.
7899 ///
7900 /// Sets the *page token* query property to the given value.
7901 pub fn page_token(mut self, new_value: &str) -> ProjectLocationEntryGroupTagListCall<'a, C> {
7902 self._page_token = Some(new_value.to_string());
7903 self
7904 }
7905 /// The maximum number of tags to return. Default is 10. Max limit is 1000.
7906 ///
7907 /// Sets the *page size* query property to the given value.
7908 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupTagListCall<'a, C> {
7909 self._page_size = Some(new_value);
7910 self
7911 }
7912 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7913 /// while executing the actual API request.
7914 ///
7915 /// ````text
7916 /// It should be used to handle progress information, and to implement a certain level of resilience.
7917 /// ````
7918 ///
7919 /// Sets the *delegate* property to the given value.
7920 pub fn delegate(
7921 mut self,
7922 new_value: &'a mut dyn common::Delegate,
7923 ) -> ProjectLocationEntryGroupTagListCall<'a, C> {
7924 self._delegate = Some(new_value);
7925 self
7926 }
7927
7928 /// Set any additional parameter of the query string used in the request.
7929 /// It should be used to set parameters which are not yet available through their own
7930 /// setters.
7931 ///
7932 /// Please note that this method must not be used to set any of the known parameters
7933 /// which have their own setter method. If done anyway, the request will fail.
7934 ///
7935 /// # Additional Parameters
7936 ///
7937 /// * *$.xgafv* (query-string) - V1 error format.
7938 /// * *access_token* (query-string) - OAuth access token.
7939 /// * *alt* (query-string) - Data format for response.
7940 /// * *callback* (query-string) - JSONP
7941 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7942 /// * *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.
7943 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7944 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7945 /// * *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.
7946 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7947 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7948 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagListCall<'a, C>
7949 where
7950 T: AsRef<str>,
7951 {
7952 self._additional_params
7953 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7954 self
7955 }
7956
7957 /// Identifies the authorization scope for the method you are building.
7958 ///
7959 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7960 /// [`Scope::CloudPlatform`].
7961 ///
7962 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7963 /// tokens for more than one scope.
7964 ///
7965 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7966 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7967 /// sufficient, a read-write scope will do as well.
7968 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagListCall<'a, C>
7969 where
7970 St: AsRef<str>,
7971 {
7972 self._scopes.insert(String::from(scope.as_ref()));
7973 self
7974 }
7975 /// Identifies the authorization scope(s) for the method you are building.
7976 ///
7977 /// See [`Self::add_scope()`] for details.
7978 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagListCall<'a, C>
7979 where
7980 I: IntoIterator<Item = St>,
7981 St: AsRef<str>,
7982 {
7983 self._scopes
7984 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7985 self
7986 }
7987
7988 /// Removes all scopes, and no default scope will be used either.
7989 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7990 /// for details).
7991 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagListCall<'a, C> {
7992 self._scopes.clear();
7993 self
7994 }
7995}
7996
7997/// Updates an existing tag.
7998///
7999/// A builder for the *locations.entryGroups.tags.patch* method supported by a *project* resource.
8000/// It is not used directly, but through a [`ProjectMethods`] instance.
8001///
8002/// # Example
8003///
8004/// Instantiate a resource method builder
8005///
8006/// ```test_harness,no_run
8007/// # extern crate hyper;
8008/// # extern crate hyper_rustls;
8009/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
8010/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Tag;
8011/// # async fn dox() {
8012/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8013///
8014/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8015/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8016/// # .with_native_roots()
8017/// # .unwrap()
8018/// # .https_only()
8019/// # .enable_http2()
8020/// # .build();
8021///
8022/// # let executor = hyper_util::rt::TokioExecutor::new();
8023/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8024/// # secret,
8025/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8026/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8027/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8028/// # ),
8029/// # ).build().await.unwrap();
8030///
8031/// # let client = hyper_util::client::legacy::Client::builder(
8032/// # hyper_util::rt::TokioExecutor::new()
8033/// # )
8034/// # .build(
8035/// # hyper_rustls::HttpsConnectorBuilder::new()
8036/// # .with_native_roots()
8037/// # .unwrap()
8038/// # .https_or_http()
8039/// # .enable_http2()
8040/// # .build()
8041/// # );
8042/// # let mut hub = DataCatalog::new(client, auth);
8043/// // As the method needs a request, you would usually fill it with the desired information
8044/// // into the respective structure. Some of the parts shown here might not be applicable !
8045/// // Values shown here are possibly random and not representative !
8046/// let mut req = GoogleCloudDatacatalogV1beta1Tag::default();
8047///
8048/// // You can configure optional parameters by calling the respective setters at will, and
8049/// // execute the final call using `doit()`.
8050/// // Values shown here are possibly random and not representative !
8051/// let result = hub.projects().locations_entry_groups_tags_patch(req, "name")
8052/// .update_mask(FieldMask::new::<&str>(&[]))
8053/// .doit().await;
8054/// # }
8055/// ```
8056pub struct ProjectLocationEntryGroupTagPatchCall<'a, C>
8057where
8058 C: 'a,
8059{
8060 hub: &'a DataCatalog<C>,
8061 _request: GoogleCloudDatacatalogV1beta1Tag,
8062 _name: String,
8063 _update_mask: Option<common::FieldMask>,
8064 _delegate: Option<&'a mut dyn common::Delegate>,
8065 _additional_params: HashMap<String, String>,
8066 _scopes: BTreeSet<String>,
8067}
8068
8069impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTagPatchCall<'a, C> {}
8070
8071impl<'a, C> ProjectLocationEntryGroupTagPatchCall<'a, C>
8072where
8073 C: common::Connector,
8074{
8075 /// Perform the operation you have build so far.
8076 pub async fn doit(
8077 mut self,
8078 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Tag)> {
8079 use std::borrow::Cow;
8080 use std::io::{Read, Seek};
8081
8082 use common::{url::Params, ToParts};
8083 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8084
8085 let mut dd = common::DefaultDelegate;
8086 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8087 dlg.begin(common::MethodInfo {
8088 id: "datacatalog.projects.locations.entryGroups.tags.patch",
8089 http_method: hyper::Method::PATCH,
8090 });
8091
8092 for &field in ["alt", "name", "updateMask"].iter() {
8093 if self._additional_params.contains_key(field) {
8094 dlg.finished(false);
8095 return Err(common::Error::FieldClash(field));
8096 }
8097 }
8098
8099 let mut params = Params::with_capacity(5 + self._additional_params.len());
8100 params.push("name", self._name);
8101 if let Some(value) = self._update_mask.as_ref() {
8102 params.push("updateMask", value.to_string());
8103 }
8104
8105 params.extend(self._additional_params.iter());
8106
8107 params.push("alt", "json");
8108 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8109 if self._scopes.is_empty() {
8110 self._scopes
8111 .insert(Scope::CloudPlatform.as_ref().to_string());
8112 }
8113
8114 #[allow(clippy::single_element_loop)]
8115 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8116 url = params.uri_replacement(url, param_name, find_this, true);
8117 }
8118 {
8119 let to_remove = ["name"];
8120 params.remove_params(&to_remove);
8121 }
8122
8123 let url = params.parse_with_url(&url);
8124
8125 let mut json_mime_type = mime::APPLICATION_JSON;
8126 let mut request_value_reader = {
8127 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8128 common::remove_json_null_values(&mut value);
8129 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8130 serde_json::to_writer(&mut dst, &value).unwrap();
8131 dst
8132 };
8133 let request_size = request_value_reader
8134 .seek(std::io::SeekFrom::End(0))
8135 .unwrap();
8136 request_value_reader
8137 .seek(std::io::SeekFrom::Start(0))
8138 .unwrap();
8139
8140 loop {
8141 let token = match self
8142 .hub
8143 .auth
8144 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8145 .await
8146 {
8147 Ok(token) => token,
8148 Err(e) => match dlg.token(e) {
8149 Ok(token) => token,
8150 Err(e) => {
8151 dlg.finished(false);
8152 return Err(common::Error::MissingToken(e));
8153 }
8154 },
8155 };
8156 request_value_reader
8157 .seek(std::io::SeekFrom::Start(0))
8158 .unwrap();
8159 let mut req_result = {
8160 let client = &self.hub.client;
8161 dlg.pre_request();
8162 let mut req_builder = hyper::Request::builder()
8163 .method(hyper::Method::PATCH)
8164 .uri(url.as_str())
8165 .header(USER_AGENT, self.hub._user_agent.clone());
8166
8167 if let Some(token) = token.as_ref() {
8168 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8169 }
8170
8171 let request = req_builder
8172 .header(CONTENT_TYPE, json_mime_type.to_string())
8173 .header(CONTENT_LENGTH, request_size as u64)
8174 .body(common::to_body(
8175 request_value_reader.get_ref().clone().into(),
8176 ));
8177
8178 client.request(request.unwrap()).await
8179 };
8180
8181 match req_result {
8182 Err(err) => {
8183 if let common::Retry::After(d) = dlg.http_error(&err) {
8184 sleep(d).await;
8185 continue;
8186 }
8187 dlg.finished(false);
8188 return Err(common::Error::HttpError(err));
8189 }
8190 Ok(res) => {
8191 let (mut parts, body) = res.into_parts();
8192 let mut body = common::Body::new(body);
8193 if !parts.status.is_success() {
8194 let bytes = common::to_bytes(body).await.unwrap_or_default();
8195 let error = serde_json::from_str(&common::to_string(&bytes));
8196 let response = common::to_response(parts, bytes.into());
8197
8198 if let common::Retry::After(d) =
8199 dlg.http_failure(&response, error.as_ref().ok())
8200 {
8201 sleep(d).await;
8202 continue;
8203 }
8204
8205 dlg.finished(false);
8206
8207 return Err(match error {
8208 Ok(value) => common::Error::BadRequest(value),
8209 _ => common::Error::Failure(response),
8210 });
8211 }
8212 let response = {
8213 let bytes = common::to_bytes(body).await.unwrap_or_default();
8214 let encoded = common::to_string(&bytes);
8215 match serde_json::from_str(&encoded) {
8216 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8217 Err(error) => {
8218 dlg.response_json_decode_error(&encoded, &error);
8219 return Err(common::Error::JsonDecodeError(
8220 encoded.to_string(),
8221 error,
8222 ));
8223 }
8224 }
8225 };
8226
8227 dlg.finished(true);
8228 return Ok(response);
8229 }
8230 }
8231 }
8232 }
8233
8234 ///
8235 /// Sets the *request* property to the given value.
8236 ///
8237 /// Even though the property as already been set when instantiating this call,
8238 /// we provide this method for API completeness.
8239 pub fn request(
8240 mut self,
8241 new_value: GoogleCloudDatacatalogV1beta1Tag,
8242 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
8243 self._request = new_value;
8244 self
8245 }
8246 /// Identifier. The resource name of the tag in URL format. Example: * projects/{project_id}/locations/{location}/entrygroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id} where `tag_id` is a system-generated identifier. Note that this Tag may not actually be stored in the location in this name.
8247 ///
8248 /// Sets the *name* path property to the given value.
8249 ///
8250 /// Even though the property as already been set when instantiating this call,
8251 /// we provide this method for API completeness.
8252 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
8253 self._name = new_value.to_string();
8254 self
8255 }
8256 /// Note: Currently, this parameter can only take `"fields"` as value. 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.
8257 ///
8258 /// Sets the *update mask* query property to the given value.
8259 pub fn update_mask(
8260 mut self,
8261 new_value: common::FieldMask,
8262 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
8263 self._update_mask = Some(new_value);
8264 self
8265 }
8266 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8267 /// while executing the actual API request.
8268 ///
8269 /// ````text
8270 /// It should be used to handle progress information, and to implement a certain level of resilience.
8271 /// ````
8272 ///
8273 /// Sets the *delegate* property to the given value.
8274 pub fn delegate(
8275 mut self,
8276 new_value: &'a mut dyn common::Delegate,
8277 ) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
8278 self._delegate = Some(new_value);
8279 self
8280 }
8281
8282 /// Set any additional parameter of the query string used in the request.
8283 /// It should be used to set parameters which are not yet available through their own
8284 /// setters.
8285 ///
8286 /// Please note that this method must not be used to set any of the known parameters
8287 /// which have their own setter method. If done anyway, the request will fail.
8288 ///
8289 /// # Additional Parameters
8290 ///
8291 /// * *$.xgafv* (query-string) - V1 error format.
8292 /// * *access_token* (query-string) - OAuth access token.
8293 /// * *alt* (query-string) - Data format for response.
8294 /// * *callback* (query-string) - JSONP
8295 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8296 /// * *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.
8297 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8298 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8299 /// * *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.
8300 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8301 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8302 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupTagPatchCall<'a, C>
8303 where
8304 T: AsRef<str>,
8305 {
8306 self._additional_params
8307 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8308 self
8309 }
8310
8311 /// Identifies the authorization scope for the method you are building.
8312 ///
8313 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8314 /// [`Scope::CloudPlatform`].
8315 ///
8316 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8317 /// tokens for more than one scope.
8318 ///
8319 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8320 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8321 /// sufficient, a read-write scope will do as well.
8322 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupTagPatchCall<'a, C>
8323 where
8324 St: AsRef<str>,
8325 {
8326 self._scopes.insert(String::from(scope.as_ref()));
8327 self
8328 }
8329 /// Identifies the authorization scope(s) for the method you are building.
8330 ///
8331 /// See [`Self::add_scope()`] for details.
8332 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupTagPatchCall<'a, C>
8333 where
8334 I: IntoIterator<Item = St>,
8335 St: AsRef<str>,
8336 {
8337 self._scopes
8338 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8339 self
8340 }
8341
8342 /// Removes all scopes, and no default scope will be used either.
8343 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8344 /// for details).
8345 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTagPatchCall<'a, C> {
8346 self._scopes.clear();
8347 self
8348 }
8349}
8350
8351/// A maximum of 10,000 entry groups may be created per organization across all locations. Users should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
8352///
8353/// A builder for the *locations.entryGroups.create* method supported by a *project* resource.
8354/// It is not used directly, but through a [`ProjectMethods`] instance.
8355///
8356/// # Example
8357///
8358/// Instantiate a resource method builder
8359///
8360/// ```test_harness,no_run
8361/// # extern crate hyper;
8362/// # extern crate hyper_rustls;
8363/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
8364/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1EntryGroup;
8365/// # async fn dox() {
8366/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8367///
8368/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8369/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8370/// # .with_native_roots()
8371/// # .unwrap()
8372/// # .https_only()
8373/// # .enable_http2()
8374/// # .build();
8375///
8376/// # let executor = hyper_util::rt::TokioExecutor::new();
8377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8378/// # secret,
8379/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8380/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8381/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8382/// # ),
8383/// # ).build().await.unwrap();
8384///
8385/// # let client = hyper_util::client::legacy::Client::builder(
8386/// # hyper_util::rt::TokioExecutor::new()
8387/// # )
8388/// # .build(
8389/// # hyper_rustls::HttpsConnectorBuilder::new()
8390/// # .with_native_roots()
8391/// # .unwrap()
8392/// # .https_or_http()
8393/// # .enable_http2()
8394/// # .build()
8395/// # );
8396/// # let mut hub = DataCatalog::new(client, auth);
8397/// // As the method needs a request, you would usually fill it with the desired information
8398/// // into the respective structure. Some of the parts shown here might not be applicable !
8399/// // Values shown here are possibly random and not representative !
8400/// let mut req = GoogleCloudDatacatalogV1beta1EntryGroup::default();
8401///
8402/// // You can configure optional parameters by calling the respective setters at will, and
8403/// // execute the final call using `doit()`.
8404/// // Values shown here are possibly random and not representative !
8405/// let result = hub.projects().locations_entry_groups_create(req, "parent")
8406/// .entry_group_id("est")
8407/// .doit().await;
8408/// # }
8409/// ```
8410pub struct ProjectLocationEntryGroupCreateCall<'a, C>
8411where
8412 C: 'a,
8413{
8414 hub: &'a DataCatalog<C>,
8415 _request: GoogleCloudDatacatalogV1beta1EntryGroup,
8416 _parent: String,
8417 _entry_group_id: Option<String>,
8418 _delegate: Option<&'a mut dyn common::Delegate>,
8419 _additional_params: HashMap<String, String>,
8420 _scopes: BTreeSet<String>,
8421}
8422
8423impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupCreateCall<'a, C> {}
8424
8425impl<'a, C> ProjectLocationEntryGroupCreateCall<'a, C>
8426where
8427 C: common::Connector,
8428{
8429 /// Perform the operation you have build so far.
8430 pub async fn doit(
8431 mut self,
8432 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1EntryGroup)> {
8433 use std::borrow::Cow;
8434 use std::io::{Read, Seek};
8435
8436 use common::{url::Params, ToParts};
8437 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8438
8439 let mut dd = common::DefaultDelegate;
8440 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8441 dlg.begin(common::MethodInfo {
8442 id: "datacatalog.projects.locations.entryGroups.create",
8443 http_method: hyper::Method::POST,
8444 });
8445
8446 for &field in ["alt", "parent", "entryGroupId"].iter() {
8447 if self._additional_params.contains_key(field) {
8448 dlg.finished(false);
8449 return Err(common::Error::FieldClash(field));
8450 }
8451 }
8452
8453 let mut params = Params::with_capacity(5 + self._additional_params.len());
8454 params.push("parent", self._parent);
8455 if let Some(value) = self._entry_group_id.as_ref() {
8456 params.push("entryGroupId", value);
8457 }
8458
8459 params.extend(self._additional_params.iter());
8460
8461 params.push("alt", "json");
8462 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/entryGroups";
8463 if self._scopes.is_empty() {
8464 self._scopes
8465 .insert(Scope::CloudPlatform.as_ref().to_string());
8466 }
8467
8468 #[allow(clippy::single_element_loop)]
8469 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8470 url = params.uri_replacement(url, param_name, find_this, true);
8471 }
8472 {
8473 let to_remove = ["parent"];
8474 params.remove_params(&to_remove);
8475 }
8476
8477 let url = params.parse_with_url(&url);
8478
8479 let mut json_mime_type = mime::APPLICATION_JSON;
8480 let mut request_value_reader = {
8481 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8482 common::remove_json_null_values(&mut value);
8483 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8484 serde_json::to_writer(&mut dst, &value).unwrap();
8485 dst
8486 };
8487 let request_size = request_value_reader
8488 .seek(std::io::SeekFrom::End(0))
8489 .unwrap();
8490 request_value_reader
8491 .seek(std::io::SeekFrom::Start(0))
8492 .unwrap();
8493
8494 loop {
8495 let token = match self
8496 .hub
8497 .auth
8498 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8499 .await
8500 {
8501 Ok(token) => token,
8502 Err(e) => match dlg.token(e) {
8503 Ok(token) => token,
8504 Err(e) => {
8505 dlg.finished(false);
8506 return Err(common::Error::MissingToken(e));
8507 }
8508 },
8509 };
8510 request_value_reader
8511 .seek(std::io::SeekFrom::Start(0))
8512 .unwrap();
8513 let mut req_result = {
8514 let client = &self.hub.client;
8515 dlg.pre_request();
8516 let mut req_builder = hyper::Request::builder()
8517 .method(hyper::Method::POST)
8518 .uri(url.as_str())
8519 .header(USER_AGENT, self.hub._user_agent.clone());
8520
8521 if let Some(token) = token.as_ref() {
8522 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8523 }
8524
8525 let request = req_builder
8526 .header(CONTENT_TYPE, json_mime_type.to_string())
8527 .header(CONTENT_LENGTH, request_size as u64)
8528 .body(common::to_body(
8529 request_value_reader.get_ref().clone().into(),
8530 ));
8531
8532 client.request(request.unwrap()).await
8533 };
8534
8535 match req_result {
8536 Err(err) => {
8537 if let common::Retry::After(d) = dlg.http_error(&err) {
8538 sleep(d).await;
8539 continue;
8540 }
8541 dlg.finished(false);
8542 return Err(common::Error::HttpError(err));
8543 }
8544 Ok(res) => {
8545 let (mut parts, body) = res.into_parts();
8546 let mut body = common::Body::new(body);
8547 if !parts.status.is_success() {
8548 let bytes = common::to_bytes(body).await.unwrap_or_default();
8549 let error = serde_json::from_str(&common::to_string(&bytes));
8550 let response = common::to_response(parts, bytes.into());
8551
8552 if let common::Retry::After(d) =
8553 dlg.http_failure(&response, error.as_ref().ok())
8554 {
8555 sleep(d).await;
8556 continue;
8557 }
8558
8559 dlg.finished(false);
8560
8561 return Err(match error {
8562 Ok(value) => common::Error::BadRequest(value),
8563 _ => common::Error::Failure(response),
8564 });
8565 }
8566 let response = {
8567 let bytes = common::to_bytes(body).await.unwrap_or_default();
8568 let encoded = common::to_string(&bytes);
8569 match serde_json::from_str(&encoded) {
8570 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8571 Err(error) => {
8572 dlg.response_json_decode_error(&encoded, &error);
8573 return Err(common::Error::JsonDecodeError(
8574 encoded.to_string(),
8575 error,
8576 ));
8577 }
8578 }
8579 };
8580
8581 dlg.finished(true);
8582 return Ok(response);
8583 }
8584 }
8585 }
8586 }
8587
8588 ///
8589 /// Sets the *request* property to the given value.
8590 ///
8591 /// Even though the property as already been set when instantiating this call,
8592 /// we provide this method for API completeness.
8593 pub fn request(
8594 mut self,
8595 new_value: GoogleCloudDatacatalogV1beta1EntryGroup,
8596 ) -> ProjectLocationEntryGroupCreateCall<'a, C> {
8597 self._request = new_value;
8598 self
8599 }
8600 /// Required. The name of the project this entry group is in. Example: * projects/{project_id}/locations/{location} Note that this EntryGroup and its child resources may not actually be stored in the location in this name.
8601 ///
8602 /// Sets the *parent* path property to the given value.
8603 ///
8604 /// Even though the property as already been set when instantiating this call,
8605 /// we provide this method for API completeness.
8606 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupCreateCall<'a, C> {
8607 self._parent = new_value.to_string();
8608 self
8609 }
8610 /// Required. The id of the entry group to create. The id must begin with a letter or underscore, contain only English letters, numbers and underscores, and be at most 64 characters.
8611 ///
8612 /// Sets the *entry group id* query property to the given value.
8613 pub fn entry_group_id(mut self, new_value: &str) -> ProjectLocationEntryGroupCreateCall<'a, C> {
8614 self._entry_group_id = Some(new_value.to_string());
8615 self
8616 }
8617 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8618 /// while executing the actual API request.
8619 ///
8620 /// ````text
8621 /// It should be used to handle progress information, and to implement a certain level of resilience.
8622 /// ````
8623 ///
8624 /// Sets the *delegate* property to the given value.
8625 pub fn delegate(
8626 mut self,
8627 new_value: &'a mut dyn common::Delegate,
8628 ) -> ProjectLocationEntryGroupCreateCall<'a, C> {
8629 self._delegate = Some(new_value);
8630 self
8631 }
8632
8633 /// Set any additional parameter of the query string used in the request.
8634 /// It should be used to set parameters which are not yet available through their own
8635 /// setters.
8636 ///
8637 /// Please note that this method must not be used to set any of the known parameters
8638 /// which have their own setter method. If done anyway, the request will fail.
8639 ///
8640 /// # Additional Parameters
8641 ///
8642 /// * *$.xgafv* (query-string) - V1 error format.
8643 /// * *access_token* (query-string) - OAuth access token.
8644 /// * *alt* (query-string) - Data format for response.
8645 /// * *callback* (query-string) - JSONP
8646 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8647 /// * *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.
8648 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8649 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8650 /// * *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.
8651 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8652 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8653 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupCreateCall<'a, C>
8654 where
8655 T: AsRef<str>,
8656 {
8657 self._additional_params
8658 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8659 self
8660 }
8661
8662 /// Identifies the authorization scope for the method you are building.
8663 ///
8664 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8665 /// [`Scope::CloudPlatform`].
8666 ///
8667 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8668 /// tokens for more than one scope.
8669 ///
8670 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8671 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8672 /// sufficient, a read-write scope will do as well.
8673 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupCreateCall<'a, C>
8674 where
8675 St: AsRef<str>,
8676 {
8677 self._scopes.insert(String::from(scope.as_ref()));
8678 self
8679 }
8680 /// Identifies the authorization scope(s) for the method you are building.
8681 ///
8682 /// See [`Self::add_scope()`] for details.
8683 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupCreateCall<'a, C>
8684 where
8685 I: IntoIterator<Item = St>,
8686 St: AsRef<str>,
8687 {
8688 self._scopes
8689 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8690 self
8691 }
8692
8693 /// Removes all scopes, and no default scope will be used either.
8694 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8695 /// for details).
8696 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupCreateCall<'a, C> {
8697 self._scopes.clear();
8698 self
8699 }
8700}
8701
8702/// Deletes an EntryGroup. Only entry groups that do not contain entries can be deleted. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
8703///
8704/// A builder for the *locations.entryGroups.delete* method supported by a *project* resource.
8705/// It is not used directly, but through a [`ProjectMethods`] instance.
8706///
8707/// # Example
8708///
8709/// Instantiate a resource method builder
8710///
8711/// ```test_harness,no_run
8712/// # extern crate hyper;
8713/// # extern crate hyper_rustls;
8714/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
8715/// # async fn dox() {
8716/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8717///
8718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8719/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8720/// # .with_native_roots()
8721/// # .unwrap()
8722/// # .https_only()
8723/// # .enable_http2()
8724/// # .build();
8725///
8726/// # let executor = hyper_util::rt::TokioExecutor::new();
8727/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8728/// # secret,
8729/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8730/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8731/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8732/// # ),
8733/// # ).build().await.unwrap();
8734///
8735/// # let client = hyper_util::client::legacy::Client::builder(
8736/// # hyper_util::rt::TokioExecutor::new()
8737/// # )
8738/// # .build(
8739/// # hyper_rustls::HttpsConnectorBuilder::new()
8740/// # .with_native_roots()
8741/// # .unwrap()
8742/// # .https_or_http()
8743/// # .enable_http2()
8744/// # .build()
8745/// # );
8746/// # let mut hub = DataCatalog::new(client, auth);
8747/// // You can configure optional parameters by calling the respective setters at will, and
8748/// // execute the final call using `doit()`.
8749/// // Values shown here are possibly random and not representative !
8750/// let result = hub.projects().locations_entry_groups_delete("name")
8751/// .force(true)
8752/// .doit().await;
8753/// # }
8754/// ```
8755pub struct ProjectLocationEntryGroupDeleteCall<'a, C>
8756where
8757 C: 'a,
8758{
8759 hub: &'a DataCatalog<C>,
8760 _name: String,
8761 _force: Option<bool>,
8762 _delegate: Option<&'a mut dyn common::Delegate>,
8763 _additional_params: HashMap<String, String>,
8764 _scopes: BTreeSet<String>,
8765}
8766
8767impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupDeleteCall<'a, C> {}
8768
8769impl<'a, C> ProjectLocationEntryGroupDeleteCall<'a, C>
8770where
8771 C: common::Connector,
8772{
8773 /// Perform the operation you have build so far.
8774 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8775 use std::borrow::Cow;
8776 use std::io::{Read, Seek};
8777
8778 use common::{url::Params, ToParts};
8779 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8780
8781 let mut dd = common::DefaultDelegate;
8782 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8783 dlg.begin(common::MethodInfo {
8784 id: "datacatalog.projects.locations.entryGroups.delete",
8785 http_method: hyper::Method::DELETE,
8786 });
8787
8788 for &field in ["alt", "name", "force"].iter() {
8789 if self._additional_params.contains_key(field) {
8790 dlg.finished(false);
8791 return Err(common::Error::FieldClash(field));
8792 }
8793 }
8794
8795 let mut params = Params::with_capacity(4 + self._additional_params.len());
8796 params.push("name", self._name);
8797 if let Some(value) = self._force.as_ref() {
8798 params.push("force", value.to_string());
8799 }
8800
8801 params.extend(self._additional_params.iter());
8802
8803 params.push("alt", "json");
8804 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8805 if self._scopes.is_empty() {
8806 self._scopes
8807 .insert(Scope::CloudPlatform.as_ref().to_string());
8808 }
8809
8810 #[allow(clippy::single_element_loop)]
8811 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8812 url = params.uri_replacement(url, param_name, find_this, true);
8813 }
8814 {
8815 let to_remove = ["name"];
8816 params.remove_params(&to_remove);
8817 }
8818
8819 let url = params.parse_with_url(&url);
8820
8821 loop {
8822 let token = match self
8823 .hub
8824 .auth
8825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8826 .await
8827 {
8828 Ok(token) => token,
8829 Err(e) => match dlg.token(e) {
8830 Ok(token) => token,
8831 Err(e) => {
8832 dlg.finished(false);
8833 return Err(common::Error::MissingToken(e));
8834 }
8835 },
8836 };
8837 let mut req_result = {
8838 let client = &self.hub.client;
8839 dlg.pre_request();
8840 let mut req_builder = hyper::Request::builder()
8841 .method(hyper::Method::DELETE)
8842 .uri(url.as_str())
8843 .header(USER_AGENT, self.hub._user_agent.clone());
8844
8845 if let Some(token) = token.as_ref() {
8846 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8847 }
8848
8849 let request = req_builder
8850 .header(CONTENT_LENGTH, 0_u64)
8851 .body(common::to_body::<String>(None));
8852
8853 client.request(request.unwrap()).await
8854 };
8855
8856 match req_result {
8857 Err(err) => {
8858 if let common::Retry::After(d) = dlg.http_error(&err) {
8859 sleep(d).await;
8860 continue;
8861 }
8862 dlg.finished(false);
8863 return Err(common::Error::HttpError(err));
8864 }
8865 Ok(res) => {
8866 let (mut parts, body) = res.into_parts();
8867 let mut body = common::Body::new(body);
8868 if !parts.status.is_success() {
8869 let bytes = common::to_bytes(body).await.unwrap_or_default();
8870 let error = serde_json::from_str(&common::to_string(&bytes));
8871 let response = common::to_response(parts, bytes.into());
8872
8873 if let common::Retry::After(d) =
8874 dlg.http_failure(&response, error.as_ref().ok())
8875 {
8876 sleep(d).await;
8877 continue;
8878 }
8879
8880 dlg.finished(false);
8881
8882 return Err(match error {
8883 Ok(value) => common::Error::BadRequest(value),
8884 _ => common::Error::Failure(response),
8885 });
8886 }
8887 let response = {
8888 let bytes = common::to_bytes(body).await.unwrap_or_default();
8889 let encoded = common::to_string(&bytes);
8890 match serde_json::from_str(&encoded) {
8891 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8892 Err(error) => {
8893 dlg.response_json_decode_error(&encoded, &error);
8894 return Err(common::Error::JsonDecodeError(
8895 encoded.to_string(),
8896 error,
8897 ));
8898 }
8899 }
8900 };
8901
8902 dlg.finished(true);
8903 return Ok(response);
8904 }
8905 }
8906 }
8907 }
8908
8909 /// Required. The name of the entry group. For example, `projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}`.
8910 ///
8911 /// Sets the *name* path property to the given value.
8912 ///
8913 /// Even though the property as already been set when instantiating this call,
8914 /// we provide this method for API completeness.
8915 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
8916 self._name = new_value.to_string();
8917 self
8918 }
8919 /// Optional. If true, deletes all entries in the entry group.
8920 ///
8921 /// Sets the *force* query property to the given value.
8922 pub fn force(mut self, new_value: bool) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
8923 self._force = Some(new_value);
8924 self
8925 }
8926 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8927 /// while executing the actual API request.
8928 ///
8929 /// ````text
8930 /// It should be used to handle progress information, and to implement a certain level of resilience.
8931 /// ````
8932 ///
8933 /// Sets the *delegate* property to the given value.
8934 pub fn delegate(
8935 mut self,
8936 new_value: &'a mut dyn common::Delegate,
8937 ) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
8938 self._delegate = Some(new_value);
8939 self
8940 }
8941
8942 /// Set any additional parameter of the query string used in the request.
8943 /// It should be used to set parameters which are not yet available through their own
8944 /// setters.
8945 ///
8946 /// Please note that this method must not be used to set any of the known parameters
8947 /// which have their own setter method. If done anyway, the request will fail.
8948 ///
8949 /// # Additional Parameters
8950 ///
8951 /// * *$.xgafv* (query-string) - V1 error format.
8952 /// * *access_token* (query-string) - OAuth access token.
8953 /// * *alt* (query-string) - Data format for response.
8954 /// * *callback* (query-string) - JSONP
8955 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8956 /// * *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.
8957 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8958 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8959 /// * *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.
8960 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8961 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8962 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupDeleteCall<'a, C>
8963 where
8964 T: AsRef<str>,
8965 {
8966 self._additional_params
8967 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8968 self
8969 }
8970
8971 /// Identifies the authorization scope for the method you are building.
8972 ///
8973 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8974 /// [`Scope::CloudPlatform`].
8975 ///
8976 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8977 /// tokens for more than one scope.
8978 ///
8979 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8980 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8981 /// sufficient, a read-write scope will do as well.
8982 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupDeleteCall<'a, C>
8983 where
8984 St: AsRef<str>,
8985 {
8986 self._scopes.insert(String::from(scope.as_ref()));
8987 self
8988 }
8989 /// Identifies the authorization scope(s) for the method you are building.
8990 ///
8991 /// See [`Self::add_scope()`] for details.
8992 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupDeleteCall<'a, C>
8993 where
8994 I: IntoIterator<Item = St>,
8995 St: AsRef<str>,
8996 {
8997 self._scopes
8998 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8999 self
9000 }
9001
9002 /// Removes all scopes, and no default scope will be used either.
9003 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9004 /// for details).
9005 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupDeleteCall<'a, C> {
9006 self._scopes.clear();
9007 self
9008 }
9009}
9010
9011/// Gets an EntryGroup.
9012///
9013/// A builder for the *locations.entryGroups.get* method supported by a *project* resource.
9014/// It is not used directly, but through a [`ProjectMethods`] instance.
9015///
9016/// # Example
9017///
9018/// Instantiate a resource method builder
9019///
9020/// ```test_harness,no_run
9021/// # extern crate hyper;
9022/// # extern crate hyper_rustls;
9023/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
9024/// # async fn dox() {
9025/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9026///
9027/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9028/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9029/// # .with_native_roots()
9030/// # .unwrap()
9031/// # .https_only()
9032/// # .enable_http2()
9033/// # .build();
9034///
9035/// # let executor = hyper_util::rt::TokioExecutor::new();
9036/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9037/// # secret,
9038/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9039/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9040/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9041/// # ),
9042/// # ).build().await.unwrap();
9043///
9044/// # let client = hyper_util::client::legacy::Client::builder(
9045/// # hyper_util::rt::TokioExecutor::new()
9046/// # )
9047/// # .build(
9048/// # hyper_rustls::HttpsConnectorBuilder::new()
9049/// # .with_native_roots()
9050/// # .unwrap()
9051/// # .https_or_http()
9052/// # .enable_http2()
9053/// # .build()
9054/// # );
9055/// # let mut hub = DataCatalog::new(client, auth);
9056/// // You can configure optional parameters by calling the respective setters at will, and
9057/// // execute the final call using `doit()`.
9058/// // Values shown here are possibly random and not representative !
9059/// let result = hub.projects().locations_entry_groups_get("name")
9060/// .read_mask(FieldMask::new::<&str>(&[]))
9061/// .doit().await;
9062/// # }
9063/// ```
9064pub struct ProjectLocationEntryGroupGetCall<'a, C>
9065where
9066 C: 'a,
9067{
9068 hub: &'a DataCatalog<C>,
9069 _name: String,
9070 _read_mask: Option<common::FieldMask>,
9071 _delegate: Option<&'a mut dyn common::Delegate>,
9072 _additional_params: HashMap<String, String>,
9073 _scopes: BTreeSet<String>,
9074}
9075
9076impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupGetCall<'a, C> {}
9077
9078impl<'a, C> ProjectLocationEntryGroupGetCall<'a, C>
9079where
9080 C: common::Connector,
9081{
9082 /// Perform the operation you have build so far.
9083 pub async fn doit(
9084 mut self,
9085 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1EntryGroup)> {
9086 use std::borrow::Cow;
9087 use std::io::{Read, Seek};
9088
9089 use common::{url::Params, ToParts};
9090 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9091
9092 let mut dd = common::DefaultDelegate;
9093 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9094 dlg.begin(common::MethodInfo {
9095 id: "datacatalog.projects.locations.entryGroups.get",
9096 http_method: hyper::Method::GET,
9097 });
9098
9099 for &field in ["alt", "name", "readMask"].iter() {
9100 if self._additional_params.contains_key(field) {
9101 dlg.finished(false);
9102 return Err(common::Error::FieldClash(field));
9103 }
9104 }
9105
9106 let mut params = Params::with_capacity(4 + self._additional_params.len());
9107 params.push("name", self._name);
9108 if let Some(value) = self._read_mask.as_ref() {
9109 params.push("readMask", value.to_string());
9110 }
9111
9112 params.extend(self._additional_params.iter());
9113
9114 params.push("alt", "json");
9115 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
9116 if self._scopes.is_empty() {
9117 self._scopes
9118 .insert(Scope::CloudPlatform.as_ref().to_string());
9119 }
9120
9121 #[allow(clippy::single_element_loop)]
9122 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9123 url = params.uri_replacement(url, param_name, find_this, true);
9124 }
9125 {
9126 let to_remove = ["name"];
9127 params.remove_params(&to_remove);
9128 }
9129
9130 let url = params.parse_with_url(&url);
9131
9132 loop {
9133 let token = match self
9134 .hub
9135 .auth
9136 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9137 .await
9138 {
9139 Ok(token) => token,
9140 Err(e) => match dlg.token(e) {
9141 Ok(token) => token,
9142 Err(e) => {
9143 dlg.finished(false);
9144 return Err(common::Error::MissingToken(e));
9145 }
9146 },
9147 };
9148 let mut req_result = {
9149 let client = &self.hub.client;
9150 dlg.pre_request();
9151 let mut req_builder = hyper::Request::builder()
9152 .method(hyper::Method::GET)
9153 .uri(url.as_str())
9154 .header(USER_AGENT, self.hub._user_agent.clone());
9155
9156 if let Some(token) = token.as_ref() {
9157 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9158 }
9159
9160 let request = req_builder
9161 .header(CONTENT_LENGTH, 0_u64)
9162 .body(common::to_body::<String>(None));
9163
9164 client.request(request.unwrap()).await
9165 };
9166
9167 match req_result {
9168 Err(err) => {
9169 if let common::Retry::After(d) = dlg.http_error(&err) {
9170 sleep(d).await;
9171 continue;
9172 }
9173 dlg.finished(false);
9174 return Err(common::Error::HttpError(err));
9175 }
9176 Ok(res) => {
9177 let (mut parts, body) = res.into_parts();
9178 let mut body = common::Body::new(body);
9179 if !parts.status.is_success() {
9180 let bytes = common::to_bytes(body).await.unwrap_or_default();
9181 let error = serde_json::from_str(&common::to_string(&bytes));
9182 let response = common::to_response(parts, bytes.into());
9183
9184 if let common::Retry::After(d) =
9185 dlg.http_failure(&response, error.as_ref().ok())
9186 {
9187 sleep(d).await;
9188 continue;
9189 }
9190
9191 dlg.finished(false);
9192
9193 return Err(match error {
9194 Ok(value) => common::Error::BadRequest(value),
9195 _ => common::Error::Failure(response),
9196 });
9197 }
9198 let response = {
9199 let bytes = common::to_bytes(body).await.unwrap_or_default();
9200 let encoded = common::to_string(&bytes);
9201 match serde_json::from_str(&encoded) {
9202 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9203 Err(error) => {
9204 dlg.response_json_decode_error(&encoded, &error);
9205 return Err(common::Error::JsonDecodeError(
9206 encoded.to_string(),
9207 error,
9208 ));
9209 }
9210 }
9211 };
9212
9213 dlg.finished(true);
9214 return Ok(response);
9215 }
9216 }
9217 }
9218 }
9219
9220 /// Required. The name of the entry group. For example, `projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}`.
9221 ///
9222 /// Sets the *name* path property to the given value.
9223 ///
9224 /// Even though the property as already been set when instantiating this call,
9225 /// we provide this method for API completeness.
9226 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupGetCall<'a, C> {
9227 self._name = new_value.to_string();
9228 self
9229 }
9230 /// The fields to return. If not set or empty, all fields are returned.
9231 ///
9232 /// Sets the *read mask* query property to the given value.
9233 pub fn read_mask(
9234 mut self,
9235 new_value: common::FieldMask,
9236 ) -> ProjectLocationEntryGroupGetCall<'a, C> {
9237 self._read_mask = Some(new_value);
9238 self
9239 }
9240 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9241 /// while executing the actual API request.
9242 ///
9243 /// ````text
9244 /// It should be used to handle progress information, and to implement a certain level of resilience.
9245 /// ````
9246 ///
9247 /// Sets the *delegate* property to the given value.
9248 pub fn delegate(
9249 mut self,
9250 new_value: &'a mut dyn common::Delegate,
9251 ) -> ProjectLocationEntryGroupGetCall<'a, C> {
9252 self._delegate = Some(new_value);
9253 self
9254 }
9255
9256 /// Set any additional parameter of the query string used in the request.
9257 /// It should be used to set parameters which are not yet available through their own
9258 /// setters.
9259 ///
9260 /// Please note that this method must not be used to set any of the known parameters
9261 /// which have their own setter method. If done anyway, the request will fail.
9262 ///
9263 /// # Additional Parameters
9264 ///
9265 /// * *$.xgafv* (query-string) - V1 error format.
9266 /// * *access_token* (query-string) - OAuth access token.
9267 /// * *alt* (query-string) - Data format for response.
9268 /// * *callback* (query-string) - JSONP
9269 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9270 /// * *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.
9271 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9272 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9273 /// * *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.
9274 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9275 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9276 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupGetCall<'a, C>
9277 where
9278 T: AsRef<str>,
9279 {
9280 self._additional_params
9281 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9282 self
9283 }
9284
9285 /// Identifies the authorization scope for the method you are building.
9286 ///
9287 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9288 /// [`Scope::CloudPlatform`].
9289 ///
9290 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9291 /// tokens for more than one scope.
9292 ///
9293 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9294 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9295 /// sufficient, a read-write scope will do as well.
9296 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupGetCall<'a, C>
9297 where
9298 St: AsRef<str>,
9299 {
9300 self._scopes.insert(String::from(scope.as_ref()));
9301 self
9302 }
9303 /// Identifies the authorization scope(s) for the method you are building.
9304 ///
9305 /// See [`Self::add_scope()`] for details.
9306 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupGetCall<'a, C>
9307 where
9308 I: IntoIterator<Item = St>,
9309 St: AsRef<str>,
9310 {
9311 self._scopes
9312 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9313 self
9314 }
9315
9316 /// Removes all scopes, and no default scope will be used either.
9317 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9318 /// for details).
9319 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupGetCall<'a, C> {
9320 self._scopes.clear();
9321 self
9322 }
9323}
9324
9325/// Gets the access control policy for a resource. A `NOT_FOUND` error is returned if the resource does not exist. An empty policy is returned if the resource exists but does not have a policy set on it. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entries.getIamPolicy` to get policies on entries. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
9326///
9327/// A builder for the *locations.entryGroups.getIamPolicy* method supported by a *project* resource.
9328/// It is not used directly, but through a [`ProjectMethods`] instance.
9329///
9330/// # Example
9331///
9332/// Instantiate a resource method builder
9333///
9334/// ```test_harness,no_run
9335/// # extern crate hyper;
9336/// # extern crate hyper_rustls;
9337/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
9338/// use datacatalog1_beta1::api::GetIamPolicyRequest;
9339/// # async fn dox() {
9340/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9341///
9342/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9343/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9344/// # .with_native_roots()
9345/// # .unwrap()
9346/// # .https_only()
9347/// # .enable_http2()
9348/// # .build();
9349///
9350/// # let executor = hyper_util::rt::TokioExecutor::new();
9351/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9352/// # secret,
9353/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9354/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9355/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9356/// # ),
9357/// # ).build().await.unwrap();
9358///
9359/// # let client = hyper_util::client::legacy::Client::builder(
9360/// # hyper_util::rt::TokioExecutor::new()
9361/// # )
9362/// # .build(
9363/// # hyper_rustls::HttpsConnectorBuilder::new()
9364/// # .with_native_roots()
9365/// # .unwrap()
9366/// # .https_or_http()
9367/// # .enable_http2()
9368/// # .build()
9369/// # );
9370/// # let mut hub = DataCatalog::new(client, auth);
9371/// // As the method needs a request, you would usually fill it with the desired information
9372/// // into the respective structure. Some of the parts shown here might not be applicable !
9373/// // Values shown here are possibly random and not representative !
9374/// let mut req = GetIamPolicyRequest::default();
9375///
9376/// // You can configure optional parameters by calling the respective setters at will, and
9377/// // execute the final call using `doit()`.
9378/// // Values shown here are possibly random and not representative !
9379/// let result = hub.projects().locations_entry_groups_get_iam_policy(req, "resource")
9380/// .doit().await;
9381/// # }
9382/// ```
9383pub struct ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
9384where
9385 C: 'a,
9386{
9387 hub: &'a DataCatalog<C>,
9388 _request: GetIamPolicyRequest,
9389 _resource: String,
9390 _delegate: Option<&'a mut dyn common::Delegate>,
9391 _additional_params: HashMap<String, String>,
9392 _scopes: BTreeSet<String>,
9393}
9394
9395impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {}
9396
9397impl<'a, C> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
9398where
9399 C: common::Connector,
9400{
9401 /// Perform the operation you have build so far.
9402 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9403 use std::borrow::Cow;
9404 use std::io::{Read, Seek};
9405
9406 use common::{url::Params, ToParts};
9407 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9408
9409 let mut dd = common::DefaultDelegate;
9410 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9411 dlg.begin(common::MethodInfo {
9412 id: "datacatalog.projects.locations.entryGroups.getIamPolicy",
9413 http_method: hyper::Method::POST,
9414 });
9415
9416 for &field in ["alt", "resource"].iter() {
9417 if self._additional_params.contains_key(field) {
9418 dlg.finished(false);
9419 return Err(common::Error::FieldClash(field));
9420 }
9421 }
9422
9423 let mut params = Params::with_capacity(4 + self._additional_params.len());
9424 params.push("resource", self._resource);
9425
9426 params.extend(self._additional_params.iter());
9427
9428 params.push("alt", "json");
9429 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
9430 if self._scopes.is_empty() {
9431 self._scopes
9432 .insert(Scope::CloudPlatform.as_ref().to_string());
9433 }
9434
9435 #[allow(clippy::single_element_loop)]
9436 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9437 url = params.uri_replacement(url, param_name, find_this, true);
9438 }
9439 {
9440 let to_remove = ["resource"];
9441 params.remove_params(&to_remove);
9442 }
9443
9444 let url = params.parse_with_url(&url);
9445
9446 let mut json_mime_type = mime::APPLICATION_JSON;
9447 let mut request_value_reader = {
9448 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9449 common::remove_json_null_values(&mut value);
9450 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9451 serde_json::to_writer(&mut dst, &value).unwrap();
9452 dst
9453 };
9454 let request_size = request_value_reader
9455 .seek(std::io::SeekFrom::End(0))
9456 .unwrap();
9457 request_value_reader
9458 .seek(std::io::SeekFrom::Start(0))
9459 .unwrap();
9460
9461 loop {
9462 let token = match self
9463 .hub
9464 .auth
9465 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9466 .await
9467 {
9468 Ok(token) => token,
9469 Err(e) => match dlg.token(e) {
9470 Ok(token) => token,
9471 Err(e) => {
9472 dlg.finished(false);
9473 return Err(common::Error::MissingToken(e));
9474 }
9475 },
9476 };
9477 request_value_reader
9478 .seek(std::io::SeekFrom::Start(0))
9479 .unwrap();
9480 let mut req_result = {
9481 let client = &self.hub.client;
9482 dlg.pre_request();
9483 let mut req_builder = hyper::Request::builder()
9484 .method(hyper::Method::POST)
9485 .uri(url.as_str())
9486 .header(USER_AGENT, self.hub._user_agent.clone());
9487
9488 if let Some(token) = token.as_ref() {
9489 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9490 }
9491
9492 let request = req_builder
9493 .header(CONTENT_TYPE, json_mime_type.to_string())
9494 .header(CONTENT_LENGTH, request_size as u64)
9495 .body(common::to_body(
9496 request_value_reader.get_ref().clone().into(),
9497 ));
9498
9499 client.request(request.unwrap()).await
9500 };
9501
9502 match req_result {
9503 Err(err) => {
9504 if let common::Retry::After(d) = dlg.http_error(&err) {
9505 sleep(d).await;
9506 continue;
9507 }
9508 dlg.finished(false);
9509 return Err(common::Error::HttpError(err));
9510 }
9511 Ok(res) => {
9512 let (mut parts, body) = res.into_parts();
9513 let mut body = common::Body::new(body);
9514 if !parts.status.is_success() {
9515 let bytes = common::to_bytes(body).await.unwrap_or_default();
9516 let error = serde_json::from_str(&common::to_string(&bytes));
9517 let response = common::to_response(parts, bytes.into());
9518
9519 if let common::Retry::After(d) =
9520 dlg.http_failure(&response, error.as_ref().ok())
9521 {
9522 sleep(d).await;
9523 continue;
9524 }
9525
9526 dlg.finished(false);
9527
9528 return Err(match error {
9529 Ok(value) => common::Error::BadRequest(value),
9530 _ => common::Error::Failure(response),
9531 });
9532 }
9533 let response = {
9534 let bytes = common::to_bytes(body).await.unwrap_or_default();
9535 let encoded = common::to_string(&bytes);
9536 match serde_json::from_str(&encoded) {
9537 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9538 Err(error) => {
9539 dlg.response_json_decode_error(&encoded, &error);
9540 return Err(common::Error::JsonDecodeError(
9541 encoded.to_string(),
9542 error,
9543 ));
9544 }
9545 }
9546 };
9547
9548 dlg.finished(true);
9549 return Ok(response);
9550 }
9551 }
9552 }
9553 }
9554
9555 ///
9556 /// Sets the *request* property to the given value.
9557 ///
9558 /// Even though the property as already been set when instantiating this call,
9559 /// we provide this method for API completeness.
9560 pub fn request(
9561 mut self,
9562 new_value: GetIamPolicyRequest,
9563 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
9564 self._request = new_value;
9565 self
9566 }
9567 /// 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.
9568 ///
9569 /// Sets the *resource* path property to the given value.
9570 ///
9571 /// Even though the property as already been set when instantiating this call,
9572 /// we provide this method for API completeness.
9573 pub fn resource(mut self, new_value: &str) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
9574 self._resource = new_value.to_string();
9575 self
9576 }
9577 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9578 /// while executing the actual API request.
9579 ///
9580 /// ````text
9581 /// It should be used to handle progress information, and to implement a certain level of resilience.
9582 /// ````
9583 ///
9584 /// Sets the *delegate* property to the given value.
9585 pub fn delegate(
9586 mut self,
9587 new_value: &'a mut dyn common::Delegate,
9588 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
9589 self._delegate = Some(new_value);
9590 self
9591 }
9592
9593 /// Set any additional parameter of the query string used in the request.
9594 /// It should be used to set parameters which are not yet available through their own
9595 /// setters.
9596 ///
9597 /// Please note that this method must not be used to set any of the known parameters
9598 /// which have their own setter method. If done anyway, the request will fail.
9599 ///
9600 /// # Additional Parameters
9601 ///
9602 /// * *$.xgafv* (query-string) - V1 error format.
9603 /// * *access_token* (query-string) - OAuth access token.
9604 /// * *alt* (query-string) - Data format for response.
9605 /// * *callback* (query-string) - JSONP
9606 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9607 /// * *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.
9608 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9609 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9610 /// * *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.
9611 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9612 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9613 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
9614 where
9615 T: AsRef<str>,
9616 {
9617 self._additional_params
9618 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9619 self
9620 }
9621
9622 /// Identifies the authorization scope for the method you are building.
9623 ///
9624 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9625 /// [`Scope::CloudPlatform`].
9626 ///
9627 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9628 /// tokens for more than one scope.
9629 ///
9630 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9631 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9632 /// sufficient, a read-write scope will do as well.
9633 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
9634 where
9635 St: AsRef<str>,
9636 {
9637 self._scopes.insert(String::from(scope.as_ref()));
9638 self
9639 }
9640 /// Identifies the authorization scope(s) for the method you are building.
9641 ///
9642 /// See [`Self::add_scope()`] for details.
9643 pub fn add_scopes<I, St>(
9644 mut self,
9645 scopes: I,
9646 ) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C>
9647 where
9648 I: IntoIterator<Item = St>,
9649 St: AsRef<str>,
9650 {
9651 self._scopes
9652 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9653 self
9654 }
9655
9656 /// Removes all scopes, and no default scope will be used either.
9657 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9658 /// for details).
9659 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupGetIamPolicyCall<'a, C> {
9660 self._scopes.clear();
9661 self
9662 }
9663}
9664
9665/// Lists entry groups.
9666///
9667/// A builder for the *locations.entryGroups.list* method supported by a *project* resource.
9668/// It is not used directly, but through a [`ProjectMethods`] instance.
9669///
9670/// # Example
9671///
9672/// Instantiate a resource method builder
9673///
9674/// ```test_harness,no_run
9675/// # extern crate hyper;
9676/// # extern crate hyper_rustls;
9677/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
9678/// # async fn dox() {
9679/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9680///
9681/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9682/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9683/// # .with_native_roots()
9684/// # .unwrap()
9685/// # .https_only()
9686/// # .enable_http2()
9687/// # .build();
9688///
9689/// # let executor = hyper_util::rt::TokioExecutor::new();
9690/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9691/// # secret,
9692/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9693/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9694/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9695/// # ),
9696/// # ).build().await.unwrap();
9697///
9698/// # let client = hyper_util::client::legacy::Client::builder(
9699/// # hyper_util::rt::TokioExecutor::new()
9700/// # )
9701/// # .build(
9702/// # hyper_rustls::HttpsConnectorBuilder::new()
9703/// # .with_native_roots()
9704/// # .unwrap()
9705/// # .https_or_http()
9706/// # .enable_http2()
9707/// # .build()
9708/// # );
9709/// # let mut hub = DataCatalog::new(client, auth);
9710/// // You can configure optional parameters by calling the respective setters at will, and
9711/// // execute the final call using `doit()`.
9712/// // Values shown here are possibly random and not representative !
9713/// let result = hub.projects().locations_entry_groups_list("parent")
9714/// .page_token("dolor")
9715/// .page_size(-56)
9716/// .doit().await;
9717/// # }
9718/// ```
9719pub struct ProjectLocationEntryGroupListCall<'a, C>
9720where
9721 C: 'a,
9722{
9723 hub: &'a DataCatalog<C>,
9724 _parent: String,
9725 _page_token: Option<String>,
9726 _page_size: Option<i32>,
9727 _delegate: Option<&'a mut dyn common::Delegate>,
9728 _additional_params: HashMap<String, String>,
9729 _scopes: BTreeSet<String>,
9730}
9731
9732impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupListCall<'a, C> {}
9733
9734impl<'a, C> ProjectLocationEntryGroupListCall<'a, C>
9735where
9736 C: common::Connector,
9737{
9738 /// Perform the operation you have build so far.
9739 pub async fn doit(
9740 mut self,
9741 ) -> common::Result<(
9742 common::Response,
9743 GoogleCloudDatacatalogV1beta1ListEntryGroupsResponse,
9744 )> {
9745 use std::borrow::Cow;
9746 use std::io::{Read, Seek};
9747
9748 use common::{url::Params, ToParts};
9749 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9750
9751 let mut dd = common::DefaultDelegate;
9752 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9753 dlg.begin(common::MethodInfo {
9754 id: "datacatalog.projects.locations.entryGroups.list",
9755 http_method: hyper::Method::GET,
9756 });
9757
9758 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
9759 if self._additional_params.contains_key(field) {
9760 dlg.finished(false);
9761 return Err(common::Error::FieldClash(field));
9762 }
9763 }
9764
9765 let mut params = Params::with_capacity(5 + self._additional_params.len());
9766 params.push("parent", self._parent);
9767 if let Some(value) = self._page_token.as_ref() {
9768 params.push("pageToken", value);
9769 }
9770 if let Some(value) = self._page_size.as_ref() {
9771 params.push("pageSize", value.to_string());
9772 }
9773
9774 params.extend(self._additional_params.iter());
9775
9776 params.push("alt", "json");
9777 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/entryGroups";
9778 if self._scopes.is_empty() {
9779 self._scopes
9780 .insert(Scope::CloudPlatform.as_ref().to_string());
9781 }
9782
9783 #[allow(clippy::single_element_loop)]
9784 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9785 url = params.uri_replacement(url, param_name, find_this, true);
9786 }
9787 {
9788 let to_remove = ["parent"];
9789 params.remove_params(&to_remove);
9790 }
9791
9792 let url = params.parse_with_url(&url);
9793
9794 loop {
9795 let token = match self
9796 .hub
9797 .auth
9798 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9799 .await
9800 {
9801 Ok(token) => token,
9802 Err(e) => match dlg.token(e) {
9803 Ok(token) => token,
9804 Err(e) => {
9805 dlg.finished(false);
9806 return Err(common::Error::MissingToken(e));
9807 }
9808 },
9809 };
9810 let mut req_result = {
9811 let client = &self.hub.client;
9812 dlg.pre_request();
9813 let mut req_builder = hyper::Request::builder()
9814 .method(hyper::Method::GET)
9815 .uri(url.as_str())
9816 .header(USER_AGENT, self.hub._user_agent.clone());
9817
9818 if let Some(token) = token.as_ref() {
9819 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9820 }
9821
9822 let request = req_builder
9823 .header(CONTENT_LENGTH, 0_u64)
9824 .body(common::to_body::<String>(None));
9825
9826 client.request(request.unwrap()).await
9827 };
9828
9829 match req_result {
9830 Err(err) => {
9831 if let common::Retry::After(d) = dlg.http_error(&err) {
9832 sleep(d).await;
9833 continue;
9834 }
9835 dlg.finished(false);
9836 return Err(common::Error::HttpError(err));
9837 }
9838 Ok(res) => {
9839 let (mut parts, body) = res.into_parts();
9840 let mut body = common::Body::new(body);
9841 if !parts.status.is_success() {
9842 let bytes = common::to_bytes(body).await.unwrap_or_default();
9843 let error = serde_json::from_str(&common::to_string(&bytes));
9844 let response = common::to_response(parts, bytes.into());
9845
9846 if let common::Retry::After(d) =
9847 dlg.http_failure(&response, error.as_ref().ok())
9848 {
9849 sleep(d).await;
9850 continue;
9851 }
9852
9853 dlg.finished(false);
9854
9855 return Err(match error {
9856 Ok(value) => common::Error::BadRequest(value),
9857 _ => common::Error::Failure(response),
9858 });
9859 }
9860 let response = {
9861 let bytes = common::to_bytes(body).await.unwrap_or_default();
9862 let encoded = common::to_string(&bytes);
9863 match serde_json::from_str(&encoded) {
9864 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9865 Err(error) => {
9866 dlg.response_json_decode_error(&encoded, &error);
9867 return Err(common::Error::JsonDecodeError(
9868 encoded.to_string(),
9869 error,
9870 ));
9871 }
9872 }
9873 };
9874
9875 dlg.finished(true);
9876 return Ok(response);
9877 }
9878 }
9879 }
9880 }
9881
9882 /// Required. The name of the location that contains the entry groups, which can be provided in URL format. Example: * projects/{project_id}/locations/{location}
9883 ///
9884 /// Sets the *parent* path property to the given value.
9885 ///
9886 /// Even though the property as already been set when instantiating this call,
9887 /// we provide this method for API completeness.
9888 pub fn parent(mut self, new_value: &str) -> ProjectLocationEntryGroupListCall<'a, C> {
9889 self._parent = new_value.to_string();
9890 self
9891 }
9892 /// Optional. Token that specifies which page is requested. If empty, the first page is returned.
9893 ///
9894 /// Sets the *page token* query property to the given value.
9895 pub fn page_token(mut self, new_value: &str) -> ProjectLocationEntryGroupListCall<'a, C> {
9896 self._page_token = Some(new_value.to_string());
9897 self
9898 }
9899 /// Optional. The maximum number of items to return. Default is 10. Max limit is 1000. Throws an invalid argument for `page_size > 1000`.
9900 ///
9901 /// Sets the *page size* query property to the given value.
9902 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEntryGroupListCall<'a, C> {
9903 self._page_size = Some(new_value);
9904 self
9905 }
9906 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9907 /// while executing the actual API request.
9908 ///
9909 /// ````text
9910 /// It should be used to handle progress information, and to implement a certain level of resilience.
9911 /// ````
9912 ///
9913 /// Sets the *delegate* property to the given value.
9914 pub fn delegate(
9915 mut self,
9916 new_value: &'a mut dyn common::Delegate,
9917 ) -> ProjectLocationEntryGroupListCall<'a, C> {
9918 self._delegate = Some(new_value);
9919 self
9920 }
9921
9922 /// Set any additional parameter of the query string used in the request.
9923 /// It should be used to set parameters which are not yet available through their own
9924 /// setters.
9925 ///
9926 /// Please note that this method must not be used to set any of the known parameters
9927 /// which have their own setter method. If done anyway, the request will fail.
9928 ///
9929 /// # Additional Parameters
9930 ///
9931 /// * *$.xgafv* (query-string) - V1 error format.
9932 /// * *access_token* (query-string) - OAuth access token.
9933 /// * *alt* (query-string) - Data format for response.
9934 /// * *callback* (query-string) - JSONP
9935 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9936 /// * *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.
9937 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9938 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9939 /// * *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.
9940 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9941 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9942 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupListCall<'a, C>
9943 where
9944 T: AsRef<str>,
9945 {
9946 self._additional_params
9947 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9948 self
9949 }
9950
9951 /// Identifies the authorization scope for the method you are building.
9952 ///
9953 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9954 /// [`Scope::CloudPlatform`].
9955 ///
9956 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9957 /// tokens for more than one scope.
9958 ///
9959 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9960 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9961 /// sufficient, a read-write scope will do as well.
9962 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupListCall<'a, C>
9963 where
9964 St: AsRef<str>,
9965 {
9966 self._scopes.insert(String::from(scope.as_ref()));
9967 self
9968 }
9969 /// Identifies the authorization scope(s) for the method you are building.
9970 ///
9971 /// See [`Self::add_scope()`] for details.
9972 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupListCall<'a, C>
9973 where
9974 I: IntoIterator<Item = St>,
9975 St: AsRef<str>,
9976 {
9977 self._scopes
9978 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9979 self
9980 }
9981
9982 /// Removes all scopes, and no default scope will be used either.
9983 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9984 /// for details).
9985 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupListCall<'a, C> {
9986 self._scopes.clear();
9987 self
9988 }
9989}
9990
9991/// Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by the `entry_group.name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
9992///
9993/// A builder for the *locations.entryGroups.patch* method supported by a *project* resource.
9994/// It is not used directly, but through a [`ProjectMethods`] instance.
9995///
9996/// # Example
9997///
9998/// Instantiate a resource method builder
9999///
10000/// ```test_harness,no_run
10001/// # extern crate hyper;
10002/// # extern crate hyper_rustls;
10003/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
10004/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1EntryGroup;
10005/// # async fn dox() {
10006/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10007///
10008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10009/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10010/// # .with_native_roots()
10011/// # .unwrap()
10012/// # .https_only()
10013/// # .enable_http2()
10014/// # .build();
10015///
10016/// # let executor = hyper_util::rt::TokioExecutor::new();
10017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10018/// # secret,
10019/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10020/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10021/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10022/// # ),
10023/// # ).build().await.unwrap();
10024///
10025/// # let client = hyper_util::client::legacy::Client::builder(
10026/// # hyper_util::rt::TokioExecutor::new()
10027/// # )
10028/// # .build(
10029/// # hyper_rustls::HttpsConnectorBuilder::new()
10030/// # .with_native_roots()
10031/// # .unwrap()
10032/// # .https_or_http()
10033/// # .enable_http2()
10034/// # .build()
10035/// # );
10036/// # let mut hub = DataCatalog::new(client, auth);
10037/// // As the method needs a request, you would usually fill it with the desired information
10038/// // into the respective structure. Some of the parts shown here might not be applicable !
10039/// // Values shown here are possibly random and not representative !
10040/// let mut req = GoogleCloudDatacatalogV1beta1EntryGroup::default();
10041///
10042/// // You can configure optional parameters by calling the respective setters at will, and
10043/// // execute the final call using `doit()`.
10044/// // Values shown here are possibly random and not representative !
10045/// let result = hub.projects().locations_entry_groups_patch(req, "name")
10046/// .update_mask(FieldMask::new::<&str>(&[]))
10047/// .doit().await;
10048/// # }
10049/// ```
10050pub struct ProjectLocationEntryGroupPatchCall<'a, C>
10051where
10052 C: 'a,
10053{
10054 hub: &'a DataCatalog<C>,
10055 _request: GoogleCloudDatacatalogV1beta1EntryGroup,
10056 _name: String,
10057 _update_mask: Option<common::FieldMask>,
10058 _delegate: Option<&'a mut dyn common::Delegate>,
10059 _additional_params: HashMap<String, String>,
10060 _scopes: BTreeSet<String>,
10061}
10062
10063impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupPatchCall<'a, C> {}
10064
10065impl<'a, C> ProjectLocationEntryGroupPatchCall<'a, C>
10066where
10067 C: common::Connector,
10068{
10069 /// Perform the operation you have build so far.
10070 pub async fn doit(
10071 mut self,
10072 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1EntryGroup)> {
10073 use std::borrow::Cow;
10074 use std::io::{Read, Seek};
10075
10076 use common::{url::Params, ToParts};
10077 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10078
10079 let mut dd = common::DefaultDelegate;
10080 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10081 dlg.begin(common::MethodInfo {
10082 id: "datacatalog.projects.locations.entryGroups.patch",
10083 http_method: hyper::Method::PATCH,
10084 });
10085
10086 for &field in ["alt", "name", "updateMask"].iter() {
10087 if self._additional_params.contains_key(field) {
10088 dlg.finished(false);
10089 return Err(common::Error::FieldClash(field));
10090 }
10091 }
10092
10093 let mut params = Params::with_capacity(5 + self._additional_params.len());
10094 params.push("name", self._name);
10095 if let Some(value) = self._update_mask.as_ref() {
10096 params.push("updateMask", value.to_string());
10097 }
10098
10099 params.extend(self._additional_params.iter());
10100
10101 params.push("alt", "json");
10102 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10103 if self._scopes.is_empty() {
10104 self._scopes
10105 .insert(Scope::CloudPlatform.as_ref().to_string());
10106 }
10107
10108 #[allow(clippy::single_element_loop)]
10109 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10110 url = params.uri_replacement(url, param_name, find_this, true);
10111 }
10112 {
10113 let to_remove = ["name"];
10114 params.remove_params(&to_remove);
10115 }
10116
10117 let url = params.parse_with_url(&url);
10118
10119 let mut json_mime_type = mime::APPLICATION_JSON;
10120 let mut request_value_reader = {
10121 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10122 common::remove_json_null_values(&mut value);
10123 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10124 serde_json::to_writer(&mut dst, &value).unwrap();
10125 dst
10126 };
10127 let request_size = request_value_reader
10128 .seek(std::io::SeekFrom::End(0))
10129 .unwrap();
10130 request_value_reader
10131 .seek(std::io::SeekFrom::Start(0))
10132 .unwrap();
10133
10134 loop {
10135 let token = match self
10136 .hub
10137 .auth
10138 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10139 .await
10140 {
10141 Ok(token) => token,
10142 Err(e) => match dlg.token(e) {
10143 Ok(token) => token,
10144 Err(e) => {
10145 dlg.finished(false);
10146 return Err(common::Error::MissingToken(e));
10147 }
10148 },
10149 };
10150 request_value_reader
10151 .seek(std::io::SeekFrom::Start(0))
10152 .unwrap();
10153 let mut req_result = {
10154 let client = &self.hub.client;
10155 dlg.pre_request();
10156 let mut req_builder = hyper::Request::builder()
10157 .method(hyper::Method::PATCH)
10158 .uri(url.as_str())
10159 .header(USER_AGENT, self.hub._user_agent.clone());
10160
10161 if let Some(token) = token.as_ref() {
10162 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10163 }
10164
10165 let request = req_builder
10166 .header(CONTENT_TYPE, json_mime_type.to_string())
10167 .header(CONTENT_LENGTH, request_size as u64)
10168 .body(common::to_body(
10169 request_value_reader.get_ref().clone().into(),
10170 ));
10171
10172 client.request(request.unwrap()).await
10173 };
10174
10175 match req_result {
10176 Err(err) => {
10177 if let common::Retry::After(d) = dlg.http_error(&err) {
10178 sleep(d).await;
10179 continue;
10180 }
10181 dlg.finished(false);
10182 return Err(common::Error::HttpError(err));
10183 }
10184 Ok(res) => {
10185 let (mut parts, body) = res.into_parts();
10186 let mut body = common::Body::new(body);
10187 if !parts.status.is_success() {
10188 let bytes = common::to_bytes(body).await.unwrap_or_default();
10189 let error = serde_json::from_str(&common::to_string(&bytes));
10190 let response = common::to_response(parts, bytes.into());
10191
10192 if let common::Retry::After(d) =
10193 dlg.http_failure(&response, error.as_ref().ok())
10194 {
10195 sleep(d).await;
10196 continue;
10197 }
10198
10199 dlg.finished(false);
10200
10201 return Err(match error {
10202 Ok(value) => common::Error::BadRequest(value),
10203 _ => common::Error::Failure(response),
10204 });
10205 }
10206 let response = {
10207 let bytes = common::to_bytes(body).await.unwrap_or_default();
10208 let encoded = common::to_string(&bytes);
10209 match serde_json::from_str(&encoded) {
10210 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10211 Err(error) => {
10212 dlg.response_json_decode_error(&encoded, &error);
10213 return Err(common::Error::JsonDecodeError(
10214 encoded.to_string(),
10215 error,
10216 ));
10217 }
10218 }
10219 };
10220
10221 dlg.finished(true);
10222 return Ok(response);
10223 }
10224 }
10225 }
10226 }
10227
10228 ///
10229 /// Sets the *request* property to the given value.
10230 ///
10231 /// Even though the property as already been set when instantiating this call,
10232 /// we provide this method for API completeness.
10233 pub fn request(
10234 mut self,
10235 new_value: GoogleCloudDatacatalogV1beta1EntryGroup,
10236 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
10237 self._request = new_value;
10238 self
10239 }
10240 /// Identifier. The resource name of the entry group in URL format. Example: * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} Note that this EntryGroup and its child resources may not actually be stored in the location in this name.
10241 ///
10242 /// Sets the *name* path property to the given value.
10243 ///
10244 /// Even though the property as already been set when instantiating this call,
10245 /// we provide this method for API completeness.
10246 pub fn name(mut self, new_value: &str) -> ProjectLocationEntryGroupPatchCall<'a, C> {
10247 self._name = new_value.to_string();
10248 self
10249 }
10250 /// 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.
10251 ///
10252 /// Sets the *update mask* query property to the given value.
10253 pub fn update_mask(
10254 mut self,
10255 new_value: common::FieldMask,
10256 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
10257 self._update_mask = Some(new_value);
10258 self
10259 }
10260 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10261 /// while executing the actual API request.
10262 ///
10263 /// ````text
10264 /// It should be used to handle progress information, and to implement a certain level of resilience.
10265 /// ````
10266 ///
10267 /// Sets the *delegate* property to the given value.
10268 pub fn delegate(
10269 mut self,
10270 new_value: &'a mut dyn common::Delegate,
10271 ) -> ProjectLocationEntryGroupPatchCall<'a, C> {
10272 self._delegate = Some(new_value);
10273 self
10274 }
10275
10276 /// Set any additional parameter of the query string used in the request.
10277 /// It should be used to set parameters which are not yet available through their own
10278 /// setters.
10279 ///
10280 /// Please note that this method must not be used to set any of the known parameters
10281 /// which have their own setter method. If done anyway, the request will fail.
10282 ///
10283 /// # Additional Parameters
10284 ///
10285 /// * *$.xgafv* (query-string) - V1 error format.
10286 /// * *access_token* (query-string) - OAuth access token.
10287 /// * *alt* (query-string) - Data format for response.
10288 /// * *callback* (query-string) - JSONP
10289 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10290 /// * *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.
10291 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10292 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10293 /// * *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.
10294 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10295 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10296 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupPatchCall<'a, C>
10297 where
10298 T: AsRef<str>,
10299 {
10300 self._additional_params
10301 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10302 self
10303 }
10304
10305 /// Identifies the authorization scope for the method you are building.
10306 ///
10307 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10308 /// [`Scope::CloudPlatform`].
10309 ///
10310 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10311 /// tokens for more than one scope.
10312 ///
10313 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10314 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10315 /// sufficient, a read-write scope will do as well.
10316 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupPatchCall<'a, C>
10317 where
10318 St: AsRef<str>,
10319 {
10320 self._scopes.insert(String::from(scope.as_ref()));
10321 self
10322 }
10323 /// Identifies the authorization scope(s) for the method you are building.
10324 ///
10325 /// See [`Self::add_scope()`] for details.
10326 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEntryGroupPatchCall<'a, C>
10327 where
10328 I: IntoIterator<Item = St>,
10329 St: AsRef<str>,
10330 {
10331 self._scopes
10332 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10333 self
10334 }
10335
10336 /// Removes all scopes, and no default scope will be used either.
10337 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10338 /// for details).
10339 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupPatchCall<'a, C> {
10340 self._scopes.clear();
10341 self
10342 }
10343}
10344
10345/// Sets the access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entries.setIamPolicy` to set policies on entries. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
10346///
10347/// A builder for the *locations.entryGroups.setIamPolicy* method supported by a *project* resource.
10348/// It is not used directly, but through a [`ProjectMethods`] instance.
10349///
10350/// # Example
10351///
10352/// Instantiate a resource method builder
10353///
10354/// ```test_harness,no_run
10355/// # extern crate hyper;
10356/// # extern crate hyper_rustls;
10357/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
10358/// use datacatalog1_beta1::api::SetIamPolicyRequest;
10359/// # async fn dox() {
10360/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10361///
10362/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10363/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10364/// # .with_native_roots()
10365/// # .unwrap()
10366/// # .https_only()
10367/// # .enable_http2()
10368/// # .build();
10369///
10370/// # let executor = hyper_util::rt::TokioExecutor::new();
10371/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10372/// # secret,
10373/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10374/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10375/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10376/// # ),
10377/// # ).build().await.unwrap();
10378///
10379/// # let client = hyper_util::client::legacy::Client::builder(
10380/// # hyper_util::rt::TokioExecutor::new()
10381/// # )
10382/// # .build(
10383/// # hyper_rustls::HttpsConnectorBuilder::new()
10384/// # .with_native_roots()
10385/// # .unwrap()
10386/// # .https_or_http()
10387/// # .enable_http2()
10388/// # .build()
10389/// # );
10390/// # let mut hub = DataCatalog::new(client, auth);
10391/// // As the method needs a request, you would usually fill it with the desired information
10392/// // into the respective structure. Some of the parts shown here might not be applicable !
10393/// // Values shown here are possibly random and not representative !
10394/// let mut req = SetIamPolicyRequest::default();
10395///
10396/// // You can configure optional parameters by calling the respective setters at will, and
10397/// // execute the final call using `doit()`.
10398/// // Values shown here are possibly random and not representative !
10399/// let result = hub.projects().locations_entry_groups_set_iam_policy(req, "resource")
10400/// .doit().await;
10401/// # }
10402/// ```
10403pub struct ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
10404where
10405 C: 'a,
10406{
10407 hub: &'a DataCatalog<C>,
10408 _request: SetIamPolicyRequest,
10409 _resource: String,
10410 _delegate: Option<&'a mut dyn common::Delegate>,
10411 _additional_params: HashMap<String, String>,
10412 _scopes: BTreeSet<String>,
10413}
10414
10415impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {}
10416
10417impl<'a, C> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
10418where
10419 C: common::Connector,
10420{
10421 /// Perform the operation you have build so far.
10422 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10423 use std::borrow::Cow;
10424 use std::io::{Read, Seek};
10425
10426 use common::{url::Params, ToParts};
10427 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10428
10429 let mut dd = common::DefaultDelegate;
10430 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10431 dlg.begin(common::MethodInfo {
10432 id: "datacatalog.projects.locations.entryGroups.setIamPolicy",
10433 http_method: hyper::Method::POST,
10434 });
10435
10436 for &field in ["alt", "resource"].iter() {
10437 if self._additional_params.contains_key(field) {
10438 dlg.finished(false);
10439 return Err(common::Error::FieldClash(field));
10440 }
10441 }
10442
10443 let mut params = Params::with_capacity(4 + self._additional_params.len());
10444 params.push("resource", self._resource);
10445
10446 params.extend(self._additional_params.iter());
10447
10448 params.push("alt", "json");
10449 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
10450 if self._scopes.is_empty() {
10451 self._scopes
10452 .insert(Scope::CloudPlatform.as_ref().to_string());
10453 }
10454
10455 #[allow(clippy::single_element_loop)]
10456 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10457 url = params.uri_replacement(url, param_name, find_this, true);
10458 }
10459 {
10460 let to_remove = ["resource"];
10461 params.remove_params(&to_remove);
10462 }
10463
10464 let url = params.parse_with_url(&url);
10465
10466 let mut json_mime_type = mime::APPLICATION_JSON;
10467 let mut request_value_reader = {
10468 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10469 common::remove_json_null_values(&mut value);
10470 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10471 serde_json::to_writer(&mut dst, &value).unwrap();
10472 dst
10473 };
10474 let request_size = request_value_reader
10475 .seek(std::io::SeekFrom::End(0))
10476 .unwrap();
10477 request_value_reader
10478 .seek(std::io::SeekFrom::Start(0))
10479 .unwrap();
10480
10481 loop {
10482 let token = match self
10483 .hub
10484 .auth
10485 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10486 .await
10487 {
10488 Ok(token) => token,
10489 Err(e) => match dlg.token(e) {
10490 Ok(token) => token,
10491 Err(e) => {
10492 dlg.finished(false);
10493 return Err(common::Error::MissingToken(e));
10494 }
10495 },
10496 };
10497 request_value_reader
10498 .seek(std::io::SeekFrom::Start(0))
10499 .unwrap();
10500 let mut req_result = {
10501 let client = &self.hub.client;
10502 dlg.pre_request();
10503 let mut req_builder = hyper::Request::builder()
10504 .method(hyper::Method::POST)
10505 .uri(url.as_str())
10506 .header(USER_AGENT, self.hub._user_agent.clone());
10507
10508 if let Some(token) = token.as_ref() {
10509 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10510 }
10511
10512 let request = req_builder
10513 .header(CONTENT_TYPE, json_mime_type.to_string())
10514 .header(CONTENT_LENGTH, request_size as u64)
10515 .body(common::to_body(
10516 request_value_reader.get_ref().clone().into(),
10517 ));
10518
10519 client.request(request.unwrap()).await
10520 };
10521
10522 match req_result {
10523 Err(err) => {
10524 if let common::Retry::After(d) = dlg.http_error(&err) {
10525 sleep(d).await;
10526 continue;
10527 }
10528 dlg.finished(false);
10529 return Err(common::Error::HttpError(err));
10530 }
10531 Ok(res) => {
10532 let (mut parts, body) = res.into_parts();
10533 let mut body = common::Body::new(body);
10534 if !parts.status.is_success() {
10535 let bytes = common::to_bytes(body).await.unwrap_or_default();
10536 let error = serde_json::from_str(&common::to_string(&bytes));
10537 let response = common::to_response(parts, bytes.into());
10538
10539 if let common::Retry::After(d) =
10540 dlg.http_failure(&response, error.as_ref().ok())
10541 {
10542 sleep(d).await;
10543 continue;
10544 }
10545
10546 dlg.finished(false);
10547
10548 return Err(match error {
10549 Ok(value) => common::Error::BadRequest(value),
10550 _ => common::Error::Failure(response),
10551 });
10552 }
10553 let response = {
10554 let bytes = common::to_bytes(body).await.unwrap_or_default();
10555 let encoded = common::to_string(&bytes);
10556 match serde_json::from_str(&encoded) {
10557 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10558 Err(error) => {
10559 dlg.response_json_decode_error(&encoded, &error);
10560 return Err(common::Error::JsonDecodeError(
10561 encoded.to_string(),
10562 error,
10563 ));
10564 }
10565 }
10566 };
10567
10568 dlg.finished(true);
10569 return Ok(response);
10570 }
10571 }
10572 }
10573 }
10574
10575 ///
10576 /// Sets the *request* property to the given value.
10577 ///
10578 /// Even though the property as already been set when instantiating this call,
10579 /// we provide this method for API completeness.
10580 pub fn request(
10581 mut self,
10582 new_value: SetIamPolicyRequest,
10583 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
10584 self._request = new_value;
10585 self
10586 }
10587 /// 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.
10588 ///
10589 /// Sets the *resource* path property to the given value.
10590 ///
10591 /// Even though the property as already been set when instantiating this call,
10592 /// we provide this method for API completeness.
10593 pub fn resource(mut self, new_value: &str) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
10594 self._resource = new_value.to_string();
10595 self
10596 }
10597 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10598 /// while executing the actual API request.
10599 ///
10600 /// ````text
10601 /// It should be used to handle progress information, and to implement a certain level of resilience.
10602 /// ````
10603 ///
10604 /// Sets the *delegate* property to the given value.
10605 pub fn delegate(
10606 mut self,
10607 new_value: &'a mut dyn common::Delegate,
10608 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
10609 self._delegate = Some(new_value);
10610 self
10611 }
10612
10613 /// Set any additional parameter of the query string used in the request.
10614 /// It should be used to set parameters which are not yet available through their own
10615 /// setters.
10616 ///
10617 /// Please note that this method must not be used to set any of the known parameters
10618 /// which have their own setter method. If done anyway, the request will fail.
10619 ///
10620 /// # Additional Parameters
10621 ///
10622 /// * *$.xgafv* (query-string) - V1 error format.
10623 /// * *access_token* (query-string) - OAuth access token.
10624 /// * *alt* (query-string) - Data format for response.
10625 /// * *callback* (query-string) - JSONP
10626 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10627 /// * *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.
10628 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10629 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10630 /// * *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.
10631 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10632 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10633 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
10634 where
10635 T: AsRef<str>,
10636 {
10637 self._additional_params
10638 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10639 self
10640 }
10641
10642 /// Identifies the authorization scope for the method you are building.
10643 ///
10644 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10645 /// [`Scope::CloudPlatform`].
10646 ///
10647 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10648 /// tokens for more than one scope.
10649 ///
10650 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10651 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10652 /// sufficient, a read-write scope will do as well.
10653 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
10654 where
10655 St: AsRef<str>,
10656 {
10657 self._scopes.insert(String::from(scope.as_ref()));
10658 self
10659 }
10660 /// Identifies the authorization scope(s) for the method you are building.
10661 ///
10662 /// See [`Self::add_scope()`] for details.
10663 pub fn add_scopes<I, St>(
10664 mut self,
10665 scopes: I,
10666 ) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C>
10667 where
10668 I: IntoIterator<Item = St>,
10669 St: AsRef<str>,
10670 {
10671 self._scopes
10672 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10673 self
10674 }
10675
10676 /// Removes all scopes, and no default scope will be used either.
10677 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10678 /// for details).
10679 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupSetIamPolicyCall<'a, C> {
10680 self._scopes.clear();
10681 self
10682 }
10683}
10684
10685/// Returns the caller's permissions on a resource. If the resource does not exist, an empty set of permissions is returned (We don't return a `NOT_FOUND` error). Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. A caller is not required to have Google IAM permission to make this request.
10686///
10687/// A builder for the *locations.entryGroups.testIamPermissions* method supported by a *project* resource.
10688/// It is not used directly, but through a [`ProjectMethods`] instance.
10689///
10690/// # Example
10691///
10692/// Instantiate a resource method builder
10693///
10694/// ```test_harness,no_run
10695/// # extern crate hyper;
10696/// # extern crate hyper_rustls;
10697/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
10698/// use datacatalog1_beta1::api::TestIamPermissionsRequest;
10699/// # async fn dox() {
10700/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10701///
10702/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10703/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10704/// # .with_native_roots()
10705/// # .unwrap()
10706/// # .https_only()
10707/// # .enable_http2()
10708/// # .build();
10709///
10710/// # let executor = hyper_util::rt::TokioExecutor::new();
10711/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10712/// # secret,
10713/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10714/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10715/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10716/// # ),
10717/// # ).build().await.unwrap();
10718///
10719/// # let client = hyper_util::client::legacy::Client::builder(
10720/// # hyper_util::rt::TokioExecutor::new()
10721/// # )
10722/// # .build(
10723/// # hyper_rustls::HttpsConnectorBuilder::new()
10724/// # .with_native_roots()
10725/// # .unwrap()
10726/// # .https_or_http()
10727/// # .enable_http2()
10728/// # .build()
10729/// # );
10730/// # let mut hub = DataCatalog::new(client, auth);
10731/// // As the method needs a request, you would usually fill it with the desired information
10732/// // into the respective structure. Some of the parts shown here might not be applicable !
10733/// // Values shown here are possibly random and not representative !
10734/// let mut req = TestIamPermissionsRequest::default();
10735///
10736/// // You can configure optional parameters by calling the respective setters at will, and
10737/// // execute the final call using `doit()`.
10738/// // Values shown here are possibly random and not representative !
10739/// let result = hub.projects().locations_entry_groups_test_iam_permissions(req, "resource")
10740/// .doit().await;
10741/// # }
10742/// ```
10743pub struct ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
10744where
10745 C: 'a,
10746{
10747 hub: &'a DataCatalog<C>,
10748 _request: TestIamPermissionsRequest,
10749 _resource: String,
10750 _delegate: Option<&'a mut dyn common::Delegate>,
10751 _additional_params: HashMap<String, String>,
10752 _scopes: BTreeSet<String>,
10753}
10754
10755impl<'a, C> common::CallBuilder for ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {}
10756
10757impl<'a, C> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
10758where
10759 C: common::Connector,
10760{
10761 /// Perform the operation you have build so far.
10762 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
10763 use std::borrow::Cow;
10764 use std::io::{Read, Seek};
10765
10766 use common::{url::Params, ToParts};
10767 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10768
10769 let mut dd = common::DefaultDelegate;
10770 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10771 dlg.begin(common::MethodInfo {
10772 id: "datacatalog.projects.locations.entryGroups.testIamPermissions",
10773 http_method: hyper::Method::POST,
10774 });
10775
10776 for &field in ["alt", "resource"].iter() {
10777 if self._additional_params.contains_key(field) {
10778 dlg.finished(false);
10779 return Err(common::Error::FieldClash(field));
10780 }
10781 }
10782
10783 let mut params = Params::with_capacity(4 + self._additional_params.len());
10784 params.push("resource", self._resource);
10785
10786 params.extend(self._additional_params.iter());
10787
10788 params.push("alt", "json");
10789 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
10790 if self._scopes.is_empty() {
10791 self._scopes
10792 .insert(Scope::CloudPlatform.as_ref().to_string());
10793 }
10794
10795 #[allow(clippy::single_element_loop)]
10796 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10797 url = params.uri_replacement(url, param_name, find_this, true);
10798 }
10799 {
10800 let to_remove = ["resource"];
10801 params.remove_params(&to_remove);
10802 }
10803
10804 let url = params.parse_with_url(&url);
10805
10806 let mut json_mime_type = mime::APPLICATION_JSON;
10807 let mut request_value_reader = {
10808 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10809 common::remove_json_null_values(&mut value);
10810 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10811 serde_json::to_writer(&mut dst, &value).unwrap();
10812 dst
10813 };
10814 let request_size = request_value_reader
10815 .seek(std::io::SeekFrom::End(0))
10816 .unwrap();
10817 request_value_reader
10818 .seek(std::io::SeekFrom::Start(0))
10819 .unwrap();
10820
10821 loop {
10822 let token = match self
10823 .hub
10824 .auth
10825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10826 .await
10827 {
10828 Ok(token) => token,
10829 Err(e) => match dlg.token(e) {
10830 Ok(token) => token,
10831 Err(e) => {
10832 dlg.finished(false);
10833 return Err(common::Error::MissingToken(e));
10834 }
10835 },
10836 };
10837 request_value_reader
10838 .seek(std::io::SeekFrom::Start(0))
10839 .unwrap();
10840 let mut req_result = {
10841 let client = &self.hub.client;
10842 dlg.pre_request();
10843 let mut req_builder = hyper::Request::builder()
10844 .method(hyper::Method::POST)
10845 .uri(url.as_str())
10846 .header(USER_AGENT, self.hub._user_agent.clone());
10847
10848 if let Some(token) = token.as_ref() {
10849 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10850 }
10851
10852 let request = req_builder
10853 .header(CONTENT_TYPE, json_mime_type.to_string())
10854 .header(CONTENT_LENGTH, request_size as u64)
10855 .body(common::to_body(
10856 request_value_reader.get_ref().clone().into(),
10857 ));
10858
10859 client.request(request.unwrap()).await
10860 };
10861
10862 match req_result {
10863 Err(err) => {
10864 if let common::Retry::After(d) = dlg.http_error(&err) {
10865 sleep(d).await;
10866 continue;
10867 }
10868 dlg.finished(false);
10869 return Err(common::Error::HttpError(err));
10870 }
10871 Ok(res) => {
10872 let (mut parts, body) = res.into_parts();
10873 let mut body = common::Body::new(body);
10874 if !parts.status.is_success() {
10875 let bytes = common::to_bytes(body).await.unwrap_or_default();
10876 let error = serde_json::from_str(&common::to_string(&bytes));
10877 let response = common::to_response(parts, bytes.into());
10878
10879 if let common::Retry::After(d) =
10880 dlg.http_failure(&response, error.as_ref().ok())
10881 {
10882 sleep(d).await;
10883 continue;
10884 }
10885
10886 dlg.finished(false);
10887
10888 return Err(match error {
10889 Ok(value) => common::Error::BadRequest(value),
10890 _ => common::Error::Failure(response),
10891 });
10892 }
10893 let response = {
10894 let bytes = common::to_bytes(body).await.unwrap_or_default();
10895 let encoded = common::to_string(&bytes);
10896 match serde_json::from_str(&encoded) {
10897 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10898 Err(error) => {
10899 dlg.response_json_decode_error(&encoded, &error);
10900 return Err(common::Error::JsonDecodeError(
10901 encoded.to_string(),
10902 error,
10903 ));
10904 }
10905 }
10906 };
10907
10908 dlg.finished(true);
10909 return Ok(response);
10910 }
10911 }
10912 }
10913 }
10914
10915 ///
10916 /// Sets the *request* property to the given value.
10917 ///
10918 /// Even though the property as already been set when instantiating this call,
10919 /// we provide this method for API completeness.
10920 pub fn request(
10921 mut self,
10922 new_value: TestIamPermissionsRequest,
10923 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
10924 self._request = new_value;
10925 self
10926 }
10927 /// 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.
10928 ///
10929 /// Sets the *resource* path property to the given value.
10930 ///
10931 /// Even though the property as already been set when instantiating this call,
10932 /// we provide this method for API completeness.
10933 pub fn resource(
10934 mut self,
10935 new_value: &str,
10936 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
10937 self._resource = new_value.to_string();
10938 self
10939 }
10940 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10941 /// while executing the actual API request.
10942 ///
10943 /// ````text
10944 /// It should be used to handle progress information, and to implement a certain level of resilience.
10945 /// ````
10946 ///
10947 /// Sets the *delegate* property to the given value.
10948 pub fn delegate(
10949 mut self,
10950 new_value: &'a mut dyn common::Delegate,
10951 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
10952 self._delegate = Some(new_value);
10953 self
10954 }
10955
10956 /// Set any additional parameter of the query string used in the request.
10957 /// It should be used to set parameters which are not yet available through their own
10958 /// setters.
10959 ///
10960 /// Please note that this method must not be used to set any of the known parameters
10961 /// which have their own setter method. If done anyway, the request will fail.
10962 ///
10963 /// # Additional Parameters
10964 ///
10965 /// * *$.xgafv* (query-string) - V1 error format.
10966 /// * *access_token* (query-string) - OAuth access token.
10967 /// * *alt* (query-string) - Data format for response.
10968 /// * *callback* (query-string) - JSONP
10969 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10970 /// * *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.
10971 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10972 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10973 /// * *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.
10974 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10975 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10976 pub fn param<T>(
10977 mut self,
10978 name: T,
10979 value: T,
10980 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
10981 where
10982 T: AsRef<str>,
10983 {
10984 self._additional_params
10985 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10986 self
10987 }
10988
10989 /// Identifies the authorization scope for the method you are building.
10990 ///
10991 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10992 /// [`Scope::CloudPlatform`].
10993 ///
10994 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10995 /// tokens for more than one scope.
10996 ///
10997 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10998 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10999 /// sufficient, a read-write scope will do as well.
11000 pub fn add_scope<St>(
11001 mut self,
11002 scope: St,
11003 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
11004 where
11005 St: AsRef<str>,
11006 {
11007 self._scopes.insert(String::from(scope.as_ref()));
11008 self
11009 }
11010 /// Identifies the authorization scope(s) for the method you are building.
11011 ///
11012 /// See [`Self::add_scope()`] for details.
11013 pub fn add_scopes<I, St>(
11014 mut self,
11015 scopes: I,
11016 ) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C>
11017 where
11018 I: IntoIterator<Item = St>,
11019 St: AsRef<str>,
11020 {
11021 self._scopes
11022 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11023 self
11024 }
11025
11026 /// Removes all scopes, and no default scope will be used either.
11027 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11028 /// for details).
11029 pub fn clear_scopes(mut self) -> ProjectLocationEntryGroupTestIamPermissionCall<'a, C> {
11030 self._scopes.clear();
11031 self
11032 }
11033}
11034
11035/// Renames an enum value in a tag template. The enum values have to be unique within one enum field. Thus, an enum value cannot be renamed with a name used in any other enum value within the same enum field.
11036///
11037/// A builder for the *locations.tagTemplates.fields.enumValues.rename* method supported by a *project* resource.
11038/// It is not used directly, but through a [`ProjectMethods`] instance.
11039///
11040/// # Example
11041///
11042/// Instantiate a resource method builder
11043///
11044/// ```test_harness,no_run
11045/// # extern crate hyper;
11046/// # extern crate hyper_rustls;
11047/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
11048/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldEnumValueRequest;
11049/// # async fn dox() {
11050/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11051///
11052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11053/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11054/// # .with_native_roots()
11055/// # .unwrap()
11056/// # .https_only()
11057/// # .enable_http2()
11058/// # .build();
11059///
11060/// # let executor = hyper_util::rt::TokioExecutor::new();
11061/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11062/// # secret,
11063/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11064/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11065/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11066/// # ),
11067/// # ).build().await.unwrap();
11068///
11069/// # let client = hyper_util::client::legacy::Client::builder(
11070/// # hyper_util::rt::TokioExecutor::new()
11071/// # )
11072/// # .build(
11073/// # hyper_rustls::HttpsConnectorBuilder::new()
11074/// # .with_native_roots()
11075/// # .unwrap()
11076/// # .https_or_http()
11077/// # .enable_http2()
11078/// # .build()
11079/// # );
11080/// # let mut hub = DataCatalog::new(client, auth);
11081/// // As the method needs a request, you would usually fill it with the desired information
11082/// // into the respective structure. Some of the parts shown here might not be applicable !
11083/// // Values shown here are possibly random and not representative !
11084/// let mut req = GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldEnumValueRequest::default();
11085///
11086/// // You can configure optional parameters by calling the respective setters at will, and
11087/// // execute the final call using `doit()`.
11088/// // Values shown here are possibly random and not representative !
11089/// let result = hub.projects().locations_tag_templates_fields_enum_values_rename(req, "name")
11090/// .doit().await;
11091/// # }
11092/// ```
11093pub struct ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
11094where
11095 C: 'a,
11096{
11097 hub: &'a DataCatalog<C>,
11098 _request: GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldEnumValueRequest,
11099 _name: String,
11100 _delegate: Option<&'a mut dyn common::Delegate>,
11101 _additional_params: HashMap<String, String>,
11102 _scopes: BTreeSet<String>,
11103}
11104
11105impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {}
11106
11107impl<'a, C> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
11108where
11109 C: common::Connector,
11110{
11111 /// Perform the operation you have build so far.
11112 pub async fn doit(
11113 mut self,
11114 ) -> common::Result<(
11115 common::Response,
11116 GoogleCloudDatacatalogV1beta1TagTemplateField,
11117 )> {
11118 use std::borrow::Cow;
11119 use std::io::{Read, Seek};
11120
11121 use common::{url::Params, ToParts};
11122 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11123
11124 let mut dd = common::DefaultDelegate;
11125 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11126 dlg.begin(common::MethodInfo {
11127 id: "datacatalog.projects.locations.tagTemplates.fields.enumValues.rename",
11128 http_method: hyper::Method::POST,
11129 });
11130
11131 for &field in ["alt", "name"].iter() {
11132 if self._additional_params.contains_key(field) {
11133 dlg.finished(false);
11134 return Err(common::Error::FieldClash(field));
11135 }
11136 }
11137
11138 let mut params = Params::with_capacity(4 + self._additional_params.len());
11139 params.push("name", self._name);
11140
11141 params.extend(self._additional_params.iter());
11142
11143 params.push("alt", "json");
11144 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:rename";
11145 if self._scopes.is_empty() {
11146 self._scopes
11147 .insert(Scope::CloudPlatform.as_ref().to_string());
11148 }
11149
11150 #[allow(clippy::single_element_loop)]
11151 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11152 url = params.uri_replacement(url, param_name, find_this, true);
11153 }
11154 {
11155 let to_remove = ["name"];
11156 params.remove_params(&to_remove);
11157 }
11158
11159 let url = params.parse_with_url(&url);
11160
11161 let mut json_mime_type = mime::APPLICATION_JSON;
11162 let mut request_value_reader = {
11163 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11164 common::remove_json_null_values(&mut value);
11165 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11166 serde_json::to_writer(&mut dst, &value).unwrap();
11167 dst
11168 };
11169 let request_size = request_value_reader
11170 .seek(std::io::SeekFrom::End(0))
11171 .unwrap();
11172 request_value_reader
11173 .seek(std::io::SeekFrom::Start(0))
11174 .unwrap();
11175
11176 loop {
11177 let token = match self
11178 .hub
11179 .auth
11180 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11181 .await
11182 {
11183 Ok(token) => token,
11184 Err(e) => match dlg.token(e) {
11185 Ok(token) => token,
11186 Err(e) => {
11187 dlg.finished(false);
11188 return Err(common::Error::MissingToken(e));
11189 }
11190 },
11191 };
11192 request_value_reader
11193 .seek(std::io::SeekFrom::Start(0))
11194 .unwrap();
11195 let mut req_result = {
11196 let client = &self.hub.client;
11197 dlg.pre_request();
11198 let mut req_builder = hyper::Request::builder()
11199 .method(hyper::Method::POST)
11200 .uri(url.as_str())
11201 .header(USER_AGENT, self.hub._user_agent.clone());
11202
11203 if let Some(token) = token.as_ref() {
11204 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11205 }
11206
11207 let request = req_builder
11208 .header(CONTENT_TYPE, json_mime_type.to_string())
11209 .header(CONTENT_LENGTH, request_size as u64)
11210 .body(common::to_body(
11211 request_value_reader.get_ref().clone().into(),
11212 ));
11213
11214 client.request(request.unwrap()).await
11215 };
11216
11217 match req_result {
11218 Err(err) => {
11219 if let common::Retry::After(d) = dlg.http_error(&err) {
11220 sleep(d).await;
11221 continue;
11222 }
11223 dlg.finished(false);
11224 return Err(common::Error::HttpError(err));
11225 }
11226 Ok(res) => {
11227 let (mut parts, body) = res.into_parts();
11228 let mut body = common::Body::new(body);
11229 if !parts.status.is_success() {
11230 let bytes = common::to_bytes(body).await.unwrap_or_default();
11231 let error = serde_json::from_str(&common::to_string(&bytes));
11232 let response = common::to_response(parts, bytes.into());
11233
11234 if let common::Retry::After(d) =
11235 dlg.http_failure(&response, error.as_ref().ok())
11236 {
11237 sleep(d).await;
11238 continue;
11239 }
11240
11241 dlg.finished(false);
11242
11243 return Err(match error {
11244 Ok(value) => common::Error::BadRequest(value),
11245 _ => common::Error::Failure(response),
11246 });
11247 }
11248 let response = {
11249 let bytes = common::to_bytes(body).await.unwrap_or_default();
11250 let encoded = common::to_string(&bytes);
11251 match serde_json::from_str(&encoded) {
11252 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11253 Err(error) => {
11254 dlg.response_json_decode_error(&encoded, &error);
11255 return Err(common::Error::JsonDecodeError(
11256 encoded.to_string(),
11257 error,
11258 ));
11259 }
11260 }
11261 };
11262
11263 dlg.finished(true);
11264 return Ok(response);
11265 }
11266 }
11267 }
11268 }
11269
11270 ///
11271 /// Sets the *request* property to the given value.
11272 ///
11273 /// Even though the property as already been set when instantiating this call,
11274 /// we provide this method for API completeness.
11275 pub fn request(
11276 mut self,
11277 new_value: GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldEnumValueRequest,
11278 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
11279 self._request = new_value;
11280 self
11281 }
11282 /// Required. The name of the enum field value. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}/enumValues/{enum_value_display_name}
11283 ///
11284 /// Sets the *name* path property to the given value.
11285 ///
11286 /// Even though the property as already been set when instantiating this call,
11287 /// we provide this method for API completeness.
11288 pub fn name(
11289 mut self,
11290 new_value: &str,
11291 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
11292 self._name = new_value.to_string();
11293 self
11294 }
11295 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11296 /// while executing the actual API request.
11297 ///
11298 /// ````text
11299 /// It should be used to handle progress information, and to implement a certain level of resilience.
11300 /// ````
11301 ///
11302 /// Sets the *delegate* property to the given value.
11303 pub fn delegate(
11304 mut self,
11305 new_value: &'a mut dyn common::Delegate,
11306 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
11307 self._delegate = Some(new_value);
11308 self
11309 }
11310
11311 /// Set any additional parameter of the query string used in the request.
11312 /// It should be used to set parameters which are not yet available through their own
11313 /// setters.
11314 ///
11315 /// Please note that this method must not be used to set any of the known parameters
11316 /// which have their own setter method. If done anyway, the request will fail.
11317 ///
11318 /// # Additional Parameters
11319 ///
11320 /// * *$.xgafv* (query-string) - V1 error format.
11321 /// * *access_token* (query-string) - OAuth access token.
11322 /// * *alt* (query-string) - Data format for response.
11323 /// * *callback* (query-string) - JSONP
11324 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11325 /// * *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.
11326 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11327 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11328 /// * *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.
11329 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11330 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11331 pub fn param<T>(
11332 mut self,
11333 name: T,
11334 value: T,
11335 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
11336 where
11337 T: AsRef<str>,
11338 {
11339 self._additional_params
11340 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11341 self
11342 }
11343
11344 /// Identifies the authorization scope for the method you are building.
11345 ///
11346 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11347 /// [`Scope::CloudPlatform`].
11348 ///
11349 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11350 /// tokens for more than one scope.
11351 ///
11352 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11353 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11354 /// sufficient, a read-write scope will do as well.
11355 pub fn add_scope<St>(
11356 mut self,
11357 scope: St,
11358 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
11359 where
11360 St: AsRef<str>,
11361 {
11362 self._scopes.insert(String::from(scope.as_ref()));
11363 self
11364 }
11365 /// Identifies the authorization scope(s) for the method you are building.
11366 ///
11367 /// See [`Self::add_scope()`] for details.
11368 pub fn add_scopes<I, St>(
11369 mut self,
11370 scopes: I,
11371 ) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C>
11372 where
11373 I: IntoIterator<Item = St>,
11374 St: AsRef<str>,
11375 {
11376 self._scopes
11377 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11378 self
11379 }
11380
11381 /// Removes all scopes, and no default scope will be used either.
11382 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11383 /// for details).
11384 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldEnumValueRenameCall<'a, C> {
11385 self._scopes.clear();
11386 self
11387 }
11388}
11389
11390/// Creates a field in a tag template. The user should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
11391///
11392/// A builder for the *locations.tagTemplates.fields.create* method supported by a *project* resource.
11393/// It is not used directly, but through a [`ProjectMethods`] instance.
11394///
11395/// # Example
11396///
11397/// Instantiate a resource method builder
11398///
11399/// ```test_harness,no_run
11400/// # extern crate hyper;
11401/// # extern crate hyper_rustls;
11402/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
11403/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1TagTemplateField;
11404/// # async fn dox() {
11405/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11406///
11407/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11408/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11409/// # .with_native_roots()
11410/// # .unwrap()
11411/// # .https_only()
11412/// # .enable_http2()
11413/// # .build();
11414///
11415/// # let executor = hyper_util::rt::TokioExecutor::new();
11416/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11417/// # secret,
11418/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11419/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11420/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11421/// # ),
11422/// # ).build().await.unwrap();
11423///
11424/// # let client = hyper_util::client::legacy::Client::builder(
11425/// # hyper_util::rt::TokioExecutor::new()
11426/// # )
11427/// # .build(
11428/// # hyper_rustls::HttpsConnectorBuilder::new()
11429/// # .with_native_roots()
11430/// # .unwrap()
11431/// # .https_or_http()
11432/// # .enable_http2()
11433/// # .build()
11434/// # );
11435/// # let mut hub = DataCatalog::new(client, auth);
11436/// // As the method needs a request, you would usually fill it with the desired information
11437/// // into the respective structure. Some of the parts shown here might not be applicable !
11438/// // Values shown here are possibly random and not representative !
11439/// let mut req = GoogleCloudDatacatalogV1beta1TagTemplateField::default();
11440///
11441/// // You can configure optional parameters by calling the respective setters at will, and
11442/// // execute the final call using `doit()`.
11443/// // Values shown here are possibly random and not representative !
11444/// let result = hub.projects().locations_tag_templates_fields_create(req, "parent")
11445/// .tag_template_field_id("no")
11446/// .doit().await;
11447/// # }
11448/// ```
11449pub struct ProjectLocationTagTemplateFieldCreateCall<'a, C>
11450where
11451 C: 'a,
11452{
11453 hub: &'a DataCatalog<C>,
11454 _request: GoogleCloudDatacatalogV1beta1TagTemplateField,
11455 _parent: String,
11456 _tag_template_field_id: Option<String>,
11457 _delegate: Option<&'a mut dyn common::Delegate>,
11458 _additional_params: HashMap<String, String>,
11459 _scopes: BTreeSet<String>,
11460}
11461
11462impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldCreateCall<'a, C> {}
11463
11464impl<'a, C> ProjectLocationTagTemplateFieldCreateCall<'a, C>
11465where
11466 C: common::Connector,
11467{
11468 /// Perform the operation you have build so far.
11469 pub async fn doit(
11470 mut self,
11471 ) -> common::Result<(
11472 common::Response,
11473 GoogleCloudDatacatalogV1beta1TagTemplateField,
11474 )> {
11475 use std::borrow::Cow;
11476 use std::io::{Read, Seek};
11477
11478 use common::{url::Params, ToParts};
11479 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11480
11481 let mut dd = common::DefaultDelegate;
11482 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11483 dlg.begin(common::MethodInfo {
11484 id: "datacatalog.projects.locations.tagTemplates.fields.create",
11485 http_method: hyper::Method::POST,
11486 });
11487
11488 for &field in ["alt", "parent", "tagTemplateFieldId"].iter() {
11489 if self._additional_params.contains_key(field) {
11490 dlg.finished(false);
11491 return Err(common::Error::FieldClash(field));
11492 }
11493 }
11494
11495 let mut params = Params::with_capacity(5 + self._additional_params.len());
11496 params.push("parent", self._parent);
11497 if let Some(value) = self._tag_template_field_id.as_ref() {
11498 params.push("tagTemplateFieldId", value);
11499 }
11500
11501 params.extend(self._additional_params.iter());
11502
11503 params.push("alt", "json");
11504 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fields";
11505 if self._scopes.is_empty() {
11506 self._scopes
11507 .insert(Scope::CloudPlatform.as_ref().to_string());
11508 }
11509
11510 #[allow(clippy::single_element_loop)]
11511 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11512 url = params.uri_replacement(url, param_name, find_this, true);
11513 }
11514 {
11515 let to_remove = ["parent"];
11516 params.remove_params(&to_remove);
11517 }
11518
11519 let url = params.parse_with_url(&url);
11520
11521 let mut json_mime_type = mime::APPLICATION_JSON;
11522 let mut request_value_reader = {
11523 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11524 common::remove_json_null_values(&mut value);
11525 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11526 serde_json::to_writer(&mut dst, &value).unwrap();
11527 dst
11528 };
11529 let request_size = request_value_reader
11530 .seek(std::io::SeekFrom::End(0))
11531 .unwrap();
11532 request_value_reader
11533 .seek(std::io::SeekFrom::Start(0))
11534 .unwrap();
11535
11536 loop {
11537 let token = match self
11538 .hub
11539 .auth
11540 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11541 .await
11542 {
11543 Ok(token) => token,
11544 Err(e) => match dlg.token(e) {
11545 Ok(token) => token,
11546 Err(e) => {
11547 dlg.finished(false);
11548 return Err(common::Error::MissingToken(e));
11549 }
11550 },
11551 };
11552 request_value_reader
11553 .seek(std::io::SeekFrom::Start(0))
11554 .unwrap();
11555 let mut req_result = {
11556 let client = &self.hub.client;
11557 dlg.pre_request();
11558 let mut req_builder = hyper::Request::builder()
11559 .method(hyper::Method::POST)
11560 .uri(url.as_str())
11561 .header(USER_AGENT, self.hub._user_agent.clone());
11562
11563 if let Some(token) = token.as_ref() {
11564 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11565 }
11566
11567 let request = req_builder
11568 .header(CONTENT_TYPE, json_mime_type.to_string())
11569 .header(CONTENT_LENGTH, request_size as u64)
11570 .body(common::to_body(
11571 request_value_reader.get_ref().clone().into(),
11572 ));
11573
11574 client.request(request.unwrap()).await
11575 };
11576
11577 match req_result {
11578 Err(err) => {
11579 if let common::Retry::After(d) = dlg.http_error(&err) {
11580 sleep(d).await;
11581 continue;
11582 }
11583 dlg.finished(false);
11584 return Err(common::Error::HttpError(err));
11585 }
11586 Ok(res) => {
11587 let (mut parts, body) = res.into_parts();
11588 let mut body = common::Body::new(body);
11589 if !parts.status.is_success() {
11590 let bytes = common::to_bytes(body).await.unwrap_or_default();
11591 let error = serde_json::from_str(&common::to_string(&bytes));
11592 let response = common::to_response(parts, bytes.into());
11593
11594 if let common::Retry::After(d) =
11595 dlg.http_failure(&response, error.as_ref().ok())
11596 {
11597 sleep(d).await;
11598 continue;
11599 }
11600
11601 dlg.finished(false);
11602
11603 return Err(match error {
11604 Ok(value) => common::Error::BadRequest(value),
11605 _ => common::Error::Failure(response),
11606 });
11607 }
11608 let response = {
11609 let bytes = common::to_bytes(body).await.unwrap_or_default();
11610 let encoded = common::to_string(&bytes);
11611 match serde_json::from_str(&encoded) {
11612 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11613 Err(error) => {
11614 dlg.response_json_decode_error(&encoded, &error);
11615 return Err(common::Error::JsonDecodeError(
11616 encoded.to_string(),
11617 error,
11618 ));
11619 }
11620 }
11621 };
11622
11623 dlg.finished(true);
11624 return Ok(response);
11625 }
11626 }
11627 }
11628 }
11629
11630 ///
11631 /// Sets the *request* property to the given value.
11632 ///
11633 /// Even though the property as already been set when instantiating this call,
11634 /// we provide this method for API completeness.
11635 pub fn request(
11636 mut self,
11637 new_value: GoogleCloudDatacatalogV1beta1TagTemplateField,
11638 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
11639 self._request = new_value;
11640 self
11641 }
11642 /// Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions). Example: * projects/{project_id}/locations/us-central1/tagTemplates/{tag_template_id}
11643 ///
11644 /// Sets the *parent* path property to the given value.
11645 ///
11646 /// Even though the property as already been set when instantiating this call,
11647 /// we provide this method for API completeness.
11648 pub fn parent(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
11649 self._parent = new_value.to_string();
11650 self
11651 }
11652 /// Required. The ID of the tag template field to create. 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.
11653 ///
11654 /// Sets the *tag template field id* query property to the given value.
11655 pub fn tag_template_field_id(
11656 mut self,
11657 new_value: &str,
11658 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
11659 self._tag_template_field_id = Some(new_value.to_string());
11660 self
11661 }
11662 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11663 /// while executing the actual API request.
11664 ///
11665 /// ````text
11666 /// It should be used to handle progress information, and to implement a certain level of resilience.
11667 /// ````
11668 ///
11669 /// Sets the *delegate* property to the given value.
11670 pub fn delegate(
11671 mut self,
11672 new_value: &'a mut dyn common::Delegate,
11673 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
11674 self._delegate = Some(new_value);
11675 self
11676 }
11677
11678 /// Set any additional parameter of the query string used in the request.
11679 /// It should be used to set parameters which are not yet available through their own
11680 /// setters.
11681 ///
11682 /// Please note that this method must not be used to set any of the known parameters
11683 /// which have their own setter method. If done anyway, the request will fail.
11684 ///
11685 /// # Additional Parameters
11686 ///
11687 /// * *$.xgafv* (query-string) - V1 error format.
11688 /// * *access_token* (query-string) - OAuth access token.
11689 /// * *alt* (query-string) - Data format for response.
11690 /// * *callback* (query-string) - JSONP
11691 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11692 /// * *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.
11693 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11694 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11695 /// * *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.
11696 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11697 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11698 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldCreateCall<'a, C>
11699 where
11700 T: AsRef<str>,
11701 {
11702 self._additional_params
11703 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11704 self
11705 }
11706
11707 /// Identifies the authorization scope for the method you are building.
11708 ///
11709 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11710 /// [`Scope::CloudPlatform`].
11711 ///
11712 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11713 /// tokens for more than one scope.
11714 ///
11715 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11716 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11717 /// sufficient, a read-write scope will do as well.
11718 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldCreateCall<'a, C>
11719 where
11720 St: AsRef<str>,
11721 {
11722 self._scopes.insert(String::from(scope.as_ref()));
11723 self
11724 }
11725 /// Identifies the authorization scope(s) for the method you are building.
11726 ///
11727 /// See [`Self::add_scope()`] for details.
11728 pub fn add_scopes<I, St>(
11729 mut self,
11730 scopes: I,
11731 ) -> ProjectLocationTagTemplateFieldCreateCall<'a, C>
11732 where
11733 I: IntoIterator<Item = St>,
11734 St: AsRef<str>,
11735 {
11736 self._scopes
11737 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11738 self
11739 }
11740
11741 /// Removes all scopes, and no default scope will be used either.
11742 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11743 /// for details).
11744 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldCreateCall<'a, C> {
11745 self._scopes.clear();
11746 self
11747 }
11748}
11749
11750/// Deletes a field in a tag template and all uses of that field. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
11751///
11752/// A builder for the *locations.tagTemplates.fields.delete* method supported by a *project* resource.
11753/// It is not used directly, but through a [`ProjectMethods`] instance.
11754///
11755/// # Example
11756///
11757/// Instantiate a resource method builder
11758///
11759/// ```test_harness,no_run
11760/// # extern crate hyper;
11761/// # extern crate hyper_rustls;
11762/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
11763/// # async fn dox() {
11764/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11765///
11766/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11767/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11768/// # .with_native_roots()
11769/// # .unwrap()
11770/// # .https_only()
11771/// # .enable_http2()
11772/// # .build();
11773///
11774/// # let executor = hyper_util::rt::TokioExecutor::new();
11775/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11776/// # secret,
11777/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11778/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11779/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11780/// # ),
11781/// # ).build().await.unwrap();
11782///
11783/// # let client = hyper_util::client::legacy::Client::builder(
11784/// # hyper_util::rt::TokioExecutor::new()
11785/// # )
11786/// # .build(
11787/// # hyper_rustls::HttpsConnectorBuilder::new()
11788/// # .with_native_roots()
11789/// # .unwrap()
11790/// # .https_or_http()
11791/// # .enable_http2()
11792/// # .build()
11793/// # );
11794/// # let mut hub = DataCatalog::new(client, auth);
11795/// // You can configure optional parameters by calling the respective setters at will, and
11796/// // execute the final call using `doit()`.
11797/// // Values shown here are possibly random and not representative !
11798/// let result = hub.projects().locations_tag_templates_fields_delete("name")
11799/// .force(true)
11800/// .doit().await;
11801/// # }
11802/// ```
11803pub struct ProjectLocationTagTemplateFieldDeleteCall<'a, C>
11804where
11805 C: 'a,
11806{
11807 hub: &'a DataCatalog<C>,
11808 _name: String,
11809 _force: Option<bool>,
11810 _delegate: Option<&'a mut dyn common::Delegate>,
11811 _additional_params: HashMap<String, String>,
11812 _scopes: BTreeSet<String>,
11813}
11814
11815impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldDeleteCall<'a, C> {}
11816
11817impl<'a, C> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
11818where
11819 C: common::Connector,
11820{
11821 /// Perform the operation you have build so far.
11822 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
11823 use std::borrow::Cow;
11824 use std::io::{Read, Seek};
11825
11826 use common::{url::Params, ToParts};
11827 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11828
11829 let mut dd = common::DefaultDelegate;
11830 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11831 dlg.begin(common::MethodInfo {
11832 id: "datacatalog.projects.locations.tagTemplates.fields.delete",
11833 http_method: hyper::Method::DELETE,
11834 });
11835
11836 for &field in ["alt", "name", "force"].iter() {
11837 if self._additional_params.contains_key(field) {
11838 dlg.finished(false);
11839 return Err(common::Error::FieldClash(field));
11840 }
11841 }
11842
11843 let mut params = Params::with_capacity(4 + self._additional_params.len());
11844 params.push("name", self._name);
11845 if let Some(value) = self._force.as_ref() {
11846 params.push("force", value.to_string());
11847 }
11848
11849 params.extend(self._additional_params.iter());
11850
11851 params.push("alt", "json");
11852 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
11853 if self._scopes.is_empty() {
11854 self._scopes
11855 .insert(Scope::CloudPlatform.as_ref().to_string());
11856 }
11857
11858 #[allow(clippy::single_element_loop)]
11859 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11860 url = params.uri_replacement(url, param_name, find_this, true);
11861 }
11862 {
11863 let to_remove = ["name"];
11864 params.remove_params(&to_remove);
11865 }
11866
11867 let url = params.parse_with_url(&url);
11868
11869 loop {
11870 let token = match self
11871 .hub
11872 .auth
11873 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11874 .await
11875 {
11876 Ok(token) => token,
11877 Err(e) => match dlg.token(e) {
11878 Ok(token) => token,
11879 Err(e) => {
11880 dlg.finished(false);
11881 return Err(common::Error::MissingToken(e));
11882 }
11883 },
11884 };
11885 let mut req_result = {
11886 let client = &self.hub.client;
11887 dlg.pre_request();
11888 let mut req_builder = hyper::Request::builder()
11889 .method(hyper::Method::DELETE)
11890 .uri(url.as_str())
11891 .header(USER_AGENT, self.hub._user_agent.clone());
11892
11893 if let Some(token) = token.as_ref() {
11894 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11895 }
11896
11897 let request = req_builder
11898 .header(CONTENT_LENGTH, 0_u64)
11899 .body(common::to_body::<String>(None));
11900
11901 client.request(request.unwrap()).await
11902 };
11903
11904 match req_result {
11905 Err(err) => {
11906 if let common::Retry::After(d) = dlg.http_error(&err) {
11907 sleep(d).await;
11908 continue;
11909 }
11910 dlg.finished(false);
11911 return Err(common::Error::HttpError(err));
11912 }
11913 Ok(res) => {
11914 let (mut parts, body) = res.into_parts();
11915 let mut body = common::Body::new(body);
11916 if !parts.status.is_success() {
11917 let bytes = common::to_bytes(body).await.unwrap_or_default();
11918 let error = serde_json::from_str(&common::to_string(&bytes));
11919 let response = common::to_response(parts, bytes.into());
11920
11921 if let common::Retry::After(d) =
11922 dlg.http_failure(&response, error.as_ref().ok())
11923 {
11924 sleep(d).await;
11925 continue;
11926 }
11927
11928 dlg.finished(false);
11929
11930 return Err(match error {
11931 Ok(value) => common::Error::BadRequest(value),
11932 _ => common::Error::Failure(response),
11933 });
11934 }
11935 let response = {
11936 let bytes = common::to_bytes(body).await.unwrap_or_default();
11937 let encoded = common::to_string(&bytes);
11938 match serde_json::from_str(&encoded) {
11939 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11940 Err(error) => {
11941 dlg.response_json_decode_error(&encoded, &error);
11942 return Err(common::Error::JsonDecodeError(
11943 encoded.to_string(),
11944 error,
11945 ));
11946 }
11947 }
11948 };
11949
11950 dlg.finished(true);
11951 return Ok(response);
11952 }
11953 }
11954 }
11955 }
11956
11957 /// Required. The name of the tag template field to delete. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
11958 ///
11959 /// Sets the *name* path property to the given value.
11960 ///
11961 /// Even though the property as already been set when instantiating this call,
11962 /// we provide this method for API completeness.
11963 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
11964 self._name = new_value.to_string();
11965 self
11966 }
11967 /// Required. Currently, this field must always be set to `true`. This confirms the deletion of this field from any tags using this field. `force = false` will be supported in the future.
11968 ///
11969 /// Sets the *force* query property to the given value.
11970 pub fn force(mut self, new_value: bool) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
11971 self._force = Some(new_value);
11972 self
11973 }
11974 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11975 /// while executing the actual API request.
11976 ///
11977 /// ````text
11978 /// It should be used to handle progress information, and to implement a certain level of resilience.
11979 /// ````
11980 ///
11981 /// Sets the *delegate* property to the given value.
11982 pub fn delegate(
11983 mut self,
11984 new_value: &'a mut dyn common::Delegate,
11985 ) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
11986 self._delegate = Some(new_value);
11987 self
11988 }
11989
11990 /// Set any additional parameter of the query string used in the request.
11991 /// It should be used to set parameters which are not yet available through their own
11992 /// setters.
11993 ///
11994 /// Please note that this method must not be used to set any of the known parameters
11995 /// which have their own setter method. If done anyway, the request will fail.
11996 ///
11997 /// # Additional Parameters
11998 ///
11999 /// * *$.xgafv* (query-string) - V1 error format.
12000 /// * *access_token* (query-string) - OAuth access token.
12001 /// * *alt* (query-string) - Data format for response.
12002 /// * *callback* (query-string) - JSONP
12003 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12004 /// * *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.
12005 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12006 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12007 /// * *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.
12008 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12009 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12010 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
12011 where
12012 T: AsRef<str>,
12013 {
12014 self._additional_params
12015 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12016 self
12017 }
12018
12019 /// Identifies the authorization scope for the method you are building.
12020 ///
12021 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12022 /// [`Scope::CloudPlatform`].
12023 ///
12024 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12025 /// tokens for more than one scope.
12026 ///
12027 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12028 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12029 /// sufficient, a read-write scope will do as well.
12030 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
12031 where
12032 St: AsRef<str>,
12033 {
12034 self._scopes.insert(String::from(scope.as_ref()));
12035 self
12036 }
12037 /// Identifies the authorization scope(s) for the method you are building.
12038 ///
12039 /// See [`Self::add_scope()`] for details.
12040 pub fn add_scopes<I, St>(
12041 mut self,
12042 scopes: I,
12043 ) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C>
12044 where
12045 I: IntoIterator<Item = St>,
12046 St: AsRef<str>,
12047 {
12048 self._scopes
12049 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12050 self
12051 }
12052
12053 /// Removes all scopes, and no default scope will be used either.
12054 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12055 /// for details).
12056 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldDeleteCall<'a, C> {
12057 self._scopes.clear();
12058 self
12059 }
12060}
12061
12062/// Updates a field in a tag template. This method cannot be used to update the field type. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
12063///
12064/// A builder for the *locations.tagTemplates.fields.patch* method supported by a *project* resource.
12065/// It is not used directly, but through a [`ProjectMethods`] instance.
12066///
12067/// # Example
12068///
12069/// Instantiate a resource method builder
12070///
12071/// ```test_harness,no_run
12072/// # extern crate hyper;
12073/// # extern crate hyper_rustls;
12074/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
12075/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1TagTemplateField;
12076/// # async fn dox() {
12077/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12078///
12079/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12080/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12081/// # .with_native_roots()
12082/// # .unwrap()
12083/// # .https_only()
12084/// # .enable_http2()
12085/// # .build();
12086///
12087/// # let executor = hyper_util::rt::TokioExecutor::new();
12088/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12089/// # secret,
12090/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12091/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12092/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12093/// # ),
12094/// # ).build().await.unwrap();
12095///
12096/// # let client = hyper_util::client::legacy::Client::builder(
12097/// # hyper_util::rt::TokioExecutor::new()
12098/// # )
12099/// # .build(
12100/// # hyper_rustls::HttpsConnectorBuilder::new()
12101/// # .with_native_roots()
12102/// # .unwrap()
12103/// # .https_or_http()
12104/// # .enable_http2()
12105/// # .build()
12106/// # );
12107/// # let mut hub = DataCatalog::new(client, auth);
12108/// // As the method needs a request, you would usually fill it with the desired information
12109/// // into the respective structure. Some of the parts shown here might not be applicable !
12110/// // Values shown here are possibly random and not representative !
12111/// let mut req = GoogleCloudDatacatalogV1beta1TagTemplateField::default();
12112///
12113/// // You can configure optional parameters by calling the respective setters at will, and
12114/// // execute the final call using `doit()`.
12115/// // Values shown here are possibly random and not representative !
12116/// let result = hub.projects().locations_tag_templates_fields_patch(req, "name")
12117/// .update_mask(FieldMask::new::<&str>(&[]))
12118/// .doit().await;
12119/// # }
12120/// ```
12121pub struct ProjectLocationTagTemplateFieldPatchCall<'a, C>
12122where
12123 C: 'a,
12124{
12125 hub: &'a DataCatalog<C>,
12126 _request: GoogleCloudDatacatalogV1beta1TagTemplateField,
12127 _name: String,
12128 _update_mask: Option<common::FieldMask>,
12129 _delegate: Option<&'a mut dyn common::Delegate>,
12130 _additional_params: HashMap<String, String>,
12131 _scopes: BTreeSet<String>,
12132}
12133
12134impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldPatchCall<'a, C> {}
12135
12136impl<'a, C> ProjectLocationTagTemplateFieldPatchCall<'a, C>
12137where
12138 C: common::Connector,
12139{
12140 /// Perform the operation you have build so far.
12141 pub async fn doit(
12142 mut self,
12143 ) -> common::Result<(
12144 common::Response,
12145 GoogleCloudDatacatalogV1beta1TagTemplateField,
12146 )> {
12147 use std::borrow::Cow;
12148 use std::io::{Read, Seek};
12149
12150 use common::{url::Params, ToParts};
12151 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12152
12153 let mut dd = common::DefaultDelegate;
12154 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12155 dlg.begin(common::MethodInfo {
12156 id: "datacatalog.projects.locations.tagTemplates.fields.patch",
12157 http_method: hyper::Method::PATCH,
12158 });
12159
12160 for &field in ["alt", "name", "updateMask"].iter() {
12161 if self._additional_params.contains_key(field) {
12162 dlg.finished(false);
12163 return Err(common::Error::FieldClash(field));
12164 }
12165 }
12166
12167 let mut params = Params::with_capacity(5 + self._additional_params.len());
12168 params.push("name", self._name);
12169 if let Some(value) = self._update_mask.as_ref() {
12170 params.push("updateMask", value.to_string());
12171 }
12172
12173 params.extend(self._additional_params.iter());
12174
12175 params.push("alt", "json");
12176 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
12177 if self._scopes.is_empty() {
12178 self._scopes
12179 .insert(Scope::CloudPlatform.as_ref().to_string());
12180 }
12181
12182 #[allow(clippy::single_element_loop)]
12183 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12184 url = params.uri_replacement(url, param_name, find_this, true);
12185 }
12186 {
12187 let to_remove = ["name"];
12188 params.remove_params(&to_remove);
12189 }
12190
12191 let url = params.parse_with_url(&url);
12192
12193 let mut json_mime_type = mime::APPLICATION_JSON;
12194 let mut request_value_reader = {
12195 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12196 common::remove_json_null_values(&mut value);
12197 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12198 serde_json::to_writer(&mut dst, &value).unwrap();
12199 dst
12200 };
12201 let request_size = request_value_reader
12202 .seek(std::io::SeekFrom::End(0))
12203 .unwrap();
12204 request_value_reader
12205 .seek(std::io::SeekFrom::Start(0))
12206 .unwrap();
12207
12208 loop {
12209 let token = match self
12210 .hub
12211 .auth
12212 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12213 .await
12214 {
12215 Ok(token) => token,
12216 Err(e) => match dlg.token(e) {
12217 Ok(token) => token,
12218 Err(e) => {
12219 dlg.finished(false);
12220 return Err(common::Error::MissingToken(e));
12221 }
12222 },
12223 };
12224 request_value_reader
12225 .seek(std::io::SeekFrom::Start(0))
12226 .unwrap();
12227 let mut req_result = {
12228 let client = &self.hub.client;
12229 dlg.pre_request();
12230 let mut req_builder = hyper::Request::builder()
12231 .method(hyper::Method::PATCH)
12232 .uri(url.as_str())
12233 .header(USER_AGENT, self.hub._user_agent.clone());
12234
12235 if let Some(token) = token.as_ref() {
12236 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12237 }
12238
12239 let request = req_builder
12240 .header(CONTENT_TYPE, json_mime_type.to_string())
12241 .header(CONTENT_LENGTH, request_size as u64)
12242 .body(common::to_body(
12243 request_value_reader.get_ref().clone().into(),
12244 ));
12245
12246 client.request(request.unwrap()).await
12247 };
12248
12249 match req_result {
12250 Err(err) => {
12251 if let common::Retry::After(d) = dlg.http_error(&err) {
12252 sleep(d).await;
12253 continue;
12254 }
12255 dlg.finished(false);
12256 return Err(common::Error::HttpError(err));
12257 }
12258 Ok(res) => {
12259 let (mut parts, body) = res.into_parts();
12260 let mut body = common::Body::new(body);
12261 if !parts.status.is_success() {
12262 let bytes = common::to_bytes(body).await.unwrap_or_default();
12263 let error = serde_json::from_str(&common::to_string(&bytes));
12264 let response = common::to_response(parts, bytes.into());
12265
12266 if let common::Retry::After(d) =
12267 dlg.http_failure(&response, error.as_ref().ok())
12268 {
12269 sleep(d).await;
12270 continue;
12271 }
12272
12273 dlg.finished(false);
12274
12275 return Err(match error {
12276 Ok(value) => common::Error::BadRequest(value),
12277 _ => common::Error::Failure(response),
12278 });
12279 }
12280 let response = {
12281 let bytes = common::to_bytes(body).await.unwrap_or_default();
12282 let encoded = common::to_string(&bytes);
12283 match serde_json::from_str(&encoded) {
12284 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12285 Err(error) => {
12286 dlg.response_json_decode_error(&encoded, &error);
12287 return Err(common::Error::JsonDecodeError(
12288 encoded.to_string(),
12289 error,
12290 ));
12291 }
12292 }
12293 };
12294
12295 dlg.finished(true);
12296 return Ok(response);
12297 }
12298 }
12299 }
12300 }
12301
12302 ///
12303 /// Sets the *request* property to the given value.
12304 ///
12305 /// Even though the property as already been set when instantiating this call,
12306 /// we provide this method for API completeness.
12307 pub fn request(
12308 mut self,
12309 new_value: GoogleCloudDatacatalogV1beta1TagTemplateField,
12310 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
12311 self._request = new_value;
12312 self
12313 }
12314 /// Required. The name of the tag template field. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
12315 ///
12316 /// Sets the *name* path property to the given value.
12317 ///
12318 /// Even though the property as already been set when instantiating this call,
12319 /// we provide this method for API completeness.
12320 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
12321 self._name = new_value.to_string();
12322 self
12323 }
12324 /// 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.
12325 ///
12326 /// Sets the *update mask* query property to the given value.
12327 pub fn update_mask(
12328 mut self,
12329 new_value: common::FieldMask,
12330 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
12331 self._update_mask = Some(new_value);
12332 self
12333 }
12334 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12335 /// while executing the actual API request.
12336 ///
12337 /// ````text
12338 /// It should be used to handle progress information, and to implement a certain level of resilience.
12339 /// ````
12340 ///
12341 /// Sets the *delegate* property to the given value.
12342 pub fn delegate(
12343 mut self,
12344 new_value: &'a mut dyn common::Delegate,
12345 ) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
12346 self._delegate = Some(new_value);
12347 self
12348 }
12349
12350 /// Set any additional parameter of the query string used in the request.
12351 /// It should be used to set parameters which are not yet available through their own
12352 /// setters.
12353 ///
12354 /// Please note that this method must not be used to set any of the known parameters
12355 /// which have their own setter method. If done anyway, the request will fail.
12356 ///
12357 /// # Additional Parameters
12358 ///
12359 /// * *$.xgafv* (query-string) - V1 error format.
12360 /// * *access_token* (query-string) - OAuth access token.
12361 /// * *alt* (query-string) - Data format for response.
12362 /// * *callback* (query-string) - JSONP
12363 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12364 /// * *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.
12365 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12366 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12367 /// * *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.
12368 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12369 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12370 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldPatchCall<'a, C>
12371 where
12372 T: AsRef<str>,
12373 {
12374 self._additional_params
12375 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12376 self
12377 }
12378
12379 /// Identifies the authorization scope for the method you are building.
12380 ///
12381 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12382 /// [`Scope::CloudPlatform`].
12383 ///
12384 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12385 /// tokens for more than one scope.
12386 ///
12387 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12388 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12389 /// sufficient, a read-write scope will do as well.
12390 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldPatchCall<'a, C>
12391 where
12392 St: AsRef<str>,
12393 {
12394 self._scopes.insert(String::from(scope.as_ref()));
12395 self
12396 }
12397 /// Identifies the authorization scope(s) for the method you are building.
12398 ///
12399 /// See [`Self::add_scope()`] for details.
12400 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateFieldPatchCall<'a, C>
12401 where
12402 I: IntoIterator<Item = St>,
12403 St: AsRef<str>,
12404 {
12405 self._scopes
12406 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12407 self
12408 }
12409
12410 /// Removes all scopes, and no default scope will be used either.
12411 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12412 /// for details).
12413 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldPatchCall<'a, C> {
12414 self._scopes.clear();
12415 self
12416 }
12417}
12418
12419/// Renames a field in a tag template. The user should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
12420///
12421/// A builder for the *locations.tagTemplates.fields.rename* method supported by a *project* resource.
12422/// It is not used directly, but through a [`ProjectMethods`] instance.
12423///
12424/// # Example
12425///
12426/// Instantiate a resource method builder
12427///
12428/// ```test_harness,no_run
12429/// # extern crate hyper;
12430/// # extern crate hyper_rustls;
12431/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
12432/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldRequest;
12433/// # async fn dox() {
12434/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12435///
12436/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12437/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12438/// # .with_native_roots()
12439/// # .unwrap()
12440/// # .https_only()
12441/// # .enable_http2()
12442/// # .build();
12443///
12444/// # let executor = hyper_util::rt::TokioExecutor::new();
12445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12446/// # secret,
12447/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12448/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12449/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12450/// # ),
12451/// # ).build().await.unwrap();
12452///
12453/// # let client = hyper_util::client::legacy::Client::builder(
12454/// # hyper_util::rt::TokioExecutor::new()
12455/// # )
12456/// # .build(
12457/// # hyper_rustls::HttpsConnectorBuilder::new()
12458/// # .with_native_roots()
12459/// # .unwrap()
12460/// # .https_or_http()
12461/// # .enable_http2()
12462/// # .build()
12463/// # );
12464/// # let mut hub = DataCatalog::new(client, auth);
12465/// // As the method needs a request, you would usually fill it with the desired information
12466/// // into the respective structure. Some of the parts shown here might not be applicable !
12467/// // Values shown here are possibly random and not representative !
12468/// let mut req = GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldRequest::default();
12469///
12470/// // You can configure optional parameters by calling the respective setters at will, and
12471/// // execute the final call using `doit()`.
12472/// // Values shown here are possibly random and not representative !
12473/// let result = hub.projects().locations_tag_templates_fields_rename(req, "name")
12474/// .doit().await;
12475/// # }
12476/// ```
12477pub struct ProjectLocationTagTemplateFieldRenameCall<'a, C>
12478where
12479 C: 'a,
12480{
12481 hub: &'a DataCatalog<C>,
12482 _request: GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldRequest,
12483 _name: String,
12484 _delegate: Option<&'a mut dyn common::Delegate>,
12485 _additional_params: HashMap<String, String>,
12486 _scopes: BTreeSet<String>,
12487}
12488
12489impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateFieldRenameCall<'a, C> {}
12490
12491impl<'a, C> ProjectLocationTagTemplateFieldRenameCall<'a, C>
12492where
12493 C: common::Connector,
12494{
12495 /// Perform the operation you have build so far.
12496 pub async fn doit(
12497 mut self,
12498 ) -> common::Result<(
12499 common::Response,
12500 GoogleCloudDatacatalogV1beta1TagTemplateField,
12501 )> {
12502 use std::borrow::Cow;
12503 use std::io::{Read, Seek};
12504
12505 use common::{url::Params, ToParts};
12506 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12507
12508 let mut dd = common::DefaultDelegate;
12509 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12510 dlg.begin(common::MethodInfo {
12511 id: "datacatalog.projects.locations.tagTemplates.fields.rename",
12512 http_method: hyper::Method::POST,
12513 });
12514
12515 for &field in ["alt", "name"].iter() {
12516 if self._additional_params.contains_key(field) {
12517 dlg.finished(false);
12518 return Err(common::Error::FieldClash(field));
12519 }
12520 }
12521
12522 let mut params = Params::with_capacity(4 + self._additional_params.len());
12523 params.push("name", self._name);
12524
12525 params.extend(self._additional_params.iter());
12526
12527 params.push("alt", "json");
12528 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:rename";
12529 if self._scopes.is_empty() {
12530 self._scopes
12531 .insert(Scope::CloudPlatform.as_ref().to_string());
12532 }
12533
12534 #[allow(clippy::single_element_loop)]
12535 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12536 url = params.uri_replacement(url, param_name, find_this, true);
12537 }
12538 {
12539 let to_remove = ["name"];
12540 params.remove_params(&to_remove);
12541 }
12542
12543 let url = params.parse_with_url(&url);
12544
12545 let mut json_mime_type = mime::APPLICATION_JSON;
12546 let mut request_value_reader = {
12547 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12548 common::remove_json_null_values(&mut value);
12549 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12550 serde_json::to_writer(&mut dst, &value).unwrap();
12551 dst
12552 };
12553 let request_size = request_value_reader
12554 .seek(std::io::SeekFrom::End(0))
12555 .unwrap();
12556 request_value_reader
12557 .seek(std::io::SeekFrom::Start(0))
12558 .unwrap();
12559
12560 loop {
12561 let token = match self
12562 .hub
12563 .auth
12564 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12565 .await
12566 {
12567 Ok(token) => token,
12568 Err(e) => match dlg.token(e) {
12569 Ok(token) => token,
12570 Err(e) => {
12571 dlg.finished(false);
12572 return Err(common::Error::MissingToken(e));
12573 }
12574 },
12575 };
12576 request_value_reader
12577 .seek(std::io::SeekFrom::Start(0))
12578 .unwrap();
12579 let mut req_result = {
12580 let client = &self.hub.client;
12581 dlg.pre_request();
12582 let mut req_builder = hyper::Request::builder()
12583 .method(hyper::Method::POST)
12584 .uri(url.as_str())
12585 .header(USER_AGENT, self.hub._user_agent.clone());
12586
12587 if let Some(token) = token.as_ref() {
12588 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12589 }
12590
12591 let request = req_builder
12592 .header(CONTENT_TYPE, json_mime_type.to_string())
12593 .header(CONTENT_LENGTH, request_size as u64)
12594 .body(common::to_body(
12595 request_value_reader.get_ref().clone().into(),
12596 ));
12597
12598 client.request(request.unwrap()).await
12599 };
12600
12601 match req_result {
12602 Err(err) => {
12603 if let common::Retry::After(d) = dlg.http_error(&err) {
12604 sleep(d).await;
12605 continue;
12606 }
12607 dlg.finished(false);
12608 return Err(common::Error::HttpError(err));
12609 }
12610 Ok(res) => {
12611 let (mut parts, body) = res.into_parts();
12612 let mut body = common::Body::new(body);
12613 if !parts.status.is_success() {
12614 let bytes = common::to_bytes(body).await.unwrap_or_default();
12615 let error = serde_json::from_str(&common::to_string(&bytes));
12616 let response = common::to_response(parts, bytes.into());
12617
12618 if let common::Retry::After(d) =
12619 dlg.http_failure(&response, error.as_ref().ok())
12620 {
12621 sleep(d).await;
12622 continue;
12623 }
12624
12625 dlg.finished(false);
12626
12627 return Err(match error {
12628 Ok(value) => common::Error::BadRequest(value),
12629 _ => common::Error::Failure(response),
12630 });
12631 }
12632 let response = {
12633 let bytes = common::to_bytes(body).await.unwrap_or_default();
12634 let encoded = common::to_string(&bytes);
12635 match serde_json::from_str(&encoded) {
12636 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12637 Err(error) => {
12638 dlg.response_json_decode_error(&encoded, &error);
12639 return Err(common::Error::JsonDecodeError(
12640 encoded.to_string(),
12641 error,
12642 ));
12643 }
12644 }
12645 };
12646
12647 dlg.finished(true);
12648 return Ok(response);
12649 }
12650 }
12651 }
12652 }
12653
12654 ///
12655 /// Sets the *request* property to the given value.
12656 ///
12657 /// Even though the property as already been set when instantiating this call,
12658 /// we provide this method for API completeness.
12659 pub fn request(
12660 mut self,
12661 new_value: GoogleCloudDatacatalogV1beta1RenameTagTemplateFieldRequest,
12662 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
12663 self._request = new_value;
12664 self
12665 }
12666 /// Required. The name of the tag template. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
12667 ///
12668 /// Sets the *name* path property to the given value.
12669 ///
12670 /// Even though the property as already been set when instantiating this call,
12671 /// we provide this method for API completeness.
12672 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
12673 self._name = new_value.to_string();
12674 self
12675 }
12676 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12677 /// while executing the actual API request.
12678 ///
12679 /// ````text
12680 /// It should be used to handle progress information, and to implement a certain level of resilience.
12681 /// ````
12682 ///
12683 /// Sets the *delegate* property to the given value.
12684 pub fn delegate(
12685 mut self,
12686 new_value: &'a mut dyn common::Delegate,
12687 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
12688 self._delegate = Some(new_value);
12689 self
12690 }
12691
12692 /// Set any additional parameter of the query string used in the request.
12693 /// It should be used to set parameters which are not yet available through their own
12694 /// setters.
12695 ///
12696 /// Please note that this method must not be used to set any of the known parameters
12697 /// which have their own setter method. If done anyway, the request will fail.
12698 ///
12699 /// # Additional Parameters
12700 ///
12701 /// * *$.xgafv* (query-string) - V1 error format.
12702 /// * *access_token* (query-string) - OAuth access token.
12703 /// * *alt* (query-string) - Data format for response.
12704 /// * *callback* (query-string) - JSONP
12705 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12706 /// * *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.
12707 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12708 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12709 /// * *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.
12710 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12711 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12712 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateFieldRenameCall<'a, C>
12713 where
12714 T: AsRef<str>,
12715 {
12716 self._additional_params
12717 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12718 self
12719 }
12720
12721 /// Identifies the authorization scope for the method you are building.
12722 ///
12723 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12724 /// [`Scope::CloudPlatform`].
12725 ///
12726 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12727 /// tokens for more than one scope.
12728 ///
12729 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12730 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12731 /// sufficient, a read-write scope will do as well.
12732 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateFieldRenameCall<'a, C>
12733 where
12734 St: AsRef<str>,
12735 {
12736 self._scopes.insert(String::from(scope.as_ref()));
12737 self
12738 }
12739 /// Identifies the authorization scope(s) for the method you are building.
12740 ///
12741 /// See [`Self::add_scope()`] for details.
12742 pub fn add_scopes<I, St>(
12743 mut self,
12744 scopes: I,
12745 ) -> ProjectLocationTagTemplateFieldRenameCall<'a, C>
12746 where
12747 I: IntoIterator<Item = St>,
12748 St: AsRef<str>,
12749 {
12750 self._scopes
12751 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12752 self
12753 }
12754
12755 /// Removes all scopes, and no default scope will be used either.
12756 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12757 /// for details).
12758 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateFieldRenameCall<'a, C> {
12759 self._scopes.clear();
12760 self
12761 }
12762}
12763
12764/// Creates a tag template. The user should enable the Data Catalog API in the project identified by the `parent` parameter (see [Data Catalog Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
12765///
12766/// A builder for the *locations.tagTemplates.create* method supported by a *project* resource.
12767/// It is not used directly, but through a [`ProjectMethods`] instance.
12768///
12769/// # Example
12770///
12771/// Instantiate a resource method builder
12772///
12773/// ```test_harness,no_run
12774/// # extern crate hyper;
12775/// # extern crate hyper_rustls;
12776/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
12777/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1TagTemplate;
12778/// # async fn dox() {
12779/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12780///
12781/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12782/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12783/// # .with_native_roots()
12784/// # .unwrap()
12785/// # .https_only()
12786/// # .enable_http2()
12787/// # .build();
12788///
12789/// # let executor = hyper_util::rt::TokioExecutor::new();
12790/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12791/// # secret,
12792/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12793/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12794/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12795/// # ),
12796/// # ).build().await.unwrap();
12797///
12798/// # let client = hyper_util::client::legacy::Client::builder(
12799/// # hyper_util::rt::TokioExecutor::new()
12800/// # )
12801/// # .build(
12802/// # hyper_rustls::HttpsConnectorBuilder::new()
12803/// # .with_native_roots()
12804/// # .unwrap()
12805/// # .https_or_http()
12806/// # .enable_http2()
12807/// # .build()
12808/// # );
12809/// # let mut hub = DataCatalog::new(client, auth);
12810/// // As the method needs a request, you would usually fill it with the desired information
12811/// // into the respective structure. Some of the parts shown here might not be applicable !
12812/// // Values shown here are possibly random and not representative !
12813/// let mut req = GoogleCloudDatacatalogV1beta1TagTemplate::default();
12814///
12815/// // You can configure optional parameters by calling the respective setters at will, and
12816/// // execute the final call using `doit()`.
12817/// // Values shown here are possibly random and not representative !
12818/// let result = hub.projects().locations_tag_templates_create(req, "parent")
12819/// .tag_template_id("erat")
12820/// .doit().await;
12821/// # }
12822/// ```
12823pub struct ProjectLocationTagTemplateCreateCall<'a, C>
12824where
12825 C: 'a,
12826{
12827 hub: &'a DataCatalog<C>,
12828 _request: GoogleCloudDatacatalogV1beta1TagTemplate,
12829 _parent: String,
12830 _tag_template_id: Option<String>,
12831 _delegate: Option<&'a mut dyn common::Delegate>,
12832 _additional_params: HashMap<String, String>,
12833 _scopes: BTreeSet<String>,
12834}
12835
12836impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateCreateCall<'a, C> {}
12837
12838impl<'a, C> ProjectLocationTagTemplateCreateCall<'a, C>
12839where
12840 C: common::Connector,
12841{
12842 /// Perform the operation you have build so far.
12843 pub async fn doit(
12844 mut self,
12845 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1TagTemplate)> {
12846 use std::borrow::Cow;
12847 use std::io::{Read, Seek};
12848
12849 use common::{url::Params, ToParts};
12850 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12851
12852 let mut dd = common::DefaultDelegate;
12853 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12854 dlg.begin(common::MethodInfo {
12855 id: "datacatalog.projects.locations.tagTemplates.create",
12856 http_method: hyper::Method::POST,
12857 });
12858
12859 for &field in ["alt", "parent", "tagTemplateId"].iter() {
12860 if self._additional_params.contains_key(field) {
12861 dlg.finished(false);
12862 return Err(common::Error::FieldClash(field));
12863 }
12864 }
12865
12866 let mut params = Params::with_capacity(5 + self._additional_params.len());
12867 params.push("parent", self._parent);
12868 if let Some(value) = self._tag_template_id.as_ref() {
12869 params.push("tagTemplateId", value);
12870 }
12871
12872 params.extend(self._additional_params.iter());
12873
12874 params.push("alt", "json");
12875 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/tagTemplates";
12876 if self._scopes.is_empty() {
12877 self._scopes
12878 .insert(Scope::CloudPlatform.as_ref().to_string());
12879 }
12880
12881 #[allow(clippy::single_element_loop)]
12882 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12883 url = params.uri_replacement(url, param_name, find_this, true);
12884 }
12885 {
12886 let to_remove = ["parent"];
12887 params.remove_params(&to_remove);
12888 }
12889
12890 let url = params.parse_with_url(&url);
12891
12892 let mut json_mime_type = mime::APPLICATION_JSON;
12893 let mut request_value_reader = {
12894 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12895 common::remove_json_null_values(&mut value);
12896 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12897 serde_json::to_writer(&mut dst, &value).unwrap();
12898 dst
12899 };
12900 let request_size = request_value_reader
12901 .seek(std::io::SeekFrom::End(0))
12902 .unwrap();
12903 request_value_reader
12904 .seek(std::io::SeekFrom::Start(0))
12905 .unwrap();
12906
12907 loop {
12908 let token = match self
12909 .hub
12910 .auth
12911 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12912 .await
12913 {
12914 Ok(token) => token,
12915 Err(e) => match dlg.token(e) {
12916 Ok(token) => token,
12917 Err(e) => {
12918 dlg.finished(false);
12919 return Err(common::Error::MissingToken(e));
12920 }
12921 },
12922 };
12923 request_value_reader
12924 .seek(std::io::SeekFrom::Start(0))
12925 .unwrap();
12926 let mut req_result = {
12927 let client = &self.hub.client;
12928 dlg.pre_request();
12929 let mut req_builder = hyper::Request::builder()
12930 .method(hyper::Method::POST)
12931 .uri(url.as_str())
12932 .header(USER_AGENT, self.hub._user_agent.clone());
12933
12934 if let Some(token) = token.as_ref() {
12935 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12936 }
12937
12938 let request = req_builder
12939 .header(CONTENT_TYPE, json_mime_type.to_string())
12940 .header(CONTENT_LENGTH, request_size as u64)
12941 .body(common::to_body(
12942 request_value_reader.get_ref().clone().into(),
12943 ));
12944
12945 client.request(request.unwrap()).await
12946 };
12947
12948 match req_result {
12949 Err(err) => {
12950 if let common::Retry::After(d) = dlg.http_error(&err) {
12951 sleep(d).await;
12952 continue;
12953 }
12954 dlg.finished(false);
12955 return Err(common::Error::HttpError(err));
12956 }
12957 Ok(res) => {
12958 let (mut parts, body) = res.into_parts();
12959 let mut body = common::Body::new(body);
12960 if !parts.status.is_success() {
12961 let bytes = common::to_bytes(body).await.unwrap_or_default();
12962 let error = serde_json::from_str(&common::to_string(&bytes));
12963 let response = common::to_response(parts, bytes.into());
12964
12965 if let common::Retry::After(d) =
12966 dlg.http_failure(&response, error.as_ref().ok())
12967 {
12968 sleep(d).await;
12969 continue;
12970 }
12971
12972 dlg.finished(false);
12973
12974 return Err(match error {
12975 Ok(value) => common::Error::BadRequest(value),
12976 _ => common::Error::Failure(response),
12977 });
12978 }
12979 let response = {
12980 let bytes = common::to_bytes(body).await.unwrap_or_default();
12981 let encoded = common::to_string(&bytes);
12982 match serde_json::from_str(&encoded) {
12983 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12984 Err(error) => {
12985 dlg.response_json_decode_error(&encoded, &error);
12986 return Err(common::Error::JsonDecodeError(
12987 encoded.to_string(),
12988 error,
12989 ));
12990 }
12991 }
12992 };
12993
12994 dlg.finished(true);
12995 return Ok(response);
12996 }
12997 }
12998 }
12999 }
13000
13001 ///
13002 /// Sets the *request* property to the given value.
13003 ///
13004 /// Even though the property as already been set when instantiating this call,
13005 /// we provide this method for API completeness.
13006 pub fn request(
13007 mut self,
13008 new_value: GoogleCloudDatacatalogV1beta1TagTemplate,
13009 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
13010 self._request = new_value;
13011 self
13012 }
13013 /// Required. The name of the project and the template location [region](https://cloud.google.com/data-catalog/docs/concepts/regions. Example: * projects/{project_id}/locations/us-central1
13014 ///
13015 /// Sets the *parent* path property to the given value.
13016 ///
13017 /// Even though the property as already been set when instantiating this call,
13018 /// we provide this method for API completeness.
13019 pub fn parent(mut self, new_value: &str) -> ProjectLocationTagTemplateCreateCall<'a, C> {
13020 self._parent = new_value.to_string();
13021 self
13022 }
13023 /// Required. The id of the tag template to create.
13024 ///
13025 /// Sets the *tag template id* query property to the given value.
13026 pub fn tag_template_id(
13027 mut self,
13028 new_value: &str,
13029 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
13030 self._tag_template_id = Some(new_value.to_string());
13031 self
13032 }
13033 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13034 /// while executing the actual API request.
13035 ///
13036 /// ````text
13037 /// It should be used to handle progress information, and to implement a certain level of resilience.
13038 /// ````
13039 ///
13040 /// Sets the *delegate* property to the given value.
13041 pub fn delegate(
13042 mut self,
13043 new_value: &'a mut dyn common::Delegate,
13044 ) -> ProjectLocationTagTemplateCreateCall<'a, C> {
13045 self._delegate = Some(new_value);
13046 self
13047 }
13048
13049 /// Set any additional parameter of the query string used in the request.
13050 /// It should be used to set parameters which are not yet available through their own
13051 /// setters.
13052 ///
13053 /// Please note that this method must not be used to set any of the known parameters
13054 /// which have their own setter method. If done anyway, the request will fail.
13055 ///
13056 /// # Additional Parameters
13057 ///
13058 /// * *$.xgafv* (query-string) - V1 error format.
13059 /// * *access_token* (query-string) - OAuth access token.
13060 /// * *alt* (query-string) - Data format for response.
13061 /// * *callback* (query-string) - JSONP
13062 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13063 /// * *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.
13064 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13065 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13066 /// * *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.
13067 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13068 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13069 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateCreateCall<'a, C>
13070 where
13071 T: AsRef<str>,
13072 {
13073 self._additional_params
13074 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13075 self
13076 }
13077
13078 /// Identifies the authorization scope for the method you are building.
13079 ///
13080 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13081 /// [`Scope::CloudPlatform`].
13082 ///
13083 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13084 /// tokens for more than one scope.
13085 ///
13086 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13087 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13088 /// sufficient, a read-write scope will do as well.
13089 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateCreateCall<'a, C>
13090 where
13091 St: AsRef<str>,
13092 {
13093 self._scopes.insert(String::from(scope.as_ref()));
13094 self
13095 }
13096 /// Identifies the authorization scope(s) for the method you are building.
13097 ///
13098 /// See [`Self::add_scope()`] for details.
13099 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateCreateCall<'a, C>
13100 where
13101 I: IntoIterator<Item = St>,
13102 St: AsRef<str>,
13103 {
13104 self._scopes
13105 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13106 self
13107 }
13108
13109 /// Removes all scopes, and no default scope will be used either.
13110 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13111 /// for details).
13112 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateCreateCall<'a, C> {
13113 self._scopes.clear();
13114 self
13115 }
13116}
13117
13118/// Deletes a tag template and all tags using the template. Users should enable the Data Catalog API in the project identified by the `name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
13119///
13120/// A builder for the *locations.tagTemplates.delete* method supported by a *project* resource.
13121/// It is not used directly, but through a [`ProjectMethods`] instance.
13122///
13123/// # Example
13124///
13125/// Instantiate a resource method builder
13126///
13127/// ```test_harness,no_run
13128/// # extern crate hyper;
13129/// # extern crate hyper_rustls;
13130/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
13131/// # async fn dox() {
13132/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13133///
13134/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13135/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13136/// # .with_native_roots()
13137/// # .unwrap()
13138/// # .https_only()
13139/// # .enable_http2()
13140/// # .build();
13141///
13142/// # let executor = hyper_util::rt::TokioExecutor::new();
13143/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13144/// # secret,
13145/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13146/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13147/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13148/// # ),
13149/// # ).build().await.unwrap();
13150///
13151/// # let client = hyper_util::client::legacy::Client::builder(
13152/// # hyper_util::rt::TokioExecutor::new()
13153/// # )
13154/// # .build(
13155/// # hyper_rustls::HttpsConnectorBuilder::new()
13156/// # .with_native_roots()
13157/// # .unwrap()
13158/// # .https_or_http()
13159/// # .enable_http2()
13160/// # .build()
13161/// # );
13162/// # let mut hub = DataCatalog::new(client, auth);
13163/// // You can configure optional parameters by calling the respective setters at will, and
13164/// // execute the final call using `doit()`.
13165/// // Values shown here are possibly random and not representative !
13166/// let result = hub.projects().locations_tag_templates_delete("name")
13167/// .force(false)
13168/// .doit().await;
13169/// # }
13170/// ```
13171pub struct ProjectLocationTagTemplateDeleteCall<'a, C>
13172where
13173 C: 'a,
13174{
13175 hub: &'a DataCatalog<C>,
13176 _name: String,
13177 _force: Option<bool>,
13178 _delegate: Option<&'a mut dyn common::Delegate>,
13179 _additional_params: HashMap<String, String>,
13180 _scopes: BTreeSet<String>,
13181}
13182
13183impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateDeleteCall<'a, C> {}
13184
13185impl<'a, C> ProjectLocationTagTemplateDeleteCall<'a, C>
13186where
13187 C: common::Connector,
13188{
13189 /// Perform the operation you have build so far.
13190 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
13191 use std::borrow::Cow;
13192 use std::io::{Read, Seek};
13193
13194 use common::{url::Params, ToParts};
13195 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13196
13197 let mut dd = common::DefaultDelegate;
13198 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13199 dlg.begin(common::MethodInfo {
13200 id: "datacatalog.projects.locations.tagTemplates.delete",
13201 http_method: hyper::Method::DELETE,
13202 });
13203
13204 for &field in ["alt", "name", "force"].iter() {
13205 if self._additional_params.contains_key(field) {
13206 dlg.finished(false);
13207 return Err(common::Error::FieldClash(field));
13208 }
13209 }
13210
13211 let mut params = Params::with_capacity(4 + self._additional_params.len());
13212 params.push("name", self._name);
13213 if let Some(value) = self._force.as_ref() {
13214 params.push("force", value.to_string());
13215 }
13216
13217 params.extend(self._additional_params.iter());
13218
13219 params.push("alt", "json");
13220 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
13221 if self._scopes.is_empty() {
13222 self._scopes
13223 .insert(Scope::CloudPlatform.as_ref().to_string());
13224 }
13225
13226 #[allow(clippy::single_element_loop)]
13227 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13228 url = params.uri_replacement(url, param_name, find_this, true);
13229 }
13230 {
13231 let to_remove = ["name"];
13232 params.remove_params(&to_remove);
13233 }
13234
13235 let url = params.parse_with_url(&url);
13236
13237 loop {
13238 let token = match self
13239 .hub
13240 .auth
13241 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13242 .await
13243 {
13244 Ok(token) => token,
13245 Err(e) => match dlg.token(e) {
13246 Ok(token) => token,
13247 Err(e) => {
13248 dlg.finished(false);
13249 return Err(common::Error::MissingToken(e));
13250 }
13251 },
13252 };
13253 let mut req_result = {
13254 let client = &self.hub.client;
13255 dlg.pre_request();
13256 let mut req_builder = hyper::Request::builder()
13257 .method(hyper::Method::DELETE)
13258 .uri(url.as_str())
13259 .header(USER_AGENT, self.hub._user_agent.clone());
13260
13261 if let Some(token) = token.as_ref() {
13262 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13263 }
13264
13265 let request = req_builder
13266 .header(CONTENT_LENGTH, 0_u64)
13267 .body(common::to_body::<String>(None));
13268
13269 client.request(request.unwrap()).await
13270 };
13271
13272 match req_result {
13273 Err(err) => {
13274 if let common::Retry::After(d) = dlg.http_error(&err) {
13275 sleep(d).await;
13276 continue;
13277 }
13278 dlg.finished(false);
13279 return Err(common::Error::HttpError(err));
13280 }
13281 Ok(res) => {
13282 let (mut parts, body) = res.into_parts();
13283 let mut body = common::Body::new(body);
13284 if !parts.status.is_success() {
13285 let bytes = common::to_bytes(body).await.unwrap_or_default();
13286 let error = serde_json::from_str(&common::to_string(&bytes));
13287 let response = common::to_response(parts, bytes.into());
13288
13289 if let common::Retry::After(d) =
13290 dlg.http_failure(&response, error.as_ref().ok())
13291 {
13292 sleep(d).await;
13293 continue;
13294 }
13295
13296 dlg.finished(false);
13297
13298 return Err(match error {
13299 Ok(value) => common::Error::BadRequest(value),
13300 _ => common::Error::Failure(response),
13301 });
13302 }
13303 let response = {
13304 let bytes = common::to_bytes(body).await.unwrap_or_default();
13305 let encoded = common::to_string(&bytes);
13306 match serde_json::from_str(&encoded) {
13307 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13308 Err(error) => {
13309 dlg.response_json_decode_error(&encoded, &error);
13310 return Err(common::Error::JsonDecodeError(
13311 encoded.to_string(),
13312 error,
13313 ));
13314 }
13315 }
13316 };
13317
13318 dlg.finished(true);
13319 return Ok(response);
13320 }
13321 }
13322 }
13323 }
13324
13325 /// Required. The name of the tag template to delete. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}
13326 ///
13327 /// Sets the *name* path property to the given value.
13328 ///
13329 /// Even though the property as already been set when instantiating this call,
13330 /// we provide this method for API completeness.
13331 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
13332 self._name = new_value.to_string();
13333 self
13334 }
13335 /// Required. Currently, this field must always be set to `true`. This confirms the deletion of any possible tags using this template. `force = false` will be supported in the future.
13336 ///
13337 /// Sets the *force* query property to the given value.
13338 pub fn force(mut self, new_value: bool) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
13339 self._force = Some(new_value);
13340 self
13341 }
13342 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13343 /// while executing the actual API request.
13344 ///
13345 /// ````text
13346 /// It should be used to handle progress information, and to implement a certain level of resilience.
13347 /// ````
13348 ///
13349 /// Sets the *delegate* property to the given value.
13350 pub fn delegate(
13351 mut self,
13352 new_value: &'a mut dyn common::Delegate,
13353 ) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
13354 self._delegate = Some(new_value);
13355 self
13356 }
13357
13358 /// Set any additional parameter of the query string used in the request.
13359 /// It should be used to set parameters which are not yet available through their own
13360 /// setters.
13361 ///
13362 /// Please note that this method must not be used to set any of the known parameters
13363 /// which have their own setter method. If done anyway, the request will fail.
13364 ///
13365 /// # Additional Parameters
13366 ///
13367 /// * *$.xgafv* (query-string) - V1 error format.
13368 /// * *access_token* (query-string) - OAuth access token.
13369 /// * *alt* (query-string) - Data format for response.
13370 /// * *callback* (query-string) - JSONP
13371 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13372 /// * *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.
13373 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13374 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13375 /// * *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.
13376 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13377 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13378 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateDeleteCall<'a, C>
13379 where
13380 T: AsRef<str>,
13381 {
13382 self._additional_params
13383 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13384 self
13385 }
13386
13387 /// Identifies the authorization scope for the method you are building.
13388 ///
13389 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13390 /// [`Scope::CloudPlatform`].
13391 ///
13392 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13393 /// tokens for more than one scope.
13394 ///
13395 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13396 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13397 /// sufficient, a read-write scope will do as well.
13398 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateDeleteCall<'a, C>
13399 where
13400 St: AsRef<str>,
13401 {
13402 self._scopes.insert(String::from(scope.as_ref()));
13403 self
13404 }
13405 /// Identifies the authorization scope(s) for the method you are building.
13406 ///
13407 /// See [`Self::add_scope()`] for details.
13408 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateDeleteCall<'a, C>
13409 where
13410 I: IntoIterator<Item = St>,
13411 St: AsRef<str>,
13412 {
13413 self._scopes
13414 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13415 self
13416 }
13417
13418 /// Removes all scopes, and no default scope will be used either.
13419 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13420 /// for details).
13421 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateDeleteCall<'a, C> {
13422 self._scopes.clear();
13423 self
13424 }
13425}
13426
13427/// Gets a tag template.
13428///
13429/// A builder for the *locations.tagTemplates.get* method supported by a *project* resource.
13430/// It is not used directly, but through a [`ProjectMethods`] instance.
13431///
13432/// # Example
13433///
13434/// Instantiate a resource method builder
13435///
13436/// ```test_harness,no_run
13437/// # extern crate hyper;
13438/// # extern crate hyper_rustls;
13439/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
13440/// # async fn dox() {
13441/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13442///
13443/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13444/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13445/// # .with_native_roots()
13446/// # .unwrap()
13447/// # .https_only()
13448/// # .enable_http2()
13449/// # .build();
13450///
13451/// # let executor = hyper_util::rt::TokioExecutor::new();
13452/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13453/// # secret,
13454/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13455/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13456/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13457/// # ),
13458/// # ).build().await.unwrap();
13459///
13460/// # let client = hyper_util::client::legacy::Client::builder(
13461/// # hyper_util::rt::TokioExecutor::new()
13462/// # )
13463/// # .build(
13464/// # hyper_rustls::HttpsConnectorBuilder::new()
13465/// # .with_native_roots()
13466/// # .unwrap()
13467/// # .https_or_http()
13468/// # .enable_http2()
13469/// # .build()
13470/// # );
13471/// # let mut hub = DataCatalog::new(client, auth);
13472/// // You can configure optional parameters by calling the respective setters at will, and
13473/// // execute the final call using `doit()`.
13474/// // Values shown here are possibly random and not representative !
13475/// let result = hub.projects().locations_tag_templates_get("name")
13476/// .doit().await;
13477/// # }
13478/// ```
13479pub struct ProjectLocationTagTemplateGetCall<'a, C>
13480where
13481 C: 'a,
13482{
13483 hub: &'a DataCatalog<C>,
13484 _name: String,
13485 _delegate: Option<&'a mut dyn common::Delegate>,
13486 _additional_params: HashMap<String, String>,
13487 _scopes: BTreeSet<String>,
13488}
13489
13490impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateGetCall<'a, C> {}
13491
13492impl<'a, C> ProjectLocationTagTemplateGetCall<'a, C>
13493where
13494 C: common::Connector,
13495{
13496 /// Perform the operation you have build so far.
13497 pub async fn doit(
13498 mut self,
13499 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1TagTemplate)> {
13500 use std::borrow::Cow;
13501 use std::io::{Read, Seek};
13502
13503 use common::{url::Params, ToParts};
13504 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13505
13506 let mut dd = common::DefaultDelegate;
13507 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13508 dlg.begin(common::MethodInfo {
13509 id: "datacatalog.projects.locations.tagTemplates.get",
13510 http_method: hyper::Method::GET,
13511 });
13512
13513 for &field in ["alt", "name"].iter() {
13514 if self._additional_params.contains_key(field) {
13515 dlg.finished(false);
13516 return Err(common::Error::FieldClash(field));
13517 }
13518 }
13519
13520 let mut params = Params::with_capacity(3 + self._additional_params.len());
13521 params.push("name", self._name);
13522
13523 params.extend(self._additional_params.iter());
13524
13525 params.push("alt", "json");
13526 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
13527 if self._scopes.is_empty() {
13528 self._scopes
13529 .insert(Scope::CloudPlatform.as_ref().to_string());
13530 }
13531
13532 #[allow(clippy::single_element_loop)]
13533 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13534 url = params.uri_replacement(url, param_name, find_this, true);
13535 }
13536 {
13537 let to_remove = ["name"];
13538 params.remove_params(&to_remove);
13539 }
13540
13541 let url = params.parse_with_url(&url);
13542
13543 loop {
13544 let token = match self
13545 .hub
13546 .auth
13547 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13548 .await
13549 {
13550 Ok(token) => token,
13551 Err(e) => match dlg.token(e) {
13552 Ok(token) => token,
13553 Err(e) => {
13554 dlg.finished(false);
13555 return Err(common::Error::MissingToken(e));
13556 }
13557 },
13558 };
13559 let mut req_result = {
13560 let client = &self.hub.client;
13561 dlg.pre_request();
13562 let mut req_builder = hyper::Request::builder()
13563 .method(hyper::Method::GET)
13564 .uri(url.as_str())
13565 .header(USER_AGENT, self.hub._user_agent.clone());
13566
13567 if let Some(token) = token.as_ref() {
13568 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13569 }
13570
13571 let request = req_builder
13572 .header(CONTENT_LENGTH, 0_u64)
13573 .body(common::to_body::<String>(None));
13574
13575 client.request(request.unwrap()).await
13576 };
13577
13578 match req_result {
13579 Err(err) => {
13580 if let common::Retry::After(d) = dlg.http_error(&err) {
13581 sleep(d).await;
13582 continue;
13583 }
13584 dlg.finished(false);
13585 return Err(common::Error::HttpError(err));
13586 }
13587 Ok(res) => {
13588 let (mut parts, body) = res.into_parts();
13589 let mut body = common::Body::new(body);
13590 if !parts.status.is_success() {
13591 let bytes = common::to_bytes(body).await.unwrap_or_default();
13592 let error = serde_json::from_str(&common::to_string(&bytes));
13593 let response = common::to_response(parts, bytes.into());
13594
13595 if let common::Retry::After(d) =
13596 dlg.http_failure(&response, error.as_ref().ok())
13597 {
13598 sleep(d).await;
13599 continue;
13600 }
13601
13602 dlg.finished(false);
13603
13604 return Err(match error {
13605 Ok(value) => common::Error::BadRequest(value),
13606 _ => common::Error::Failure(response),
13607 });
13608 }
13609 let response = {
13610 let bytes = common::to_bytes(body).await.unwrap_or_default();
13611 let encoded = common::to_string(&bytes);
13612 match serde_json::from_str(&encoded) {
13613 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13614 Err(error) => {
13615 dlg.response_json_decode_error(&encoded, &error);
13616 return Err(common::Error::JsonDecodeError(
13617 encoded.to_string(),
13618 error,
13619 ));
13620 }
13621 }
13622 };
13623
13624 dlg.finished(true);
13625 return Ok(response);
13626 }
13627 }
13628 }
13629 }
13630
13631 /// Required. The name of the tag template. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}
13632 ///
13633 /// Sets the *name* path property to the given value.
13634 ///
13635 /// Even though the property as already been set when instantiating this call,
13636 /// we provide this method for API completeness.
13637 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplateGetCall<'a, C> {
13638 self._name = new_value.to_string();
13639 self
13640 }
13641 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13642 /// while executing the actual API request.
13643 ///
13644 /// ````text
13645 /// It should be used to handle progress information, and to implement a certain level of resilience.
13646 /// ````
13647 ///
13648 /// Sets the *delegate* property to the given value.
13649 pub fn delegate(
13650 mut self,
13651 new_value: &'a mut dyn common::Delegate,
13652 ) -> ProjectLocationTagTemplateGetCall<'a, C> {
13653 self._delegate = Some(new_value);
13654 self
13655 }
13656
13657 /// Set any additional parameter of the query string used in the request.
13658 /// It should be used to set parameters which are not yet available through their own
13659 /// setters.
13660 ///
13661 /// Please note that this method must not be used to set any of the known parameters
13662 /// which have their own setter method. If done anyway, the request will fail.
13663 ///
13664 /// # Additional Parameters
13665 ///
13666 /// * *$.xgafv* (query-string) - V1 error format.
13667 /// * *access_token* (query-string) - OAuth access token.
13668 /// * *alt* (query-string) - Data format for response.
13669 /// * *callback* (query-string) - JSONP
13670 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13671 /// * *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.
13672 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13673 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13674 /// * *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.
13675 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13676 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13677 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplateGetCall<'a, C>
13678 where
13679 T: AsRef<str>,
13680 {
13681 self._additional_params
13682 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13683 self
13684 }
13685
13686 /// Identifies the authorization scope for the method you are building.
13687 ///
13688 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13689 /// [`Scope::CloudPlatform`].
13690 ///
13691 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13692 /// tokens for more than one scope.
13693 ///
13694 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13695 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13696 /// sufficient, a read-write scope will do as well.
13697 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateGetCall<'a, C>
13698 where
13699 St: AsRef<str>,
13700 {
13701 self._scopes.insert(String::from(scope.as_ref()));
13702 self
13703 }
13704 /// Identifies the authorization scope(s) for the method you are building.
13705 ///
13706 /// See [`Self::add_scope()`] for details.
13707 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplateGetCall<'a, C>
13708 where
13709 I: IntoIterator<Item = St>,
13710 St: AsRef<str>,
13711 {
13712 self._scopes
13713 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13714 self
13715 }
13716
13717 /// Removes all scopes, and no default scope will be used either.
13718 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13719 /// for details).
13720 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateGetCall<'a, C> {
13721 self._scopes.clear();
13722 self
13723 }
13724}
13725
13726/// Gets the access control policy for a resource. A `NOT_FOUND` error is returned if the resource does not exist. An empty policy is returned if the resource exists but does not have a policy set on it. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag templates. - `datacatalog.entries.getIamPolicy` to get policies on entries. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
13727///
13728/// A builder for the *locations.tagTemplates.getIamPolicy* method supported by a *project* resource.
13729/// It is not used directly, but through a [`ProjectMethods`] instance.
13730///
13731/// # Example
13732///
13733/// Instantiate a resource method builder
13734///
13735/// ```test_harness,no_run
13736/// # extern crate hyper;
13737/// # extern crate hyper_rustls;
13738/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
13739/// use datacatalog1_beta1::api::GetIamPolicyRequest;
13740/// # async fn dox() {
13741/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13742///
13743/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13744/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13745/// # .with_native_roots()
13746/// # .unwrap()
13747/// # .https_only()
13748/// # .enable_http2()
13749/// # .build();
13750///
13751/// # let executor = hyper_util::rt::TokioExecutor::new();
13752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13753/// # secret,
13754/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13755/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13756/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13757/// # ),
13758/// # ).build().await.unwrap();
13759///
13760/// # let client = hyper_util::client::legacy::Client::builder(
13761/// # hyper_util::rt::TokioExecutor::new()
13762/// # )
13763/// # .build(
13764/// # hyper_rustls::HttpsConnectorBuilder::new()
13765/// # .with_native_roots()
13766/// # .unwrap()
13767/// # .https_or_http()
13768/// # .enable_http2()
13769/// # .build()
13770/// # );
13771/// # let mut hub = DataCatalog::new(client, auth);
13772/// // As the method needs a request, you would usually fill it with the desired information
13773/// // into the respective structure. Some of the parts shown here might not be applicable !
13774/// // Values shown here are possibly random and not representative !
13775/// let mut req = GetIamPolicyRequest::default();
13776///
13777/// // You can configure optional parameters by calling the respective setters at will, and
13778/// // execute the final call using `doit()`.
13779/// // Values shown here are possibly random and not representative !
13780/// let result = hub.projects().locations_tag_templates_get_iam_policy(req, "resource")
13781/// .doit().await;
13782/// # }
13783/// ```
13784pub struct ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
13785where
13786 C: 'a,
13787{
13788 hub: &'a DataCatalog<C>,
13789 _request: GetIamPolicyRequest,
13790 _resource: String,
13791 _delegate: Option<&'a mut dyn common::Delegate>,
13792 _additional_params: HashMap<String, String>,
13793 _scopes: BTreeSet<String>,
13794}
13795
13796impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {}
13797
13798impl<'a, C> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
13799where
13800 C: common::Connector,
13801{
13802 /// Perform the operation you have build so far.
13803 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
13804 use std::borrow::Cow;
13805 use std::io::{Read, Seek};
13806
13807 use common::{url::Params, ToParts};
13808 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13809
13810 let mut dd = common::DefaultDelegate;
13811 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13812 dlg.begin(common::MethodInfo {
13813 id: "datacatalog.projects.locations.tagTemplates.getIamPolicy",
13814 http_method: hyper::Method::POST,
13815 });
13816
13817 for &field in ["alt", "resource"].iter() {
13818 if self._additional_params.contains_key(field) {
13819 dlg.finished(false);
13820 return Err(common::Error::FieldClash(field));
13821 }
13822 }
13823
13824 let mut params = Params::with_capacity(4 + self._additional_params.len());
13825 params.push("resource", self._resource);
13826
13827 params.extend(self._additional_params.iter());
13828
13829 params.push("alt", "json");
13830 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
13831 if self._scopes.is_empty() {
13832 self._scopes
13833 .insert(Scope::CloudPlatform.as_ref().to_string());
13834 }
13835
13836 #[allow(clippy::single_element_loop)]
13837 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13838 url = params.uri_replacement(url, param_name, find_this, true);
13839 }
13840 {
13841 let to_remove = ["resource"];
13842 params.remove_params(&to_remove);
13843 }
13844
13845 let url = params.parse_with_url(&url);
13846
13847 let mut json_mime_type = mime::APPLICATION_JSON;
13848 let mut request_value_reader = {
13849 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13850 common::remove_json_null_values(&mut value);
13851 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13852 serde_json::to_writer(&mut dst, &value).unwrap();
13853 dst
13854 };
13855 let request_size = request_value_reader
13856 .seek(std::io::SeekFrom::End(0))
13857 .unwrap();
13858 request_value_reader
13859 .seek(std::io::SeekFrom::Start(0))
13860 .unwrap();
13861
13862 loop {
13863 let token = match self
13864 .hub
13865 .auth
13866 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13867 .await
13868 {
13869 Ok(token) => token,
13870 Err(e) => match dlg.token(e) {
13871 Ok(token) => token,
13872 Err(e) => {
13873 dlg.finished(false);
13874 return Err(common::Error::MissingToken(e));
13875 }
13876 },
13877 };
13878 request_value_reader
13879 .seek(std::io::SeekFrom::Start(0))
13880 .unwrap();
13881 let mut req_result = {
13882 let client = &self.hub.client;
13883 dlg.pre_request();
13884 let mut req_builder = hyper::Request::builder()
13885 .method(hyper::Method::POST)
13886 .uri(url.as_str())
13887 .header(USER_AGENT, self.hub._user_agent.clone());
13888
13889 if let Some(token) = token.as_ref() {
13890 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13891 }
13892
13893 let request = req_builder
13894 .header(CONTENT_TYPE, json_mime_type.to_string())
13895 .header(CONTENT_LENGTH, request_size as u64)
13896 .body(common::to_body(
13897 request_value_reader.get_ref().clone().into(),
13898 ));
13899
13900 client.request(request.unwrap()).await
13901 };
13902
13903 match req_result {
13904 Err(err) => {
13905 if let common::Retry::After(d) = dlg.http_error(&err) {
13906 sleep(d).await;
13907 continue;
13908 }
13909 dlg.finished(false);
13910 return Err(common::Error::HttpError(err));
13911 }
13912 Ok(res) => {
13913 let (mut parts, body) = res.into_parts();
13914 let mut body = common::Body::new(body);
13915 if !parts.status.is_success() {
13916 let bytes = common::to_bytes(body).await.unwrap_or_default();
13917 let error = serde_json::from_str(&common::to_string(&bytes));
13918 let response = common::to_response(parts, bytes.into());
13919
13920 if let common::Retry::After(d) =
13921 dlg.http_failure(&response, error.as_ref().ok())
13922 {
13923 sleep(d).await;
13924 continue;
13925 }
13926
13927 dlg.finished(false);
13928
13929 return Err(match error {
13930 Ok(value) => common::Error::BadRequest(value),
13931 _ => common::Error::Failure(response),
13932 });
13933 }
13934 let response = {
13935 let bytes = common::to_bytes(body).await.unwrap_or_default();
13936 let encoded = common::to_string(&bytes);
13937 match serde_json::from_str(&encoded) {
13938 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13939 Err(error) => {
13940 dlg.response_json_decode_error(&encoded, &error);
13941 return Err(common::Error::JsonDecodeError(
13942 encoded.to_string(),
13943 error,
13944 ));
13945 }
13946 }
13947 };
13948
13949 dlg.finished(true);
13950 return Ok(response);
13951 }
13952 }
13953 }
13954 }
13955
13956 ///
13957 /// Sets the *request* property to the given value.
13958 ///
13959 /// Even though the property as already been set when instantiating this call,
13960 /// we provide this method for API completeness.
13961 pub fn request(
13962 mut self,
13963 new_value: GetIamPolicyRequest,
13964 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
13965 self._request = new_value;
13966 self
13967 }
13968 /// 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.
13969 ///
13970 /// Sets the *resource* path property to the given value.
13971 ///
13972 /// Even though the property as already been set when instantiating this call,
13973 /// we provide this method for API completeness.
13974 pub fn resource(
13975 mut self,
13976 new_value: &str,
13977 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
13978 self._resource = new_value.to_string();
13979 self
13980 }
13981 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13982 /// while executing the actual API request.
13983 ///
13984 /// ````text
13985 /// It should be used to handle progress information, and to implement a certain level of resilience.
13986 /// ````
13987 ///
13988 /// Sets the *delegate* property to the given value.
13989 pub fn delegate(
13990 mut self,
13991 new_value: &'a mut dyn common::Delegate,
13992 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
13993 self._delegate = Some(new_value);
13994 self
13995 }
13996
13997 /// Set any additional parameter of the query string used in the request.
13998 /// It should be used to set parameters which are not yet available through their own
13999 /// setters.
14000 ///
14001 /// Please note that this method must not be used to set any of the known parameters
14002 /// which have their own setter method. If done anyway, the request will fail.
14003 ///
14004 /// # Additional Parameters
14005 ///
14006 /// * *$.xgafv* (query-string) - V1 error format.
14007 /// * *access_token* (query-string) - OAuth access token.
14008 /// * *alt* (query-string) - Data format for response.
14009 /// * *callback* (query-string) - JSONP
14010 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14011 /// * *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.
14012 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14013 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14014 /// * *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.
14015 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14016 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14017 pub fn param<T>(
14018 mut self,
14019 name: T,
14020 value: T,
14021 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
14022 where
14023 T: AsRef<str>,
14024 {
14025 self._additional_params
14026 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14027 self
14028 }
14029
14030 /// Identifies the authorization scope for the method you are building.
14031 ///
14032 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14033 /// [`Scope::CloudPlatform`].
14034 ///
14035 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14036 /// tokens for more than one scope.
14037 ///
14038 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14039 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14040 /// sufficient, a read-write scope will do as well.
14041 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
14042 where
14043 St: AsRef<str>,
14044 {
14045 self._scopes.insert(String::from(scope.as_ref()));
14046 self
14047 }
14048 /// Identifies the authorization scope(s) for the method you are building.
14049 ///
14050 /// See [`Self::add_scope()`] for details.
14051 pub fn add_scopes<I, St>(
14052 mut self,
14053 scopes: I,
14054 ) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C>
14055 where
14056 I: IntoIterator<Item = St>,
14057 St: AsRef<str>,
14058 {
14059 self._scopes
14060 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14061 self
14062 }
14063
14064 /// Removes all scopes, and no default scope will be used either.
14065 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14066 /// for details).
14067 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateGetIamPolicyCall<'a, C> {
14068 self._scopes.clear();
14069 self
14070 }
14071}
14072
14073/// Updates a tag template. This method cannot be used to update the fields of a template. The tag template fields are represented as separate resources and should be updated using their own create/update/delete methods. Users should enable the Data Catalog API in the project identified by the `tag_template.name` parameter (see [Data Catalog Resource Project] (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
14074///
14075/// A builder for the *locations.tagTemplates.patch* method supported by a *project* resource.
14076/// It is not used directly, but through a [`ProjectMethods`] instance.
14077///
14078/// # Example
14079///
14080/// Instantiate a resource method builder
14081///
14082/// ```test_harness,no_run
14083/// # extern crate hyper;
14084/// # extern crate hyper_rustls;
14085/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
14086/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1TagTemplate;
14087/// # async fn dox() {
14088/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14089///
14090/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14091/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14092/// # .with_native_roots()
14093/// # .unwrap()
14094/// # .https_only()
14095/// # .enable_http2()
14096/// # .build();
14097///
14098/// # let executor = hyper_util::rt::TokioExecutor::new();
14099/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14100/// # secret,
14101/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14102/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14103/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14104/// # ),
14105/// # ).build().await.unwrap();
14106///
14107/// # let client = hyper_util::client::legacy::Client::builder(
14108/// # hyper_util::rt::TokioExecutor::new()
14109/// # )
14110/// # .build(
14111/// # hyper_rustls::HttpsConnectorBuilder::new()
14112/// # .with_native_roots()
14113/// # .unwrap()
14114/// # .https_or_http()
14115/// # .enable_http2()
14116/// # .build()
14117/// # );
14118/// # let mut hub = DataCatalog::new(client, auth);
14119/// // As the method needs a request, you would usually fill it with the desired information
14120/// // into the respective structure. Some of the parts shown here might not be applicable !
14121/// // Values shown here are possibly random and not representative !
14122/// let mut req = GoogleCloudDatacatalogV1beta1TagTemplate::default();
14123///
14124/// // You can configure optional parameters by calling the respective setters at will, and
14125/// // execute the final call using `doit()`.
14126/// // Values shown here are possibly random and not representative !
14127/// let result = hub.projects().locations_tag_templates_patch(req, "name")
14128/// .update_mask(FieldMask::new::<&str>(&[]))
14129/// .doit().await;
14130/// # }
14131/// ```
14132pub struct ProjectLocationTagTemplatePatchCall<'a, C>
14133where
14134 C: 'a,
14135{
14136 hub: &'a DataCatalog<C>,
14137 _request: GoogleCloudDatacatalogV1beta1TagTemplate,
14138 _name: String,
14139 _update_mask: Option<common::FieldMask>,
14140 _delegate: Option<&'a mut dyn common::Delegate>,
14141 _additional_params: HashMap<String, String>,
14142 _scopes: BTreeSet<String>,
14143}
14144
14145impl<'a, C> common::CallBuilder for ProjectLocationTagTemplatePatchCall<'a, C> {}
14146
14147impl<'a, C> ProjectLocationTagTemplatePatchCall<'a, C>
14148where
14149 C: common::Connector,
14150{
14151 /// Perform the operation you have build so far.
14152 pub async fn doit(
14153 mut self,
14154 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1TagTemplate)> {
14155 use std::borrow::Cow;
14156 use std::io::{Read, Seek};
14157
14158 use common::{url::Params, ToParts};
14159 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14160
14161 let mut dd = common::DefaultDelegate;
14162 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14163 dlg.begin(common::MethodInfo {
14164 id: "datacatalog.projects.locations.tagTemplates.patch",
14165 http_method: hyper::Method::PATCH,
14166 });
14167
14168 for &field in ["alt", "name", "updateMask"].iter() {
14169 if self._additional_params.contains_key(field) {
14170 dlg.finished(false);
14171 return Err(common::Error::FieldClash(field));
14172 }
14173 }
14174
14175 let mut params = Params::with_capacity(5 + self._additional_params.len());
14176 params.push("name", self._name);
14177 if let Some(value) = self._update_mask.as_ref() {
14178 params.push("updateMask", value.to_string());
14179 }
14180
14181 params.extend(self._additional_params.iter());
14182
14183 params.push("alt", "json");
14184 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
14185 if self._scopes.is_empty() {
14186 self._scopes
14187 .insert(Scope::CloudPlatform.as_ref().to_string());
14188 }
14189
14190 #[allow(clippy::single_element_loop)]
14191 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14192 url = params.uri_replacement(url, param_name, find_this, true);
14193 }
14194 {
14195 let to_remove = ["name"];
14196 params.remove_params(&to_remove);
14197 }
14198
14199 let url = params.parse_with_url(&url);
14200
14201 let mut json_mime_type = mime::APPLICATION_JSON;
14202 let mut request_value_reader = {
14203 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14204 common::remove_json_null_values(&mut value);
14205 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14206 serde_json::to_writer(&mut dst, &value).unwrap();
14207 dst
14208 };
14209 let request_size = request_value_reader
14210 .seek(std::io::SeekFrom::End(0))
14211 .unwrap();
14212 request_value_reader
14213 .seek(std::io::SeekFrom::Start(0))
14214 .unwrap();
14215
14216 loop {
14217 let token = match self
14218 .hub
14219 .auth
14220 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14221 .await
14222 {
14223 Ok(token) => token,
14224 Err(e) => match dlg.token(e) {
14225 Ok(token) => token,
14226 Err(e) => {
14227 dlg.finished(false);
14228 return Err(common::Error::MissingToken(e));
14229 }
14230 },
14231 };
14232 request_value_reader
14233 .seek(std::io::SeekFrom::Start(0))
14234 .unwrap();
14235 let mut req_result = {
14236 let client = &self.hub.client;
14237 dlg.pre_request();
14238 let mut req_builder = hyper::Request::builder()
14239 .method(hyper::Method::PATCH)
14240 .uri(url.as_str())
14241 .header(USER_AGENT, self.hub._user_agent.clone());
14242
14243 if let Some(token) = token.as_ref() {
14244 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14245 }
14246
14247 let request = req_builder
14248 .header(CONTENT_TYPE, json_mime_type.to_string())
14249 .header(CONTENT_LENGTH, request_size as u64)
14250 .body(common::to_body(
14251 request_value_reader.get_ref().clone().into(),
14252 ));
14253
14254 client.request(request.unwrap()).await
14255 };
14256
14257 match req_result {
14258 Err(err) => {
14259 if let common::Retry::After(d) = dlg.http_error(&err) {
14260 sleep(d).await;
14261 continue;
14262 }
14263 dlg.finished(false);
14264 return Err(common::Error::HttpError(err));
14265 }
14266 Ok(res) => {
14267 let (mut parts, body) = res.into_parts();
14268 let mut body = common::Body::new(body);
14269 if !parts.status.is_success() {
14270 let bytes = common::to_bytes(body).await.unwrap_or_default();
14271 let error = serde_json::from_str(&common::to_string(&bytes));
14272 let response = common::to_response(parts, bytes.into());
14273
14274 if let common::Retry::After(d) =
14275 dlg.http_failure(&response, error.as_ref().ok())
14276 {
14277 sleep(d).await;
14278 continue;
14279 }
14280
14281 dlg.finished(false);
14282
14283 return Err(match error {
14284 Ok(value) => common::Error::BadRequest(value),
14285 _ => common::Error::Failure(response),
14286 });
14287 }
14288 let response = {
14289 let bytes = common::to_bytes(body).await.unwrap_or_default();
14290 let encoded = common::to_string(&bytes);
14291 match serde_json::from_str(&encoded) {
14292 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14293 Err(error) => {
14294 dlg.response_json_decode_error(&encoded, &error);
14295 return Err(common::Error::JsonDecodeError(
14296 encoded.to_string(),
14297 error,
14298 ));
14299 }
14300 }
14301 };
14302
14303 dlg.finished(true);
14304 return Ok(response);
14305 }
14306 }
14307 }
14308 }
14309
14310 ///
14311 /// Sets the *request* property to the given value.
14312 ///
14313 /// Even though the property as already been set when instantiating this call,
14314 /// we provide this method for API completeness.
14315 pub fn request(
14316 mut self,
14317 new_value: GoogleCloudDatacatalogV1beta1TagTemplate,
14318 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
14319 self._request = new_value;
14320 self
14321 }
14322 /// Identifier. The resource name of the tag template in URL format. Example: * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id} Note that this TagTemplate and its child resources may not actually be stored in the location in this name.
14323 ///
14324 /// Sets the *name* path property to the given value.
14325 ///
14326 /// Even though the property as already been set when instantiating this call,
14327 /// we provide this method for API completeness.
14328 pub fn name(mut self, new_value: &str) -> ProjectLocationTagTemplatePatchCall<'a, C> {
14329 self._name = new_value.to_string();
14330 self
14331 }
14332 /// Names of fields whose values to overwrite on a tag template. Currently, only `display_name` can be overwritten. 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.
14333 ///
14334 /// Sets the *update mask* query property to the given value.
14335 pub fn update_mask(
14336 mut self,
14337 new_value: common::FieldMask,
14338 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
14339 self._update_mask = Some(new_value);
14340 self
14341 }
14342 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14343 /// while executing the actual API request.
14344 ///
14345 /// ````text
14346 /// It should be used to handle progress information, and to implement a certain level of resilience.
14347 /// ````
14348 ///
14349 /// Sets the *delegate* property to the given value.
14350 pub fn delegate(
14351 mut self,
14352 new_value: &'a mut dyn common::Delegate,
14353 ) -> ProjectLocationTagTemplatePatchCall<'a, C> {
14354 self._delegate = Some(new_value);
14355 self
14356 }
14357
14358 /// Set any additional parameter of the query string used in the request.
14359 /// It should be used to set parameters which are not yet available through their own
14360 /// setters.
14361 ///
14362 /// Please note that this method must not be used to set any of the known parameters
14363 /// which have their own setter method. If done anyway, the request will fail.
14364 ///
14365 /// # Additional Parameters
14366 ///
14367 /// * *$.xgafv* (query-string) - V1 error format.
14368 /// * *access_token* (query-string) - OAuth access token.
14369 /// * *alt* (query-string) - Data format for response.
14370 /// * *callback* (query-string) - JSONP
14371 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14372 /// * *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.
14373 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14374 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14375 /// * *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.
14376 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14377 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14378 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTagTemplatePatchCall<'a, C>
14379 where
14380 T: AsRef<str>,
14381 {
14382 self._additional_params
14383 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14384 self
14385 }
14386
14387 /// Identifies the authorization scope for the method you are building.
14388 ///
14389 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14390 /// [`Scope::CloudPlatform`].
14391 ///
14392 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14393 /// tokens for more than one scope.
14394 ///
14395 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14396 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14397 /// sufficient, a read-write scope will do as well.
14398 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplatePatchCall<'a, C>
14399 where
14400 St: AsRef<str>,
14401 {
14402 self._scopes.insert(String::from(scope.as_ref()));
14403 self
14404 }
14405 /// Identifies the authorization scope(s) for the method you are building.
14406 ///
14407 /// See [`Self::add_scope()`] for details.
14408 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTagTemplatePatchCall<'a, C>
14409 where
14410 I: IntoIterator<Item = St>,
14411 St: AsRef<str>,
14412 {
14413 self._scopes
14414 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14415 self
14416 }
14417
14418 /// Removes all scopes, and no default scope will be used either.
14419 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14420 /// for details).
14421 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplatePatchCall<'a, C> {
14422 self._scopes.clear();
14423 self
14424 }
14425}
14426
14427/// Sets the access control policy for a resource. Replaces any existing policy. Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. Callers must have following Google IAM permission - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - `datacatalog.entries.setIamPolicy` to set policies on entries. - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
14428///
14429/// A builder for the *locations.tagTemplates.setIamPolicy* method supported by a *project* resource.
14430/// It is not used directly, but through a [`ProjectMethods`] instance.
14431///
14432/// # Example
14433///
14434/// Instantiate a resource method builder
14435///
14436/// ```test_harness,no_run
14437/// # extern crate hyper;
14438/// # extern crate hyper_rustls;
14439/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
14440/// use datacatalog1_beta1::api::SetIamPolicyRequest;
14441/// # async fn dox() {
14442/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14443///
14444/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14445/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14446/// # .with_native_roots()
14447/// # .unwrap()
14448/// # .https_only()
14449/// # .enable_http2()
14450/// # .build();
14451///
14452/// # let executor = hyper_util::rt::TokioExecutor::new();
14453/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14454/// # secret,
14455/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14456/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14457/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14458/// # ),
14459/// # ).build().await.unwrap();
14460///
14461/// # let client = hyper_util::client::legacy::Client::builder(
14462/// # hyper_util::rt::TokioExecutor::new()
14463/// # )
14464/// # .build(
14465/// # hyper_rustls::HttpsConnectorBuilder::new()
14466/// # .with_native_roots()
14467/// # .unwrap()
14468/// # .https_or_http()
14469/// # .enable_http2()
14470/// # .build()
14471/// # );
14472/// # let mut hub = DataCatalog::new(client, auth);
14473/// // As the method needs a request, you would usually fill it with the desired information
14474/// // into the respective structure. Some of the parts shown here might not be applicable !
14475/// // Values shown here are possibly random and not representative !
14476/// let mut req = SetIamPolicyRequest::default();
14477///
14478/// // You can configure optional parameters by calling the respective setters at will, and
14479/// // execute the final call using `doit()`.
14480/// // Values shown here are possibly random and not representative !
14481/// let result = hub.projects().locations_tag_templates_set_iam_policy(req, "resource")
14482/// .doit().await;
14483/// # }
14484/// ```
14485pub struct ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
14486where
14487 C: 'a,
14488{
14489 hub: &'a DataCatalog<C>,
14490 _request: SetIamPolicyRequest,
14491 _resource: String,
14492 _delegate: Option<&'a mut dyn common::Delegate>,
14493 _additional_params: HashMap<String, String>,
14494 _scopes: BTreeSet<String>,
14495}
14496
14497impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {}
14498
14499impl<'a, C> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
14500where
14501 C: common::Connector,
14502{
14503 /// Perform the operation you have build so far.
14504 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14505 use std::borrow::Cow;
14506 use std::io::{Read, Seek};
14507
14508 use common::{url::Params, ToParts};
14509 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14510
14511 let mut dd = common::DefaultDelegate;
14512 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14513 dlg.begin(common::MethodInfo {
14514 id: "datacatalog.projects.locations.tagTemplates.setIamPolicy",
14515 http_method: hyper::Method::POST,
14516 });
14517
14518 for &field in ["alt", "resource"].iter() {
14519 if self._additional_params.contains_key(field) {
14520 dlg.finished(false);
14521 return Err(common::Error::FieldClash(field));
14522 }
14523 }
14524
14525 let mut params = Params::with_capacity(4 + self._additional_params.len());
14526 params.push("resource", self._resource);
14527
14528 params.extend(self._additional_params.iter());
14529
14530 params.push("alt", "json");
14531 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
14532 if self._scopes.is_empty() {
14533 self._scopes
14534 .insert(Scope::CloudPlatform.as_ref().to_string());
14535 }
14536
14537 #[allow(clippy::single_element_loop)]
14538 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14539 url = params.uri_replacement(url, param_name, find_this, true);
14540 }
14541 {
14542 let to_remove = ["resource"];
14543 params.remove_params(&to_remove);
14544 }
14545
14546 let url = params.parse_with_url(&url);
14547
14548 let mut json_mime_type = mime::APPLICATION_JSON;
14549 let mut request_value_reader = {
14550 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14551 common::remove_json_null_values(&mut value);
14552 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14553 serde_json::to_writer(&mut dst, &value).unwrap();
14554 dst
14555 };
14556 let request_size = request_value_reader
14557 .seek(std::io::SeekFrom::End(0))
14558 .unwrap();
14559 request_value_reader
14560 .seek(std::io::SeekFrom::Start(0))
14561 .unwrap();
14562
14563 loop {
14564 let token = match self
14565 .hub
14566 .auth
14567 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14568 .await
14569 {
14570 Ok(token) => token,
14571 Err(e) => match dlg.token(e) {
14572 Ok(token) => token,
14573 Err(e) => {
14574 dlg.finished(false);
14575 return Err(common::Error::MissingToken(e));
14576 }
14577 },
14578 };
14579 request_value_reader
14580 .seek(std::io::SeekFrom::Start(0))
14581 .unwrap();
14582 let mut req_result = {
14583 let client = &self.hub.client;
14584 dlg.pre_request();
14585 let mut req_builder = hyper::Request::builder()
14586 .method(hyper::Method::POST)
14587 .uri(url.as_str())
14588 .header(USER_AGENT, self.hub._user_agent.clone());
14589
14590 if let Some(token) = token.as_ref() {
14591 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14592 }
14593
14594 let request = req_builder
14595 .header(CONTENT_TYPE, json_mime_type.to_string())
14596 .header(CONTENT_LENGTH, request_size as u64)
14597 .body(common::to_body(
14598 request_value_reader.get_ref().clone().into(),
14599 ));
14600
14601 client.request(request.unwrap()).await
14602 };
14603
14604 match req_result {
14605 Err(err) => {
14606 if let common::Retry::After(d) = dlg.http_error(&err) {
14607 sleep(d).await;
14608 continue;
14609 }
14610 dlg.finished(false);
14611 return Err(common::Error::HttpError(err));
14612 }
14613 Ok(res) => {
14614 let (mut parts, body) = res.into_parts();
14615 let mut body = common::Body::new(body);
14616 if !parts.status.is_success() {
14617 let bytes = common::to_bytes(body).await.unwrap_or_default();
14618 let error = serde_json::from_str(&common::to_string(&bytes));
14619 let response = common::to_response(parts, bytes.into());
14620
14621 if let common::Retry::After(d) =
14622 dlg.http_failure(&response, error.as_ref().ok())
14623 {
14624 sleep(d).await;
14625 continue;
14626 }
14627
14628 dlg.finished(false);
14629
14630 return Err(match error {
14631 Ok(value) => common::Error::BadRequest(value),
14632 _ => common::Error::Failure(response),
14633 });
14634 }
14635 let response = {
14636 let bytes = common::to_bytes(body).await.unwrap_or_default();
14637 let encoded = common::to_string(&bytes);
14638 match serde_json::from_str(&encoded) {
14639 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14640 Err(error) => {
14641 dlg.response_json_decode_error(&encoded, &error);
14642 return Err(common::Error::JsonDecodeError(
14643 encoded.to_string(),
14644 error,
14645 ));
14646 }
14647 }
14648 };
14649
14650 dlg.finished(true);
14651 return Ok(response);
14652 }
14653 }
14654 }
14655 }
14656
14657 ///
14658 /// Sets the *request* property to the given value.
14659 ///
14660 /// Even though the property as already been set when instantiating this call,
14661 /// we provide this method for API completeness.
14662 pub fn request(
14663 mut self,
14664 new_value: SetIamPolicyRequest,
14665 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
14666 self._request = new_value;
14667 self
14668 }
14669 /// 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.
14670 ///
14671 /// Sets the *resource* path property to the given value.
14672 ///
14673 /// Even though the property as already been set when instantiating this call,
14674 /// we provide this method for API completeness.
14675 pub fn resource(
14676 mut self,
14677 new_value: &str,
14678 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
14679 self._resource = new_value.to_string();
14680 self
14681 }
14682 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14683 /// while executing the actual API request.
14684 ///
14685 /// ````text
14686 /// It should be used to handle progress information, and to implement a certain level of resilience.
14687 /// ````
14688 ///
14689 /// Sets the *delegate* property to the given value.
14690 pub fn delegate(
14691 mut self,
14692 new_value: &'a mut dyn common::Delegate,
14693 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
14694 self._delegate = Some(new_value);
14695 self
14696 }
14697
14698 /// Set any additional parameter of the query string used in the request.
14699 /// It should be used to set parameters which are not yet available through their own
14700 /// setters.
14701 ///
14702 /// Please note that this method must not be used to set any of the known parameters
14703 /// which have their own setter method. If done anyway, the request will fail.
14704 ///
14705 /// # Additional Parameters
14706 ///
14707 /// * *$.xgafv* (query-string) - V1 error format.
14708 /// * *access_token* (query-string) - OAuth access token.
14709 /// * *alt* (query-string) - Data format for response.
14710 /// * *callback* (query-string) - JSONP
14711 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14712 /// * *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.
14713 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14714 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14715 /// * *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.
14716 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14717 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14718 pub fn param<T>(
14719 mut self,
14720 name: T,
14721 value: T,
14722 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
14723 where
14724 T: AsRef<str>,
14725 {
14726 self._additional_params
14727 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14728 self
14729 }
14730
14731 /// Identifies the authorization scope for the method you are building.
14732 ///
14733 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14734 /// [`Scope::CloudPlatform`].
14735 ///
14736 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14737 /// tokens for more than one scope.
14738 ///
14739 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14740 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14741 /// sufficient, a read-write scope will do as well.
14742 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
14743 where
14744 St: AsRef<str>,
14745 {
14746 self._scopes.insert(String::from(scope.as_ref()));
14747 self
14748 }
14749 /// Identifies the authorization scope(s) for the method you are building.
14750 ///
14751 /// See [`Self::add_scope()`] for details.
14752 pub fn add_scopes<I, St>(
14753 mut self,
14754 scopes: I,
14755 ) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C>
14756 where
14757 I: IntoIterator<Item = St>,
14758 St: AsRef<str>,
14759 {
14760 self._scopes
14761 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14762 self
14763 }
14764
14765 /// Removes all scopes, and no default scope will be used either.
14766 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14767 /// for details).
14768 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateSetIamPolicyCall<'a, C> {
14769 self._scopes.clear();
14770 self
14771 }
14772}
14773
14774/// Returns the caller's permissions on a resource. If the resource does not exist, an empty set of permissions is returned (We don't return a `NOT_FOUND` error). Supported resources are: - Tag templates. - Entries. - Entry groups. Note, this method cannot be used to manage policies for BigQuery, Pub/Sub and any external Google Cloud Platform resources synced to Data Catalog. A caller is not required to have Google IAM permission to make this request.
14775///
14776/// A builder for the *locations.tagTemplates.testIamPermissions* method supported by a *project* resource.
14777/// It is not used directly, but through a [`ProjectMethods`] instance.
14778///
14779/// # Example
14780///
14781/// Instantiate a resource method builder
14782///
14783/// ```test_harness,no_run
14784/// # extern crate hyper;
14785/// # extern crate hyper_rustls;
14786/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
14787/// use datacatalog1_beta1::api::TestIamPermissionsRequest;
14788/// # async fn dox() {
14789/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14790///
14791/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14792/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14793/// # .with_native_roots()
14794/// # .unwrap()
14795/// # .https_only()
14796/// # .enable_http2()
14797/// # .build();
14798///
14799/// # let executor = hyper_util::rt::TokioExecutor::new();
14800/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14801/// # secret,
14802/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14803/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14804/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14805/// # ),
14806/// # ).build().await.unwrap();
14807///
14808/// # let client = hyper_util::client::legacy::Client::builder(
14809/// # hyper_util::rt::TokioExecutor::new()
14810/// # )
14811/// # .build(
14812/// # hyper_rustls::HttpsConnectorBuilder::new()
14813/// # .with_native_roots()
14814/// # .unwrap()
14815/// # .https_or_http()
14816/// # .enable_http2()
14817/// # .build()
14818/// # );
14819/// # let mut hub = DataCatalog::new(client, auth);
14820/// // As the method needs a request, you would usually fill it with the desired information
14821/// // into the respective structure. Some of the parts shown here might not be applicable !
14822/// // Values shown here are possibly random and not representative !
14823/// let mut req = TestIamPermissionsRequest::default();
14824///
14825/// // You can configure optional parameters by calling the respective setters at will, and
14826/// // execute the final call using `doit()`.
14827/// // Values shown here are possibly random and not representative !
14828/// let result = hub.projects().locations_tag_templates_test_iam_permissions(req, "resource")
14829/// .doit().await;
14830/// # }
14831/// ```
14832pub struct ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
14833where
14834 C: 'a,
14835{
14836 hub: &'a DataCatalog<C>,
14837 _request: TestIamPermissionsRequest,
14838 _resource: String,
14839 _delegate: Option<&'a mut dyn common::Delegate>,
14840 _additional_params: HashMap<String, String>,
14841 _scopes: BTreeSet<String>,
14842}
14843
14844impl<'a, C> common::CallBuilder for ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {}
14845
14846impl<'a, C> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
14847where
14848 C: common::Connector,
14849{
14850 /// Perform the operation you have build so far.
14851 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
14852 use std::borrow::Cow;
14853 use std::io::{Read, Seek};
14854
14855 use common::{url::Params, ToParts};
14856 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14857
14858 let mut dd = common::DefaultDelegate;
14859 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14860 dlg.begin(common::MethodInfo {
14861 id: "datacatalog.projects.locations.tagTemplates.testIamPermissions",
14862 http_method: hyper::Method::POST,
14863 });
14864
14865 for &field in ["alt", "resource"].iter() {
14866 if self._additional_params.contains_key(field) {
14867 dlg.finished(false);
14868 return Err(common::Error::FieldClash(field));
14869 }
14870 }
14871
14872 let mut params = Params::with_capacity(4 + self._additional_params.len());
14873 params.push("resource", self._resource);
14874
14875 params.extend(self._additional_params.iter());
14876
14877 params.push("alt", "json");
14878 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
14879 if self._scopes.is_empty() {
14880 self._scopes
14881 .insert(Scope::CloudPlatform.as_ref().to_string());
14882 }
14883
14884 #[allow(clippy::single_element_loop)]
14885 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14886 url = params.uri_replacement(url, param_name, find_this, true);
14887 }
14888 {
14889 let to_remove = ["resource"];
14890 params.remove_params(&to_remove);
14891 }
14892
14893 let url = params.parse_with_url(&url);
14894
14895 let mut json_mime_type = mime::APPLICATION_JSON;
14896 let mut request_value_reader = {
14897 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14898 common::remove_json_null_values(&mut value);
14899 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14900 serde_json::to_writer(&mut dst, &value).unwrap();
14901 dst
14902 };
14903 let request_size = request_value_reader
14904 .seek(std::io::SeekFrom::End(0))
14905 .unwrap();
14906 request_value_reader
14907 .seek(std::io::SeekFrom::Start(0))
14908 .unwrap();
14909
14910 loop {
14911 let token = match self
14912 .hub
14913 .auth
14914 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14915 .await
14916 {
14917 Ok(token) => token,
14918 Err(e) => match dlg.token(e) {
14919 Ok(token) => token,
14920 Err(e) => {
14921 dlg.finished(false);
14922 return Err(common::Error::MissingToken(e));
14923 }
14924 },
14925 };
14926 request_value_reader
14927 .seek(std::io::SeekFrom::Start(0))
14928 .unwrap();
14929 let mut req_result = {
14930 let client = &self.hub.client;
14931 dlg.pre_request();
14932 let mut req_builder = hyper::Request::builder()
14933 .method(hyper::Method::POST)
14934 .uri(url.as_str())
14935 .header(USER_AGENT, self.hub._user_agent.clone());
14936
14937 if let Some(token) = token.as_ref() {
14938 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14939 }
14940
14941 let request = req_builder
14942 .header(CONTENT_TYPE, json_mime_type.to_string())
14943 .header(CONTENT_LENGTH, request_size as u64)
14944 .body(common::to_body(
14945 request_value_reader.get_ref().clone().into(),
14946 ));
14947
14948 client.request(request.unwrap()).await
14949 };
14950
14951 match req_result {
14952 Err(err) => {
14953 if let common::Retry::After(d) = dlg.http_error(&err) {
14954 sleep(d).await;
14955 continue;
14956 }
14957 dlg.finished(false);
14958 return Err(common::Error::HttpError(err));
14959 }
14960 Ok(res) => {
14961 let (mut parts, body) = res.into_parts();
14962 let mut body = common::Body::new(body);
14963 if !parts.status.is_success() {
14964 let bytes = common::to_bytes(body).await.unwrap_or_default();
14965 let error = serde_json::from_str(&common::to_string(&bytes));
14966 let response = common::to_response(parts, bytes.into());
14967
14968 if let common::Retry::After(d) =
14969 dlg.http_failure(&response, error.as_ref().ok())
14970 {
14971 sleep(d).await;
14972 continue;
14973 }
14974
14975 dlg.finished(false);
14976
14977 return Err(match error {
14978 Ok(value) => common::Error::BadRequest(value),
14979 _ => common::Error::Failure(response),
14980 });
14981 }
14982 let response = {
14983 let bytes = common::to_bytes(body).await.unwrap_or_default();
14984 let encoded = common::to_string(&bytes);
14985 match serde_json::from_str(&encoded) {
14986 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14987 Err(error) => {
14988 dlg.response_json_decode_error(&encoded, &error);
14989 return Err(common::Error::JsonDecodeError(
14990 encoded.to_string(),
14991 error,
14992 ));
14993 }
14994 }
14995 };
14996
14997 dlg.finished(true);
14998 return Ok(response);
14999 }
15000 }
15001 }
15002 }
15003
15004 ///
15005 /// Sets the *request* property to the given value.
15006 ///
15007 /// Even though the property as already been set when instantiating this call,
15008 /// we provide this method for API completeness.
15009 pub fn request(
15010 mut self,
15011 new_value: TestIamPermissionsRequest,
15012 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
15013 self._request = new_value;
15014 self
15015 }
15016 /// 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.
15017 ///
15018 /// Sets the *resource* path property to the given value.
15019 ///
15020 /// Even though the property as already been set when instantiating this call,
15021 /// we provide this method for API completeness.
15022 pub fn resource(
15023 mut self,
15024 new_value: &str,
15025 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
15026 self._resource = new_value.to_string();
15027 self
15028 }
15029 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15030 /// while executing the actual API request.
15031 ///
15032 /// ````text
15033 /// It should be used to handle progress information, and to implement a certain level of resilience.
15034 /// ````
15035 ///
15036 /// Sets the *delegate* property to the given value.
15037 pub fn delegate(
15038 mut self,
15039 new_value: &'a mut dyn common::Delegate,
15040 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
15041 self._delegate = Some(new_value);
15042 self
15043 }
15044
15045 /// Set any additional parameter of the query string used in the request.
15046 /// It should be used to set parameters which are not yet available through their own
15047 /// setters.
15048 ///
15049 /// Please note that this method must not be used to set any of the known parameters
15050 /// which have their own setter method. If done anyway, the request will fail.
15051 ///
15052 /// # Additional Parameters
15053 ///
15054 /// * *$.xgafv* (query-string) - V1 error format.
15055 /// * *access_token* (query-string) - OAuth access token.
15056 /// * *alt* (query-string) - Data format for response.
15057 /// * *callback* (query-string) - JSONP
15058 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15059 /// * *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.
15060 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15061 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15062 /// * *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.
15063 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15064 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15065 pub fn param<T>(
15066 mut self,
15067 name: T,
15068 value: T,
15069 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
15070 where
15071 T: AsRef<str>,
15072 {
15073 self._additional_params
15074 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15075 self
15076 }
15077
15078 /// Identifies the authorization scope for the method you are building.
15079 ///
15080 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15081 /// [`Scope::CloudPlatform`].
15082 ///
15083 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15084 /// tokens for more than one scope.
15085 ///
15086 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15087 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15088 /// sufficient, a read-write scope will do as well.
15089 pub fn add_scope<St>(
15090 mut self,
15091 scope: St,
15092 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
15093 where
15094 St: AsRef<str>,
15095 {
15096 self._scopes.insert(String::from(scope.as_ref()));
15097 self
15098 }
15099 /// Identifies the authorization scope(s) for the method you are building.
15100 ///
15101 /// See [`Self::add_scope()`] for details.
15102 pub fn add_scopes<I, St>(
15103 mut self,
15104 scopes: I,
15105 ) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C>
15106 where
15107 I: IntoIterator<Item = St>,
15108 St: AsRef<str>,
15109 {
15110 self._scopes
15111 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15112 self
15113 }
15114
15115 /// Removes all scopes, and no default scope will be used either.
15116 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15117 /// for details).
15118 pub fn clear_scopes(mut self) -> ProjectLocationTagTemplateTestIamPermissionCall<'a, C> {
15119 self._scopes.clear();
15120 self
15121 }
15122}
15123
15124/// Creates a policy tag in the specified taxonomy.
15125///
15126/// A builder for the *locations.taxonomies.policyTags.create* method supported by a *project* resource.
15127/// It is not used directly, but through a [`ProjectMethods`] instance.
15128///
15129/// # Example
15130///
15131/// Instantiate a resource method builder
15132///
15133/// ```test_harness,no_run
15134/// # extern crate hyper;
15135/// # extern crate hyper_rustls;
15136/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
15137/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1PolicyTag;
15138/// # async fn dox() {
15139/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15140///
15141/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15142/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15143/// # .with_native_roots()
15144/// # .unwrap()
15145/// # .https_only()
15146/// # .enable_http2()
15147/// # .build();
15148///
15149/// # let executor = hyper_util::rt::TokioExecutor::new();
15150/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15151/// # secret,
15152/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15153/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15154/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15155/// # ),
15156/// # ).build().await.unwrap();
15157///
15158/// # let client = hyper_util::client::legacy::Client::builder(
15159/// # hyper_util::rt::TokioExecutor::new()
15160/// # )
15161/// # .build(
15162/// # hyper_rustls::HttpsConnectorBuilder::new()
15163/// # .with_native_roots()
15164/// # .unwrap()
15165/// # .https_or_http()
15166/// # .enable_http2()
15167/// # .build()
15168/// # );
15169/// # let mut hub = DataCatalog::new(client, auth);
15170/// // As the method needs a request, you would usually fill it with the desired information
15171/// // into the respective structure. Some of the parts shown here might not be applicable !
15172/// // Values shown here are possibly random and not representative !
15173/// let mut req = GoogleCloudDatacatalogV1beta1PolicyTag::default();
15174///
15175/// // You can configure optional parameters by calling the respective setters at will, and
15176/// // execute the final call using `doit()`.
15177/// // Values shown here are possibly random and not representative !
15178/// let result = hub.projects().locations_taxonomies_policy_tags_create(req, "parent")
15179/// .doit().await;
15180/// # }
15181/// ```
15182pub struct ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
15183where
15184 C: 'a,
15185{
15186 hub: &'a DataCatalog<C>,
15187 _request: GoogleCloudDatacatalogV1beta1PolicyTag,
15188 _parent: String,
15189 _delegate: Option<&'a mut dyn common::Delegate>,
15190 _additional_params: HashMap<String, String>,
15191 _scopes: BTreeSet<String>,
15192}
15193
15194impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {}
15195
15196impl<'a, C> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
15197where
15198 C: common::Connector,
15199{
15200 /// Perform the operation you have build so far.
15201 pub async fn doit(
15202 mut self,
15203 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1PolicyTag)> {
15204 use std::borrow::Cow;
15205 use std::io::{Read, Seek};
15206
15207 use common::{url::Params, ToParts};
15208 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15209
15210 let mut dd = common::DefaultDelegate;
15211 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15212 dlg.begin(common::MethodInfo {
15213 id: "datacatalog.projects.locations.taxonomies.policyTags.create",
15214 http_method: hyper::Method::POST,
15215 });
15216
15217 for &field in ["alt", "parent"].iter() {
15218 if self._additional_params.contains_key(field) {
15219 dlg.finished(false);
15220 return Err(common::Error::FieldClash(field));
15221 }
15222 }
15223
15224 let mut params = Params::with_capacity(4 + self._additional_params.len());
15225 params.push("parent", self._parent);
15226
15227 params.extend(self._additional_params.iter());
15228
15229 params.push("alt", "json");
15230 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/policyTags";
15231 if self._scopes.is_empty() {
15232 self._scopes
15233 .insert(Scope::CloudPlatform.as_ref().to_string());
15234 }
15235
15236 #[allow(clippy::single_element_loop)]
15237 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15238 url = params.uri_replacement(url, param_name, find_this, true);
15239 }
15240 {
15241 let to_remove = ["parent"];
15242 params.remove_params(&to_remove);
15243 }
15244
15245 let url = params.parse_with_url(&url);
15246
15247 let mut json_mime_type = mime::APPLICATION_JSON;
15248 let mut request_value_reader = {
15249 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15250 common::remove_json_null_values(&mut value);
15251 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15252 serde_json::to_writer(&mut dst, &value).unwrap();
15253 dst
15254 };
15255 let request_size = request_value_reader
15256 .seek(std::io::SeekFrom::End(0))
15257 .unwrap();
15258 request_value_reader
15259 .seek(std::io::SeekFrom::Start(0))
15260 .unwrap();
15261
15262 loop {
15263 let token = match self
15264 .hub
15265 .auth
15266 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15267 .await
15268 {
15269 Ok(token) => token,
15270 Err(e) => match dlg.token(e) {
15271 Ok(token) => token,
15272 Err(e) => {
15273 dlg.finished(false);
15274 return Err(common::Error::MissingToken(e));
15275 }
15276 },
15277 };
15278 request_value_reader
15279 .seek(std::io::SeekFrom::Start(0))
15280 .unwrap();
15281 let mut req_result = {
15282 let client = &self.hub.client;
15283 dlg.pre_request();
15284 let mut req_builder = hyper::Request::builder()
15285 .method(hyper::Method::POST)
15286 .uri(url.as_str())
15287 .header(USER_AGENT, self.hub._user_agent.clone());
15288
15289 if let Some(token) = token.as_ref() {
15290 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15291 }
15292
15293 let request = req_builder
15294 .header(CONTENT_TYPE, json_mime_type.to_string())
15295 .header(CONTENT_LENGTH, request_size as u64)
15296 .body(common::to_body(
15297 request_value_reader.get_ref().clone().into(),
15298 ));
15299
15300 client.request(request.unwrap()).await
15301 };
15302
15303 match req_result {
15304 Err(err) => {
15305 if let common::Retry::After(d) = dlg.http_error(&err) {
15306 sleep(d).await;
15307 continue;
15308 }
15309 dlg.finished(false);
15310 return Err(common::Error::HttpError(err));
15311 }
15312 Ok(res) => {
15313 let (mut parts, body) = res.into_parts();
15314 let mut body = common::Body::new(body);
15315 if !parts.status.is_success() {
15316 let bytes = common::to_bytes(body).await.unwrap_or_default();
15317 let error = serde_json::from_str(&common::to_string(&bytes));
15318 let response = common::to_response(parts, bytes.into());
15319
15320 if let common::Retry::After(d) =
15321 dlg.http_failure(&response, error.as_ref().ok())
15322 {
15323 sleep(d).await;
15324 continue;
15325 }
15326
15327 dlg.finished(false);
15328
15329 return Err(match error {
15330 Ok(value) => common::Error::BadRequest(value),
15331 _ => common::Error::Failure(response),
15332 });
15333 }
15334 let response = {
15335 let bytes = common::to_bytes(body).await.unwrap_or_default();
15336 let encoded = common::to_string(&bytes);
15337 match serde_json::from_str(&encoded) {
15338 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15339 Err(error) => {
15340 dlg.response_json_decode_error(&encoded, &error);
15341 return Err(common::Error::JsonDecodeError(
15342 encoded.to_string(),
15343 error,
15344 ));
15345 }
15346 }
15347 };
15348
15349 dlg.finished(true);
15350 return Ok(response);
15351 }
15352 }
15353 }
15354 }
15355
15356 ///
15357 /// Sets the *request* property to the given value.
15358 ///
15359 /// Even though the property as already been set when instantiating this call,
15360 /// we provide this method for API completeness.
15361 pub fn request(
15362 mut self,
15363 new_value: GoogleCloudDatacatalogV1beta1PolicyTag,
15364 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
15365 self._request = new_value;
15366 self
15367 }
15368 /// Required. Resource name of the taxonomy that the policy tag will belong to.
15369 ///
15370 /// Sets the *parent* path property to the given value.
15371 ///
15372 /// Even though the property as already been set when instantiating this call,
15373 /// we provide this method for API completeness.
15374 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
15375 self._parent = new_value.to_string();
15376 self
15377 }
15378 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15379 /// while executing the actual API request.
15380 ///
15381 /// ````text
15382 /// It should be used to handle progress information, and to implement a certain level of resilience.
15383 /// ````
15384 ///
15385 /// Sets the *delegate* property to the given value.
15386 pub fn delegate(
15387 mut self,
15388 new_value: &'a mut dyn common::Delegate,
15389 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
15390 self._delegate = Some(new_value);
15391 self
15392 }
15393
15394 /// Set any additional parameter of the query string used in the request.
15395 /// It should be used to set parameters which are not yet available through their own
15396 /// setters.
15397 ///
15398 /// Please note that this method must not be used to set any of the known parameters
15399 /// which have their own setter method. If done anyway, the request will fail.
15400 ///
15401 /// # Additional Parameters
15402 ///
15403 /// * *$.xgafv* (query-string) - V1 error format.
15404 /// * *access_token* (query-string) - OAuth access token.
15405 /// * *alt* (query-string) - Data format for response.
15406 /// * *callback* (query-string) - JSONP
15407 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15408 /// * *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.
15409 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15410 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15411 /// * *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.
15412 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15413 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15414 pub fn param<T>(
15415 mut self,
15416 name: T,
15417 value: T,
15418 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
15419 where
15420 T: AsRef<str>,
15421 {
15422 self._additional_params
15423 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15424 self
15425 }
15426
15427 /// Identifies the authorization scope for the method you are building.
15428 ///
15429 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15430 /// [`Scope::CloudPlatform`].
15431 ///
15432 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15433 /// tokens for more than one scope.
15434 ///
15435 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15436 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15437 /// sufficient, a read-write scope will do as well.
15438 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
15439 where
15440 St: AsRef<str>,
15441 {
15442 self._scopes.insert(String::from(scope.as_ref()));
15443 self
15444 }
15445 /// Identifies the authorization scope(s) for the method you are building.
15446 ///
15447 /// See [`Self::add_scope()`] for details.
15448 pub fn add_scopes<I, St>(
15449 mut self,
15450 scopes: I,
15451 ) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C>
15452 where
15453 I: IntoIterator<Item = St>,
15454 St: AsRef<str>,
15455 {
15456 self._scopes
15457 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15458 self
15459 }
15460
15461 /// Removes all scopes, and no default scope will be used either.
15462 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15463 /// for details).
15464 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagCreateCall<'a, C> {
15465 self._scopes.clear();
15466 self
15467 }
15468}
15469
15470/// Deletes a policy tag. Also deletes all of its descendant policy tags.
15471///
15472/// A builder for the *locations.taxonomies.policyTags.delete* method supported by a *project* resource.
15473/// It is not used directly, but through a [`ProjectMethods`] instance.
15474///
15475/// # Example
15476///
15477/// Instantiate a resource method builder
15478///
15479/// ```test_harness,no_run
15480/// # extern crate hyper;
15481/// # extern crate hyper_rustls;
15482/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
15483/// # async fn dox() {
15484/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15485///
15486/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15487/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15488/// # .with_native_roots()
15489/// # .unwrap()
15490/// # .https_only()
15491/// # .enable_http2()
15492/// # .build();
15493///
15494/// # let executor = hyper_util::rt::TokioExecutor::new();
15495/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15496/// # secret,
15497/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15498/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15499/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15500/// # ),
15501/// # ).build().await.unwrap();
15502///
15503/// # let client = hyper_util::client::legacy::Client::builder(
15504/// # hyper_util::rt::TokioExecutor::new()
15505/// # )
15506/// # .build(
15507/// # hyper_rustls::HttpsConnectorBuilder::new()
15508/// # .with_native_roots()
15509/// # .unwrap()
15510/// # .https_or_http()
15511/// # .enable_http2()
15512/// # .build()
15513/// # );
15514/// # let mut hub = DataCatalog::new(client, auth);
15515/// // You can configure optional parameters by calling the respective setters at will, and
15516/// // execute the final call using `doit()`.
15517/// // Values shown here are possibly random and not representative !
15518/// let result = hub.projects().locations_taxonomies_policy_tags_delete("name")
15519/// .doit().await;
15520/// # }
15521/// ```
15522pub struct ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
15523where
15524 C: 'a,
15525{
15526 hub: &'a DataCatalog<C>,
15527 _name: String,
15528 _delegate: Option<&'a mut dyn common::Delegate>,
15529 _additional_params: HashMap<String, String>,
15530 _scopes: BTreeSet<String>,
15531}
15532
15533impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {}
15534
15535impl<'a, C> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
15536where
15537 C: common::Connector,
15538{
15539 /// Perform the operation you have build so far.
15540 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
15541 use std::borrow::Cow;
15542 use std::io::{Read, Seek};
15543
15544 use common::{url::Params, ToParts};
15545 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15546
15547 let mut dd = common::DefaultDelegate;
15548 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15549 dlg.begin(common::MethodInfo {
15550 id: "datacatalog.projects.locations.taxonomies.policyTags.delete",
15551 http_method: hyper::Method::DELETE,
15552 });
15553
15554 for &field in ["alt", "name"].iter() {
15555 if self._additional_params.contains_key(field) {
15556 dlg.finished(false);
15557 return Err(common::Error::FieldClash(field));
15558 }
15559 }
15560
15561 let mut params = Params::with_capacity(3 + self._additional_params.len());
15562 params.push("name", self._name);
15563
15564 params.extend(self._additional_params.iter());
15565
15566 params.push("alt", "json");
15567 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
15568 if self._scopes.is_empty() {
15569 self._scopes
15570 .insert(Scope::CloudPlatform.as_ref().to_string());
15571 }
15572
15573 #[allow(clippy::single_element_loop)]
15574 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15575 url = params.uri_replacement(url, param_name, find_this, true);
15576 }
15577 {
15578 let to_remove = ["name"];
15579 params.remove_params(&to_remove);
15580 }
15581
15582 let url = params.parse_with_url(&url);
15583
15584 loop {
15585 let token = match self
15586 .hub
15587 .auth
15588 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15589 .await
15590 {
15591 Ok(token) => token,
15592 Err(e) => match dlg.token(e) {
15593 Ok(token) => token,
15594 Err(e) => {
15595 dlg.finished(false);
15596 return Err(common::Error::MissingToken(e));
15597 }
15598 },
15599 };
15600 let mut req_result = {
15601 let client = &self.hub.client;
15602 dlg.pre_request();
15603 let mut req_builder = hyper::Request::builder()
15604 .method(hyper::Method::DELETE)
15605 .uri(url.as_str())
15606 .header(USER_AGENT, self.hub._user_agent.clone());
15607
15608 if let Some(token) = token.as_ref() {
15609 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15610 }
15611
15612 let request = req_builder
15613 .header(CONTENT_LENGTH, 0_u64)
15614 .body(common::to_body::<String>(None));
15615
15616 client.request(request.unwrap()).await
15617 };
15618
15619 match req_result {
15620 Err(err) => {
15621 if let common::Retry::After(d) = dlg.http_error(&err) {
15622 sleep(d).await;
15623 continue;
15624 }
15625 dlg.finished(false);
15626 return Err(common::Error::HttpError(err));
15627 }
15628 Ok(res) => {
15629 let (mut parts, body) = res.into_parts();
15630 let mut body = common::Body::new(body);
15631 if !parts.status.is_success() {
15632 let bytes = common::to_bytes(body).await.unwrap_or_default();
15633 let error = serde_json::from_str(&common::to_string(&bytes));
15634 let response = common::to_response(parts, bytes.into());
15635
15636 if let common::Retry::After(d) =
15637 dlg.http_failure(&response, error.as_ref().ok())
15638 {
15639 sleep(d).await;
15640 continue;
15641 }
15642
15643 dlg.finished(false);
15644
15645 return Err(match error {
15646 Ok(value) => common::Error::BadRequest(value),
15647 _ => common::Error::Failure(response),
15648 });
15649 }
15650 let response = {
15651 let bytes = common::to_bytes(body).await.unwrap_or_default();
15652 let encoded = common::to_string(&bytes);
15653 match serde_json::from_str(&encoded) {
15654 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15655 Err(error) => {
15656 dlg.response_json_decode_error(&encoded, &error);
15657 return Err(common::Error::JsonDecodeError(
15658 encoded.to_string(),
15659 error,
15660 ));
15661 }
15662 }
15663 };
15664
15665 dlg.finished(true);
15666 return Ok(response);
15667 }
15668 }
15669 }
15670 }
15671
15672 /// Required. Resource name of the policy tag to be deleted. All of its descendant policy tags will also be deleted.
15673 ///
15674 /// Sets the *name* path property to the given value.
15675 ///
15676 /// Even though the property as already been set when instantiating this call,
15677 /// we provide this method for API completeness.
15678 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
15679 self._name = new_value.to_string();
15680 self
15681 }
15682 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15683 /// while executing the actual API request.
15684 ///
15685 /// ````text
15686 /// It should be used to handle progress information, and to implement a certain level of resilience.
15687 /// ````
15688 ///
15689 /// Sets the *delegate* property to the given value.
15690 pub fn delegate(
15691 mut self,
15692 new_value: &'a mut dyn common::Delegate,
15693 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
15694 self._delegate = Some(new_value);
15695 self
15696 }
15697
15698 /// Set any additional parameter of the query string used in the request.
15699 /// It should be used to set parameters which are not yet available through their own
15700 /// setters.
15701 ///
15702 /// Please note that this method must not be used to set any of the known parameters
15703 /// which have their own setter method. If done anyway, the request will fail.
15704 ///
15705 /// # Additional Parameters
15706 ///
15707 /// * *$.xgafv* (query-string) - V1 error format.
15708 /// * *access_token* (query-string) - OAuth access token.
15709 /// * *alt* (query-string) - Data format for response.
15710 /// * *callback* (query-string) - JSONP
15711 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15712 /// * *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.
15713 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15714 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15715 /// * *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.
15716 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15717 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15718 pub fn param<T>(
15719 mut self,
15720 name: T,
15721 value: T,
15722 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
15723 where
15724 T: AsRef<str>,
15725 {
15726 self._additional_params
15727 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15728 self
15729 }
15730
15731 /// Identifies the authorization scope for the method you are building.
15732 ///
15733 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15734 /// [`Scope::CloudPlatform`].
15735 ///
15736 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15737 /// tokens for more than one scope.
15738 ///
15739 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15740 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15741 /// sufficient, a read-write scope will do as well.
15742 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
15743 where
15744 St: AsRef<str>,
15745 {
15746 self._scopes.insert(String::from(scope.as_ref()));
15747 self
15748 }
15749 /// Identifies the authorization scope(s) for the method you are building.
15750 ///
15751 /// See [`Self::add_scope()`] for details.
15752 pub fn add_scopes<I, St>(
15753 mut self,
15754 scopes: I,
15755 ) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C>
15756 where
15757 I: IntoIterator<Item = St>,
15758 St: AsRef<str>,
15759 {
15760 self._scopes
15761 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15762 self
15763 }
15764
15765 /// Removes all scopes, and no default scope will be used either.
15766 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15767 /// for details).
15768 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagDeleteCall<'a, C> {
15769 self._scopes.clear();
15770 self
15771 }
15772}
15773
15774/// Gets a policy tag.
15775///
15776/// A builder for the *locations.taxonomies.policyTags.get* method supported by a *project* resource.
15777/// It is not used directly, but through a [`ProjectMethods`] instance.
15778///
15779/// # Example
15780///
15781/// Instantiate a resource method builder
15782///
15783/// ```test_harness,no_run
15784/// # extern crate hyper;
15785/// # extern crate hyper_rustls;
15786/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
15787/// # async fn dox() {
15788/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15789///
15790/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15791/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15792/// # .with_native_roots()
15793/// # .unwrap()
15794/// # .https_only()
15795/// # .enable_http2()
15796/// # .build();
15797///
15798/// # let executor = hyper_util::rt::TokioExecutor::new();
15799/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15800/// # secret,
15801/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15802/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15803/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15804/// # ),
15805/// # ).build().await.unwrap();
15806///
15807/// # let client = hyper_util::client::legacy::Client::builder(
15808/// # hyper_util::rt::TokioExecutor::new()
15809/// # )
15810/// # .build(
15811/// # hyper_rustls::HttpsConnectorBuilder::new()
15812/// # .with_native_roots()
15813/// # .unwrap()
15814/// # .https_or_http()
15815/// # .enable_http2()
15816/// # .build()
15817/// # );
15818/// # let mut hub = DataCatalog::new(client, auth);
15819/// // You can configure optional parameters by calling the respective setters at will, and
15820/// // execute the final call using `doit()`.
15821/// // Values shown here are possibly random and not representative !
15822/// let result = hub.projects().locations_taxonomies_policy_tags_get("name")
15823/// .doit().await;
15824/// # }
15825/// ```
15826pub struct ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
15827where
15828 C: 'a,
15829{
15830 hub: &'a DataCatalog<C>,
15831 _name: String,
15832 _delegate: Option<&'a mut dyn common::Delegate>,
15833 _additional_params: HashMap<String, String>,
15834 _scopes: BTreeSet<String>,
15835}
15836
15837impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {}
15838
15839impl<'a, C> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
15840where
15841 C: common::Connector,
15842{
15843 /// Perform the operation you have build so far.
15844 pub async fn doit(
15845 mut self,
15846 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1PolicyTag)> {
15847 use std::borrow::Cow;
15848 use std::io::{Read, Seek};
15849
15850 use common::{url::Params, ToParts};
15851 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15852
15853 let mut dd = common::DefaultDelegate;
15854 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15855 dlg.begin(common::MethodInfo {
15856 id: "datacatalog.projects.locations.taxonomies.policyTags.get",
15857 http_method: hyper::Method::GET,
15858 });
15859
15860 for &field in ["alt", "name"].iter() {
15861 if self._additional_params.contains_key(field) {
15862 dlg.finished(false);
15863 return Err(common::Error::FieldClash(field));
15864 }
15865 }
15866
15867 let mut params = Params::with_capacity(3 + self._additional_params.len());
15868 params.push("name", self._name);
15869
15870 params.extend(self._additional_params.iter());
15871
15872 params.push("alt", "json");
15873 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
15874 if self._scopes.is_empty() {
15875 self._scopes
15876 .insert(Scope::CloudPlatform.as_ref().to_string());
15877 }
15878
15879 #[allow(clippy::single_element_loop)]
15880 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15881 url = params.uri_replacement(url, param_name, find_this, true);
15882 }
15883 {
15884 let to_remove = ["name"];
15885 params.remove_params(&to_remove);
15886 }
15887
15888 let url = params.parse_with_url(&url);
15889
15890 loop {
15891 let token = match self
15892 .hub
15893 .auth
15894 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15895 .await
15896 {
15897 Ok(token) => token,
15898 Err(e) => match dlg.token(e) {
15899 Ok(token) => token,
15900 Err(e) => {
15901 dlg.finished(false);
15902 return Err(common::Error::MissingToken(e));
15903 }
15904 },
15905 };
15906 let mut req_result = {
15907 let client = &self.hub.client;
15908 dlg.pre_request();
15909 let mut req_builder = hyper::Request::builder()
15910 .method(hyper::Method::GET)
15911 .uri(url.as_str())
15912 .header(USER_AGENT, self.hub._user_agent.clone());
15913
15914 if let Some(token) = token.as_ref() {
15915 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15916 }
15917
15918 let request = req_builder
15919 .header(CONTENT_LENGTH, 0_u64)
15920 .body(common::to_body::<String>(None));
15921
15922 client.request(request.unwrap()).await
15923 };
15924
15925 match req_result {
15926 Err(err) => {
15927 if let common::Retry::After(d) = dlg.http_error(&err) {
15928 sleep(d).await;
15929 continue;
15930 }
15931 dlg.finished(false);
15932 return Err(common::Error::HttpError(err));
15933 }
15934 Ok(res) => {
15935 let (mut parts, body) = res.into_parts();
15936 let mut body = common::Body::new(body);
15937 if !parts.status.is_success() {
15938 let bytes = common::to_bytes(body).await.unwrap_or_default();
15939 let error = serde_json::from_str(&common::to_string(&bytes));
15940 let response = common::to_response(parts, bytes.into());
15941
15942 if let common::Retry::After(d) =
15943 dlg.http_failure(&response, error.as_ref().ok())
15944 {
15945 sleep(d).await;
15946 continue;
15947 }
15948
15949 dlg.finished(false);
15950
15951 return Err(match error {
15952 Ok(value) => common::Error::BadRequest(value),
15953 _ => common::Error::Failure(response),
15954 });
15955 }
15956 let response = {
15957 let bytes = common::to_bytes(body).await.unwrap_or_default();
15958 let encoded = common::to_string(&bytes);
15959 match serde_json::from_str(&encoded) {
15960 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15961 Err(error) => {
15962 dlg.response_json_decode_error(&encoded, &error);
15963 return Err(common::Error::JsonDecodeError(
15964 encoded.to_string(),
15965 error,
15966 ));
15967 }
15968 }
15969 };
15970
15971 dlg.finished(true);
15972 return Ok(response);
15973 }
15974 }
15975 }
15976 }
15977
15978 /// Required. Resource name of the requested policy tag.
15979 ///
15980 /// Sets the *name* path property to the given value.
15981 ///
15982 /// Even though the property as already been set when instantiating this call,
15983 /// we provide this method for API completeness.
15984 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
15985 self._name = new_value.to_string();
15986 self
15987 }
15988 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15989 /// while executing the actual API request.
15990 ///
15991 /// ````text
15992 /// It should be used to handle progress information, and to implement a certain level of resilience.
15993 /// ````
15994 ///
15995 /// Sets the *delegate* property to the given value.
15996 pub fn delegate(
15997 mut self,
15998 new_value: &'a mut dyn common::Delegate,
15999 ) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
16000 self._delegate = Some(new_value);
16001 self
16002 }
16003
16004 /// Set any additional parameter of the query string used in the request.
16005 /// It should be used to set parameters which are not yet available through their own
16006 /// setters.
16007 ///
16008 /// Please note that this method must not be used to set any of the known parameters
16009 /// which have their own setter method. If done anyway, the request will fail.
16010 ///
16011 /// # Additional Parameters
16012 ///
16013 /// * *$.xgafv* (query-string) - V1 error format.
16014 /// * *access_token* (query-string) - OAuth access token.
16015 /// * *alt* (query-string) - Data format for response.
16016 /// * *callback* (query-string) - JSONP
16017 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16018 /// * *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.
16019 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16020 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16021 /// * *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.
16022 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16023 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16024 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
16025 where
16026 T: AsRef<str>,
16027 {
16028 self._additional_params
16029 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16030 self
16031 }
16032
16033 /// Identifies the authorization scope for the method you are building.
16034 ///
16035 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16036 /// [`Scope::CloudPlatform`].
16037 ///
16038 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16039 /// tokens for more than one scope.
16040 ///
16041 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16042 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16043 /// sufficient, a read-write scope will do as well.
16044 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
16045 where
16046 St: AsRef<str>,
16047 {
16048 self._scopes.insert(String::from(scope.as_ref()));
16049 self
16050 }
16051 /// Identifies the authorization scope(s) for the method you are building.
16052 ///
16053 /// See [`Self::add_scope()`] for details.
16054 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C>
16055 where
16056 I: IntoIterator<Item = St>,
16057 St: AsRef<str>,
16058 {
16059 self._scopes
16060 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16061 self
16062 }
16063
16064 /// Removes all scopes, and no default scope will be used either.
16065 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16066 /// for details).
16067 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagGetCall<'a, C> {
16068 self._scopes.clear();
16069 self
16070 }
16071}
16072
16073/// Gets the IAM policy for a taxonomy or a policy tag.
16074///
16075/// A builder for the *locations.taxonomies.policyTags.getIamPolicy* method supported by a *project* resource.
16076/// It is not used directly, but through a [`ProjectMethods`] instance.
16077///
16078/// # Example
16079///
16080/// Instantiate a resource method builder
16081///
16082/// ```test_harness,no_run
16083/// # extern crate hyper;
16084/// # extern crate hyper_rustls;
16085/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
16086/// use datacatalog1_beta1::api::GetIamPolicyRequest;
16087/// # async fn dox() {
16088/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16089///
16090/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16091/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16092/// # .with_native_roots()
16093/// # .unwrap()
16094/// # .https_only()
16095/// # .enable_http2()
16096/// # .build();
16097///
16098/// # let executor = hyper_util::rt::TokioExecutor::new();
16099/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16100/// # secret,
16101/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16102/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16103/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16104/// # ),
16105/// # ).build().await.unwrap();
16106///
16107/// # let client = hyper_util::client::legacy::Client::builder(
16108/// # hyper_util::rt::TokioExecutor::new()
16109/// # )
16110/// # .build(
16111/// # hyper_rustls::HttpsConnectorBuilder::new()
16112/// # .with_native_roots()
16113/// # .unwrap()
16114/// # .https_or_http()
16115/// # .enable_http2()
16116/// # .build()
16117/// # );
16118/// # let mut hub = DataCatalog::new(client, auth);
16119/// // As the method needs a request, you would usually fill it with the desired information
16120/// // into the respective structure. Some of the parts shown here might not be applicable !
16121/// // Values shown here are possibly random and not representative !
16122/// let mut req = GetIamPolicyRequest::default();
16123///
16124/// // You can configure optional parameters by calling the respective setters at will, and
16125/// // execute the final call using `doit()`.
16126/// // Values shown here are possibly random and not representative !
16127/// let result = hub.projects().locations_taxonomies_policy_tags_get_iam_policy(req, "resource")
16128/// .doit().await;
16129/// # }
16130/// ```
16131pub struct ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
16132where
16133 C: 'a,
16134{
16135 hub: &'a DataCatalog<C>,
16136 _request: GetIamPolicyRequest,
16137 _resource: String,
16138 _delegate: Option<&'a mut dyn common::Delegate>,
16139 _additional_params: HashMap<String, String>,
16140 _scopes: BTreeSet<String>,
16141}
16142
16143impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {}
16144
16145impl<'a, C> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
16146where
16147 C: common::Connector,
16148{
16149 /// Perform the operation you have build so far.
16150 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16151 use std::borrow::Cow;
16152 use std::io::{Read, Seek};
16153
16154 use common::{url::Params, ToParts};
16155 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16156
16157 let mut dd = common::DefaultDelegate;
16158 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16159 dlg.begin(common::MethodInfo {
16160 id: "datacatalog.projects.locations.taxonomies.policyTags.getIamPolicy",
16161 http_method: hyper::Method::POST,
16162 });
16163
16164 for &field in ["alt", "resource"].iter() {
16165 if self._additional_params.contains_key(field) {
16166 dlg.finished(false);
16167 return Err(common::Error::FieldClash(field));
16168 }
16169 }
16170
16171 let mut params = Params::with_capacity(4 + self._additional_params.len());
16172 params.push("resource", self._resource);
16173
16174 params.extend(self._additional_params.iter());
16175
16176 params.push("alt", "json");
16177 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
16178 if self._scopes.is_empty() {
16179 self._scopes
16180 .insert(Scope::CloudPlatform.as_ref().to_string());
16181 }
16182
16183 #[allow(clippy::single_element_loop)]
16184 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16185 url = params.uri_replacement(url, param_name, find_this, true);
16186 }
16187 {
16188 let to_remove = ["resource"];
16189 params.remove_params(&to_remove);
16190 }
16191
16192 let url = params.parse_with_url(&url);
16193
16194 let mut json_mime_type = mime::APPLICATION_JSON;
16195 let mut request_value_reader = {
16196 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16197 common::remove_json_null_values(&mut value);
16198 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16199 serde_json::to_writer(&mut dst, &value).unwrap();
16200 dst
16201 };
16202 let request_size = request_value_reader
16203 .seek(std::io::SeekFrom::End(0))
16204 .unwrap();
16205 request_value_reader
16206 .seek(std::io::SeekFrom::Start(0))
16207 .unwrap();
16208
16209 loop {
16210 let token = match self
16211 .hub
16212 .auth
16213 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16214 .await
16215 {
16216 Ok(token) => token,
16217 Err(e) => match dlg.token(e) {
16218 Ok(token) => token,
16219 Err(e) => {
16220 dlg.finished(false);
16221 return Err(common::Error::MissingToken(e));
16222 }
16223 },
16224 };
16225 request_value_reader
16226 .seek(std::io::SeekFrom::Start(0))
16227 .unwrap();
16228 let mut req_result = {
16229 let client = &self.hub.client;
16230 dlg.pre_request();
16231 let mut req_builder = hyper::Request::builder()
16232 .method(hyper::Method::POST)
16233 .uri(url.as_str())
16234 .header(USER_AGENT, self.hub._user_agent.clone());
16235
16236 if let Some(token) = token.as_ref() {
16237 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16238 }
16239
16240 let request = req_builder
16241 .header(CONTENT_TYPE, json_mime_type.to_string())
16242 .header(CONTENT_LENGTH, request_size as u64)
16243 .body(common::to_body(
16244 request_value_reader.get_ref().clone().into(),
16245 ));
16246
16247 client.request(request.unwrap()).await
16248 };
16249
16250 match req_result {
16251 Err(err) => {
16252 if let common::Retry::After(d) = dlg.http_error(&err) {
16253 sleep(d).await;
16254 continue;
16255 }
16256 dlg.finished(false);
16257 return Err(common::Error::HttpError(err));
16258 }
16259 Ok(res) => {
16260 let (mut parts, body) = res.into_parts();
16261 let mut body = common::Body::new(body);
16262 if !parts.status.is_success() {
16263 let bytes = common::to_bytes(body).await.unwrap_or_default();
16264 let error = serde_json::from_str(&common::to_string(&bytes));
16265 let response = common::to_response(parts, bytes.into());
16266
16267 if let common::Retry::After(d) =
16268 dlg.http_failure(&response, error.as_ref().ok())
16269 {
16270 sleep(d).await;
16271 continue;
16272 }
16273
16274 dlg.finished(false);
16275
16276 return Err(match error {
16277 Ok(value) => common::Error::BadRequest(value),
16278 _ => common::Error::Failure(response),
16279 });
16280 }
16281 let response = {
16282 let bytes = common::to_bytes(body).await.unwrap_or_default();
16283 let encoded = common::to_string(&bytes);
16284 match serde_json::from_str(&encoded) {
16285 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16286 Err(error) => {
16287 dlg.response_json_decode_error(&encoded, &error);
16288 return Err(common::Error::JsonDecodeError(
16289 encoded.to_string(),
16290 error,
16291 ));
16292 }
16293 }
16294 };
16295
16296 dlg.finished(true);
16297 return Ok(response);
16298 }
16299 }
16300 }
16301 }
16302
16303 ///
16304 /// Sets the *request* property to the given value.
16305 ///
16306 /// Even though the property as already been set when instantiating this call,
16307 /// we provide this method for API completeness.
16308 pub fn request(
16309 mut self,
16310 new_value: GetIamPolicyRequest,
16311 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
16312 self._request = new_value;
16313 self
16314 }
16315 /// 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.
16316 ///
16317 /// Sets the *resource* path property to the given value.
16318 ///
16319 /// Even though the property as already been set when instantiating this call,
16320 /// we provide this method for API completeness.
16321 pub fn resource(
16322 mut self,
16323 new_value: &str,
16324 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
16325 self._resource = new_value.to_string();
16326 self
16327 }
16328 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16329 /// while executing the actual API request.
16330 ///
16331 /// ````text
16332 /// It should be used to handle progress information, and to implement a certain level of resilience.
16333 /// ````
16334 ///
16335 /// Sets the *delegate* property to the given value.
16336 pub fn delegate(
16337 mut self,
16338 new_value: &'a mut dyn common::Delegate,
16339 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
16340 self._delegate = Some(new_value);
16341 self
16342 }
16343
16344 /// Set any additional parameter of the query string used in the request.
16345 /// It should be used to set parameters which are not yet available through their own
16346 /// setters.
16347 ///
16348 /// Please note that this method must not be used to set any of the known parameters
16349 /// which have their own setter method. If done anyway, the request will fail.
16350 ///
16351 /// # Additional Parameters
16352 ///
16353 /// * *$.xgafv* (query-string) - V1 error format.
16354 /// * *access_token* (query-string) - OAuth access token.
16355 /// * *alt* (query-string) - Data format for response.
16356 /// * *callback* (query-string) - JSONP
16357 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16358 /// * *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.
16359 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16360 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16361 /// * *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.
16362 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16363 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16364 pub fn param<T>(
16365 mut self,
16366 name: T,
16367 value: T,
16368 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
16369 where
16370 T: AsRef<str>,
16371 {
16372 self._additional_params
16373 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16374 self
16375 }
16376
16377 /// Identifies the authorization scope for the method you are building.
16378 ///
16379 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16380 /// [`Scope::CloudPlatform`].
16381 ///
16382 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16383 /// tokens for more than one scope.
16384 ///
16385 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16386 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16387 /// sufficient, a read-write scope will do as well.
16388 pub fn add_scope<St>(
16389 mut self,
16390 scope: St,
16391 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
16392 where
16393 St: AsRef<str>,
16394 {
16395 self._scopes.insert(String::from(scope.as_ref()));
16396 self
16397 }
16398 /// Identifies the authorization scope(s) for the method you are building.
16399 ///
16400 /// See [`Self::add_scope()`] for details.
16401 pub fn add_scopes<I, St>(
16402 mut self,
16403 scopes: I,
16404 ) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C>
16405 where
16406 I: IntoIterator<Item = St>,
16407 St: AsRef<str>,
16408 {
16409 self._scopes
16410 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16411 self
16412 }
16413
16414 /// Removes all scopes, and no default scope will be used either.
16415 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16416 /// for details).
16417 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagGetIamPolicyCall<'a, C> {
16418 self._scopes.clear();
16419 self
16420 }
16421}
16422
16423/// Lists all policy tags in a taxonomy.
16424///
16425/// A builder for the *locations.taxonomies.policyTags.list* method supported by a *project* resource.
16426/// It is not used directly, but through a [`ProjectMethods`] instance.
16427///
16428/// # Example
16429///
16430/// Instantiate a resource method builder
16431///
16432/// ```test_harness,no_run
16433/// # extern crate hyper;
16434/// # extern crate hyper_rustls;
16435/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
16436/// # async fn dox() {
16437/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16438///
16439/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16440/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16441/// # .with_native_roots()
16442/// # .unwrap()
16443/// # .https_only()
16444/// # .enable_http2()
16445/// # .build();
16446///
16447/// # let executor = hyper_util::rt::TokioExecutor::new();
16448/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16449/// # secret,
16450/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16451/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16452/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16453/// # ),
16454/// # ).build().await.unwrap();
16455///
16456/// # let client = hyper_util::client::legacy::Client::builder(
16457/// # hyper_util::rt::TokioExecutor::new()
16458/// # )
16459/// # .build(
16460/// # hyper_rustls::HttpsConnectorBuilder::new()
16461/// # .with_native_roots()
16462/// # .unwrap()
16463/// # .https_or_http()
16464/// # .enable_http2()
16465/// # .build()
16466/// # );
16467/// # let mut hub = DataCatalog::new(client, auth);
16468/// // You can configure optional parameters by calling the respective setters at will, and
16469/// // execute the final call using `doit()`.
16470/// // Values shown here are possibly random and not representative !
16471/// let result = hub.projects().locations_taxonomies_policy_tags_list("parent")
16472/// .page_token("invidunt")
16473/// .page_size(-65)
16474/// .doit().await;
16475/// # }
16476/// ```
16477pub struct ProjectLocationTaxonomyPolicyTagListCall<'a, C>
16478where
16479 C: 'a,
16480{
16481 hub: &'a DataCatalog<C>,
16482 _parent: String,
16483 _page_token: Option<String>,
16484 _page_size: Option<i32>,
16485 _delegate: Option<&'a mut dyn common::Delegate>,
16486 _additional_params: HashMap<String, String>,
16487 _scopes: BTreeSet<String>,
16488}
16489
16490impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagListCall<'a, C> {}
16491
16492impl<'a, C> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
16493where
16494 C: common::Connector,
16495{
16496 /// Perform the operation you have build so far.
16497 pub async fn doit(
16498 mut self,
16499 ) -> common::Result<(
16500 common::Response,
16501 GoogleCloudDatacatalogV1beta1ListPolicyTagsResponse,
16502 )> {
16503 use std::borrow::Cow;
16504 use std::io::{Read, Seek};
16505
16506 use common::{url::Params, ToParts};
16507 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16508
16509 let mut dd = common::DefaultDelegate;
16510 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16511 dlg.begin(common::MethodInfo {
16512 id: "datacatalog.projects.locations.taxonomies.policyTags.list",
16513 http_method: hyper::Method::GET,
16514 });
16515
16516 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
16517 if self._additional_params.contains_key(field) {
16518 dlg.finished(false);
16519 return Err(common::Error::FieldClash(field));
16520 }
16521 }
16522
16523 let mut params = Params::with_capacity(5 + self._additional_params.len());
16524 params.push("parent", self._parent);
16525 if let Some(value) = self._page_token.as_ref() {
16526 params.push("pageToken", value);
16527 }
16528 if let Some(value) = self._page_size.as_ref() {
16529 params.push("pageSize", value.to_string());
16530 }
16531
16532 params.extend(self._additional_params.iter());
16533
16534 params.push("alt", "json");
16535 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/policyTags";
16536 if self._scopes.is_empty() {
16537 self._scopes
16538 .insert(Scope::CloudPlatform.as_ref().to_string());
16539 }
16540
16541 #[allow(clippy::single_element_loop)]
16542 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16543 url = params.uri_replacement(url, param_name, find_this, true);
16544 }
16545 {
16546 let to_remove = ["parent"];
16547 params.remove_params(&to_remove);
16548 }
16549
16550 let url = params.parse_with_url(&url);
16551
16552 loop {
16553 let token = match self
16554 .hub
16555 .auth
16556 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16557 .await
16558 {
16559 Ok(token) => token,
16560 Err(e) => match dlg.token(e) {
16561 Ok(token) => token,
16562 Err(e) => {
16563 dlg.finished(false);
16564 return Err(common::Error::MissingToken(e));
16565 }
16566 },
16567 };
16568 let mut req_result = {
16569 let client = &self.hub.client;
16570 dlg.pre_request();
16571 let mut req_builder = hyper::Request::builder()
16572 .method(hyper::Method::GET)
16573 .uri(url.as_str())
16574 .header(USER_AGENT, self.hub._user_agent.clone());
16575
16576 if let Some(token) = token.as_ref() {
16577 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16578 }
16579
16580 let request = req_builder
16581 .header(CONTENT_LENGTH, 0_u64)
16582 .body(common::to_body::<String>(None));
16583
16584 client.request(request.unwrap()).await
16585 };
16586
16587 match req_result {
16588 Err(err) => {
16589 if let common::Retry::After(d) = dlg.http_error(&err) {
16590 sleep(d).await;
16591 continue;
16592 }
16593 dlg.finished(false);
16594 return Err(common::Error::HttpError(err));
16595 }
16596 Ok(res) => {
16597 let (mut parts, body) = res.into_parts();
16598 let mut body = common::Body::new(body);
16599 if !parts.status.is_success() {
16600 let bytes = common::to_bytes(body).await.unwrap_or_default();
16601 let error = serde_json::from_str(&common::to_string(&bytes));
16602 let response = common::to_response(parts, bytes.into());
16603
16604 if let common::Retry::After(d) =
16605 dlg.http_failure(&response, error.as_ref().ok())
16606 {
16607 sleep(d).await;
16608 continue;
16609 }
16610
16611 dlg.finished(false);
16612
16613 return Err(match error {
16614 Ok(value) => common::Error::BadRequest(value),
16615 _ => common::Error::Failure(response),
16616 });
16617 }
16618 let response = {
16619 let bytes = common::to_bytes(body).await.unwrap_or_default();
16620 let encoded = common::to_string(&bytes);
16621 match serde_json::from_str(&encoded) {
16622 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16623 Err(error) => {
16624 dlg.response_json_decode_error(&encoded, &error);
16625 return Err(common::Error::JsonDecodeError(
16626 encoded.to_string(),
16627 error,
16628 ));
16629 }
16630 }
16631 };
16632
16633 dlg.finished(true);
16634 return Ok(response);
16635 }
16636 }
16637 }
16638 }
16639
16640 /// Required. Resource name of the taxonomy to list the policy tags of.
16641 ///
16642 /// Sets the *parent* path property to the given value.
16643 ///
16644 /// Even though the property as already been set when instantiating this call,
16645 /// we provide this method for API completeness.
16646 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
16647 self._parent = new_value.to_string();
16648 self
16649 }
16650 /// The next_page_token value returned from a previous List request, if any. If not set, defaults to an empty string.
16651 ///
16652 /// Sets the *page token* query property to the given value.
16653 pub fn page_token(
16654 mut self,
16655 new_value: &str,
16656 ) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
16657 self._page_token = Some(new_value.to_string());
16658 self
16659 }
16660 /// The maximum number of items to return. Must be a value between 1 and 1000. If not set, defaults to 50.
16661 ///
16662 /// Sets the *page size* query property to the given value.
16663 pub fn page_size(mut self, new_value: i32) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
16664 self._page_size = Some(new_value);
16665 self
16666 }
16667 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16668 /// while executing the actual API request.
16669 ///
16670 /// ````text
16671 /// It should be used to handle progress information, and to implement a certain level of resilience.
16672 /// ````
16673 ///
16674 /// Sets the *delegate* property to the given value.
16675 pub fn delegate(
16676 mut self,
16677 new_value: &'a mut dyn common::Delegate,
16678 ) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
16679 self._delegate = Some(new_value);
16680 self
16681 }
16682
16683 /// Set any additional parameter of the query string used in the request.
16684 /// It should be used to set parameters which are not yet available through their own
16685 /// setters.
16686 ///
16687 /// Please note that this method must not be used to set any of the known parameters
16688 /// which have their own setter method. If done anyway, the request will fail.
16689 ///
16690 /// # Additional Parameters
16691 ///
16692 /// * *$.xgafv* (query-string) - V1 error format.
16693 /// * *access_token* (query-string) - OAuth access token.
16694 /// * *alt* (query-string) - Data format for response.
16695 /// * *callback* (query-string) - JSONP
16696 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16697 /// * *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.
16698 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16699 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16700 /// * *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.
16701 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16702 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16703 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
16704 where
16705 T: AsRef<str>,
16706 {
16707 self._additional_params
16708 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16709 self
16710 }
16711
16712 /// Identifies the authorization scope for the method you are building.
16713 ///
16714 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16715 /// [`Scope::CloudPlatform`].
16716 ///
16717 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16718 /// tokens for more than one scope.
16719 ///
16720 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16721 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16722 /// sufficient, a read-write scope will do as well.
16723 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
16724 where
16725 St: AsRef<str>,
16726 {
16727 self._scopes.insert(String::from(scope.as_ref()));
16728 self
16729 }
16730 /// Identifies the authorization scope(s) for the method you are building.
16731 ///
16732 /// See [`Self::add_scope()`] for details.
16733 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C>
16734 where
16735 I: IntoIterator<Item = St>,
16736 St: AsRef<str>,
16737 {
16738 self._scopes
16739 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16740 self
16741 }
16742
16743 /// Removes all scopes, and no default scope will be used either.
16744 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16745 /// for details).
16746 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagListCall<'a, C> {
16747 self._scopes.clear();
16748 self
16749 }
16750}
16751
16752/// Updates a policy tag.
16753///
16754/// A builder for the *locations.taxonomies.policyTags.patch* method supported by a *project* resource.
16755/// It is not used directly, but through a [`ProjectMethods`] instance.
16756///
16757/// # Example
16758///
16759/// Instantiate a resource method builder
16760///
16761/// ```test_harness,no_run
16762/// # extern crate hyper;
16763/// # extern crate hyper_rustls;
16764/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
16765/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1PolicyTag;
16766/// # async fn dox() {
16767/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16768///
16769/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16770/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16771/// # .with_native_roots()
16772/// # .unwrap()
16773/// # .https_only()
16774/// # .enable_http2()
16775/// # .build();
16776///
16777/// # let executor = hyper_util::rt::TokioExecutor::new();
16778/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16779/// # secret,
16780/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16781/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16782/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16783/// # ),
16784/// # ).build().await.unwrap();
16785///
16786/// # let client = hyper_util::client::legacy::Client::builder(
16787/// # hyper_util::rt::TokioExecutor::new()
16788/// # )
16789/// # .build(
16790/// # hyper_rustls::HttpsConnectorBuilder::new()
16791/// # .with_native_roots()
16792/// # .unwrap()
16793/// # .https_or_http()
16794/// # .enable_http2()
16795/// # .build()
16796/// # );
16797/// # let mut hub = DataCatalog::new(client, auth);
16798/// // As the method needs a request, you would usually fill it with the desired information
16799/// // into the respective structure. Some of the parts shown here might not be applicable !
16800/// // Values shown here are possibly random and not representative !
16801/// let mut req = GoogleCloudDatacatalogV1beta1PolicyTag::default();
16802///
16803/// // You can configure optional parameters by calling the respective setters at will, and
16804/// // execute the final call using `doit()`.
16805/// // Values shown here are possibly random and not representative !
16806/// let result = hub.projects().locations_taxonomies_policy_tags_patch(req, "name")
16807/// .update_mask(FieldMask::new::<&str>(&[]))
16808/// .doit().await;
16809/// # }
16810/// ```
16811pub struct ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
16812where
16813 C: 'a,
16814{
16815 hub: &'a DataCatalog<C>,
16816 _request: GoogleCloudDatacatalogV1beta1PolicyTag,
16817 _name: String,
16818 _update_mask: Option<common::FieldMask>,
16819 _delegate: Option<&'a mut dyn common::Delegate>,
16820 _additional_params: HashMap<String, String>,
16821 _scopes: BTreeSet<String>,
16822}
16823
16824impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {}
16825
16826impl<'a, C> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
16827where
16828 C: common::Connector,
16829{
16830 /// Perform the operation you have build so far.
16831 pub async fn doit(
16832 mut self,
16833 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1PolicyTag)> {
16834 use std::borrow::Cow;
16835 use std::io::{Read, Seek};
16836
16837 use common::{url::Params, ToParts};
16838 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16839
16840 let mut dd = common::DefaultDelegate;
16841 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16842 dlg.begin(common::MethodInfo {
16843 id: "datacatalog.projects.locations.taxonomies.policyTags.patch",
16844 http_method: hyper::Method::PATCH,
16845 });
16846
16847 for &field in ["alt", "name", "updateMask"].iter() {
16848 if self._additional_params.contains_key(field) {
16849 dlg.finished(false);
16850 return Err(common::Error::FieldClash(field));
16851 }
16852 }
16853
16854 let mut params = Params::with_capacity(5 + self._additional_params.len());
16855 params.push("name", self._name);
16856 if let Some(value) = self._update_mask.as_ref() {
16857 params.push("updateMask", value.to_string());
16858 }
16859
16860 params.extend(self._additional_params.iter());
16861
16862 params.push("alt", "json");
16863 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
16864 if self._scopes.is_empty() {
16865 self._scopes
16866 .insert(Scope::CloudPlatform.as_ref().to_string());
16867 }
16868
16869 #[allow(clippy::single_element_loop)]
16870 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16871 url = params.uri_replacement(url, param_name, find_this, true);
16872 }
16873 {
16874 let to_remove = ["name"];
16875 params.remove_params(&to_remove);
16876 }
16877
16878 let url = params.parse_with_url(&url);
16879
16880 let mut json_mime_type = mime::APPLICATION_JSON;
16881 let mut request_value_reader = {
16882 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16883 common::remove_json_null_values(&mut value);
16884 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16885 serde_json::to_writer(&mut dst, &value).unwrap();
16886 dst
16887 };
16888 let request_size = request_value_reader
16889 .seek(std::io::SeekFrom::End(0))
16890 .unwrap();
16891 request_value_reader
16892 .seek(std::io::SeekFrom::Start(0))
16893 .unwrap();
16894
16895 loop {
16896 let token = match self
16897 .hub
16898 .auth
16899 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16900 .await
16901 {
16902 Ok(token) => token,
16903 Err(e) => match dlg.token(e) {
16904 Ok(token) => token,
16905 Err(e) => {
16906 dlg.finished(false);
16907 return Err(common::Error::MissingToken(e));
16908 }
16909 },
16910 };
16911 request_value_reader
16912 .seek(std::io::SeekFrom::Start(0))
16913 .unwrap();
16914 let mut req_result = {
16915 let client = &self.hub.client;
16916 dlg.pre_request();
16917 let mut req_builder = hyper::Request::builder()
16918 .method(hyper::Method::PATCH)
16919 .uri(url.as_str())
16920 .header(USER_AGENT, self.hub._user_agent.clone());
16921
16922 if let Some(token) = token.as_ref() {
16923 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16924 }
16925
16926 let request = req_builder
16927 .header(CONTENT_TYPE, json_mime_type.to_string())
16928 .header(CONTENT_LENGTH, request_size as u64)
16929 .body(common::to_body(
16930 request_value_reader.get_ref().clone().into(),
16931 ));
16932
16933 client.request(request.unwrap()).await
16934 };
16935
16936 match req_result {
16937 Err(err) => {
16938 if let common::Retry::After(d) = dlg.http_error(&err) {
16939 sleep(d).await;
16940 continue;
16941 }
16942 dlg.finished(false);
16943 return Err(common::Error::HttpError(err));
16944 }
16945 Ok(res) => {
16946 let (mut parts, body) = res.into_parts();
16947 let mut body = common::Body::new(body);
16948 if !parts.status.is_success() {
16949 let bytes = common::to_bytes(body).await.unwrap_or_default();
16950 let error = serde_json::from_str(&common::to_string(&bytes));
16951 let response = common::to_response(parts, bytes.into());
16952
16953 if let common::Retry::After(d) =
16954 dlg.http_failure(&response, error.as_ref().ok())
16955 {
16956 sleep(d).await;
16957 continue;
16958 }
16959
16960 dlg.finished(false);
16961
16962 return Err(match error {
16963 Ok(value) => common::Error::BadRequest(value),
16964 _ => common::Error::Failure(response),
16965 });
16966 }
16967 let response = {
16968 let bytes = common::to_bytes(body).await.unwrap_or_default();
16969 let encoded = common::to_string(&bytes);
16970 match serde_json::from_str(&encoded) {
16971 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16972 Err(error) => {
16973 dlg.response_json_decode_error(&encoded, &error);
16974 return Err(common::Error::JsonDecodeError(
16975 encoded.to_string(),
16976 error,
16977 ));
16978 }
16979 }
16980 };
16981
16982 dlg.finished(true);
16983 return Ok(response);
16984 }
16985 }
16986 }
16987 }
16988
16989 ///
16990 /// Sets the *request* property to the given value.
16991 ///
16992 /// Even though the property as already been set when instantiating this call,
16993 /// we provide this method for API completeness.
16994 pub fn request(
16995 mut self,
16996 new_value: GoogleCloudDatacatalogV1beta1PolicyTag,
16997 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
16998 self._request = new_value;
16999 self
17000 }
17001 /// Identifier. Resource name of this policy tag, whose format is: "projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{id}".
17002 ///
17003 /// Sets the *name* path property to the given value.
17004 ///
17005 /// Even though the property as already been set when instantiating this call,
17006 /// we provide this method for API completeness.
17007 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
17008 self._name = new_value.to_string();
17009 self
17010 }
17011 /// The update mask applies to the resource. Only display_name, description and parent_policy_tag can be updated and thus can be listed in the mask. If update_mask is not provided, all allowed fields (i.e. display_name, description and parent) will be updated. For more information including the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If not set, defaults to all of the fields that are allowed to update.
17012 ///
17013 /// Sets the *update mask* query property to the given value.
17014 pub fn update_mask(
17015 mut self,
17016 new_value: common::FieldMask,
17017 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
17018 self._update_mask = Some(new_value);
17019 self
17020 }
17021 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17022 /// while executing the actual API request.
17023 ///
17024 /// ````text
17025 /// It should be used to handle progress information, and to implement a certain level of resilience.
17026 /// ````
17027 ///
17028 /// Sets the *delegate* property to the given value.
17029 pub fn delegate(
17030 mut self,
17031 new_value: &'a mut dyn common::Delegate,
17032 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
17033 self._delegate = Some(new_value);
17034 self
17035 }
17036
17037 /// Set any additional parameter of the query string used in the request.
17038 /// It should be used to set parameters which are not yet available through their own
17039 /// setters.
17040 ///
17041 /// Please note that this method must not be used to set any of the known parameters
17042 /// which have their own setter method. If done anyway, the request will fail.
17043 ///
17044 /// # Additional Parameters
17045 ///
17046 /// * *$.xgafv* (query-string) - V1 error format.
17047 /// * *access_token* (query-string) - OAuth access token.
17048 /// * *alt* (query-string) - Data format for response.
17049 /// * *callback* (query-string) - JSONP
17050 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17051 /// * *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.
17052 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17053 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17054 /// * *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.
17055 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17056 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17057 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
17058 where
17059 T: AsRef<str>,
17060 {
17061 self._additional_params
17062 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17063 self
17064 }
17065
17066 /// Identifies the authorization scope for the method you are building.
17067 ///
17068 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17069 /// [`Scope::CloudPlatform`].
17070 ///
17071 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17072 /// tokens for more than one scope.
17073 ///
17074 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17075 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17076 /// sufficient, a read-write scope will do as well.
17077 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
17078 where
17079 St: AsRef<str>,
17080 {
17081 self._scopes.insert(String::from(scope.as_ref()));
17082 self
17083 }
17084 /// Identifies the authorization scope(s) for the method you are building.
17085 ///
17086 /// See [`Self::add_scope()`] for details.
17087 pub fn add_scopes<I, St>(
17088 mut self,
17089 scopes: I,
17090 ) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C>
17091 where
17092 I: IntoIterator<Item = St>,
17093 St: AsRef<str>,
17094 {
17095 self._scopes
17096 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17097 self
17098 }
17099
17100 /// Removes all scopes, and no default scope will be used either.
17101 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17102 /// for details).
17103 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagPatchCall<'a, C> {
17104 self._scopes.clear();
17105 self
17106 }
17107}
17108
17109/// Sets the IAM policy for a taxonomy or a policy tag.
17110///
17111/// A builder for the *locations.taxonomies.policyTags.setIamPolicy* method supported by a *project* resource.
17112/// It is not used directly, but through a [`ProjectMethods`] instance.
17113///
17114/// # Example
17115///
17116/// Instantiate a resource method builder
17117///
17118/// ```test_harness,no_run
17119/// # extern crate hyper;
17120/// # extern crate hyper_rustls;
17121/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
17122/// use datacatalog1_beta1::api::SetIamPolicyRequest;
17123/// # async fn dox() {
17124/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17125///
17126/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17127/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17128/// # .with_native_roots()
17129/// # .unwrap()
17130/// # .https_only()
17131/// # .enable_http2()
17132/// # .build();
17133///
17134/// # let executor = hyper_util::rt::TokioExecutor::new();
17135/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17136/// # secret,
17137/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17138/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17139/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17140/// # ),
17141/// # ).build().await.unwrap();
17142///
17143/// # let client = hyper_util::client::legacy::Client::builder(
17144/// # hyper_util::rt::TokioExecutor::new()
17145/// # )
17146/// # .build(
17147/// # hyper_rustls::HttpsConnectorBuilder::new()
17148/// # .with_native_roots()
17149/// # .unwrap()
17150/// # .https_or_http()
17151/// # .enable_http2()
17152/// # .build()
17153/// # );
17154/// # let mut hub = DataCatalog::new(client, auth);
17155/// // As the method needs a request, you would usually fill it with the desired information
17156/// // into the respective structure. Some of the parts shown here might not be applicable !
17157/// // Values shown here are possibly random and not representative !
17158/// let mut req = SetIamPolicyRequest::default();
17159///
17160/// // You can configure optional parameters by calling the respective setters at will, and
17161/// // execute the final call using `doit()`.
17162/// // Values shown here are possibly random and not representative !
17163/// let result = hub.projects().locations_taxonomies_policy_tags_set_iam_policy(req, "resource")
17164/// .doit().await;
17165/// # }
17166/// ```
17167pub struct ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
17168where
17169 C: 'a,
17170{
17171 hub: &'a DataCatalog<C>,
17172 _request: SetIamPolicyRequest,
17173 _resource: String,
17174 _delegate: Option<&'a mut dyn common::Delegate>,
17175 _additional_params: HashMap<String, String>,
17176 _scopes: BTreeSet<String>,
17177}
17178
17179impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {}
17180
17181impl<'a, C> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
17182where
17183 C: common::Connector,
17184{
17185 /// Perform the operation you have build so far.
17186 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
17187 use std::borrow::Cow;
17188 use std::io::{Read, Seek};
17189
17190 use common::{url::Params, ToParts};
17191 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17192
17193 let mut dd = common::DefaultDelegate;
17194 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17195 dlg.begin(common::MethodInfo {
17196 id: "datacatalog.projects.locations.taxonomies.policyTags.setIamPolicy",
17197 http_method: hyper::Method::POST,
17198 });
17199
17200 for &field in ["alt", "resource"].iter() {
17201 if self._additional_params.contains_key(field) {
17202 dlg.finished(false);
17203 return Err(common::Error::FieldClash(field));
17204 }
17205 }
17206
17207 let mut params = Params::with_capacity(4 + self._additional_params.len());
17208 params.push("resource", self._resource);
17209
17210 params.extend(self._additional_params.iter());
17211
17212 params.push("alt", "json");
17213 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
17214 if self._scopes.is_empty() {
17215 self._scopes
17216 .insert(Scope::CloudPlatform.as_ref().to_string());
17217 }
17218
17219 #[allow(clippy::single_element_loop)]
17220 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17221 url = params.uri_replacement(url, param_name, find_this, true);
17222 }
17223 {
17224 let to_remove = ["resource"];
17225 params.remove_params(&to_remove);
17226 }
17227
17228 let url = params.parse_with_url(&url);
17229
17230 let mut json_mime_type = mime::APPLICATION_JSON;
17231 let mut request_value_reader = {
17232 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17233 common::remove_json_null_values(&mut value);
17234 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17235 serde_json::to_writer(&mut dst, &value).unwrap();
17236 dst
17237 };
17238 let request_size = request_value_reader
17239 .seek(std::io::SeekFrom::End(0))
17240 .unwrap();
17241 request_value_reader
17242 .seek(std::io::SeekFrom::Start(0))
17243 .unwrap();
17244
17245 loop {
17246 let token = match self
17247 .hub
17248 .auth
17249 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17250 .await
17251 {
17252 Ok(token) => token,
17253 Err(e) => match dlg.token(e) {
17254 Ok(token) => token,
17255 Err(e) => {
17256 dlg.finished(false);
17257 return Err(common::Error::MissingToken(e));
17258 }
17259 },
17260 };
17261 request_value_reader
17262 .seek(std::io::SeekFrom::Start(0))
17263 .unwrap();
17264 let mut req_result = {
17265 let client = &self.hub.client;
17266 dlg.pre_request();
17267 let mut req_builder = hyper::Request::builder()
17268 .method(hyper::Method::POST)
17269 .uri(url.as_str())
17270 .header(USER_AGENT, self.hub._user_agent.clone());
17271
17272 if let Some(token) = token.as_ref() {
17273 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17274 }
17275
17276 let request = req_builder
17277 .header(CONTENT_TYPE, json_mime_type.to_string())
17278 .header(CONTENT_LENGTH, request_size as u64)
17279 .body(common::to_body(
17280 request_value_reader.get_ref().clone().into(),
17281 ));
17282
17283 client.request(request.unwrap()).await
17284 };
17285
17286 match req_result {
17287 Err(err) => {
17288 if let common::Retry::After(d) = dlg.http_error(&err) {
17289 sleep(d).await;
17290 continue;
17291 }
17292 dlg.finished(false);
17293 return Err(common::Error::HttpError(err));
17294 }
17295 Ok(res) => {
17296 let (mut parts, body) = res.into_parts();
17297 let mut body = common::Body::new(body);
17298 if !parts.status.is_success() {
17299 let bytes = common::to_bytes(body).await.unwrap_or_default();
17300 let error = serde_json::from_str(&common::to_string(&bytes));
17301 let response = common::to_response(parts, bytes.into());
17302
17303 if let common::Retry::After(d) =
17304 dlg.http_failure(&response, error.as_ref().ok())
17305 {
17306 sleep(d).await;
17307 continue;
17308 }
17309
17310 dlg.finished(false);
17311
17312 return Err(match error {
17313 Ok(value) => common::Error::BadRequest(value),
17314 _ => common::Error::Failure(response),
17315 });
17316 }
17317 let response = {
17318 let bytes = common::to_bytes(body).await.unwrap_or_default();
17319 let encoded = common::to_string(&bytes);
17320 match serde_json::from_str(&encoded) {
17321 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17322 Err(error) => {
17323 dlg.response_json_decode_error(&encoded, &error);
17324 return Err(common::Error::JsonDecodeError(
17325 encoded.to_string(),
17326 error,
17327 ));
17328 }
17329 }
17330 };
17331
17332 dlg.finished(true);
17333 return Ok(response);
17334 }
17335 }
17336 }
17337 }
17338
17339 ///
17340 /// Sets the *request* property to the given value.
17341 ///
17342 /// Even though the property as already been set when instantiating this call,
17343 /// we provide this method for API completeness.
17344 pub fn request(
17345 mut self,
17346 new_value: SetIamPolicyRequest,
17347 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
17348 self._request = new_value;
17349 self
17350 }
17351 /// 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.
17352 ///
17353 /// Sets the *resource* path property to the given value.
17354 ///
17355 /// Even though the property as already been set when instantiating this call,
17356 /// we provide this method for API completeness.
17357 pub fn resource(
17358 mut self,
17359 new_value: &str,
17360 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
17361 self._resource = new_value.to_string();
17362 self
17363 }
17364 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17365 /// while executing the actual API request.
17366 ///
17367 /// ````text
17368 /// It should be used to handle progress information, and to implement a certain level of resilience.
17369 /// ````
17370 ///
17371 /// Sets the *delegate* property to the given value.
17372 pub fn delegate(
17373 mut self,
17374 new_value: &'a mut dyn common::Delegate,
17375 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
17376 self._delegate = Some(new_value);
17377 self
17378 }
17379
17380 /// Set any additional parameter of the query string used in the request.
17381 /// It should be used to set parameters which are not yet available through their own
17382 /// setters.
17383 ///
17384 /// Please note that this method must not be used to set any of the known parameters
17385 /// which have their own setter method. If done anyway, the request will fail.
17386 ///
17387 /// # Additional Parameters
17388 ///
17389 /// * *$.xgafv* (query-string) - V1 error format.
17390 /// * *access_token* (query-string) - OAuth access token.
17391 /// * *alt* (query-string) - Data format for response.
17392 /// * *callback* (query-string) - JSONP
17393 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17394 /// * *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.
17395 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17396 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17397 /// * *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.
17398 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17399 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17400 pub fn param<T>(
17401 mut self,
17402 name: T,
17403 value: T,
17404 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
17405 where
17406 T: AsRef<str>,
17407 {
17408 self._additional_params
17409 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17410 self
17411 }
17412
17413 /// Identifies the authorization scope for the method you are building.
17414 ///
17415 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17416 /// [`Scope::CloudPlatform`].
17417 ///
17418 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17419 /// tokens for more than one scope.
17420 ///
17421 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17422 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17423 /// sufficient, a read-write scope will do as well.
17424 pub fn add_scope<St>(
17425 mut self,
17426 scope: St,
17427 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
17428 where
17429 St: AsRef<str>,
17430 {
17431 self._scopes.insert(String::from(scope.as_ref()));
17432 self
17433 }
17434 /// Identifies the authorization scope(s) for the method you are building.
17435 ///
17436 /// See [`Self::add_scope()`] for details.
17437 pub fn add_scopes<I, St>(
17438 mut self,
17439 scopes: I,
17440 ) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C>
17441 where
17442 I: IntoIterator<Item = St>,
17443 St: AsRef<str>,
17444 {
17445 self._scopes
17446 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17447 self
17448 }
17449
17450 /// Removes all scopes, and no default scope will be used either.
17451 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17452 /// for details).
17453 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagSetIamPolicyCall<'a, C> {
17454 self._scopes.clear();
17455 self
17456 }
17457}
17458
17459/// Returns the permissions that a caller has on the specified taxonomy or policy tag.
17460///
17461/// A builder for the *locations.taxonomies.policyTags.testIamPermissions* method supported by a *project* resource.
17462/// It is not used directly, but through a [`ProjectMethods`] instance.
17463///
17464/// # Example
17465///
17466/// Instantiate a resource method builder
17467///
17468/// ```test_harness,no_run
17469/// # extern crate hyper;
17470/// # extern crate hyper_rustls;
17471/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
17472/// use datacatalog1_beta1::api::TestIamPermissionsRequest;
17473/// # async fn dox() {
17474/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17475///
17476/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17477/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17478/// # .with_native_roots()
17479/// # .unwrap()
17480/// # .https_only()
17481/// # .enable_http2()
17482/// # .build();
17483///
17484/// # let executor = hyper_util::rt::TokioExecutor::new();
17485/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17486/// # secret,
17487/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17488/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17489/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17490/// # ),
17491/// # ).build().await.unwrap();
17492///
17493/// # let client = hyper_util::client::legacy::Client::builder(
17494/// # hyper_util::rt::TokioExecutor::new()
17495/// # )
17496/// # .build(
17497/// # hyper_rustls::HttpsConnectorBuilder::new()
17498/// # .with_native_roots()
17499/// # .unwrap()
17500/// # .https_or_http()
17501/// # .enable_http2()
17502/// # .build()
17503/// # );
17504/// # let mut hub = DataCatalog::new(client, auth);
17505/// // As the method needs a request, you would usually fill it with the desired information
17506/// // into the respective structure. Some of the parts shown here might not be applicable !
17507/// // Values shown here are possibly random and not representative !
17508/// let mut req = TestIamPermissionsRequest::default();
17509///
17510/// // You can configure optional parameters by calling the respective setters at will, and
17511/// // execute the final call using `doit()`.
17512/// // Values shown here are possibly random and not representative !
17513/// let result = hub.projects().locations_taxonomies_policy_tags_test_iam_permissions(req, "resource")
17514/// .doit().await;
17515/// # }
17516/// ```
17517pub struct ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
17518where
17519 C: 'a,
17520{
17521 hub: &'a DataCatalog<C>,
17522 _request: TestIamPermissionsRequest,
17523 _resource: String,
17524 _delegate: Option<&'a mut dyn common::Delegate>,
17525 _additional_params: HashMap<String, String>,
17526 _scopes: BTreeSet<String>,
17527}
17528
17529impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {}
17530
17531impl<'a, C> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
17532where
17533 C: common::Connector,
17534{
17535 /// Perform the operation you have build so far.
17536 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
17537 use std::borrow::Cow;
17538 use std::io::{Read, Seek};
17539
17540 use common::{url::Params, ToParts};
17541 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17542
17543 let mut dd = common::DefaultDelegate;
17544 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17545 dlg.begin(common::MethodInfo {
17546 id: "datacatalog.projects.locations.taxonomies.policyTags.testIamPermissions",
17547 http_method: hyper::Method::POST,
17548 });
17549
17550 for &field in ["alt", "resource"].iter() {
17551 if self._additional_params.contains_key(field) {
17552 dlg.finished(false);
17553 return Err(common::Error::FieldClash(field));
17554 }
17555 }
17556
17557 let mut params = Params::with_capacity(4 + self._additional_params.len());
17558 params.push("resource", self._resource);
17559
17560 params.extend(self._additional_params.iter());
17561
17562 params.push("alt", "json");
17563 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
17564 if self._scopes.is_empty() {
17565 self._scopes
17566 .insert(Scope::CloudPlatform.as_ref().to_string());
17567 }
17568
17569 #[allow(clippy::single_element_loop)]
17570 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17571 url = params.uri_replacement(url, param_name, find_this, true);
17572 }
17573 {
17574 let to_remove = ["resource"];
17575 params.remove_params(&to_remove);
17576 }
17577
17578 let url = params.parse_with_url(&url);
17579
17580 let mut json_mime_type = mime::APPLICATION_JSON;
17581 let mut request_value_reader = {
17582 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17583 common::remove_json_null_values(&mut value);
17584 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17585 serde_json::to_writer(&mut dst, &value).unwrap();
17586 dst
17587 };
17588 let request_size = request_value_reader
17589 .seek(std::io::SeekFrom::End(0))
17590 .unwrap();
17591 request_value_reader
17592 .seek(std::io::SeekFrom::Start(0))
17593 .unwrap();
17594
17595 loop {
17596 let token = match self
17597 .hub
17598 .auth
17599 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17600 .await
17601 {
17602 Ok(token) => token,
17603 Err(e) => match dlg.token(e) {
17604 Ok(token) => token,
17605 Err(e) => {
17606 dlg.finished(false);
17607 return Err(common::Error::MissingToken(e));
17608 }
17609 },
17610 };
17611 request_value_reader
17612 .seek(std::io::SeekFrom::Start(0))
17613 .unwrap();
17614 let mut req_result = {
17615 let client = &self.hub.client;
17616 dlg.pre_request();
17617 let mut req_builder = hyper::Request::builder()
17618 .method(hyper::Method::POST)
17619 .uri(url.as_str())
17620 .header(USER_AGENT, self.hub._user_agent.clone());
17621
17622 if let Some(token) = token.as_ref() {
17623 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17624 }
17625
17626 let request = req_builder
17627 .header(CONTENT_TYPE, json_mime_type.to_string())
17628 .header(CONTENT_LENGTH, request_size as u64)
17629 .body(common::to_body(
17630 request_value_reader.get_ref().clone().into(),
17631 ));
17632
17633 client.request(request.unwrap()).await
17634 };
17635
17636 match req_result {
17637 Err(err) => {
17638 if let common::Retry::After(d) = dlg.http_error(&err) {
17639 sleep(d).await;
17640 continue;
17641 }
17642 dlg.finished(false);
17643 return Err(common::Error::HttpError(err));
17644 }
17645 Ok(res) => {
17646 let (mut parts, body) = res.into_parts();
17647 let mut body = common::Body::new(body);
17648 if !parts.status.is_success() {
17649 let bytes = common::to_bytes(body).await.unwrap_or_default();
17650 let error = serde_json::from_str(&common::to_string(&bytes));
17651 let response = common::to_response(parts, bytes.into());
17652
17653 if let common::Retry::After(d) =
17654 dlg.http_failure(&response, error.as_ref().ok())
17655 {
17656 sleep(d).await;
17657 continue;
17658 }
17659
17660 dlg.finished(false);
17661
17662 return Err(match error {
17663 Ok(value) => common::Error::BadRequest(value),
17664 _ => common::Error::Failure(response),
17665 });
17666 }
17667 let response = {
17668 let bytes = common::to_bytes(body).await.unwrap_or_default();
17669 let encoded = common::to_string(&bytes);
17670 match serde_json::from_str(&encoded) {
17671 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17672 Err(error) => {
17673 dlg.response_json_decode_error(&encoded, &error);
17674 return Err(common::Error::JsonDecodeError(
17675 encoded.to_string(),
17676 error,
17677 ));
17678 }
17679 }
17680 };
17681
17682 dlg.finished(true);
17683 return Ok(response);
17684 }
17685 }
17686 }
17687 }
17688
17689 ///
17690 /// Sets the *request* property to the given value.
17691 ///
17692 /// Even though the property as already been set when instantiating this call,
17693 /// we provide this method for API completeness.
17694 pub fn request(
17695 mut self,
17696 new_value: TestIamPermissionsRequest,
17697 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
17698 self._request = new_value;
17699 self
17700 }
17701 /// 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.
17702 ///
17703 /// Sets the *resource* path property to the given value.
17704 ///
17705 /// Even though the property as already been set when instantiating this call,
17706 /// we provide this method for API completeness.
17707 pub fn resource(
17708 mut self,
17709 new_value: &str,
17710 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
17711 self._resource = new_value.to_string();
17712 self
17713 }
17714 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17715 /// while executing the actual API request.
17716 ///
17717 /// ````text
17718 /// It should be used to handle progress information, and to implement a certain level of resilience.
17719 /// ````
17720 ///
17721 /// Sets the *delegate* property to the given value.
17722 pub fn delegate(
17723 mut self,
17724 new_value: &'a mut dyn common::Delegate,
17725 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
17726 self._delegate = Some(new_value);
17727 self
17728 }
17729
17730 /// Set any additional parameter of the query string used in the request.
17731 /// It should be used to set parameters which are not yet available through their own
17732 /// setters.
17733 ///
17734 /// Please note that this method must not be used to set any of the known parameters
17735 /// which have their own setter method. If done anyway, the request will fail.
17736 ///
17737 /// # Additional Parameters
17738 ///
17739 /// * *$.xgafv* (query-string) - V1 error format.
17740 /// * *access_token* (query-string) - OAuth access token.
17741 /// * *alt* (query-string) - Data format for response.
17742 /// * *callback* (query-string) - JSONP
17743 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17744 /// * *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.
17745 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17746 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17747 /// * *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.
17748 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17749 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17750 pub fn param<T>(
17751 mut self,
17752 name: T,
17753 value: T,
17754 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
17755 where
17756 T: AsRef<str>,
17757 {
17758 self._additional_params
17759 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17760 self
17761 }
17762
17763 /// Identifies the authorization scope for the method you are building.
17764 ///
17765 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17766 /// [`Scope::CloudPlatform`].
17767 ///
17768 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17769 /// tokens for more than one scope.
17770 ///
17771 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17772 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17773 /// sufficient, a read-write scope will do as well.
17774 pub fn add_scope<St>(
17775 mut self,
17776 scope: St,
17777 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
17778 where
17779 St: AsRef<str>,
17780 {
17781 self._scopes.insert(String::from(scope.as_ref()));
17782 self
17783 }
17784 /// Identifies the authorization scope(s) for the method you are building.
17785 ///
17786 /// See [`Self::add_scope()`] for details.
17787 pub fn add_scopes<I, St>(
17788 mut self,
17789 scopes: I,
17790 ) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C>
17791 where
17792 I: IntoIterator<Item = St>,
17793 St: AsRef<str>,
17794 {
17795 self._scopes
17796 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17797 self
17798 }
17799
17800 /// Removes all scopes, and no default scope will be used either.
17801 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17802 /// for details).
17803 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPolicyTagTestIamPermissionCall<'a, C> {
17804 self._scopes.clear();
17805 self
17806 }
17807}
17808
17809/// Creates a taxonomy in the specified project.
17810///
17811/// A builder for the *locations.taxonomies.create* method supported by a *project* resource.
17812/// It is not used directly, but through a [`ProjectMethods`] instance.
17813///
17814/// # Example
17815///
17816/// Instantiate a resource method builder
17817///
17818/// ```test_harness,no_run
17819/// # extern crate hyper;
17820/// # extern crate hyper_rustls;
17821/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
17822/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Taxonomy;
17823/// # async fn dox() {
17824/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17825///
17826/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17827/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17828/// # .with_native_roots()
17829/// # .unwrap()
17830/// # .https_only()
17831/// # .enable_http2()
17832/// # .build();
17833///
17834/// # let executor = hyper_util::rt::TokioExecutor::new();
17835/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17836/// # secret,
17837/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17838/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17839/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17840/// # ),
17841/// # ).build().await.unwrap();
17842///
17843/// # let client = hyper_util::client::legacy::Client::builder(
17844/// # hyper_util::rt::TokioExecutor::new()
17845/// # )
17846/// # .build(
17847/// # hyper_rustls::HttpsConnectorBuilder::new()
17848/// # .with_native_roots()
17849/// # .unwrap()
17850/// # .https_or_http()
17851/// # .enable_http2()
17852/// # .build()
17853/// # );
17854/// # let mut hub = DataCatalog::new(client, auth);
17855/// // As the method needs a request, you would usually fill it with the desired information
17856/// // into the respective structure. Some of the parts shown here might not be applicable !
17857/// // Values shown here are possibly random and not representative !
17858/// let mut req = GoogleCloudDatacatalogV1beta1Taxonomy::default();
17859///
17860/// // You can configure optional parameters by calling the respective setters at will, and
17861/// // execute the final call using `doit()`.
17862/// // Values shown here are possibly random and not representative !
17863/// let result = hub.projects().locations_taxonomies_create(req, "parent")
17864/// .doit().await;
17865/// # }
17866/// ```
17867pub struct ProjectLocationTaxonomyCreateCall<'a, C>
17868where
17869 C: 'a,
17870{
17871 hub: &'a DataCatalog<C>,
17872 _request: GoogleCloudDatacatalogV1beta1Taxonomy,
17873 _parent: String,
17874 _delegate: Option<&'a mut dyn common::Delegate>,
17875 _additional_params: HashMap<String, String>,
17876 _scopes: BTreeSet<String>,
17877}
17878
17879impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyCreateCall<'a, C> {}
17880
17881impl<'a, C> ProjectLocationTaxonomyCreateCall<'a, C>
17882where
17883 C: common::Connector,
17884{
17885 /// Perform the operation you have build so far.
17886 pub async fn doit(
17887 mut self,
17888 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Taxonomy)> {
17889 use std::borrow::Cow;
17890 use std::io::{Read, Seek};
17891
17892 use common::{url::Params, ToParts};
17893 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17894
17895 let mut dd = common::DefaultDelegate;
17896 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17897 dlg.begin(common::MethodInfo {
17898 id: "datacatalog.projects.locations.taxonomies.create",
17899 http_method: hyper::Method::POST,
17900 });
17901
17902 for &field in ["alt", "parent"].iter() {
17903 if self._additional_params.contains_key(field) {
17904 dlg.finished(false);
17905 return Err(common::Error::FieldClash(field));
17906 }
17907 }
17908
17909 let mut params = Params::with_capacity(4 + self._additional_params.len());
17910 params.push("parent", self._parent);
17911
17912 params.extend(self._additional_params.iter());
17913
17914 params.push("alt", "json");
17915 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/taxonomies";
17916 if self._scopes.is_empty() {
17917 self._scopes
17918 .insert(Scope::CloudPlatform.as_ref().to_string());
17919 }
17920
17921 #[allow(clippy::single_element_loop)]
17922 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17923 url = params.uri_replacement(url, param_name, find_this, true);
17924 }
17925 {
17926 let to_remove = ["parent"];
17927 params.remove_params(&to_remove);
17928 }
17929
17930 let url = params.parse_with_url(&url);
17931
17932 let mut json_mime_type = mime::APPLICATION_JSON;
17933 let mut request_value_reader = {
17934 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17935 common::remove_json_null_values(&mut value);
17936 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17937 serde_json::to_writer(&mut dst, &value).unwrap();
17938 dst
17939 };
17940 let request_size = request_value_reader
17941 .seek(std::io::SeekFrom::End(0))
17942 .unwrap();
17943 request_value_reader
17944 .seek(std::io::SeekFrom::Start(0))
17945 .unwrap();
17946
17947 loop {
17948 let token = match self
17949 .hub
17950 .auth
17951 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17952 .await
17953 {
17954 Ok(token) => token,
17955 Err(e) => match dlg.token(e) {
17956 Ok(token) => token,
17957 Err(e) => {
17958 dlg.finished(false);
17959 return Err(common::Error::MissingToken(e));
17960 }
17961 },
17962 };
17963 request_value_reader
17964 .seek(std::io::SeekFrom::Start(0))
17965 .unwrap();
17966 let mut req_result = {
17967 let client = &self.hub.client;
17968 dlg.pre_request();
17969 let mut req_builder = hyper::Request::builder()
17970 .method(hyper::Method::POST)
17971 .uri(url.as_str())
17972 .header(USER_AGENT, self.hub._user_agent.clone());
17973
17974 if let Some(token) = token.as_ref() {
17975 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17976 }
17977
17978 let request = req_builder
17979 .header(CONTENT_TYPE, json_mime_type.to_string())
17980 .header(CONTENT_LENGTH, request_size as u64)
17981 .body(common::to_body(
17982 request_value_reader.get_ref().clone().into(),
17983 ));
17984
17985 client.request(request.unwrap()).await
17986 };
17987
17988 match req_result {
17989 Err(err) => {
17990 if let common::Retry::After(d) = dlg.http_error(&err) {
17991 sleep(d).await;
17992 continue;
17993 }
17994 dlg.finished(false);
17995 return Err(common::Error::HttpError(err));
17996 }
17997 Ok(res) => {
17998 let (mut parts, body) = res.into_parts();
17999 let mut body = common::Body::new(body);
18000 if !parts.status.is_success() {
18001 let bytes = common::to_bytes(body).await.unwrap_or_default();
18002 let error = serde_json::from_str(&common::to_string(&bytes));
18003 let response = common::to_response(parts, bytes.into());
18004
18005 if let common::Retry::After(d) =
18006 dlg.http_failure(&response, error.as_ref().ok())
18007 {
18008 sleep(d).await;
18009 continue;
18010 }
18011
18012 dlg.finished(false);
18013
18014 return Err(match error {
18015 Ok(value) => common::Error::BadRequest(value),
18016 _ => common::Error::Failure(response),
18017 });
18018 }
18019 let response = {
18020 let bytes = common::to_bytes(body).await.unwrap_or_default();
18021 let encoded = common::to_string(&bytes);
18022 match serde_json::from_str(&encoded) {
18023 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18024 Err(error) => {
18025 dlg.response_json_decode_error(&encoded, &error);
18026 return Err(common::Error::JsonDecodeError(
18027 encoded.to_string(),
18028 error,
18029 ));
18030 }
18031 }
18032 };
18033
18034 dlg.finished(true);
18035 return Ok(response);
18036 }
18037 }
18038 }
18039 }
18040
18041 ///
18042 /// Sets the *request* property to the given value.
18043 ///
18044 /// Even though the property as already been set when instantiating this call,
18045 /// we provide this method for API completeness.
18046 pub fn request(
18047 mut self,
18048 new_value: GoogleCloudDatacatalogV1beta1Taxonomy,
18049 ) -> ProjectLocationTaxonomyCreateCall<'a, C> {
18050 self._request = new_value;
18051 self
18052 }
18053 /// Required. Resource name of the project that the taxonomy will belong to.
18054 ///
18055 /// Sets the *parent* path property to the given value.
18056 ///
18057 /// Even though the property as already been set when instantiating this call,
18058 /// we provide this method for API completeness.
18059 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyCreateCall<'a, C> {
18060 self._parent = new_value.to_string();
18061 self
18062 }
18063 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18064 /// while executing the actual API request.
18065 ///
18066 /// ````text
18067 /// It should be used to handle progress information, and to implement a certain level of resilience.
18068 /// ````
18069 ///
18070 /// Sets the *delegate* property to the given value.
18071 pub fn delegate(
18072 mut self,
18073 new_value: &'a mut dyn common::Delegate,
18074 ) -> ProjectLocationTaxonomyCreateCall<'a, C> {
18075 self._delegate = Some(new_value);
18076 self
18077 }
18078
18079 /// Set any additional parameter of the query string used in the request.
18080 /// It should be used to set parameters which are not yet available through their own
18081 /// setters.
18082 ///
18083 /// Please note that this method must not be used to set any of the known parameters
18084 /// which have their own setter method. If done anyway, the request will fail.
18085 ///
18086 /// # Additional Parameters
18087 ///
18088 /// * *$.xgafv* (query-string) - V1 error format.
18089 /// * *access_token* (query-string) - OAuth access token.
18090 /// * *alt* (query-string) - Data format for response.
18091 /// * *callback* (query-string) - JSONP
18092 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18093 /// * *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.
18094 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18095 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18096 /// * *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.
18097 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18098 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18099 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyCreateCall<'a, C>
18100 where
18101 T: AsRef<str>,
18102 {
18103 self._additional_params
18104 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18105 self
18106 }
18107
18108 /// Identifies the authorization scope for the method you are building.
18109 ///
18110 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18111 /// [`Scope::CloudPlatform`].
18112 ///
18113 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18114 /// tokens for more than one scope.
18115 ///
18116 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18117 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18118 /// sufficient, a read-write scope will do as well.
18119 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyCreateCall<'a, C>
18120 where
18121 St: AsRef<str>,
18122 {
18123 self._scopes.insert(String::from(scope.as_ref()));
18124 self
18125 }
18126 /// Identifies the authorization scope(s) for the method you are building.
18127 ///
18128 /// See [`Self::add_scope()`] for details.
18129 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyCreateCall<'a, C>
18130 where
18131 I: IntoIterator<Item = St>,
18132 St: AsRef<str>,
18133 {
18134 self._scopes
18135 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18136 self
18137 }
18138
18139 /// Removes all scopes, and no default scope will be used either.
18140 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18141 /// for details).
18142 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyCreateCall<'a, C> {
18143 self._scopes.clear();
18144 self
18145 }
18146}
18147
18148/// Deletes a taxonomy. This operation will also delete all policy tags in this taxonomy along with their associated policies.
18149///
18150/// A builder for the *locations.taxonomies.delete* method supported by a *project* resource.
18151/// It is not used directly, but through a [`ProjectMethods`] instance.
18152///
18153/// # Example
18154///
18155/// Instantiate a resource method builder
18156///
18157/// ```test_harness,no_run
18158/// # extern crate hyper;
18159/// # extern crate hyper_rustls;
18160/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
18161/// # async fn dox() {
18162/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18163///
18164/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18165/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18166/// # .with_native_roots()
18167/// # .unwrap()
18168/// # .https_only()
18169/// # .enable_http2()
18170/// # .build();
18171///
18172/// # let executor = hyper_util::rt::TokioExecutor::new();
18173/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18174/// # secret,
18175/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18176/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18177/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18178/// # ),
18179/// # ).build().await.unwrap();
18180///
18181/// # let client = hyper_util::client::legacy::Client::builder(
18182/// # hyper_util::rt::TokioExecutor::new()
18183/// # )
18184/// # .build(
18185/// # hyper_rustls::HttpsConnectorBuilder::new()
18186/// # .with_native_roots()
18187/// # .unwrap()
18188/// # .https_or_http()
18189/// # .enable_http2()
18190/// # .build()
18191/// # );
18192/// # let mut hub = DataCatalog::new(client, auth);
18193/// // You can configure optional parameters by calling the respective setters at will, and
18194/// // execute the final call using `doit()`.
18195/// // Values shown here are possibly random and not representative !
18196/// let result = hub.projects().locations_taxonomies_delete("name")
18197/// .doit().await;
18198/// # }
18199/// ```
18200pub struct ProjectLocationTaxonomyDeleteCall<'a, C>
18201where
18202 C: 'a,
18203{
18204 hub: &'a DataCatalog<C>,
18205 _name: String,
18206 _delegate: Option<&'a mut dyn common::Delegate>,
18207 _additional_params: HashMap<String, String>,
18208 _scopes: BTreeSet<String>,
18209}
18210
18211impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyDeleteCall<'a, C> {}
18212
18213impl<'a, C> ProjectLocationTaxonomyDeleteCall<'a, C>
18214where
18215 C: common::Connector,
18216{
18217 /// Perform the operation you have build so far.
18218 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
18219 use std::borrow::Cow;
18220 use std::io::{Read, Seek};
18221
18222 use common::{url::Params, ToParts};
18223 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18224
18225 let mut dd = common::DefaultDelegate;
18226 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18227 dlg.begin(common::MethodInfo {
18228 id: "datacatalog.projects.locations.taxonomies.delete",
18229 http_method: hyper::Method::DELETE,
18230 });
18231
18232 for &field in ["alt", "name"].iter() {
18233 if self._additional_params.contains_key(field) {
18234 dlg.finished(false);
18235 return Err(common::Error::FieldClash(field));
18236 }
18237 }
18238
18239 let mut params = Params::with_capacity(3 + self._additional_params.len());
18240 params.push("name", self._name);
18241
18242 params.extend(self._additional_params.iter());
18243
18244 params.push("alt", "json");
18245 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
18246 if self._scopes.is_empty() {
18247 self._scopes
18248 .insert(Scope::CloudPlatform.as_ref().to_string());
18249 }
18250
18251 #[allow(clippy::single_element_loop)]
18252 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18253 url = params.uri_replacement(url, param_name, find_this, true);
18254 }
18255 {
18256 let to_remove = ["name"];
18257 params.remove_params(&to_remove);
18258 }
18259
18260 let url = params.parse_with_url(&url);
18261
18262 loop {
18263 let token = match self
18264 .hub
18265 .auth
18266 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18267 .await
18268 {
18269 Ok(token) => token,
18270 Err(e) => match dlg.token(e) {
18271 Ok(token) => token,
18272 Err(e) => {
18273 dlg.finished(false);
18274 return Err(common::Error::MissingToken(e));
18275 }
18276 },
18277 };
18278 let mut req_result = {
18279 let client = &self.hub.client;
18280 dlg.pre_request();
18281 let mut req_builder = hyper::Request::builder()
18282 .method(hyper::Method::DELETE)
18283 .uri(url.as_str())
18284 .header(USER_AGENT, self.hub._user_agent.clone());
18285
18286 if let Some(token) = token.as_ref() {
18287 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18288 }
18289
18290 let request = req_builder
18291 .header(CONTENT_LENGTH, 0_u64)
18292 .body(common::to_body::<String>(None));
18293
18294 client.request(request.unwrap()).await
18295 };
18296
18297 match req_result {
18298 Err(err) => {
18299 if let common::Retry::After(d) = dlg.http_error(&err) {
18300 sleep(d).await;
18301 continue;
18302 }
18303 dlg.finished(false);
18304 return Err(common::Error::HttpError(err));
18305 }
18306 Ok(res) => {
18307 let (mut parts, body) = res.into_parts();
18308 let mut body = common::Body::new(body);
18309 if !parts.status.is_success() {
18310 let bytes = common::to_bytes(body).await.unwrap_or_default();
18311 let error = serde_json::from_str(&common::to_string(&bytes));
18312 let response = common::to_response(parts, bytes.into());
18313
18314 if let common::Retry::After(d) =
18315 dlg.http_failure(&response, error.as_ref().ok())
18316 {
18317 sleep(d).await;
18318 continue;
18319 }
18320
18321 dlg.finished(false);
18322
18323 return Err(match error {
18324 Ok(value) => common::Error::BadRequest(value),
18325 _ => common::Error::Failure(response),
18326 });
18327 }
18328 let response = {
18329 let bytes = common::to_bytes(body).await.unwrap_or_default();
18330 let encoded = common::to_string(&bytes);
18331 match serde_json::from_str(&encoded) {
18332 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18333 Err(error) => {
18334 dlg.response_json_decode_error(&encoded, &error);
18335 return Err(common::Error::JsonDecodeError(
18336 encoded.to_string(),
18337 error,
18338 ));
18339 }
18340 }
18341 };
18342
18343 dlg.finished(true);
18344 return Ok(response);
18345 }
18346 }
18347 }
18348 }
18349
18350 /// Required. Resource name of the taxonomy to be deleted. All policy tags in this taxonomy will also be deleted.
18351 ///
18352 /// Sets the *name* path property to the given value.
18353 ///
18354 /// Even though the property as already been set when instantiating this call,
18355 /// we provide this method for API completeness.
18356 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
18357 self._name = new_value.to_string();
18358 self
18359 }
18360 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18361 /// while executing the actual API request.
18362 ///
18363 /// ````text
18364 /// It should be used to handle progress information, and to implement a certain level of resilience.
18365 /// ````
18366 ///
18367 /// Sets the *delegate* property to the given value.
18368 pub fn delegate(
18369 mut self,
18370 new_value: &'a mut dyn common::Delegate,
18371 ) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
18372 self._delegate = Some(new_value);
18373 self
18374 }
18375
18376 /// Set any additional parameter of the query string used in the request.
18377 /// It should be used to set parameters which are not yet available through their own
18378 /// setters.
18379 ///
18380 /// Please note that this method must not be used to set any of the known parameters
18381 /// which have their own setter method. If done anyway, the request will fail.
18382 ///
18383 /// # Additional Parameters
18384 ///
18385 /// * *$.xgafv* (query-string) - V1 error format.
18386 /// * *access_token* (query-string) - OAuth access token.
18387 /// * *alt* (query-string) - Data format for response.
18388 /// * *callback* (query-string) - JSONP
18389 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18390 /// * *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.
18391 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18392 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18393 /// * *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.
18394 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18395 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18396 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyDeleteCall<'a, C>
18397 where
18398 T: AsRef<str>,
18399 {
18400 self._additional_params
18401 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18402 self
18403 }
18404
18405 /// Identifies the authorization scope for the method you are building.
18406 ///
18407 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18408 /// [`Scope::CloudPlatform`].
18409 ///
18410 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18411 /// tokens for more than one scope.
18412 ///
18413 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18414 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18415 /// sufficient, a read-write scope will do as well.
18416 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyDeleteCall<'a, C>
18417 where
18418 St: AsRef<str>,
18419 {
18420 self._scopes.insert(String::from(scope.as_ref()));
18421 self
18422 }
18423 /// Identifies the authorization scope(s) for the method you are building.
18424 ///
18425 /// See [`Self::add_scope()`] for details.
18426 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyDeleteCall<'a, C>
18427 where
18428 I: IntoIterator<Item = St>,
18429 St: AsRef<str>,
18430 {
18431 self._scopes
18432 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18433 self
18434 }
18435
18436 /// Removes all scopes, and no default scope will be used either.
18437 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18438 /// for details).
18439 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyDeleteCall<'a, C> {
18440 self._scopes.clear();
18441 self
18442 }
18443}
18444
18445/// Exports all taxonomies and their policy tags in a project. This method generates SerializedTaxonomy protos with nested policy tags that can be used as an input for future ImportTaxonomies calls.
18446///
18447/// A builder for the *locations.taxonomies.export* method supported by a *project* resource.
18448/// It is not used directly, but through a [`ProjectMethods`] instance.
18449///
18450/// # Example
18451///
18452/// Instantiate a resource method builder
18453///
18454/// ```test_harness,no_run
18455/// # extern crate hyper;
18456/// # extern crate hyper_rustls;
18457/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
18458/// # async fn dox() {
18459/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18460///
18461/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18462/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18463/// # .with_native_roots()
18464/// # .unwrap()
18465/// # .https_only()
18466/// # .enable_http2()
18467/// # .build();
18468///
18469/// # let executor = hyper_util::rt::TokioExecutor::new();
18470/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18471/// # secret,
18472/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18473/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18474/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18475/// # ),
18476/// # ).build().await.unwrap();
18477///
18478/// # let client = hyper_util::client::legacy::Client::builder(
18479/// # hyper_util::rt::TokioExecutor::new()
18480/// # )
18481/// # .build(
18482/// # hyper_rustls::HttpsConnectorBuilder::new()
18483/// # .with_native_roots()
18484/// # .unwrap()
18485/// # .https_or_http()
18486/// # .enable_http2()
18487/// # .build()
18488/// # );
18489/// # let mut hub = DataCatalog::new(client, auth);
18490/// // You can configure optional parameters by calling the respective setters at will, and
18491/// // execute the final call using `doit()`.
18492/// // Values shown here are possibly random and not representative !
18493/// let result = hub.projects().locations_taxonomies_export("parent")
18494/// .add_taxonomies("accusam")
18495/// .serialized_taxonomies(true)
18496/// .doit().await;
18497/// # }
18498/// ```
18499pub struct ProjectLocationTaxonomyExportCall<'a, C>
18500where
18501 C: 'a,
18502{
18503 hub: &'a DataCatalog<C>,
18504 _parent: String,
18505 _taxonomies: Vec<String>,
18506 _serialized_taxonomies: Option<bool>,
18507 _delegate: Option<&'a mut dyn common::Delegate>,
18508 _additional_params: HashMap<String, String>,
18509 _scopes: BTreeSet<String>,
18510}
18511
18512impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyExportCall<'a, C> {}
18513
18514impl<'a, C> ProjectLocationTaxonomyExportCall<'a, C>
18515where
18516 C: common::Connector,
18517{
18518 /// Perform the operation you have build so far.
18519 pub async fn doit(
18520 mut self,
18521 ) -> common::Result<(
18522 common::Response,
18523 GoogleCloudDatacatalogV1beta1ExportTaxonomiesResponse,
18524 )> {
18525 use std::borrow::Cow;
18526 use std::io::{Read, Seek};
18527
18528 use common::{url::Params, ToParts};
18529 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18530
18531 let mut dd = common::DefaultDelegate;
18532 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18533 dlg.begin(common::MethodInfo {
18534 id: "datacatalog.projects.locations.taxonomies.export",
18535 http_method: hyper::Method::GET,
18536 });
18537
18538 for &field in ["alt", "parent", "taxonomies", "serializedTaxonomies"].iter() {
18539 if self._additional_params.contains_key(field) {
18540 dlg.finished(false);
18541 return Err(common::Error::FieldClash(field));
18542 }
18543 }
18544
18545 let mut params = Params::with_capacity(5 + self._additional_params.len());
18546 params.push("parent", self._parent);
18547 if !self._taxonomies.is_empty() {
18548 for f in self._taxonomies.iter() {
18549 params.push("taxonomies", f);
18550 }
18551 }
18552 if let Some(value) = self._serialized_taxonomies.as_ref() {
18553 params.push("serializedTaxonomies", value.to_string());
18554 }
18555
18556 params.extend(self._additional_params.iter());
18557
18558 params.push("alt", "json");
18559 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/taxonomies:export";
18560 if self._scopes.is_empty() {
18561 self._scopes
18562 .insert(Scope::CloudPlatform.as_ref().to_string());
18563 }
18564
18565 #[allow(clippy::single_element_loop)]
18566 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18567 url = params.uri_replacement(url, param_name, find_this, true);
18568 }
18569 {
18570 let to_remove = ["parent"];
18571 params.remove_params(&to_remove);
18572 }
18573
18574 let url = params.parse_with_url(&url);
18575
18576 loop {
18577 let token = match self
18578 .hub
18579 .auth
18580 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18581 .await
18582 {
18583 Ok(token) => token,
18584 Err(e) => match dlg.token(e) {
18585 Ok(token) => token,
18586 Err(e) => {
18587 dlg.finished(false);
18588 return Err(common::Error::MissingToken(e));
18589 }
18590 },
18591 };
18592 let mut req_result = {
18593 let client = &self.hub.client;
18594 dlg.pre_request();
18595 let mut req_builder = hyper::Request::builder()
18596 .method(hyper::Method::GET)
18597 .uri(url.as_str())
18598 .header(USER_AGENT, self.hub._user_agent.clone());
18599
18600 if let Some(token) = token.as_ref() {
18601 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18602 }
18603
18604 let request = req_builder
18605 .header(CONTENT_LENGTH, 0_u64)
18606 .body(common::to_body::<String>(None));
18607
18608 client.request(request.unwrap()).await
18609 };
18610
18611 match req_result {
18612 Err(err) => {
18613 if let common::Retry::After(d) = dlg.http_error(&err) {
18614 sleep(d).await;
18615 continue;
18616 }
18617 dlg.finished(false);
18618 return Err(common::Error::HttpError(err));
18619 }
18620 Ok(res) => {
18621 let (mut parts, body) = res.into_parts();
18622 let mut body = common::Body::new(body);
18623 if !parts.status.is_success() {
18624 let bytes = common::to_bytes(body).await.unwrap_or_default();
18625 let error = serde_json::from_str(&common::to_string(&bytes));
18626 let response = common::to_response(parts, bytes.into());
18627
18628 if let common::Retry::After(d) =
18629 dlg.http_failure(&response, error.as_ref().ok())
18630 {
18631 sleep(d).await;
18632 continue;
18633 }
18634
18635 dlg.finished(false);
18636
18637 return Err(match error {
18638 Ok(value) => common::Error::BadRequest(value),
18639 _ => common::Error::Failure(response),
18640 });
18641 }
18642 let response = {
18643 let bytes = common::to_bytes(body).await.unwrap_or_default();
18644 let encoded = common::to_string(&bytes);
18645 match serde_json::from_str(&encoded) {
18646 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18647 Err(error) => {
18648 dlg.response_json_decode_error(&encoded, &error);
18649 return Err(common::Error::JsonDecodeError(
18650 encoded.to_string(),
18651 error,
18652 ));
18653 }
18654 }
18655 };
18656
18657 dlg.finished(true);
18658 return Ok(response);
18659 }
18660 }
18661 }
18662 }
18663
18664 /// Required. Resource name of the project that taxonomies to be exported will share.
18665 ///
18666 /// Sets the *parent* path property to the given value.
18667 ///
18668 /// Even though the property as already been set when instantiating this call,
18669 /// we provide this method for API completeness.
18670 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyExportCall<'a, C> {
18671 self._parent = new_value.to_string();
18672 self
18673 }
18674 /// Required. Resource names of the taxonomies to be exported.
18675 ///
18676 /// Append the given value to the *taxonomies* query property.
18677 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
18678 pub fn add_taxonomies(mut self, new_value: &str) -> ProjectLocationTaxonomyExportCall<'a, C> {
18679 self._taxonomies.push(new_value.to_string());
18680 self
18681 }
18682 /// Export taxonomies as serialized taxonomies.
18683 ///
18684 /// Sets the *serialized taxonomies* query property to the given value.
18685 pub fn serialized_taxonomies(
18686 mut self,
18687 new_value: bool,
18688 ) -> ProjectLocationTaxonomyExportCall<'a, C> {
18689 self._serialized_taxonomies = Some(new_value);
18690 self
18691 }
18692 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18693 /// while executing the actual API request.
18694 ///
18695 /// ````text
18696 /// It should be used to handle progress information, and to implement a certain level of resilience.
18697 /// ````
18698 ///
18699 /// Sets the *delegate* property to the given value.
18700 pub fn delegate(
18701 mut self,
18702 new_value: &'a mut dyn common::Delegate,
18703 ) -> ProjectLocationTaxonomyExportCall<'a, C> {
18704 self._delegate = Some(new_value);
18705 self
18706 }
18707
18708 /// Set any additional parameter of the query string used in the request.
18709 /// It should be used to set parameters which are not yet available through their own
18710 /// setters.
18711 ///
18712 /// Please note that this method must not be used to set any of the known parameters
18713 /// which have their own setter method. If done anyway, the request will fail.
18714 ///
18715 /// # Additional Parameters
18716 ///
18717 /// * *$.xgafv* (query-string) - V1 error format.
18718 /// * *access_token* (query-string) - OAuth access token.
18719 /// * *alt* (query-string) - Data format for response.
18720 /// * *callback* (query-string) - JSONP
18721 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18722 /// * *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.
18723 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18724 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18725 /// * *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.
18726 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18727 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18728 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyExportCall<'a, C>
18729 where
18730 T: AsRef<str>,
18731 {
18732 self._additional_params
18733 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18734 self
18735 }
18736
18737 /// Identifies the authorization scope for the method you are building.
18738 ///
18739 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18740 /// [`Scope::CloudPlatform`].
18741 ///
18742 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18743 /// tokens for more than one scope.
18744 ///
18745 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18746 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18747 /// sufficient, a read-write scope will do as well.
18748 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyExportCall<'a, C>
18749 where
18750 St: AsRef<str>,
18751 {
18752 self._scopes.insert(String::from(scope.as_ref()));
18753 self
18754 }
18755 /// Identifies the authorization scope(s) for the method you are building.
18756 ///
18757 /// See [`Self::add_scope()`] for details.
18758 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyExportCall<'a, C>
18759 where
18760 I: IntoIterator<Item = St>,
18761 St: AsRef<str>,
18762 {
18763 self._scopes
18764 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18765 self
18766 }
18767
18768 /// Removes all scopes, and no default scope will be used either.
18769 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18770 /// for details).
18771 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyExportCall<'a, C> {
18772 self._scopes.clear();
18773 self
18774 }
18775}
18776
18777/// Gets a taxonomy.
18778///
18779/// A builder for the *locations.taxonomies.get* method supported by a *project* resource.
18780/// It is not used directly, but through a [`ProjectMethods`] instance.
18781///
18782/// # Example
18783///
18784/// Instantiate a resource method builder
18785///
18786/// ```test_harness,no_run
18787/// # extern crate hyper;
18788/// # extern crate hyper_rustls;
18789/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
18790/// # async fn dox() {
18791/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18792///
18793/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18794/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18795/// # .with_native_roots()
18796/// # .unwrap()
18797/// # .https_only()
18798/// # .enable_http2()
18799/// # .build();
18800///
18801/// # let executor = hyper_util::rt::TokioExecutor::new();
18802/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18803/// # secret,
18804/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18805/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18806/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18807/// # ),
18808/// # ).build().await.unwrap();
18809///
18810/// # let client = hyper_util::client::legacy::Client::builder(
18811/// # hyper_util::rt::TokioExecutor::new()
18812/// # )
18813/// # .build(
18814/// # hyper_rustls::HttpsConnectorBuilder::new()
18815/// # .with_native_roots()
18816/// # .unwrap()
18817/// # .https_or_http()
18818/// # .enable_http2()
18819/// # .build()
18820/// # );
18821/// # let mut hub = DataCatalog::new(client, auth);
18822/// // You can configure optional parameters by calling the respective setters at will, and
18823/// // execute the final call using `doit()`.
18824/// // Values shown here are possibly random and not representative !
18825/// let result = hub.projects().locations_taxonomies_get("name")
18826/// .doit().await;
18827/// # }
18828/// ```
18829pub struct ProjectLocationTaxonomyGetCall<'a, C>
18830where
18831 C: 'a,
18832{
18833 hub: &'a DataCatalog<C>,
18834 _name: String,
18835 _delegate: Option<&'a mut dyn common::Delegate>,
18836 _additional_params: HashMap<String, String>,
18837 _scopes: BTreeSet<String>,
18838}
18839
18840impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyGetCall<'a, C> {}
18841
18842impl<'a, C> ProjectLocationTaxonomyGetCall<'a, C>
18843where
18844 C: common::Connector,
18845{
18846 /// Perform the operation you have build so far.
18847 pub async fn doit(
18848 mut self,
18849 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Taxonomy)> {
18850 use std::borrow::Cow;
18851 use std::io::{Read, Seek};
18852
18853 use common::{url::Params, ToParts};
18854 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18855
18856 let mut dd = common::DefaultDelegate;
18857 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18858 dlg.begin(common::MethodInfo {
18859 id: "datacatalog.projects.locations.taxonomies.get",
18860 http_method: hyper::Method::GET,
18861 });
18862
18863 for &field in ["alt", "name"].iter() {
18864 if self._additional_params.contains_key(field) {
18865 dlg.finished(false);
18866 return Err(common::Error::FieldClash(field));
18867 }
18868 }
18869
18870 let mut params = Params::with_capacity(3 + self._additional_params.len());
18871 params.push("name", self._name);
18872
18873 params.extend(self._additional_params.iter());
18874
18875 params.push("alt", "json");
18876 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
18877 if self._scopes.is_empty() {
18878 self._scopes
18879 .insert(Scope::CloudPlatform.as_ref().to_string());
18880 }
18881
18882 #[allow(clippy::single_element_loop)]
18883 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18884 url = params.uri_replacement(url, param_name, find_this, true);
18885 }
18886 {
18887 let to_remove = ["name"];
18888 params.remove_params(&to_remove);
18889 }
18890
18891 let url = params.parse_with_url(&url);
18892
18893 loop {
18894 let token = match self
18895 .hub
18896 .auth
18897 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18898 .await
18899 {
18900 Ok(token) => token,
18901 Err(e) => match dlg.token(e) {
18902 Ok(token) => token,
18903 Err(e) => {
18904 dlg.finished(false);
18905 return Err(common::Error::MissingToken(e));
18906 }
18907 },
18908 };
18909 let mut req_result = {
18910 let client = &self.hub.client;
18911 dlg.pre_request();
18912 let mut req_builder = hyper::Request::builder()
18913 .method(hyper::Method::GET)
18914 .uri(url.as_str())
18915 .header(USER_AGENT, self.hub._user_agent.clone());
18916
18917 if let Some(token) = token.as_ref() {
18918 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18919 }
18920
18921 let request = req_builder
18922 .header(CONTENT_LENGTH, 0_u64)
18923 .body(common::to_body::<String>(None));
18924
18925 client.request(request.unwrap()).await
18926 };
18927
18928 match req_result {
18929 Err(err) => {
18930 if let common::Retry::After(d) = dlg.http_error(&err) {
18931 sleep(d).await;
18932 continue;
18933 }
18934 dlg.finished(false);
18935 return Err(common::Error::HttpError(err));
18936 }
18937 Ok(res) => {
18938 let (mut parts, body) = res.into_parts();
18939 let mut body = common::Body::new(body);
18940 if !parts.status.is_success() {
18941 let bytes = common::to_bytes(body).await.unwrap_or_default();
18942 let error = serde_json::from_str(&common::to_string(&bytes));
18943 let response = common::to_response(parts, bytes.into());
18944
18945 if let common::Retry::After(d) =
18946 dlg.http_failure(&response, error.as_ref().ok())
18947 {
18948 sleep(d).await;
18949 continue;
18950 }
18951
18952 dlg.finished(false);
18953
18954 return Err(match error {
18955 Ok(value) => common::Error::BadRequest(value),
18956 _ => common::Error::Failure(response),
18957 });
18958 }
18959 let response = {
18960 let bytes = common::to_bytes(body).await.unwrap_or_default();
18961 let encoded = common::to_string(&bytes);
18962 match serde_json::from_str(&encoded) {
18963 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18964 Err(error) => {
18965 dlg.response_json_decode_error(&encoded, &error);
18966 return Err(common::Error::JsonDecodeError(
18967 encoded.to_string(),
18968 error,
18969 ));
18970 }
18971 }
18972 };
18973
18974 dlg.finished(true);
18975 return Ok(response);
18976 }
18977 }
18978 }
18979 }
18980
18981 /// Required. Resource name of the requested taxonomy.
18982 ///
18983 /// Sets the *name* path property to the given value.
18984 ///
18985 /// Even though the property as already been set when instantiating this call,
18986 /// we provide this method for API completeness.
18987 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyGetCall<'a, C> {
18988 self._name = new_value.to_string();
18989 self
18990 }
18991 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18992 /// while executing the actual API request.
18993 ///
18994 /// ````text
18995 /// It should be used to handle progress information, and to implement a certain level of resilience.
18996 /// ````
18997 ///
18998 /// Sets the *delegate* property to the given value.
18999 pub fn delegate(
19000 mut self,
19001 new_value: &'a mut dyn common::Delegate,
19002 ) -> ProjectLocationTaxonomyGetCall<'a, C> {
19003 self._delegate = Some(new_value);
19004 self
19005 }
19006
19007 /// Set any additional parameter of the query string used in the request.
19008 /// It should be used to set parameters which are not yet available through their own
19009 /// setters.
19010 ///
19011 /// Please note that this method must not be used to set any of the known parameters
19012 /// which have their own setter method. If done anyway, the request will fail.
19013 ///
19014 /// # Additional Parameters
19015 ///
19016 /// * *$.xgafv* (query-string) - V1 error format.
19017 /// * *access_token* (query-string) - OAuth access token.
19018 /// * *alt* (query-string) - Data format for response.
19019 /// * *callback* (query-string) - JSONP
19020 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19021 /// * *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.
19022 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19023 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19024 /// * *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.
19025 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19026 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19027 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyGetCall<'a, C>
19028 where
19029 T: AsRef<str>,
19030 {
19031 self._additional_params
19032 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19033 self
19034 }
19035
19036 /// Identifies the authorization scope for the method you are building.
19037 ///
19038 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19039 /// [`Scope::CloudPlatform`].
19040 ///
19041 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19042 /// tokens for more than one scope.
19043 ///
19044 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19045 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19046 /// sufficient, a read-write scope will do as well.
19047 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyGetCall<'a, C>
19048 where
19049 St: AsRef<str>,
19050 {
19051 self._scopes.insert(String::from(scope.as_ref()));
19052 self
19053 }
19054 /// Identifies the authorization scope(s) for the method you are building.
19055 ///
19056 /// See [`Self::add_scope()`] for details.
19057 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyGetCall<'a, C>
19058 where
19059 I: IntoIterator<Item = St>,
19060 St: AsRef<str>,
19061 {
19062 self._scopes
19063 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19064 self
19065 }
19066
19067 /// Removes all scopes, and no default scope will be used either.
19068 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19069 /// for details).
19070 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyGetCall<'a, C> {
19071 self._scopes.clear();
19072 self
19073 }
19074}
19075
19076/// Gets the IAM policy for a taxonomy or a policy tag.
19077///
19078/// A builder for the *locations.taxonomies.getIamPolicy* method supported by a *project* resource.
19079/// It is not used directly, but through a [`ProjectMethods`] instance.
19080///
19081/// # Example
19082///
19083/// Instantiate a resource method builder
19084///
19085/// ```test_harness,no_run
19086/// # extern crate hyper;
19087/// # extern crate hyper_rustls;
19088/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
19089/// use datacatalog1_beta1::api::GetIamPolicyRequest;
19090/// # async fn dox() {
19091/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19092///
19093/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19094/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19095/// # .with_native_roots()
19096/// # .unwrap()
19097/// # .https_only()
19098/// # .enable_http2()
19099/// # .build();
19100///
19101/// # let executor = hyper_util::rt::TokioExecutor::new();
19102/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19103/// # secret,
19104/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19105/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19106/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19107/// # ),
19108/// # ).build().await.unwrap();
19109///
19110/// # let client = hyper_util::client::legacy::Client::builder(
19111/// # hyper_util::rt::TokioExecutor::new()
19112/// # )
19113/// # .build(
19114/// # hyper_rustls::HttpsConnectorBuilder::new()
19115/// # .with_native_roots()
19116/// # .unwrap()
19117/// # .https_or_http()
19118/// # .enable_http2()
19119/// # .build()
19120/// # );
19121/// # let mut hub = DataCatalog::new(client, auth);
19122/// // As the method needs a request, you would usually fill it with the desired information
19123/// // into the respective structure. Some of the parts shown here might not be applicable !
19124/// // Values shown here are possibly random and not representative !
19125/// let mut req = GetIamPolicyRequest::default();
19126///
19127/// // You can configure optional parameters by calling the respective setters at will, and
19128/// // execute the final call using `doit()`.
19129/// // Values shown here are possibly random and not representative !
19130/// let result = hub.projects().locations_taxonomies_get_iam_policy(req, "resource")
19131/// .doit().await;
19132/// # }
19133/// ```
19134pub struct ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
19135where
19136 C: 'a,
19137{
19138 hub: &'a DataCatalog<C>,
19139 _request: GetIamPolicyRequest,
19140 _resource: String,
19141 _delegate: Option<&'a mut dyn common::Delegate>,
19142 _additional_params: HashMap<String, String>,
19143 _scopes: BTreeSet<String>,
19144}
19145
19146impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {}
19147
19148impl<'a, C> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
19149where
19150 C: common::Connector,
19151{
19152 /// Perform the operation you have build so far.
19153 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
19154 use std::borrow::Cow;
19155 use std::io::{Read, Seek};
19156
19157 use common::{url::Params, ToParts};
19158 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19159
19160 let mut dd = common::DefaultDelegate;
19161 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19162 dlg.begin(common::MethodInfo {
19163 id: "datacatalog.projects.locations.taxonomies.getIamPolicy",
19164 http_method: hyper::Method::POST,
19165 });
19166
19167 for &field in ["alt", "resource"].iter() {
19168 if self._additional_params.contains_key(field) {
19169 dlg.finished(false);
19170 return Err(common::Error::FieldClash(field));
19171 }
19172 }
19173
19174 let mut params = Params::with_capacity(4 + self._additional_params.len());
19175 params.push("resource", self._resource);
19176
19177 params.extend(self._additional_params.iter());
19178
19179 params.push("alt", "json");
19180 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
19181 if self._scopes.is_empty() {
19182 self._scopes
19183 .insert(Scope::CloudPlatform.as_ref().to_string());
19184 }
19185
19186 #[allow(clippy::single_element_loop)]
19187 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19188 url = params.uri_replacement(url, param_name, find_this, true);
19189 }
19190 {
19191 let to_remove = ["resource"];
19192 params.remove_params(&to_remove);
19193 }
19194
19195 let url = params.parse_with_url(&url);
19196
19197 let mut json_mime_type = mime::APPLICATION_JSON;
19198 let mut request_value_reader = {
19199 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19200 common::remove_json_null_values(&mut value);
19201 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19202 serde_json::to_writer(&mut dst, &value).unwrap();
19203 dst
19204 };
19205 let request_size = request_value_reader
19206 .seek(std::io::SeekFrom::End(0))
19207 .unwrap();
19208 request_value_reader
19209 .seek(std::io::SeekFrom::Start(0))
19210 .unwrap();
19211
19212 loop {
19213 let token = match self
19214 .hub
19215 .auth
19216 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19217 .await
19218 {
19219 Ok(token) => token,
19220 Err(e) => match dlg.token(e) {
19221 Ok(token) => token,
19222 Err(e) => {
19223 dlg.finished(false);
19224 return Err(common::Error::MissingToken(e));
19225 }
19226 },
19227 };
19228 request_value_reader
19229 .seek(std::io::SeekFrom::Start(0))
19230 .unwrap();
19231 let mut req_result = {
19232 let client = &self.hub.client;
19233 dlg.pre_request();
19234 let mut req_builder = hyper::Request::builder()
19235 .method(hyper::Method::POST)
19236 .uri(url.as_str())
19237 .header(USER_AGENT, self.hub._user_agent.clone());
19238
19239 if let Some(token) = token.as_ref() {
19240 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19241 }
19242
19243 let request = req_builder
19244 .header(CONTENT_TYPE, json_mime_type.to_string())
19245 .header(CONTENT_LENGTH, request_size as u64)
19246 .body(common::to_body(
19247 request_value_reader.get_ref().clone().into(),
19248 ));
19249
19250 client.request(request.unwrap()).await
19251 };
19252
19253 match req_result {
19254 Err(err) => {
19255 if let common::Retry::After(d) = dlg.http_error(&err) {
19256 sleep(d).await;
19257 continue;
19258 }
19259 dlg.finished(false);
19260 return Err(common::Error::HttpError(err));
19261 }
19262 Ok(res) => {
19263 let (mut parts, body) = res.into_parts();
19264 let mut body = common::Body::new(body);
19265 if !parts.status.is_success() {
19266 let bytes = common::to_bytes(body).await.unwrap_or_default();
19267 let error = serde_json::from_str(&common::to_string(&bytes));
19268 let response = common::to_response(parts, bytes.into());
19269
19270 if let common::Retry::After(d) =
19271 dlg.http_failure(&response, error.as_ref().ok())
19272 {
19273 sleep(d).await;
19274 continue;
19275 }
19276
19277 dlg.finished(false);
19278
19279 return Err(match error {
19280 Ok(value) => common::Error::BadRequest(value),
19281 _ => common::Error::Failure(response),
19282 });
19283 }
19284 let response = {
19285 let bytes = common::to_bytes(body).await.unwrap_or_default();
19286 let encoded = common::to_string(&bytes);
19287 match serde_json::from_str(&encoded) {
19288 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19289 Err(error) => {
19290 dlg.response_json_decode_error(&encoded, &error);
19291 return Err(common::Error::JsonDecodeError(
19292 encoded.to_string(),
19293 error,
19294 ));
19295 }
19296 }
19297 };
19298
19299 dlg.finished(true);
19300 return Ok(response);
19301 }
19302 }
19303 }
19304 }
19305
19306 ///
19307 /// Sets the *request* property to the given value.
19308 ///
19309 /// Even though the property as already been set when instantiating this call,
19310 /// we provide this method for API completeness.
19311 pub fn request(
19312 mut self,
19313 new_value: GetIamPolicyRequest,
19314 ) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
19315 self._request = new_value;
19316 self
19317 }
19318 /// 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.
19319 ///
19320 /// Sets the *resource* path property to the given value.
19321 ///
19322 /// Even though the property as already been set when instantiating this call,
19323 /// we provide this method for API completeness.
19324 pub fn resource(mut self, new_value: &str) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
19325 self._resource = new_value.to_string();
19326 self
19327 }
19328 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19329 /// while executing the actual API request.
19330 ///
19331 /// ````text
19332 /// It should be used to handle progress information, and to implement a certain level of resilience.
19333 /// ````
19334 ///
19335 /// Sets the *delegate* property to the given value.
19336 pub fn delegate(
19337 mut self,
19338 new_value: &'a mut dyn common::Delegate,
19339 ) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
19340 self._delegate = Some(new_value);
19341 self
19342 }
19343
19344 /// Set any additional parameter of the query string used in the request.
19345 /// It should be used to set parameters which are not yet available through their own
19346 /// setters.
19347 ///
19348 /// Please note that this method must not be used to set any of the known parameters
19349 /// which have their own setter method. If done anyway, the request will fail.
19350 ///
19351 /// # Additional Parameters
19352 ///
19353 /// * *$.xgafv* (query-string) - V1 error format.
19354 /// * *access_token* (query-string) - OAuth access token.
19355 /// * *alt* (query-string) - Data format for response.
19356 /// * *callback* (query-string) - JSONP
19357 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19358 /// * *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.
19359 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19360 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19361 /// * *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.
19362 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19363 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19364 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
19365 where
19366 T: AsRef<str>,
19367 {
19368 self._additional_params
19369 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19370 self
19371 }
19372
19373 /// Identifies the authorization scope for the method you are building.
19374 ///
19375 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19376 /// [`Scope::CloudPlatform`].
19377 ///
19378 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19379 /// tokens for more than one scope.
19380 ///
19381 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19382 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19383 /// sufficient, a read-write scope will do as well.
19384 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
19385 where
19386 St: AsRef<str>,
19387 {
19388 self._scopes.insert(String::from(scope.as_ref()));
19389 self
19390 }
19391 /// Identifies the authorization scope(s) for the method you are building.
19392 ///
19393 /// See [`Self::add_scope()`] for details.
19394 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C>
19395 where
19396 I: IntoIterator<Item = St>,
19397 St: AsRef<str>,
19398 {
19399 self._scopes
19400 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19401 self
19402 }
19403
19404 /// Removes all scopes, and no default scope will be used either.
19405 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19406 /// for details).
19407 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyGetIamPolicyCall<'a, C> {
19408 self._scopes.clear();
19409 self
19410 }
19411}
19412
19413/// Imports all taxonomies and their policy tags to a project as new taxonomies. This method provides a bulk taxonomy / policy tag creation using nested proto structure.
19414///
19415/// A builder for the *locations.taxonomies.import* method supported by a *project* resource.
19416/// It is not used directly, but through a [`ProjectMethods`] instance.
19417///
19418/// # Example
19419///
19420/// Instantiate a resource method builder
19421///
19422/// ```test_harness,no_run
19423/// # extern crate hyper;
19424/// # extern crate hyper_rustls;
19425/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
19426/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1ImportTaxonomiesRequest;
19427/// # async fn dox() {
19428/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19429///
19430/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19431/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19432/// # .with_native_roots()
19433/// # .unwrap()
19434/// # .https_only()
19435/// # .enable_http2()
19436/// # .build();
19437///
19438/// # let executor = hyper_util::rt::TokioExecutor::new();
19439/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19440/// # secret,
19441/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19442/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19443/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19444/// # ),
19445/// # ).build().await.unwrap();
19446///
19447/// # let client = hyper_util::client::legacy::Client::builder(
19448/// # hyper_util::rt::TokioExecutor::new()
19449/// # )
19450/// # .build(
19451/// # hyper_rustls::HttpsConnectorBuilder::new()
19452/// # .with_native_roots()
19453/// # .unwrap()
19454/// # .https_or_http()
19455/// # .enable_http2()
19456/// # .build()
19457/// # );
19458/// # let mut hub = DataCatalog::new(client, auth);
19459/// // As the method needs a request, you would usually fill it with the desired information
19460/// // into the respective structure. Some of the parts shown here might not be applicable !
19461/// // Values shown here are possibly random and not representative !
19462/// let mut req = GoogleCloudDatacatalogV1beta1ImportTaxonomiesRequest::default();
19463///
19464/// // You can configure optional parameters by calling the respective setters at will, and
19465/// // execute the final call using `doit()`.
19466/// // Values shown here are possibly random and not representative !
19467/// let result = hub.projects().locations_taxonomies_import(req, "parent")
19468/// .doit().await;
19469/// # }
19470/// ```
19471pub struct ProjectLocationTaxonomyImportCall<'a, C>
19472where
19473 C: 'a,
19474{
19475 hub: &'a DataCatalog<C>,
19476 _request: GoogleCloudDatacatalogV1beta1ImportTaxonomiesRequest,
19477 _parent: String,
19478 _delegate: Option<&'a mut dyn common::Delegate>,
19479 _additional_params: HashMap<String, String>,
19480 _scopes: BTreeSet<String>,
19481}
19482
19483impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyImportCall<'a, C> {}
19484
19485impl<'a, C> ProjectLocationTaxonomyImportCall<'a, C>
19486where
19487 C: common::Connector,
19488{
19489 /// Perform the operation you have build so far.
19490 pub async fn doit(
19491 mut self,
19492 ) -> common::Result<(
19493 common::Response,
19494 GoogleCloudDatacatalogV1beta1ImportTaxonomiesResponse,
19495 )> {
19496 use std::borrow::Cow;
19497 use std::io::{Read, Seek};
19498
19499 use common::{url::Params, ToParts};
19500 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19501
19502 let mut dd = common::DefaultDelegate;
19503 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19504 dlg.begin(common::MethodInfo {
19505 id: "datacatalog.projects.locations.taxonomies.import",
19506 http_method: hyper::Method::POST,
19507 });
19508
19509 for &field in ["alt", "parent"].iter() {
19510 if self._additional_params.contains_key(field) {
19511 dlg.finished(false);
19512 return Err(common::Error::FieldClash(field));
19513 }
19514 }
19515
19516 let mut params = Params::with_capacity(4 + self._additional_params.len());
19517 params.push("parent", self._parent);
19518
19519 params.extend(self._additional_params.iter());
19520
19521 params.push("alt", "json");
19522 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/taxonomies:import";
19523 if self._scopes.is_empty() {
19524 self._scopes
19525 .insert(Scope::CloudPlatform.as_ref().to_string());
19526 }
19527
19528 #[allow(clippy::single_element_loop)]
19529 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19530 url = params.uri_replacement(url, param_name, find_this, true);
19531 }
19532 {
19533 let to_remove = ["parent"];
19534 params.remove_params(&to_remove);
19535 }
19536
19537 let url = params.parse_with_url(&url);
19538
19539 let mut json_mime_type = mime::APPLICATION_JSON;
19540 let mut request_value_reader = {
19541 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19542 common::remove_json_null_values(&mut value);
19543 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19544 serde_json::to_writer(&mut dst, &value).unwrap();
19545 dst
19546 };
19547 let request_size = request_value_reader
19548 .seek(std::io::SeekFrom::End(0))
19549 .unwrap();
19550 request_value_reader
19551 .seek(std::io::SeekFrom::Start(0))
19552 .unwrap();
19553
19554 loop {
19555 let token = match self
19556 .hub
19557 .auth
19558 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19559 .await
19560 {
19561 Ok(token) => token,
19562 Err(e) => match dlg.token(e) {
19563 Ok(token) => token,
19564 Err(e) => {
19565 dlg.finished(false);
19566 return Err(common::Error::MissingToken(e));
19567 }
19568 },
19569 };
19570 request_value_reader
19571 .seek(std::io::SeekFrom::Start(0))
19572 .unwrap();
19573 let mut req_result = {
19574 let client = &self.hub.client;
19575 dlg.pre_request();
19576 let mut req_builder = hyper::Request::builder()
19577 .method(hyper::Method::POST)
19578 .uri(url.as_str())
19579 .header(USER_AGENT, self.hub._user_agent.clone());
19580
19581 if let Some(token) = token.as_ref() {
19582 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19583 }
19584
19585 let request = req_builder
19586 .header(CONTENT_TYPE, json_mime_type.to_string())
19587 .header(CONTENT_LENGTH, request_size as u64)
19588 .body(common::to_body(
19589 request_value_reader.get_ref().clone().into(),
19590 ));
19591
19592 client.request(request.unwrap()).await
19593 };
19594
19595 match req_result {
19596 Err(err) => {
19597 if let common::Retry::After(d) = dlg.http_error(&err) {
19598 sleep(d).await;
19599 continue;
19600 }
19601 dlg.finished(false);
19602 return Err(common::Error::HttpError(err));
19603 }
19604 Ok(res) => {
19605 let (mut parts, body) = res.into_parts();
19606 let mut body = common::Body::new(body);
19607 if !parts.status.is_success() {
19608 let bytes = common::to_bytes(body).await.unwrap_or_default();
19609 let error = serde_json::from_str(&common::to_string(&bytes));
19610 let response = common::to_response(parts, bytes.into());
19611
19612 if let common::Retry::After(d) =
19613 dlg.http_failure(&response, error.as_ref().ok())
19614 {
19615 sleep(d).await;
19616 continue;
19617 }
19618
19619 dlg.finished(false);
19620
19621 return Err(match error {
19622 Ok(value) => common::Error::BadRequest(value),
19623 _ => common::Error::Failure(response),
19624 });
19625 }
19626 let response = {
19627 let bytes = common::to_bytes(body).await.unwrap_or_default();
19628 let encoded = common::to_string(&bytes);
19629 match serde_json::from_str(&encoded) {
19630 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19631 Err(error) => {
19632 dlg.response_json_decode_error(&encoded, &error);
19633 return Err(common::Error::JsonDecodeError(
19634 encoded.to_string(),
19635 error,
19636 ));
19637 }
19638 }
19639 };
19640
19641 dlg.finished(true);
19642 return Ok(response);
19643 }
19644 }
19645 }
19646 }
19647
19648 ///
19649 /// Sets the *request* property to the given value.
19650 ///
19651 /// Even though the property as already been set when instantiating this call,
19652 /// we provide this method for API completeness.
19653 pub fn request(
19654 mut self,
19655 new_value: GoogleCloudDatacatalogV1beta1ImportTaxonomiesRequest,
19656 ) -> ProjectLocationTaxonomyImportCall<'a, C> {
19657 self._request = new_value;
19658 self
19659 }
19660 /// Required. Resource name of project that the imported taxonomies will belong to.
19661 ///
19662 /// Sets the *parent* path property to the given value.
19663 ///
19664 /// Even though the property as already been set when instantiating this call,
19665 /// we provide this method for API completeness.
19666 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyImportCall<'a, C> {
19667 self._parent = new_value.to_string();
19668 self
19669 }
19670 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19671 /// while executing the actual API request.
19672 ///
19673 /// ````text
19674 /// It should be used to handle progress information, and to implement a certain level of resilience.
19675 /// ````
19676 ///
19677 /// Sets the *delegate* property to the given value.
19678 pub fn delegate(
19679 mut self,
19680 new_value: &'a mut dyn common::Delegate,
19681 ) -> ProjectLocationTaxonomyImportCall<'a, C> {
19682 self._delegate = Some(new_value);
19683 self
19684 }
19685
19686 /// Set any additional parameter of the query string used in the request.
19687 /// It should be used to set parameters which are not yet available through their own
19688 /// setters.
19689 ///
19690 /// Please note that this method must not be used to set any of the known parameters
19691 /// which have their own setter method. If done anyway, the request will fail.
19692 ///
19693 /// # Additional Parameters
19694 ///
19695 /// * *$.xgafv* (query-string) - V1 error format.
19696 /// * *access_token* (query-string) - OAuth access token.
19697 /// * *alt* (query-string) - Data format for response.
19698 /// * *callback* (query-string) - JSONP
19699 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19700 /// * *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.
19701 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19702 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19703 /// * *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.
19704 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19705 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19706 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyImportCall<'a, C>
19707 where
19708 T: AsRef<str>,
19709 {
19710 self._additional_params
19711 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19712 self
19713 }
19714
19715 /// Identifies the authorization scope for the method you are building.
19716 ///
19717 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19718 /// [`Scope::CloudPlatform`].
19719 ///
19720 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19721 /// tokens for more than one scope.
19722 ///
19723 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19724 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19725 /// sufficient, a read-write scope will do as well.
19726 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyImportCall<'a, C>
19727 where
19728 St: AsRef<str>,
19729 {
19730 self._scopes.insert(String::from(scope.as_ref()));
19731 self
19732 }
19733 /// Identifies the authorization scope(s) for the method you are building.
19734 ///
19735 /// See [`Self::add_scope()`] for details.
19736 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyImportCall<'a, C>
19737 where
19738 I: IntoIterator<Item = St>,
19739 St: AsRef<str>,
19740 {
19741 self._scopes
19742 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19743 self
19744 }
19745
19746 /// Removes all scopes, and no default scope will be used either.
19747 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19748 /// for details).
19749 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyImportCall<'a, C> {
19750 self._scopes.clear();
19751 self
19752 }
19753}
19754
19755/// Lists all taxonomies in a project in a particular location that the caller has permission to view.
19756///
19757/// A builder for the *locations.taxonomies.list* method supported by a *project* resource.
19758/// It is not used directly, but through a [`ProjectMethods`] instance.
19759///
19760/// # Example
19761///
19762/// Instantiate a resource method builder
19763///
19764/// ```test_harness,no_run
19765/// # extern crate hyper;
19766/// # extern crate hyper_rustls;
19767/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
19768/// # async fn dox() {
19769/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19770///
19771/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19772/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19773/// # .with_native_roots()
19774/// # .unwrap()
19775/// # .https_only()
19776/// # .enable_http2()
19777/// # .build();
19778///
19779/// # let executor = hyper_util::rt::TokioExecutor::new();
19780/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19781/// # secret,
19782/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19783/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19784/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19785/// # ),
19786/// # ).build().await.unwrap();
19787///
19788/// # let client = hyper_util::client::legacy::Client::builder(
19789/// # hyper_util::rt::TokioExecutor::new()
19790/// # )
19791/// # .build(
19792/// # hyper_rustls::HttpsConnectorBuilder::new()
19793/// # .with_native_roots()
19794/// # .unwrap()
19795/// # .https_or_http()
19796/// # .enable_http2()
19797/// # .build()
19798/// # );
19799/// # let mut hub = DataCatalog::new(client, auth);
19800/// // You can configure optional parameters by calling the respective setters at will, and
19801/// // execute the final call using `doit()`.
19802/// // Values shown here are possibly random and not representative !
19803/// let result = hub.projects().locations_taxonomies_list("parent")
19804/// .page_token("consetetur")
19805/// .page_size(-2)
19806/// .filter("sed")
19807/// .doit().await;
19808/// # }
19809/// ```
19810pub struct ProjectLocationTaxonomyListCall<'a, C>
19811where
19812 C: 'a,
19813{
19814 hub: &'a DataCatalog<C>,
19815 _parent: String,
19816 _page_token: Option<String>,
19817 _page_size: Option<i32>,
19818 _filter: Option<String>,
19819 _delegate: Option<&'a mut dyn common::Delegate>,
19820 _additional_params: HashMap<String, String>,
19821 _scopes: BTreeSet<String>,
19822}
19823
19824impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyListCall<'a, C> {}
19825
19826impl<'a, C> ProjectLocationTaxonomyListCall<'a, C>
19827where
19828 C: common::Connector,
19829{
19830 /// Perform the operation you have build so far.
19831 pub async fn doit(
19832 mut self,
19833 ) -> common::Result<(
19834 common::Response,
19835 GoogleCloudDatacatalogV1beta1ListTaxonomiesResponse,
19836 )> {
19837 use std::borrow::Cow;
19838 use std::io::{Read, Seek};
19839
19840 use common::{url::Params, ToParts};
19841 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19842
19843 let mut dd = common::DefaultDelegate;
19844 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19845 dlg.begin(common::MethodInfo {
19846 id: "datacatalog.projects.locations.taxonomies.list",
19847 http_method: hyper::Method::GET,
19848 });
19849
19850 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
19851 if self._additional_params.contains_key(field) {
19852 dlg.finished(false);
19853 return Err(common::Error::FieldClash(field));
19854 }
19855 }
19856
19857 let mut params = Params::with_capacity(6 + self._additional_params.len());
19858 params.push("parent", self._parent);
19859 if let Some(value) = self._page_token.as_ref() {
19860 params.push("pageToken", value);
19861 }
19862 if let Some(value) = self._page_size.as_ref() {
19863 params.push("pageSize", value.to_string());
19864 }
19865 if let Some(value) = self._filter.as_ref() {
19866 params.push("filter", value);
19867 }
19868
19869 params.extend(self._additional_params.iter());
19870
19871 params.push("alt", "json");
19872 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/taxonomies";
19873 if self._scopes.is_empty() {
19874 self._scopes
19875 .insert(Scope::CloudPlatform.as_ref().to_string());
19876 }
19877
19878 #[allow(clippy::single_element_loop)]
19879 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19880 url = params.uri_replacement(url, param_name, find_this, true);
19881 }
19882 {
19883 let to_remove = ["parent"];
19884 params.remove_params(&to_remove);
19885 }
19886
19887 let url = params.parse_with_url(&url);
19888
19889 loop {
19890 let token = match self
19891 .hub
19892 .auth
19893 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19894 .await
19895 {
19896 Ok(token) => token,
19897 Err(e) => match dlg.token(e) {
19898 Ok(token) => token,
19899 Err(e) => {
19900 dlg.finished(false);
19901 return Err(common::Error::MissingToken(e));
19902 }
19903 },
19904 };
19905 let mut req_result = {
19906 let client = &self.hub.client;
19907 dlg.pre_request();
19908 let mut req_builder = hyper::Request::builder()
19909 .method(hyper::Method::GET)
19910 .uri(url.as_str())
19911 .header(USER_AGENT, self.hub._user_agent.clone());
19912
19913 if let Some(token) = token.as_ref() {
19914 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19915 }
19916
19917 let request = req_builder
19918 .header(CONTENT_LENGTH, 0_u64)
19919 .body(common::to_body::<String>(None));
19920
19921 client.request(request.unwrap()).await
19922 };
19923
19924 match req_result {
19925 Err(err) => {
19926 if let common::Retry::After(d) = dlg.http_error(&err) {
19927 sleep(d).await;
19928 continue;
19929 }
19930 dlg.finished(false);
19931 return Err(common::Error::HttpError(err));
19932 }
19933 Ok(res) => {
19934 let (mut parts, body) = res.into_parts();
19935 let mut body = common::Body::new(body);
19936 if !parts.status.is_success() {
19937 let bytes = common::to_bytes(body).await.unwrap_or_default();
19938 let error = serde_json::from_str(&common::to_string(&bytes));
19939 let response = common::to_response(parts, bytes.into());
19940
19941 if let common::Retry::After(d) =
19942 dlg.http_failure(&response, error.as_ref().ok())
19943 {
19944 sleep(d).await;
19945 continue;
19946 }
19947
19948 dlg.finished(false);
19949
19950 return Err(match error {
19951 Ok(value) => common::Error::BadRequest(value),
19952 _ => common::Error::Failure(response),
19953 });
19954 }
19955 let response = {
19956 let bytes = common::to_bytes(body).await.unwrap_or_default();
19957 let encoded = common::to_string(&bytes);
19958 match serde_json::from_str(&encoded) {
19959 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19960 Err(error) => {
19961 dlg.response_json_decode_error(&encoded, &error);
19962 return Err(common::Error::JsonDecodeError(
19963 encoded.to_string(),
19964 error,
19965 ));
19966 }
19967 }
19968 };
19969
19970 dlg.finished(true);
19971 return Ok(response);
19972 }
19973 }
19974 }
19975 }
19976
19977 /// Required. Resource name of the project to list the taxonomies of.
19978 ///
19979 /// Sets the *parent* path property to the given value.
19980 ///
19981 /// Even though the property as already been set when instantiating this call,
19982 /// we provide this method for API completeness.
19983 pub fn parent(mut self, new_value: &str) -> ProjectLocationTaxonomyListCall<'a, C> {
19984 self._parent = new_value.to_string();
19985 self
19986 }
19987 /// The next_page_token value returned from a previous list request, if any. If not set, defaults to an empty string.
19988 ///
19989 /// Sets the *page token* query property to the given value.
19990 pub fn page_token(mut self, new_value: &str) -> ProjectLocationTaxonomyListCall<'a, C> {
19991 self._page_token = Some(new_value.to_string());
19992 self
19993 }
19994 /// The maximum number of items to return. Must be a value between 1 and 1000. If not set, defaults to 50.
19995 ///
19996 /// Sets the *page size* query property to the given value.
19997 pub fn page_size(mut self, new_value: i32) -> ProjectLocationTaxonomyListCall<'a, C> {
19998 self._page_size = Some(new_value);
19999 self
20000 }
20001 /// Supported field for filter is 'service' and value is 'dataplex'. Eg: service=dataplex.
20002 ///
20003 /// Sets the *filter* query property to the given value.
20004 pub fn filter(mut self, new_value: &str) -> ProjectLocationTaxonomyListCall<'a, C> {
20005 self._filter = Some(new_value.to_string());
20006 self
20007 }
20008 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20009 /// while executing the actual API request.
20010 ///
20011 /// ````text
20012 /// It should be used to handle progress information, and to implement a certain level of resilience.
20013 /// ````
20014 ///
20015 /// Sets the *delegate* property to the given value.
20016 pub fn delegate(
20017 mut self,
20018 new_value: &'a mut dyn common::Delegate,
20019 ) -> ProjectLocationTaxonomyListCall<'a, C> {
20020 self._delegate = Some(new_value);
20021 self
20022 }
20023
20024 /// Set any additional parameter of the query string used in the request.
20025 /// It should be used to set parameters which are not yet available through their own
20026 /// setters.
20027 ///
20028 /// Please note that this method must not be used to set any of the known parameters
20029 /// which have their own setter method. If done anyway, the request will fail.
20030 ///
20031 /// # Additional Parameters
20032 ///
20033 /// * *$.xgafv* (query-string) - V1 error format.
20034 /// * *access_token* (query-string) - OAuth access token.
20035 /// * *alt* (query-string) - Data format for response.
20036 /// * *callback* (query-string) - JSONP
20037 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20038 /// * *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.
20039 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20040 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20041 /// * *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.
20042 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20043 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20044 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyListCall<'a, C>
20045 where
20046 T: AsRef<str>,
20047 {
20048 self._additional_params
20049 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20050 self
20051 }
20052
20053 /// Identifies the authorization scope for the method you are building.
20054 ///
20055 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20056 /// [`Scope::CloudPlatform`].
20057 ///
20058 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20059 /// tokens for more than one scope.
20060 ///
20061 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20062 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20063 /// sufficient, a read-write scope will do as well.
20064 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyListCall<'a, C>
20065 where
20066 St: AsRef<str>,
20067 {
20068 self._scopes.insert(String::from(scope.as_ref()));
20069 self
20070 }
20071 /// Identifies the authorization scope(s) for the method you are building.
20072 ///
20073 /// See [`Self::add_scope()`] for details.
20074 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyListCall<'a, C>
20075 where
20076 I: IntoIterator<Item = St>,
20077 St: AsRef<str>,
20078 {
20079 self._scopes
20080 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20081 self
20082 }
20083
20084 /// Removes all scopes, and no default scope will be used either.
20085 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20086 /// for details).
20087 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyListCall<'a, C> {
20088 self._scopes.clear();
20089 self
20090 }
20091}
20092
20093/// Updates a taxonomy.
20094///
20095/// A builder for the *locations.taxonomies.patch* method supported by a *project* resource.
20096/// It is not used directly, but through a [`ProjectMethods`] instance.
20097///
20098/// # Example
20099///
20100/// Instantiate a resource method builder
20101///
20102/// ```test_harness,no_run
20103/// # extern crate hyper;
20104/// # extern crate hyper_rustls;
20105/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
20106/// use datacatalog1_beta1::api::GoogleCloudDatacatalogV1beta1Taxonomy;
20107/// # async fn dox() {
20108/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20109///
20110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20111/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20112/// # .with_native_roots()
20113/// # .unwrap()
20114/// # .https_only()
20115/// # .enable_http2()
20116/// # .build();
20117///
20118/// # let executor = hyper_util::rt::TokioExecutor::new();
20119/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20120/// # secret,
20121/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20122/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20123/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20124/// # ),
20125/// # ).build().await.unwrap();
20126///
20127/// # let client = hyper_util::client::legacy::Client::builder(
20128/// # hyper_util::rt::TokioExecutor::new()
20129/// # )
20130/// # .build(
20131/// # hyper_rustls::HttpsConnectorBuilder::new()
20132/// # .with_native_roots()
20133/// # .unwrap()
20134/// # .https_or_http()
20135/// # .enable_http2()
20136/// # .build()
20137/// # );
20138/// # let mut hub = DataCatalog::new(client, auth);
20139/// // As the method needs a request, you would usually fill it with the desired information
20140/// // into the respective structure. Some of the parts shown here might not be applicable !
20141/// // Values shown here are possibly random and not representative !
20142/// let mut req = GoogleCloudDatacatalogV1beta1Taxonomy::default();
20143///
20144/// // You can configure optional parameters by calling the respective setters at will, and
20145/// // execute the final call using `doit()`.
20146/// // Values shown here are possibly random and not representative !
20147/// let result = hub.projects().locations_taxonomies_patch(req, "name")
20148/// .update_mask(FieldMask::new::<&str>(&[]))
20149/// .doit().await;
20150/// # }
20151/// ```
20152pub struct ProjectLocationTaxonomyPatchCall<'a, C>
20153where
20154 C: 'a,
20155{
20156 hub: &'a DataCatalog<C>,
20157 _request: GoogleCloudDatacatalogV1beta1Taxonomy,
20158 _name: String,
20159 _update_mask: Option<common::FieldMask>,
20160 _delegate: Option<&'a mut dyn common::Delegate>,
20161 _additional_params: HashMap<String, String>,
20162 _scopes: BTreeSet<String>,
20163}
20164
20165impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyPatchCall<'a, C> {}
20166
20167impl<'a, C> ProjectLocationTaxonomyPatchCall<'a, C>
20168where
20169 C: common::Connector,
20170{
20171 /// Perform the operation you have build so far.
20172 pub async fn doit(
20173 mut self,
20174 ) -> common::Result<(common::Response, GoogleCloudDatacatalogV1beta1Taxonomy)> {
20175 use std::borrow::Cow;
20176 use std::io::{Read, Seek};
20177
20178 use common::{url::Params, ToParts};
20179 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20180
20181 let mut dd = common::DefaultDelegate;
20182 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20183 dlg.begin(common::MethodInfo {
20184 id: "datacatalog.projects.locations.taxonomies.patch",
20185 http_method: hyper::Method::PATCH,
20186 });
20187
20188 for &field in ["alt", "name", "updateMask"].iter() {
20189 if self._additional_params.contains_key(field) {
20190 dlg.finished(false);
20191 return Err(common::Error::FieldClash(field));
20192 }
20193 }
20194
20195 let mut params = Params::with_capacity(5 + self._additional_params.len());
20196 params.push("name", self._name);
20197 if let Some(value) = self._update_mask.as_ref() {
20198 params.push("updateMask", value.to_string());
20199 }
20200
20201 params.extend(self._additional_params.iter());
20202
20203 params.push("alt", "json");
20204 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
20205 if self._scopes.is_empty() {
20206 self._scopes
20207 .insert(Scope::CloudPlatform.as_ref().to_string());
20208 }
20209
20210 #[allow(clippy::single_element_loop)]
20211 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20212 url = params.uri_replacement(url, param_name, find_this, true);
20213 }
20214 {
20215 let to_remove = ["name"];
20216 params.remove_params(&to_remove);
20217 }
20218
20219 let url = params.parse_with_url(&url);
20220
20221 let mut json_mime_type = mime::APPLICATION_JSON;
20222 let mut request_value_reader = {
20223 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20224 common::remove_json_null_values(&mut value);
20225 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20226 serde_json::to_writer(&mut dst, &value).unwrap();
20227 dst
20228 };
20229 let request_size = request_value_reader
20230 .seek(std::io::SeekFrom::End(0))
20231 .unwrap();
20232 request_value_reader
20233 .seek(std::io::SeekFrom::Start(0))
20234 .unwrap();
20235
20236 loop {
20237 let token = match self
20238 .hub
20239 .auth
20240 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20241 .await
20242 {
20243 Ok(token) => token,
20244 Err(e) => match dlg.token(e) {
20245 Ok(token) => token,
20246 Err(e) => {
20247 dlg.finished(false);
20248 return Err(common::Error::MissingToken(e));
20249 }
20250 },
20251 };
20252 request_value_reader
20253 .seek(std::io::SeekFrom::Start(0))
20254 .unwrap();
20255 let mut req_result = {
20256 let client = &self.hub.client;
20257 dlg.pre_request();
20258 let mut req_builder = hyper::Request::builder()
20259 .method(hyper::Method::PATCH)
20260 .uri(url.as_str())
20261 .header(USER_AGENT, self.hub._user_agent.clone());
20262
20263 if let Some(token) = token.as_ref() {
20264 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20265 }
20266
20267 let request = req_builder
20268 .header(CONTENT_TYPE, json_mime_type.to_string())
20269 .header(CONTENT_LENGTH, request_size as u64)
20270 .body(common::to_body(
20271 request_value_reader.get_ref().clone().into(),
20272 ));
20273
20274 client.request(request.unwrap()).await
20275 };
20276
20277 match req_result {
20278 Err(err) => {
20279 if let common::Retry::After(d) = dlg.http_error(&err) {
20280 sleep(d).await;
20281 continue;
20282 }
20283 dlg.finished(false);
20284 return Err(common::Error::HttpError(err));
20285 }
20286 Ok(res) => {
20287 let (mut parts, body) = res.into_parts();
20288 let mut body = common::Body::new(body);
20289 if !parts.status.is_success() {
20290 let bytes = common::to_bytes(body).await.unwrap_or_default();
20291 let error = serde_json::from_str(&common::to_string(&bytes));
20292 let response = common::to_response(parts, bytes.into());
20293
20294 if let common::Retry::After(d) =
20295 dlg.http_failure(&response, error.as_ref().ok())
20296 {
20297 sleep(d).await;
20298 continue;
20299 }
20300
20301 dlg.finished(false);
20302
20303 return Err(match error {
20304 Ok(value) => common::Error::BadRequest(value),
20305 _ => common::Error::Failure(response),
20306 });
20307 }
20308 let response = {
20309 let bytes = common::to_bytes(body).await.unwrap_or_default();
20310 let encoded = common::to_string(&bytes);
20311 match serde_json::from_str(&encoded) {
20312 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20313 Err(error) => {
20314 dlg.response_json_decode_error(&encoded, &error);
20315 return Err(common::Error::JsonDecodeError(
20316 encoded.to_string(),
20317 error,
20318 ));
20319 }
20320 }
20321 };
20322
20323 dlg.finished(true);
20324 return Ok(response);
20325 }
20326 }
20327 }
20328 }
20329
20330 ///
20331 /// Sets the *request* property to the given value.
20332 ///
20333 /// Even though the property as already been set when instantiating this call,
20334 /// we provide this method for API completeness.
20335 pub fn request(
20336 mut self,
20337 new_value: GoogleCloudDatacatalogV1beta1Taxonomy,
20338 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
20339 self._request = new_value;
20340 self
20341 }
20342 /// Identifier. Resource name of this taxonomy, whose format is: "projects/{project_number}/locations/{location_id}/taxonomies/{id}".
20343 ///
20344 /// Sets the *name* path property to the given value.
20345 ///
20346 /// Even though the property as already been set when instantiating this call,
20347 /// we provide this method for API completeness.
20348 pub fn name(mut self, new_value: &str) -> ProjectLocationTaxonomyPatchCall<'a, C> {
20349 self._name = new_value.to_string();
20350 self
20351 }
20352 /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If not set, defaults to all of the fields that are allowed to update.
20353 ///
20354 /// Sets the *update mask* query property to the given value.
20355 pub fn update_mask(
20356 mut self,
20357 new_value: common::FieldMask,
20358 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
20359 self._update_mask = Some(new_value);
20360 self
20361 }
20362 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20363 /// while executing the actual API request.
20364 ///
20365 /// ````text
20366 /// It should be used to handle progress information, and to implement a certain level of resilience.
20367 /// ````
20368 ///
20369 /// Sets the *delegate* property to the given value.
20370 pub fn delegate(
20371 mut self,
20372 new_value: &'a mut dyn common::Delegate,
20373 ) -> ProjectLocationTaxonomyPatchCall<'a, C> {
20374 self._delegate = Some(new_value);
20375 self
20376 }
20377
20378 /// Set any additional parameter of the query string used in the request.
20379 /// It should be used to set parameters which are not yet available through their own
20380 /// setters.
20381 ///
20382 /// Please note that this method must not be used to set any of the known parameters
20383 /// which have their own setter method. If done anyway, the request will fail.
20384 ///
20385 /// # Additional Parameters
20386 ///
20387 /// * *$.xgafv* (query-string) - V1 error format.
20388 /// * *access_token* (query-string) - OAuth access token.
20389 /// * *alt* (query-string) - Data format for response.
20390 /// * *callback* (query-string) - JSONP
20391 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20392 /// * *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.
20393 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20394 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20395 /// * *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.
20396 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20397 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20398 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomyPatchCall<'a, C>
20399 where
20400 T: AsRef<str>,
20401 {
20402 self._additional_params
20403 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20404 self
20405 }
20406
20407 /// Identifies the authorization scope for the method you are building.
20408 ///
20409 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20410 /// [`Scope::CloudPlatform`].
20411 ///
20412 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20413 /// tokens for more than one scope.
20414 ///
20415 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20416 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20417 /// sufficient, a read-write scope will do as well.
20418 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyPatchCall<'a, C>
20419 where
20420 St: AsRef<str>,
20421 {
20422 self._scopes.insert(String::from(scope.as_ref()));
20423 self
20424 }
20425 /// Identifies the authorization scope(s) for the method you are building.
20426 ///
20427 /// See [`Self::add_scope()`] for details.
20428 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomyPatchCall<'a, C>
20429 where
20430 I: IntoIterator<Item = St>,
20431 St: AsRef<str>,
20432 {
20433 self._scopes
20434 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20435 self
20436 }
20437
20438 /// Removes all scopes, and no default scope will be used either.
20439 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20440 /// for details).
20441 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyPatchCall<'a, C> {
20442 self._scopes.clear();
20443 self
20444 }
20445}
20446
20447/// Sets the IAM policy for a taxonomy or a policy tag.
20448///
20449/// A builder for the *locations.taxonomies.setIamPolicy* method supported by a *project* resource.
20450/// It is not used directly, but through a [`ProjectMethods`] instance.
20451///
20452/// # Example
20453///
20454/// Instantiate a resource method builder
20455///
20456/// ```test_harness,no_run
20457/// # extern crate hyper;
20458/// # extern crate hyper_rustls;
20459/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
20460/// use datacatalog1_beta1::api::SetIamPolicyRequest;
20461/// # async fn dox() {
20462/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20463///
20464/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20465/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20466/// # .with_native_roots()
20467/// # .unwrap()
20468/// # .https_only()
20469/// # .enable_http2()
20470/// # .build();
20471///
20472/// # let executor = hyper_util::rt::TokioExecutor::new();
20473/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20474/// # secret,
20475/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20476/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20477/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20478/// # ),
20479/// # ).build().await.unwrap();
20480///
20481/// # let client = hyper_util::client::legacy::Client::builder(
20482/// # hyper_util::rt::TokioExecutor::new()
20483/// # )
20484/// # .build(
20485/// # hyper_rustls::HttpsConnectorBuilder::new()
20486/// # .with_native_roots()
20487/// # .unwrap()
20488/// # .https_or_http()
20489/// # .enable_http2()
20490/// # .build()
20491/// # );
20492/// # let mut hub = DataCatalog::new(client, auth);
20493/// // As the method needs a request, you would usually fill it with the desired information
20494/// // into the respective structure. Some of the parts shown here might not be applicable !
20495/// // Values shown here are possibly random and not representative !
20496/// let mut req = SetIamPolicyRequest::default();
20497///
20498/// // You can configure optional parameters by calling the respective setters at will, and
20499/// // execute the final call using `doit()`.
20500/// // Values shown here are possibly random and not representative !
20501/// let result = hub.projects().locations_taxonomies_set_iam_policy(req, "resource")
20502/// .doit().await;
20503/// # }
20504/// ```
20505pub struct ProjectLocationTaxonomySetIamPolicyCall<'a, C>
20506where
20507 C: 'a,
20508{
20509 hub: &'a DataCatalog<C>,
20510 _request: SetIamPolicyRequest,
20511 _resource: String,
20512 _delegate: Option<&'a mut dyn common::Delegate>,
20513 _additional_params: HashMap<String, String>,
20514 _scopes: BTreeSet<String>,
20515}
20516
20517impl<'a, C> common::CallBuilder for ProjectLocationTaxonomySetIamPolicyCall<'a, C> {}
20518
20519impl<'a, C> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
20520where
20521 C: common::Connector,
20522{
20523 /// Perform the operation you have build so far.
20524 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
20525 use std::borrow::Cow;
20526 use std::io::{Read, Seek};
20527
20528 use common::{url::Params, ToParts};
20529 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20530
20531 let mut dd = common::DefaultDelegate;
20532 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20533 dlg.begin(common::MethodInfo {
20534 id: "datacatalog.projects.locations.taxonomies.setIamPolicy",
20535 http_method: hyper::Method::POST,
20536 });
20537
20538 for &field in ["alt", "resource"].iter() {
20539 if self._additional_params.contains_key(field) {
20540 dlg.finished(false);
20541 return Err(common::Error::FieldClash(field));
20542 }
20543 }
20544
20545 let mut params = Params::with_capacity(4 + self._additional_params.len());
20546 params.push("resource", self._resource);
20547
20548 params.extend(self._additional_params.iter());
20549
20550 params.push("alt", "json");
20551 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
20552 if self._scopes.is_empty() {
20553 self._scopes
20554 .insert(Scope::CloudPlatform.as_ref().to_string());
20555 }
20556
20557 #[allow(clippy::single_element_loop)]
20558 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20559 url = params.uri_replacement(url, param_name, find_this, true);
20560 }
20561 {
20562 let to_remove = ["resource"];
20563 params.remove_params(&to_remove);
20564 }
20565
20566 let url = params.parse_with_url(&url);
20567
20568 let mut json_mime_type = mime::APPLICATION_JSON;
20569 let mut request_value_reader = {
20570 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20571 common::remove_json_null_values(&mut value);
20572 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20573 serde_json::to_writer(&mut dst, &value).unwrap();
20574 dst
20575 };
20576 let request_size = request_value_reader
20577 .seek(std::io::SeekFrom::End(0))
20578 .unwrap();
20579 request_value_reader
20580 .seek(std::io::SeekFrom::Start(0))
20581 .unwrap();
20582
20583 loop {
20584 let token = match self
20585 .hub
20586 .auth
20587 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20588 .await
20589 {
20590 Ok(token) => token,
20591 Err(e) => match dlg.token(e) {
20592 Ok(token) => token,
20593 Err(e) => {
20594 dlg.finished(false);
20595 return Err(common::Error::MissingToken(e));
20596 }
20597 },
20598 };
20599 request_value_reader
20600 .seek(std::io::SeekFrom::Start(0))
20601 .unwrap();
20602 let mut req_result = {
20603 let client = &self.hub.client;
20604 dlg.pre_request();
20605 let mut req_builder = hyper::Request::builder()
20606 .method(hyper::Method::POST)
20607 .uri(url.as_str())
20608 .header(USER_AGENT, self.hub._user_agent.clone());
20609
20610 if let Some(token) = token.as_ref() {
20611 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20612 }
20613
20614 let request = req_builder
20615 .header(CONTENT_TYPE, json_mime_type.to_string())
20616 .header(CONTENT_LENGTH, request_size as u64)
20617 .body(common::to_body(
20618 request_value_reader.get_ref().clone().into(),
20619 ));
20620
20621 client.request(request.unwrap()).await
20622 };
20623
20624 match req_result {
20625 Err(err) => {
20626 if let common::Retry::After(d) = dlg.http_error(&err) {
20627 sleep(d).await;
20628 continue;
20629 }
20630 dlg.finished(false);
20631 return Err(common::Error::HttpError(err));
20632 }
20633 Ok(res) => {
20634 let (mut parts, body) = res.into_parts();
20635 let mut body = common::Body::new(body);
20636 if !parts.status.is_success() {
20637 let bytes = common::to_bytes(body).await.unwrap_or_default();
20638 let error = serde_json::from_str(&common::to_string(&bytes));
20639 let response = common::to_response(parts, bytes.into());
20640
20641 if let common::Retry::After(d) =
20642 dlg.http_failure(&response, error.as_ref().ok())
20643 {
20644 sleep(d).await;
20645 continue;
20646 }
20647
20648 dlg.finished(false);
20649
20650 return Err(match error {
20651 Ok(value) => common::Error::BadRequest(value),
20652 _ => common::Error::Failure(response),
20653 });
20654 }
20655 let response = {
20656 let bytes = common::to_bytes(body).await.unwrap_or_default();
20657 let encoded = common::to_string(&bytes);
20658 match serde_json::from_str(&encoded) {
20659 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20660 Err(error) => {
20661 dlg.response_json_decode_error(&encoded, &error);
20662 return Err(common::Error::JsonDecodeError(
20663 encoded.to_string(),
20664 error,
20665 ));
20666 }
20667 }
20668 };
20669
20670 dlg.finished(true);
20671 return Ok(response);
20672 }
20673 }
20674 }
20675 }
20676
20677 ///
20678 /// Sets the *request* property to the given value.
20679 ///
20680 /// Even though the property as already been set when instantiating this call,
20681 /// we provide this method for API completeness.
20682 pub fn request(
20683 mut self,
20684 new_value: SetIamPolicyRequest,
20685 ) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
20686 self._request = new_value;
20687 self
20688 }
20689 /// 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.
20690 ///
20691 /// Sets the *resource* path property to the given value.
20692 ///
20693 /// Even though the property as already been set when instantiating this call,
20694 /// we provide this method for API completeness.
20695 pub fn resource(mut self, new_value: &str) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
20696 self._resource = new_value.to_string();
20697 self
20698 }
20699 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20700 /// while executing the actual API request.
20701 ///
20702 /// ````text
20703 /// It should be used to handle progress information, and to implement a certain level of resilience.
20704 /// ````
20705 ///
20706 /// Sets the *delegate* property to the given value.
20707 pub fn delegate(
20708 mut self,
20709 new_value: &'a mut dyn common::Delegate,
20710 ) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
20711 self._delegate = Some(new_value);
20712 self
20713 }
20714
20715 /// Set any additional parameter of the query string used in the request.
20716 /// It should be used to set parameters which are not yet available through their own
20717 /// setters.
20718 ///
20719 /// Please note that this method must not be used to set any of the known parameters
20720 /// which have their own setter method. If done anyway, the request will fail.
20721 ///
20722 /// # Additional Parameters
20723 ///
20724 /// * *$.xgafv* (query-string) - V1 error format.
20725 /// * *access_token* (query-string) - OAuth access token.
20726 /// * *alt* (query-string) - Data format for response.
20727 /// * *callback* (query-string) - JSONP
20728 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20729 /// * *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.
20730 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20731 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20732 /// * *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.
20733 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20734 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20735 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
20736 where
20737 T: AsRef<str>,
20738 {
20739 self._additional_params
20740 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20741 self
20742 }
20743
20744 /// Identifies the authorization scope for the method you are building.
20745 ///
20746 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20747 /// [`Scope::CloudPlatform`].
20748 ///
20749 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20750 /// tokens for more than one scope.
20751 ///
20752 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20753 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20754 /// sufficient, a read-write scope will do as well.
20755 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
20756 where
20757 St: AsRef<str>,
20758 {
20759 self._scopes.insert(String::from(scope.as_ref()));
20760 self
20761 }
20762 /// Identifies the authorization scope(s) for the method you are building.
20763 ///
20764 /// See [`Self::add_scope()`] for details.
20765 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C>
20766 where
20767 I: IntoIterator<Item = St>,
20768 St: AsRef<str>,
20769 {
20770 self._scopes
20771 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20772 self
20773 }
20774
20775 /// Removes all scopes, and no default scope will be used either.
20776 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20777 /// for details).
20778 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomySetIamPolicyCall<'a, C> {
20779 self._scopes.clear();
20780 self
20781 }
20782}
20783
20784/// Returns the permissions that a caller has on the specified taxonomy or policy tag.
20785///
20786/// A builder for the *locations.taxonomies.testIamPermissions* method supported by a *project* resource.
20787/// It is not used directly, but through a [`ProjectMethods`] instance.
20788///
20789/// # Example
20790///
20791/// Instantiate a resource method builder
20792///
20793/// ```test_harness,no_run
20794/// # extern crate hyper;
20795/// # extern crate hyper_rustls;
20796/// # extern crate google_datacatalog1_beta1 as datacatalog1_beta1;
20797/// use datacatalog1_beta1::api::TestIamPermissionsRequest;
20798/// # async fn dox() {
20799/// # use datacatalog1_beta1::{DataCatalog, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20800///
20801/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20802/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20803/// # .with_native_roots()
20804/// # .unwrap()
20805/// # .https_only()
20806/// # .enable_http2()
20807/// # .build();
20808///
20809/// # let executor = hyper_util::rt::TokioExecutor::new();
20810/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20811/// # secret,
20812/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20813/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20814/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20815/// # ),
20816/// # ).build().await.unwrap();
20817///
20818/// # let client = hyper_util::client::legacy::Client::builder(
20819/// # hyper_util::rt::TokioExecutor::new()
20820/// # )
20821/// # .build(
20822/// # hyper_rustls::HttpsConnectorBuilder::new()
20823/// # .with_native_roots()
20824/// # .unwrap()
20825/// # .https_or_http()
20826/// # .enable_http2()
20827/// # .build()
20828/// # );
20829/// # let mut hub = DataCatalog::new(client, auth);
20830/// // As the method needs a request, you would usually fill it with the desired information
20831/// // into the respective structure. Some of the parts shown here might not be applicable !
20832/// // Values shown here are possibly random and not representative !
20833/// let mut req = TestIamPermissionsRequest::default();
20834///
20835/// // You can configure optional parameters by calling the respective setters at will, and
20836/// // execute the final call using `doit()`.
20837/// // Values shown here are possibly random and not representative !
20838/// let result = hub.projects().locations_taxonomies_test_iam_permissions(req, "resource")
20839/// .doit().await;
20840/// # }
20841/// ```
20842pub struct ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
20843where
20844 C: 'a,
20845{
20846 hub: &'a DataCatalog<C>,
20847 _request: TestIamPermissionsRequest,
20848 _resource: String,
20849 _delegate: Option<&'a mut dyn common::Delegate>,
20850 _additional_params: HashMap<String, String>,
20851 _scopes: BTreeSet<String>,
20852}
20853
20854impl<'a, C> common::CallBuilder for ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {}
20855
20856impl<'a, C> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
20857where
20858 C: common::Connector,
20859{
20860 /// Perform the operation you have build so far.
20861 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
20862 use std::borrow::Cow;
20863 use std::io::{Read, Seek};
20864
20865 use common::{url::Params, ToParts};
20866 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20867
20868 let mut dd = common::DefaultDelegate;
20869 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20870 dlg.begin(common::MethodInfo {
20871 id: "datacatalog.projects.locations.taxonomies.testIamPermissions",
20872 http_method: hyper::Method::POST,
20873 });
20874
20875 for &field in ["alt", "resource"].iter() {
20876 if self._additional_params.contains_key(field) {
20877 dlg.finished(false);
20878 return Err(common::Error::FieldClash(field));
20879 }
20880 }
20881
20882 let mut params = Params::with_capacity(4 + self._additional_params.len());
20883 params.push("resource", self._resource);
20884
20885 params.extend(self._additional_params.iter());
20886
20887 params.push("alt", "json");
20888 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
20889 if self._scopes.is_empty() {
20890 self._scopes
20891 .insert(Scope::CloudPlatform.as_ref().to_string());
20892 }
20893
20894 #[allow(clippy::single_element_loop)]
20895 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20896 url = params.uri_replacement(url, param_name, find_this, true);
20897 }
20898 {
20899 let to_remove = ["resource"];
20900 params.remove_params(&to_remove);
20901 }
20902
20903 let url = params.parse_with_url(&url);
20904
20905 let mut json_mime_type = mime::APPLICATION_JSON;
20906 let mut request_value_reader = {
20907 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20908 common::remove_json_null_values(&mut value);
20909 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20910 serde_json::to_writer(&mut dst, &value).unwrap();
20911 dst
20912 };
20913 let request_size = request_value_reader
20914 .seek(std::io::SeekFrom::End(0))
20915 .unwrap();
20916 request_value_reader
20917 .seek(std::io::SeekFrom::Start(0))
20918 .unwrap();
20919
20920 loop {
20921 let token = match self
20922 .hub
20923 .auth
20924 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20925 .await
20926 {
20927 Ok(token) => token,
20928 Err(e) => match dlg.token(e) {
20929 Ok(token) => token,
20930 Err(e) => {
20931 dlg.finished(false);
20932 return Err(common::Error::MissingToken(e));
20933 }
20934 },
20935 };
20936 request_value_reader
20937 .seek(std::io::SeekFrom::Start(0))
20938 .unwrap();
20939 let mut req_result = {
20940 let client = &self.hub.client;
20941 dlg.pre_request();
20942 let mut req_builder = hyper::Request::builder()
20943 .method(hyper::Method::POST)
20944 .uri(url.as_str())
20945 .header(USER_AGENT, self.hub._user_agent.clone());
20946
20947 if let Some(token) = token.as_ref() {
20948 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20949 }
20950
20951 let request = req_builder
20952 .header(CONTENT_TYPE, json_mime_type.to_string())
20953 .header(CONTENT_LENGTH, request_size as u64)
20954 .body(common::to_body(
20955 request_value_reader.get_ref().clone().into(),
20956 ));
20957
20958 client.request(request.unwrap()).await
20959 };
20960
20961 match req_result {
20962 Err(err) => {
20963 if let common::Retry::After(d) = dlg.http_error(&err) {
20964 sleep(d).await;
20965 continue;
20966 }
20967 dlg.finished(false);
20968 return Err(common::Error::HttpError(err));
20969 }
20970 Ok(res) => {
20971 let (mut parts, body) = res.into_parts();
20972 let mut body = common::Body::new(body);
20973 if !parts.status.is_success() {
20974 let bytes = common::to_bytes(body).await.unwrap_or_default();
20975 let error = serde_json::from_str(&common::to_string(&bytes));
20976 let response = common::to_response(parts, bytes.into());
20977
20978 if let common::Retry::After(d) =
20979 dlg.http_failure(&response, error.as_ref().ok())
20980 {
20981 sleep(d).await;
20982 continue;
20983 }
20984
20985 dlg.finished(false);
20986
20987 return Err(match error {
20988 Ok(value) => common::Error::BadRequest(value),
20989 _ => common::Error::Failure(response),
20990 });
20991 }
20992 let response = {
20993 let bytes = common::to_bytes(body).await.unwrap_or_default();
20994 let encoded = common::to_string(&bytes);
20995 match serde_json::from_str(&encoded) {
20996 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20997 Err(error) => {
20998 dlg.response_json_decode_error(&encoded, &error);
20999 return Err(common::Error::JsonDecodeError(
21000 encoded.to_string(),
21001 error,
21002 ));
21003 }
21004 }
21005 };
21006
21007 dlg.finished(true);
21008 return Ok(response);
21009 }
21010 }
21011 }
21012 }
21013
21014 ///
21015 /// Sets the *request* property to the given value.
21016 ///
21017 /// Even though the property as already been set when instantiating this call,
21018 /// we provide this method for API completeness.
21019 pub fn request(
21020 mut self,
21021 new_value: TestIamPermissionsRequest,
21022 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
21023 self._request = new_value;
21024 self
21025 }
21026 /// 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.
21027 ///
21028 /// Sets the *resource* path property to the given value.
21029 ///
21030 /// Even though the property as already been set when instantiating this call,
21031 /// we provide this method for API completeness.
21032 pub fn resource(
21033 mut self,
21034 new_value: &str,
21035 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
21036 self._resource = new_value.to_string();
21037 self
21038 }
21039 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21040 /// while executing the actual API request.
21041 ///
21042 /// ````text
21043 /// It should be used to handle progress information, and to implement a certain level of resilience.
21044 /// ````
21045 ///
21046 /// Sets the *delegate* property to the given value.
21047 pub fn delegate(
21048 mut self,
21049 new_value: &'a mut dyn common::Delegate,
21050 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
21051 self._delegate = Some(new_value);
21052 self
21053 }
21054
21055 /// Set any additional parameter of the query string used in the request.
21056 /// It should be used to set parameters which are not yet available through their own
21057 /// setters.
21058 ///
21059 /// Please note that this method must not be used to set any of the known parameters
21060 /// which have their own setter method. If done anyway, the request will fail.
21061 ///
21062 /// # Additional Parameters
21063 ///
21064 /// * *$.xgafv* (query-string) - V1 error format.
21065 /// * *access_token* (query-string) - OAuth access token.
21066 /// * *alt* (query-string) - Data format for response.
21067 /// * *callback* (query-string) - JSONP
21068 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21069 /// * *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.
21070 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21071 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21072 /// * *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.
21073 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21074 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21075 pub fn param<T>(
21076 mut self,
21077 name: T,
21078 value: T,
21079 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
21080 where
21081 T: AsRef<str>,
21082 {
21083 self._additional_params
21084 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21085 self
21086 }
21087
21088 /// Identifies the authorization scope for the method you are building.
21089 ///
21090 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21091 /// [`Scope::CloudPlatform`].
21092 ///
21093 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21094 /// tokens for more than one scope.
21095 ///
21096 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21097 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21098 /// sufficient, a read-write scope will do as well.
21099 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
21100 where
21101 St: AsRef<str>,
21102 {
21103 self._scopes.insert(String::from(scope.as_ref()));
21104 self
21105 }
21106 /// Identifies the authorization scope(s) for the method you are building.
21107 ///
21108 /// See [`Self::add_scope()`] for details.
21109 pub fn add_scopes<I, St>(
21110 mut self,
21111 scopes: I,
21112 ) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C>
21113 where
21114 I: IntoIterator<Item = St>,
21115 St: AsRef<str>,
21116 {
21117 self._scopes
21118 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21119 self
21120 }
21121
21122 /// Removes all scopes, and no default scope will be used either.
21123 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21124 /// for details).
21125 pub fn clear_scopes(mut self) -> ProjectLocationTaxonomyTestIamPermissionCall<'a, C> {
21126 self._scopes.clear();
21127 self
21128 }
21129}