google_eventarc1/
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 Eventarc 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_eventarc1 as eventarc1;
49/// use eventarc1::api::Enrollment;
50/// use eventarc1::{Result, Error};
51/// # async fn dox() {
52/// use eventarc1::{Eventarc, 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 = Eventarc::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 = Enrollment::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_enrollments_patch(req, "name")
99///              .validate_only(true)
100///              .update_mask(FieldMask::new::<&str>(&[]))
101///              .allow_missing(true)
102///              .doit().await;
103///
104/// match result {
105///     Err(e) => match e {
106///         // The Error enum provides details about what exactly happened.
107///         // You can also just use its `Debug`, `Display` or `Error` traits
108///          Error::HttpError(_)
109///         |Error::Io(_)
110///         |Error::MissingAPIKey
111///         |Error::MissingToken(_)
112///         |Error::Cancelled
113///         |Error::UploadSizeLimitExceeded(_, _)
114///         |Error::Failure(_)
115///         |Error::BadRequest(_)
116///         |Error::FieldClash(_)
117///         |Error::JsonDecodeError(_, _) => println!("{}", e),
118///     },
119///     Ok(res) => println!("Success: {:?}", res),
120/// }
121/// # }
122/// ```
123#[derive(Clone)]
124pub struct Eventarc<C> {
125    pub client: common::Client<C>,
126    pub auth: Box<dyn common::GetToken>,
127    _user_agent: String,
128    _base_url: String,
129    _root_url: String,
130}
131
132impl<C> common::Hub for Eventarc<C> {}
133
134impl<'a, C> Eventarc<C> {
135    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Eventarc<C> {
136        Eventarc {
137            client,
138            auth: Box::new(auth),
139            _user_agent: "google-api-rust-client/7.0.0".to_string(),
140            _base_url: "https://eventarc.googleapis.com/".to_string(),
141            _root_url: "https://eventarc.googleapis.com/".to_string(),
142        }
143    }
144
145    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
146        ProjectMethods { hub: self }
147    }
148
149    /// Set the user-agent header field to use in all requests to the server.
150    /// It defaults to `google-api-rust-client/7.0.0`.
151    ///
152    /// Returns the previously set user-agent.
153    pub fn user_agent(&mut self, agent_name: String) -> String {
154        std::mem::replace(&mut self._user_agent, agent_name)
155    }
156
157    /// Set the base url to use in all requests to the server.
158    /// It defaults to `https://eventarc.googleapis.com/`.
159    ///
160    /// Returns the previously set base url.
161    pub fn base_url(&mut self, new_base_url: String) -> String {
162        std::mem::replace(&mut self._base_url, new_base_url)
163    }
164
165    /// Set the root url to use in all requests to the server.
166    /// It defaults to `https://eventarc.googleapis.com/`.
167    ///
168    /// Returns the previously set root url.
169    pub fn root_url(&mut self, new_root_url: String) -> String {
170        std::mem::replace(&mut self._root_url, new_root_url)
171    }
172}
173
174// ############
175// SCHEMAS ###
176// ##########
177/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
178///
179/// This type is not used in any activity, and only used as *part* of another schema.
180///
181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
182#[serde_with::serde_as]
183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
184pub struct AuditConfig {
185    /// The configuration for logging of each type of permission.
186    #[serde(rename = "auditLogConfigs")]
187    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
188    /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services.
189    pub service: Option<String>,
190}
191
192impl common::Part for AuditConfig {}
193
194/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
195///
196/// This type is not used in any activity, and only used as *part* of another schema.
197///
198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
199#[serde_with::serde_as]
200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
201pub struct AuditLogConfig {
202    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
203    #[serde(rename = "exemptedMembers")]
204    pub exempted_members: Option<Vec<String>>,
205    /// The log type that this config enables.
206    #[serde(rename = "logType")]
207    pub log_type: Option<String>,
208}
209
210impl common::Part for AuditLogConfig {}
211
212/// Associates `members`, or principals, with a `role`.
213///
214/// This type is not used in any activity, and only used as *part* of another schema.
215///
216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
217#[serde_with::serde_as]
218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
219pub struct Binding {
220    /// 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).
221    pub condition: Option<Expr>,
222    /// 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`.
223    pub members: Option<Vec<String>>,
224    /// 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).
225    pub role: Option<String>,
226}
227
228impl common::Part for Binding {}
229
230/// A representation of the Channel resource. A Channel is a resource on which event providers publish their events. The published events are delivered through the transport associated with the channel. Note that a channel is associated with exactly one event provider.
231///
232/// # Activities
233///
234/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
235/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
236///
237/// * [locations channels create projects](ProjectLocationChannelCreateCall) (request)
238/// * [locations channels get projects](ProjectLocationChannelGetCall) (response)
239/// * [locations channels patch projects](ProjectLocationChannelPatchCall) (request)
240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
241#[serde_with::serde_as]
242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
243pub struct Channel {
244    /// Output only. The activation token for the channel. The token must be used by the provider to register the channel for publishing.
245    #[serde(rename = "activationToken")]
246    pub activation_token: Option<String>,
247    /// Output only. The creation time.
248    #[serde(rename = "createTime")]
249    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
250    /// Optional. Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt their event data. It must match the pattern `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
251    #[serde(rename = "cryptoKeyName")]
252    pub crypto_key_name: Option<String>,
253    /// Optional. Resource labels.
254    pub labels: Option<HashMap<String, String>>,
255    /// Required. The resource name of the channel. Must be unique within the location on the project and must be in `projects/{project}/locations/{location}/channels/{channel_id}` format.
256    pub name: Option<String>,
257    /// The name of the event provider (e.g. Eventarc SaaS partner) associated with the channel. This provider will be granted permissions to publish events to the channel. Format: `projects/{project}/locations/{location}/providers/{provider_id}`.
258    pub provider: Option<String>,
259    /// Output only. The name of the Pub/Sub topic created and managed by Eventarc system as a transport for the event delivery. Format: `projects/{project}/topics/{topic_id}`.
260    #[serde(rename = "pubsubTopic")]
261    pub pubsub_topic: Option<String>,
262    /// Output only. Whether or not this Channel satisfies the requirements of physical zone separation
263    #[serde(rename = "satisfiesPzs")]
264    pub satisfies_pzs: Option<bool>,
265    /// Output only. The state of a Channel.
266    pub state: Option<String>,
267    /// Output only. Server assigned unique identifier for the channel. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
268    pub uid: Option<String>,
269    /// Output only. The last-modified time.
270    #[serde(rename = "updateTime")]
271    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
272}
273
274impl common::RequestValue for Channel {}
275impl common::ResponseResult for Channel {}
276
277/// A representation of the ChannelConnection resource. A ChannelConnection is a resource which event providers create during the activation process to establish a connection between the provider and the subscriber channel.
278///
279/// # Activities
280///
281/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
282/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
283///
284/// * [locations channel connections create projects](ProjectLocationChannelConnectionCreateCall) (request)
285/// * [locations channel connections get projects](ProjectLocationChannelConnectionGetCall) (response)
286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
287#[serde_with::serde_as]
288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
289pub struct ChannelConnection {
290    /// Input only. Activation token for the channel. The token will be used during the creation of ChannelConnection to bind the channel with the provider project. This field will not be stored in the provider resource.
291    #[serde(rename = "activationToken")]
292    pub activation_token: Option<String>,
293    /// Required. The name of the connected subscriber Channel. This is a weak reference to avoid cross project and cross accounts references. This must be in `projects/{project}/location/{location}/channels/{channel_id}` format.
294    pub channel: Option<String>,
295    /// Output only. The creation time.
296    #[serde(rename = "createTime")]
297    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
298    /// Optional. Resource labels.
299    pub labels: Option<HashMap<String, String>>,
300    /// Required. The name of the connection.
301    pub name: Option<String>,
302    /// Output only. Server assigned ID of the resource. The server guarantees uniqueness and immutability until deleted.
303    pub uid: Option<String>,
304    /// Output only. The last-modified time.
305    #[serde(rename = "updateTime")]
306    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
307}
308
309impl common::RequestValue for ChannelConnection {}
310impl common::ResponseResult for ChannelConnection {}
311
312/// Represents a Cloud Run destination.
313///
314/// This type is not used in any activity, and only used as *part* of another schema.
315///
316#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
317#[serde_with::serde_as]
318#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
319pub struct CloudRun {
320    /// Optional. The relative path on the Cloud Run service the events should be sent to. The value must conform to the definition of a URI path segment (section 3.3 of RFC2396). Examples: "/route", "route", "route/subroute".
321    pub path: Option<String>,
322    /// Required. The region the Cloud Run service is deployed in.
323    pub region: Option<String>,
324    /// Required. The name of the Cloud Run service being addressed. See https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services. Only services located in the same project as the trigger object can be addressed.
325    pub service: Option<String>,
326}
327
328impl common::Part for CloudRun {}
329
330/// Represents a target of an invocation over HTTP.
331///
332/// This type is not used in any activity, and only used as *part* of another schema.
333///
334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
335#[serde_with::serde_as]
336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
337pub struct Destination {
338    /// The Cloud Function resource name. Cloud Functions V1 and V2 are supported. Format: `projects/{project}/locations/{location}/functions/{function}` This is a read-only field. Creating Cloud Functions V1/V2 triggers is only supported via the Cloud Functions product. An error will be returned if the user sets this value.
339    #[serde(rename = "cloudFunction")]
340    pub cloud_function: Option<String>,
341    /// Cloud Run fully-managed resource that receives the events. The resource should be in the same project as the trigger.
342    #[serde(rename = "cloudRun")]
343    pub cloud_run: Option<CloudRun>,
344    /// A GKE service capable of receiving events. The service should be running in the same project as the trigger.
345    pub gke: Option<GKE>,
346    /// An HTTP endpoint destination described by an URI.
347    #[serde(rename = "httpEndpoint")]
348    pub http_endpoint: Option<HttpEndpoint>,
349    /// Optional. Network config is used to configure how Eventarc resolves and connect to a destination. This should only be used with HttpEndpoint destination type.
350    #[serde(rename = "networkConfig")]
351    pub network_config: Option<NetworkConfig>,
352    /// The resource name of the Workflow whose Executions are triggered by the events. The Workflow resource should be deployed in the same project as the trigger. Format: `projects/{project}/locations/{location}/workflows/{workflow}`
353    pub workflow: Option<String>,
354}
355
356impl common::Part for Destination {}
357
358/// 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); }
359///
360/// # Activities
361///
362/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
363/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
364///
365/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
366/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
368#[serde_with::serde_as]
369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
370pub struct Empty {
371    _never_set: Option<bool>,
372}
373
374impl common::ResponseResult for Empty {}
375
376/// An enrollment represents a subscription for messages on a particular message bus. It defines a matching criteria for messages on the bus and the subscriber endpoint where matched messages should be delivered.
377///
378/// # Activities
379///
380/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
381/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
382///
383/// * [locations enrollments create projects](ProjectLocationEnrollmentCreateCall) (request)
384/// * [locations enrollments get projects](ProjectLocationEnrollmentGetCall) (response)
385/// * [locations enrollments patch projects](ProjectLocationEnrollmentPatchCall) (request)
386#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
387#[serde_with::serde_as]
388#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
389pub struct Enrollment {
390    /// Optional. Resource annotations.
391    pub annotations: Option<HashMap<String, String>>,
392    /// Required. A CEL expression identifying which messages this enrollment applies to.
393    #[serde(rename = "celMatch")]
394    pub cel_match: Option<String>,
395    /// Output only. The creation time.
396    #[serde(rename = "createTime")]
397    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
398    /// Required. Destination is the Pipeline that the Enrollment is delivering to. It must point to the full resource name of a Pipeline. Format: "projects/{PROJECT_ID}/locations/{region}/pipelines/{PIPELINE_ID)"
399    pub destination: Option<String>,
400    /// Optional. Resource display name.
401    #[serde(rename = "displayName")]
402    pub display_name: Option<String>,
403    /// Output only. This checksum is computed by the server based on the value of other fields, and might be sent only on update and delete requests to ensure that the client has an up-to-date value before proceeding.
404    pub etag: Option<String>,
405    /// Optional. Resource labels.
406    pub labels: Option<HashMap<String, String>>,
407    /// Required. Immutable. Resource name of the message bus identifying the source of the messages. It matches the form projects/{project}/locations/{location}/messageBuses/{messageBus}.
408    #[serde(rename = "messageBus")]
409    pub message_bus: Option<String>,
410    /// Identifier. Resource name of the form projects/{project}/locations/{location}/enrollments/{enrollment}
411    pub name: Option<String>,
412    /// Output only. Server assigned unique identifier for the channel. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
413    pub uid: Option<String>,
414    /// Output only. The last-modified time.
415    #[serde(rename = "updateTime")]
416    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
417}
418
419impl common::RequestValue for Enrollment {}
420impl common::ResponseResult for Enrollment {}
421
422/// Filters events based on exact matches on the CloudEvents attributes.
423///
424/// This type is not used in any activity, and only used as *part* of another schema.
425///
426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
427#[serde_with::serde_as]
428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
429pub struct EventFilter {
430    /// Required. The name of a CloudEvents attribute. Currently, only a subset of attributes are supported for filtering. You can [retrieve a specific provider’s supported event types](https://cloud.google.com/eventarc/docs/list-providers#describe-provider). All triggers MUST provide a filter for the ‘type’ attribute.
431    pub attribute: Option<String>,
432    /// Optional. The operator used for matching the events with the value of the filter. If not specified, only events that have an exact key-value pair specified in the filter are matched. The allowed values are `path_pattern` and `match-path-pattern`. `path_pattern` is only allowed for GCFv1 triggers.
433    pub operator: Option<String>,
434    /// Required. The value for the attribute.
435    pub value: Option<String>,
436}
437
438impl common::Part for EventFilter {}
439
440/// A representation of the event type resource.
441///
442/// This type is not used in any activity, and only used as *part* of another schema.
443///
444#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
445#[serde_with::serde_as]
446#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
447pub struct EventType {
448    /// Output only. Human friendly description of what the event type is about. For example "Bucket created in Cloud Storage".
449    pub description: Option<String>,
450    /// Output only. URI for the event schema. For example "https://github.com/googleapis/google-cloudevents/blob/master/proto/google/events/cloud/storage/v1/events.proto"
451    #[serde(rename = "eventSchemaUri")]
452    pub event_schema_uri: Option<String>,
453    /// Output only. Filtering attributes for the event type.
454    #[serde(rename = "filteringAttributes")]
455    pub filtering_attributes: Option<Vec<FilteringAttribute>>,
456    /// Output only. The full name of the event type (for example, "google.cloud.storage.object.v1.finalized"). In the form of {provider-specific-prefix}.{resource}.{version}.{verb}. Types MUST be versioned and event schemas are guaranteed to remain backward compatible within one version. Note that event type versions and API versions do not need to match.
457    #[serde(rename = "type")]
458    pub type_: Option<String>,
459}
460
461impl common::Part for EventType {}
462
463/// 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.
464///
465/// This type is not used in any activity, and only used as *part* of another schema.
466///
467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
468#[serde_with::serde_as]
469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
470pub struct Expr {
471    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
472    pub description: Option<String>,
473    /// Textual representation of an expression in Common Expression Language syntax.
474    pub expression: Option<String>,
475    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
476    pub location: Option<String>,
477    /// 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.
478    pub title: Option<String>,
479}
480
481impl common::Part for Expr {}
482
483/// A representation of the FilteringAttribute resource. Filtering attributes are per event type.
484///
485/// This type is not used in any activity, and only used as *part* of another schema.
486///
487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
488#[serde_with::serde_as]
489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
490pub struct FilteringAttribute {
491    /// Output only. Attribute used for filtering the event type.
492    pub attribute: Option<String>,
493    /// Output only. Description of the purpose of the attribute.
494    pub description: Option<String>,
495    /// Output only. If true, the attribute accepts matching expressions in the Eventarc PathPattern format.
496    #[serde(rename = "pathPatternSupported")]
497    pub path_pattern_supported: Option<bool>,
498    /// Output only. If true, the triggers for this provider should always specify a filter on these attributes. Trigger creation will fail otherwise.
499    pub required: Option<bool>,
500}
501
502impl common::Part for FilteringAttribute {}
503
504/// Represents a GKE destination.
505///
506/// This type is not used in any activity, and only used as *part* of another schema.
507///
508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
509#[serde_with::serde_as]
510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
511pub struct GKE {
512    /// Required. The name of the cluster the GKE service is running in. The cluster must be running in the same project as the trigger being created.
513    pub cluster: Option<String>,
514    /// Required. The name of the Google Compute Engine in which the cluster resides, which can either be compute zone (for example, us-central1-a) for the zonal clusters or region (for example, us-central1) for regional clusters.
515    pub location: Option<String>,
516    /// Required. The namespace the GKE service is running in.
517    pub namespace: Option<String>,
518    /// Optional. The relative path on the GKE service the events should be sent to. The value must conform to the definition of a URI path segment (section 3.3 of RFC2396). Examples: "/route", "route", "route/subroute".
519    pub path: Option<String>,
520    /// Required. Name of the GKE service.
521    pub service: Option<String>,
522}
523
524impl common::Part for GKE {}
525
526/// A GoogleApiSource represents a subscription of 1P events from a MessageBus.
527///
528/// # Activities
529///
530/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
531/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
532///
533/// * [locations google api sources create projects](ProjectLocationGoogleApiSourceCreateCall) (request)
534/// * [locations google api sources get projects](ProjectLocationGoogleApiSourceGetCall) (response)
535/// * [locations google api sources patch projects](ProjectLocationGoogleApiSourcePatchCall) (request)
536#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
537#[serde_with::serde_as]
538#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
539pub struct GoogleApiSource {
540    /// Optional. Resource annotations.
541    pub annotations: Option<HashMap<String, String>>,
542    /// Output only. The creation time.
543    #[serde(rename = "createTime")]
544    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
545    /// Optional. Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt their event data. It must match the pattern `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
546    #[serde(rename = "cryptoKeyName")]
547    pub crypto_key_name: Option<String>,
548    /// Required. Destination is the message bus that the GoogleApiSource is delivering to. It must be point to the full resource name of a MessageBus. Format: "projects/{PROJECT_ID}/locations/{region}/messagesBuses/{MESSAGE_BUS_ID)
549    pub destination: Option<String>,
550    /// Optional. Resource display name.
551    #[serde(rename = "displayName")]
552    pub display_name: Option<String>,
553    /// Output only. This checksum is computed by the server based on the value of other fields, and might be sent only on update and delete requests to ensure that the client has an up-to-date value before proceeding.
554    pub etag: Option<String>,
555    /// Optional. Resource labels.
556    pub labels: Option<HashMap<String, String>>,
557    /// Optional. Config to control Platform logging for the GoogleApiSource.
558    #[serde(rename = "loggingConfig")]
559    pub logging_config: Option<LoggingConfig>,
560    /// Identifier. Resource name of the form projects/{project}/locations/{location}/googleApiSources/{google_api_source}
561    pub name: Option<String>,
562    /// Optional. Config to enable subscribing to events from all projects in the GoogleApiSource's org.
563    #[serde(rename = "organizationSubscription")]
564    pub organization_subscription: Option<OrganizationSubscription>,
565    /// Optional. Config to enable subscribing to all events from a list of projects. All the projects must be in the same org as the GoogleApiSource.
566    #[serde(rename = "projectSubscriptions")]
567    pub project_subscriptions: Option<ProjectSubscriptions>,
568    /// Output only. Server assigned unique identifier for the channel. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
569    pub uid: Option<String>,
570    /// Output only. The last-modified time.
571    #[serde(rename = "updateTime")]
572    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
573}
574
575impl common::RequestValue for GoogleApiSource {}
576impl common::ResponseResult for GoogleApiSource {}
577
578/// A GoogleChannelConfig is a resource that stores the custom settings respected by Eventarc first-party triggers in the matching region. Once configured, first-party event data will be protected using the specified custom managed encryption key instead of Google-managed encryption keys.
579///
580/// # Activities
581///
582/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
583/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
584///
585/// * [locations get google channel config projects](ProjectLocationGetGoogleChannelConfigCall) (response)
586/// * [locations update google channel config projects](ProjectLocationUpdateGoogleChannelConfigCall) (request|response)
587#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
588#[serde_with::serde_as]
589#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
590pub struct GoogleChannelConfig {
591    /// Optional. Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt their event data. It must match the pattern `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
592    #[serde(rename = "cryptoKeyName")]
593    pub crypto_key_name: Option<String>,
594    /// Optional. Resource labels.
595    pub labels: Option<HashMap<String, String>>,
596    /// Required. The resource name of the config. Must be in the format of, `projects/{project}/locations/{location}/googleChannelConfig`. In API responses, the config name always includes the projectID, regardless of whether the projectID or projectNumber was provided.
597    pub name: Option<String>,
598    /// Output only. The last-modified time.
599    #[serde(rename = "updateTime")]
600    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
601}
602
603impl common::RequestValue for GoogleChannelConfig {}
604impl common::ResponseResult for GoogleChannelConfig {}
605
606/// Represents a target of an invocation over HTTP.
607///
608/// This type is not used in any activity, and only used as *part* of another schema.
609///
610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
611#[serde_with::serde_as]
612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
613pub struct GoogleCloudEventarcV1PipelineDestination {
614    /// Optional. An authentication config used to authenticate message requests, such that destinations can verify the source. For example, this can be used with private Google Cloud destinations that require Google Cloud credentials for access like Cloud Run. This field is optional and should be set only by users interested in authenticated push.
615    #[serde(rename = "authenticationConfig")]
616    pub authentication_config: Option<GoogleCloudEventarcV1PipelineDestinationAuthenticationConfig>,
617    /// Optional. An HTTP endpoint destination described by an URI. If a DNS FQDN is provided as the endpoint, Pipeline will create a peering zone to the consumer VPC and forward DNS requests to the VPC specified by network config to resolve the service endpoint. See: https://cloud.google.com/dns/docs/zones/zones-overview#peering_zones
618    #[serde(rename = "httpEndpoint")]
619    pub http_endpoint: Option<GoogleCloudEventarcV1PipelineDestinationHttpEndpoint>,
620    /// Optional. The resource name of the Message Bus to which events should be published. The Message Bus resource should exist in the same project as the Pipeline. Format: `projects/{project}/locations/{location}/messageBuses/{message_bus}`
621    #[serde(rename = "messageBus")]
622    pub message_bus: Option<String>,
623    /// Optional. Network config is used to configure how Pipeline resolves and connects to a destination.
624    #[serde(rename = "networkConfig")]
625    pub network_config: Option<GoogleCloudEventarcV1PipelineDestinationNetworkConfig>,
626    /// Optional. The message format before it is delivered to the destination. If not set, the message will be delivered in the format it was originally delivered to the Pipeline. This field can only be set if Pipeline.input_payload_format is also set.
627    #[serde(rename = "outputPayloadFormat")]
628    pub output_payload_format: Option<GoogleCloudEventarcV1PipelineMessagePayloadFormat>,
629    /// Optional. The resource name of the Pub/Sub topic to which events should be published. Format: `projects/{project}/locations/{location}/topics/{topic}`
630    pub topic: Option<String>,
631    /// Optional. The resource name of the Workflow whose Executions are triggered by the events. The Workflow resource should be deployed in the same project as the Pipeline. Format: `projects/{project}/locations/{location}/workflows/{workflow}`
632    pub workflow: Option<String>,
633}
634
635impl common::Part for GoogleCloudEventarcV1PipelineDestination {}
636
637/// Represents a config used to authenticate message requests.
638///
639/// This type is not used in any activity, and only used as *part* of another schema.
640///
641#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
642#[serde_with::serde_as]
643#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
644pub struct GoogleCloudEventarcV1PipelineDestinationAuthenticationConfig {
645    /// Optional. This authenticate method will apply Google OIDC tokens signed by a Google Cloud service account to the requests.
646    #[serde(rename = "googleOidc")]
647    pub google_oidc: Option<GoogleCloudEventarcV1PipelineDestinationAuthenticationConfigOidcToken>,
648    /// Optional. If specified, an [OAuth token](https://developers.google.com/identity/protocols/OAuth2) will be generated and attached as an `Authorization` header in the HTTP request. This type of authorization should generally only be used when calling Google APIs hosted on *.googleapis.com.
649    #[serde(rename = "oauthToken")]
650    pub oauth_token: Option<GoogleCloudEventarcV1PipelineDestinationAuthenticationConfigOAuthToken>,
651}
652
653impl common::Part for GoogleCloudEventarcV1PipelineDestinationAuthenticationConfig {}
654
655/// Contains information needed for generating an [OAuth token](https://developers.google.com/identity/protocols/OAuth2). This type of authorization should generally only be used when calling Google APIs hosted on *.googleapis.com.
656///
657/// This type is not used in any activity, and only used as *part* of another schema.
658///
659#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
660#[serde_with::serde_as]
661#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
662pub struct GoogleCloudEventarcV1PipelineDestinationAuthenticationConfigOAuthToken {
663    /// Optional. OAuth scope to be used for generating OAuth access token. If not specified, "https://www.googleapis.com/auth/cloud-platform" will be used.
664    pub scope: Option<String>,
665    /// Required. Service account email used to generate the [OAuth token](https://developers.google.com/identity/protocols/OAuth2). The principal who calls this API must have iam.serviceAccounts.actAs permission in the service account. See https://cloud.google.com/iam/docs/understanding-service-accounts for more information. Eventarc service agents must have roles/roles/iam.serviceAccountTokenCreator role to allow Pipeline to create OAuth2 tokens for authenticated requests.
666    #[serde(rename = "serviceAccount")]
667    pub service_account: Option<String>,
668}
669
670impl common::Part for GoogleCloudEventarcV1PipelineDestinationAuthenticationConfigOAuthToken {}
671
672/// Represents a config used to authenticate with a Google OIDC token using a Google Cloud service account. Use this authentication method to invoke your Cloud Run and Cloud Functions destinations or HTTP endpoints that support Google OIDC.
673///
674/// This type is not used in any activity, and only used as *part* of another schema.
675///
676#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
677#[serde_with::serde_as]
678#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
679pub struct GoogleCloudEventarcV1PipelineDestinationAuthenticationConfigOidcToken {
680    /// Optional. Audience to be used to generate the OIDC Token. The audience claim identifies the recipient that the JWT is intended for. If unspecified, the destination URI will be used.
681    pub audience: Option<String>,
682    /// Required. Service account email used to generate the OIDC Token. The principal who calls this API must have iam.serviceAccounts.actAs permission in the service account. See https://cloud.google.com/iam/docs/understanding-service-accounts for more information. Eventarc service agents must have roles/roles/iam.serviceAccountTokenCreator role to allow the Pipeline to create OpenID tokens for authenticated requests.
683    #[serde(rename = "serviceAccount")]
684    pub service_account: Option<String>,
685}
686
687impl common::Part for GoogleCloudEventarcV1PipelineDestinationAuthenticationConfigOidcToken {}
688
689/// Represents a HTTP endpoint destination.
690///
691/// This type is not used in any activity, and only used as *part* of another schema.
692///
693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
694#[serde_with::serde_as]
695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
696pub struct GoogleCloudEventarcV1PipelineDestinationHttpEndpoint {
697    /// Optional. The CEL expression used to modify how the destination-bound HTTP request is constructed. If a binding expression is not specified here, the message is treated as a CloudEvent and is mapped to the HTTP request according to the CloudEvent HTTP Protocol Binding Binary Content Mode (https://github.com/cloudevents/spec/blob/main/cloudevents/bindings/http-protocol-binding.md#31-binary-content-mode). In this representation, all fields except the `data` and `datacontenttype` field on the message are mapped to HTTP request headers with a prefix of `ce-`. To construct the HTTP request payload and the value of the content-type HTTP header, the payload format is defined as follows: 1) Use the output_payload_format_type on the Pipeline.Destination if it is set, else: 2) Use the input_payload_format_type on the Pipeline if it is set, else: 3) Treat the payload as opaque binary data. The `data` field of the message is converted to the payload format or left as-is for case 3) and then attached as the payload of the HTTP request. The `content-type` header on the HTTP request is set to the payload format type or left empty for case 3). However, if a mediation has updated the `datacontenttype` field on the message so that it is not the same as the payload format type but it is still a prefix of the payload format type, then the `content-type` header on the HTTP request is set to this `datacontenttype` value. For example, if the `datacontenttype` is "application/json" and the payload format type is "application/json; charset=utf-8", then the `content-type` header on the HTTP request is set to "application/json; charset=utf-8". If a non-empty binding expression is specified then this expression is used to modify the default CloudEvent HTTP Protocol Binding Binary Content representation. The result of the CEL expression must be a map of key/value pairs which is used as follows: - If a map named `headers` exists on the result of the expression, then its key/value pairs are directly mapped to the HTTP request headers. The headers values are constructed from the corresponding value type's canonical representation. If the `headers` field doesn't exist then the resulting HTTP request will be the headers of the CloudEvent HTTP Binding Binary Content Mode representation of the final message. Note: If the specified binding expression, has updated the `datacontenttype` field on the message so that it is not the same as the payload format type but it is still a prefix of the payload format type, then the `content-type` header in the `headers` map is set to this `datacontenttype` value. - If a field named `body` exists on the result of the expression then its value is directly mapped to the body of the request. If the value of the `body` field is of type bytes or string then it is used for the HTTP request body as-is, with no conversion. If the body field is of any other type then it is converted to a JSON string. If the body field does not exist then the resulting payload of the HTTP request will be data value of the CloudEvent HTTP Binding Binary Content Mode representation of the final message as described earlier. - Any other fields in the resulting expression will be ignored. The CEL expression may access the incoming CloudEvent message in its definition, as follows: - The `data` field of the incoming CloudEvent message can be accessed using the `message.data` value. Subfields of `message.data` may also be accessed if an input_payload_format has been specified on the Pipeline. - Each attribute of the incoming CloudEvent message can be accessed using the `message.` value, where is replaced with the name of the attribute. - Existing headers can be accessed in the CEL expression using the `headers` variable. The `headers` variable defines a map of key/value pairs corresponding to the HTTP headers of the CloudEvent HTTP Binding Binary Content Mode representation of the final message as described earlier. For example, the following CEL expression can be used to construct an HTTP request by adding an additional header to the HTTP headers of the CloudEvent HTTP Binding Binary Content Mode representation of the final message and by overwriting the body of the request: ``` { "headers": headers.merge({"new-header-key": "new-header-value"}), "body": "new-body" } ``` - The default binding for the message payload can be accessed using the `body` variable. It conatins a string representation of the message payload in the format specified by the `output_payload_format` field. If the `input_payload_format` field is not set, the `body` variable contains the same message payload bytes that were published. Additionally, the following CEL extension functions are provided for use in this CEL expression: - toBase64Url: map.toBase64Url() -> string - Converts a CelValue to a base64url encoded string - toJsonString: map.toJsonString() -> string - Converts a CelValue to a JSON string - merge: map1.merge(map2) -> map3 - Merges the passed CEL map with the existing CEL map the function is applied to. - If the same key exists in both maps, if the key's value is type map both maps are merged else the value from the passed map is used. - denormalize: map.denormalize() -> map - Denormalizes a CEL map such that every value of type map or key in the map is expanded to return a single level map. - The resulting keys are "." separated indices of the map keys. - For example: { "a": 1, "b": { "c": 2, "d": 3 } "e": [4, 5] } .denormalize() -> { "a": 1, "b.c": 2, "b.d": 3, "e.0": 4, "e.1": 5 } - setField: map.setField(key, value) -> message - Sets the field of the message with the given key to the given value. - If the field is not present it will be added. - If the field is present it will be overwritten. - The key can be a dot separated path to set a field in a nested message. - Key must be of type string. - Value may be any valid type. - removeFields: map.removeFields([key1, key2, ...]) -> message - Removes the fields of the map with the given keys. - The keys can be a dot separated path to remove a field in a nested message. - If a key is not found it will be ignored. - Keys must be of type string. - toMap: [map1, map2, ...].toMap() -> map - Converts a CEL list of CEL maps to a single CEL map - toCloudEventJsonWithPayloadFormat: message.toCloudEventJsonWithPayloadFormat() -> map - Converts a message to the corresponding structure of JSON format for CloudEvents. - It converts `data` to destination payload format specified in `output_payload_format`. If `output_payload_format` is not set, the data will remain unchanged. - It also sets the corresponding datacontenttype of the CloudEvent, as indicated by `output_payload_format`. If no `output_payload_format` is set it will use the value of the "datacontenttype" attribute on the CloudEvent if present, else remove "datacontenttype" attribute. - This function expects that the content of the message will adhere to the standard CloudEvent format. If it doesn't then this function will fail. - The result is a CEL map that corresponds to the JSON representation of the CloudEvent. To convert that data to a JSON string it can be chained with the toJsonString function. The Pipeline expects that the message it receives adheres to the standard CloudEvent format. If it doesn't then the outgoing message request may fail with a persistent error.
698    #[serde(rename = "messageBindingTemplate")]
699    pub message_binding_template: Option<String>,
700    /// Required. The URI of the HTTP endpoint. The value must be a RFC2396 URI string. Examples: `https://svc.us-central1.p.local:8080/route`. Only the HTTPS protocol is supported.
701    pub uri: Option<String>,
702}
703
704impl common::Part for GoogleCloudEventarcV1PipelineDestinationHttpEndpoint {}
705
706/// Represents a network config to be used for destination resolution and connectivity.
707///
708/// This type is not used in any activity, and only used as *part* of another schema.
709///
710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
711#[serde_with::serde_as]
712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
713pub struct GoogleCloudEventarcV1PipelineDestinationNetworkConfig {
714    /// Required. Name of the NetworkAttachment that allows access to the consumer VPC. Format: `projects/{PROJECT_ID}/regions/{REGION}/networkAttachments/{NETWORK_ATTACHMENT_NAME}`
715    #[serde(rename = "networkAttachment")]
716    pub network_attachment: Option<String>,
717}
718
719impl common::Part for GoogleCloudEventarcV1PipelineDestinationNetworkConfig {}
720
721/// Mediation defines different ways to modify the Pipeline.
722///
723/// This type is not used in any activity, and only used as *part* of another schema.
724///
725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
726#[serde_with::serde_as]
727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
728pub struct GoogleCloudEventarcV1PipelineMediation {
729    /// Optional. How the Pipeline is to transform messages
730    pub transformation: Option<GoogleCloudEventarcV1PipelineMediationTransformation>,
731}
732
733impl common::Part for GoogleCloudEventarcV1PipelineMediation {}
734
735/// Transformation defines the way to transform an incoming message.
736///
737/// This type is not used in any activity, and only used as *part* of another schema.
738///
739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
740#[serde_with::serde_as]
741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
742pub struct GoogleCloudEventarcV1PipelineMediationTransformation {
743    /// Optional. The CEL expression template to apply to transform messages. The following CEL extension functions are provided for use in this CEL expression: - merge: map1.merge(map2) -> map3 - Merges the passed CEL map with the existing CEL map the function is applied to. - If the same key exists in both maps, if the key's value is type map both maps are merged else the value from the passed map is used. - denormalize: map.denormalize() -> map - Denormalizes a CEL map such that every value of type map or key in the map is expanded to return a single level map. - The resulting keys are "." separated indices of the map keys. - For example: { "a": 1, "b": { "c": 2, "d": 3 } "e": [4, 5] } .denormalize() -> { "a": 1, "b.c": 2, "b.d": 3, "e.0": 4, "e.1": 5 } - setField: map.setField(key, value) -> message - Sets the field of the message with the given key to the given value. - If the field is not present it will be added. - If the field is present it will be overwritten. - The key can be a dot separated path to set a field in a nested message. - Key must be of type string. - Value may be any valid type. - removeFields: map.removeFields([key1, key2, ...]) -> message - Removes the fields of the map with the given keys. - The keys can be a dot separated path to remove a field in a nested message. - If a key is not found it will be ignored. - Keys must be of type string. - toMap: [map1, map2, ...].toMap() -> map - Converts a CEL list of CEL maps to a single CEL map - toDestinationPayloadFormat(): message.data.toDestinationPayloadFormat() -> string or bytes - Converts the message data to the destination payload format specified in Pipeline.Destination.output_payload_format - This function is meant to be applied to the message.data field. - If the destination payload format is not set, the function will return the message data unchanged. - toCloudEventJsonWithPayloadFormat: message.toCloudEventJsonWithPayloadFormat() -> map - Converts a message to the corresponding structure of JSON format for CloudEvents - This function applies toDestinationPayloadFormat() to the message data. It also sets the corresponding datacontenttype of the CloudEvent, as indicated by Pipeline.Destination.output_payload_format. If no output_payload_format is set it will use the existing datacontenttype on the CloudEvent if present, else leave datacontenttype absent. - This function expects that the content of the message will adhere to the standard CloudEvent format. If it doesn't then this function will fail. - The result is a CEL map that corresponds to the JSON representation of the CloudEvent. To convert that data to a JSON string it can be chained with the toJsonString function.
744    #[serde(rename = "transformationTemplate")]
745    pub transformation_template: Option<String>,
746}
747
748impl common::Part for GoogleCloudEventarcV1PipelineMediationTransformation {}
749
750/// Represents the format of message data.
751///
752/// This type is not used in any activity, and only used as *part* of another schema.
753///
754#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
755#[serde_with::serde_as]
756#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
757pub struct GoogleCloudEventarcV1PipelineMessagePayloadFormat {
758    /// Optional. Avro format.
759    pub avro: Option<GoogleCloudEventarcV1PipelineMessagePayloadFormatAvroFormat>,
760    /// Optional. JSON format.
761    pub json: Option<GoogleCloudEventarcV1PipelineMessagePayloadFormatJsonFormat>,
762    /// Optional. Protobuf format.
763    pub protobuf: Option<GoogleCloudEventarcV1PipelineMessagePayloadFormatProtobufFormat>,
764}
765
766impl common::Part for GoogleCloudEventarcV1PipelineMessagePayloadFormat {}
767
768/// The format of an AVRO message payload.
769///
770/// This type is not used in any activity, and only used as *part* of another schema.
771///
772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
773#[serde_with::serde_as]
774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
775pub struct GoogleCloudEventarcV1PipelineMessagePayloadFormatAvroFormat {
776    /// Optional. The entire schema definition is stored in this field.
777    #[serde(rename = "schemaDefinition")]
778    pub schema_definition: Option<String>,
779}
780
781impl common::Part for GoogleCloudEventarcV1PipelineMessagePayloadFormatAvroFormat {}
782
783/// The format of a JSON message payload.
784///
785/// This type is not used in any activity, and only used as *part* of another schema.
786///
787#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
788#[serde_with::serde_as]
789#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
790pub struct GoogleCloudEventarcV1PipelineMessagePayloadFormatJsonFormat {
791    _never_set: Option<bool>,
792}
793
794impl common::Part for GoogleCloudEventarcV1PipelineMessagePayloadFormatJsonFormat {}
795
796/// The format of a Protobuf message payload.
797///
798/// This type is not used in any activity, and only used as *part* of another schema.
799///
800#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
801#[serde_with::serde_as]
802#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
803pub struct GoogleCloudEventarcV1PipelineMessagePayloadFormatProtobufFormat {
804    /// Optional. The entire schema definition is stored in this field.
805    #[serde(rename = "schemaDefinition")]
806    pub schema_definition: Option<String>,
807}
808
809impl common::Part for GoogleCloudEventarcV1PipelineMessagePayloadFormatProtobufFormat {}
810
811/// The retry policy configuration for the Pipeline. The pipeline exponentially backs off in case the destination is non responsive or returns a retryable error code. The default semantics are as follows: The backoff starts with a 5 second delay and doubles the delay after each failed attempt (10 seconds, 20 seconds, 40 seconds, etc.). The delay is capped at 60 seconds by default. Please note that if you set the min_retry_delay and max_retry_delay fields to the same value this will make the duration between retries constant.
812///
813/// This type is not used in any activity, and only used as *part* of another schema.
814///
815#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
816#[serde_with::serde_as]
817#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
818pub struct GoogleCloudEventarcV1PipelineRetryPolicy {
819    /// Optional. The maximum number of delivery attempts for any message. The value must be between 1 and 100. The default value for this field is 5.
820    #[serde(rename = "maxAttempts")]
821    pub max_attempts: Option<i32>,
822    /// Optional. The maximum amount of seconds to wait between retry attempts. The value must be between 1 and 600. The default value for this field is 60.
823    #[serde(rename = "maxRetryDelay")]
824    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
825    pub max_retry_delay: Option<chrono::Duration>,
826    /// Optional. The minimum amount of seconds to wait between retry attempts. The value must be between 1 and 600. The default value for this field is 5.
827    #[serde(rename = "minRetryDelay")]
828    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
829    pub min_retry_delay: Option<chrono::Duration>,
830}
831
832impl common::Part for GoogleCloudEventarcV1PipelineRetryPolicy {}
833
834/// The request message for Operations.CancelOperation.
835///
836/// # Activities
837///
838/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
839/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
840///
841/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
842#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
843#[serde_with::serde_as]
844#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
845pub struct GoogleLongrunningCancelOperationRequest {
846    _never_set: Option<bool>,
847}
848
849impl common::RequestValue for GoogleLongrunningCancelOperationRequest {}
850
851/// The response message for Operations.ListOperations.
852///
853/// # Activities
854///
855/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
856/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
857///
858/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
859#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
860#[serde_with::serde_as]
861#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
862pub struct GoogleLongrunningListOperationsResponse {
863    /// The standard List next-page token.
864    #[serde(rename = "nextPageToken")]
865    pub next_page_token: Option<String>,
866    /// A list of operations that matches the specified filter in the request.
867    pub operations: Option<Vec<GoogleLongrunningOperation>>,
868    /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
869    pub unreachable: Option<Vec<String>>,
870}
871
872impl common::ResponseResult for GoogleLongrunningListOperationsResponse {}
873
874/// This resource represents a long-running operation that is the result of a network API call.
875///
876/// # Activities
877///
878/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
879/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
880///
881/// * [locations channel connections create projects](ProjectLocationChannelConnectionCreateCall) (response)
882/// * [locations channel connections delete projects](ProjectLocationChannelConnectionDeleteCall) (response)
883/// * [locations channels create projects](ProjectLocationChannelCreateCall) (response)
884/// * [locations channels delete projects](ProjectLocationChannelDeleteCall) (response)
885/// * [locations channels patch projects](ProjectLocationChannelPatchCall) (response)
886/// * [locations enrollments create projects](ProjectLocationEnrollmentCreateCall) (response)
887/// * [locations enrollments delete projects](ProjectLocationEnrollmentDeleteCall) (response)
888/// * [locations enrollments patch projects](ProjectLocationEnrollmentPatchCall) (response)
889/// * [locations google api sources create projects](ProjectLocationGoogleApiSourceCreateCall) (response)
890/// * [locations google api sources delete projects](ProjectLocationGoogleApiSourceDeleteCall) (response)
891/// * [locations google api sources patch projects](ProjectLocationGoogleApiSourcePatchCall) (response)
892/// * [locations message buses create projects](ProjectLocationMessageBusCreateCall) (response)
893/// * [locations message buses delete projects](ProjectLocationMessageBusDeleteCall) (response)
894/// * [locations message buses patch projects](ProjectLocationMessageBusPatchCall) (response)
895/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
896/// * [locations pipelines create projects](ProjectLocationPipelineCreateCall) (response)
897/// * [locations pipelines delete projects](ProjectLocationPipelineDeleteCall) (response)
898/// * [locations pipelines patch projects](ProjectLocationPipelinePatchCall) (response)
899/// * [locations triggers create projects](ProjectLocationTriggerCreateCall) (response)
900/// * [locations triggers delete projects](ProjectLocationTriggerDeleteCall) (response)
901/// * [locations triggers patch projects](ProjectLocationTriggerPatchCall) (response)
902#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
903#[serde_with::serde_as]
904#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
905pub struct GoogleLongrunningOperation {
906    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
907    pub done: Option<bool>,
908    /// The error result of the operation in case of failure or cancellation.
909    pub error: Option<GoogleRpcStatus>,
910    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
911    pub metadata: Option<HashMap<String, serde_json::Value>>,
912    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
913    pub name: Option<String>,
914    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
915    pub response: Option<HashMap<String, serde_json::Value>>,
916}
917
918impl common::ResponseResult for GoogleLongrunningOperation {}
919
920/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
921///
922/// This type is not used in any activity, and only used as *part* of another schema.
923///
924#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
925#[serde_with::serde_as]
926#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
927pub struct GoogleRpcStatus {
928    /// The status code, which should be an enum value of google.rpc.Code.
929    pub code: Option<i32>,
930    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
931    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
932    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
933    pub message: Option<String>,
934}
935
936impl common::Part for GoogleRpcStatus {}
937
938/// Represents a HTTP endpoint destination.
939///
940/// This type is not used in any activity, and only used as *part* of another schema.
941///
942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
943#[serde_with::serde_as]
944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
945pub struct HttpEndpoint {
946    /// Required. The URI of the HTTP endpoint. The value must be a RFC2396 URI string. Examples: `http://10.10.10.8:80/route`, `http://svc.us-central1.p.local:8080/`. Only HTTP and HTTPS protocols are supported. The host can be either a static IP addressable from the VPC specified by the network config, or an internal DNS hostname of the service resolvable via Cloud DNS.
947    pub uri: Option<String>,
948}
949
950impl common::Part for HttpEndpoint {}
951
952/// The response message for the `ListChannelConnections` method.
953///
954/// # Activities
955///
956/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
957/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
958///
959/// * [locations channel connections list projects](ProjectLocationChannelConnectionListCall) (response)
960#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
961#[serde_with::serde_as]
962#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
963pub struct ListChannelConnectionsResponse {
964    /// The requested channel connections, up to the number specified in `page_size`.
965    #[serde(rename = "channelConnections")]
966    pub channel_connections: Option<Vec<ChannelConnection>>,
967    /// A page token that can be sent to `ListChannelConnections` to request the next page. If this is empty, then there are no more pages.
968    #[serde(rename = "nextPageToken")]
969    pub next_page_token: Option<String>,
970    /// Unreachable resources, if any.
971    pub unreachable: Option<Vec<String>>,
972}
973
974impl common::ResponseResult for ListChannelConnectionsResponse {}
975
976/// The response message for the `ListChannels` method.
977///
978/// # Activities
979///
980/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
981/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
982///
983/// * [locations channels list projects](ProjectLocationChannelListCall) (response)
984#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
985#[serde_with::serde_as]
986#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
987pub struct ListChannelsResponse {
988    /// The requested channels, up to the number specified in `page_size`.
989    pub channels: Option<Vec<Channel>>,
990    /// A page token that can be sent to `ListChannels` to request the next page. If this is empty, then there are no more pages.
991    #[serde(rename = "nextPageToken")]
992    pub next_page_token: Option<String>,
993    /// Unreachable resources, if any.
994    pub unreachable: Option<Vec<String>>,
995}
996
997impl common::ResponseResult for ListChannelsResponse {}
998
999/// The response message for the `ListEnrollments` method.
1000///
1001/// # Activities
1002///
1003/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1004/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1005///
1006/// * [locations enrollments list projects](ProjectLocationEnrollmentListCall) (response)
1007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1008#[serde_with::serde_as]
1009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1010pub struct ListEnrollmentsResponse {
1011    /// The requested Enrollments, up to the number specified in `page_size`.
1012    pub enrollments: Option<Vec<Enrollment>>,
1013    /// A page token that can be sent to `ListEnrollments` to request the next page. If this is empty, then there are no more pages.
1014    #[serde(rename = "nextPageToken")]
1015    pub next_page_token: Option<String>,
1016    /// Unreachable resources, if any.
1017    pub unreachable: Option<Vec<String>>,
1018}
1019
1020impl common::ResponseResult for ListEnrollmentsResponse {}
1021
1022/// The response message for the `ListGoogleApiSources` method.
1023///
1024/// # Activities
1025///
1026/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1027/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1028///
1029/// * [locations google api sources list projects](ProjectLocationGoogleApiSourceListCall) (response)
1030#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1031#[serde_with::serde_as]
1032#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1033pub struct ListGoogleApiSourcesResponse {
1034    /// The requested GoogleApiSources, up to the number specified in `page_size`.
1035    #[serde(rename = "googleApiSources")]
1036    pub google_api_sources: Option<Vec<GoogleApiSource>>,
1037    /// A page token that can be sent to `ListMessageBusEnrollments` to request the next page. If this is empty, then there are no more pages.
1038    #[serde(rename = "nextPageToken")]
1039    pub next_page_token: Option<String>,
1040    /// Unreachable resources, if any.
1041    pub unreachable: Option<Vec<String>>,
1042}
1043
1044impl common::ResponseResult for ListGoogleApiSourcesResponse {}
1045
1046/// The response message for Locations.ListLocations.
1047///
1048/// # Activities
1049///
1050/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1051/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1052///
1053/// * [locations list projects](ProjectLocationListCall) (response)
1054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1055#[serde_with::serde_as]
1056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1057pub struct ListLocationsResponse {
1058    /// A list of locations that matches the specified filter in the request.
1059    pub locations: Option<Vec<Location>>,
1060    /// The standard List next-page token.
1061    #[serde(rename = "nextPageToken")]
1062    pub next_page_token: Option<String>,
1063}
1064
1065impl common::ResponseResult for ListLocationsResponse {}
1066
1067/// The response message for the `ListMessageBusEnrollments` method.\`
1068///
1069/// # Activities
1070///
1071/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1072/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1073///
1074/// * [locations message buses list enrollments projects](ProjectLocationMessageBusListEnrollmentCall) (response)
1075#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1076#[serde_with::serde_as]
1077#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1078pub struct ListMessageBusEnrollmentsResponse {
1079    /// The requested enrollments, up to the number specified in `page_size`.
1080    pub enrollments: Option<Vec<String>>,
1081    /// A page token that can be sent to `ListMessageBusEnrollments` to request the next page. If this is empty, then there are no more pages.
1082    #[serde(rename = "nextPageToken")]
1083    pub next_page_token: Option<String>,
1084    /// Unreachable resources, if any.
1085    pub unreachable: Option<Vec<String>>,
1086}
1087
1088impl common::ResponseResult for ListMessageBusEnrollmentsResponse {}
1089
1090/// The response message for the `ListMessageBuses` method.
1091///
1092/// # Activities
1093///
1094/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1095/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1096///
1097/// * [locations message buses list projects](ProjectLocationMessageBusListCall) (response)
1098#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1099#[serde_with::serde_as]
1100#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1101pub struct ListMessageBusesResponse {
1102    /// The requested message buses, up to the number specified in `page_size`.
1103    #[serde(rename = "messageBuses")]
1104    pub message_buses: Option<Vec<MessageBus>>,
1105    /// A page token that can be sent to `ListMessageBuses` to request the next page. If this is empty, then there are no more pages.
1106    #[serde(rename = "nextPageToken")]
1107    pub next_page_token: Option<String>,
1108    /// Unreachable resources, if any.
1109    pub unreachable: Option<Vec<String>>,
1110}
1111
1112impl common::ResponseResult for ListMessageBusesResponse {}
1113
1114/// The response message for the ListPipelines method.
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 pipelines list projects](ProjectLocationPipelineListCall) (response)
1122#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1123#[serde_with::serde_as]
1124#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1125pub struct ListPipelinesResponse {
1126    /// A page token that can be sent to `ListPipelines` to request the next page. If this is empty, then there are no more pages.
1127    #[serde(rename = "nextPageToken")]
1128    pub next_page_token: Option<String>,
1129    /// The requested pipelines, up to the number specified in `page_size`.
1130    pub pipelines: Option<Vec<Pipeline>>,
1131    /// Unreachable resources, if any.
1132    pub unreachable: Option<Vec<String>>,
1133}
1134
1135impl common::ResponseResult for ListPipelinesResponse {}
1136
1137/// The response message for the `ListProviders` method.
1138///
1139/// # Activities
1140///
1141/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1142/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1143///
1144/// * [locations providers list projects](ProjectLocationProviderListCall) (response)
1145#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1146#[serde_with::serde_as]
1147#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1148pub struct ListProvidersResponse {
1149    /// A page token that can be sent to `ListProviders` to request the next page. If this is empty, then there are no more pages.
1150    #[serde(rename = "nextPageToken")]
1151    pub next_page_token: Option<String>,
1152    /// The requested providers, up to the number specified in `page_size`.
1153    pub providers: Option<Vec<Provider>>,
1154    /// Unreachable resources, if any.
1155    pub unreachable: Option<Vec<String>>,
1156}
1157
1158impl common::ResponseResult for ListProvidersResponse {}
1159
1160/// The response message for the `ListTriggers` method.
1161///
1162/// # Activities
1163///
1164/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1165/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1166///
1167/// * [locations triggers list projects](ProjectLocationTriggerListCall) (response)
1168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1169#[serde_with::serde_as]
1170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1171pub struct ListTriggersResponse {
1172    /// A page token that can be sent to `ListTriggers` to request the next page. If this is empty, then there are no more pages.
1173    #[serde(rename = "nextPageToken")]
1174    pub next_page_token: Option<String>,
1175    /// The requested triggers, up to the number specified in `page_size`.
1176    pub triggers: Option<Vec<Trigger>>,
1177    /// Unreachable resources, if any.
1178    pub unreachable: Option<Vec<String>>,
1179}
1180
1181impl common::ResponseResult for ListTriggersResponse {}
1182
1183/// A resource that represents a Google Cloud location.
1184///
1185/// # Activities
1186///
1187/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1188/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1189///
1190/// * [locations get projects](ProjectLocationGetCall) (response)
1191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1192#[serde_with::serde_as]
1193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1194pub struct Location {
1195    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1196    #[serde(rename = "displayName")]
1197    pub display_name: Option<String>,
1198    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1199    pub labels: Option<HashMap<String, String>>,
1200    /// The canonical id for this location. For example: `"us-east1"`.
1201    #[serde(rename = "locationId")]
1202    pub location_id: Option<String>,
1203    /// Service-specific metadata. For example the available capacity at the given location.
1204    pub metadata: Option<HashMap<String, serde_json::Value>>,
1205    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1206    pub name: Option<String>,
1207}
1208
1209impl common::ResponseResult for Location {}
1210
1211/// The configuration for Platform Telemetry logging for Eventarc Advanced resources.
1212///
1213/// This type is not used in any activity, and only used as *part* of another schema.
1214///
1215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1216#[serde_with::serde_as]
1217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1218pub struct LoggingConfig {
1219    /// Optional. The minimum severity of logs that will be sent to Stackdriver/Platform Telemetry. Logs at severitiy ≥ this value will be sent, unless it is NONE.
1220    #[serde(rename = "logSeverity")]
1221    pub log_severity: Option<String>,
1222}
1223
1224impl common::Part for LoggingConfig {}
1225
1226/// MessageBus for the messages flowing through the system. The admin has visibility and control over the messages being published and consumed and can restrict publishers and subscribers to only a subset of data available in the system by defining authorization policies.
1227///
1228/// # Activities
1229///
1230/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1231/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1232///
1233/// * [locations message buses create projects](ProjectLocationMessageBusCreateCall) (request)
1234/// * [locations message buses get projects](ProjectLocationMessageBusGetCall) (response)
1235/// * [locations message buses patch projects](ProjectLocationMessageBusPatchCall) (request)
1236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1237#[serde_with::serde_as]
1238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1239pub struct MessageBus {
1240    /// Optional. Resource annotations.
1241    pub annotations: Option<HashMap<String, String>>,
1242    /// Output only. The creation time.
1243    #[serde(rename = "createTime")]
1244    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1245    /// Optional. Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt their event data. It must match the pattern `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
1246    #[serde(rename = "cryptoKeyName")]
1247    pub crypto_key_name: Option<String>,
1248    /// Optional. Resource display name.
1249    #[serde(rename = "displayName")]
1250    pub display_name: Option<String>,
1251    /// Output only. This checksum is computed by the server based on the value of other fields, and might be sent only on update and delete requests to ensure that the client has an up-to-date value before proceeding.
1252    pub etag: Option<String>,
1253    /// Optional. Resource labels.
1254    pub labels: Option<HashMap<String, String>>,
1255    /// Optional. Config to control Platform logging for the Message Bus. This log configuration is applied to the Message Bus itself, and all the Enrollments attached to it.
1256    #[serde(rename = "loggingConfig")]
1257    pub logging_config: Option<LoggingConfig>,
1258    /// Identifier. Resource name of the form projects/{project}/locations/{location}/messageBuses/{message_bus}
1259    pub name: Option<String>,
1260    /// Output only. Server assigned unique identifier for the channel. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
1261    pub uid: Option<String>,
1262    /// Output only. The last-modified time.
1263    #[serde(rename = "updateTime")]
1264    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1265}
1266
1267impl common::RequestValue for MessageBus {}
1268impl common::ResponseResult for MessageBus {}
1269
1270/// Network Configuration that can be inherited by other protos.
1271///
1272/// This type is not used in any activity, and only used as *part* of another schema.
1273///
1274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1275#[serde_with::serde_as]
1276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1277pub struct NetworkConfig {
1278    /// Required. Name of the NetworkAttachment that allows access to the customer's VPC. Format: `projects/{PROJECT_ID}/regions/{REGION}/networkAttachments/{NETWORK_ATTACHMENT_NAME}`
1279    #[serde(rename = "networkAttachment")]
1280    pub network_attachment: Option<String>,
1281}
1282
1283impl common::Part for NetworkConfig {}
1284
1285/// Config to enabled subscribing to events from other projects in the org.
1286///
1287/// This type is not used in any activity, and only used as *part* of another schema.
1288///
1289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1290#[serde_with::serde_as]
1291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1292pub struct OrganizationSubscription {
1293    /// Required. Enable org level subscription.
1294    pub enabled: Option<bool>,
1295}
1296
1297impl common::Part for OrganizationSubscription {}
1298
1299/// A representation of the Pipeline resource.
1300///
1301/// # Activities
1302///
1303/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1304/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1305///
1306/// * [locations pipelines create projects](ProjectLocationPipelineCreateCall) (request)
1307/// * [locations pipelines get projects](ProjectLocationPipelineGetCall) (response)
1308/// * [locations pipelines patch projects](ProjectLocationPipelinePatchCall) (request)
1309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1310#[serde_with::serde_as]
1311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1312pub struct Pipeline {
1313    /// Optional. User-defined annotations. See https://google.aip.dev/128#annotations.
1314    pub annotations: Option<HashMap<String, String>>,
1315    /// Output only. The creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
1316    #[serde(rename = "createTime")]
1317    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1318    /// Optional. Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt the event data. If not set, an internal Google-owned key will be used to encrypt messages. It must match the pattern "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}".
1319    #[serde(rename = "cryptoKeyName")]
1320    pub crypto_key_name: Option<String>,
1321    /// Required. List of destinations to which messages will be forwarded. Currently, exactly one destination is supported per Pipeline.
1322    pub destinations: Option<Vec<GoogleCloudEventarcV1PipelineDestination>>,
1323    /// Optional. Display name of resource.
1324    #[serde(rename = "displayName")]
1325    pub display_name: Option<String>,
1326    /// Output only. This checksum is computed by the server based on the value of other fields, and might be sent only on create requests to ensure that the client has an up-to-date value before proceeding.
1327    pub etag: Option<String>,
1328    /// Optional. The payload format expected for the messages received by the Pipeline. If input_payload_format is set then any messages not matching this format will be treated as persistent errors. If input_payload_format is not set, then the message data will be treated as an opaque binary and no output format can be set on the Pipeline through the Pipeline.Destination.output_payload_format field. Any Mediations on the Pipeline that involve access to the data field will fail as persistent errors.
1329    #[serde(rename = "inputPayloadFormat")]
1330    pub input_payload_format: Option<GoogleCloudEventarcV1PipelineMessagePayloadFormat>,
1331    /// Optional. User labels attached to the Pipeline that can be used to group resources. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
1332    pub labels: Option<HashMap<String, String>>,
1333    /// Optional. Config to control Platform Logging for Pipelines.
1334    #[serde(rename = "loggingConfig")]
1335    pub logging_config: Option<LoggingConfig>,
1336    /// Optional. List of mediation operations to be performed on the message. Currently, only one Transformation operation is allowed in each Pipeline.
1337    pub mediations: Option<Vec<GoogleCloudEventarcV1PipelineMediation>>,
1338    /// Identifier. The resource name of the Pipeline. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/pipelines/{pipeline}` format.
1339    pub name: Option<String>,
1340    /// Optional. The retry policy to use in the pipeline.
1341    #[serde(rename = "retryPolicy")]
1342    pub retry_policy: Option<GoogleCloudEventarcV1PipelineRetryPolicy>,
1343    /// Output only. Whether or not this Pipeline satisfies the requirements of physical zone separation
1344    #[serde(rename = "satisfiesPzs")]
1345    pub satisfies_pzs: Option<bool>,
1346    /// Output only. Server-assigned unique identifier for the Pipeline. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
1347    pub uid: Option<String>,
1348    /// Output only. The last-modified time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
1349    #[serde(rename = "updateTime")]
1350    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1351}
1352
1353impl common::RequestValue for Pipeline {}
1354impl common::ResponseResult for Pipeline {}
1355
1356/// 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/).
1357///
1358/// # Activities
1359///
1360/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1361/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1362///
1363/// * [locations channel connections get iam policy projects](ProjectLocationChannelConnectionGetIamPolicyCall) (response)
1364/// * [locations channel connections set iam policy projects](ProjectLocationChannelConnectionSetIamPolicyCall) (response)
1365/// * [locations channels get iam policy projects](ProjectLocationChannelGetIamPolicyCall) (response)
1366/// * [locations channels set iam policy projects](ProjectLocationChannelSetIamPolicyCall) (response)
1367/// * [locations enrollments get iam policy projects](ProjectLocationEnrollmentGetIamPolicyCall) (response)
1368/// * [locations enrollments set iam policy projects](ProjectLocationEnrollmentSetIamPolicyCall) (response)
1369/// * [locations google api sources get iam policy projects](ProjectLocationGoogleApiSourceGetIamPolicyCall) (response)
1370/// * [locations google api sources set iam policy projects](ProjectLocationGoogleApiSourceSetIamPolicyCall) (response)
1371/// * [locations message buses get iam policy projects](ProjectLocationMessageBusGetIamPolicyCall) (response)
1372/// * [locations message buses set iam policy projects](ProjectLocationMessageBusSetIamPolicyCall) (response)
1373/// * [locations pipelines get iam policy projects](ProjectLocationPipelineGetIamPolicyCall) (response)
1374/// * [locations pipelines set iam policy projects](ProjectLocationPipelineSetIamPolicyCall) (response)
1375/// * [locations triggers get iam policy projects](ProjectLocationTriggerGetIamPolicyCall) (response)
1376/// * [locations triggers set iam policy projects](ProjectLocationTriggerSetIamPolicyCall) (response)
1377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1378#[serde_with::serde_as]
1379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1380pub struct Policy {
1381    /// Specifies cloud audit logging configuration for this policy.
1382    #[serde(rename = "auditConfigs")]
1383    pub audit_configs: Option<Vec<AuditConfig>>,
1384    /// 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`.
1385    pub bindings: Option<Vec<Binding>>,
1386    /// `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.
1387    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1388    pub etag: Option<Vec<u8>>,
1389    /// 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).
1390    pub version: Option<i32>,
1391}
1392
1393impl common::ResponseResult for Policy {}
1394
1395/// Config to enable subscribing to all events from a list of projects.
1396///
1397/// This type is not used in any activity, and only used as *part* of another schema.
1398///
1399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1400#[serde_with::serde_as]
1401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1402pub struct ProjectSubscriptions {
1403    /// Required. A list of projects to receive events from. All the projects must be in the same org. The listed projects should have the format project/{identifier} where identifier can be either the project id for project number. A single list may contain both formats. At most 100 projects can be listed.
1404    pub list: Option<Vec<String>>,
1405}
1406
1407impl common::Part for ProjectSubscriptions {}
1408
1409/// A representation of the Provider resource.
1410///
1411/// # Activities
1412///
1413/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1414/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1415///
1416/// * [locations providers get projects](ProjectLocationProviderGetCall) (response)
1417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1418#[serde_with::serde_as]
1419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1420pub struct Provider {
1421    /// Output only. Human friendly name for the Provider. For example "Cloud Storage".
1422    #[serde(rename = "displayName")]
1423    pub display_name: Option<String>,
1424    /// Output only. Event types for this provider.
1425    #[serde(rename = "eventTypes")]
1426    pub event_types: Option<Vec<EventType>>,
1427    /// Output only. In `projects/{project}/locations/{location}/providers/{provider_id}` format.
1428    pub name: Option<String>,
1429}
1430
1431impl common::ResponseResult for Provider {}
1432
1433/// Represents a Pub/Sub transport.
1434///
1435/// This type is not used in any activity, and only used as *part* of another schema.
1436///
1437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1438#[serde_with::serde_as]
1439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1440pub struct Pubsub {
1441    /// Output only. The name of the Pub/Sub subscription created and managed by Eventarc as a transport for the event delivery. Format: `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
1442    pub subscription: Option<String>,
1443    /// Optional. The name of the Pub/Sub topic created and managed by Eventarc as a transport for the event delivery. Format: `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`. You can set an existing topic for triggers of the type `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide here is not deleted by Eventarc at trigger deletion.
1444    pub topic: Option<String>,
1445}
1446
1447impl common::Part for Pubsub {}
1448
1449/// The retry policy configuration for the Trigger. Can only be set with Cloud Run destinations.
1450///
1451/// This type is not used in any activity, and only used as *part* of another schema.
1452///
1453#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1454#[serde_with::serde_as]
1455#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1456pub struct RetryPolicy {
1457    /// Optional. The maximum number of delivery attempts for any message. The only valid value is 1.
1458    #[serde(rename = "maxAttempts")]
1459    pub max_attempts: Option<i32>,
1460}
1461
1462impl common::Part for RetryPolicy {}
1463
1464/// Request message for `SetIamPolicy` method.
1465///
1466/// # Activities
1467///
1468/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1469/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1470///
1471/// * [locations channel connections set iam policy projects](ProjectLocationChannelConnectionSetIamPolicyCall) (request)
1472/// * [locations channels set iam policy projects](ProjectLocationChannelSetIamPolicyCall) (request)
1473/// * [locations enrollments set iam policy projects](ProjectLocationEnrollmentSetIamPolicyCall) (request)
1474/// * [locations google api sources set iam policy projects](ProjectLocationGoogleApiSourceSetIamPolicyCall) (request)
1475/// * [locations message buses set iam policy projects](ProjectLocationMessageBusSetIamPolicyCall) (request)
1476/// * [locations pipelines set iam policy projects](ProjectLocationPipelineSetIamPolicyCall) (request)
1477/// * [locations triggers set iam policy projects](ProjectLocationTriggerSetIamPolicyCall) (request)
1478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1479#[serde_with::serde_as]
1480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1481pub struct SetIamPolicyRequest {
1482    /// 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.
1483    pub policy: Option<Policy>,
1484    /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
1485    #[serde(rename = "updateMask")]
1486    pub update_mask: Option<common::FieldMask>,
1487}
1488
1489impl common::RequestValue for SetIamPolicyRequest {}
1490
1491/// A condition that is part of the trigger state computation.
1492///
1493/// This type is not used in any activity, and only used as *part* of another schema.
1494///
1495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1496#[serde_with::serde_as]
1497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1498pub struct StateCondition {
1499    /// The canonical code of the condition.
1500    pub code: Option<String>,
1501    /// Human-readable message.
1502    pub message: Option<String>,
1503}
1504
1505impl common::Part for StateCondition {}
1506
1507/// Request message for `TestIamPermissions` method.
1508///
1509/// # Activities
1510///
1511/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1512/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1513///
1514/// * [locations channel connections test iam permissions projects](ProjectLocationChannelConnectionTestIamPermissionCall) (request)
1515/// * [locations channels test iam permissions projects](ProjectLocationChannelTestIamPermissionCall) (request)
1516/// * [locations enrollments test iam permissions projects](ProjectLocationEnrollmentTestIamPermissionCall) (request)
1517/// * [locations google api sources test iam permissions projects](ProjectLocationGoogleApiSourceTestIamPermissionCall) (request)
1518/// * [locations message buses test iam permissions projects](ProjectLocationMessageBusTestIamPermissionCall) (request)
1519/// * [locations pipelines test iam permissions projects](ProjectLocationPipelineTestIamPermissionCall) (request)
1520/// * [locations triggers test iam permissions projects](ProjectLocationTriggerTestIamPermissionCall) (request)
1521#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1522#[serde_with::serde_as]
1523#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1524pub struct TestIamPermissionsRequest {
1525    /// 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).
1526    pub permissions: Option<Vec<String>>,
1527}
1528
1529impl common::RequestValue for TestIamPermissionsRequest {}
1530
1531/// Response message for `TestIamPermissions` method.
1532///
1533/// # Activities
1534///
1535/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1536/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1537///
1538/// * [locations channel connections test iam permissions projects](ProjectLocationChannelConnectionTestIamPermissionCall) (response)
1539/// * [locations channels test iam permissions projects](ProjectLocationChannelTestIamPermissionCall) (response)
1540/// * [locations enrollments test iam permissions projects](ProjectLocationEnrollmentTestIamPermissionCall) (response)
1541/// * [locations google api sources test iam permissions projects](ProjectLocationGoogleApiSourceTestIamPermissionCall) (response)
1542/// * [locations message buses test iam permissions projects](ProjectLocationMessageBusTestIamPermissionCall) (response)
1543/// * [locations pipelines test iam permissions projects](ProjectLocationPipelineTestIamPermissionCall) (response)
1544/// * [locations triggers test iam permissions projects](ProjectLocationTriggerTestIamPermissionCall) (response)
1545#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1546#[serde_with::serde_as]
1547#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1548pub struct TestIamPermissionsResponse {
1549    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1550    pub permissions: Option<Vec<String>>,
1551}
1552
1553impl common::ResponseResult for TestIamPermissionsResponse {}
1554
1555/// Represents the transport intermediaries created for the trigger to deliver events.
1556///
1557/// This type is not used in any activity, and only used as *part* of another schema.
1558///
1559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1560#[serde_with::serde_as]
1561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1562pub struct Transport {
1563    /// The Pub/Sub topic and subscription used by Eventarc as a transport intermediary.
1564    pub pubsub: Option<Pubsub>,
1565}
1566
1567impl common::Part for Transport {}
1568
1569/// A representation of the trigger resource.
1570///
1571/// # Activities
1572///
1573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1575///
1576/// * [locations triggers create projects](ProjectLocationTriggerCreateCall) (request)
1577/// * [locations triggers get projects](ProjectLocationTriggerGetCall) (response)
1578/// * [locations triggers patch projects](ProjectLocationTriggerPatchCall) (request)
1579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1580#[serde_with::serde_as]
1581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1582pub struct Trigger {
1583    /// Optional. The name of the channel associated with the trigger in `projects/{project}/locations/{location}/channels/{channel}` format. You must provide a channel to receive events from Eventarc SaaS partners.
1584    pub channel: Option<String>,
1585    /// Output only. The reason(s) why a trigger is in FAILED state.
1586    pub conditions: Option<HashMap<String, StateCondition>>,
1587    /// Output only. The creation time.
1588    #[serde(rename = "createTime")]
1589    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1590    /// Required. Destination specifies where the events should be sent to.
1591    pub destination: Option<Destination>,
1592    /// Output only. This checksum is computed by the server based on the value of other fields, and might be sent only on create requests to ensure that the client has an up-to-date value before proceeding.
1593    pub etag: Option<String>,
1594    /// Optional. EventDataContentType specifies the type of payload in MIME format that is expected from the CloudEvent data field. This is set to `application/json` if the value is not defined.
1595    #[serde(rename = "eventDataContentType")]
1596    pub event_data_content_type: Option<String>,
1597    /// Required. Unordered list. The list of filters that applies to event attributes. Only events that match all the provided filters are sent to the destination.
1598    #[serde(rename = "eventFilters")]
1599    pub event_filters: Option<Vec<EventFilter>>,
1600    /// Optional. User labels attached to the triggers that can be used to group resources.
1601    pub labels: Option<HashMap<String, String>>,
1602    /// Required. The resource name of the trigger. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/triggers/{trigger}` format.
1603    pub name: Option<String>,
1604    /// Optional. The retry policy to use in the Trigger. If unset, event delivery will be retried for up to 24 hours by default: https://cloud.google.com/eventarc/docs/retry-events
1605    #[serde(rename = "retryPolicy")]
1606    pub retry_policy: Option<RetryPolicy>,
1607    /// Output only. Whether or not this Trigger satisfies the requirements of physical zone separation
1608    #[serde(rename = "satisfiesPzs")]
1609    pub satisfies_pzs: Option<bool>,
1610    /// Optional. The IAM service account email associated with the trigger. The service account represents the identity of the trigger. The `iam.serviceAccounts.actAs` permission must be granted on the service account to allow a principal to impersonate the service account. For more information, see the [Roles and permissions](https://cloud.google.com/eventarc/docs/all-roles-permissions) page specific to the trigger destination.
1611    #[serde(rename = "serviceAccount")]
1612    pub service_account: Option<String>,
1613    /// Optional. To deliver messages, Eventarc might use other Google Cloud products as a transport intermediary. This field contains a reference to that transport intermediary. This information can be used for debugging purposes.
1614    pub transport: Option<Transport>,
1615    /// Output only. Server-assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
1616    pub uid: Option<String>,
1617    /// Output only. The last-modified time.
1618    #[serde(rename = "updateTime")]
1619    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1620}
1621
1622impl common::RequestValue for Trigger {}
1623impl common::ResponseResult for Trigger {}
1624
1625// ###################
1626// MethodBuilders ###
1627// #################
1628
1629/// A builder providing access to all methods supported on *project* resources.
1630/// It is not used directly, but through the [`Eventarc`] hub.
1631///
1632/// # Example
1633///
1634/// Instantiate a resource builder
1635///
1636/// ```test_harness,no_run
1637/// extern crate hyper;
1638/// extern crate hyper_rustls;
1639/// extern crate google_eventarc1 as eventarc1;
1640///
1641/// # async fn dox() {
1642/// use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1643///
1644/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1645/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1646///     .with_native_roots()
1647///     .unwrap()
1648///     .https_only()
1649///     .enable_http2()
1650///     .build();
1651///
1652/// let executor = hyper_util::rt::TokioExecutor::new();
1653/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1654///     secret,
1655///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1656///     yup_oauth2::client::CustomHyperClientBuilder::from(
1657///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1658///     ),
1659/// ).build().await.unwrap();
1660///
1661/// let client = hyper_util::client::legacy::Client::builder(
1662///     hyper_util::rt::TokioExecutor::new()
1663/// )
1664/// .build(
1665///     hyper_rustls::HttpsConnectorBuilder::new()
1666///         .with_native_roots()
1667///         .unwrap()
1668///         .https_or_http()
1669///         .enable_http2()
1670///         .build()
1671/// );
1672/// let mut hub = Eventarc::new(client, auth);
1673/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1674/// // like `locations_channel_connections_create(...)`, `locations_channel_connections_delete(...)`, `locations_channel_connections_get(...)`, `locations_channel_connections_get_iam_policy(...)`, `locations_channel_connections_list(...)`, `locations_channel_connections_set_iam_policy(...)`, `locations_channel_connections_test_iam_permissions(...)`, `locations_channels_create(...)`, `locations_channels_delete(...)`, `locations_channels_get(...)`, `locations_channels_get_iam_policy(...)`, `locations_channels_list(...)`, `locations_channels_patch(...)`, `locations_channels_set_iam_policy(...)`, `locations_channels_test_iam_permissions(...)`, `locations_enrollments_create(...)`, `locations_enrollments_delete(...)`, `locations_enrollments_get(...)`, `locations_enrollments_get_iam_policy(...)`, `locations_enrollments_list(...)`, `locations_enrollments_patch(...)`, `locations_enrollments_set_iam_policy(...)`, `locations_enrollments_test_iam_permissions(...)`, `locations_get(...)`, `locations_get_google_channel_config(...)`, `locations_google_api_sources_create(...)`, `locations_google_api_sources_delete(...)`, `locations_google_api_sources_get(...)`, `locations_google_api_sources_get_iam_policy(...)`, `locations_google_api_sources_list(...)`, `locations_google_api_sources_patch(...)`, `locations_google_api_sources_set_iam_policy(...)`, `locations_google_api_sources_test_iam_permissions(...)`, `locations_list(...)`, `locations_message_buses_create(...)`, `locations_message_buses_delete(...)`, `locations_message_buses_get(...)`, `locations_message_buses_get_iam_policy(...)`, `locations_message_buses_list(...)`, `locations_message_buses_list_enrollments(...)`, `locations_message_buses_patch(...)`, `locations_message_buses_set_iam_policy(...)`, `locations_message_buses_test_iam_permissions(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_pipelines_create(...)`, `locations_pipelines_delete(...)`, `locations_pipelines_get(...)`, `locations_pipelines_get_iam_policy(...)`, `locations_pipelines_list(...)`, `locations_pipelines_patch(...)`, `locations_pipelines_set_iam_policy(...)`, `locations_pipelines_test_iam_permissions(...)`, `locations_providers_get(...)`, `locations_providers_list(...)`, `locations_triggers_create(...)`, `locations_triggers_delete(...)`, `locations_triggers_get(...)`, `locations_triggers_get_iam_policy(...)`, `locations_triggers_list(...)`, `locations_triggers_patch(...)`, `locations_triggers_set_iam_policy(...)`, `locations_triggers_test_iam_permissions(...)` and `locations_update_google_channel_config(...)`
1675/// // to build up your call.
1676/// let rb = hub.projects();
1677/// # }
1678/// ```
1679pub struct ProjectMethods<'a, C>
1680where
1681    C: 'a,
1682{
1683    hub: &'a Eventarc<C>,
1684}
1685
1686impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1687
1688impl<'a, C> ProjectMethods<'a, C> {
1689    /// Create a builder to help you perform the following task:
1690    ///
1691    /// Create a new ChannelConnection in a particular project and location.
1692    ///
1693    /// # Arguments
1694    ///
1695    /// * `request` - No description provided.
1696    /// * `parent` - Required. The parent collection in which to add this channel connection.
1697    pub fn locations_channel_connections_create(
1698        &self,
1699        request: ChannelConnection,
1700        parent: &str,
1701    ) -> ProjectLocationChannelConnectionCreateCall<'a, C> {
1702        ProjectLocationChannelConnectionCreateCall {
1703            hub: self.hub,
1704            _request: request,
1705            _parent: parent.to_string(),
1706            _channel_connection_id: Default::default(),
1707            _delegate: Default::default(),
1708            _additional_params: Default::default(),
1709            _scopes: Default::default(),
1710        }
1711    }
1712
1713    /// Create a builder to help you perform the following task:
1714    ///
1715    /// Delete a single ChannelConnection.
1716    ///
1717    /// # Arguments
1718    ///
1719    /// * `name` - Required. The name of the channel connection to delete.
1720    pub fn locations_channel_connections_delete(
1721        &self,
1722        name: &str,
1723    ) -> ProjectLocationChannelConnectionDeleteCall<'a, C> {
1724        ProjectLocationChannelConnectionDeleteCall {
1725            hub: self.hub,
1726            _name: name.to_string(),
1727            _delegate: Default::default(),
1728            _additional_params: Default::default(),
1729            _scopes: Default::default(),
1730        }
1731    }
1732
1733    /// Create a builder to help you perform the following task:
1734    ///
1735    /// Get a single ChannelConnection.
1736    ///
1737    /// # Arguments
1738    ///
1739    /// * `name` - Required. The name of the channel connection to get.
1740    pub fn locations_channel_connections_get(
1741        &self,
1742        name: &str,
1743    ) -> ProjectLocationChannelConnectionGetCall<'a, C> {
1744        ProjectLocationChannelConnectionGetCall {
1745            hub: self.hub,
1746            _name: name.to_string(),
1747            _delegate: Default::default(),
1748            _additional_params: Default::default(),
1749            _scopes: Default::default(),
1750        }
1751    }
1752
1753    /// Create a builder to help you perform the following task:
1754    ///
1755    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1756    ///
1757    /// # Arguments
1758    ///
1759    /// * `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.
1760    pub fn locations_channel_connections_get_iam_policy(
1761        &self,
1762        resource: &str,
1763    ) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C> {
1764        ProjectLocationChannelConnectionGetIamPolicyCall {
1765            hub: self.hub,
1766            _resource: resource.to_string(),
1767            _options_requested_policy_version: Default::default(),
1768            _delegate: Default::default(),
1769            _additional_params: Default::default(),
1770            _scopes: Default::default(),
1771        }
1772    }
1773
1774    /// Create a builder to help you perform the following task:
1775    ///
1776    /// List channel connections.
1777    ///
1778    /// # Arguments
1779    ///
1780    /// * `parent` - Required. The parent collection from which to list channel connections.
1781    pub fn locations_channel_connections_list(
1782        &self,
1783        parent: &str,
1784    ) -> ProjectLocationChannelConnectionListCall<'a, C> {
1785        ProjectLocationChannelConnectionListCall {
1786            hub: self.hub,
1787            _parent: parent.to_string(),
1788            _page_token: Default::default(),
1789            _page_size: Default::default(),
1790            _delegate: Default::default(),
1791            _additional_params: Default::default(),
1792            _scopes: Default::default(),
1793        }
1794    }
1795
1796    /// Create a builder to help you perform the following task:
1797    ///
1798    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1799    ///
1800    /// # Arguments
1801    ///
1802    /// * `request` - No description provided.
1803    /// * `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.
1804    pub fn locations_channel_connections_set_iam_policy(
1805        &self,
1806        request: SetIamPolicyRequest,
1807        resource: &str,
1808    ) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C> {
1809        ProjectLocationChannelConnectionSetIamPolicyCall {
1810            hub: self.hub,
1811            _request: request,
1812            _resource: resource.to_string(),
1813            _delegate: Default::default(),
1814            _additional_params: Default::default(),
1815            _scopes: Default::default(),
1816        }
1817    }
1818
1819    /// Create a builder to help you perform the following task:
1820    ///
1821    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
1822    ///
1823    /// # Arguments
1824    ///
1825    /// * `request` - No description provided.
1826    /// * `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.
1827    pub fn locations_channel_connections_test_iam_permissions(
1828        &self,
1829        request: TestIamPermissionsRequest,
1830        resource: &str,
1831    ) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C> {
1832        ProjectLocationChannelConnectionTestIamPermissionCall {
1833            hub: self.hub,
1834            _request: request,
1835            _resource: resource.to_string(),
1836            _delegate: Default::default(),
1837            _additional_params: Default::default(),
1838            _scopes: Default::default(),
1839        }
1840    }
1841
1842    /// Create a builder to help you perform the following task:
1843    ///
1844    /// Create a new channel in a particular project and location.
1845    ///
1846    /// # Arguments
1847    ///
1848    /// * `request` - No description provided.
1849    /// * `parent` - Required. The parent collection in which to add this channel.
1850    pub fn locations_channels_create(
1851        &self,
1852        request: Channel,
1853        parent: &str,
1854    ) -> ProjectLocationChannelCreateCall<'a, C> {
1855        ProjectLocationChannelCreateCall {
1856            hub: self.hub,
1857            _request: request,
1858            _parent: parent.to_string(),
1859            _validate_only: Default::default(),
1860            _channel_id: Default::default(),
1861            _delegate: Default::default(),
1862            _additional_params: Default::default(),
1863            _scopes: Default::default(),
1864        }
1865    }
1866
1867    /// Create a builder to help you perform the following task:
1868    ///
1869    /// Delete a single channel.
1870    ///
1871    /// # Arguments
1872    ///
1873    /// * `name` - Required. The name of the channel to be deleted.
1874    pub fn locations_channels_delete(&self, name: &str) -> ProjectLocationChannelDeleteCall<'a, C> {
1875        ProjectLocationChannelDeleteCall {
1876            hub: self.hub,
1877            _name: name.to_string(),
1878            _validate_only: Default::default(),
1879            _delegate: Default::default(),
1880            _additional_params: Default::default(),
1881            _scopes: Default::default(),
1882        }
1883    }
1884
1885    /// Create a builder to help you perform the following task:
1886    ///
1887    /// Get a single Channel.
1888    ///
1889    /// # Arguments
1890    ///
1891    /// * `name` - Required. The name of the channel to get.
1892    pub fn locations_channels_get(&self, name: &str) -> ProjectLocationChannelGetCall<'a, C> {
1893        ProjectLocationChannelGetCall {
1894            hub: self.hub,
1895            _name: name.to_string(),
1896            _delegate: Default::default(),
1897            _additional_params: Default::default(),
1898            _scopes: Default::default(),
1899        }
1900    }
1901
1902    /// Create a builder to help you perform the following task:
1903    ///
1904    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1905    ///
1906    /// # Arguments
1907    ///
1908    /// * `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.
1909    pub fn locations_channels_get_iam_policy(
1910        &self,
1911        resource: &str,
1912    ) -> ProjectLocationChannelGetIamPolicyCall<'a, C> {
1913        ProjectLocationChannelGetIamPolicyCall {
1914            hub: self.hub,
1915            _resource: resource.to_string(),
1916            _options_requested_policy_version: Default::default(),
1917            _delegate: Default::default(),
1918            _additional_params: Default::default(),
1919            _scopes: Default::default(),
1920        }
1921    }
1922
1923    /// Create a builder to help you perform the following task:
1924    ///
1925    /// List channels.
1926    ///
1927    /// # Arguments
1928    ///
1929    /// * `parent` - Required. The parent collection to list channels on.
1930    pub fn locations_channels_list(&self, parent: &str) -> ProjectLocationChannelListCall<'a, C> {
1931        ProjectLocationChannelListCall {
1932            hub: self.hub,
1933            _parent: parent.to_string(),
1934            _page_token: Default::default(),
1935            _page_size: Default::default(),
1936            _order_by: Default::default(),
1937            _delegate: Default::default(),
1938            _additional_params: Default::default(),
1939            _scopes: Default::default(),
1940        }
1941    }
1942
1943    /// Create a builder to help you perform the following task:
1944    ///
1945    /// Update a single channel.
1946    ///
1947    /// # Arguments
1948    ///
1949    /// * `request` - No description provided.
1950    /// * `name` - Required. The resource name of the channel. Must be unique within the location on the project and must be in `projects/{project}/locations/{location}/channels/{channel_id}` format.
1951    pub fn locations_channels_patch(
1952        &self,
1953        request: Channel,
1954        name: &str,
1955    ) -> ProjectLocationChannelPatchCall<'a, C> {
1956        ProjectLocationChannelPatchCall {
1957            hub: self.hub,
1958            _request: request,
1959            _name: name.to_string(),
1960            _validate_only: Default::default(),
1961            _update_mask: Default::default(),
1962            _delegate: Default::default(),
1963            _additional_params: Default::default(),
1964            _scopes: Default::default(),
1965        }
1966    }
1967
1968    /// Create a builder to help you perform the following task:
1969    ///
1970    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1971    ///
1972    /// # Arguments
1973    ///
1974    /// * `request` - No description provided.
1975    /// * `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.
1976    pub fn locations_channels_set_iam_policy(
1977        &self,
1978        request: SetIamPolicyRequest,
1979        resource: &str,
1980    ) -> ProjectLocationChannelSetIamPolicyCall<'a, C> {
1981        ProjectLocationChannelSetIamPolicyCall {
1982            hub: self.hub,
1983            _request: request,
1984            _resource: resource.to_string(),
1985            _delegate: Default::default(),
1986            _additional_params: Default::default(),
1987            _scopes: Default::default(),
1988        }
1989    }
1990
1991    /// Create a builder to help you perform the following task:
1992    ///
1993    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
1994    ///
1995    /// # Arguments
1996    ///
1997    /// * `request` - No description provided.
1998    /// * `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.
1999    pub fn locations_channels_test_iam_permissions(
2000        &self,
2001        request: TestIamPermissionsRequest,
2002        resource: &str,
2003    ) -> ProjectLocationChannelTestIamPermissionCall<'a, C> {
2004        ProjectLocationChannelTestIamPermissionCall {
2005            hub: self.hub,
2006            _request: request,
2007            _resource: resource.to_string(),
2008            _delegate: Default::default(),
2009            _additional_params: Default::default(),
2010            _scopes: Default::default(),
2011        }
2012    }
2013
2014    /// Create a builder to help you perform the following task:
2015    ///
2016    /// Create a new Enrollment in a particular project and location.
2017    ///
2018    /// # Arguments
2019    ///
2020    /// * `request` - No description provided.
2021    /// * `parent` - Required. The parent collection in which to add this enrollment.
2022    pub fn locations_enrollments_create(
2023        &self,
2024        request: Enrollment,
2025        parent: &str,
2026    ) -> ProjectLocationEnrollmentCreateCall<'a, C> {
2027        ProjectLocationEnrollmentCreateCall {
2028            hub: self.hub,
2029            _request: request,
2030            _parent: parent.to_string(),
2031            _validate_only: Default::default(),
2032            _enrollment_id: Default::default(),
2033            _delegate: Default::default(),
2034            _additional_params: Default::default(),
2035            _scopes: Default::default(),
2036        }
2037    }
2038
2039    /// Create a builder to help you perform the following task:
2040    ///
2041    /// Delete a single Enrollment.
2042    ///
2043    /// # Arguments
2044    ///
2045    /// * `name` - Required. The name of the Enrollment to be deleted.
2046    pub fn locations_enrollments_delete(
2047        &self,
2048        name: &str,
2049    ) -> ProjectLocationEnrollmentDeleteCall<'a, C> {
2050        ProjectLocationEnrollmentDeleteCall {
2051            hub: self.hub,
2052            _name: name.to_string(),
2053            _validate_only: Default::default(),
2054            _etag: Default::default(),
2055            _allow_missing: Default::default(),
2056            _delegate: Default::default(),
2057            _additional_params: Default::default(),
2058            _scopes: Default::default(),
2059        }
2060    }
2061
2062    /// Create a builder to help you perform the following task:
2063    ///
2064    /// Get a single Enrollment.
2065    ///
2066    /// # Arguments
2067    ///
2068    /// * `name` - Required. The name of the Enrollment to get.
2069    pub fn locations_enrollments_get(&self, name: &str) -> ProjectLocationEnrollmentGetCall<'a, C> {
2070        ProjectLocationEnrollmentGetCall {
2071            hub: self.hub,
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    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2082    ///
2083    /// # Arguments
2084    ///
2085    /// * `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.
2086    pub fn locations_enrollments_get_iam_policy(
2087        &self,
2088        resource: &str,
2089    ) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C> {
2090        ProjectLocationEnrollmentGetIamPolicyCall {
2091            hub: self.hub,
2092            _resource: resource.to_string(),
2093            _options_requested_policy_version: Default::default(),
2094            _delegate: Default::default(),
2095            _additional_params: Default::default(),
2096            _scopes: Default::default(),
2097        }
2098    }
2099
2100    /// Create a builder to help you perform the following task:
2101    ///
2102    /// List Enrollments.
2103    ///
2104    /// # Arguments
2105    ///
2106    /// * `parent` - Required. The parent collection to list triggers on.
2107    pub fn locations_enrollments_list(
2108        &self,
2109        parent: &str,
2110    ) -> ProjectLocationEnrollmentListCall<'a, C> {
2111        ProjectLocationEnrollmentListCall {
2112            hub: self.hub,
2113            _parent: parent.to_string(),
2114            _page_token: Default::default(),
2115            _page_size: Default::default(),
2116            _order_by: Default::default(),
2117            _filter: 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    /// Update a single Enrollment.
2127    ///
2128    /// # Arguments
2129    ///
2130    /// * `request` - No description provided.
2131    /// * `name` - Identifier. Resource name of the form projects/{project}/locations/{location}/enrollments/{enrollment}
2132    pub fn locations_enrollments_patch(
2133        &self,
2134        request: Enrollment,
2135        name: &str,
2136    ) -> ProjectLocationEnrollmentPatchCall<'a, C> {
2137        ProjectLocationEnrollmentPatchCall {
2138            hub: self.hub,
2139            _request: request,
2140            _name: name.to_string(),
2141            _validate_only: Default::default(),
2142            _update_mask: Default::default(),
2143            _allow_missing: Default::default(),
2144            _delegate: Default::default(),
2145            _additional_params: Default::default(),
2146            _scopes: Default::default(),
2147        }
2148    }
2149
2150    /// Create a builder to help you perform the following task:
2151    ///
2152    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2153    ///
2154    /// # Arguments
2155    ///
2156    /// * `request` - No description provided.
2157    /// * `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.
2158    pub fn locations_enrollments_set_iam_policy(
2159        &self,
2160        request: SetIamPolicyRequest,
2161        resource: &str,
2162    ) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C> {
2163        ProjectLocationEnrollmentSetIamPolicyCall {
2164            hub: self.hub,
2165            _request: request,
2166            _resource: resource.to_string(),
2167            _delegate: Default::default(),
2168            _additional_params: Default::default(),
2169            _scopes: Default::default(),
2170        }
2171    }
2172
2173    /// Create a builder to help you perform the following task:
2174    ///
2175    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2176    ///
2177    /// # Arguments
2178    ///
2179    /// * `request` - No description provided.
2180    /// * `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.
2181    pub fn locations_enrollments_test_iam_permissions(
2182        &self,
2183        request: TestIamPermissionsRequest,
2184        resource: &str,
2185    ) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C> {
2186        ProjectLocationEnrollmentTestIamPermissionCall {
2187            hub: self.hub,
2188            _request: request,
2189            _resource: resource.to_string(),
2190            _delegate: Default::default(),
2191            _additional_params: Default::default(),
2192            _scopes: Default::default(),
2193        }
2194    }
2195
2196    /// Create a builder to help you perform the following task:
2197    ///
2198    /// Create a new GoogleApiSource in a particular project and location.
2199    ///
2200    /// # Arguments
2201    ///
2202    /// * `request` - No description provided.
2203    /// * `parent` - Required. The parent collection in which to add this google api source.
2204    pub fn locations_google_api_sources_create(
2205        &self,
2206        request: GoogleApiSource,
2207        parent: &str,
2208    ) -> ProjectLocationGoogleApiSourceCreateCall<'a, C> {
2209        ProjectLocationGoogleApiSourceCreateCall {
2210            hub: self.hub,
2211            _request: request,
2212            _parent: parent.to_string(),
2213            _validate_only: Default::default(),
2214            _google_api_source_id: Default::default(),
2215            _delegate: Default::default(),
2216            _additional_params: Default::default(),
2217            _scopes: Default::default(),
2218        }
2219    }
2220
2221    /// Create a builder to help you perform the following task:
2222    ///
2223    /// Delete a single GoogleApiSource.
2224    ///
2225    /// # Arguments
2226    ///
2227    /// * `name` - Required. The name of the GoogleApiSource to be deleted.
2228    pub fn locations_google_api_sources_delete(
2229        &self,
2230        name: &str,
2231    ) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C> {
2232        ProjectLocationGoogleApiSourceDeleteCall {
2233            hub: self.hub,
2234            _name: name.to_string(),
2235            _validate_only: Default::default(),
2236            _etag: Default::default(),
2237            _allow_missing: Default::default(),
2238            _delegate: Default::default(),
2239            _additional_params: Default::default(),
2240            _scopes: Default::default(),
2241        }
2242    }
2243
2244    /// Create a builder to help you perform the following task:
2245    ///
2246    /// Get a single GoogleApiSource.
2247    ///
2248    /// # Arguments
2249    ///
2250    /// * `name` - Required. The name of the google api source to get.
2251    pub fn locations_google_api_sources_get(
2252        &self,
2253        name: &str,
2254    ) -> ProjectLocationGoogleApiSourceGetCall<'a, C> {
2255        ProjectLocationGoogleApiSourceGetCall {
2256            hub: self.hub,
2257            _name: name.to_string(),
2258            _delegate: Default::default(),
2259            _additional_params: Default::default(),
2260            _scopes: Default::default(),
2261        }
2262    }
2263
2264    /// Create a builder to help you perform the following task:
2265    ///
2266    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2267    ///
2268    /// # Arguments
2269    ///
2270    /// * `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.
2271    pub fn locations_google_api_sources_get_iam_policy(
2272        &self,
2273        resource: &str,
2274    ) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C> {
2275        ProjectLocationGoogleApiSourceGetIamPolicyCall {
2276            hub: self.hub,
2277            _resource: resource.to_string(),
2278            _options_requested_policy_version: Default::default(),
2279            _delegate: Default::default(),
2280            _additional_params: Default::default(),
2281            _scopes: Default::default(),
2282        }
2283    }
2284
2285    /// Create a builder to help you perform the following task:
2286    ///
2287    /// List GoogleApiSources.
2288    ///
2289    /// # Arguments
2290    ///
2291    /// * `parent` - Required. The parent collection to list GoogleApiSources on.
2292    pub fn locations_google_api_sources_list(
2293        &self,
2294        parent: &str,
2295    ) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
2296        ProjectLocationGoogleApiSourceListCall {
2297            hub: self.hub,
2298            _parent: parent.to_string(),
2299            _page_token: Default::default(),
2300            _page_size: Default::default(),
2301            _order_by: Default::default(),
2302            _filter: Default::default(),
2303            _delegate: Default::default(),
2304            _additional_params: Default::default(),
2305            _scopes: Default::default(),
2306        }
2307    }
2308
2309    /// Create a builder to help you perform the following task:
2310    ///
2311    /// Update a single GoogleApiSource.
2312    ///
2313    /// # Arguments
2314    ///
2315    /// * `request` - No description provided.
2316    /// * `name` - Identifier. Resource name of the form projects/{project}/locations/{location}/googleApiSources/{google_api_source}
2317    pub fn locations_google_api_sources_patch(
2318        &self,
2319        request: GoogleApiSource,
2320        name: &str,
2321    ) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
2322        ProjectLocationGoogleApiSourcePatchCall {
2323            hub: self.hub,
2324            _request: request,
2325            _name: name.to_string(),
2326            _validate_only: Default::default(),
2327            _update_mask: Default::default(),
2328            _allow_missing: Default::default(),
2329            _delegate: Default::default(),
2330            _additional_params: Default::default(),
2331            _scopes: Default::default(),
2332        }
2333    }
2334
2335    /// Create a builder to help you perform the following task:
2336    ///
2337    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2338    ///
2339    /// # Arguments
2340    ///
2341    /// * `request` - No description provided.
2342    /// * `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.
2343    pub fn locations_google_api_sources_set_iam_policy(
2344        &self,
2345        request: SetIamPolicyRequest,
2346        resource: &str,
2347    ) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C> {
2348        ProjectLocationGoogleApiSourceSetIamPolicyCall {
2349            hub: self.hub,
2350            _request: request,
2351            _resource: resource.to_string(),
2352            _delegate: Default::default(),
2353            _additional_params: Default::default(),
2354            _scopes: Default::default(),
2355        }
2356    }
2357
2358    /// Create a builder to help you perform the following task:
2359    ///
2360    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2361    ///
2362    /// # Arguments
2363    ///
2364    /// * `request` - No description provided.
2365    /// * `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.
2366    pub fn locations_google_api_sources_test_iam_permissions(
2367        &self,
2368        request: TestIamPermissionsRequest,
2369        resource: &str,
2370    ) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C> {
2371        ProjectLocationGoogleApiSourceTestIamPermissionCall {
2372            hub: self.hub,
2373            _request: request,
2374            _resource: resource.to_string(),
2375            _delegate: Default::default(),
2376            _additional_params: Default::default(),
2377            _scopes: Default::default(),
2378        }
2379    }
2380
2381    /// Create a builder to help you perform the following task:
2382    ///
2383    /// Create a new MessageBus in a particular project and location.
2384    ///
2385    /// # Arguments
2386    ///
2387    /// * `request` - No description provided.
2388    /// * `parent` - Required. The parent collection in which to add this message bus.
2389    pub fn locations_message_buses_create(
2390        &self,
2391        request: MessageBus,
2392        parent: &str,
2393    ) -> ProjectLocationMessageBusCreateCall<'a, C> {
2394        ProjectLocationMessageBusCreateCall {
2395            hub: self.hub,
2396            _request: request,
2397            _parent: parent.to_string(),
2398            _validate_only: Default::default(),
2399            _message_bus_id: Default::default(),
2400            _delegate: Default::default(),
2401            _additional_params: Default::default(),
2402            _scopes: Default::default(),
2403        }
2404    }
2405
2406    /// Create a builder to help you perform the following task:
2407    ///
2408    /// Delete a single message bus.
2409    ///
2410    /// # Arguments
2411    ///
2412    /// * `name` - Required. The name of the MessageBus to be deleted.
2413    pub fn locations_message_buses_delete(
2414        &self,
2415        name: &str,
2416    ) -> ProjectLocationMessageBusDeleteCall<'a, C> {
2417        ProjectLocationMessageBusDeleteCall {
2418            hub: self.hub,
2419            _name: name.to_string(),
2420            _validate_only: Default::default(),
2421            _etag: Default::default(),
2422            _allow_missing: Default::default(),
2423            _delegate: Default::default(),
2424            _additional_params: Default::default(),
2425            _scopes: Default::default(),
2426        }
2427    }
2428
2429    /// Create a builder to help you perform the following task:
2430    ///
2431    /// Get a single MessageBus.
2432    ///
2433    /// # Arguments
2434    ///
2435    /// * `name` - Required. The name of the message bus to get.
2436    pub fn locations_message_buses_get(
2437        &self,
2438        name: &str,
2439    ) -> ProjectLocationMessageBusGetCall<'a, C> {
2440        ProjectLocationMessageBusGetCall {
2441            hub: self.hub,
2442            _name: name.to_string(),
2443            _delegate: Default::default(),
2444            _additional_params: Default::default(),
2445            _scopes: Default::default(),
2446        }
2447    }
2448
2449    /// Create a builder to help you perform the following task:
2450    ///
2451    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2452    ///
2453    /// # Arguments
2454    ///
2455    /// * `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.
2456    pub fn locations_message_buses_get_iam_policy(
2457        &self,
2458        resource: &str,
2459    ) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C> {
2460        ProjectLocationMessageBusGetIamPolicyCall {
2461            hub: self.hub,
2462            _resource: resource.to_string(),
2463            _options_requested_policy_version: Default::default(),
2464            _delegate: Default::default(),
2465            _additional_params: Default::default(),
2466            _scopes: Default::default(),
2467        }
2468    }
2469
2470    /// Create a builder to help you perform the following task:
2471    ///
2472    /// List message buses.
2473    ///
2474    /// # Arguments
2475    ///
2476    /// * `parent` - Required. The parent collection to list message buses on.
2477    pub fn locations_message_buses_list(
2478        &self,
2479        parent: &str,
2480    ) -> ProjectLocationMessageBusListCall<'a, C> {
2481        ProjectLocationMessageBusListCall {
2482            hub: self.hub,
2483            _parent: parent.to_string(),
2484            _page_token: Default::default(),
2485            _page_size: Default::default(),
2486            _order_by: Default::default(),
2487            _filter: Default::default(),
2488            _delegate: Default::default(),
2489            _additional_params: Default::default(),
2490            _scopes: Default::default(),
2491        }
2492    }
2493
2494    /// Create a builder to help you perform the following task:
2495    ///
2496    /// List message bus enrollments.
2497    ///
2498    /// # Arguments
2499    ///
2500    /// * `parent` - Required. The parent message bus to list enrollments on.
2501    pub fn locations_message_buses_list_enrollments(
2502        &self,
2503        parent: &str,
2504    ) -> ProjectLocationMessageBusListEnrollmentCall<'a, C> {
2505        ProjectLocationMessageBusListEnrollmentCall {
2506            hub: self.hub,
2507            _parent: parent.to_string(),
2508            _page_token: Default::default(),
2509            _page_size: Default::default(),
2510            _delegate: Default::default(),
2511            _additional_params: Default::default(),
2512            _scopes: Default::default(),
2513        }
2514    }
2515
2516    /// Create a builder to help you perform the following task:
2517    ///
2518    /// Update a single message bus.
2519    ///
2520    /// # Arguments
2521    ///
2522    /// * `request` - No description provided.
2523    /// * `name` - Identifier. Resource name of the form projects/{project}/locations/{location}/messageBuses/{message_bus}
2524    pub fn locations_message_buses_patch(
2525        &self,
2526        request: MessageBus,
2527        name: &str,
2528    ) -> ProjectLocationMessageBusPatchCall<'a, C> {
2529        ProjectLocationMessageBusPatchCall {
2530            hub: self.hub,
2531            _request: request,
2532            _name: name.to_string(),
2533            _validate_only: Default::default(),
2534            _update_mask: Default::default(),
2535            _allow_missing: Default::default(),
2536            _delegate: Default::default(),
2537            _additional_params: Default::default(),
2538            _scopes: Default::default(),
2539        }
2540    }
2541
2542    /// Create a builder to help you perform the following task:
2543    ///
2544    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2545    ///
2546    /// # Arguments
2547    ///
2548    /// * `request` - No description provided.
2549    /// * `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.
2550    pub fn locations_message_buses_set_iam_policy(
2551        &self,
2552        request: SetIamPolicyRequest,
2553        resource: &str,
2554    ) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C> {
2555        ProjectLocationMessageBusSetIamPolicyCall {
2556            hub: self.hub,
2557            _request: request,
2558            _resource: resource.to_string(),
2559            _delegate: Default::default(),
2560            _additional_params: Default::default(),
2561            _scopes: Default::default(),
2562        }
2563    }
2564
2565    /// Create a builder to help you perform the following task:
2566    ///
2567    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2568    ///
2569    /// # Arguments
2570    ///
2571    /// * `request` - No description provided.
2572    /// * `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.
2573    pub fn locations_message_buses_test_iam_permissions(
2574        &self,
2575        request: TestIamPermissionsRequest,
2576        resource: &str,
2577    ) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C> {
2578        ProjectLocationMessageBusTestIamPermissionCall {
2579            hub: self.hub,
2580            _request: request,
2581            _resource: resource.to_string(),
2582            _delegate: Default::default(),
2583            _additional_params: Default::default(),
2584            _scopes: Default::default(),
2585        }
2586    }
2587
2588    /// Create a builder to help you perform the following task:
2589    ///
2590    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
2591    ///
2592    /// # Arguments
2593    ///
2594    /// * `request` - No description provided.
2595    /// * `name` - The name of the operation resource to be cancelled.
2596    pub fn locations_operations_cancel(
2597        &self,
2598        request: GoogleLongrunningCancelOperationRequest,
2599        name: &str,
2600    ) -> ProjectLocationOperationCancelCall<'a, C> {
2601        ProjectLocationOperationCancelCall {
2602            hub: self.hub,
2603            _request: request,
2604            _name: name.to_string(),
2605            _delegate: Default::default(),
2606            _additional_params: Default::default(),
2607            _scopes: Default::default(),
2608        }
2609    }
2610
2611    /// Create a builder to help you perform the following task:
2612    ///
2613    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2614    ///
2615    /// # Arguments
2616    ///
2617    /// * `name` - The name of the operation resource to be deleted.
2618    pub fn locations_operations_delete(
2619        &self,
2620        name: &str,
2621    ) -> ProjectLocationOperationDeleteCall<'a, C> {
2622        ProjectLocationOperationDeleteCall {
2623            hub: self.hub,
2624            _name: name.to_string(),
2625            _delegate: Default::default(),
2626            _additional_params: Default::default(),
2627            _scopes: Default::default(),
2628        }
2629    }
2630
2631    /// Create a builder to help you perform the following task:
2632    ///
2633    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2634    ///
2635    /// # Arguments
2636    ///
2637    /// * `name` - The name of the operation resource.
2638    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2639        ProjectLocationOperationGetCall {
2640            hub: self.hub,
2641            _name: name.to_string(),
2642            _delegate: Default::default(),
2643            _additional_params: Default::default(),
2644            _scopes: Default::default(),
2645        }
2646    }
2647
2648    /// Create a builder to help you perform the following task:
2649    ///
2650    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2651    ///
2652    /// # Arguments
2653    ///
2654    /// * `name` - The name of the operation's parent resource.
2655    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2656        ProjectLocationOperationListCall {
2657            hub: self.hub,
2658            _name: name.to_string(),
2659            _return_partial_success: Default::default(),
2660            _page_token: Default::default(),
2661            _page_size: Default::default(),
2662            _filter: Default::default(),
2663            _delegate: Default::default(),
2664            _additional_params: Default::default(),
2665            _scopes: Default::default(),
2666        }
2667    }
2668
2669    /// Create a builder to help you perform the following task:
2670    ///
2671    /// Create a new Pipeline in a particular project and location.
2672    ///
2673    /// # Arguments
2674    ///
2675    /// * `request` - No description provided.
2676    /// * `parent` - Required. The parent collection in which to add this pipeline.
2677    pub fn locations_pipelines_create(
2678        &self,
2679        request: Pipeline,
2680        parent: &str,
2681    ) -> ProjectLocationPipelineCreateCall<'a, C> {
2682        ProjectLocationPipelineCreateCall {
2683            hub: self.hub,
2684            _request: request,
2685            _parent: parent.to_string(),
2686            _validate_only: Default::default(),
2687            _pipeline_id: Default::default(),
2688            _delegate: Default::default(),
2689            _additional_params: Default::default(),
2690            _scopes: Default::default(),
2691        }
2692    }
2693
2694    /// Create a builder to help you perform the following task:
2695    ///
2696    /// Delete a single pipeline.
2697    ///
2698    /// # Arguments
2699    ///
2700    /// * `name` - Required. The name of the Pipeline to be deleted.
2701    pub fn locations_pipelines_delete(
2702        &self,
2703        name: &str,
2704    ) -> ProjectLocationPipelineDeleteCall<'a, C> {
2705        ProjectLocationPipelineDeleteCall {
2706            hub: self.hub,
2707            _name: name.to_string(),
2708            _validate_only: Default::default(),
2709            _etag: Default::default(),
2710            _allow_missing: Default::default(),
2711            _delegate: Default::default(),
2712            _additional_params: Default::default(),
2713            _scopes: Default::default(),
2714        }
2715    }
2716
2717    /// Create a builder to help you perform the following task:
2718    ///
2719    /// Get a single Pipeline.
2720    ///
2721    /// # Arguments
2722    ///
2723    /// * `name` - Required. The name of the pipeline to get.
2724    pub fn locations_pipelines_get(&self, name: &str) -> ProjectLocationPipelineGetCall<'a, C> {
2725        ProjectLocationPipelineGetCall {
2726            hub: self.hub,
2727            _name: name.to_string(),
2728            _delegate: Default::default(),
2729            _additional_params: Default::default(),
2730            _scopes: Default::default(),
2731        }
2732    }
2733
2734    /// Create a builder to help you perform the following task:
2735    ///
2736    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2737    ///
2738    /// # Arguments
2739    ///
2740    /// * `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.
2741    pub fn locations_pipelines_get_iam_policy(
2742        &self,
2743        resource: &str,
2744    ) -> ProjectLocationPipelineGetIamPolicyCall<'a, C> {
2745        ProjectLocationPipelineGetIamPolicyCall {
2746            hub: self.hub,
2747            _resource: resource.to_string(),
2748            _options_requested_policy_version: Default::default(),
2749            _delegate: Default::default(),
2750            _additional_params: Default::default(),
2751            _scopes: Default::default(),
2752        }
2753    }
2754
2755    /// Create a builder to help you perform the following task:
2756    ///
2757    /// List pipelines.
2758    ///
2759    /// # Arguments
2760    ///
2761    /// * `parent` - Required. The parent collection to list pipelines on.
2762    pub fn locations_pipelines_list(&self, parent: &str) -> ProjectLocationPipelineListCall<'a, C> {
2763        ProjectLocationPipelineListCall {
2764            hub: self.hub,
2765            _parent: parent.to_string(),
2766            _page_token: Default::default(),
2767            _page_size: Default::default(),
2768            _order_by: Default::default(),
2769            _filter: Default::default(),
2770            _delegate: Default::default(),
2771            _additional_params: Default::default(),
2772            _scopes: Default::default(),
2773        }
2774    }
2775
2776    /// Create a builder to help you perform the following task:
2777    ///
2778    /// Update a single pipeline.
2779    ///
2780    /// # Arguments
2781    ///
2782    /// * `request` - No description provided.
2783    /// * `name` - Identifier. The resource name of the Pipeline. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/pipelines/{pipeline}` format.
2784    pub fn locations_pipelines_patch(
2785        &self,
2786        request: Pipeline,
2787        name: &str,
2788    ) -> ProjectLocationPipelinePatchCall<'a, C> {
2789        ProjectLocationPipelinePatchCall {
2790            hub: self.hub,
2791            _request: request,
2792            _name: name.to_string(),
2793            _validate_only: Default::default(),
2794            _update_mask: Default::default(),
2795            _allow_missing: Default::default(),
2796            _delegate: Default::default(),
2797            _additional_params: Default::default(),
2798            _scopes: Default::default(),
2799        }
2800    }
2801
2802    /// Create a builder to help you perform the following task:
2803    ///
2804    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2805    ///
2806    /// # Arguments
2807    ///
2808    /// * `request` - No description provided.
2809    /// * `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.
2810    pub fn locations_pipelines_set_iam_policy(
2811        &self,
2812        request: SetIamPolicyRequest,
2813        resource: &str,
2814    ) -> ProjectLocationPipelineSetIamPolicyCall<'a, C> {
2815        ProjectLocationPipelineSetIamPolicyCall {
2816            hub: self.hub,
2817            _request: request,
2818            _resource: resource.to_string(),
2819            _delegate: Default::default(),
2820            _additional_params: Default::default(),
2821            _scopes: Default::default(),
2822        }
2823    }
2824
2825    /// Create a builder to help you perform the following task:
2826    ///
2827    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2828    ///
2829    /// # Arguments
2830    ///
2831    /// * `request` - No description provided.
2832    /// * `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.
2833    pub fn locations_pipelines_test_iam_permissions(
2834        &self,
2835        request: TestIamPermissionsRequest,
2836        resource: &str,
2837    ) -> ProjectLocationPipelineTestIamPermissionCall<'a, C> {
2838        ProjectLocationPipelineTestIamPermissionCall {
2839            hub: self.hub,
2840            _request: request,
2841            _resource: resource.to_string(),
2842            _delegate: Default::default(),
2843            _additional_params: Default::default(),
2844            _scopes: Default::default(),
2845        }
2846    }
2847
2848    /// Create a builder to help you perform the following task:
2849    ///
2850    /// Get a single Provider.
2851    ///
2852    /// # Arguments
2853    ///
2854    /// * `name` - Required. The name of the provider to get.
2855    pub fn locations_providers_get(&self, name: &str) -> ProjectLocationProviderGetCall<'a, C> {
2856        ProjectLocationProviderGetCall {
2857            hub: self.hub,
2858            _name: name.to_string(),
2859            _delegate: Default::default(),
2860            _additional_params: Default::default(),
2861            _scopes: Default::default(),
2862        }
2863    }
2864
2865    /// Create a builder to help you perform the following task:
2866    ///
2867    /// List providers.
2868    ///
2869    /// # Arguments
2870    ///
2871    /// * `parent` - Required. The parent of the provider to get.
2872    pub fn locations_providers_list(&self, parent: &str) -> ProjectLocationProviderListCall<'a, C> {
2873        ProjectLocationProviderListCall {
2874            hub: self.hub,
2875            _parent: parent.to_string(),
2876            _page_token: Default::default(),
2877            _page_size: Default::default(),
2878            _order_by: Default::default(),
2879            _filter: Default::default(),
2880            _delegate: Default::default(),
2881            _additional_params: Default::default(),
2882            _scopes: Default::default(),
2883        }
2884    }
2885
2886    /// Create a builder to help you perform the following task:
2887    ///
2888    /// Create a new trigger in a particular project and location.
2889    ///
2890    /// # Arguments
2891    ///
2892    /// * `request` - No description provided.
2893    /// * `parent` - Required. The parent collection in which to add this trigger.
2894    pub fn locations_triggers_create(
2895        &self,
2896        request: Trigger,
2897        parent: &str,
2898    ) -> ProjectLocationTriggerCreateCall<'a, C> {
2899        ProjectLocationTriggerCreateCall {
2900            hub: self.hub,
2901            _request: request,
2902            _parent: parent.to_string(),
2903            _validate_only: Default::default(),
2904            _trigger_id: Default::default(),
2905            _delegate: Default::default(),
2906            _additional_params: Default::default(),
2907            _scopes: Default::default(),
2908        }
2909    }
2910
2911    /// Create a builder to help you perform the following task:
2912    ///
2913    /// Delete a single trigger.
2914    ///
2915    /// # Arguments
2916    ///
2917    /// * `name` - Required. The name of the trigger to be deleted.
2918    pub fn locations_triggers_delete(&self, name: &str) -> ProjectLocationTriggerDeleteCall<'a, C> {
2919        ProjectLocationTriggerDeleteCall {
2920            hub: self.hub,
2921            _name: name.to_string(),
2922            _validate_only: Default::default(),
2923            _etag: Default::default(),
2924            _allow_missing: Default::default(),
2925            _delegate: Default::default(),
2926            _additional_params: Default::default(),
2927            _scopes: Default::default(),
2928        }
2929    }
2930
2931    /// Create a builder to help you perform the following task:
2932    ///
2933    /// Get a single trigger.
2934    ///
2935    /// # Arguments
2936    ///
2937    /// * `name` - Required. The name of the trigger to get.
2938    pub fn locations_triggers_get(&self, name: &str) -> ProjectLocationTriggerGetCall<'a, C> {
2939        ProjectLocationTriggerGetCall {
2940            hub: self.hub,
2941            _name: name.to_string(),
2942            _delegate: Default::default(),
2943            _additional_params: Default::default(),
2944            _scopes: Default::default(),
2945        }
2946    }
2947
2948    /// Create a builder to help you perform the following task:
2949    ///
2950    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2951    ///
2952    /// # Arguments
2953    ///
2954    /// * `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.
2955    pub fn locations_triggers_get_iam_policy(
2956        &self,
2957        resource: &str,
2958    ) -> ProjectLocationTriggerGetIamPolicyCall<'a, C> {
2959        ProjectLocationTriggerGetIamPolicyCall {
2960            hub: self.hub,
2961            _resource: resource.to_string(),
2962            _options_requested_policy_version: Default::default(),
2963            _delegate: Default::default(),
2964            _additional_params: Default::default(),
2965            _scopes: Default::default(),
2966        }
2967    }
2968
2969    /// Create a builder to help you perform the following task:
2970    ///
2971    /// List triggers.
2972    ///
2973    /// # Arguments
2974    ///
2975    /// * `parent` - Required. The parent collection to list triggers on.
2976    pub fn locations_triggers_list(&self, parent: &str) -> ProjectLocationTriggerListCall<'a, C> {
2977        ProjectLocationTriggerListCall {
2978            hub: self.hub,
2979            _parent: parent.to_string(),
2980            _page_token: Default::default(),
2981            _page_size: Default::default(),
2982            _order_by: Default::default(),
2983            _filter: Default::default(),
2984            _delegate: Default::default(),
2985            _additional_params: Default::default(),
2986            _scopes: Default::default(),
2987        }
2988    }
2989
2990    /// Create a builder to help you perform the following task:
2991    ///
2992    /// Update a single trigger.
2993    ///
2994    /// # Arguments
2995    ///
2996    /// * `request` - No description provided.
2997    /// * `name` - Required. The resource name of the trigger. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/triggers/{trigger}` format.
2998    pub fn locations_triggers_patch(
2999        &self,
3000        request: Trigger,
3001        name: &str,
3002    ) -> ProjectLocationTriggerPatchCall<'a, C> {
3003        ProjectLocationTriggerPatchCall {
3004            hub: self.hub,
3005            _request: request,
3006            _name: name.to_string(),
3007            _validate_only: Default::default(),
3008            _update_mask: Default::default(),
3009            _allow_missing: Default::default(),
3010            _delegate: Default::default(),
3011            _additional_params: Default::default(),
3012            _scopes: Default::default(),
3013        }
3014    }
3015
3016    /// Create a builder to help you perform the following task:
3017    ///
3018    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3019    ///
3020    /// # Arguments
3021    ///
3022    /// * `request` - No description provided.
3023    /// * `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.
3024    pub fn locations_triggers_set_iam_policy(
3025        &self,
3026        request: SetIamPolicyRequest,
3027        resource: &str,
3028    ) -> ProjectLocationTriggerSetIamPolicyCall<'a, C> {
3029        ProjectLocationTriggerSetIamPolicyCall {
3030            hub: self.hub,
3031            _request: request,
3032            _resource: resource.to_string(),
3033            _delegate: Default::default(),
3034            _additional_params: Default::default(),
3035            _scopes: Default::default(),
3036        }
3037    }
3038
3039    /// Create a builder to help you perform the following task:
3040    ///
3041    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
3042    ///
3043    /// # Arguments
3044    ///
3045    /// * `request` - No description provided.
3046    /// * `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.
3047    pub fn locations_triggers_test_iam_permissions(
3048        &self,
3049        request: TestIamPermissionsRequest,
3050        resource: &str,
3051    ) -> ProjectLocationTriggerTestIamPermissionCall<'a, C> {
3052        ProjectLocationTriggerTestIamPermissionCall {
3053            hub: self.hub,
3054            _request: request,
3055            _resource: resource.to_string(),
3056            _delegate: Default::default(),
3057            _additional_params: Default::default(),
3058            _scopes: Default::default(),
3059        }
3060    }
3061
3062    /// Create a builder to help you perform the following task:
3063    ///
3064    /// Gets information about a location.
3065    ///
3066    /// # Arguments
3067    ///
3068    /// * `name` - Resource name for the location.
3069    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
3070        ProjectLocationGetCall {
3071            hub: self.hub,
3072            _name: name.to_string(),
3073            _delegate: Default::default(),
3074            _additional_params: Default::default(),
3075            _scopes: Default::default(),
3076        }
3077    }
3078
3079    /// Create a builder to help you perform the following task:
3080    ///
3081    /// Get a GoogleChannelConfig. The name of the GoogleChannelConfig in the response is ALWAYS coded with projectID.
3082    ///
3083    /// # Arguments
3084    ///
3085    /// * `name` - Required. The name of the config to get.
3086    pub fn locations_get_google_channel_config(
3087        &self,
3088        name: &str,
3089    ) -> ProjectLocationGetGoogleChannelConfigCall<'a, C> {
3090        ProjectLocationGetGoogleChannelConfigCall {
3091            hub: self.hub,
3092            _name: name.to_string(),
3093            _delegate: Default::default(),
3094            _additional_params: Default::default(),
3095            _scopes: Default::default(),
3096        }
3097    }
3098
3099    /// Create a builder to help you perform the following task:
3100    ///
3101    /// Lists information about the supported locations for this service.
3102    ///
3103    /// # Arguments
3104    ///
3105    /// * `name` - The resource that owns the locations collection, if applicable.
3106    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
3107        ProjectLocationListCall {
3108            hub: self.hub,
3109            _name: name.to_string(),
3110            _page_token: Default::default(),
3111            _page_size: Default::default(),
3112            _filter: Default::default(),
3113            _extra_location_types: Default::default(),
3114            _delegate: Default::default(),
3115            _additional_params: Default::default(),
3116            _scopes: Default::default(),
3117        }
3118    }
3119
3120    /// Create a builder to help you perform the following task:
3121    ///
3122    /// Update a single GoogleChannelConfig
3123    ///
3124    /// # Arguments
3125    ///
3126    /// * `request` - No description provided.
3127    /// * `name` - Required. The resource name of the config. Must be in the format of, `projects/{project}/locations/{location}/googleChannelConfig`. In API responses, the config name always includes the projectID, regardless of whether the projectID or projectNumber was provided.
3128    pub fn locations_update_google_channel_config(
3129        &self,
3130        request: GoogleChannelConfig,
3131        name: &str,
3132    ) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C> {
3133        ProjectLocationUpdateGoogleChannelConfigCall {
3134            hub: self.hub,
3135            _request: request,
3136            _name: name.to_string(),
3137            _update_mask: Default::default(),
3138            _delegate: Default::default(),
3139            _additional_params: Default::default(),
3140            _scopes: Default::default(),
3141        }
3142    }
3143}
3144
3145// ###################
3146// CallBuilders   ###
3147// #################
3148
3149/// Create a new ChannelConnection in a particular project and location.
3150///
3151/// A builder for the *locations.channelConnections.create* method supported by a *project* resource.
3152/// It is not used directly, but through a [`ProjectMethods`] instance.
3153///
3154/// # Example
3155///
3156/// Instantiate a resource method builder
3157///
3158/// ```test_harness,no_run
3159/// # extern crate hyper;
3160/// # extern crate hyper_rustls;
3161/// # extern crate google_eventarc1 as eventarc1;
3162/// use eventarc1::api::ChannelConnection;
3163/// # async fn dox() {
3164/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3165///
3166/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3167/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3168/// #     .with_native_roots()
3169/// #     .unwrap()
3170/// #     .https_only()
3171/// #     .enable_http2()
3172/// #     .build();
3173///
3174/// # let executor = hyper_util::rt::TokioExecutor::new();
3175/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3176/// #     secret,
3177/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3178/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3179/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3180/// #     ),
3181/// # ).build().await.unwrap();
3182///
3183/// # let client = hyper_util::client::legacy::Client::builder(
3184/// #     hyper_util::rt::TokioExecutor::new()
3185/// # )
3186/// # .build(
3187/// #     hyper_rustls::HttpsConnectorBuilder::new()
3188/// #         .with_native_roots()
3189/// #         .unwrap()
3190/// #         .https_or_http()
3191/// #         .enable_http2()
3192/// #         .build()
3193/// # );
3194/// # let mut hub = Eventarc::new(client, auth);
3195/// // As the method needs a request, you would usually fill it with the desired information
3196/// // into the respective structure. Some of the parts shown here might not be applicable !
3197/// // Values shown here are possibly random and not representative !
3198/// let mut req = ChannelConnection::default();
3199///
3200/// // You can configure optional parameters by calling the respective setters at will, and
3201/// // execute the final call using `doit()`.
3202/// // Values shown here are possibly random and not representative !
3203/// let result = hub.projects().locations_channel_connections_create(req, "parent")
3204///              .channel_connection_id("gubergren")
3205///              .doit().await;
3206/// # }
3207/// ```
3208pub struct ProjectLocationChannelConnectionCreateCall<'a, C>
3209where
3210    C: 'a,
3211{
3212    hub: &'a Eventarc<C>,
3213    _request: ChannelConnection,
3214    _parent: String,
3215    _channel_connection_id: Option<String>,
3216    _delegate: Option<&'a mut dyn common::Delegate>,
3217    _additional_params: HashMap<String, String>,
3218    _scopes: BTreeSet<String>,
3219}
3220
3221impl<'a, C> common::CallBuilder for ProjectLocationChannelConnectionCreateCall<'a, C> {}
3222
3223impl<'a, C> ProjectLocationChannelConnectionCreateCall<'a, C>
3224where
3225    C: common::Connector,
3226{
3227    /// Perform the operation you have build so far.
3228    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
3229        use std::borrow::Cow;
3230        use std::io::{Read, Seek};
3231
3232        use common::{url::Params, ToParts};
3233        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3234
3235        let mut dd = common::DefaultDelegate;
3236        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3237        dlg.begin(common::MethodInfo {
3238            id: "eventarc.projects.locations.channelConnections.create",
3239            http_method: hyper::Method::POST,
3240        });
3241
3242        for &field in ["alt", "parent", "channelConnectionId"].iter() {
3243            if self._additional_params.contains_key(field) {
3244                dlg.finished(false);
3245                return Err(common::Error::FieldClash(field));
3246            }
3247        }
3248
3249        let mut params = Params::with_capacity(5 + self._additional_params.len());
3250        params.push("parent", self._parent);
3251        if let Some(value) = self._channel_connection_id.as_ref() {
3252            params.push("channelConnectionId", value);
3253        }
3254
3255        params.extend(self._additional_params.iter());
3256
3257        params.push("alt", "json");
3258        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channelConnections";
3259        if self._scopes.is_empty() {
3260            self._scopes
3261                .insert(Scope::CloudPlatform.as_ref().to_string());
3262        }
3263
3264        #[allow(clippy::single_element_loop)]
3265        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3266            url = params.uri_replacement(url, param_name, find_this, true);
3267        }
3268        {
3269            let to_remove = ["parent"];
3270            params.remove_params(&to_remove);
3271        }
3272
3273        let url = params.parse_with_url(&url);
3274
3275        let mut json_mime_type = mime::APPLICATION_JSON;
3276        let mut request_value_reader = {
3277            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3278            common::remove_json_null_values(&mut value);
3279            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3280            serde_json::to_writer(&mut dst, &value).unwrap();
3281            dst
3282        };
3283        let request_size = request_value_reader
3284            .seek(std::io::SeekFrom::End(0))
3285            .unwrap();
3286        request_value_reader
3287            .seek(std::io::SeekFrom::Start(0))
3288            .unwrap();
3289
3290        loop {
3291            let token = match self
3292                .hub
3293                .auth
3294                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3295                .await
3296            {
3297                Ok(token) => token,
3298                Err(e) => match dlg.token(e) {
3299                    Ok(token) => token,
3300                    Err(e) => {
3301                        dlg.finished(false);
3302                        return Err(common::Error::MissingToken(e));
3303                    }
3304                },
3305            };
3306            request_value_reader
3307                .seek(std::io::SeekFrom::Start(0))
3308                .unwrap();
3309            let mut req_result = {
3310                let client = &self.hub.client;
3311                dlg.pre_request();
3312                let mut req_builder = hyper::Request::builder()
3313                    .method(hyper::Method::POST)
3314                    .uri(url.as_str())
3315                    .header(USER_AGENT, self.hub._user_agent.clone());
3316
3317                if let Some(token) = token.as_ref() {
3318                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3319                }
3320
3321                let request = req_builder
3322                    .header(CONTENT_TYPE, json_mime_type.to_string())
3323                    .header(CONTENT_LENGTH, request_size as u64)
3324                    .body(common::to_body(
3325                        request_value_reader.get_ref().clone().into(),
3326                    ));
3327
3328                client.request(request.unwrap()).await
3329            };
3330
3331            match req_result {
3332                Err(err) => {
3333                    if let common::Retry::After(d) = dlg.http_error(&err) {
3334                        sleep(d).await;
3335                        continue;
3336                    }
3337                    dlg.finished(false);
3338                    return Err(common::Error::HttpError(err));
3339                }
3340                Ok(res) => {
3341                    let (mut parts, body) = res.into_parts();
3342                    let mut body = common::Body::new(body);
3343                    if !parts.status.is_success() {
3344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3345                        let error = serde_json::from_str(&common::to_string(&bytes));
3346                        let response = common::to_response(parts, bytes.into());
3347
3348                        if let common::Retry::After(d) =
3349                            dlg.http_failure(&response, error.as_ref().ok())
3350                        {
3351                            sleep(d).await;
3352                            continue;
3353                        }
3354
3355                        dlg.finished(false);
3356
3357                        return Err(match error {
3358                            Ok(value) => common::Error::BadRequest(value),
3359                            _ => common::Error::Failure(response),
3360                        });
3361                    }
3362                    let response = {
3363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3364                        let encoded = common::to_string(&bytes);
3365                        match serde_json::from_str(&encoded) {
3366                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3367                            Err(error) => {
3368                                dlg.response_json_decode_error(&encoded, &error);
3369                                return Err(common::Error::JsonDecodeError(
3370                                    encoded.to_string(),
3371                                    error,
3372                                ));
3373                            }
3374                        }
3375                    };
3376
3377                    dlg.finished(true);
3378                    return Ok(response);
3379                }
3380            }
3381        }
3382    }
3383
3384    ///
3385    /// Sets the *request* property to the given value.
3386    ///
3387    /// Even though the property as already been set when instantiating this call,
3388    /// we provide this method for API completeness.
3389    pub fn request(
3390        mut self,
3391        new_value: ChannelConnection,
3392    ) -> ProjectLocationChannelConnectionCreateCall<'a, C> {
3393        self._request = new_value;
3394        self
3395    }
3396    /// Required. The parent collection in which to add this channel connection.
3397    ///
3398    /// Sets the *parent* path property to the given value.
3399    ///
3400    /// Even though the property as already been set when instantiating this call,
3401    /// we provide this method for API completeness.
3402    pub fn parent(mut self, new_value: &str) -> ProjectLocationChannelConnectionCreateCall<'a, C> {
3403        self._parent = new_value.to_string();
3404        self
3405    }
3406    /// Required. The user-provided ID to be assigned to the channel connection.
3407    ///
3408    /// Sets the *channel connection id* query property to the given value.
3409    pub fn channel_connection_id(
3410        mut self,
3411        new_value: &str,
3412    ) -> ProjectLocationChannelConnectionCreateCall<'a, C> {
3413        self._channel_connection_id = Some(new_value.to_string());
3414        self
3415    }
3416    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3417    /// while executing the actual API request.
3418    ///
3419    /// ````text
3420    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3421    /// ````
3422    ///
3423    /// Sets the *delegate* property to the given value.
3424    pub fn delegate(
3425        mut self,
3426        new_value: &'a mut dyn common::Delegate,
3427    ) -> ProjectLocationChannelConnectionCreateCall<'a, C> {
3428        self._delegate = Some(new_value);
3429        self
3430    }
3431
3432    /// Set any additional parameter of the query string used in the request.
3433    /// It should be used to set parameters which are not yet available through their own
3434    /// setters.
3435    ///
3436    /// Please note that this method must not be used to set any of the known parameters
3437    /// which have their own setter method. If done anyway, the request will fail.
3438    ///
3439    /// # Additional Parameters
3440    ///
3441    /// * *$.xgafv* (query-string) - V1 error format.
3442    /// * *access_token* (query-string) - OAuth access token.
3443    /// * *alt* (query-string) - Data format for response.
3444    /// * *callback* (query-string) - JSONP
3445    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3446    /// * *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.
3447    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3448    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3449    /// * *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.
3450    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3451    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3452    pub fn param<T>(
3453        mut self,
3454        name: T,
3455        value: T,
3456    ) -> ProjectLocationChannelConnectionCreateCall<'a, C>
3457    where
3458        T: AsRef<str>,
3459    {
3460        self._additional_params
3461            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3462        self
3463    }
3464
3465    /// Identifies the authorization scope for the method you are building.
3466    ///
3467    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3468    /// [`Scope::CloudPlatform`].
3469    ///
3470    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3471    /// tokens for more than one scope.
3472    ///
3473    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3474    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3475    /// sufficient, a read-write scope will do as well.
3476    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelConnectionCreateCall<'a, C>
3477    where
3478        St: AsRef<str>,
3479    {
3480        self._scopes.insert(String::from(scope.as_ref()));
3481        self
3482    }
3483    /// Identifies the authorization scope(s) for the method you are building.
3484    ///
3485    /// See [`Self::add_scope()`] for details.
3486    pub fn add_scopes<I, St>(
3487        mut self,
3488        scopes: I,
3489    ) -> ProjectLocationChannelConnectionCreateCall<'a, C>
3490    where
3491        I: IntoIterator<Item = St>,
3492        St: AsRef<str>,
3493    {
3494        self._scopes
3495            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3496        self
3497    }
3498
3499    /// Removes all scopes, and no default scope will be used either.
3500    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3501    /// for details).
3502    pub fn clear_scopes(mut self) -> ProjectLocationChannelConnectionCreateCall<'a, C> {
3503        self._scopes.clear();
3504        self
3505    }
3506}
3507
3508/// Delete a single ChannelConnection.
3509///
3510/// A builder for the *locations.channelConnections.delete* method supported by a *project* resource.
3511/// It is not used directly, but through a [`ProjectMethods`] instance.
3512///
3513/// # Example
3514///
3515/// Instantiate a resource method builder
3516///
3517/// ```test_harness,no_run
3518/// # extern crate hyper;
3519/// # extern crate hyper_rustls;
3520/// # extern crate google_eventarc1 as eventarc1;
3521/// # async fn dox() {
3522/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3523///
3524/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3525/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3526/// #     .with_native_roots()
3527/// #     .unwrap()
3528/// #     .https_only()
3529/// #     .enable_http2()
3530/// #     .build();
3531///
3532/// # let executor = hyper_util::rt::TokioExecutor::new();
3533/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3534/// #     secret,
3535/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3536/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3537/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3538/// #     ),
3539/// # ).build().await.unwrap();
3540///
3541/// # let client = hyper_util::client::legacy::Client::builder(
3542/// #     hyper_util::rt::TokioExecutor::new()
3543/// # )
3544/// # .build(
3545/// #     hyper_rustls::HttpsConnectorBuilder::new()
3546/// #         .with_native_roots()
3547/// #         .unwrap()
3548/// #         .https_or_http()
3549/// #         .enable_http2()
3550/// #         .build()
3551/// # );
3552/// # let mut hub = Eventarc::new(client, auth);
3553/// // You can configure optional parameters by calling the respective setters at will, and
3554/// // execute the final call using `doit()`.
3555/// // Values shown here are possibly random and not representative !
3556/// let result = hub.projects().locations_channel_connections_delete("name")
3557///              .doit().await;
3558/// # }
3559/// ```
3560pub struct ProjectLocationChannelConnectionDeleteCall<'a, C>
3561where
3562    C: 'a,
3563{
3564    hub: &'a Eventarc<C>,
3565    _name: String,
3566    _delegate: Option<&'a mut dyn common::Delegate>,
3567    _additional_params: HashMap<String, String>,
3568    _scopes: BTreeSet<String>,
3569}
3570
3571impl<'a, C> common::CallBuilder for ProjectLocationChannelConnectionDeleteCall<'a, C> {}
3572
3573impl<'a, C> ProjectLocationChannelConnectionDeleteCall<'a, C>
3574where
3575    C: common::Connector,
3576{
3577    /// Perform the operation you have build so far.
3578    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
3579        use std::borrow::Cow;
3580        use std::io::{Read, Seek};
3581
3582        use common::{url::Params, ToParts};
3583        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3584
3585        let mut dd = common::DefaultDelegate;
3586        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3587        dlg.begin(common::MethodInfo {
3588            id: "eventarc.projects.locations.channelConnections.delete",
3589            http_method: hyper::Method::DELETE,
3590        });
3591
3592        for &field in ["alt", "name"].iter() {
3593            if self._additional_params.contains_key(field) {
3594                dlg.finished(false);
3595                return Err(common::Error::FieldClash(field));
3596            }
3597        }
3598
3599        let mut params = Params::with_capacity(3 + self._additional_params.len());
3600        params.push("name", self._name);
3601
3602        params.extend(self._additional_params.iter());
3603
3604        params.push("alt", "json");
3605        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3606        if self._scopes.is_empty() {
3607            self._scopes
3608                .insert(Scope::CloudPlatform.as_ref().to_string());
3609        }
3610
3611        #[allow(clippy::single_element_loop)]
3612        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3613            url = params.uri_replacement(url, param_name, find_this, true);
3614        }
3615        {
3616            let to_remove = ["name"];
3617            params.remove_params(&to_remove);
3618        }
3619
3620        let url = params.parse_with_url(&url);
3621
3622        loop {
3623            let token = match self
3624                .hub
3625                .auth
3626                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3627                .await
3628            {
3629                Ok(token) => token,
3630                Err(e) => match dlg.token(e) {
3631                    Ok(token) => token,
3632                    Err(e) => {
3633                        dlg.finished(false);
3634                        return Err(common::Error::MissingToken(e));
3635                    }
3636                },
3637            };
3638            let mut req_result = {
3639                let client = &self.hub.client;
3640                dlg.pre_request();
3641                let mut req_builder = hyper::Request::builder()
3642                    .method(hyper::Method::DELETE)
3643                    .uri(url.as_str())
3644                    .header(USER_AGENT, self.hub._user_agent.clone());
3645
3646                if let Some(token) = token.as_ref() {
3647                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3648                }
3649
3650                let request = req_builder
3651                    .header(CONTENT_LENGTH, 0_u64)
3652                    .body(common::to_body::<String>(None));
3653
3654                client.request(request.unwrap()).await
3655            };
3656
3657            match req_result {
3658                Err(err) => {
3659                    if let common::Retry::After(d) = dlg.http_error(&err) {
3660                        sleep(d).await;
3661                        continue;
3662                    }
3663                    dlg.finished(false);
3664                    return Err(common::Error::HttpError(err));
3665                }
3666                Ok(res) => {
3667                    let (mut parts, body) = res.into_parts();
3668                    let mut body = common::Body::new(body);
3669                    if !parts.status.is_success() {
3670                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3671                        let error = serde_json::from_str(&common::to_string(&bytes));
3672                        let response = common::to_response(parts, bytes.into());
3673
3674                        if let common::Retry::After(d) =
3675                            dlg.http_failure(&response, error.as_ref().ok())
3676                        {
3677                            sleep(d).await;
3678                            continue;
3679                        }
3680
3681                        dlg.finished(false);
3682
3683                        return Err(match error {
3684                            Ok(value) => common::Error::BadRequest(value),
3685                            _ => common::Error::Failure(response),
3686                        });
3687                    }
3688                    let response = {
3689                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3690                        let encoded = common::to_string(&bytes);
3691                        match serde_json::from_str(&encoded) {
3692                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3693                            Err(error) => {
3694                                dlg.response_json_decode_error(&encoded, &error);
3695                                return Err(common::Error::JsonDecodeError(
3696                                    encoded.to_string(),
3697                                    error,
3698                                ));
3699                            }
3700                        }
3701                    };
3702
3703                    dlg.finished(true);
3704                    return Ok(response);
3705                }
3706            }
3707        }
3708    }
3709
3710    /// Required. The name of the channel connection to delete.
3711    ///
3712    /// Sets the *name* path property to the given value.
3713    ///
3714    /// Even though the property as already been set when instantiating this call,
3715    /// we provide this method for API completeness.
3716    pub fn name(mut self, new_value: &str) -> ProjectLocationChannelConnectionDeleteCall<'a, C> {
3717        self._name = new_value.to_string();
3718        self
3719    }
3720    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3721    /// while executing the actual API request.
3722    ///
3723    /// ````text
3724    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3725    /// ````
3726    ///
3727    /// Sets the *delegate* property to the given value.
3728    pub fn delegate(
3729        mut self,
3730        new_value: &'a mut dyn common::Delegate,
3731    ) -> ProjectLocationChannelConnectionDeleteCall<'a, C> {
3732        self._delegate = Some(new_value);
3733        self
3734    }
3735
3736    /// Set any additional parameter of the query string used in the request.
3737    /// It should be used to set parameters which are not yet available through their own
3738    /// setters.
3739    ///
3740    /// Please note that this method must not be used to set any of the known parameters
3741    /// which have their own setter method. If done anyway, the request will fail.
3742    ///
3743    /// # Additional Parameters
3744    ///
3745    /// * *$.xgafv* (query-string) - V1 error format.
3746    /// * *access_token* (query-string) - OAuth access token.
3747    /// * *alt* (query-string) - Data format for response.
3748    /// * *callback* (query-string) - JSONP
3749    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3750    /// * *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.
3751    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3752    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3753    /// * *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.
3754    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3755    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3756    pub fn param<T>(
3757        mut self,
3758        name: T,
3759        value: T,
3760    ) -> ProjectLocationChannelConnectionDeleteCall<'a, C>
3761    where
3762        T: AsRef<str>,
3763    {
3764        self._additional_params
3765            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3766        self
3767    }
3768
3769    /// Identifies the authorization scope for the method you are building.
3770    ///
3771    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3772    /// [`Scope::CloudPlatform`].
3773    ///
3774    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3775    /// tokens for more than one scope.
3776    ///
3777    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3778    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3779    /// sufficient, a read-write scope will do as well.
3780    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelConnectionDeleteCall<'a, C>
3781    where
3782        St: AsRef<str>,
3783    {
3784        self._scopes.insert(String::from(scope.as_ref()));
3785        self
3786    }
3787    /// Identifies the authorization scope(s) for the method you are building.
3788    ///
3789    /// See [`Self::add_scope()`] for details.
3790    pub fn add_scopes<I, St>(
3791        mut self,
3792        scopes: I,
3793    ) -> ProjectLocationChannelConnectionDeleteCall<'a, C>
3794    where
3795        I: IntoIterator<Item = St>,
3796        St: AsRef<str>,
3797    {
3798        self._scopes
3799            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3800        self
3801    }
3802
3803    /// Removes all scopes, and no default scope will be used either.
3804    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3805    /// for details).
3806    pub fn clear_scopes(mut self) -> ProjectLocationChannelConnectionDeleteCall<'a, C> {
3807        self._scopes.clear();
3808        self
3809    }
3810}
3811
3812/// Get a single ChannelConnection.
3813///
3814/// A builder for the *locations.channelConnections.get* method supported by a *project* resource.
3815/// It is not used directly, but through a [`ProjectMethods`] instance.
3816///
3817/// # Example
3818///
3819/// Instantiate a resource method builder
3820///
3821/// ```test_harness,no_run
3822/// # extern crate hyper;
3823/// # extern crate hyper_rustls;
3824/// # extern crate google_eventarc1 as eventarc1;
3825/// # async fn dox() {
3826/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3827///
3828/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3829/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3830/// #     .with_native_roots()
3831/// #     .unwrap()
3832/// #     .https_only()
3833/// #     .enable_http2()
3834/// #     .build();
3835///
3836/// # let executor = hyper_util::rt::TokioExecutor::new();
3837/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3838/// #     secret,
3839/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3840/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3841/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3842/// #     ),
3843/// # ).build().await.unwrap();
3844///
3845/// # let client = hyper_util::client::legacy::Client::builder(
3846/// #     hyper_util::rt::TokioExecutor::new()
3847/// # )
3848/// # .build(
3849/// #     hyper_rustls::HttpsConnectorBuilder::new()
3850/// #         .with_native_roots()
3851/// #         .unwrap()
3852/// #         .https_or_http()
3853/// #         .enable_http2()
3854/// #         .build()
3855/// # );
3856/// # let mut hub = Eventarc::new(client, auth);
3857/// // You can configure optional parameters by calling the respective setters at will, and
3858/// // execute the final call using `doit()`.
3859/// // Values shown here are possibly random and not representative !
3860/// let result = hub.projects().locations_channel_connections_get("name")
3861///              .doit().await;
3862/// # }
3863/// ```
3864pub struct ProjectLocationChannelConnectionGetCall<'a, C>
3865where
3866    C: 'a,
3867{
3868    hub: &'a Eventarc<C>,
3869    _name: String,
3870    _delegate: Option<&'a mut dyn common::Delegate>,
3871    _additional_params: HashMap<String, String>,
3872    _scopes: BTreeSet<String>,
3873}
3874
3875impl<'a, C> common::CallBuilder for ProjectLocationChannelConnectionGetCall<'a, C> {}
3876
3877impl<'a, C> ProjectLocationChannelConnectionGetCall<'a, C>
3878where
3879    C: common::Connector,
3880{
3881    /// Perform the operation you have build so far.
3882    pub async fn doit(mut self) -> common::Result<(common::Response, ChannelConnection)> {
3883        use std::borrow::Cow;
3884        use std::io::{Read, Seek};
3885
3886        use common::{url::Params, ToParts};
3887        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3888
3889        let mut dd = common::DefaultDelegate;
3890        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3891        dlg.begin(common::MethodInfo {
3892            id: "eventarc.projects.locations.channelConnections.get",
3893            http_method: hyper::Method::GET,
3894        });
3895
3896        for &field in ["alt", "name"].iter() {
3897            if self._additional_params.contains_key(field) {
3898                dlg.finished(false);
3899                return Err(common::Error::FieldClash(field));
3900            }
3901        }
3902
3903        let mut params = Params::with_capacity(3 + self._additional_params.len());
3904        params.push("name", self._name);
3905
3906        params.extend(self._additional_params.iter());
3907
3908        params.push("alt", "json");
3909        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3910        if self._scopes.is_empty() {
3911            self._scopes
3912                .insert(Scope::CloudPlatform.as_ref().to_string());
3913        }
3914
3915        #[allow(clippy::single_element_loop)]
3916        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3917            url = params.uri_replacement(url, param_name, find_this, true);
3918        }
3919        {
3920            let to_remove = ["name"];
3921            params.remove_params(&to_remove);
3922        }
3923
3924        let url = params.parse_with_url(&url);
3925
3926        loop {
3927            let token = match self
3928                .hub
3929                .auth
3930                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3931                .await
3932            {
3933                Ok(token) => token,
3934                Err(e) => match dlg.token(e) {
3935                    Ok(token) => token,
3936                    Err(e) => {
3937                        dlg.finished(false);
3938                        return Err(common::Error::MissingToken(e));
3939                    }
3940                },
3941            };
3942            let mut req_result = {
3943                let client = &self.hub.client;
3944                dlg.pre_request();
3945                let mut req_builder = hyper::Request::builder()
3946                    .method(hyper::Method::GET)
3947                    .uri(url.as_str())
3948                    .header(USER_AGENT, self.hub._user_agent.clone());
3949
3950                if let Some(token) = token.as_ref() {
3951                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3952                }
3953
3954                let request = req_builder
3955                    .header(CONTENT_LENGTH, 0_u64)
3956                    .body(common::to_body::<String>(None));
3957
3958                client.request(request.unwrap()).await
3959            };
3960
3961            match req_result {
3962                Err(err) => {
3963                    if let common::Retry::After(d) = dlg.http_error(&err) {
3964                        sleep(d).await;
3965                        continue;
3966                    }
3967                    dlg.finished(false);
3968                    return Err(common::Error::HttpError(err));
3969                }
3970                Ok(res) => {
3971                    let (mut parts, body) = res.into_parts();
3972                    let mut body = common::Body::new(body);
3973                    if !parts.status.is_success() {
3974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3975                        let error = serde_json::from_str(&common::to_string(&bytes));
3976                        let response = common::to_response(parts, bytes.into());
3977
3978                        if let common::Retry::After(d) =
3979                            dlg.http_failure(&response, error.as_ref().ok())
3980                        {
3981                            sleep(d).await;
3982                            continue;
3983                        }
3984
3985                        dlg.finished(false);
3986
3987                        return Err(match error {
3988                            Ok(value) => common::Error::BadRequest(value),
3989                            _ => common::Error::Failure(response),
3990                        });
3991                    }
3992                    let response = {
3993                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3994                        let encoded = common::to_string(&bytes);
3995                        match serde_json::from_str(&encoded) {
3996                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3997                            Err(error) => {
3998                                dlg.response_json_decode_error(&encoded, &error);
3999                                return Err(common::Error::JsonDecodeError(
4000                                    encoded.to_string(),
4001                                    error,
4002                                ));
4003                            }
4004                        }
4005                    };
4006
4007                    dlg.finished(true);
4008                    return Ok(response);
4009                }
4010            }
4011        }
4012    }
4013
4014    /// Required. The name of the channel connection to get.
4015    ///
4016    /// Sets the *name* path property to the given value.
4017    ///
4018    /// Even though the property as already been set when instantiating this call,
4019    /// we provide this method for API completeness.
4020    pub fn name(mut self, new_value: &str) -> ProjectLocationChannelConnectionGetCall<'a, C> {
4021        self._name = new_value.to_string();
4022        self
4023    }
4024    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4025    /// while executing the actual API request.
4026    ///
4027    /// ````text
4028    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4029    /// ````
4030    ///
4031    /// Sets the *delegate* property to the given value.
4032    pub fn delegate(
4033        mut self,
4034        new_value: &'a mut dyn common::Delegate,
4035    ) -> ProjectLocationChannelConnectionGetCall<'a, C> {
4036        self._delegate = Some(new_value);
4037        self
4038    }
4039
4040    /// Set any additional parameter of the query string used in the request.
4041    /// It should be used to set parameters which are not yet available through their own
4042    /// setters.
4043    ///
4044    /// Please note that this method must not be used to set any of the known parameters
4045    /// which have their own setter method. If done anyway, the request will fail.
4046    ///
4047    /// # Additional Parameters
4048    ///
4049    /// * *$.xgafv* (query-string) - V1 error format.
4050    /// * *access_token* (query-string) - OAuth access token.
4051    /// * *alt* (query-string) - Data format for response.
4052    /// * *callback* (query-string) - JSONP
4053    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4054    /// * *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.
4055    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4056    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4057    /// * *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.
4058    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4059    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4060    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelConnectionGetCall<'a, C>
4061    where
4062        T: AsRef<str>,
4063    {
4064        self._additional_params
4065            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4066        self
4067    }
4068
4069    /// Identifies the authorization scope for the method you are building.
4070    ///
4071    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4072    /// [`Scope::CloudPlatform`].
4073    ///
4074    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4075    /// tokens for more than one scope.
4076    ///
4077    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4078    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4079    /// sufficient, a read-write scope will do as well.
4080    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelConnectionGetCall<'a, C>
4081    where
4082        St: AsRef<str>,
4083    {
4084        self._scopes.insert(String::from(scope.as_ref()));
4085        self
4086    }
4087    /// Identifies the authorization scope(s) for the method you are building.
4088    ///
4089    /// See [`Self::add_scope()`] for details.
4090    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelConnectionGetCall<'a, C>
4091    where
4092        I: IntoIterator<Item = St>,
4093        St: AsRef<str>,
4094    {
4095        self._scopes
4096            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4097        self
4098    }
4099
4100    /// Removes all scopes, and no default scope will be used either.
4101    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4102    /// for details).
4103    pub fn clear_scopes(mut self) -> ProjectLocationChannelConnectionGetCall<'a, C> {
4104        self._scopes.clear();
4105        self
4106    }
4107}
4108
4109/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4110///
4111/// A builder for the *locations.channelConnections.getIamPolicy* method supported by a *project* resource.
4112/// It is not used directly, but through a [`ProjectMethods`] instance.
4113///
4114/// # Example
4115///
4116/// Instantiate a resource method builder
4117///
4118/// ```test_harness,no_run
4119/// # extern crate hyper;
4120/// # extern crate hyper_rustls;
4121/// # extern crate google_eventarc1 as eventarc1;
4122/// # async fn dox() {
4123/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4124///
4125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4126/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4127/// #     .with_native_roots()
4128/// #     .unwrap()
4129/// #     .https_only()
4130/// #     .enable_http2()
4131/// #     .build();
4132///
4133/// # let executor = hyper_util::rt::TokioExecutor::new();
4134/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4135/// #     secret,
4136/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4137/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4138/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4139/// #     ),
4140/// # ).build().await.unwrap();
4141///
4142/// # let client = hyper_util::client::legacy::Client::builder(
4143/// #     hyper_util::rt::TokioExecutor::new()
4144/// # )
4145/// # .build(
4146/// #     hyper_rustls::HttpsConnectorBuilder::new()
4147/// #         .with_native_roots()
4148/// #         .unwrap()
4149/// #         .https_or_http()
4150/// #         .enable_http2()
4151/// #         .build()
4152/// # );
4153/// # let mut hub = Eventarc::new(client, auth);
4154/// // You can configure optional parameters by calling the respective setters at will, and
4155/// // execute the final call using `doit()`.
4156/// // Values shown here are possibly random and not representative !
4157/// let result = hub.projects().locations_channel_connections_get_iam_policy("resource")
4158///              .options_requested_policy_version(-55)
4159///              .doit().await;
4160/// # }
4161/// ```
4162pub struct ProjectLocationChannelConnectionGetIamPolicyCall<'a, C>
4163where
4164    C: 'a,
4165{
4166    hub: &'a Eventarc<C>,
4167    _resource: String,
4168    _options_requested_policy_version: Option<i32>,
4169    _delegate: Option<&'a mut dyn common::Delegate>,
4170    _additional_params: HashMap<String, String>,
4171    _scopes: BTreeSet<String>,
4172}
4173
4174impl<'a, C> common::CallBuilder for ProjectLocationChannelConnectionGetIamPolicyCall<'a, C> {}
4175
4176impl<'a, C> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C>
4177where
4178    C: common::Connector,
4179{
4180    /// Perform the operation you have build so far.
4181    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4182        use std::borrow::Cow;
4183        use std::io::{Read, Seek};
4184
4185        use common::{url::Params, ToParts};
4186        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4187
4188        let mut dd = common::DefaultDelegate;
4189        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4190        dlg.begin(common::MethodInfo {
4191            id: "eventarc.projects.locations.channelConnections.getIamPolicy",
4192            http_method: hyper::Method::GET,
4193        });
4194
4195        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
4196            if self._additional_params.contains_key(field) {
4197                dlg.finished(false);
4198                return Err(common::Error::FieldClash(field));
4199            }
4200        }
4201
4202        let mut params = Params::with_capacity(4 + self._additional_params.len());
4203        params.push("resource", self._resource);
4204        if let Some(value) = self._options_requested_policy_version.as_ref() {
4205            params.push("options.requestedPolicyVersion", value.to_string());
4206        }
4207
4208        params.extend(self._additional_params.iter());
4209
4210        params.push("alt", "json");
4211        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
4212        if self._scopes.is_empty() {
4213            self._scopes
4214                .insert(Scope::CloudPlatform.as_ref().to_string());
4215        }
4216
4217        #[allow(clippy::single_element_loop)]
4218        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4219            url = params.uri_replacement(url, param_name, find_this, true);
4220        }
4221        {
4222            let to_remove = ["resource"];
4223            params.remove_params(&to_remove);
4224        }
4225
4226        let url = params.parse_with_url(&url);
4227
4228        loop {
4229            let token = match self
4230                .hub
4231                .auth
4232                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4233                .await
4234            {
4235                Ok(token) => token,
4236                Err(e) => match dlg.token(e) {
4237                    Ok(token) => token,
4238                    Err(e) => {
4239                        dlg.finished(false);
4240                        return Err(common::Error::MissingToken(e));
4241                    }
4242                },
4243            };
4244            let mut req_result = {
4245                let client = &self.hub.client;
4246                dlg.pre_request();
4247                let mut req_builder = hyper::Request::builder()
4248                    .method(hyper::Method::GET)
4249                    .uri(url.as_str())
4250                    .header(USER_AGENT, self.hub._user_agent.clone());
4251
4252                if let Some(token) = token.as_ref() {
4253                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4254                }
4255
4256                let request = req_builder
4257                    .header(CONTENT_LENGTH, 0_u64)
4258                    .body(common::to_body::<String>(None));
4259
4260                client.request(request.unwrap()).await
4261            };
4262
4263            match req_result {
4264                Err(err) => {
4265                    if let common::Retry::After(d) = dlg.http_error(&err) {
4266                        sleep(d).await;
4267                        continue;
4268                    }
4269                    dlg.finished(false);
4270                    return Err(common::Error::HttpError(err));
4271                }
4272                Ok(res) => {
4273                    let (mut parts, body) = res.into_parts();
4274                    let mut body = common::Body::new(body);
4275                    if !parts.status.is_success() {
4276                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4277                        let error = serde_json::from_str(&common::to_string(&bytes));
4278                        let response = common::to_response(parts, bytes.into());
4279
4280                        if let common::Retry::After(d) =
4281                            dlg.http_failure(&response, error.as_ref().ok())
4282                        {
4283                            sleep(d).await;
4284                            continue;
4285                        }
4286
4287                        dlg.finished(false);
4288
4289                        return Err(match error {
4290                            Ok(value) => common::Error::BadRequest(value),
4291                            _ => common::Error::Failure(response),
4292                        });
4293                    }
4294                    let response = {
4295                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4296                        let encoded = common::to_string(&bytes);
4297                        match serde_json::from_str(&encoded) {
4298                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4299                            Err(error) => {
4300                                dlg.response_json_decode_error(&encoded, &error);
4301                                return Err(common::Error::JsonDecodeError(
4302                                    encoded.to_string(),
4303                                    error,
4304                                ));
4305                            }
4306                        }
4307                    };
4308
4309                    dlg.finished(true);
4310                    return Ok(response);
4311                }
4312            }
4313        }
4314    }
4315
4316    /// 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.
4317    ///
4318    /// Sets the *resource* path property to the given value.
4319    ///
4320    /// Even though the property as already been set when instantiating this call,
4321    /// we provide this method for API completeness.
4322    pub fn resource(
4323        mut self,
4324        new_value: &str,
4325    ) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C> {
4326        self._resource = new_value.to_string();
4327        self
4328    }
4329    /// 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).
4330    ///
4331    /// Sets the *options.requested policy version* query property to the given value.
4332    pub fn options_requested_policy_version(
4333        mut self,
4334        new_value: i32,
4335    ) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C> {
4336        self._options_requested_policy_version = Some(new_value);
4337        self
4338    }
4339    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4340    /// while executing the actual API request.
4341    ///
4342    /// ````text
4343    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4344    /// ````
4345    ///
4346    /// Sets the *delegate* property to the given value.
4347    pub fn delegate(
4348        mut self,
4349        new_value: &'a mut dyn common::Delegate,
4350    ) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C> {
4351        self._delegate = Some(new_value);
4352        self
4353    }
4354
4355    /// Set any additional parameter of the query string used in the request.
4356    /// It should be used to set parameters which are not yet available through their own
4357    /// setters.
4358    ///
4359    /// Please note that this method must not be used to set any of the known parameters
4360    /// which have their own setter method. If done anyway, the request will fail.
4361    ///
4362    /// # Additional Parameters
4363    ///
4364    /// * *$.xgafv* (query-string) - V1 error format.
4365    /// * *access_token* (query-string) - OAuth access token.
4366    /// * *alt* (query-string) - Data format for response.
4367    /// * *callback* (query-string) - JSONP
4368    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4369    /// * *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.
4370    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4371    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4372    /// * *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.
4373    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4374    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4375    pub fn param<T>(
4376        mut self,
4377        name: T,
4378        value: T,
4379    ) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C>
4380    where
4381        T: AsRef<str>,
4382    {
4383        self._additional_params
4384            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4385        self
4386    }
4387
4388    /// Identifies the authorization scope for the method you are building.
4389    ///
4390    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4391    /// [`Scope::CloudPlatform`].
4392    ///
4393    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4394    /// tokens for more than one scope.
4395    ///
4396    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4397    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4398    /// sufficient, a read-write scope will do as well.
4399    pub fn add_scope<St>(
4400        mut self,
4401        scope: St,
4402    ) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C>
4403    where
4404        St: AsRef<str>,
4405    {
4406        self._scopes.insert(String::from(scope.as_ref()));
4407        self
4408    }
4409    /// Identifies the authorization scope(s) for the method you are building.
4410    ///
4411    /// See [`Self::add_scope()`] for details.
4412    pub fn add_scopes<I, St>(
4413        mut self,
4414        scopes: I,
4415    ) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C>
4416    where
4417        I: IntoIterator<Item = St>,
4418        St: AsRef<str>,
4419    {
4420        self._scopes
4421            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4422        self
4423    }
4424
4425    /// Removes all scopes, and no default scope will be used either.
4426    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4427    /// for details).
4428    pub fn clear_scopes(mut self) -> ProjectLocationChannelConnectionGetIamPolicyCall<'a, C> {
4429        self._scopes.clear();
4430        self
4431    }
4432}
4433
4434/// List channel connections.
4435///
4436/// A builder for the *locations.channelConnections.list* method supported by a *project* resource.
4437/// It is not used directly, but through a [`ProjectMethods`] instance.
4438///
4439/// # Example
4440///
4441/// Instantiate a resource method builder
4442///
4443/// ```test_harness,no_run
4444/// # extern crate hyper;
4445/// # extern crate hyper_rustls;
4446/// # extern crate google_eventarc1 as eventarc1;
4447/// # async fn dox() {
4448/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4449///
4450/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4451/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4452/// #     .with_native_roots()
4453/// #     .unwrap()
4454/// #     .https_only()
4455/// #     .enable_http2()
4456/// #     .build();
4457///
4458/// # let executor = hyper_util::rt::TokioExecutor::new();
4459/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4460/// #     secret,
4461/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4462/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4463/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4464/// #     ),
4465/// # ).build().await.unwrap();
4466///
4467/// # let client = hyper_util::client::legacy::Client::builder(
4468/// #     hyper_util::rt::TokioExecutor::new()
4469/// # )
4470/// # .build(
4471/// #     hyper_rustls::HttpsConnectorBuilder::new()
4472/// #         .with_native_roots()
4473/// #         .unwrap()
4474/// #         .https_or_http()
4475/// #         .enable_http2()
4476/// #         .build()
4477/// # );
4478/// # let mut hub = Eventarc::new(client, auth);
4479/// // You can configure optional parameters by calling the respective setters at will, and
4480/// // execute the final call using `doit()`.
4481/// // Values shown here are possibly random and not representative !
4482/// let result = hub.projects().locations_channel_connections_list("parent")
4483///              .page_token("amet")
4484///              .page_size(-20)
4485///              .doit().await;
4486/// # }
4487/// ```
4488pub struct ProjectLocationChannelConnectionListCall<'a, C>
4489where
4490    C: 'a,
4491{
4492    hub: &'a Eventarc<C>,
4493    _parent: String,
4494    _page_token: Option<String>,
4495    _page_size: Option<i32>,
4496    _delegate: Option<&'a mut dyn common::Delegate>,
4497    _additional_params: HashMap<String, String>,
4498    _scopes: BTreeSet<String>,
4499}
4500
4501impl<'a, C> common::CallBuilder for ProjectLocationChannelConnectionListCall<'a, C> {}
4502
4503impl<'a, C> ProjectLocationChannelConnectionListCall<'a, C>
4504where
4505    C: common::Connector,
4506{
4507    /// Perform the operation you have build so far.
4508    pub async fn doit(
4509        mut self,
4510    ) -> common::Result<(common::Response, ListChannelConnectionsResponse)> {
4511        use std::borrow::Cow;
4512        use std::io::{Read, Seek};
4513
4514        use common::{url::Params, ToParts};
4515        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4516
4517        let mut dd = common::DefaultDelegate;
4518        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4519        dlg.begin(common::MethodInfo {
4520            id: "eventarc.projects.locations.channelConnections.list",
4521            http_method: hyper::Method::GET,
4522        });
4523
4524        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4525            if self._additional_params.contains_key(field) {
4526                dlg.finished(false);
4527                return Err(common::Error::FieldClash(field));
4528            }
4529        }
4530
4531        let mut params = Params::with_capacity(5 + self._additional_params.len());
4532        params.push("parent", self._parent);
4533        if let Some(value) = self._page_token.as_ref() {
4534            params.push("pageToken", value);
4535        }
4536        if let Some(value) = self._page_size.as_ref() {
4537            params.push("pageSize", value.to_string());
4538        }
4539
4540        params.extend(self._additional_params.iter());
4541
4542        params.push("alt", "json");
4543        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channelConnections";
4544        if self._scopes.is_empty() {
4545            self._scopes
4546                .insert(Scope::CloudPlatform.as_ref().to_string());
4547        }
4548
4549        #[allow(clippy::single_element_loop)]
4550        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4551            url = params.uri_replacement(url, param_name, find_this, true);
4552        }
4553        {
4554            let to_remove = ["parent"];
4555            params.remove_params(&to_remove);
4556        }
4557
4558        let url = params.parse_with_url(&url);
4559
4560        loop {
4561            let token = match self
4562                .hub
4563                .auth
4564                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4565                .await
4566            {
4567                Ok(token) => token,
4568                Err(e) => match dlg.token(e) {
4569                    Ok(token) => token,
4570                    Err(e) => {
4571                        dlg.finished(false);
4572                        return Err(common::Error::MissingToken(e));
4573                    }
4574                },
4575            };
4576            let mut req_result = {
4577                let client = &self.hub.client;
4578                dlg.pre_request();
4579                let mut req_builder = hyper::Request::builder()
4580                    .method(hyper::Method::GET)
4581                    .uri(url.as_str())
4582                    .header(USER_AGENT, self.hub._user_agent.clone());
4583
4584                if let Some(token) = token.as_ref() {
4585                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4586                }
4587
4588                let request = req_builder
4589                    .header(CONTENT_LENGTH, 0_u64)
4590                    .body(common::to_body::<String>(None));
4591
4592                client.request(request.unwrap()).await
4593            };
4594
4595            match req_result {
4596                Err(err) => {
4597                    if let common::Retry::After(d) = dlg.http_error(&err) {
4598                        sleep(d).await;
4599                        continue;
4600                    }
4601                    dlg.finished(false);
4602                    return Err(common::Error::HttpError(err));
4603                }
4604                Ok(res) => {
4605                    let (mut parts, body) = res.into_parts();
4606                    let mut body = common::Body::new(body);
4607                    if !parts.status.is_success() {
4608                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4609                        let error = serde_json::from_str(&common::to_string(&bytes));
4610                        let response = common::to_response(parts, bytes.into());
4611
4612                        if let common::Retry::After(d) =
4613                            dlg.http_failure(&response, error.as_ref().ok())
4614                        {
4615                            sleep(d).await;
4616                            continue;
4617                        }
4618
4619                        dlg.finished(false);
4620
4621                        return Err(match error {
4622                            Ok(value) => common::Error::BadRequest(value),
4623                            _ => common::Error::Failure(response),
4624                        });
4625                    }
4626                    let response = {
4627                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4628                        let encoded = common::to_string(&bytes);
4629                        match serde_json::from_str(&encoded) {
4630                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4631                            Err(error) => {
4632                                dlg.response_json_decode_error(&encoded, &error);
4633                                return Err(common::Error::JsonDecodeError(
4634                                    encoded.to_string(),
4635                                    error,
4636                                ));
4637                            }
4638                        }
4639                    };
4640
4641                    dlg.finished(true);
4642                    return Ok(response);
4643                }
4644            }
4645        }
4646    }
4647
4648    /// Required. The parent collection from which to list channel connections.
4649    ///
4650    /// Sets the *parent* path property to the given value.
4651    ///
4652    /// Even though the property as already been set when instantiating this call,
4653    /// we provide this method for API completeness.
4654    pub fn parent(mut self, new_value: &str) -> ProjectLocationChannelConnectionListCall<'a, C> {
4655        self._parent = new_value.to_string();
4656        self
4657    }
4658    /// The page token; provide the value from the `next_page_token` field in a previous `ListChannelConnections` call to retrieve the subsequent page. When paginating, all other parameters provided to `ListChannelConnetions` match the call that provided the page token.
4659    ///
4660    /// Sets the *page token* query property to the given value.
4661    pub fn page_token(
4662        mut self,
4663        new_value: &str,
4664    ) -> ProjectLocationChannelConnectionListCall<'a, C> {
4665        self._page_token = Some(new_value.to_string());
4666        self
4667    }
4668    /// The maximum number of channel connections to return on each page. Note: The service may send fewer responses.
4669    ///
4670    /// Sets the *page size* query property to the given value.
4671    pub fn page_size(mut self, new_value: i32) -> ProjectLocationChannelConnectionListCall<'a, C> {
4672        self._page_size = Some(new_value);
4673        self
4674    }
4675    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4676    /// while executing the actual API request.
4677    ///
4678    /// ````text
4679    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4680    /// ````
4681    ///
4682    /// Sets the *delegate* property to the given value.
4683    pub fn delegate(
4684        mut self,
4685        new_value: &'a mut dyn common::Delegate,
4686    ) -> ProjectLocationChannelConnectionListCall<'a, C> {
4687        self._delegate = Some(new_value);
4688        self
4689    }
4690
4691    /// Set any additional parameter of the query string used in the request.
4692    /// It should be used to set parameters which are not yet available through their own
4693    /// setters.
4694    ///
4695    /// Please note that this method must not be used to set any of the known parameters
4696    /// which have their own setter method. If done anyway, the request will fail.
4697    ///
4698    /// # Additional Parameters
4699    ///
4700    /// * *$.xgafv* (query-string) - V1 error format.
4701    /// * *access_token* (query-string) - OAuth access token.
4702    /// * *alt* (query-string) - Data format for response.
4703    /// * *callback* (query-string) - JSONP
4704    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4705    /// * *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.
4706    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4707    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4708    /// * *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.
4709    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4710    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4711    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelConnectionListCall<'a, C>
4712    where
4713        T: AsRef<str>,
4714    {
4715        self._additional_params
4716            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4717        self
4718    }
4719
4720    /// Identifies the authorization scope for the method you are building.
4721    ///
4722    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4723    /// [`Scope::CloudPlatform`].
4724    ///
4725    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4726    /// tokens for more than one scope.
4727    ///
4728    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4729    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4730    /// sufficient, a read-write scope will do as well.
4731    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelConnectionListCall<'a, C>
4732    where
4733        St: AsRef<str>,
4734    {
4735        self._scopes.insert(String::from(scope.as_ref()));
4736        self
4737    }
4738    /// Identifies the authorization scope(s) for the method you are building.
4739    ///
4740    /// See [`Self::add_scope()`] for details.
4741    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelConnectionListCall<'a, C>
4742    where
4743        I: IntoIterator<Item = St>,
4744        St: AsRef<str>,
4745    {
4746        self._scopes
4747            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4748        self
4749    }
4750
4751    /// Removes all scopes, and no default scope will be used either.
4752    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4753    /// for details).
4754    pub fn clear_scopes(mut self) -> ProjectLocationChannelConnectionListCall<'a, C> {
4755        self._scopes.clear();
4756        self
4757    }
4758}
4759
4760/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4761///
4762/// A builder for the *locations.channelConnections.setIamPolicy* method supported by a *project* resource.
4763/// It is not used directly, but through a [`ProjectMethods`] instance.
4764///
4765/// # Example
4766///
4767/// Instantiate a resource method builder
4768///
4769/// ```test_harness,no_run
4770/// # extern crate hyper;
4771/// # extern crate hyper_rustls;
4772/// # extern crate google_eventarc1 as eventarc1;
4773/// use eventarc1::api::SetIamPolicyRequest;
4774/// # async fn dox() {
4775/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4776///
4777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4778/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4779/// #     .with_native_roots()
4780/// #     .unwrap()
4781/// #     .https_only()
4782/// #     .enable_http2()
4783/// #     .build();
4784///
4785/// # let executor = hyper_util::rt::TokioExecutor::new();
4786/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4787/// #     secret,
4788/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4789/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4790/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4791/// #     ),
4792/// # ).build().await.unwrap();
4793///
4794/// # let client = hyper_util::client::legacy::Client::builder(
4795/// #     hyper_util::rt::TokioExecutor::new()
4796/// # )
4797/// # .build(
4798/// #     hyper_rustls::HttpsConnectorBuilder::new()
4799/// #         .with_native_roots()
4800/// #         .unwrap()
4801/// #         .https_or_http()
4802/// #         .enable_http2()
4803/// #         .build()
4804/// # );
4805/// # let mut hub = Eventarc::new(client, auth);
4806/// // As the method needs a request, you would usually fill it with the desired information
4807/// // into the respective structure. Some of the parts shown here might not be applicable !
4808/// // Values shown here are possibly random and not representative !
4809/// let mut req = SetIamPolicyRequest::default();
4810///
4811/// // You can configure optional parameters by calling the respective setters at will, and
4812/// // execute the final call using `doit()`.
4813/// // Values shown here are possibly random and not representative !
4814/// let result = hub.projects().locations_channel_connections_set_iam_policy(req, "resource")
4815///              .doit().await;
4816/// # }
4817/// ```
4818pub struct ProjectLocationChannelConnectionSetIamPolicyCall<'a, C>
4819where
4820    C: 'a,
4821{
4822    hub: &'a Eventarc<C>,
4823    _request: SetIamPolicyRequest,
4824    _resource: String,
4825    _delegate: Option<&'a mut dyn common::Delegate>,
4826    _additional_params: HashMap<String, String>,
4827    _scopes: BTreeSet<String>,
4828}
4829
4830impl<'a, C> common::CallBuilder for ProjectLocationChannelConnectionSetIamPolicyCall<'a, C> {}
4831
4832impl<'a, C> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C>
4833where
4834    C: common::Connector,
4835{
4836    /// Perform the operation you have build so far.
4837    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4838        use std::borrow::Cow;
4839        use std::io::{Read, Seek};
4840
4841        use common::{url::Params, ToParts};
4842        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4843
4844        let mut dd = common::DefaultDelegate;
4845        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4846        dlg.begin(common::MethodInfo {
4847            id: "eventarc.projects.locations.channelConnections.setIamPolicy",
4848            http_method: hyper::Method::POST,
4849        });
4850
4851        for &field in ["alt", "resource"].iter() {
4852            if self._additional_params.contains_key(field) {
4853                dlg.finished(false);
4854                return Err(common::Error::FieldClash(field));
4855            }
4856        }
4857
4858        let mut params = Params::with_capacity(4 + self._additional_params.len());
4859        params.push("resource", self._resource);
4860
4861        params.extend(self._additional_params.iter());
4862
4863        params.push("alt", "json");
4864        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
4865        if self._scopes.is_empty() {
4866            self._scopes
4867                .insert(Scope::CloudPlatform.as_ref().to_string());
4868        }
4869
4870        #[allow(clippy::single_element_loop)]
4871        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4872            url = params.uri_replacement(url, param_name, find_this, true);
4873        }
4874        {
4875            let to_remove = ["resource"];
4876            params.remove_params(&to_remove);
4877        }
4878
4879        let url = params.parse_with_url(&url);
4880
4881        let mut json_mime_type = mime::APPLICATION_JSON;
4882        let mut request_value_reader = {
4883            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4884            common::remove_json_null_values(&mut value);
4885            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4886            serde_json::to_writer(&mut dst, &value).unwrap();
4887            dst
4888        };
4889        let request_size = request_value_reader
4890            .seek(std::io::SeekFrom::End(0))
4891            .unwrap();
4892        request_value_reader
4893            .seek(std::io::SeekFrom::Start(0))
4894            .unwrap();
4895
4896        loop {
4897            let token = match self
4898                .hub
4899                .auth
4900                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4901                .await
4902            {
4903                Ok(token) => token,
4904                Err(e) => match dlg.token(e) {
4905                    Ok(token) => token,
4906                    Err(e) => {
4907                        dlg.finished(false);
4908                        return Err(common::Error::MissingToken(e));
4909                    }
4910                },
4911            };
4912            request_value_reader
4913                .seek(std::io::SeekFrom::Start(0))
4914                .unwrap();
4915            let mut req_result = {
4916                let client = &self.hub.client;
4917                dlg.pre_request();
4918                let mut req_builder = hyper::Request::builder()
4919                    .method(hyper::Method::POST)
4920                    .uri(url.as_str())
4921                    .header(USER_AGENT, self.hub._user_agent.clone());
4922
4923                if let Some(token) = token.as_ref() {
4924                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4925                }
4926
4927                let request = req_builder
4928                    .header(CONTENT_TYPE, json_mime_type.to_string())
4929                    .header(CONTENT_LENGTH, request_size as u64)
4930                    .body(common::to_body(
4931                        request_value_reader.get_ref().clone().into(),
4932                    ));
4933
4934                client.request(request.unwrap()).await
4935            };
4936
4937            match req_result {
4938                Err(err) => {
4939                    if let common::Retry::After(d) = dlg.http_error(&err) {
4940                        sleep(d).await;
4941                        continue;
4942                    }
4943                    dlg.finished(false);
4944                    return Err(common::Error::HttpError(err));
4945                }
4946                Ok(res) => {
4947                    let (mut parts, body) = res.into_parts();
4948                    let mut body = common::Body::new(body);
4949                    if !parts.status.is_success() {
4950                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4951                        let error = serde_json::from_str(&common::to_string(&bytes));
4952                        let response = common::to_response(parts, bytes.into());
4953
4954                        if let common::Retry::After(d) =
4955                            dlg.http_failure(&response, error.as_ref().ok())
4956                        {
4957                            sleep(d).await;
4958                            continue;
4959                        }
4960
4961                        dlg.finished(false);
4962
4963                        return Err(match error {
4964                            Ok(value) => common::Error::BadRequest(value),
4965                            _ => common::Error::Failure(response),
4966                        });
4967                    }
4968                    let response = {
4969                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4970                        let encoded = common::to_string(&bytes);
4971                        match serde_json::from_str(&encoded) {
4972                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4973                            Err(error) => {
4974                                dlg.response_json_decode_error(&encoded, &error);
4975                                return Err(common::Error::JsonDecodeError(
4976                                    encoded.to_string(),
4977                                    error,
4978                                ));
4979                            }
4980                        }
4981                    };
4982
4983                    dlg.finished(true);
4984                    return Ok(response);
4985                }
4986            }
4987        }
4988    }
4989
4990    ///
4991    /// Sets the *request* property to the given value.
4992    ///
4993    /// Even though the property as already been set when instantiating this call,
4994    /// we provide this method for API completeness.
4995    pub fn request(
4996        mut self,
4997        new_value: SetIamPolicyRequest,
4998    ) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C> {
4999        self._request = new_value;
5000        self
5001    }
5002    /// 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.
5003    ///
5004    /// Sets the *resource* path property to the given value.
5005    ///
5006    /// Even though the property as already been set when instantiating this call,
5007    /// we provide this method for API completeness.
5008    pub fn resource(
5009        mut self,
5010        new_value: &str,
5011    ) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C> {
5012        self._resource = new_value.to_string();
5013        self
5014    }
5015    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5016    /// while executing the actual API request.
5017    ///
5018    /// ````text
5019    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5020    /// ````
5021    ///
5022    /// Sets the *delegate* property to the given value.
5023    pub fn delegate(
5024        mut self,
5025        new_value: &'a mut dyn common::Delegate,
5026    ) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C> {
5027        self._delegate = Some(new_value);
5028        self
5029    }
5030
5031    /// Set any additional parameter of the query string used in the request.
5032    /// It should be used to set parameters which are not yet available through their own
5033    /// setters.
5034    ///
5035    /// Please note that this method must not be used to set any of the known parameters
5036    /// which have their own setter method. If done anyway, the request will fail.
5037    ///
5038    /// # Additional Parameters
5039    ///
5040    /// * *$.xgafv* (query-string) - V1 error format.
5041    /// * *access_token* (query-string) - OAuth access token.
5042    /// * *alt* (query-string) - Data format for response.
5043    /// * *callback* (query-string) - JSONP
5044    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5045    /// * *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.
5046    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5047    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5048    /// * *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.
5049    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5050    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5051    pub fn param<T>(
5052        mut self,
5053        name: T,
5054        value: T,
5055    ) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C>
5056    where
5057        T: AsRef<str>,
5058    {
5059        self._additional_params
5060            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5061        self
5062    }
5063
5064    /// Identifies the authorization scope for the method you are building.
5065    ///
5066    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5067    /// [`Scope::CloudPlatform`].
5068    ///
5069    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5070    /// tokens for more than one scope.
5071    ///
5072    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5073    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5074    /// sufficient, a read-write scope will do as well.
5075    pub fn add_scope<St>(
5076        mut self,
5077        scope: St,
5078    ) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C>
5079    where
5080        St: AsRef<str>,
5081    {
5082        self._scopes.insert(String::from(scope.as_ref()));
5083        self
5084    }
5085    /// Identifies the authorization scope(s) for the method you are building.
5086    ///
5087    /// See [`Self::add_scope()`] for details.
5088    pub fn add_scopes<I, St>(
5089        mut self,
5090        scopes: I,
5091    ) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C>
5092    where
5093        I: IntoIterator<Item = St>,
5094        St: AsRef<str>,
5095    {
5096        self._scopes
5097            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5098        self
5099    }
5100
5101    /// Removes all scopes, and no default scope will be used either.
5102    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5103    /// for details).
5104    pub fn clear_scopes(mut self) -> ProjectLocationChannelConnectionSetIamPolicyCall<'a, C> {
5105        self._scopes.clear();
5106        self
5107    }
5108}
5109
5110/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
5111///
5112/// A builder for the *locations.channelConnections.testIamPermissions* method supported by a *project* resource.
5113/// It is not used directly, but through a [`ProjectMethods`] instance.
5114///
5115/// # Example
5116///
5117/// Instantiate a resource method builder
5118///
5119/// ```test_harness,no_run
5120/// # extern crate hyper;
5121/// # extern crate hyper_rustls;
5122/// # extern crate google_eventarc1 as eventarc1;
5123/// use eventarc1::api::TestIamPermissionsRequest;
5124/// # async fn dox() {
5125/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5126///
5127/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5128/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5129/// #     .with_native_roots()
5130/// #     .unwrap()
5131/// #     .https_only()
5132/// #     .enable_http2()
5133/// #     .build();
5134///
5135/// # let executor = hyper_util::rt::TokioExecutor::new();
5136/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5137/// #     secret,
5138/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5139/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5140/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5141/// #     ),
5142/// # ).build().await.unwrap();
5143///
5144/// # let client = hyper_util::client::legacy::Client::builder(
5145/// #     hyper_util::rt::TokioExecutor::new()
5146/// # )
5147/// # .build(
5148/// #     hyper_rustls::HttpsConnectorBuilder::new()
5149/// #         .with_native_roots()
5150/// #         .unwrap()
5151/// #         .https_or_http()
5152/// #         .enable_http2()
5153/// #         .build()
5154/// # );
5155/// # let mut hub = Eventarc::new(client, auth);
5156/// // As the method needs a request, you would usually fill it with the desired information
5157/// // into the respective structure. Some of the parts shown here might not be applicable !
5158/// // Values shown here are possibly random and not representative !
5159/// let mut req = TestIamPermissionsRequest::default();
5160///
5161/// // You can configure optional parameters by calling the respective setters at will, and
5162/// // execute the final call using `doit()`.
5163/// // Values shown here are possibly random and not representative !
5164/// let result = hub.projects().locations_channel_connections_test_iam_permissions(req, "resource")
5165///              .doit().await;
5166/// # }
5167/// ```
5168pub struct ProjectLocationChannelConnectionTestIamPermissionCall<'a, C>
5169where
5170    C: 'a,
5171{
5172    hub: &'a Eventarc<C>,
5173    _request: TestIamPermissionsRequest,
5174    _resource: String,
5175    _delegate: Option<&'a mut dyn common::Delegate>,
5176    _additional_params: HashMap<String, String>,
5177    _scopes: BTreeSet<String>,
5178}
5179
5180impl<'a, C> common::CallBuilder for ProjectLocationChannelConnectionTestIamPermissionCall<'a, C> {}
5181
5182impl<'a, C> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C>
5183where
5184    C: common::Connector,
5185{
5186    /// Perform the operation you have build so far.
5187    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
5188        use std::borrow::Cow;
5189        use std::io::{Read, Seek};
5190
5191        use common::{url::Params, ToParts};
5192        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5193
5194        let mut dd = common::DefaultDelegate;
5195        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5196        dlg.begin(common::MethodInfo {
5197            id: "eventarc.projects.locations.channelConnections.testIamPermissions",
5198            http_method: hyper::Method::POST,
5199        });
5200
5201        for &field in ["alt", "resource"].iter() {
5202            if self._additional_params.contains_key(field) {
5203                dlg.finished(false);
5204                return Err(common::Error::FieldClash(field));
5205            }
5206        }
5207
5208        let mut params = Params::with_capacity(4 + self._additional_params.len());
5209        params.push("resource", self._resource);
5210
5211        params.extend(self._additional_params.iter());
5212
5213        params.push("alt", "json");
5214        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
5215        if self._scopes.is_empty() {
5216            self._scopes
5217                .insert(Scope::CloudPlatform.as_ref().to_string());
5218        }
5219
5220        #[allow(clippy::single_element_loop)]
5221        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5222            url = params.uri_replacement(url, param_name, find_this, true);
5223        }
5224        {
5225            let to_remove = ["resource"];
5226            params.remove_params(&to_remove);
5227        }
5228
5229        let url = params.parse_with_url(&url);
5230
5231        let mut json_mime_type = mime::APPLICATION_JSON;
5232        let mut request_value_reader = {
5233            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5234            common::remove_json_null_values(&mut value);
5235            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5236            serde_json::to_writer(&mut dst, &value).unwrap();
5237            dst
5238        };
5239        let request_size = request_value_reader
5240            .seek(std::io::SeekFrom::End(0))
5241            .unwrap();
5242        request_value_reader
5243            .seek(std::io::SeekFrom::Start(0))
5244            .unwrap();
5245
5246        loop {
5247            let token = match self
5248                .hub
5249                .auth
5250                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5251                .await
5252            {
5253                Ok(token) => token,
5254                Err(e) => match dlg.token(e) {
5255                    Ok(token) => token,
5256                    Err(e) => {
5257                        dlg.finished(false);
5258                        return Err(common::Error::MissingToken(e));
5259                    }
5260                },
5261            };
5262            request_value_reader
5263                .seek(std::io::SeekFrom::Start(0))
5264                .unwrap();
5265            let mut req_result = {
5266                let client = &self.hub.client;
5267                dlg.pre_request();
5268                let mut req_builder = hyper::Request::builder()
5269                    .method(hyper::Method::POST)
5270                    .uri(url.as_str())
5271                    .header(USER_AGENT, self.hub._user_agent.clone());
5272
5273                if let Some(token) = token.as_ref() {
5274                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5275                }
5276
5277                let request = req_builder
5278                    .header(CONTENT_TYPE, json_mime_type.to_string())
5279                    .header(CONTENT_LENGTH, request_size as u64)
5280                    .body(common::to_body(
5281                        request_value_reader.get_ref().clone().into(),
5282                    ));
5283
5284                client.request(request.unwrap()).await
5285            };
5286
5287            match req_result {
5288                Err(err) => {
5289                    if let common::Retry::After(d) = dlg.http_error(&err) {
5290                        sleep(d).await;
5291                        continue;
5292                    }
5293                    dlg.finished(false);
5294                    return Err(common::Error::HttpError(err));
5295                }
5296                Ok(res) => {
5297                    let (mut parts, body) = res.into_parts();
5298                    let mut body = common::Body::new(body);
5299                    if !parts.status.is_success() {
5300                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5301                        let error = serde_json::from_str(&common::to_string(&bytes));
5302                        let response = common::to_response(parts, bytes.into());
5303
5304                        if let common::Retry::After(d) =
5305                            dlg.http_failure(&response, error.as_ref().ok())
5306                        {
5307                            sleep(d).await;
5308                            continue;
5309                        }
5310
5311                        dlg.finished(false);
5312
5313                        return Err(match error {
5314                            Ok(value) => common::Error::BadRequest(value),
5315                            _ => common::Error::Failure(response),
5316                        });
5317                    }
5318                    let response = {
5319                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5320                        let encoded = common::to_string(&bytes);
5321                        match serde_json::from_str(&encoded) {
5322                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5323                            Err(error) => {
5324                                dlg.response_json_decode_error(&encoded, &error);
5325                                return Err(common::Error::JsonDecodeError(
5326                                    encoded.to_string(),
5327                                    error,
5328                                ));
5329                            }
5330                        }
5331                    };
5332
5333                    dlg.finished(true);
5334                    return Ok(response);
5335                }
5336            }
5337        }
5338    }
5339
5340    ///
5341    /// Sets the *request* property to the given value.
5342    ///
5343    /// Even though the property as already been set when instantiating this call,
5344    /// we provide this method for API completeness.
5345    pub fn request(
5346        mut self,
5347        new_value: TestIamPermissionsRequest,
5348    ) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C> {
5349        self._request = new_value;
5350        self
5351    }
5352    /// 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.
5353    ///
5354    /// Sets the *resource* path property to the given value.
5355    ///
5356    /// Even though the property as already been set when instantiating this call,
5357    /// we provide this method for API completeness.
5358    pub fn resource(
5359        mut self,
5360        new_value: &str,
5361    ) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C> {
5362        self._resource = new_value.to_string();
5363        self
5364    }
5365    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5366    /// while executing the actual API request.
5367    ///
5368    /// ````text
5369    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5370    /// ````
5371    ///
5372    /// Sets the *delegate* property to the given value.
5373    pub fn delegate(
5374        mut self,
5375        new_value: &'a mut dyn common::Delegate,
5376    ) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C> {
5377        self._delegate = Some(new_value);
5378        self
5379    }
5380
5381    /// Set any additional parameter of the query string used in the request.
5382    /// It should be used to set parameters which are not yet available through their own
5383    /// setters.
5384    ///
5385    /// Please note that this method must not be used to set any of the known parameters
5386    /// which have their own setter method. If done anyway, the request will fail.
5387    ///
5388    /// # Additional Parameters
5389    ///
5390    /// * *$.xgafv* (query-string) - V1 error format.
5391    /// * *access_token* (query-string) - OAuth access token.
5392    /// * *alt* (query-string) - Data format for response.
5393    /// * *callback* (query-string) - JSONP
5394    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5395    /// * *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.
5396    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5397    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5398    /// * *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.
5399    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5400    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5401    pub fn param<T>(
5402        mut self,
5403        name: T,
5404        value: T,
5405    ) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C>
5406    where
5407        T: AsRef<str>,
5408    {
5409        self._additional_params
5410            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5411        self
5412    }
5413
5414    /// Identifies the authorization scope for the method you are building.
5415    ///
5416    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5417    /// [`Scope::CloudPlatform`].
5418    ///
5419    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5420    /// tokens for more than one scope.
5421    ///
5422    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5423    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5424    /// sufficient, a read-write scope will do as well.
5425    pub fn add_scope<St>(
5426        mut self,
5427        scope: St,
5428    ) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C>
5429    where
5430        St: AsRef<str>,
5431    {
5432        self._scopes.insert(String::from(scope.as_ref()));
5433        self
5434    }
5435    /// Identifies the authorization scope(s) for the method you are building.
5436    ///
5437    /// See [`Self::add_scope()`] for details.
5438    pub fn add_scopes<I, St>(
5439        mut self,
5440        scopes: I,
5441    ) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C>
5442    where
5443        I: IntoIterator<Item = St>,
5444        St: AsRef<str>,
5445    {
5446        self._scopes
5447            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5448        self
5449    }
5450
5451    /// Removes all scopes, and no default scope will be used either.
5452    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5453    /// for details).
5454    pub fn clear_scopes(mut self) -> ProjectLocationChannelConnectionTestIamPermissionCall<'a, C> {
5455        self._scopes.clear();
5456        self
5457    }
5458}
5459
5460/// Create a new channel in a particular project and location.
5461///
5462/// A builder for the *locations.channels.create* method supported by a *project* resource.
5463/// It is not used directly, but through a [`ProjectMethods`] instance.
5464///
5465/// # Example
5466///
5467/// Instantiate a resource method builder
5468///
5469/// ```test_harness,no_run
5470/// # extern crate hyper;
5471/// # extern crate hyper_rustls;
5472/// # extern crate google_eventarc1 as eventarc1;
5473/// use eventarc1::api::Channel;
5474/// # async fn dox() {
5475/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5476///
5477/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5478/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5479/// #     .with_native_roots()
5480/// #     .unwrap()
5481/// #     .https_only()
5482/// #     .enable_http2()
5483/// #     .build();
5484///
5485/// # let executor = hyper_util::rt::TokioExecutor::new();
5486/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5487/// #     secret,
5488/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5489/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5490/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5491/// #     ),
5492/// # ).build().await.unwrap();
5493///
5494/// # let client = hyper_util::client::legacy::Client::builder(
5495/// #     hyper_util::rt::TokioExecutor::new()
5496/// # )
5497/// # .build(
5498/// #     hyper_rustls::HttpsConnectorBuilder::new()
5499/// #         .with_native_roots()
5500/// #         .unwrap()
5501/// #         .https_or_http()
5502/// #         .enable_http2()
5503/// #         .build()
5504/// # );
5505/// # let mut hub = Eventarc::new(client, auth);
5506/// // As the method needs a request, you would usually fill it with the desired information
5507/// // into the respective structure. Some of the parts shown here might not be applicable !
5508/// // Values shown here are possibly random and not representative !
5509/// let mut req = Channel::default();
5510///
5511/// // You can configure optional parameters by calling the respective setters at will, and
5512/// // execute the final call using `doit()`.
5513/// // Values shown here are possibly random and not representative !
5514/// let result = hub.projects().locations_channels_create(req, "parent")
5515///              .validate_only(true)
5516///              .channel_id("ipsum")
5517///              .doit().await;
5518/// # }
5519/// ```
5520pub struct ProjectLocationChannelCreateCall<'a, C>
5521where
5522    C: 'a,
5523{
5524    hub: &'a Eventarc<C>,
5525    _request: Channel,
5526    _parent: String,
5527    _validate_only: Option<bool>,
5528    _channel_id: Option<String>,
5529    _delegate: Option<&'a mut dyn common::Delegate>,
5530    _additional_params: HashMap<String, String>,
5531    _scopes: BTreeSet<String>,
5532}
5533
5534impl<'a, C> common::CallBuilder for ProjectLocationChannelCreateCall<'a, C> {}
5535
5536impl<'a, C> ProjectLocationChannelCreateCall<'a, C>
5537where
5538    C: common::Connector,
5539{
5540    /// Perform the operation you have build so far.
5541    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
5542        use std::borrow::Cow;
5543        use std::io::{Read, Seek};
5544
5545        use common::{url::Params, ToParts};
5546        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5547
5548        let mut dd = common::DefaultDelegate;
5549        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5550        dlg.begin(common::MethodInfo {
5551            id: "eventarc.projects.locations.channels.create",
5552            http_method: hyper::Method::POST,
5553        });
5554
5555        for &field in ["alt", "parent", "validateOnly", "channelId"].iter() {
5556            if self._additional_params.contains_key(field) {
5557                dlg.finished(false);
5558                return Err(common::Error::FieldClash(field));
5559            }
5560        }
5561
5562        let mut params = Params::with_capacity(6 + self._additional_params.len());
5563        params.push("parent", self._parent);
5564        if let Some(value) = self._validate_only.as_ref() {
5565            params.push("validateOnly", value.to_string());
5566        }
5567        if let Some(value) = self._channel_id.as_ref() {
5568            params.push("channelId", value);
5569        }
5570
5571        params.extend(self._additional_params.iter());
5572
5573        params.push("alt", "json");
5574        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channels";
5575        if self._scopes.is_empty() {
5576            self._scopes
5577                .insert(Scope::CloudPlatform.as_ref().to_string());
5578        }
5579
5580        #[allow(clippy::single_element_loop)]
5581        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5582            url = params.uri_replacement(url, param_name, find_this, true);
5583        }
5584        {
5585            let to_remove = ["parent"];
5586            params.remove_params(&to_remove);
5587        }
5588
5589        let url = params.parse_with_url(&url);
5590
5591        let mut json_mime_type = mime::APPLICATION_JSON;
5592        let mut request_value_reader = {
5593            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5594            common::remove_json_null_values(&mut value);
5595            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5596            serde_json::to_writer(&mut dst, &value).unwrap();
5597            dst
5598        };
5599        let request_size = request_value_reader
5600            .seek(std::io::SeekFrom::End(0))
5601            .unwrap();
5602        request_value_reader
5603            .seek(std::io::SeekFrom::Start(0))
5604            .unwrap();
5605
5606        loop {
5607            let token = match self
5608                .hub
5609                .auth
5610                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5611                .await
5612            {
5613                Ok(token) => token,
5614                Err(e) => match dlg.token(e) {
5615                    Ok(token) => token,
5616                    Err(e) => {
5617                        dlg.finished(false);
5618                        return Err(common::Error::MissingToken(e));
5619                    }
5620                },
5621            };
5622            request_value_reader
5623                .seek(std::io::SeekFrom::Start(0))
5624                .unwrap();
5625            let mut req_result = {
5626                let client = &self.hub.client;
5627                dlg.pre_request();
5628                let mut req_builder = hyper::Request::builder()
5629                    .method(hyper::Method::POST)
5630                    .uri(url.as_str())
5631                    .header(USER_AGENT, self.hub._user_agent.clone());
5632
5633                if let Some(token) = token.as_ref() {
5634                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5635                }
5636
5637                let request = req_builder
5638                    .header(CONTENT_TYPE, json_mime_type.to_string())
5639                    .header(CONTENT_LENGTH, request_size as u64)
5640                    .body(common::to_body(
5641                        request_value_reader.get_ref().clone().into(),
5642                    ));
5643
5644                client.request(request.unwrap()).await
5645            };
5646
5647            match req_result {
5648                Err(err) => {
5649                    if let common::Retry::After(d) = dlg.http_error(&err) {
5650                        sleep(d).await;
5651                        continue;
5652                    }
5653                    dlg.finished(false);
5654                    return Err(common::Error::HttpError(err));
5655                }
5656                Ok(res) => {
5657                    let (mut parts, body) = res.into_parts();
5658                    let mut body = common::Body::new(body);
5659                    if !parts.status.is_success() {
5660                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5661                        let error = serde_json::from_str(&common::to_string(&bytes));
5662                        let response = common::to_response(parts, bytes.into());
5663
5664                        if let common::Retry::After(d) =
5665                            dlg.http_failure(&response, error.as_ref().ok())
5666                        {
5667                            sleep(d).await;
5668                            continue;
5669                        }
5670
5671                        dlg.finished(false);
5672
5673                        return Err(match error {
5674                            Ok(value) => common::Error::BadRequest(value),
5675                            _ => common::Error::Failure(response),
5676                        });
5677                    }
5678                    let response = {
5679                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5680                        let encoded = common::to_string(&bytes);
5681                        match serde_json::from_str(&encoded) {
5682                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5683                            Err(error) => {
5684                                dlg.response_json_decode_error(&encoded, &error);
5685                                return Err(common::Error::JsonDecodeError(
5686                                    encoded.to_string(),
5687                                    error,
5688                                ));
5689                            }
5690                        }
5691                    };
5692
5693                    dlg.finished(true);
5694                    return Ok(response);
5695                }
5696            }
5697        }
5698    }
5699
5700    ///
5701    /// Sets the *request* property to the given value.
5702    ///
5703    /// Even though the property as already been set when instantiating this call,
5704    /// we provide this method for API completeness.
5705    pub fn request(mut self, new_value: Channel) -> ProjectLocationChannelCreateCall<'a, C> {
5706        self._request = new_value;
5707        self
5708    }
5709    /// Required. The parent collection in which to add this channel.
5710    ///
5711    /// Sets the *parent* path property to the given value.
5712    ///
5713    /// Even though the property as already been set when instantiating this call,
5714    /// we provide this method for API completeness.
5715    pub fn parent(mut self, new_value: &str) -> ProjectLocationChannelCreateCall<'a, C> {
5716        self._parent = new_value.to_string();
5717        self
5718    }
5719    /// Optional. If set, validate the request and preview the review, but do not post it.
5720    ///
5721    /// Sets the *validate only* query property to the given value.
5722    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationChannelCreateCall<'a, C> {
5723        self._validate_only = Some(new_value);
5724        self
5725    }
5726    /// Required. The user-provided ID to be assigned to the channel.
5727    ///
5728    /// Sets the *channel id* query property to the given value.
5729    pub fn channel_id(mut self, new_value: &str) -> ProjectLocationChannelCreateCall<'a, C> {
5730        self._channel_id = Some(new_value.to_string());
5731        self
5732    }
5733    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5734    /// while executing the actual API request.
5735    ///
5736    /// ````text
5737    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5738    /// ````
5739    ///
5740    /// Sets the *delegate* property to the given value.
5741    pub fn delegate(
5742        mut self,
5743        new_value: &'a mut dyn common::Delegate,
5744    ) -> ProjectLocationChannelCreateCall<'a, C> {
5745        self._delegate = Some(new_value);
5746        self
5747    }
5748
5749    /// Set any additional parameter of the query string used in the request.
5750    /// It should be used to set parameters which are not yet available through their own
5751    /// setters.
5752    ///
5753    /// Please note that this method must not be used to set any of the known parameters
5754    /// which have their own setter method. If done anyway, the request will fail.
5755    ///
5756    /// # Additional Parameters
5757    ///
5758    /// * *$.xgafv* (query-string) - V1 error format.
5759    /// * *access_token* (query-string) - OAuth access token.
5760    /// * *alt* (query-string) - Data format for response.
5761    /// * *callback* (query-string) - JSONP
5762    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5763    /// * *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.
5764    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5765    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5766    /// * *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.
5767    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5768    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5769    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelCreateCall<'a, C>
5770    where
5771        T: AsRef<str>,
5772    {
5773        self._additional_params
5774            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5775        self
5776    }
5777
5778    /// Identifies the authorization scope for the method you are building.
5779    ///
5780    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5781    /// [`Scope::CloudPlatform`].
5782    ///
5783    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5784    /// tokens for more than one scope.
5785    ///
5786    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5787    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5788    /// sufficient, a read-write scope will do as well.
5789    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelCreateCall<'a, C>
5790    where
5791        St: AsRef<str>,
5792    {
5793        self._scopes.insert(String::from(scope.as_ref()));
5794        self
5795    }
5796    /// Identifies the authorization scope(s) for the method you are building.
5797    ///
5798    /// See [`Self::add_scope()`] for details.
5799    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelCreateCall<'a, C>
5800    where
5801        I: IntoIterator<Item = St>,
5802        St: AsRef<str>,
5803    {
5804        self._scopes
5805            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5806        self
5807    }
5808
5809    /// Removes all scopes, and no default scope will be used either.
5810    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5811    /// for details).
5812    pub fn clear_scopes(mut self) -> ProjectLocationChannelCreateCall<'a, C> {
5813        self._scopes.clear();
5814        self
5815    }
5816}
5817
5818/// Delete a single channel.
5819///
5820/// A builder for the *locations.channels.delete* method supported by a *project* resource.
5821/// It is not used directly, but through a [`ProjectMethods`] instance.
5822///
5823/// # Example
5824///
5825/// Instantiate a resource method builder
5826///
5827/// ```test_harness,no_run
5828/// # extern crate hyper;
5829/// # extern crate hyper_rustls;
5830/// # extern crate google_eventarc1 as eventarc1;
5831/// # async fn dox() {
5832/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5833///
5834/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5835/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5836/// #     .with_native_roots()
5837/// #     .unwrap()
5838/// #     .https_only()
5839/// #     .enable_http2()
5840/// #     .build();
5841///
5842/// # let executor = hyper_util::rt::TokioExecutor::new();
5843/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5844/// #     secret,
5845/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5846/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5847/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5848/// #     ),
5849/// # ).build().await.unwrap();
5850///
5851/// # let client = hyper_util::client::legacy::Client::builder(
5852/// #     hyper_util::rt::TokioExecutor::new()
5853/// # )
5854/// # .build(
5855/// #     hyper_rustls::HttpsConnectorBuilder::new()
5856/// #         .with_native_roots()
5857/// #         .unwrap()
5858/// #         .https_or_http()
5859/// #         .enable_http2()
5860/// #         .build()
5861/// # );
5862/// # let mut hub = Eventarc::new(client, auth);
5863/// // You can configure optional parameters by calling the respective setters at will, and
5864/// // execute the final call using `doit()`.
5865/// // Values shown here are possibly random and not representative !
5866/// let result = hub.projects().locations_channels_delete("name")
5867///              .validate_only(true)
5868///              .doit().await;
5869/// # }
5870/// ```
5871pub struct ProjectLocationChannelDeleteCall<'a, C>
5872where
5873    C: 'a,
5874{
5875    hub: &'a Eventarc<C>,
5876    _name: String,
5877    _validate_only: Option<bool>,
5878    _delegate: Option<&'a mut dyn common::Delegate>,
5879    _additional_params: HashMap<String, String>,
5880    _scopes: BTreeSet<String>,
5881}
5882
5883impl<'a, C> common::CallBuilder for ProjectLocationChannelDeleteCall<'a, C> {}
5884
5885impl<'a, C> ProjectLocationChannelDeleteCall<'a, C>
5886where
5887    C: common::Connector,
5888{
5889    /// Perform the operation you have build so far.
5890    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
5891        use std::borrow::Cow;
5892        use std::io::{Read, Seek};
5893
5894        use common::{url::Params, ToParts};
5895        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5896
5897        let mut dd = common::DefaultDelegate;
5898        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5899        dlg.begin(common::MethodInfo {
5900            id: "eventarc.projects.locations.channels.delete",
5901            http_method: hyper::Method::DELETE,
5902        });
5903
5904        for &field in ["alt", "name", "validateOnly"].iter() {
5905            if self._additional_params.contains_key(field) {
5906                dlg.finished(false);
5907                return Err(common::Error::FieldClash(field));
5908            }
5909        }
5910
5911        let mut params = Params::with_capacity(4 + self._additional_params.len());
5912        params.push("name", self._name);
5913        if let Some(value) = self._validate_only.as_ref() {
5914            params.push("validateOnly", value.to_string());
5915        }
5916
5917        params.extend(self._additional_params.iter());
5918
5919        params.push("alt", "json");
5920        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5921        if self._scopes.is_empty() {
5922            self._scopes
5923                .insert(Scope::CloudPlatform.as_ref().to_string());
5924        }
5925
5926        #[allow(clippy::single_element_loop)]
5927        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5928            url = params.uri_replacement(url, param_name, find_this, true);
5929        }
5930        {
5931            let to_remove = ["name"];
5932            params.remove_params(&to_remove);
5933        }
5934
5935        let url = params.parse_with_url(&url);
5936
5937        loop {
5938            let token = match self
5939                .hub
5940                .auth
5941                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5942                .await
5943            {
5944                Ok(token) => token,
5945                Err(e) => match dlg.token(e) {
5946                    Ok(token) => token,
5947                    Err(e) => {
5948                        dlg.finished(false);
5949                        return Err(common::Error::MissingToken(e));
5950                    }
5951                },
5952            };
5953            let mut req_result = {
5954                let client = &self.hub.client;
5955                dlg.pre_request();
5956                let mut req_builder = hyper::Request::builder()
5957                    .method(hyper::Method::DELETE)
5958                    .uri(url.as_str())
5959                    .header(USER_AGENT, self.hub._user_agent.clone());
5960
5961                if let Some(token) = token.as_ref() {
5962                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5963                }
5964
5965                let request = req_builder
5966                    .header(CONTENT_LENGTH, 0_u64)
5967                    .body(common::to_body::<String>(None));
5968
5969                client.request(request.unwrap()).await
5970            };
5971
5972            match req_result {
5973                Err(err) => {
5974                    if let common::Retry::After(d) = dlg.http_error(&err) {
5975                        sleep(d).await;
5976                        continue;
5977                    }
5978                    dlg.finished(false);
5979                    return Err(common::Error::HttpError(err));
5980                }
5981                Ok(res) => {
5982                    let (mut parts, body) = res.into_parts();
5983                    let mut body = common::Body::new(body);
5984                    if !parts.status.is_success() {
5985                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5986                        let error = serde_json::from_str(&common::to_string(&bytes));
5987                        let response = common::to_response(parts, bytes.into());
5988
5989                        if let common::Retry::After(d) =
5990                            dlg.http_failure(&response, error.as_ref().ok())
5991                        {
5992                            sleep(d).await;
5993                            continue;
5994                        }
5995
5996                        dlg.finished(false);
5997
5998                        return Err(match error {
5999                            Ok(value) => common::Error::BadRequest(value),
6000                            _ => common::Error::Failure(response),
6001                        });
6002                    }
6003                    let response = {
6004                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6005                        let encoded = common::to_string(&bytes);
6006                        match serde_json::from_str(&encoded) {
6007                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6008                            Err(error) => {
6009                                dlg.response_json_decode_error(&encoded, &error);
6010                                return Err(common::Error::JsonDecodeError(
6011                                    encoded.to_string(),
6012                                    error,
6013                                ));
6014                            }
6015                        }
6016                    };
6017
6018                    dlg.finished(true);
6019                    return Ok(response);
6020                }
6021            }
6022        }
6023    }
6024
6025    /// Required. The name of the channel to be deleted.
6026    ///
6027    /// Sets the *name* path property to the given value.
6028    ///
6029    /// Even though the property as already been set when instantiating this call,
6030    /// we provide this method for API completeness.
6031    pub fn name(mut self, new_value: &str) -> ProjectLocationChannelDeleteCall<'a, C> {
6032        self._name = new_value.to_string();
6033        self
6034    }
6035    /// Optional. If set, validate the request and preview the review, but do not post it.
6036    ///
6037    /// Sets the *validate only* query property to the given value.
6038    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationChannelDeleteCall<'a, C> {
6039        self._validate_only = Some(new_value);
6040        self
6041    }
6042    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6043    /// while executing the actual API request.
6044    ///
6045    /// ````text
6046    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6047    /// ````
6048    ///
6049    /// Sets the *delegate* property to the given value.
6050    pub fn delegate(
6051        mut self,
6052        new_value: &'a mut dyn common::Delegate,
6053    ) -> ProjectLocationChannelDeleteCall<'a, C> {
6054        self._delegate = Some(new_value);
6055        self
6056    }
6057
6058    /// Set any additional parameter of the query string used in the request.
6059    /// It should be used to set parameters which are not yet available through their own
6060    /// setters.
6061    ///
6062    /// Please note that this method must not be used to set any of the known parameters
6063    /// which have their own setter method. If done anyway, the request will fail.
6064    ///
6065    /// # Additional Parameters
6066    ///
6067    /// * *$.xgafv* (query-string) - V1 error format.
6068    /// * *access_token* (query-string) - OAuth access token.
6069    /// * *alt* (query-string) - Data format for response.
6070    /// * *callback* (query-string) - JSONP
6071    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6072    /// * *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.
6073    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6074    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6075    /// * *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.
6076    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6077    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6078    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelDeleteCall<'a, C>
6079    where
6080        T: AsRef<str>,
6081    {
6082        self._additional_params
6083            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6084        self
6085    }
6086
6087    /// Identifies the authorization scope for the method you are building.
6088    ///
6089    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6090    /// [`Scope::CloudPlatform`].
6091    ///
6092    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6093    /// tokens for more than one scope.
6094    ///
6095    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6096    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6097    /// sufficient, a read-write scope will do as well.
6098    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelDeleteCall<'a, C>
6099    where
6100        St: AsRef<str>,
6101    {
6102        self._scopes.insert(String::from(scope.as_ref()));
6103        self
6104    }
6105    /// Identifies the authorization scope(s) for the method you are building.
6106    ///
6107    /// See [`Self::add_scope()`] for details.
6108    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelDeleteCall<'a, C>
6109    where
6110        I: IntoIterator<Item = St>,
6111        St: AsRef<str>,
6112    {
6113        self._scopes
6114            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6115        self
6116    }
6117
6118    /// Removes all scopes, and no default scope will be used either.
6119    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6120    /// for details).
6121    pub fn clear_scopes(mut self) -> ProjectLocationChannelDeleteCall<'a, C> {
6122        self._scopes.clear();
6123        self
6124    }
6125}
6126
6127/// Get a single Channel.
6128///
6129/// A builder for the *locations.channels.get* method supported by a *project* resource.
6130/// It is not used directly, but through a [`ProjectMethods`] instance.
6131///
6132/// # Example
6133///
6134/// Instantiate a resource method builder
6135///
6136/// ```test_harness,no_run
6137/// # extern crate hyper;
6138/// # extern crate hyper_rustls;
6139/// # extern crate google_eventarc1 as eventarc1;
6140/// # async fn dox() {
6141/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6142///
6143/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6144/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6145/// #     .with_native_roots()
6146/// #     .unwrap()
6147/// #     .https_only()
6148/// #     .enable_http2()
6149/// #     .build();
6150///
6151/// # let executor = hyper_util::rt::TokioExecutor::new();
6152/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6153/// #     secret,
6154/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6155/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6156/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6157/// #     ),
6158/// # ).build().await.unwrap();
6159///
6160/// # let client = hyper_util::client::legacy::Client::builder(
6161/// #     hyper_util::rt::TokioExecutor::new()
6162/// # )
6163/// # .build(
6164/// #     hyper_rustls::HttpsConnectorBuilder::new()
6165/// #         .with_native_roots()
6166/// #         .unwrap()
6167/// #         .https_or_http()
6168/// #         .enable_http2()
6169/// #         .build()
6170/// # );
6171/// # let mut hub = Eventarc::new(client, auth);
6172/// // You can configure optional parameters by calling the respective setters at will, and
6173/// // execute the final call using `doit()`.
6174/// // Values shown here are possibly random and not representative !
6175/// let result = hub.projects().locations_channels_get("name")
6176///              .doit().await;
6177/// # }
6178/// ```
6179pub struct ProjectLocationChannelGetCall<'a, C>
6180where
6181    C: 'a,
6182{
6183    hub: &'a Eventarc<C>,
6184    _name: String,
6185    _delegate: Option<&'a mut dyn common::Delegate>,
6186    _additional_params: HashMap<String, String>,
6187    _scopes: BTreeSet<String>,
6188}
6189
6190impl<'a, C> common::CallBuilder for ProjectLocationChannelGetCall<'a, C> {}
6191
6192impl<'a, C> ProjectLocationChannelGetCall<'a, C>
6193where
6194    C: common::Connector,
6195{
6196    /// Perform the operation you have build so far.
6197    pub async fn doit(mut self) -> common::Result<(common::Response, Channel)> {
6198        use std::borrow::Cow;
6199        use std::io::{Read, Seek};
6200
6201        use common::{url::Params, ToParts};
6202        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6203
6204        let mut dd = common::DefaultDelegate;
6205        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6206        dlg.begin(common::MethodInfo {
6207            id: "eventarc.projects.locations.channels.get",
6208            http_method: hyper::Method::GET,
6209        });
6210
6211        for &field in ["alt", "name"].iter() {
6212            if self._additional_params.contains_key(field) {
6213                dlg.finished(false);
6214                return Err(common::Error::FieldClash(field));
6215            }
6216        }
6217
6218        let mut params = Params::with_capacity(3 + self._additional_params.len());
6219        params.push("name", self._name);
6220
6221        params.extend(self._additional_params.iter());
6222
6223        params.push("alt", "json");
6224        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6225        if self._scopes.is_empty() {
6226            self._scopes
6227                .insert(Scope::CloudPlatform.as_ref().to_string());
6228        }
6229
6230        #[allow(clippy::single_element_loop)]
6231        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6232            url = params.uri_replacement(url, param_name, find_this, true);
6233        }
6234        {
6235            let to_remove = ["name"];
6236            params.remove_params(&to_remove);
6237        }
6238
6239        let url = params.parse_with_url(&url);
6240
6241        loop {
6242            let token = match self
6243                .hub
6244                .auth
6245                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6246                .await
6247            {
6248                Ok(token) => token,
6249                Err(e) => match dlg.token(e) {
6250                    Ok(token) => token,
6251                    Err(e) => {
6252                        dlg.finished(false);
6253                        return Err(common::Error::MissingToken(e));
6254                    }
6255                },
6256            };
6257            let mut req_result = {
6258                let client = &self.hub.client;
6259                dlg.pre_request();
6260                let mut req_builder = hyper::Request::builder()
6261                    .method(hyper::Method::GET)
6262                    .uri(url.as_str())
6263                    .header(USER_AGENT, self.hub._user_agent.clone());
6264
6265                if let Some(token) = token.as_ref() {
6266                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6267                }
6268
6269                let request = req_builder
6270                    .header(CONTENT_LENGTH, 0_u64)
6271                    .body(common::to_body::<String>(None));
6272
6273                client.request(request.unwrap()).await
6274            };
6275
6276            match req_result {
6277                Err(err) => {
6278                    if let common::Retry::After(d) = dlg.http_error(&err) {
6279                        sleep(d).await;
6280                        continue;
6281                    }
6282                    dlg.finished(false);
6283                    return Err(common::Error::HttpError(err));
6284                }
6285                Ok(res) => {
6286                    let (mut parts, body) = res.into_parts();
6287                    let mut body = common::Body::new(body);
6288                    if !parts.status.is_success() {
6289                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6290                        let error = serde_json::from_str(&common::to_string(&bytes));
6291                        let response = common::to_response(parts, bytes.into());
6292
6293                        if let common::Retry::After(d) =
6294                            dlg.http_failure(&response, error.as_ref().ok())
6295                        {
6296                            sleep(d).await;
6297                            continue;
6298                        }
6299
6300                        dlg.finished(false);
6301
6302                        return Err(match error {
6303                            Ok(value) => common::Error::BadRequest(value),
6304                            _ => common::Error::Failure(response),
6305                        });
6306                    }
6307                    let response = {
6308                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6309                        let encoded = common::to_string(&bytes);
6310                        match serde_json::from_str(&encoded) {
6311                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6312                            Err(error) => {
6313                                dlg.response_json_decode_error(&encoded, &error);
6314                                return Err(common::Error::JsonDecodeError(
6315                                    encoded.to_string(),
6316                                    error,
6317                                ));
6318                            }
6319                        }
6320                    };
6321
6322                    dlg.finished(true);
6323                    return Ok(response);
6324                }
6325            }
6326        }
6327    }
6328
6329    /// Required. The name of the channel to get.
6330    ///
6331    /// Sets the *name* path property to the given value.
6332    ///
6333    /// Even though the property as already been set when instantiating this call,
6334    /// we provide this method for API completeness.
6335    pub fn name(mut self, new_value: &str) -> ProjectLocationChannelGetCall<'a, C> {
6336        self._name = new_value.to_string();
6337        self
6338    }
6339    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6340    /// while executing the actual API request.
6341    ///
6342    /// ````text
6343    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6344    /// ````
6345    ///
6346    /// Sets the *delegate* property to the given value.
6347    pub fn delegate(
6348        mut self,
6349        new_value: &'a mut dyn common::Delegate,
6350    ) -> ProjectLocationChannelGetCall<'a, C> {
6351        self._delegate = Some(new_value);
6352        self
6353    }
6354
6355    /// Set any additional parameter of the query string used in the request.
6356    /// It should be used to set parameters which are not yet available through their own
6357    /// setters.
6358    ///
6359    /// Please note that this method must not be used to set any of the known parameters
6360    /// which have their own setter method. If done anyway, the request will fail.
6361    ///
6362    /// # Additional Parameters
6363    ///
6364    /// * *$.xgafv* (query-string) - V1 error format.
6365    /// * *access_token* (query-string) - OAuth access token.
6366    /// * *alt* (query-string) - Data format for response.
6367    /// * *callback* (query-string) - JSONP
6368    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6369    /// * *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.
6370    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6371    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6372    /// * *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.
6373    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6374    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6375    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelGetCall<'a, C>
6376    where
6377        T: AsRef<str>,
6378    {
6379        self._additional_params
6380            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6381        self
6382    }
6383
6384    /// Identifies the authorization scope for the method you are building.
6385    ///
6386    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6387    /// [`Scope::CloudPlatform`].
6388    ///
6389    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6390    /// tokens for more than one scope.
6391    ///
6392    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6393    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6394    /// sufficient, a read-write scope will do as well.
6395    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelGetCall<'a, C>
6396    where
6397        St: AsRef<str>,
6398    {
6399        self._scopes.insert(String::from(scope.as_ref()));
6400        self
6401    }
6402    /// Identifies the authorization scope(s) for the method you are building.
6403    ///
6404    /// See [`Self::add_scope()`] for details.
6405    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelGetCall<'a, C>
6406    where
6407        I: IntoIterator<Item = St>,
6408        St: AsRef<str>,
6409    {
6410        self._scopes
6411            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6412        self
6413    }
6414
6415    /// Removes all scopes, and no default scope will be used either.
6416    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6417    /// for details).
6418    pub fn clear_scopes(mut self) -> ProjectLocationChannelGetCall<'a, C> {
6419        self._scopes.clear();
6420        self
6421    }
6422}
6423
6424/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
6425///
6426/// A builder for the *locations.channels.getIamPolicy* method supported by a *project* resource.
6427/// It is not used directly, but through a [`ProjectMethods`] instance.
6428///
6429/// # Example
6430///
6431/// Instantiate a resource method builder
6432///
6433/// ```test_harness,no_run
6434/// # extern crate hyper;
6435/// # extern crate hyper_rustls;
6436/// # extern crate google_eventarc1 as eventarc1;
6437/// # async fn dox() {
6438/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6439///
6440/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6441/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6442/// #     .with_native_roots()
6443/// #     .unwrap()
6444/// #     .https_only()
6445/// #     .enable_http2()
6446/// #     .build();
6447///
6448/// # let executor = hyper_util::rt::TokioExecutor::new();
6449/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6450/// #     secret,
6451/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6452/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6453/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6454/// #     ),
6455/// # ).build().await.unwrap();
6456///
6457/// # let client = hyper_util::client::legacy::Client::builder(
6458/// #     hyper_util::rt::TokioExecutor::new()
6459/// # )
6460/// # .build(
6461/// #     hyper_rustls::HttpsConnectorBuilder::new()
6462/// #         .with_native_roots()
6463/// #         .unwrap()
6464/// #         .https_or_http()
6465/// #         .enable_http2()
6466/// #         .build()
6467/// # );
6468/// # let mut hub = Eventarc::new(client, auth);
6469/// // You can configure optional parameters by calling the respective setters at will, and
6470/// // execute the final call using `doit()`.
6471/// // Values shown here are possibly random and not representative !
6472/// let result = hub.projects().locations_channels_get_iam_policy("resource")
6473///              .options_requested_policy_version(-56)
6474///              .doit().await;
6475/// # }
6476/// ```
6477pub struct ProjectLocationChannelGetIamPolicyCall<'a, C>
6478where
6479    C: 'a,
6480{
6481    hub: &'a Eventarc<C>,
6482    _resource: String,
6483    _options_requested_policy_version: Option<i32>,
6484    _delegate: Option<&'a mut dyn common::Delegate>,
6485    _additional_params: HashMap<String, String>,
6486    _scopes: BTreeSet<String>,
6487}
6488
6489impl<'a, C> common::CallBuilder for ProjectLocationChannelGetIamPolicyCall<'a, C> {}
6490
6491impl<'a, C> ProjectLocationChannelGetIamPolicyCall<'a, C>
6492where
6493    C: common::Connector,
6494{
6495    /// Perform the operation you have build so far.
6496    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6497        use std::borrow::Cow;
6498        use std::io::{Read, Seek};
6499
6500        use common::{url::Params, ToParts};
6501        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6502
6503        let mut dd = common::DefaultDelegate;
6504        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6505        dlg.begin(common::MethodInfo {
6506            id: "eventarc.projects.locations.channels.getIamPolicy",
6507            http_method: hyper::Method::GET,
6508        });
6509
6510        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
6511            if self._additional_params.contains_key(field) {
6512                dlg.finished(false);
6513                return Err(common::Error::FieldClash(field));
6514            }
6515        }
6516
6517        let mut params = Params::with_capacity(4 + self._additional_params.len());
6518        params.push("resource", self._resource);
6519        if let Some(value) = self._options_requested_policy_version.as_ref() {
6520            params.push("options.requestedPolicyVersion", value.to_string());
6521        }
6522
6523        params.extend(self._additional_params.iter());
6524
6525        params.push("alt", "json");
6526        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
6527        if self._scopes.is_empty() {
6528            self._scopes
6529                .insert(Scope::CloudPlatform.as_ref().to_string());
6530        }
6531
6532        #[allow(clippy::single_element_loop)]
6533        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6534            url = params.uri_replacement(url, param_name, find_this, true);
6535        }
6536        {
6537            let to_remove = ["resource"];
6538            params.remove_params(&to_remove);
6539        }
6540
6541        let url = params.parse_with_url(&url);
6542
6543        loop {
6544            let token = match self
6545                .hub
6546                .auth
6547                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6548                .await
6549            {
6550                Ok(token) => token,
6551                Err(e) => match dlg.token(e) {
6552                    Ok(token) => token,
6553                    Err(e) => {
6554                        dlg.finished(false);
6555                        return Err(common::Error::MissingToken(e));
6556                    }
6557                },
6558            };
6559            let mut req_result = {
6560                let client = &self.hub.client;
6561                dlg.pre_request();
6562                let mut req_builder = hyper::Request::builder()
6563                    .method(hyper::Method::GET)
6564                    .uri(url.as_str())
6565                    .header(USER_AGENT, self.hub._user_agent.clone());
6566
6567                if let Some(token) = token.as_ref() {
6568                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6569                }
6570
6571                let request = req_builder
6572                    .header(CONTENT_LENGTH, 0_u64)
6573                    .body(common::to_body::<String>(None));
6574
6575                client.request(request.unwrap()).await
6576            };
6577
6578            match req_result {
6579                Err(err) => {
6580                    if let common::Retry::After(d) = dlg.http_error(&err) {
6581                        sleep(d).await;
6582                        continue;
6583                    }
6584                    dlg.finished(false);
6585                    return Err(common::Error::HttpError(err));
6586                }
6587                Ok(res) => {
6588                    let (mut parts, body) = res.into_parts();
6589                    let mut body = common::Body::new(body);
6590                    if !parts.status.is_success() {
6591                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6592                        let error = serde_json::from_str(&common::to_string(&bytes));
6593                        let response = common::to_response(parts, bytes.into());
6594
6595                        if let common::Retry::After(d) =
6596                            dlg.http_failure(&response, error.as_ref().ok())
6597                        {
6598                            sleep(d).await;
6599                            continue;
6600                        }
6601
6602                        dlg.finished(false);
6603
6604                        return Err(match error {
6605                            Ok(value) => common::Error::BadRequest(value),
6606                            _ => common::Error::Failure(response),
6607                        });
6608                    }
6609                    let response = {
6610                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6611                        let encoded = common::to_string(&bytes);
6612                        match serde_json::from_str(&encoded) {
6613                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6614                            Err(error) => {
6615                                dlg.response_json_decode_error(&encoded, &error);
6616                                return Err(common::Error::JsonDecodeError(
6617                                    encoded.to_string(),
6618                                    error,
6619                                ));
6620                            }
6621                        }
6622                    };
6623
6624                    dlg.finished(true);
6625                    return Ok(response);
6626                }
6627            }
6628        }
6629    }
6630
6631    /// 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.
6632    ///
6633    /// Sets the *resource* path property to the given value.
6634    ///
6635    /// Even though the property as already been set when instantiating this call,
6636    /// we provide this method for API completeness.
6637    pub fn resource(mut self, new_value: &str) -> ProjectLocationChannelGetIamPolicyCall<'a, C> {
6638        self._resource = new_value.to_string();
6639        self
6640    }
6641    /// 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).
6642    ///
6643    /// Sets the *options.requested policy version* query property to the given value.
6644    pub fn options_requested_policy_version(
6645        mut self,
6646        new_value: i32,
6647    ) -> ProjectLocationChannelGetIamPolicyCall<'a, C> {
6648        self._options_requested_policy_version = Some(new_value);
6649        self
6650    }
6651    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6652    /// while executing the actual API request.
6653    ///
6654    /// ````text
6655    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6656    /// ````
6657    ///
6658    /// Sets the *delegate* property to the given value.
6659    pub fn delegate(
6660        mut self,
6661        new_value: &'a mut dyn common::Delegate,
6662    ) -> ProjectLocationChannelGetIamPolicyCall<'a, C> {
6663        self._delegate = Some(new_value);
6664        self
6665    }
6666
6667    /// Set any additional parameter of the query string used in the request.
6668    /// It should be used to set parameters which are not yet available through their own
6669    /// setters.
6670    ///
6671    /// Please note that this method must not be used to set any of the known parameters
6672    /// which have their own setter method. If done anyway, the request will fail.
6673    ///
6674    /// # Additional Parameters
6675    ///
6676    /// * *$.xgafv* (query-string) - V1 error format.
6677    /// * *access_token* (query-string) - OAuth access token.
6678    /// * *alt* (query-string) - Data format for response.
6679    /// * *callback* (query-string) - JSONP
6680    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6681    /// * *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.
6682    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6683    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6684    /// * *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.
6685    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6686    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6687    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelGetIamPolicyCall<'a, C>
6688    where
6689        T: AsRef<str>,
6690    {
6691        self._additional_params
6692            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6693        self
6694    }
6695
6696    /// Identifies the authorization scope for the method you are building.
6697    ///
6698    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6699    /// [`Scope::CloudPlatform`].
6700    ///
6701    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6702    /// tokens for more than one scope.
6703    ///
6704    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6705    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6706    /// sufficient, a read-write scope will do as well.
6707    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelGetIamPolicyCall<'a, C>
6708    where
6709        St: AsRef<str>,
6710    {
6711        self._scopes.insert(String::from(scope.as_ref()));
6712        self
6713    }
6714    /// Identifies the authorization scope(s) for the method you are building.
6715    ///
6716    /// See [`Self::add_scope()`] for details.
6717    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelGetIamPolicyCall<'a, C>
6718    where
6719        I: IntoIterator<Item = St>,
6720        St: AsRef<str>,
6721    {
6722        self._scopes
6723            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6724        self
6725    }
6726
6727    /// Removes all scopes, and no default scope will be used either.
6728    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6729    /// for details).
6730    pub fn clear_scopes(mut self) -> ProjectLocationChannelGetIamPolicyCall<'a, C> {
6731        self._scopes.clear();
6732        self
6733    }
6734}
6735
6736/// List channels.
6737///
6738/// A builder for the *locations.channels.list* method supported by a *project* resource.
6739/// It is not used directly, but through a [`ProjectMethods`] instance.
6740///
6741/// # Example
6742///
6743/// Instantiate a resource method builder
6744///
6745/// ```test_harness,no_run
6746/// # extern crate hyper;
6747/// # extern crate hyper_rustls;
6748/// # extern crate google_eventarc1 as eventarc1;
6749/// # async fn dox() {
6750/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6751///
6752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6753/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6754/// #     .with_native_roots()
6755/// #     .unwrap()
6756/// #     .https_only()
6757/// #     .enable_http2()
6758/// #     .build();
6759///
6760/// # let executor = hyper_util::rt::TokioExecutor::new();
6761/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6762/// #     secret,
6763/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6764/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6765/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6766/// #     ),
6767/// # ).build().await.unwrap();
6768///
6769/// # let client = hyper_util::client::legacy::Client::builder(
6770/// #     hyper_util::rt::TokioExecutor::new()
6771/// # )
6772/// # .build(
6773/// #     hyper_rustls::HttpsConnectorBuilder::new()
6774/// #         .with_native_roots()
6775/// #         .unwrap()
6776/// #         .https_or_http()
6777/// #         .enable_http2()
6778/// #         .build()
6779/// # );
6780/// # let mut hub = Eventarc::new(client, auth);
6781/// // You can configure optional parameters by calling the respective setters at will, and
6782/// // execute the final call using `doit()`.
6783/// // Values shown here are possibly random and not representative !
6784/// let result = hub.projects().locations_channels_list("parent")
6785///              .page_token("labore")
6786///              .page_size(-43)
6787///              .order_by("duo")
6788///              .doit().await;
6789/// # }
6790/// ```
6791pub struct ProjectLocationChannelListCall<'a, C>
6792where
6793    C: 'a,
6794{
6795    hub: &'a Eventarc<C>,
6796    _parent: String,
6797    _page_token: Option<String>,
6798    _page_size: Option<i32>,
6799    _order_by: Option<String>,
6800    _delegate: Option<&'a mut dyn common::Delegate>,
6801    _additional_params: HashMap<String, String>,
6802    _scopes: BTreeSet<String>,
6803}
6804
6805impl<'a, C> common::CallBuilder for ProjectLocationChannelListCall<'a, C> {}
6806
6807impl<'a, C> ProjectLocationChannelListCall<'a, C>
6808where
6809    C: common::Connector,
6810{
6811    /// Perform the operation you have build so far.
6812    pub async fn doit(mut self) -> common::Result<(common::Response, ListChannelsResponse)> {
6813        use std::borrow::Cow;
6814        use std::io::{Read, Seek};
6815
6816        use common::{url::Params, ToParts};
6817        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6818
6819        let mut dd = common::DefaultDelegate;
6820        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6821        dlg.begin(common::MethodInfo {
6822            id: "eventarc.projects.locations.channels.list",
6823            http_method: hyper::Method::GET,
6824        });
6825
6826        for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy"].iter() {
6827            if self._additional_params.contains_key(field) {
6828                dlg.finished(false);
6829                return Err(common::Error::FieldClash(field));
6830            }
6831        }
6832
6833        let mut params = Params::with_capacity(6 + self._additional_params.len());
6834        params.push("parent", self._parent);
6835        if let Some(value) = self._page_token.as_ref() {
6836            params.push("pageToken", value);
6837        }
6838        if let Some(value) = self._page_size.as_ref() {
6839            params.push("pageSize", value.to_string());
6840        }
6841        if let Some(value) = self._order_by.as_ref() {
6842            params.push("orderBy", value);
6843        }
6844
6845        params.extend(self._additional_params.iter());
6846
6847        params.push("alt", "json");
6848        let mut url = self.hub._base_url.clone() + "v1/{+parent}/channels";
6849        if self._scopes.is_empty() {
6850            self._scopes
6851                .insert(Scope::CloudPlatform.as_ref().to_string());
6852        }
6853
6854        #[allow(clippy::single_element_loop)]
6855        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6856            url = params.uri_replacement(url, param_name, find_this, true);
6857        }
6858        {
6859            let to_remove = ["parent"];
6860            params.remove_params(&to_remove);
6861        }
6862
6863        let url = params.parse_with_url(&url);
6864
6865        loop {
6866            let token = match self
6867                .hub
6868                .auth
6869                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6870                .await
6871            {
6872                Ok(token) => token,
6873                Err(e) => match dlg.token(e) {
6874                    Ok(token) => token,
6875                    Err(e) => {
6876                        dlg.finished(false);
6877                        return Err(common::Error::MissingToken(e));
6878                    }
6879                },
6880            };
6881            let mut req_result = {
6882                let client = &self.hub.client;
6883                dlg.pre_request();
6884                let mut req_builder = hyper::Request::builder()
6885                    .method(hyper::Method::GET)
6886                    .uri(url.as_str())
6887                    .header(USER_AGENT, self.hub._user_agent.clone());
6888
6889                if let Some(token) = token.as_ref() {
6890                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6891                }
6892
6893                let request = req_builder
6894                    .header(CONTENT_LENGTH, 0_u64)
6895                    .body(common::to_body::<String>(None));
6896
6897                client.request(request.unwrap()).await
6898            };
6899
6900            match req_result {
6901                Err(err) => {
6902                    if let common::Retry::After(d) = dlg.http_error(&err) {
6903                        sleep(d).await;
6904                        continue;
6905                    }
6906                    dlg.finished(false);
6907                    return Err(common::Error::HttpError(err));
6908                }
6909                Ok(res) => {
6910                    let (mut parts, body) = res.into_parts();
6911                    let mut body = common::Body::new(body);
6912                    if !parts.status.is_success() {
6913                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6914                        let error = serde_json::from_str(&common::to_string(&bytes));
6915                        let response = common::to_response(parts, bytes.into());
6916
6917                        if let common::Retry::After(d) =
6918                            dlg.http_failure(&response, error.as_ref().ok())
6919                        {
6920                            sleep(d).await;
6921                            continue;
6922                        }
6923
6924                        dlg.finished(false);
6925
6926                        return Err(match error {
6927                            Ok(value) => common::Error::BadRequest(value),
6928                            _ => common::Error::Failure(response),
6929                        });
6930                    }
6931                    let response = {
6932                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6933                        let encoded = common::to_string(&bytes);
6934                        match serde_json::from_str(&encoded) {
6935                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6936                            Err(error) => {
6937                                dlg.response_json_decode_error(&encoded, &error);
6938                                return Err(common::Error::JsonDecodeError(
6939                                    encoded.to_string(),
6940                                    error,
6941                                ));
6942                            }
6943                        }
6944                    };
6945
6946                    dlg.finished(true);
6947                    return Ok(response);
6948                }
6949            }
6950        }
6951    }
6952
6953    /// Required. The parent collection to list channels on.
6954    ///
6955    /// Sets the *parent* path property to the given value.
6956    ///
6957    /// Even though the property as already been set when instantiating this call,
6958    /// we provide this method for API completeness.
6959    pub fn parent(mut self, new_value: &str) -> ProjectLocationChannelListCall<'a, C> {
6960        self._parent = new_value.to_string();
6961        self
6962    }
6963    /// The page token; provide the value from the `next_page_token` field in a previous `ListChannels` call to retrieve the subsequent page. When paginating, all other parameters provided to `ListChannels` must match the call that provided the page token.
6964    ///
6965    /// Sets the *page token* query property to the given value.
6966    pub fn page_token(mut self, new_value: &str) -> ProjectLocationChannelListCall<'a, C> {
6967        self._page_token = Some(new_value.to_string());
6968        self
6969    }
6970    /// The maximum number of channels to return on each page. Note: The service may send fewer.
6971    ///
6972    /// Sets the *page size* query property to the given value.
6973    pub fn page_size(mut self, new_value: i32) -> ProjectLocationChannelListCall<'a, C> {
6974        self._page_size = Some(new_value);
6975        self
6976    }
6977    /// The sorting order of the resources returned. Value should be a comma-separated list of fields. The default sorting order is ascending. To specify descending order for a field, append a `desc` suffix; for example: `name desc, channel_id`.
6978    ///
6979    /// Sets the *order by* query property to the given value.
6980    pub fn order_by(mut self, new_value: &str) -> ProjectLocationChannelListCall<'a, C> {
6981        self._order_by = Some(new_value.to_string());
6982        self
6983    }
6984    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6985    /// while executing the actual API request.
6986    ///
6987    /// ````text
6988    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6989    /// ````
6990    ///
6991    /// Sets the *delegate* property to the given value.
6992    pub fn delegate(
6993        mut self,
6994        new_value: &'a mut dyn common::Delegate,
6995    ) -> ProjectLocationChannelListCall<'a, C> {
6996        self._delegate = Some(new_value);
6997        self
6998    }
6999
7000    /// Set any additional parameter of the query string used in the request.
7001    /// It should be used to set parameters which are not yet available through their own
7002    /// setters.
7003    ///
7004    /// Please note that this method must not be used to set any of the known parameters
7005    /// which have their own setter method. If done anyway, the request will fail.
7006    ///
7007    /// # Additional Parameters
7008    ///
7009    /// * *$.xgafv* (query-string) - V1 error format.
7010    /// * *access_token* (query-string) - OAuth access token.
7011    /// * *alt* (query-string) - Data format for response.
7012    /// * *callback* (query-string) - JSONP
7013    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7014    /// * *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.
7015    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7016    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7017    /// * *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.
7018    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7019    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7020    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelListCall<'a, C>
7021    where
7022        T: AsRef<str>,
7023    {
7024        self._additional_params
7025            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7026        self
7027    }
7028
7029    /// Identifies the authorization scope for the method you are building.
7030    ///
7031    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7032    /// [`Scope::CloudPlatform`].
7033    ///
7034    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7035    /// tokens for more than one scope.
7036    ///
7037    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7038    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7039    /// sufficient, a read-write scope will do as well.
7040    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelListCall<'a, C>
7041    where
7042        St: AsRef<str>,
7043    {
7044        self._scopes.insert(String::from(scope.as_ref()));
7045        self
7046    }
7047    /// Identifies the authorization scope(s) for the method you are building.
7048    ///
7049    /// See [`Self::add_scope()`] for details.
7050    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelListCall<'a, C>
7051    where
7052        I: IntoIterator<Item = St>,
7053        St: AsRef<str>,
7054    {
7055        self._scopes
7056            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7057        self
7058    }
7059
7060    /// Removes all scopes, and no default scope will be used either.
7061    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7062    /// for details).
7063    pub fn clear_scopes(mut self) -> ProjectLocationChannelListCall<'a, C> {
7064        self._scopes.clear();
7065        self
7066    }
7067}
7068
7069/// Update a single channel.
7070///
7071/// A builder for the *locations.channels.patch* method supported by a *project* resource.
7072/// It is not used directly, but through a [`ProjectMethods`] instance.
7073///
7074/// # Example
7075///
7076/// Instantiate a resource method builder
7077///
7078/// ```test_harness,no_run
7079/// # extern crate hyper;
7080/// # extern crate hyper_rustls;
7081/// # extern crate google_eventarc1 as eventarc1;
7082/// use eventarc1::api::Channel;
7083/// # async fn dox() {
7084/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7085///
7086/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7087/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7088/// #     .with_native_roots()
7089/// #     .unwrap()
7090/// #     .https_only()
7091/// #     .enable_http2()
7092/// #     .build();
7093///
7094/// # let executor = hyper_util::rt::TokioExecutor::new();
7095/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7096/// #     secret,
7097/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7098/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7099/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7100/// #     ),
7101/// # ).build().await.unwrap();
7102///
7103/// # let client = hyper_util::client::legacy::Client::builder(
7104/// #     hyper_util::rt::TokioExecutor::new()
7105/// # )
7106/// # .build(
7107/// #     hyper_rustls::HttpsConnectorBuilder::new()
7108/// #         .with_native_roots()
7109/// #         .unwrap()
7110/// #         .https_or_http()
7111/// #         .enable_http2()
7112/// #         .build()
7113/// # );
7114/// # let mut hub = Eventarc::new(client, auth);
7115/// // As the method needs a request, you would usually fill it with the desired information
7116/// // into the respective structure. Some of the parts shown here might not be applicable !
7117/// // Values shown here are possibly random and not representative !
7118/// let mut req = Channel::default();
7119///
7120/// // You can configure optional parameters by calling the respective setters at will, and
7121/// // execute the final call using `doit()`.
7122/// // Values shown here are possibly random and not representative !
7123/// let result = hub.projects().locations_channels_patch(req, "name")
7124///              .validate_only(true)
7125///              .update_mask(FieldMask::new::<&str>(&[]))
7126///              .doit().await;
7127/// # }
7128/// ```
7129pub struct ProjectLocationChannelPatchCall<'a, C>
7130where
7131    C: 'a,
7132{
7133    hub: &'a Eventarc<C>,
7134    _request: Channel,
7135    _name: String,
7136    _validate_only: Option<bool>,
7137    _update_mask: Option<common::FieldMask>,
7138    _delegate: Option<&'a mut dyn common::Delegate>,
7139    _additional_params: HashMap<String, String>,
7140    _scopes: BTreeSet<String>,
7141}
7142
7143impl<'a, C> common::CallBuilder for ProjectLocationChannelPatchCall<'a, C> {}
7144
7145impl<'a, C> ProjectLocationChannelPatchCall<'a, C>
7146where
7147    C: common::Connector,
7148{
7149    /// Perform the operation you have build so far.
7150    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
7151        use std::borrow::Cow;
7152        use std::io::{Read, Seek};
7153
7154        use common::{url::Params, ToParts};
7155        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7156
7157        let mut dd = common::DefaultDelegate;
7158        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7159        dlg.begin(common::MethodInfo {
7160            id: "eventarc.projects.locations.channels.patch",
7161            http_method: hyper::Method::PATCH,
7162        });
7163
7164        for &field in ["alt", "name", "validateOnly", "updateMask"].iter() {
7165            if self._additional_params.contains_key(field) {
7166                dlg.finished(false);
7167                return Err(common::Error::FieldClash(field));
7168            }
7169        }
7170
7171        let mut params = Params::with_capacity(6 + self._additional_params.len());
7172        params.push("name", self._name);
7173        if let Some(value) = self._validate_only.as_ref() {
7174            params.push("validateOnly", value.to_string());
7175        }
7176        if let Some(value) = self._update_mask.as_ref() {
7177            params.push("updateMask", value.to_string());
7178        }
7179
7180        params.extend(self._additional_params.iter());
7181
7182        params.push("alt", "json");
7183        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7184        if self._scopes.is_empty() {
7185            self._scopes
7186                .insert(Scope::CloudPlatform.as_ref().to_string());
7187        }
7188
7189        #[allow(clippy::single_element_loop)]
7190        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7191            url = params.uri_replacement(url, param_name, find_this, true);
7192        }
7193        {
7194            let to_remove = ["name"];
7195            params.remove_params(&to_remove);
7196        }
7197
7198        let url = params.parse_with_url(&url);
7199
7200        let mut json_mime_type = mime::APPLICATION_JSON;
7201        let mut request_value_reader = {
7202            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7203            common::remove_json_null_values(&mut value);
7204            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7205            serde_json::to_writer(&mut dst, &value).unwrap();
7206            dst
7207        };
7208        let request_size = request_value_reader
7209            .seek(std::io::SeekFrom::End(0))
7210            .unwrap();
7211        request_value_reader
7212            .seek(std::io::SeekFrom::Start(0))
7213            .unwrap();
7214
7215        loop {
7216            let token = match self
7217                .hub
7218                .auth
7219                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7220                .await
7221            {
7222                Ok(token) => token,
7223                Err(e) => match dlg.token(e) {
7224                    Ok(token) => token,
7225                    Err(e) => {
7226                        dlg.finished(false);
7227                        return Err(common::Error::MissingToken(e));
7228                    }
7229                },
7230            };
7231            request_value_reader
7232                .seek(std::io::SeekFrom::Start(0))
7233                .unwrap();
7234            let mut req_result = {
7235                let client = &self.hub.client;
7236                dlg.pre_request();
7237                let mut req_builder = hyper::Request::builder()
7238                    .method(hyper::Method::PATCH)
7239                    .uri(url.as_str())
7240                    .header(USER_AGENT, self.hub._user_agent.clone());
7241
7242                if let Some(token) = token.as_ref() {
7243                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7244                }
7245
7246                let request = req_builder
7247                    .header(CONTENT_TYPE, json_mime_type.to_string())
7248                    .header(CONTENT_LENGTH, request_size as u64)
7249                    .body(common::to_body(
7250                        request_value_reader.get_ref().clone().into(),
7251                    ));
7252
7253                client.request(request.unwrap()).await
7254            };
7255
7256            match req_result {
7257                Err(err) => {
7258                    if let common::Retry::After(d) = dlg.http_error(&err) {
7259                        sleep(d).await;
7260                        continue;
7261                    }
7262                    dlg.finished(false);
7263                    return Err(common::Error::HttpError(err));
7264                }
7265                Ok(res) => {
7266                    let (mut parts, body) = res.into_parts();
7267                    let mut body = common::Body::new(body);
7268                    if !parts.status.is_success() {
7269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7270                        let error = serde_json::from_str(&common::to_string(&bytes));
7271                        let response = common::to_response(parts, bytes.into());
7272
7273                        if let common::Retry::After(d) =
7274                            dlg.http_failure(&response, error.as_ref().ok())
7275                        {
7276                            sleep(d).await;
7277                            continue;
7278                        }
7279
7280                        dlg.finished(false);
7281
7282                        return Err(match error {
7283                            Ok(value) => common::Error::BadRequest(value),
7284                            _ => common::Error::Failure(response),
7285                        });
7286                    }
7287                    let response = {
7288                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7289                        let encoded = common::to_string(&bytes);
7290                        match serde_json::from_str(&encoded) {
7291                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7292                            Err(error) => {
7293                                dlg.response_json_decode_error(&encoded, &error);
7294                                return Err(common::Error::JsonDecodeError(
7295                                    encoded.to_string(),
7296                                    error,
7297                                ));
7298                            }
7299                        }
7300                    };
7301
7302                    dlg.finished(true);
7303                    return Ok(response);
7304                }
7305            }
7306        }
7307    }
7308
7309    ///
7310    /// Sets the *request* property to the given value.
7311    ///
7312    /// Even though the property as already been set when instantiating this call,
7313    /// we provide this method for API completeness.
7314    pub fn request(mut self, new_value: Channel) -> ProjectLocationChannelPatchCall<'a, C> {
7315        self._request = new_value;
7316        self
7317    }
7318    /// Required. The resource name of the channel. Must be unique within the location on the project and must be in `projects/{project}/locations/{location}/channels/{channel_id}` format.
7319    ///
7320    /// Sets the *name* path property to the given value.
7321    ///
7322    /// Even though the property as already been set when instantiating this call,
7323    /// we provide this method for API completeness.
7324    pub fn name(mut self, new_value: &str) -> ProjectLocationChannelPatchCall<'a, C> {
7325        self._name = new_value.to_string();
7326        self
7327    }
7328    /// Optional. If set, validate the request and preview the review, but do not post it.
7329    ///
7330    /// Sets the *validate only* query property to the given value.
7331    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationChannelPatchCall<'a, C> {
7332        self._validate_only = Some(new_value);
7333        self
7334    }
7335    /// The fields to be updated; only fields explicitly provided are updated. If no field mask is provided, all provided fields in the request are updated. To update all fields, provide a field mask of "*".
7336    ///
7337    /// Sets the *update mask* query property to the given value.
7338    pub fn update_mask(
7339        mut self,
7340        new_value: common::FieldMask,
7341    ) -> ProjectLocationChannelPatchCall<'a, C> {
7342        self._update_mask = Some(new_value);
7343        self
7344    }
7345    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7346    /// while executing the actual API request.
7347    ///
7348    /// ````text
7349    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7350    /// ````
7351    ///
7352    /// Sets the *delegate* property to the given value.
7353    pub fn delegate(
7354        mut self,
7355        new_value: &'a mut dyn common::Delegate,
7356    ) -> ProjectLocationChannelPatchCall<'a, C> {
7357        self._delegate = Some(new_value);
7358        self
7359    }
7360
7361    /// Set any additional parameter of the query string used in the request.
7362    /// It should be used to set parameters which are not yet available through their own
7363    /// setters.
7364    ///
7365    /// Please note that this method must not be used to set any of the known parameters
7366    /// which have their own setter method. If done anyway, the request will fail.
7367    ///
7368    /// # Additional Parameters
7369    ///
7370    /// * *$.xgafv* (query-string) - V1 error format.
7371    /// * *access_token* (query-string) - OAuth access token.
7372    /// * *alt* (query-string) - Data format for response.
7373    /// * *callback* (query-string) - JSONP
7374    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7375    /// * *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.
7376    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7377    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7378    /// * *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.
7379    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7380    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7381    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelPatchCall<'a, C>
7382    where
7383        T: AsRef<str>,
7384    {
7385        self._additional_params
7386            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7387        self
7388    }
7389
7390    /// Identifies the authorization scope for the method you are building.
7391    ///
7392    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7393    /// [`Scope::CloudPlatform`].
7394    ///
7395    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7396    /// tokens for more than one scope.
7397    ///
7398    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7399    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7400    /// sufficient, a read-write scope will do as well.
7401    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelPatchCall<'a, C>
7402    where
7403        St: AsRef<str>,
7404    {
7405        self._scopes.insert(String::from(scope.as_ref()));
7406        self
7407    }
7408    /// Identifies the authorization scope(s) for the method you are building.
7409    ///
7410    /// See [`Self::add_scope()`] for details.
7411    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelPatchCall<'a, C>
7412    where
7413        I: IntoIterator<Item = St>,
7414        St: AsRef<str>,
7415    {
7416        self._scopes
7417            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7418        self
7419    }
7420
7421    /// Removes all scopes, and no default scope will be used either.
7422    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7423    /// for details).
7424    pub fn clear_scopes(mut self) -> ProjectLocationChannelPatchCall<'a, C> {
7425        self._scopes.clear();
7426        self
7427    }
7428}
7429
7430/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
7431///
7432/// A builder for the *locations.channels.setIamPolicy* method supported by a *project* resource.
7433/// It is not used directly, but through a [`ProjectMethods`] instance.
7434///
7435/// # Example
7436///
7437/// Instantiate a resource method builder
7438///
7439/// ```test_harness,no_run
7440/// # extern crate hyper;
7441/// # extern crate hyper_rustls;
7442/// # extern crate google_eventarc1 as eventarc1;
7443/// use eventarc1::api::SetIamPolicyRequest;
7444/// # async fn dox() {
7445/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7446///
7447/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7448/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7449/// #     .with_native_roots()
7450/// #     .unwrap()
7451/// #     .https_only()
7452/// #     .enable_http2()
7453/// #     .build();
7454///
7455/// # let executor = hyper_util::rt::TokioExecutor::new();
7456/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7457/// #     secret,
7458/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7459/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7460/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7461/// #     ),
7462/// # ).build().await.unwrap();
7463///
7464/// # let client = hyper_util::client::legacy::Client::builder(
7465/// #     hyper_util::rt::TokioExecutor::new()
7466/// # )
7467/// # .build(
7468/// #     hyper_rustls::HttpsConnectorBuilder::new()
7469/// #         .with_native_roots()
7470/// #         .unwrap()
7471/// #         .https_or_http()
7472/// #         .enable_http2()
7473/// #         .build()
7474/// # );
7475/// # let mut hub = Eventarc::new(client, auth);
7476/// // As the method needs a request, you would usually fill it with the desired information
7477/// // into the respective structure. Some of the parts shown here might not be applicable !
7478/// // Values shown here are possibly random and not representative !
7479/// let mut req = SetIamPolicyRequest::default();
7480///
7481/// // You can configure optional parameters by calling the respective setters at will, and
7482/// // execute the final call using `doit()`.
7483/// // Values shown here are possibly random and not representative !
7484/// let result = hub.projects().locations_channels_set_iam_policy(req, "resource")
7485///              .doit().await;
7486/// # }
7487/// ```
7488pub struct ProjectLocationChannelSetIamPolicyCall<'a, C>
7489where
7490    C: 'a,
7491{
7492    hub: &'a Eventarc<C>,
7493    _request: SetIamPolicyRequest,
7494    _resource: String,
7495    _delegate: Option<&'a mut dyn common::Delegate>,
7496    _additional_params: HashMap<String, String>,
7497    _scopes: BTreeSet<String>,
7498}
7499
7500impl<'a, C> common::CallBuilder for ProjectLocationChannelSetIamPolicyCall<'a, C> {}
7501
7502impl<'a, C> ProjectLocationChannelSetIamPolicyCall<'a, C>
7503where
7504    C: common::Connector,
7505{
7506    /// Perform the operation you have build so far.
7507    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7508        use std::borrow::Cow;
7509        use std::io::{Read, Seek};
7510
7511        use common::{url::Params, ToParts};
7512        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7513
7514        let mut dd = common::DefaultDelegate;
7515        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7516        dlg.begin(common::MethodInfo {
7517            id: "eventarc.projects.locations.channels.setIamPolicy",
7518            http_method: hyper::Method::POST,
7519        });
7520
7521        for &field in ["alt", "resource"].iter() {
7522            if self._additional_params.contains_key(field) {
7523                dlg.finished(false);
7524                return Err(common::Error::FieldClash(field));
7525            }
7526        }
7527
7528        let mut params = Params::with_capacity(4 + self._additional_params.len());
7529        params.push("resource", self._resource);
7530
7531        params.extend(self._additional_params.iter());
7532
7533        params.push("alt", "json");
7534        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
7535        if self._scopes.is_empty() {
7536            self._scopes
7537                .insert(Scope::CloudPlatform.as_ref().to_string());
7538        }
7539
7540        #[allow(clippy::single_element_loop)]
7541        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7542            url = params.uri_replacement(url, param_name, find_this, true);
7543        }
7544        {
7545            let to_remove = ["resource"];
7546            params.remove_params(&to_remove);
7547        }
7548
7549        let url = params.parse_with_url(&url);
7550
7551        let mut json_mime_type = mime::APPLICATION_JSON;
7552        let mut request_value_reader = {
7553            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7554            common::remove_json_null_values(&mut value);
7555            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7556            serde_json::to_writer(&mut dst, &value).unwrap();
7557            dst
7558        };
7559        let request_size = request_value_reader
7560            .seek(std::io::SeekFrom::End(0))
7561            .unwrap();
7562        request_value_reader
7563            .seek(std::io::SeekFrom::Start(0))
7564            .unwrap();
7565
7566        loop {
7567            let token = match self
7568                .hub
7569                .auth
7570                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7571                .await
7572            {
7573                Ok(token) => token,
7574                Err(e) => match dlg.token(e) {
7575                    Ok(token) => token,
7576                    Err(e) => {
7577                        dlg.finished(false);
7578                        return Err(common::Error::MissingToken(e));
7579                    }
7580                },
7581            };
7582            request_value_reader
7583                .seek(std::io::SeekFrom::Start(0))
7584                .unwrap();
7585            let mut req_result = {
7586                let client = &self.hub.client;
7587                dlg.pre_request();
7588                let mut req_builder = hyper::Request::builder()
7589                    .method(hyper::Method::POST)
7590                    .uri(url.as_str())
7591                    .header(USER_AGENT, self.hub._user_agent.clone());
7592
7593                if let Some(token) = token.as_ref() {
7594                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7595                }
7596
7597                let request = req_builder
7598                    .header(CONTENT_TYPE, json_mime_type.to_string())
7599                    .header(CONTENT_LENGTH, request_size as u64)
7600                    .body(common::to_body(
7601                        request_value_reader.get_ref().clone().into(),
7602                    ));
7603
7604                client.request(request.unwrap()).await
7605            };
7606
7607            match req_result {
7608                Err(err) => {
7609                    if let common::Retry::After(d) = dlg.http_error(&err) {
7610                        sleep(d).await;
7611                        continue;
7612                    }
7613                    dlg.finished(false);
7614                    return Err(common::Error::HttpError(err));
7615                }
7616                Ok(res) => {
7617                    let (mut parts, body) = res.into_parts();
7618                    let mut body = common::Body::new(body);
7619                    if !parts.status.is_success() {
7620                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7621                        let error = serde_json::from_str(&common::to_string(&bytes));
7622                        let response = common::to_response(parts, bytes.into());
7623
7624                        if let common::Retry::After(d) =
7625                            dlg.http_failure(&response, error.as_ref().ok())
7626                        {
7627                            sleep(d).await;
7628                            continue;
7629                        }
7630
7631                        dlg.finished(false);
7632
7633                        return Err(match error {
7634                            Ok(value) => common::Error::BadRequest(value),
7635                            _ => common::Error::Failure(response),
7636                        });
7637                    }
7638                    let response = {
7639                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7640                        let encoded = common::to_string(&bytes);
7641                        match serde_json::from_str(&encoded) {
7642                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7643                            Err(error) => {
7644                                dlg.response_json_decode_error(&encoded, &error);
7645                                return Err(common::Error::JsonDecodeError(
7646                                    encoded.to_string(),
7647                                    error,
7648                                ));
7649                            }
7650                        }
7651                    };
7652
7653                    dlg.finished(true);
7654                    return Ok(response);
7655                }
7656            }
7657        }
7658    }
7659
7660    ///
7661    /// Sets the *request* property to the given value.
7662    ///
7663    /// Even though the property as already been set when instantiating this call,
7664    /// we provide this method for API completeness.
7665    pub fn request(
7666        mut self,
7667        new_value: SetIamPolicyRequest,
7668    ) -> ProjectLocationChannelSetIamPolicyCall<'a, C> {
7669        self._request = new_value;
7670        self
7671    }
7672    /// 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.
7673    ///
7674    /// Sets the *resource* path property to the given value.
7675    ///
7676    /// Even though the property as already been set when instantiating this call,
7677    /// we provide this method for API completeness.
7678    pub fn resource(mut self, new_value: &str) -> ProjectLocationChannelSetIamPolicyCall<'a, C> {
7679        self._resource = new_value.to_string();
7680        self
7681    }
7682    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7683    /// while executing the actual API request.
7684    ///
7685    /// ````text
7686    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7687    /// ````
7688    ///
7689    /// Sets the *delegate* property to the given value.
7690    pub fn delegate(
7691        mut self,
7692        new_value: &'a mut dyn common::Delegate,
7693    ) -> ProjectLocationChannelSetIamPolicyCall<'a, C> {
7694        self._delegate = Some(new_value);
7695        self
7696    }
7697
7698    /// Set any additional parameter of the query string used in the request.
7699    /// It should be used to set parameters which are not yet available through their own
7700    /// setters.
7701    ///
7702    /// Please note that this method must not be used to set any of the known parameters
7703    /// which have their own setter method. If done anyway, the request will fail.
7704    ///
7705    /// # Additional Parameters
7706    ///
7707    /// * *$.xgafv* (query-string) - V1 error format.
7708    /// * *access_token* (query-string) - OAuth access token.
7709    /// * *alt* (query-string) - Data format for response.
7710    /// * *callback* (query-string) - JSONP
7711    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7712    /// * *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.
7713    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7714    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7715    /// * *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.
7716    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7717    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7718    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationChannelSetIamPolicyCall<'a, C>
7719    where
7720        T: AsRef<str>,
7721    {
7722        self._additional_params
7723            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7724        self
7725    }
7726
7727    /// Identifies the authorization scope for the method you are building.
7728    ///
7729    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7730    /// [`Scope::CloudPlatform`].
7731    ///
7732    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7733    /// tokens for more than one scope.
7734    ///
7735    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7736    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7737    /// sufficient, a read-write scope will do as well.
7738    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelSetIamPolicyCall<'a, C>
7739    where
7740        St: AsRef<str>,
7741    {
7742        self._scopes.insert(String::from(scope.as_ref()));
7743        self
7744    }
7745    /// Identifies the authorization scope(s) for the method you are building.
7746    ///
7747    /// See [`Self::add_scope()`] for details.
7748    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationChannelSetIamPolicyCall<'a, C>
7749    where
7750        I: IntoIterator<Item = St>,
7751        St: AsRef<str>,
7752    {
7753        self._scopes
7754            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7755        self
7756    }
7757
7758    /// Removes all scopes, and no default scope will be used either.
7759    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7760    /// for details).
7761    pub fn clear_scopes(mut self) -> ProjectLocationChannelSetIamPolicyCall<'a, C> {
7762        self._scopes.clear();
7763        self
7764    }
7765}
7766
7767/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
7768///
7769/// A builder for the *locations.channels.testIamPermissions* method supported by a *project* resource.
7770/// It is not used directly, but through a [`ProjectMethods`] instance.
7771///
7772/// # Example
7773///
7774/// Instantiate a resource method builder
7775///
7776/// ```test_harness,no_run
7777/// # extern crate hyper;
7778/// # extern crate hyper_rustls;
7779/// # extern crate google_eventarc1 as eventarc1;
7780/// use eventarc1::api::TestIamPermissionsRequest;
7781/// # async fn dox() {
7782/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7783///
7784/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7785/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7786/// #     .with_native_roots()
7787/// #     .unwrap()
7788/// #     .https_only()
7789/// #     .enable_http2()
7790/// #     .build();
7791///
7792/// # let executor = hyper_util::rt::TokioExecutor::new();
7793/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7794/// #     secret,
7795/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7796/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7797/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7798/// #     ),
7799/// # ).build().await.unwrap();
7800///
7801/// # let client = hyper_util::client::legacy::Client::builder(
7802/// #     hyper_util::rt::TokioExecutor::new()
7803/// # )
7804/// # .build(
7805/// #     hyper_rustls::HttpsConnectorBuilder::new()
7806/// #         .with_native_roots()
7807/// #         .unwrap()
7808/// #         .https_or_http()
7809/// #         .enable_http2()
7810/// #         .build()
7811/// # );
7812/// # let mut hub = Eventarc::new(client, auth);
7813/// // As the method needs a request, you would usually fill it with the desired information
7814/// // into the respective structure. Some of the parts shown here might not be applicable !
7815/// // Values shown here are possibly random and not representative !
7816/// let mut req = TestIamPermissionsRequest::default();
7817///
7818/// // You can configure optional parameters by calling the respective setters at will, and
7819/// // execute the final call using `doit()`.
7820/// // Values shown here are possibly random and not representative !
7821/// let result = hub.projects().locations_channels_test_iam_permissions(req, "resource")
7822///              .doit().await;
7823/// # }
7824/// ```
7825pub struct ProjectLocationChannelTestIamPermissionCall<'a, C>
7826where
7827    C: 'a,
7828{
7829    hub: &'a Eventarc<C>,
7830    _request: TestIamPermissionsRequest,
7831    _resource: String,
7832    _delegate: Option<&'a mut dyn common::Delegate>,
7833    _additional_params: HashMap<String, String>,
7834    _scopes: BTreeSet<String>,
7835}
7836
7837impl<'a, C> common::CallBuilder for ProjectLocationChannelTestIamPermissionCall<'a, C> {}
7838
7839impl<'a, C> ProjectLocationChannelTestIamPermissionCall<'a, C>
7840where
7841    C: common::Connector,
7842{
7843    /// Perform the operation you have build so far.
7844    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
7845        use std::borrow::Cow;
7846        use std::io::{Read, Seek};
7847
7848        use common::{url::Params, ToParts};
7849        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7850
7851        let mut dd = common::DefaultDelegate;
7852        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7853        dlg.begin(common::MethodInfo {
7854            id: "eventarc.projects.locations.channels.testIamPermissions",
7855            http_method: hyper::Method::POST,
7856        });
7857
7858        for &field in ["alt", "resource"].iter() {
7859            if self._additional_params.contains_key(field) {
7860                dlg.finished(false);
7861                return Err(common::Error::FieldClash(field));
7862            }
7863        }
7864
7865        let mut params = Params::with_capacity(4 + self._additional_params.len());
7866        params.push("resource", self._resource);
7867
7868        params.extend(self._additional_params.iter());
7869
7870        params.push("alt", "json");
7871        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
7872        if self._scopes.is_empty() {
7873            self._scopes
7874                .insert(Scope::CloudPlatform.as_ref().to_string());
7875        }
7876
7877        #[allow(clippy::single_element_loop)]
7878        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7879            url = params.uri_replacement(url, param_name, find_this, true);
7880        }
7881        {
7882            let to_remove = ["resource"];
7883            params.remove_params(&to_remove);
7884        }
7885
7886        let url = params.parse_with_url(&url);
7887
7888        let mut json_mime_type = mime::APPLICATION_JSON;
7889        let mut request_value_reader = {
7890            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7891            common::remove_json_null_values(&mut value);
7892            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7893            serde_json::to_writer(&mut dst, &value).unwrap();
7894            dst
7895        };
7896        let request_size = request_value_reader
7897            .seek(std::io::SeekFrom::End(0))
7898            .unwrap();
7899        request_value_reader
7900            .seek(std::io::SeekFrom::Start(0))
7901            .unwrap();
7902
7903        loop {
7904            let token = match self
7905                .hub
7906                .auth
7907                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7908                .await
7909            {
7910                Ok(token) => token,
7911                Err(e) => match dlg.token(e) {
7912                    Ok(token) => token,
7913                    Err(e) => {
7914                        dlg.finished(false);
7915                        return Err(common::Error::MissingToken(e));
7916                    }
7917                },
7918            };
7919            request_value_reader
7920                .seek(std::io::SeekFrom::Start(0))
7921                .unwrap();
7922            let mut req_result = {
7923                let client = &self.hub.client;
7924                dlg.pre_request();
7925                let mut req_builder = hyper::Request::builder()
7926                    .method(hyper::Method::POST)
7927                    .uri(url.as_str())
7928                    .header(USER_AGENT, self.hub._user_agent.clone());
7929
7930                if let Some(token) = token.as_ref() {
7931                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7932                }
7933
7934                let request = req_builder
7935                    .header(CONTENT_TYPE, json_mime_type.to_string())
7936                    .header(CONTENT_LENGTH, request_size as u64)
7937                    .body(common::to_body(
7938                        request_value_reader.get_ref().clone().into(),
7939                    ));
7940
7941                client.request(request.unwrap()).await
7942            };
7943
7944            match req_result {
7945                Err(err) => {
7946                    if let common::Retry::After(d) = dlg.http_error(&err) {
7947                        sleep(d).await;
7948                        continue;
7949                    }
7950                    dlg.finished(false);
7951                    return Err(common::Error::HttpError(err));
7952                }
7953                Ok(res) => {
7954                    let (mut parts, body) = res.into_parts();
7955                    let mut body = common::Body::new(body);
7956                    if !parts.status.is_success() {
7957                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7958                        let error = serde_json::from_str(&common::to_string(&bytes));
7959                        let response = common::to_response(parts, bytes.into());
7960
7961                        if let common::Retry::After(d) =
7962                            dlg.http_failure(&response, error.as_ref().ok())
7963                        {
7964                            sleep(d).await;
7965                            continue;
7966                        }
7967
7968                        dlg.finished(false);
7969
7970                        return Err(match error {
7971                            Ok(value) => common::Error::BadRequest(value),
7972                            _ => common::Error::Failure(response),
7973                        });
7974                    }
7975                    let response = {
7976                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7977                        let encoded = common::to_string(&bytes);
7978                        match serde_json::from_str(&encoded) {
7979                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7980                            Err(error) => {
7981                                dlg.response_json_decode_error(&encoded, &error);
7982                                return Err(common::Error::JsonDecodeError(
7983                                    encoded.to_string(),
7984                                    error,
7985                                ));
7986                            }
7987                        }
7988                    };
7989
7990                    dlg.finished(true);
7991                    return Ok(response);
7992                }
7993            }
7994        }
7995    }
7996
7997    ///
7998    /// Sets the *request* property to the given value.
7999    ///
8000    /// Even though the property as already been set when instantiating this call,
8001    /// we provide this method for API completeness.
8002    pub fn request(
8003        mut self,
8004        new_value: TestIamPermissionsRequest,
8005    ) -> ProjectLocationChannelTestIamPermissionCall<'a, C> {
8006        self._request = new_value;
8007        self
8008    }
8009    /// 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.
8010    ///
8011    /// Sets the *resource* path property to the given value.
8012    ///
8013    /// Even though the property as already been set when instantiating this call,
8014    /// we provide this method for API completeness.
8015    pub fn resource(
8016        mut self,
8017        new_value: &str,
8018    ) -> ProjectLocationChannelTestIamPermissionCall<'a, C> {
8019        self._resource = new_value.to_string();
8020        self
8021    }
8022    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8023    /// while executing the actual API request.
8024    ///
8025    /// ````text
8026    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8027    /// ````
8028    ///
8029    /// Sets the *delegate* property to the given value.
8030    pub fn delegate(
8031        mut self,
8032        new_value: &'a mut dyn common::Delegate,
8033    ) -> ProjectLocationChannelTestIamPermissionCall<'a, C> {
8034        self._delegate = Some(new_value);
8035        self
8036    }
8037
8038    /// Set any additional parameter of the query string used in the request.
8039    /// It should be used to set parameters which are not yet available through their own
8040    /// setters.
8041    ///
8042    /// Please note that this method must not be used to set any of the known parameters
8043    /// which have their own setter method. If done anyway, the request will fail.
8044    ///
8045    /// # Additional Parameters
8046    ///
8047    /// * *$.xgafv* (query-string) - V1 error format.
8048    /// * *access_token* (query-string) - OAuth access token.
8049    /// * *alt* (query-string) - Data format for response.
8050    /// * *callback* (query-string) - JSONP
8051    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8052    /// * *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.
8053    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8054    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8055    /// * *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.
8056    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8057    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8058    pub fn param<T>(
8059        mut self,
8060        name: T,
8061        value: T,
8062    ) -> ProjectLocationChannelTestIamPermissionCall<'a, C>
8063    where
8064        T: AsRef<str>,
8065    {
8066        self._additional_params
8067            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8068        self
8069    }
8070
8071    /// Identifies the authorization scope for the method you are building.
8072    ///
8073    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8074    /// [`Scope::CloudPlatform`].
8075    ///
8076    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8077    /// tokens for more than one scope.
8078    ///
8079    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8080    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8081    /// sufficient, a read-write scope will do as well.
8082    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationChannelTestIamPermissionCall<'a, C>
8083    where
8084        St: AsRef<str>,
8085    {
8086        self._scopes.insert(String::from(scope.as_ref()));
8087        self
8088    }
8089    /// Identifies the authorization scope(s) for the method you are building.
8090    ///
8091    /// See [`Self::add_scope()`] for details.
8092    pub fn add_scopes<I, St>(
8093        mut self,
8094        scopes: I,
8095    ) -> ProjectLocationChannelTestIamPermissionCall<'a, C>
8096    where
8097        I: IntoIterator<Item = St>,
8098        St: AsRef<str>,
8099    {
8100        self._scopes
8101            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8102        self
8103    }
8104
8105    /// Removes all scopes, and no default scope will be used either.
8106    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8107    /// for details).
8108    pub fn clear_scopes(mut self) -> ProjectLocationChannelTestIamPermissionCall<'a, C> {
8109        self._scopes.clear();
8110        self
8111    }
8112}
8113
8114/// Create a new Enrollment in a particular project and location.
8115///
8116/// A builder for the *locations.enrollments.create* method supported by a *project* resource.
8117/// It is not used directly, but through a [`ProjectMethods`] instance.
8118///
8119/// # Example
8120///
8121/// Instantiate a resource method builder
8122///
8123/// ```test_harness,no_run
8124/// # extern crate hyper;
8125/// # extern crate hyper_rustls;
8126/// # extern crate google_eventarc1 as eventarc1;
8127/// use eventarc1::api::Enrollment;
8128/// # async fn dox() {
8129/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8130///
8131/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8132/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8133/// #     .with_native_roots()
8134/// #     .unwrap()
8135/// #     .https_only()
8136/// #     .enable_http2()
8137/// #     .build();
8138///
8139/// # let executor = hyper_util::rt::TokioExecutor::new();
8140/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8141/// #     secret,
8142/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8143/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8144/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8145/// #     ),
8146/// # ).build().await.unwrap();
8147///
8148/// # let client = hyper_util::client::legacy::Client::builder(
8149/// #     hyper_util::rt::TokioExecutor::new()
8150/// # )
8151/// # .build(
8152/// #     hyper_rustls::HttpsConnectorBuilder::new()
8153/// #         .with_native_roots()
8154/// #         .unwrap()
8155/// #         .https_or_http()
8156/// #         .enable_http2()
8157/// #         .build()
8158/// # );
8159/// # let mut hub = Eventarc::new(client, auth);
8160/// // As the method needs a request, you would usually fill it with the desired information
8161/// // into the respective structure. Some of the parts shown here might not be applicable !
8162/// // Values shown here are possibly random and not representative !
8163/// let mut req = Enrollment::default();
8164///
8165/// // You can configure optional parameters by calling the respective setters at will, and
8166/// // execute the final call using `doit()`.
8167/// // Values shown here are possibly random and not representative !
8168/// let result = hub.projects().locations_enrollments_create(req, "parent")
8169///              .validate_only(true)
8170///              .enrollment_id("et")
8171///              .doit().await;
8172/// # }
8173/// ```
8174pub struct ProjectLocationEnrollmentCreateCall<'a, C>
8175where
8176    C: 'a,
8177{
8178    hub: &'a Eventarc<C>,
8179    _request: Enrollment,
8180    _parent: String,
8181    _validate_only: Option<bool>,
8182    _enrollment_id: Option<String>,
8183    _delegate: Option<&'a mut dyn common::Delegate>,
8184    _additional_params: HashMap<String, String>,
8185    _scopes: BTreeSet<String>,
8186}
8187
8188impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentCreateCall<'a, C> {}
8189
8190impl<'a, C> ProjectLocationEnrollmentCreateCall<'a, C>
8191where
8192    C: common::Connector,
8193{
8194    /// Perform the operation you have build so far.
8195    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
8196        use std::borrow::Cow;
8197        use std::io::{Read, Seek};
8198
8199        use common::{url::Params, ToParts};
8200        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8201
8202        let mut dd = common::DefaultDelegate;
8203        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8204        dlg.begin(common::MethodInfo {
8205            id: "eventarc.projects.locations.enrollments.create",
8206            http_method: hyper::Method::POST,
8207        });
8208
8209        for &field in ["alt", "parent", "validateOnly", "enrollmentId"].iter() {
8210            if self._additional_params.contains_key(field) {
8211                dlg.finished(false);
8212                return Err(common::Error::FieldClash(field));
8213            }
8214        }
8215
8216        let mut params = Params::with_capacity(6 + self._additional_params.len());
8217        params.push("parent", self._parent);
8218        if let Some(value) = self._validate_only.as_ref() {
8219            params.push("validateOnly", value.to_string());
8220        }
8221        if let Some(value) = self._enrollment_id.as_ref() {
8222            params.push("enrollmentId", value);
8223        }
8224
8225        params.extend(self._additional_params.iter());
8226
8227        params.push("alt", "json");
8228        let mut url = self.hub._base_url.clone() + "v1/{+parent}/enrollments";
8229        if self._scopes.is_empty() {
8230            self._scopes
8231                .insert(Scope::CloudPlatform.as_ref().to_string());
8232        }
8233
8234        #[allow(clippy::single_element_loop)]
8235        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8236            url = params.uri_replacement(url, param_name, find_this, true);
8237        }
8238        {
8239            let to_remove = ["parent"];
8240            params.remove_params(&to_remove);
8241        }
8242
8243        let url = params.parse_with_url(&url);
8244
8245        let mut json_mime_type = mime::APPLICATION_JSON;
8246        let mut request_value_reader = {
8247            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8248            common::remove_json_null_values(&mut value);
8249            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8250            serde_json::to_writer(&mut dst, &value).unwrap();
8251            dst
8252        };
8253        let request_size = request_value_reader
8254            .seek(std::io::SeekFrom::End(0))
8255            .unwrap();
8256        request_value_reader
8257            .seek(std::io::SeekFrom::Start(0))
8258            .unwrap();
8259
8260        loop {
8261            let token = match self
8262                .hub
8263                .auth
8264                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8265                .await
8266            {
8267                Ok(token) => token,
8268                Err(e) => match dlg.token(e) {
8269                    Ok(token) => token,
8270                    Err(e) => {
8271                        dlg.finished(false);
8272                        return Err(common::Error::MissingToken(e));
8273                    }
8274                },
8275            };
8276            request_value_reader
8277                .seek(std::io::SeekFrom::Start(0))
8278                .unwrap();
8279            let mut req_result = {
8280                let client = &self.hub.client;
8281                dlg.pre_request();
8282                let mut req_builder = hyper::Request::builder()
8283                    .method(hyper::Method::POST)
8284                    .uri(url.as_str())
8285                    .header(USER_AGENT, self.hub._user_agent.clone());
8286
8287                if let Some(token) = token.as_ref() {
8288                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8289                }
8290
8291                let request = req_builder
8292                    .header(CONTENT_TYPE, json_mime_type.to_string())
8293                    .header(CONTENT_LENGTH, request_size as u64)
8294                    .body(common::to_body(
8295                        request_value_reader.get_ref().clone().into(),
8296                    ));
8297
8298                client.request(request.unwrap()).await
8299            };
8300
8301            match req_result {
8302                Err(err) => {
8303                    if let common::Retry::After(d) = dlg.http_error(&err) {
8304                        sleep(d).await;
8305                        continue;
8306                    }
8307                    dlg.finished(false);
8308                    return Err(common::Error::HttpError(err));
8309                }
8310                Ok(res) => {
8311                    let (mut parts, body) = res.into_parts();
8312                    let mut body = common::Body::new(body);
8313                    if !parts.status.is_success() {
8314                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8315                        let error = serde_json::from_str(&common::to_string(&bytes));
8316                        let response = common::to_response(parts, bytes.into());
8317
8318                        if let common::Retry::After(d) =
8319                            dlg.http_failure(&response, error.as_ref().ok())
8320                        {
8321                            sleep(d).await;
8322                            continue;
8323                        }
8324
8325                        dlg.finished(false);
8326
8327                        return Err(match error {
8328                            Ok(value) => common::Error::BadRequest(value),
8329                            _ => common::Error::Failure(response),
8330                        });
8331                    }
8332                    let response = {
8333                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8334                        let encoded = common::to_string(&bytes);
8335                        match serde_json::from_str(&encoded) {
8336                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8337                            Err(error) => {
8338                                dlg.response_json_decode_error(&encoded, &error);
8339                                return Err(common::Error::JsonDecodeError(
8340                                    encoded.to_string(),
8341                                    error,
8342                                ));
8343                            }
8344                        }
8345                    };
8346
8347                    dlg.finished(true);
8348                    return Ok(response);
8349                }
8350            }
8351        }
8352    }
8353
8354    ///
8355    /// Sets the *request* property to the given value.
8356    ///
8357    /// Even though the property as already been set when instantiating this call,
8358    /// we provide this method for API completeness.
8359    pub fn request(mut self, new_value: Enrollment) -> ProjectLocationEnrollmentCreateCall<'a, C> {
8360        self._request = new_value;
8361        self
8362    }
8363    /// Required. The parent collection in which to add this enrollment.
8364    ///
8365    /// Sets the *parent* path property to the given value.
8366    ///
8367    /// Even though the property as already been set when instantiating this call,
8368    /// we provide this method for API completeness.
8369    pub fn parent(mut self, new_value: &str) -> ProjectLocationEnrollmentCreateCall<'a, C> {
8370        self._parent = new_value.to_string();
8371        self
8372    }
8373    /// Optional. If set, validate the request and preview the review, but do not post it.
8374    ///
8375    /// Sets the *validate only* query property to the given value.
8376    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationEnrollmentCreateCall<'a, C> {
8377        self._validate_only = Some(new_value);
8378        self
8379    }
8380    /// Required. The user-provided ID to be assigned to the Enrollment. It should match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
8381    ///
8382    /// Sets the *enrollment id* query property to the given value.
8383    pub fn enrollment_id(mut self, new_value: &str) -> ProjectLocationEnrollmentCreateCall<'a, C> {
8384        self._enrollment_id = Some(new_value.to_string());
8385        self
8386    }
8387    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8388    /// while executing the actual API request.
8389    ///
8390    /// ````text
8391    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8392    /// ````
8393    ///
8394    /// Sets the *delegate* property to the given value.
8395    pub fn delegate(
8396        mut self,
8397        new_value: &'a mut dyn common::Delegate,
8398    ) -> ProjectLocationEnrollmentCreateCall<'a, C> {
8399        self._delegate = Some(new_value);
8400        self
8401    }
8402
8403    /// Set any additional parameter of the query string used in the request.
8404    /// It should be used to set parameters which are not yet available through their own
8405    /// setters.
8406    ///
8407    /// Please note that this method must not be used to set any of the known parameters
8408    /// which have their own setter method. If done anyway, the request will fail.
8409    ///
8410    /// # Additional Parameters
8411    ///
8412    /// * *$.xgafv* (query-string) - V1 error format.
8413    /// * *access_token* (query-string) - OAuth access token.
8414    /// * *alt* (query-string) - Data format for response.
8415    /// * *callback* (query-string) - JSONP
8416    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8417    /// * *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.
8418    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8419    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8420    /// * *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.
8421    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8422    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8423    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollmentCreateCall<'a, C>
8424    where
8425        T: AsRef<str>,
8426    {
8427        self._additional_params
8428            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8429        self
8430    }
8431
8432    /// Identifies the authorization scope for the method you are building.
8433    ///
8434    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8435    /// [`Scope::CloudPlatform`].
8436    ///
8437    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8438    /// tokens for more than one scope.
8439    ///
8440    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8441    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8442    /// sufficient, a read-write scope will do as well.
8443    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollmentCreateCall<'a, C>
8444    where
8445        St: AsRef<str>,
8446    {
8447        self._scopes.insert(String::from(scope.as_ref()));
8448        self
8449    }
8450    /// Identifies the authorization scope(s) for the method you are building.
8451    ///
8452    /// See [`Self::add_scope()`] for details.
8453    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnrollmentCreateCall<'a, C>
8454    where
8455        I: IntoIterator<Item = St>,
8456        St: AsRef<str>,
8457    {
8458        self._scopes
8459            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8460        self
8461    }
8462
8463    /// Removes all scopes, and no default scope will be used either.
8464    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8465    /// for details).
8466    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentCreateCall<'a, C> {
8467        self._scopes.clear();
8468        self
8469    }
8470}
8471
8472/// Delete a single Enrollment.
8473///
8474/// A builder for the *locations.enrollments.delete* method supported by a *project* resource.
8475/// It is not used directly, but through a [`ProjectMethods`] instance.
8476///
8477/// # Example
8478///
8479/// Instantiate a resource method builder
8480///
8481/// ```test_harness,no_run
8482/// # extern crate hyper;
8483/// # extern crate hyper_rustls;
8484/// # extern crate google_eventarc1 as eventarc1;
8485/// # async fn dox() {
8486/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8487///
8488/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8489/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8490/// #     .with_native_roots()
8491/// #     .unwrap()
8492/// #     .https_only()
8493/// #     .enable_http2()
8494/// #     .build();
8495///
8496/// # let executor = hyper_util::rt::TokioExecutor::new();
8497/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8498/// #     secret,
8499/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8500/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8501/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8502/// #     ),
8503/// # ).build().await.unwrap();
8504///
8505/// # let client = hyper_util::client::legacy::Client::builder(
8506/// #     hyper_util::rt::TokioExecutor::new()
8507/// # )
8508/// # .build(
8509/// #     hyper_rustls::HttpsConnectorBuilder::new()
8510/// #         .with_native_roots()
8511/// #         .unwrap()
8512/// #         .https_or_http()
8513/// #         .enable_http2()
8514/// #         .build()
8515/// # );
8516/// # let mut hub = Eventarc::new(client, auth);
8517/// // You can configure optional parameters by calling the respective setters at will, and
8518/// // execute the final call using `doit()`.
8519/// // Values shown here are possibly random and not representative !
8520/// let result = hub.projects().locations_enrollments_delete("name")
8521///              .validate_only(false)
8522///              .etag("erat")
8523///              .allow_missing(false)
8524///              .doit().await;
8525/// # }
8526/// ```
8527pub struct ProjectLocationEnrollmentDeleteCall<'a, C>
8528where
8529    C: 'a,
8530{
8531    hub: &'a Eventarc<C>,
8532    _name: String,
8533    _validate_only: Option<bool>,
8534    _etag: Option<String>,
8535    _allow_missing: Option<bool>,
8536    _delegate: Option<&'a mut dyn common::Delegate>,
8537    _additional_params: HashMap<String, String>,
8538    _scopes: BTreeSet<String>,
8539}
8540
8541impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentDeleteCall<'a, C> {}
8542
8543impl<'a, C> ProjectLocationEnrollmentDeleteCall<'a, C>
8544where
8545    C: common::Connector,
8546{
8547    /// Perform the operation you have build so far.
8548    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
8549        use std::borrow::Cow;
8550        use std::io::{Read, Seek};
8551
8552        use common::{url::Params, ToParts};
8553        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8554
8555        let mut dd = common::DefaultDelegate;
8556        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8557        dlg.begin(common::MethodInfo {
8558            id: "eventarc.projects.locations.enrollments.delete",
8559            http_method: hyper::Method::DELETE,
8560        });
8561
8562        for &field in ["alt", "name", "validateOnly", "etag", "allowMissing"].iter() {
8563            if self._additional_params.contains_key(field) {
8564                dlg.finished(false);
8565                return Err(common::Error::FieldClash(field));
8566            }
8567        }
8568
8569        let mut params = Params::with_capacity(6 + self._additional_params.len());
8570        params.push("name", self._name);
8571        if let Some(value) = self._validate_only.as_ref() {
8572            params.push("validateOnly", value.to_string());
8573        }
8574        if let Some(value) = self._etag.as_ref() {
8575            params.push("etag", value);
8576        }
8577        if let Some(value) = self._allow_missing.as_ref() {
8578            params.push("allowMissing", value.to_string());
8579        }
8580
8581        params.extend(self._additional_params.iter());
8582
8583        params.push("alt", "json");
8584        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8585        if self._scopes.is_empty() {
8586            self._scopes
8587                .insert(Scope::CloudPlatform.as_ref().to_string());
8588        }
8589
8590        #[allow(clippy::single_element_loop)]
8591        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8592            url = params.uri_replacement(url, param_name, find_this, true);
8593        }
8594        {
8595            let to_remove = ["name"];
8596            params.remove_params(&to_remove);
8597        }
8598
8599        let url = params.parse_with_url(&url);
8600
8601        loop {
8602            let token = match self
8603                .hub
8604                .auth
8605                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8606                .await
8607            {
8608                Ok(token) => token,
8609                Err(e) => match dlg.token(e) {
8610                    Ok(token) => token,
8611                    Err(e) => {
8612                        dlg.finished(false);
8613                        return Err(common::Error::MissingToken(e));
8614                    }
8615                },
8616            };
8617            let mut req_result = {
8618                let client = &self.hub.client;
8619                dlg.pre_request();
8620                let mut req_builder = hyper::Request::builder()
8621                    .method(hyper::Method::DELETE)
8622                    .uri(url.as_str())
8623                    .header(USER_AGENT, self.hub._user_agent.clone());
8624
8625                if let Some(token) = token.as_ref() {
8626                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8627                }
8628
8629                let request = req_builder
8630                    .header(CONTENT_LENGTH, 0_u64)
8631                    .body(common::to_body::<String>(None));
8632
8633                client.request(request.unwrap()).await
8634            };
8635
8636            match req_result {
8637                Err(err) => {
8638                    if let common::Retry::After(d) = dlg.http_error(&err) {
8639                        sleep(d).await;
8640                        continue;
8641                    }
8642                    dlg.finished(false);
8643                    return Err(common::Error::HttpError(err));
8644                }
8645                Ok(res) => {
8646                    let (mut parts, body) = res.into_parts();
8647                    let mut body = common::Body::new(body);
8648                    if !parts.status.is_success() {
8649                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8650                        let error = serde_json::from_str(&common::to_string(&bytes));
8651                        let response = common::to_response(parts, bytes.into());
8652
8653                        if let common::Retry::After(d) =
8654                            dlg.http_failure(&response, error.as_ref().ok())
8655                        {
8656                            sleep(d).await;
8657                            continue;
8658                        }
8659
8660                        dlg.finished(false);
8661
8662                        return Err(match error {
8663                            Ok(value) => common::Error::BadRequest(value),
8664                            _ => common::Error::Failure(response),
8665                        });
8666                    }
8667                    let response = {
8668                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8669                        let encoded = common::to_string(&bytes);
8670                        match serde_json::from_str(&encoded) {
8671                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8672                            Err(error) => {
8673                                dlg.response_json_decode_error(&encoded, &error);
8674                                return Err(common::Error::JsonDecodeError(
8675                                    encoded.to_string(),
8676                                    error,
8677                                ));
8678                            }
8679                        }
8680                    };
8681
8682                    dlg.finished(true);
8683                    return Ok(response);
8684                }
8685            }
8686        }
8687    }
8688
8689    /// Required. The name of the Enrollment to be deleted.
8690    ///
8691    /// Sets the *name* path property to the given value.
8692    ///
8693    /// Even though the property as already been set when instantiating this call,
8694    /// we provide this method for API completeness.
8695    pub fn name(mut self, new_value: &str) -> ProjectLocationEnrollmentDeleteCall<'a, C> {
8696        self._name = new_value.to_string();
8697        self
8698    }
8699    /// Optional. If set, validate the request and preview the review, but do not post it.
8700    ///
8701    /// Sets the *validate only* query property to the given value.
8702    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationEnrollmentDeleteCall<'a, C> {
8703        self._validate_only = Some(new_value);
8704        self
8705    }
8706    /// Optional. If provided, the Enrollment will only be deleted if the etag matches the current etag on the resource.
8707    ///
8708    /// Sets the *etag* query property to the given value.
8709    pub fn etag(mut self, new_value: &str) -> ProjectLocationEnrollmentDeleteCall<'a, C> {
8710        self._etag = Some(new_value.to_string());
8711        self
8712    }
8713    /// Optional. If set to true, and the Enrollment is not found, the request will succeed but no action will be taken on the server.
8714    ///
8715    /// Sets the *allow missing* query property to the given value.
8716    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationEnrollmentDeleteCall<'a, C> {
8717        self._allow_missing = Some(new_value);
8718        self
8719    }
8720    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8721    /// while executing the actual API request.
8722    ///
8723    /// ````text
8724    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8725    /// ````
8726    ///
8727    /// Sets the *delegate* property to the given value.
8728    pub fn delegate(
8729        mut self,
8730        new_value: &'a mut dyn common::Delegate,
8731    ) -> ProjectLocationEnrollmentDeleteCall<'a, C> {
8732        self._delegate = Some(new_value);
8733        self
8734    }
8735
8736    /// Set any additional parameter of the query string used in the request.
8737    /// It should be used to set parameters which are not yet available through their own
8738    /// setters.
8739    ///
8740    /// Please note that this method must not be used to set any of the known parameters
8741    /// which have their own setter method. If done anyway, the request will fail.
8742    ///
8743    /// # Additional Parameters
8744    ///
8745    /// * *$.xgafv* (query-string) - V1 error format.
8746    /// * *access_token* (query-string) - OAuth access token.
8747    /// * *alt* (query-string) - Data format for response.
8748    /// * *callback* (query-string) - JSONP
8749    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8750    /// * *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.
8751    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8752    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8753    /// * *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.
8754    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8755    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8756    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollmentDeleteCall<'a, C>
8757    where
8758        T: AsRef<str>,
8759    {
8760        self._additional_params
8761            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8762        self
8763    }
8764
8765    /// Identifies the authorization scope for the method you are building.
8766    ///
8767    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8768    /// [`Scope::CloudPlatform`].
8769    ///
8770    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8771    /// tokens for more than one scope.
8772    ///
8773    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8774    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8775    /// sufficient, a read-write scope will do as well.
8776    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollmentDeleteCall<'a, C>
8777    where
8778        St: AsRef<str>,
8779    {
8780        self._scopes.insert(String::from(scope.as_ref()));
8781        self
8782    }
8783    /// Identifies the authorization scope(s) for the method you are building.
8784    ///
8785    /// See [`Self::add_scope()`] for details.
8786    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnrollmentDeleteCall<'a, C>
8787    where
8788        I: IntoIterator<Item = St>,
8789        St: AsRef<str>,
8790    {
8791        self._scopes
8792            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8793        self
8794    }
8795
8796    /// Removes all scopes, and no default scope will be used either.
8797    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8798    /// for details).
8799    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentDeleteCall<'a, C> {
8800        self._scopes.clear();
8801        self
8802    }
8803}
8804
8805/// Get a single Enrollment.
8806///
8807/// A builder for the *locations.enrollments.get* method supported by a *project* resource.
8808/// It is not used directly, but through a [`ProjectMethods`] instance.
8809///
8810/// # Example
8811///
8812/// Instantiate a resource method builder
8813///
8814/// ```test_harness,no_run
8815/// # extern crate hyper;
8816/// # extern crate hyper_rustls;
8817/// # extern crate google_eventarc1 as eventarc1;
8818/// # async fn dox() {
8819/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8820///
8821/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8822/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8823/// #     .with_native_roots()
8824/// #     .unwrap()
8825/// #     .https_only()
8826/// #     .enable_http2()
8827/// #     .build();
8828///
8829/// # let executor = hyper_util::rt::TokioExecutor::new();
8830/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8831/// #     secret,
8832/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8833/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8834/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8835/// #     ),
8836/// # ).build().await.unwrap();
8837///
8838/// # let client = hyper_util::client::legacy::Client::builder(
8839/// #     hyper_util::rt::TokioExecutor::new()
8840/// # )
8841/// # .build(
8842/// #     hyper_rustls::HttpsConnectorBuilder::new()
8843/// #         .with_native_roots()
8844/// #         .unwrap()
8845/// #         .https_or_http()
8846/// #         .enable_http2()
8847/// #         .build()
8848/// # );
8849/// # let mut hub = Eventarc::new(client, auth);
8850/// // You can configure optional parameters by calling the respective setters at will, and
8851/// // execute the final call using `doit()`.
8852/// // Values shown here are possibly random and not representative !
8853/// let result = hub.projects().locations_enrollments_get("name")
8854///              .doit().await;
8855/// # }
8856/// ```
8857pub struct ProjectLocationEnrollmentGetCall<'a, C>
8858where
8859    C: 'a,
8860{
8861    hub: &'a Eventarc<C>,
8862    _name: String,
8863    _delegate: Option<&'a mut dyn common::Delegate>,
8864    _additional_params: HashMap<String, String>,
8865    _scopes: BTreeSet<String>,
8866}
8867
8868impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentGetCall<'a, C> {}
8869
8870impl<'a, C> ProjectLocationEnrollmentGetCall<'a, C>
8871where
8872    C: common::Connector,
8873{
8874    /// Perform the operation you have build so far.
8875    pub async fn doit(mut self) -> common::Result<(common::Response, Enrollment)> {
8876        use std::borrow::Cow;
8877        use std::io::{Read, Seek};
8878
8879        use common::{url::Params, ToParts};
8880        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8881
8882        let mut dd = common::DefaultDelegate;
8883        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8884        dlg.begin(common::MethodInfo {
8885            id: "eventarc.projects.locations.enrollments.get",
8886            http_method: hyper::Method::GET,
8887        });
8888
8889        for &field in ["alt", "name"].iter() {
8890            if self._additional_params.contains_key(field) {
8891                dlg.finished(false);
8892                return Err(common::Error::FieldClash(field));
8893            }
8894        }
8895
8896        let mut params = Params::with_capacity(3 + self._additional_params.len());
8897        params.push("name", self._name);
8898
8899        params.extend(self._additional_params.iter());
8900
8901        params.push("alt", "json");
8902        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8903        if self._scopes.is_empty() {
8904            self._scopes
8905                .insert(Scope::CloudPlatform.as_ref().to_string());
8906        }
8907
8908        #[allow(clippy::single_element_loop)]
8909        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8910            url = params.uri_replacement(url, param_name, find_this, true);
8911        }
8912        {
8913            let to_remove = ["name"];
8914            params.remove_params(&to_remove);
8915        }
8916
8917        let url = params.parse_with_url(&url);
8918
8919        loop {
8920            let token = match self
8921                .hub
8922                .auth
8923                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8924                .await
8925            {
8926                Ok(token) => token,
8927                Err(e) => match dlg.token(e) {
8928                    Ok(token) => token,
8929                    Err(e) => {
8930                        dlg.finished(false);
8931                        return Err(common::Error::MissingToken(e));
8932                    }
8933                },
8934            };
8935            let mut req_result = {
8936                let client = &self.hub.client;
8937                dlg.pre_request();
8938                let mut req_builder = hyper::Request::builder()
8939                    .method(hyper::Method::GET)
8940                    .uri(url.as_str())
8941                    .header(USER_AGENT, self.hub._user_agent.clone());
8942
8943                if let Some(token) = token.as_ref() {
8944                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8945                }
8946
8947                let request = req_builder
8948                    .header(CONTENT_LENGTH, 0_u64)
8949                    .body(common::to_body::<String>(None));
8950
8951                client.request(request.unwrap()).await
8952            };
8953
8954            match req_result {
8955                Err(err) => {
8956                    if let common::Retry::After(d) = dlg.http_error(&err) {
8957                        sleep(d).await;
8958                        continue;
8959                    }
8960                    dlg.finished(false);
8961                    return Err(common::Error::HttpError(err));
8962                }
8963                Ok(res) => {
8964                    let (mut parts, body) = res.into_parts();
8965                    let mut body = common::Body::new(body);
8966                    if !parts.status.is_success() {
8967                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8968                        let error = serde_json::from_str(&common::to_string(&bytes));
8969                        let response = common::to_response(parts, bytes.into());
8970
8971                        if let common::Retry::After(d) =
8972                            dlg.http_failure(&response, error.as_ref().ok())
8973                        {
8974                            sleep(d).await;
8975                            continue;
8976                        }
8977
8978                        dlg.finished(false);
8979
8980                        return Err(match error {
8981                            Ok(value) => common::Error::BadRequest(value),
8982                            _ => common::Error::Failure(response),
8983                        });
8984                    }
8985                    let response = {
8986                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8987                        let encoded = common::to_string(&bytes);
8988                        match serde_json::from_str(&encoded) {
8989                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8990                            Err(error) => {
8991                                dlg.response_json_decode_error(&encoded, &error);
8992                                return Err(common::Error::JsonDecodeError(
8993                                    encoded.to_string(),
8994                                    error,
8995                                ));
8996                            }
8997                        }
8998                    };
8999
9000                    dlg.finished(true);
9001                    return Ok(response);
9002                }
9003            }
9004        }
9005    }
9006
9007    /// Required. The name of the Enrollment to get.
9008    ///
9009    /// Sets the *name* path property to the given value.
9010    ///
9011    /// Even though the property as already been set when instantiating this call,
9012    /// we provide this method for API completeness.
9013    pub fn name(mut self, new_value: &str) -> ProjectLocationEnrollmentGetCall<'a, C> {
9014        self._name = new_value.to_string();
9015        self
9016    }
9017    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9018    /// while executing the actual API request.
9019    ///
9020    /// ````text
9021    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9022    /// ````
9023    ///
9024    /// Sets the *delegate* property to the given value.
9025    pub fn delegate(
9026        mut self,
9027        new_value: &'a mut dyn common::Delegate,
9028    ) -> ProjectLocationEnrollmentGetCall<'a, C> {
9029        self._delegate = Some(new_value);
9030        self
9031    }
9032
9033    /// Set any additional parameter of the query string used in the request.
9034    /// It should be used to set parameters which are not yet available through their own
9035    /// setters.
9036    ///
9037    /// Please note that this method must not be used to set any of the known parameters
9038    /// which have their own setter method. If done anyway, the request will fail.
9039    ///
9040    /// # Additional Parameters
9041    ///
9042    /// * *$.xgafv* (query-string) - V1 error format.
9043    /// * *access_token* (query-string) - OAuth access token.
9044    /// * *alt* (query-string) - Data format for response.
9045    /// * *callback* (query-string) - JSONP
9046    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9047    /// * *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.
9048    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9049    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9050    /// * *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.
9051    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9052    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9053    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollmentGetCall<'a, C>
9054    where
9055        T: AsRef<str>,
9056    {
9057        self._additional_params
9058            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9059        self
9060    }
9061
9062    /// Identifies the authorization scope for the method you are building.
9063    ///
9064    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9065    /// [`Scope::CloudPlatform`].
9066    ///
9067    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9068    /// tokens for more than one scope.
9069    ///
9070    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9071    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9072    /// sufficient, a read-write scope will do as well.
9073    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollmentGetCall<'a, C>
9074    where
9075        St: AsRef<str>,
9076    {
9077        self._scopes.insert(String::from(scope.as_ref()));
9078        self
9079    }
9080    /// Identifies the authorization scope(s) for the method you are building.
9081    ///
9082    /// See [`Self::add_scope()`] for details.
9083    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnrollmentGetCall<'a, C>
9084    where
9085        I: IntoIterator<Item = St>,
9086        St: AsRef<str>,
9087    {
9088        self._scopes
9089            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9090        self
9091    }
9092
9093    /// Removes all scopes, and no default scope will be used either.
9094    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9095    /// for details).
9096    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentGetCall<'a, C> {
9097        self._scopes.clear();
9098        self
9099    }
9100}
9101
9102/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
9103///
9104/// A builder for the *locations.enrollments.getIamPolicy* method supported by a *project* resource.
9105/// It is not used directly, but through a [`ProjectMethods`] instance.
9106///
9107/// # Example
9108///
9109/// Instantiate a resource method builder
9110///
9111/// ```test_harness,no_run
9112/// # extern crate hyper;
9113/// # extern crate hyper_rustls;
9114/// # extern crate google_eventarc1 as eventarc1;
9115/// # async fn dox() {
9116/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9117///
9118/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9119/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9120/// #     .with_native_roots()
9121/// #     .unwrap()
9122/// #     .https_only()
9123/// #     .enable_http2()
9124/// #     .build();
9125///
9126/// # let executor = hyper_util::rt::TokioExecutor::new();
9127/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9128/// #     secret,
9129/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9130/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9131/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9132/// #     ),
9133/// # ).build().await.unwrap();
9134///
9135/// # let client = hyper_util::client::legacy::Client::builder(
9136/// #     hyper_util::rt::TokioExecutor::new()
9137/// # )
9138/// # .build(
9139/// #     hyper_rustls::HttpsConnectorBuilder::new()
9140/// #         .with_native_roots()
9141/// #         .unwrap()
9142/// #         .https_or_http()
9143/// #         .enable_http2()
9144/// #         .build()
9145/// # );
9146/// # let mut hub = Eventarc::new(client, auth);
9147/// // You can configure optional parameters by calling the respective setters at will, and
9148/// // execute the final call using `doit()`.
9149/// // Values shown here are possibly random and not representative !
9150/// let result = hub.projects().locations_enrollments_get_iam_policy("resource")
9151///              .options_requested_policy_version(-22)
9152///              .doit().await;
9153/// # }
9154/// ```
9155pub struct ProjectLocationEnrollmentGetIamPolicyCall<'a, C>
9156where
9157    C: 'a,
9158{
9159    hub: &'a Eventarc<C>,
9160    _resource: String,
9161    _options_requested_policy_version: Option<i32>,
9162    _delegate: Option<&'a mut dyn common::Delegate>,
9163    _additional_params: HashMap<String, String>,
9164    _scopes: BTreeSet<String>,
9165}
9166
9167impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentGetIamPolicyCall<'a, C> {}
9168
9169impl<'a, C> ProjectLocationEnrollmentGetIamPolicyCall<'a, C>
9170where
9171    C: common::Connector,
9172{
9173    /// Perform the operation you have build so far.
9174    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9175        use std::borrow::Cow;
9176        use std::io::{Read, Seek};
9177
9178        use common::{url::Params, ToParts};
9179        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9180
9181        let mut dd = common::DefaultDelegate;
9182        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9183        dlg.begin(common::MethodInfo {
9184            id: "eventarc.projects.locations.enrollments.getIamPolicy",
9185            http_method: hyper::Method::GET,
9186        });
9187
9188        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
9189            if self._additional_params.contains_key(field) {
9190                dlg.finished(false);
9191                return Err(common::Error::FieldClash(field));
9192            }
9193        }
9194
9195        let mut params = Params::with_capacity(4 + self._additional_params.len());
9196        params.push("resource", self._resource);
9197        if let Some(value) = self._options_requested_policy_version.as_ref() {
9198            params.push("options.requestedPolicyVersion", value.to_string());
9199        }
9200
9201        params.extend(self._additional_params.iter());
9202
9203        params.push("alt", "json");
9204        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
9205        if self._scopes.is_empty() {
9206            self._scopes
9207                .insert(Scope::CloudPlatform.as_ref().to_string());
9208        }
9209
9210        #[allow(clippy::single_element_loop)]
9211        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9212            url = params.uri_replacement(url, param_name, find_this, true);
9213        }
9214        {
9215            let to_remove = ["resource"];
9216            params.remove_params(&to_remove);
9217        }
9218
9219        let url = params.parse_with_url(&url);
9220
9221        loop {
9222            let token = match self
9223                .hub
9224                .auth
9225                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9226                .await
9227            {
9228                Ok(token) => token,
9229                Err(e) => match dlg.token(e) {
9230                    Ok(token) => token,
9231                    Err(e) => {
9232                        dlg.finished(false);
9233                        return Err(common::Error::MissingToken(e));
9234                    }
9235                },
9236            };
9237            let mut req_result = {
9238                let client = &self.hub.client;
9239                dlg.pre_request();
9240                let mut req_builder = hyper::Request::builder()
9241                    .method(hyper::Method::GET)
9242                    .uri(url.as_str())
9243                    .header(USER_AGENT, self.hub._user_agent.clone());
9244
9245                if let Some(token) = token.as_ref() {
9246                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9247                }
9248
9249                let request = req_builder
9250                    .header(CONTENT_LENGTH, 0_u64)
9251                    .body(common::to_body::<String>(None));
9252
9253                client.request(request.unwrap()).await
9254            };
9255
9256            match req_result {
9257                Err(err) => {
9258                    if let common::Retry::After(d) = dlg.http_error(&err) {
9259                        sleep(d).await;
9260                        continue;
9261                    }
9262                    dlg.finished(false);
9263                    return Err(common::Error::HttpError(err));
9264                }
9265                Ok(res) => {
9266                    let (mut parts, body) = res.into_parts();
9267                    let mut body = common::Body::new(body);
9268                    if !parts.status.is_success() {
9269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9270                        let error = serde_json::from_str(&common::to_string(&bytes));
9271                        let response = common::to_response(parts, bytes.into());
9272
9273                        if let common::Retry::After(d) =
9274                            dlg.http_failure(&response, error.as_ref().ok())
9275                        {
9276                            sleep(d).await;
9277                            continue;
9278                        }
9279
9280                        dlg.finished(false);
9281
9282                        return Err(match error {
9283                            Ok(value) => common::Error::BadRequest(value),
9284                            _ => common::Error::Failure(response),
9285                        });
9286                    }
9287                    let response = {
9288                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9289                        let encoded = common::to_string(&bytes);
9290                        match serde_json::from_str(&encoded) {
9291                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9292                            Err(error) => {
9293                                dlg.response_json_decode_error(&encoded, &error);
9294                                return Err(common::Error::JsonDecodeError(
9295                                    encoded.to_string(),
9296                                    error,
9297                                ));
9298                            }
9299                        }
9300                    };
9301
9302                    dlg.finished(true);
9303                    return Ok(response);
9304                }
9305            }
9306        }
9307    }
9308
9309    /// 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.
9310    ///
9311    /// Sets the *resource* path property to the given value.
9312    ///
9313    /// Even though the property as already been set when instantiating this call,
9314    /// we provide this method for API completeness.
9315    pub fn resource(mut self, new_value: &str) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C> {
9316        self._resource = new_value.to_string();
9317        self
9318    }
9319    /// 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).
9320    ///
9321    /// Sets the *options.requested policy version* query property to the given value.
9322    pub fn options_requested_policy_version(
9323        mut self,
9324        new_value: i32,
9325    ) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C> {
9326        self._options_requested_policy_version = Some(new_value);
9327        self
9328    }
9329    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9330    /// while executing the actual API request.
9331    ///
9332    /// ````text
9333    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9334    /// ````
9335    ///
9336    /// Sets the *delegate* property to the given value.
9337    pub fn delegate(
9338        mut self,
9339        new_value: &'a mut dyn common::Delegate,
9340    ) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C> {
9341        self._delegate = Some(new_value);
9342        self
9343    }
9344
9345    /// Set any additional parameter of the query string used in the request.
9346    /// It should be used to set parameters which are not yet available through their own
9347    /// setters.
9348    ///
9349    /// Please note that this method must not be used to set any of the known parameters
9350    /// which have their own setter method. If done anyway, the request will fail.
9351    ///
9352    /// # Additional Parameters
9353    ///
9354    /// * *$.xgafv* (query-string) - V1 error format.
9355    /// * *access_token* (query-string) - OAuth access token.
9356    /// * *alt* (query-string) - Data format for response.
9357    /// * *callback* (query-string) - JSONP
9358    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9359    /// * *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.
9360    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9361    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9362    /// * *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.
9363    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9364    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9365    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C>
9366    where
9367        T: AsRef<str>,
9368    {
9369        self._additional_params
9370            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9371        self
9372    }
9373
9374    /// Identifies the authorization scope for the method you are building.
9375    ///
9376    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9377    /// [`Scope::CloudPlatform`].
9378    ///
9379    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9380    /// tokens for more than one scope.
9381    ///
9382    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9383    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9384    /// sufficient, a read-write scope will do as well.
9385    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C>
9386    where
9387        St: AsRef<str>,
9388    {
9389        self._scopes.insert(String::from(scope.as_ref()));
9390        self
9391    }
9392    /// Identifies the authorization scope(s) for the method you are building.
9393    ///
9394    /// See [`Self::add_scope()`] for details.
9395    pub fn add_scopes<I, St>(
9396        mut self,
9397        scopes: I,
9398    ) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C>
9399    where
9400        I: IntoIterator<Item = St>,
9401        St: AsRef<str>,
9402    {
9403        self._scopes
9404            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9405        self
9406    }
9407
9408    /// Removes all scopes, and no default scope will be used either.
9409    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9410    /// for details).
9411    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentGetIamPolicyCall<'a, C> {
9412        self._scopes.clear();
9413        self
9414    }
9415}
9416
9417/// List Enrollments.
9418///
9419/// A builder for the *locations.enrollments.list* method supported by a *project* resource.
9420/// It is not used directly, but through a [`ProjectMethods`] instance.
9421///
9422/// # Example
9423///
9424/// Instantiate a resource method builder
9425///
9426/// ```test_harness,no_run
9427/// # extern crate hyper;
9428/// # extern crate hyper_rustls;
9429/// # extern crate google_eventarc1 as eventarc1;
9430/// # async fn dox() {
9431/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9432///
9433/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9434/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9435/// #     .with_native_roots()
9436/// #     .unwrap()
9437/// #     .https_only()
9438/// #     .enable_http2()
9439/// #     .build();
9440///
9441/// # let executor = hyper_util::rt::TokioExecutor::new();
9442/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9443/// #     secret,
9444/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9445/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9446/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9447/// #     ),
9448/// # ).build().await.unwrap();
9449///
9450/// # let client = hyper_util::client::legacy::Client::builder(
9451/// #     hyper_util::rt::TokioExecutor::new()
9452/// # )
9453/// # .build(
9454/// #     hyper_rustls::HttpsConnectorBuilder::new()
9455/// #         .with_native_roots()
9456/// #         .unwrap()
9457/// #         .https_or_http()
9458/// #         .enable_http2()
9459/// #         .build()
9460/// # );
9461/// # let mut hub = Eventarc::new(client, auth);
9462/// // You can configure optional parameters by calling the respective setters at will, and
9463/// // execute the final call using `doit()`.
9464/// // Values shown here are possibly random and not representative !
9465/// let result = hub.projects().locations_enrollments_list("parent")
9466///              .page_token("amet.")
9467///              .page_size(-96)
9468///              .order_by("diam")
9469///              .filter("dolor")
9470///              .doit().await;
9471/// # }
9472/// ```
9473pub struct ProjectLocationEnrollmentListCall<'a, C>
9474where
9475    C: 'a,
9476{
9477    hub: &'a Eventarc<C>,
9478    _parent: String,
9479    _page_token: Option<String>,
9480    _page_size: Option<i32>,
9481    _order_by: Option<String>,
9482    _filter: Option<String>,
9483    _delegate: Option<&'a mut dyn common::Delegate>,
9484    _additional_params: HashMap<String, String>,
9485    _scopes: BTreeSet<String>,
9486}
9487
9488impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentListCall<'a, C> {}
9489
9490impl<'a, C> ProjectLocationEnrollmentListCall<'a, C>
9491where
9492    C: common::Connector,
9493{
9494    /// Perform the operation you have build so far.
9495    pub async fn doit(mut self) -> common::Result<(common::Response, ListEnrollmentsResponse)> {
9496        use std::borrow::Cow;
9497        use std::io::{Read, Seek};
9498
9499        use common::{url::Params, ToParts};
9500        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9501
9502        let mut dd = common::DefaultDelegate;
9503        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9504        dlg.begin(common::MethodInfo {
9505            id: "eventarc.projects.locations.enrollments.list",
9506            http_method: hyper::Method::GET,
9507        });
9508
9509        for &field in [
9510            "alt",
9511            "parent",
9512            "pageToken",
9513            "pageSize",
9514            "orderBy",
9515            "filter",
9516        ]
9517        .iter()
9518        {
9519            if self._additional_params.contains_key(field) {
9520                dlg.finished(false);
9521                return Err(common::Error::FieldClash(field));
9522            }
9523        }
9524
9525        let mut params = Params::with_capacity(7 + self._additional_params.len());
9526        params.push("parent", self._parent);
9527        if let Some(value) = self._page_token.as_ref() {
9528            params.push("pageToken", value);
9529        }
9530        if let Some(value) = self._page_size.as_ref() {
9531            params.push("pageSize", value.to_string());
9532        }
9533        if let Some(value) = self._order_by.as_ref() {
9534            params.push("orderBy", value);
9535        }
9536        if let Some(value) = self._filter.as_ref() {
9537            params.push("filter", value);
9538        }
9539
9540        params.extend(self._additional_params.iter());
9541
9542        params.push("alt", "json");
9543        let mut url = self.hub._base_url.clone() + "v1/{+parent}/enrollments";
9544        if self._scopes.is_empty() {
9545            self._scopes
9546                .insert(Scope::CloudPlatform.as_ref().to_string());
9547        }
9548
9549        #[allow(clippy::single_element_loop)]
9550        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9551            url = params.uri_replacement(url, param_name, find_this, true);
9552        }
9553        {
9554            let to_remove = ["parent"];
9555            params.remove_params(&to_remove);
9556        }
9557
9558        let url = params.parse_with_url(&url);
9559
9560        loop {
9561            let token = match self
9562                .hub
9563                .auth
9564                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9565                .await
9566            {
9567                Ok(token) => token,
9568                Err(e) => match dlg.token(e) {
9569                    Ok(token) => token,
9570                    Err(e) => {
9571                        dlg.finished(false);
9572                        return Err(common::Error::MissingToken(e));
9573                    }
9574                },
9575            };
9576            let mut req_result = {
9577                let client = &self.hub.client;
9578                dlg.pre_request();
9579                let mut req_builder = hyper::Request::builder()
9580                    .method(hyper::Method::GET)
9581                    .uri(url.as_str())
9582                    .header(USER_AGENT, self.hub._user_agent.clone());
9583
9584                if let Some(token) = token.as_ref() {
9585                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9586                }
9587
9588                let request = req_builder
9589                    .header(CONTENT_LENGTH, 0_u64)
9590                    .body(common::to_body::<String>(None));
9591
9592                client.request(request.unwrap()).await
9593            };
9594
9595            match req_result {
9596                Err(err) => {
9597                    if let common::Retry::After(d) = dlg.http_error(&err) {
9598                        sleep(d).await;
9599                        continue;
9600                    }
9601                    dlg.finished(false);
9602                    return Err(common::Error::HttpError(err));
9603                }
9604                Ok(res) => {
9605                    let (mut parts, body) = res.into_parts();
9606                    let mut body = common::Body::new(body);
9607                    if !parts.status.is_success() {
9608                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9609                        let error = serde_json::from_str(&common::to_string(&bytes));
9610                        let response = common::to_response(parts, bytes.into());
9611
9612                        if let common::Retry::After(d) =
9613                            dlg.http_failure(&response, error.as_ref().ok())
9614                        {
9615                            sleep(d).await;
9616                            continue;
9617                        }
9618
9619                        dlg.finished(false);
9620
9621                        return Err(match error {
9622                            Ok(value) => common::Error::BadRequest(value),
9623                            _ => common::Error::Failure(response),
9624                        });
9625                    }
9626                    let response = {
9627                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9628                        let encoded = common::to_string(&bytes);
9629                        match serde_json::from_str(&encoded) {
9630                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9631                            Err(error) => {
9632                                dlg.response_json_decode_error(&encoded, &error);
9633                                return Err(common::Error::JsonDecodeError(
9634                                    encoded.to_string(),
9635                                    error,
9636                                ));
9637                            }
9638                        }
9639                    };
9640
9641                    dlg.finished(true);
9642                    return Ok(response);
9643                }
9644            }
9645        }
9646    }
9647
9648    /// Required. The parent collection to list triggers on.
9649    ///
9650    /// Sets the *parent* path property to the given value.
9651    ///
9652    /// Even though the property as already been set when instantiating this call,
9653    /// we provide this method for API completeness.
9654    pub fn parent(mut self, new_value: &str) -> ProjectLocationEnrollmentListCall<'a, C> {
9655        self._parent = new_value.to_string();
9656        self
9657    }
9658    /// Optional. The page token; provide the value from the `next_page_token` field in a previous call to retrieve the subsequent page. When paginating, all other parameters provided must match the previous call that provided the page token.
9659    ///
9660    /// Sets the *page token* query property to the given value.
9661    pub fn page_token(mut self, new_value: &str) -> ProjectLocationEnrollmentListCall<'a, C> {
9662        self._page_token = Some(new_value.to_string());
9663        self
9664    }
9665    /// Optional. The maximum number of results to return on each page. Note: The service may send fewer.
9666    ///
9667    /// Sets the *page size* query property to the given value.
9668    pub fn page_size(mut self, new_value: i32) -> ProjectLocationEnrollmentListCall<'a, C> {
9669        self._page_size = Some(new_value);
9670        self
9671    }
9672    /// Optional. The sorting order of the resources returned. Value should be a comma-separated list of fields. The default sorting order is ascending. To specify descending order for a field, append a `desc` suffix; for example: `name desc, update_time`.
9673    ///
9674    /// Sets the *order by* query property to the given value.
9675    pub fn order_by(mut self, new_value: &str) -> ProjectLocationEnrollmentListCall<'a, C> {
9676        self._order_by = Some(new_value.to_string());
9677        self
9678    }
9679    /// Optional. The filter field that the list request will filter on. Possible filtersare described in https://google.aip.dev/160.
9680    ///
9681    /// Sets the *filter* query property to the given value.
9682    pub fn filter(mut self, new_value: &str) -> ProjectLocationEnrollmentListCall<'a, C> {
9683        self._filter = Some(new_value.to_string());
9684        self
9685    }
9686    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9687    /// while executing the actual API request.
9688    ///
9689    /// ````text
9690    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9691    /// ````
9692    ///
9693    /// Sets the *delegate* property to the given value.
9694    pub fn delegate(
9695        mut self,
9696        new_value: &'a mut dyn common::Delegate,
9697    ) -> ProjectLocationEnrollmentListCall<'a, C> {
9698        self._delegate = Some(new_value);
9699        self
9700    }
9701
9702    /// Set any additional parameter of the query string used in the request.
9703    /// It should be used to set parameters which are not yet available through their own
9704    /// setters.
9705    ///
9706    /// Please note that this method must not be used to set any of the known parameters
9707    /// which have their own setter method. If done anyway, the request will fail.
9708    ///
9709    /// # Additional Parameters
9710    ///
9711    /// * *$.xgafv* (query-string) - V1 error format.
9712    /// * *access_token* (query-string) - OAuth access token.
9713    /// * *alt* (query-string) - Data format for response.
9714    /// * *callback* (query-string) - JSONP
9715    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9716    /// * *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.
9717    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9718    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9719    /// * *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.
9720    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9721    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9722    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollmentListCall<'a, C>
9723    where
9724        T: AsRef<str>,
9725    {
9726        self._additional_params
9727            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9728        self
9729    }
9730
9731    /// Identifies the authorization scope for the method you are building.
9732    ///
9733    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9734    /// [`Scope::CloudPlatform`].
9735    ///
9736    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9737    /// tokens for more than one scope.
9738    ///
9739    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9740    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9741    /// sufficient, a read-write scope will do as well.
9742    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollmentListCall<'a, C>
9743    where
9744        St: AsRef<str>,
9745    {
9746        self._scopes.insert(String::from(scope.as_ref()));
9747        self
9748    }
9749    /// Identifies the authorization scope(s) for the method you are building.
9750    ///
9751    /// See [`Self::add_scope()`] for details.
9752    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnrollmentListCall<'a, C>
9753    where
9754        I: IntoIterator<Item = St>,
9755        St: AsRef<str>,
9756    {
9757        self._scopes
9758            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9759        self
9760    }
9761
9762    /// Removes all scopes, and no default scope will be used either.
9763    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9764    /// for details).
9765    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentListCall<'a, C> {
9766        self._scopes.clear();
9767        self
9768    }
9769}
9770
9771/// Update a single Enrollment.
9772///
9773/// A builder for the *locations.enrollments.patch* method supported by a *project* resource.
9774/// It is not used directly, but through a [`ProjectMethods`] instance.
9775///
9776/// # Example
9777///
9778/// Instantiate a resource method builder
9779///
9780/// ```test_harness,no_run
9781/// # extern crate hyper;
9782/// # extern crate hyper_rustls;
9783/// # extern crate google_eventarc1 as eventarc1;
9784/// use eventarc1::api::Enrollment;
9785/// # async fn dox() {
9786/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9787///
9788/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9789/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9790/// #     .with_native_roots()
9791/// #     .unwrap()
9792/// #     .https_only()
9793/// #     .enable_http2()
9794/// #     .build();
9795///
9796/// # let executor = hyper_util::rt::TokioExecutor::new();
9797/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9798/// #     secret,
9799/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9800/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9801/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9802/// #     ),
9803/// # ).build().await.unwrap();
9804///
9805/// # let client = hyper_util::client::legacy::Client::builder(
9806/// #     hyper_util::rt::TokioExecutor::new()
9807/// # )
9808/// # .build(
9809/// #     hyper_rustls::HttpsConnectorBuilder::new()
9810/// #         .with_native_roots()
9811/// #         .unwrap()
9812/// #         .https_or_http()
9813/// #         .enable_http2()
9814/// #         .build()
9815/// # );
9816/// # let mut hub = Eventarc::new(client, auth);
9817/// // As the method needs a request, you would usually fill it with the desired information
9818/// // into the respective structure. Some of the parts shown here might not be applicable !
9819/// // Values shown here are possibly random and not representative !
9820/// let mut req = Enrollment::default();
9821///
9822/// // You can configure optional parameters by calling the respective setters at will, and
9823/// // execute the final call using `doit()`.
9824/// // Values shown here are possibly random and not representative !
9825/// let result = hub.projects().locations_enrollments_patch(req, "name")
9826///              .validate_only(false)
9827///              .update_mask(FieldMask::new::<&str>(&[]))
9828///              .allow_missing(false)
9829///              .doit().await;
9830/// # }
9831/// ```
9832pub struct ProjectLocationEnrollmentPatchCall<'a, C>
9833where
9834    C: 'a,
9835{
9836    hub: &'a Eventarc<C>,
9837    _request: Enrollment,
9838    _name: String,
9839    _validate_only: Option<bool>,
9840    _update_mask: Option<common::FieldMask>,
9841    _allow_missing: Option<bool>,
9842    _delegate: Option<&'a mut dyn common::Delegate>,
9843    _additional_params: HashMap<String, String>,
9844    _scopes: BTreeSet<String>,
9845}
9846
9847impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentPatchCall<'a, C> {}
9848
9849impl<'a, C> ProjectLocationEnrollmentPatchCall<'a, C>
9850where
9851    C: common::Connector,
9852{
9853    /// Perform the operation you have build so far.
9854    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
9855        use std::borrow::Cow;
9856        use std::io::{Read, Seek};
9857
9858        use common::{url::Params, ToParts};
9859        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9860
9861        let mut dd = common::DefaultDelegate;
9862        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9863        dlg.begin(common::MethodInfo {
9864            id: "eventarc.projects.locations.enrollments.patch",
9865            http_method: hyper::Method::PATCH,
9866        });
9867
9868        for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
9869            if self._additional_params.contains_key(field) {
9870                dlg.finished(false);
9871                return Err(common::Error::FieldClash(field));
9872            }
9873        }
9874
9875        let mut params = Params::with_capacity(7 + self._additional_params.len());
9876        params.push("name", self._name);
9877        if let Some(value) = self._validate_only.as_ref() {
9878            params.push("validateOnly", value.to_string());
9879        }
9880        if let Some(value) = self._update_mask.as_ref() {
9881            params.push("updateMask", value.to_string());
9882        }
9883        if let Some(value) = self._allow_missing.as_ref() {
9884            params.push("allowMissing", value.to_string());
9885        }
9886
9887        params.extend(self._additional_params.iter());
9888
9889        params.push("alt", "json");
9890        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9891        if self._scopes.is_empty() {
9892            self._scopes
9893                .insert(Scope::CloudPlatform.as_ref().to_string());
9894        }
9895
9896        #[allow(clippy::single_element_loop)]
9897        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9898            url = params.uri_replacement(url, param_name, find_this, true);
9899        }
9900        {
9901            let to_remove = ["name"];
9902            params.remove_params(&to_remove);
9903        }
9904
9905        let url = params.parse_with_url(&url);
9906
9907        let mut json_mime_type = mime::APPLICATION_JSON;
9908        let mut request_value_reader = {
9909            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9910            common::remove_json_null_values(&mut value);
9911            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9912            serde_json::to_writer(&mut dst, &value).unwrap();
9913            dst
9914        };
9915        let request_size = request_value_reader
9916            .seek(std::io::SeekFrom::End(0))
9917            .unwrap();
9918        request_value_reader
9919            .seek(std::io::SeekFrom::Start(0))
9920            .unwrap();
9921
9922        loop {
9923            let token = match self
9924                .hub
9925                .auth
9926                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9927                .await
9928            {
9929                Ok(token) => token,
9930                Err(e) => match dlg.token(e) {
9931                    Ok(token) => token,
9932                    Err(e) => {
9933                        dlg.finished(false);
9934                        return Err(common::Error::MissingToken(e));
9935                    }
9936                },
9937            };
9938            request_value_reader
9939                .seek(std::io::SeekFrom::Start(0))
9940                .unwrap();
9941            let mut req_result = {
9942                let client = &self.hub.client;
9943                dlg.pre_request();
9944                let mut req_builder = hyper::Request::builder()
9945                    .method(hyper::Method::PATCH)
9946                    .uri(url.as_str())
9947                    .header(USER_AGENT, self.hub._user_agent.clone());
9948
9949                if let Some(token) = token.as_ref() {
9950                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9951                }
9952
9953                let request = req_builder
9954                    .header(CONTENT_TYPE, json_mime_type.to_string())
9955                    .header(CONTENT_LENGTH, request_size as u64)
9956                    .body(common::to_body(
9957                        request_value_reader.get_ref().clone().into(),
9958                    ));
9959
9960                client.request(request.unwrap()).await
9961            };
9962
9963            match req_result {
9964                Err(err) => {
9965                    if let common::Retry::After(d) = dlg.http_error(&err) {
9966                        sleep(d).await;
9967                        continue;
9968                    }
9969                    dlg.finished(false);
9970                    return Err(common::Error::HttpError(err));
9971                }
9972                Ok(res) => {
9973                    let (mut parts, body) = res.into_parts();
9974                    let mut body = common::Body::new(body);
9975                    if !parts.status.is_success() {
9976                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9977                        let error = serde_json::from_str(&common::to_string(&bytes));
9978                        let response = common::to_response(parts, bytes.into());
9979
9980                        if let common::Retry::After(d) =
9981                            dlg.http_failure(&response, error.as_ref().ok())
9982                        {
9983                            sleep(d).await;
9984                            continue;
9985                        }
9986
9987                        dlg.finished(false);
9988
9989                        return Err(match error {
9990                            Ok(value) => common::Error::BadRequest(value),
9991                            _ => common::Error::Failure(response),
9992                        });
9993                    }
9994                    let response = {
9995                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9996                        let encoded = common::to_string(&bytes);
9997                        match serde_json::from_str(&encoded) {
9998                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9999                            Err(error) => {
10000                                dlg.response_json_decode_error(&encoded, &error);
10001                                return Err(common::Error::JsonDecodeError(
10002                                    encoded.to_string(),
10003                                    error,
10004                                ));
10005                            }
10006                        }
10007                    };
10008
10009                    dlg.finished(true);
10010                    return Ok(response);
10011                }
10012            }
10013        }
10014    }
10015
10016    ///
10017    /// Sets the *request* property to the given value.
10018    ///
10019    /// Even though the property as already been set when instantiating this call,
10020    /// we provide this method for API completeness.
10021    pub fn request(mut self, new_value: Enrollment) -> ProjectLocationEnrollmentPatchCall<'a, C> {
10022        self._request = new_value;
10023        self
10024    }
10025    /// Identifier. Resource name of the form projects/{project}/locations/{location}/enrollments/{enrollment}
10026    ///
10027    /// Sets the *name* path property to the given value.
10028    ///
10029    /// Even though the property as already been set when instantiating this call,
10030    /// we provide this method for API completeness.
10031    pub fn name(mut self, new_value: &str) -> ProjectLocationEnrollmentPatchCall<'a, C> {
10032        self._name = new_value.to_string();
10033        self
10034    }
10035    /// Optional. If set, validate the request and preview the review, but do not post it.
10036    ///
10037    /// Sets the *validate only* query property to the given value.
10038    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationEnrollmentPatchCall<'a, C> {
10039        self._validate_only = Some(new_value);
10040        self
10041    }
10042    /// Optional. The fields to be updated; only fields explicitly provided are updated. If no field mask is provided, all provided fields in the request are updated. To update all fields, provide a field mask of "*".
10043    ///
10044    /// Sets the *update mask* query property to the given value.
10045    pub fn update_mask(
10046        mut self,
10047        new_value: common::FieldMask,
10048    ) -> ProjectLocationEnrollmentPatchCall<'a, C> {
10049        self._update_mask = Some(new_value);
10050        self
10051    }
10052    /// Optional. If set to true, and the Enrollment is not found, a new Enrollment will be created. In this situation, `update_mask` is ignored.
10053    ///
10054    /// Sets the *allow missing* query property to the given value.
10055    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationEnrollmentPatchCall<'a, C> {
10056        self._allow_missing = Some(new_value);
10057        self
10058    }
10059    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10060    /// while executing the actual API request.
10061    ///
10062    /// ````text
10063    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10064    /// ````
10065    ///
10066    /// Sets the *delegate* property to the given value.
10067    pub fn delegate(
10068        mut self,
10069        new_value: &'a mut dyn common::Delegate,
10070    ) -> ProjectLocationEnrollmentPatchCall<'a, C> {
10071        self._delegate = Some(new_value);
10072        self
10073    }
10074
10075    /// Set any additional parameter of the query string used in the request.
10076    /// It should be used to set parameters which are not yet available through their own
10077    /// setters.
10078    ///
10079    /// Please note that this method must not be used to set any of the known parameters
10080    /// which have their own setter method. If done anyway, the request will fail.
10081    ///
10082    /// # Additional Parameters
10083    ///
10084    /// * *$.xgafv* (query-string) - V1 error format.
10085    /// * *access_token* (query-string) - OAuth access token.
10086    /// * *alt* (query-string) - Data format for response.
10087    /// * *callback* (query-string) - JSONP
10088    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10089    /// * *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.
10090    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10091    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10092    /// * *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.
10093    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10094    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10095    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollmentPatchCall<'a, C>
10096    where
10097        T: AsRef<str>,
10098    {
10099        self._additional_params
10100            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10101        self
10102    }
10103
10104    /// Identifies the authorization scope for the method you are building.
10105    ///
10106    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10107    /// [`Scope::CloudPlatform`].
10108    ///
10109    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10110    /// tokens for more than one scope.
10111    ///
10112    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10113    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10114    /// sufficient, a read-write scope will do as well.
10115    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollmentPatchCall<'a, C>
10116    where
10117        St: AsRef<str>,
10118    {
10119        self._scopes.insert(String::from(scope.as_ref()));
10120        self
10121    }
10122    /// Identifies the authorization scope(s) for the method you are building.
10123    ///
10124    /// See [`Self::add_scope()`] for details.
10125    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnrollmentPatchCall<'a, C>
10126    where
10127        I: IntoIterator<Item = St>,
10128        St: AsRef<str>,
10129    {
10130        self._scopes
10131            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10132        self
10133    }
10134
10135    /// Removes all scopes, and no default scope will be used either.
10136    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10137    /// for details).
10138    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentPatchCall<'a, C> {
10139        self._scopes.clear();
10140        self
10141    }
10142}
10143
10144/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
10145///
10146/// A builder for the *locations.enrollments.setIamPolicy* method supported by a *project* resource.
10147/// It is not used directly, but through a [`ProjectMethods`] instance.
10148///
10149/// # Example
10150///
10151/// Instantiate a resource method builder
10152///
10153/// ```test_harness,no_run
10154/// # extern crate hyper;
10155/// # extern crate hyper_rustls;
10156/// # extern crate google_eventarc1 as eventarc1;
10157/// use eventarc1::api::SetIamPolicyRequest;
10158/// # async fn dox() {
10159/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10160///
10161/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10162/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10163/// #     .with_native_roots()
10164/// #     .unwrap()
10165/// #     .https_only()
10166/// #     .enable_http2()
10167/// #     .build();
10168///
10169/// # let executor = hyper_util::rt::TokioExecutor::new();
10170/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10171/// #     secret,
10172/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10173/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10174/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10175/// #     ),
10176/// # ).build().await.unwrap();
10177///
10178/// # let client = hyper_util::client::legacy::Client::builder(
10179/// #     hyper_util::rt::TokioExecutor::new()
10180/// # )
10181/// # .build(
10182/// #     hyper_rustls::HttpsConnectorBuilder::new()
10183/// #         .with_native_roots()
10184/// #         .unwrap()
10185/// #         .https_or_http()
10186/// #         .enable_http2()
10187/// #         .build()
10188/// # );
10189/// # let mut hub = Eventarc::new(client, auth);
10190/// // As the method needs a request, you would usually fill it with the desired information
10191/// // into the respective structure. Some of the parts shown here might not be applicable !
10192/// // Values shown here are possibly random and not representative !
10193/// let mut req = SetIamPolicyRequest::default();
10194///
10195/// // You can configure optional parameters by calling the respective setters at will, and
10196/// // execute the final call using `doit()`.
10197/// // Values shown here are possibly random and not representative !
10198/// let result = hub.projects().locations_enrollments_set_iam_policy(req, "resource")
10199///              .doit().await;
10200/// # }
10201/// ```
10202pub struct ProjectLocationEnrollmentSetIamPolicyCall<'a, C>
10203where
10204    C: 'a,
10205{
10206    hub: &'a Eventarc<C>,
10207    _request: SetIamPolicyRequest,
10208    _resource: String,
10209    _delegate: Option<&'a mut dyn common::Delegate>,
10210    _additional_params: HashMap<String, String>,
10211    _scopes: BTreeSet<String>,
10212}
10213
10214impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentSetIamPolicyCall<'a, C> {}
10215
10216impl<'a, C> ProjectLocationEnrollmentSetIamPolicyCall<'a, C>
10217where
10218    C: common::Connector,
10219{
10220    /// Perform the operation you have build so far.
10221    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10222        use std::borrow::Cow;
10223        use std::io::{Read, Seek};
10224
10225        use common::{url::Params, ToParts};
10226        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10227
10228        let mut dd = common::DefaultDelegate;
10229        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10230        dlg.begin(common::MethodInfo {
10231            id: "eventarc.projects.locations.enrollments.setIamPolicy",
10232            http_method: hyper::Method::POST,
10233        });
10234
10235        for &field in ["alt", "resource"].iter() {
10236            if self._additional_params.contains_key(field) {
10237                dlg.finished(false);
10238                return Err(common::Error::FieldClash(field));
10239            }
10240        }
10241
10242        let mut params = Params::with_capacity(4 + self._additional_params.len());
10243        params.push("resource", self._resource);
10244
10245        params.extend(self._additional_params.iter());
10246
10247        params.push("alt", "json");
10248        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
10249        if self._scopes.is_empty() {
10250            self._scopes
10251                .insert(Scope::CloudPlatform.as_ref().to_string());
10252        }
10253
10254        #[allow(clippy::single_element_loop)]
10255        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10256            url = params.uri_replacement(url, param_name, find_this, true);
10257        }
10258        {
10259            let to_remove = ["resource"];
10260            params.remove_params(&to_remove);
10261        }
10262
10263        let url = params.parse_with_url(&url);
10264
10265        let mut json_mime_type = mime::APPLICATION_JSON;
10266        let mut request_value_reader = {
10267            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10268            common::remove_json_null_values(&mut value);
10269            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10270            serde_json::to_writer(&mut dst, &value).unwrap();
10271            dst
10272        };
10273        let request_size = request_value_reader
10274            .seek(std::io::SeekFrom::End(0))
10275            .unwrap();
10276        request_value_reader
10277            .seek(std::io::SeekFrom::Start(0))
10278            .unwrap();
10279
10280        loop {
10281            let token = match self
10282                .hub
10283                .auth
10284                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10285                .await
10286            {
10287                Ok(token) => token,
10288                Err(e) => match dlg.token(e) {
10289                    Ok(token) => token,
10290                    Err(e) => {
10291                        dlg.finished(false);
10292                        return Err(common::Error::MissingToken(e));
10293                    }
10294                },
10295            };
10296            request_value_reader
10297                .seek(std::io::SeekFrom::Start(0))
10298                .unwrap();
10299            let mut req_result = {
10300                let client = &self.hub.client;
10301                dlg.pre_request();
10302                let mut req_builder = hyper::Request::builder()
10303                    .method(hyper::Method::POST)
10304                    .uri(url.as_str())
10305                    .header(USER_AGENT, self.hub._user_agent.clone());
10306
10307                if let Some(token) = token.as_ref() {
10308                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10309                }
10310
10311                let request = req_builder
10312                    .header(CONTENT_TYPE, json_mime_type.to_string())
10313                    .header(CONTENT_LENGTH, request_size as u64)
10314                    .body(common::to_body(
10315                        request_value_reader.get_ref().clone().into(),
10316                    ));
10317
10318                client.request(request.unwrap()).await
10319            };
10320
10321            match req_result {
10322                Err(err) => {
10323                    if let common::Retry::After(d) = dlg.http_error(&err) {
10324                        sleep(d).await;
10325                        continue;
10326                    }
10327                    dlg.finished(false);
10328                    return Err(common::Error::HttpError(err));
10329                }
10330                Ok(res) => {
10331                    let (mut parts, body) = res.into_parts();
10332                    let mut body = common::Body::new(body);
10333                    if !parts.status.is_success() {
10334                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10335                        let error = serde_json::from_str(&common::to_string(&bytes));
10336                        let response = common::to_response(parts, bytes.into());
10337
10338                        if let common::Retry::After(d) =
10339                            dlg.http_failure(&response, error.as_ref().ok())
10340                        {
10341                            sleep(d).await;
10342                            continue;
10343                        }
10344
10345                        dlg.finished(false);
10346
10347                        return Err(match error {
10348                            Ok(value) => common::Error::BadRequest(value),
10349                            _ => common::Error::Failure(response),
10350                        });
10351                    }
10352                    let response = {
10353                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10354                        let encoded = common::to_string(&bytes);
10355                        match serde_json::from_str(&encoded) {
10356                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10357                            Err(error) => {
10358                                dlg.response_json_decode_error(&encoded, &error);
10359                                return Err(common::Error::JsonDecodeError(
10360                                    encoded.to_string(),
10361                                    error,
10362                                ));
10363                            }
10364                        }
10365                    };
10366
10367                    dlg.finished(true);
10368                    return Ok(response);
10369                }
10370            }
10371        }
10372    }
10373
10374    ///
10375    /// Sets the *request* property to the given value.
10376    ///
10377    /// Even though the property as already been set when instantiating this call,
10378    /// we provide this method for API completeness.
10379    pub fn request(
10380        mut self,
10381        new_value: SetIamPolicyRequest,
10382    ) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C> {
10383        self._request = new_value;
10384        self
10385    }
10386    /// 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.
10387    ///
10388    /// Sets the *resource* path property to the given value.
10389    ///
10390    /// Even though the property as already been set when instantiating this call,
10391    /// we provide this method for API completeness.
10392    pub fn resource(mut self, new_value: &str) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C> {
10393        self._resource = new_value.to_string();
10394        self
10395    }
10396    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10397    /// while executing the actual API request.
10398    ///
10399    /// ````text
10400    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10401    /// ````
10402    ///
10403    /// Sets the *delegate* property to the given value.
10404    pub fn delegate(
10405        mut self,
10406        new_value: &'a mut dyn common::Delegate,
10407    ) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C> {
10408        self._delegate = Some(new_value);
10409        self
10410    }
10411
10412    /// Set any additional parameter of the query string used in the request.
10413    /// It should be used to set parameters which are not yet available through their own
10414    /// setters.
10415    ///
10416    /// Please note that this method must not be used to set any of the known parameters
10417    /// which have their own setter method. If done anyway, the request will fail.
10418    ///
10419    /// # Additional Parameters
10420    ///
10421    /// * *$.xgafv* (query-string) - V1 error format.
10422    /// * *access_token* (query-string) - OAuth access token.
10423    /// * *alt* (query-string) - Data format for response.
10424    /// * *callback* (query-string) - JSONP
10425    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10426    /// * *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.
10427    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10428    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10429    /// * *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.
10430    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10431    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10432    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C>
10433    where
10434        T: AsRef<str>,
10435    {
10436        self._additional_params
10437            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10438        self
10439    }
10440
10441    /// Identifies the authorization scope for the method you are building.
10442    ///
10443    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10444    /// [`Scope::CloudPlatform`].
10445    ///
10446    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10447    /// tokens for more than one scope.
10448    ///
10449    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10450    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10451    /// sufficient, a read-write scope will do as well.
10452    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C>
10453    where
10454        St: AsRef<str>,
10455    {
10456        self._scopes.insert(String::from(scope.as_ref()));
10457        self
10458    }
10459    /// Identifies the authorization scope(s) for the method you are building.
10460    ///
10461    /// See [`Self::add_scope()`] for details.
10462    pub fn add_scopes<I, St>(
10463        mut self,
10464        scopes: I,
10465    ) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C>
10466    where
10467        I: IntoIterator<Item = St>,
10468        St: AsRef<str>,
10469    {
10470        self._scopes
10471            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10472        self
10473    }
10474
10475    /// Removes all scopes, and no default scope will be used either.
10476    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10477    /// for details).
10478    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentSetIamPolicyCall<'a, C> {
10479        self._scopes.clear();
10480        self
10481    }
10482}
10483
10484/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
10485///
10486/// A builder for the *locations.enrollments.testIamPermissions* method supported by a *project* resource.
10487/// It is not used directly, but through a [`ProjectMethods`] instance.
10488///
10489/// # Example
10490///
10491/// Instantiate a resource method builder
10492///
10493/// ```test_harness,no_run
10494/// # extern crate hyper;
10495/// # extern crate hyper_rustls;
10496/// # extern crate google_eventarc1 as eventarc1;
10497/// use eventarc1::api::TestIamPermissionsRequest;
10498/// # async fn dox() {
10499/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10500///
10501/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10502/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10503/// #     .with_native_roots()
10504/// #     .unwrap()
10505/// #     .https_only()
10506/// #     .enable_http2()
10507/// #     .build();
10508///
10509/// # let executor = hyper_util::rt::TokioExecutor::new();
10510/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10511/// #     secret,
10512/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10513/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10514/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10515/// #     ),
10516/// # ).build().await.unwrap();
10517///
10518/// # let client = hyper_util::client::legacy::Client::builder(
10519/// #     hyper_util::rt::TokioExecutor::new()
10520/// # )
10521/// # .build(
10522/// #     hyper_rustls::HttpsConnectorBuilder::new()
10523/// #         .with_native_roots()
10524/// #         .unwrap()
10525/// #         .https_or_http()
10526/// #         .enable_http2()
10527/// #         .build()
10528/// # );
10529/// # let mut hub = Eventarc::new(client, auth);
10530/// // As the method needs a request, you would usually fill it with the desired information
10531/// // into the respective structure. Some of the parts shown here might not be applicable !
10532/// // Values shown here are possibly random and not representative !
10533/// let mut req = TestIamPermissionsRequest::default();
10534///
10535/// // You can configure optional parameters by calling the respective setters at will, and
10536/// // execute the final call using `doit()`.
10537/// // Values shown here are possibly random and not representative !
10538/// let result = hub.projects().locations_enrollments_test_iam_permissions(req, "resource")
10539///              .doit().await;
10540/// # }
10541/// ```
10542pub struct ProjectLocationEnrollmentTestIamPermissionCall<'a, C>
10543where
10544    C: 'a,
10545{
10546    hub: &'a Eventarc<C>,
10547    _request: TestIamPermissionsRequest,
10548    _resource: String,
10549    _delegate: Option<&'a mut dyn common::Delegate>,
10550    _additional_params: HashMap<String, String>,
10551    _scopes: BTreeSet<String>,
10552}
10553
10554impl<'a, C> common::CallBuilder for ProjectLocationEnrollmentTestIamPermissionCall<'a, C> {}
10555
10556impl<'a, C> ProjectLocationEnrollmentTestIamPermissionCall<'a, C>
10557where
10558    C: common::Connector,
10559{
10560    /// Perform the operation you have build so far.
10561    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
10562        use std::borrow::Cow;
10563        use std::io::{Read, Seek};
10564
10565        use common::{url::Params, ToParts};
10566        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10567
10568        let mut dd = common::DefaultDelegate;
10569        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10570        dlg.begin(common::MethodInfo {
10571            id: "eventarc.projects.locations.enrollments.testIamPermissions",
10572            http_method: hyper::Method::POST,
10573        });
10574
10575        for &field in ["alt", "resource"].iter() {
10576            if self._additional_params.contains_key(field) {
10577                dlg.finished(false);
10578                return Err(common::Error::FieldClash(field));
10579            }
10580        }
10581
10582        let mut params = Params::with_capacity(4 + self._additional_params.len());
10583        params.push("resource", self._resource);
10584
10585        params.extend(self._additional_params.iter());
10586
10587        params.push("alt", "json");
10588        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
10589        if self._scopes.is_empty() {
10590            self._scopes
10591                .insert(Scope::CloudPlatform.as_ref().to_string());
10592        }
10593
10594        #[allow(clippy::single_element_loop)]
10595        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10596            url = params.uri_replacement(url, param_name, find_this, true);
10597        }
10598        {
10599            let to_remove = ["resource"];
10600            params.remove_params(&to_remove);
10601        }
10602
10603        let url = params.parse_with_url(&url);
10604
10605        let mut json_mime_type = mime::APPLICATION_JSON;
10606        let mut request_value_reader = {
10607            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10608            common::remove_json_null_values(&mut value);
10609            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10610            serde_json::to_writer(&mut dst, &value).unwrap();
10611            dst
10612        };
10613        let request_size = request_value_reader
10614            .seek(std::io::SeekFrom::End(0))
10615            .unwrap();
10616        request_value_reader
10617            .seek(std::io::SeekFrom::Start(0))
10618            .unwrap();
10619
10620        loop {
10621            let token = match self
10622                .hub
10623                .auth
10624                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10625                .await
10626            {
10627                Ok(token) => token,
10628                Err(e) => match dlg.token(e) {
10629                    Ok(token) => token,
10630                    Err(e) => {
10631                        dlg.finished(false);
10632                        return Err(common::Error::MissingToken(e));
10633                    }
10634                },
10635            };
10636            request_value_reader
10637                .seek(std::io::SeekFrom::Start(0))
10638                .unwrap();
10639            let mut req_result = {
10640                let client = &self.hub.client;
10641                dlg.pre_request();
10642                let mut req_builder = hyper::Request::builder()
10643                    .method(hyper::Method::POST)
10644                    .uri(url.as_str())
10645                    .header(USER_AGENT, self.hub._user_agent.clone());
10646
10647                if let Some(token) = token.as_ref() {
10648                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10649                }
10650
10651                let request = req_builder
10652                    .header(CONTENT_TYPE, json_mime_type.to_string())
10653                    .header(CONTENT_LENGTH, request_size as u64)
10654                    .body(common::to_body(
10655                        request_value_reader.get_ref().clone().into(),
10656                    ));
10657
10658                client.request(request.unwrap()).await
10659            };
10660
10661            match req_result {
10662                Err(err) => {
10663                    if let common::Retry::After(d) = dlg.http_error(&err) {
10664                        sleep(d).await;
10665                        continue;
10666                    }
10667                    dlg.finished(false);
10668                    return Err(common::Error::HttpError(err));
10669                }
10670                Ok(res) => {
10671                    let (mut parts, body) = res.into_parts();
10672                    let mut body = common::Body::new(body);
10673                    if !parts.status.is_success() {
10674                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10675                        let error = serde_json::from_str(&common::to_string(&bytes));
10676                        let response = common::to_response(parts, bytes.into());
10677
10678                        if let common::Retry::After(d) =
10679                            dlg.http_failure(&response, error.as_ref().ok())
10680                        {
10681                            sleep(d).await;
10682                            continue;
10683                        }
10684
10685                        dlg.finished(false);
10686
10687                        return Err(match error {
10688                            Ok(value) => common::Error::BadRequest(value),
10689                            _ => common::Error::Failure(response),
10690                        });
10691                    }
10692                    let response = {
10693                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10694                        let encoded = common::to_string(&bytes);
10695                        match serde_json::from_str(&encoded) {
10696                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10697                            Err(error) => {
10698                                dlg.response_json_decode_error(&encoded, &error);
10699                                return Err(common::Error::JsonDecodeError(
10700                                    encoded.to_string(),
10701                                    error,
10702                                ));
10703                            }
10704                        }
10705                    };
10706
10707                    dlg.finished(true);
10708                    return Ok(response);
10709                }
10710            }
10711        }
10712    }
10713
10714    ///
10715    /// Sets the *request* property to the given value.
10716    ///
10717    /// Even though the property as already been set when instantiating this call,
10718    /// we provide this method for API completeness.
10719    pub fn request(
10720        mut self,
10721        new_value: TestIamPermissionsRequest,
10722    ) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C> {
10723        self._request = new_value;
10724        self
10725    }
10726    /// 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.
10727    ///
10728    /// Sets the *resource* path property to the given value.
10729    ///
10730    /// Even though the property as already been set when instantiating this call,
10731    /// we provide this method for API completeness.
10732    pub fn resource(
10733        mut self,
10734        new_value: &str,
10735    ) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C> {
10736        self._resource = new_value.to_string();
10737        self
10738    }
10739    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10740    /// while executing the actual API request.
10741    ///
10742    /// ````text
10743    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10744    /// ````
10745    ///
10746    /// Sets the *delegate* property to the given value.
10747    pub fn delegate(
10748        mut self,
10749        new_value: &'a mut dyn common::Delegate,
10750    ) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C> {
10751        self._delegate = Some(new_value);
10752        self
10753    }
10754
10755    /// Set any additional parameter of the query string used in the request.
10756    /// It should be used to set parameters which are not yet available through their own
10757    /// setters.
10758    ///
10759    /// Please note that this method must not be used to set any of the known parameters
10760    /// which have their own setter method. If done anyway, the request will fail.
10761    ///
10762    /// # Additional Parameters
10763    ///
10764    /// * *$.xgafv* (query-string) - V1 error format.
10765    /// * *access_token* (query-string) - OAuth access token.
10766    /// * *alt* (query-string) - Data format for response.
10767    /// * *callback* (query-string) - JSONP
10768    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10769    /// * *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.
10770    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10771    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10772    /// * *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.
10773    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10774    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10775    pub fn param<T>(
10776        mut self,
10777        name: T,
10778        value: T,
10779    ) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C>
10780    where
10781        T: AsRef<str>,
10782    {
10783        self._additional_params
10784            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10785        self
10786    }
10787
10788    /// Identifies the authorization scope for the method you are building.
10789    ///
10790    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10791    /// [`Scope::CloudPlatform`].
10792    ///
10793    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10794    /// tokens for more than one scope.
10795    ///
10796    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10797    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10798    /// sufficient, a read-write scope will do as well.
10799    pub fn add_scope<St>(
10800        mut self,
10801        scope: St,
10802    ) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C>
10803    where
10804        St: AsRef<str>,
10805    {
10806        self._scopes.insert(String::from(scope.as_ref()));
10807        self
10808    }
10809    /// Identifies the authorization scope(s) for the method you are building.
10810    ///
10811    /// See [`Self::add_scope()`] for details.
10812    pub fn add_scopes<I, St>(
10813        mut self,
10814        scopes: I,
10815    ) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C>
10816    where
10817        I: IntoIterator<Item = St>,
10818        St: AsRef<str>,
10819    {
10820        self._scopes
10821            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10822        self
10823    }
10824
10825    /// Removes all scopes, and no default scope will be used either.
10826    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10827    /// for details).
10828    pub fn clear_scopes(mut self) -> ProjectLocationEnrollmentTestIamPermissionCall<'a, C> {
10829        self._scopes.clear();
10830        self
10831    }
10832}
10833
10834/// Create a new GoogleApiSource in a particular project and location.
10835///
10836/// A builder for the *locations.googleApiSources.create* method supported by a *project* resource.
10837/// It is not used directly, but through a [`ProjectMethods`] instance.
10838///
10839/// # Example
10840///
10841/// Instantiate a resource method builder
10842///
10843/// ```test_harness,no_run
10844/// # extern crate hyper;
10845/// # extern crate hyper_rustls;
10846/// # extern crate google_eventarc1 as eventarc1;
10847/// use eventarc1::api::GoogleApiSource;
10848/// # async fn dox() {
10849/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10850///
10851/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10852/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10853/// #     .with_native_roots()
10854/// #     .unwrap()
10855/// #     .https_only()
10856/// #     .enable_http2()
10857/// #     .build();
10858///
10859/// # let executor = hyper_util::rt::TokioExecutor::new();
10860/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10861/// #     secret,
10862/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10863/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10864/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10865/// #     ),
10866/// # ).build().await.unwrap();
10867///
10868/// # let client = hyper_util::client::legacy::Client::builder(
10869/// #     hyper_util::rt::TokioExecutor::new()
10870/// # )
10871/// # .build(
10872/// #     hyper_rustls::HttpsConnectorBuilder::new()
10873/// #         .with_native_roots()
10874/// #         .unwrap()
10875/// #         .https_or_http()
10876/// #         .enable_http2()
10877/// #         .build()
10878/// # );
10879/// # let mut hub = Eventarc::new(client, auth);
10880/// // As the method needs a request, you would usually fill it with the desired information
10881/// // into the respective structure. Some of the parts shown here might not be applicable !
10882/// // Values shown here are possibly random and not representative !
10883/// let mut req = GoogleApiSource::default();
10884///
10885/// // You can configure optional parameters by calling the respective setters at will, and
10886/// // execute the final call using `doit()`.
10887/// // Values shown here are possibly random and not representative !
10888/// let result = hub.projects().locations_google_api_sources_create(req, "parent")
10889///              .validate_only(false)
10890///              .google_api_source_id("Stet")
10891///              .doit().await;
10892/// # }
10893/// ```
10894pub struct ProjectLocationGoogleApiSourceCreateCall<'a, C>
10895where
10896    C: 'a,
10897{
10898    hub: &'a Eventarc<C>,
10899    _request: GoogleApiSource,
10900    _parent: String,
10901    _validate_only: Option<bool>,
10902    _google_api_source_id: Option<String>,
10903    _delegate: Option<&'a mut dyn common::Delegate>,
10904    _additional_params: HashMap<String, String>,
10905    _scopes: BTreeSet<String>,
10906}
10907
10908impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourceCreateCall<'a, C> {}
10909
10910impl<'a, C> ProjectLocationGoogleApiSourceCreateCall<'a, C>
10911where
10912    C: common::Connector,
10913{
10914    /// Perform the operation you have build so far.
10915    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
10916        use std::borrow::Cow;
10917        use std::io::{Read, Seek};
10918
10919        use common::{url::Params, ToParts};
10920        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10921
10922        let mut dd = common::DefaultDelegate;
10923        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10924        dlg.begin(common::MethodInfo {
10925            id: "eventarc.projects.locations.googleApiSources.create",
10926            http_method: hyper::Method::POST,
10927        });
10928
10929        for &field in ["alt", "parent", "validateOnly", "googleApiSourceId"].iter() {
10930            if self._additional_params.contains_key(field) {
10931                dlg.finished(false);
10932                return Err(common::Error::FieldClash(field));
10933            }
10934        }
10935
10936        let mut params = Params::with_capacity(6 + self._additional_params.len());
10937        params.push("parent", self._parent);
10938        if let Some(value) = self._validate_only.as_ref() {
10939            params.push("validateOnly", value.to_string());
10940        }
10941        if let Some(value) = self._google_api_source_id.as_ref() {
10942            params.push("googleApiSourceId", value);
10943        }
10944
10945        params.extend(self._additional_params.iter());
10946
10947        params.push("alt", "json");
10948        let mut url = self.hub._base_url.clone() + "v1/{+parent}/googleApiSources";
10949        if self._scopes.is_empty() {
10950            self._scopes
10951                .insert(Scope::CloudPlatform.as_ref().to_string());
10952        }
10953
10954        #[allow(clippy::single_element_loop)]
10955        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10956            url = params.uri_replacement(url, param_name, find_this, true);
10957        }
10958        {
10959            let to_remove = ["parent"];
10960            params.remove_params(&to_remove);
10961        }
10962
10963        let url = params.parse_with_url(&url);
10964
10965        let mut json_mime_type = mime::APPLICATION_JSON;
10966        let mut request_value_reader = {
10967            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10968            common::remove_json_null_values(&mut value);
10969            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10970            serde_json::to_writer(&mut dst, &value).unwrap();
10971            dst
10972        };
10973        let request_size = request_value_reader
10974            .seek(std::io::SeekFrom::End(0))
10975            .unwrap();
10976        request_value_reader
10977            .seek(std::io::SeekFrom::Start(0))
10978            .unwrap();
10979
10980        loop {
10981            let token = match self
10982                .hub
10983                .auth
10984                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10985                .await
10986            {
10987                Ok(token) => token,
10988                Err(e) => match dlg.token(e) {
10989                    Ok(token) => token,
10990                    Err(e) => {
10991                        dlg.finished(false);
10992                        return Err(common::Error::MissingToken(e));
10993                    }
10994                },
10995            };
10996            request_value_reader
10997                .seek(std::io::SeekFrom::Start(0))
10998                .unwrap();
10999            let mut req_result = {
11000                let client = &self.hub.client;
11001                dlg.pre_request();
11002                let mut req_builder = hyper::Request::builder()
11003                    .method(hyper::Method::POST)
11004                    .uri(url.as_str())
11005                    .header(USER_AGENT, self.hub._user_agent.clone());
11006
11007                if let Some(token) = token.as_ref() {
11008                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11009                }
11010
11011                let request = req_builder
11012                    .header(CONTENT_TYPE, json_mime_type.to_string())
11013                    .header(CONTENT_LENGTH, request_size as u64)
11014                    .body(common::to_body(
11015                        request_value_reader.get_ref().clone().into(),
11016                    ));
11017
11018                client.request(request.unwrap()).await
11019            };
11020
11021            match req_result {
11022                Err(err) => {
11023                    if let common::Retry::After(d) = dlg.http_error(&err) {
11024                        sleep(d).await;
11025                        continue;
11026                    }
11027                    dlg.finished(false);
11028                    return Err(common::Error::HttpError(err));
11029                }
11030                Ok(res) => {
11031                    let (mut parts, body) = res.into_parts();
11032                    let mut body = common::Body::new(body);
11033                    if !parts.status.is_success() {
11034                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11035                        let error = serde_json::from_str(&common::to_string(&bytes));
11036                        let response = common::to_response(parts, bytes.into());
11037
11038                        if let common::Retry::After(d) =
11039                            dlg.http_failure(&response, error.as_ref().ok())
11040                        {
11041                            sleep(d).await;
11042                            continue;
11043                        }
11044
11045                        dlg.finished(false);
11046
11047                        return Err(match error {
11048                            Ok(value) => common::Error::BadRequest(value),
11049                            _ => common::Error::Failure(response),
11050                        });
11051                    }
11052                    let response = {
11053                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11054                        let encoded = common::to_string(&bytes);
11055                        match serde_json::from_str(&encoded) {
11056                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11057                            Err(error) => {
11058                                dlg.response_json_decode_error(&encoded, &error);
11059                                return Err(common::Error::JsonDecodeError(
11060                                    encoded.to_string(),
11061                                    error,
11062                                ));
11063                            }
11064                        }
11065                    };
11066
11067                    dlg.finished(true);
11068                    return Ok(response);
11069                }
11070            }
11071        }
11072    }
11073
11074    ///
11075    /// Sets the *request* property to the given value.
11076    ///
11077    /// Even though the property as already been set when instantiating this call,
11078    /// we provide this method for API completeness.
11079    pub fn request(
11080        mut self,
11081        new_value: GoogleApiSource,
11082    ) -> ProjectLocationGoogleApiSourceCreateCall<'a, C> {
11083        self._request = new_value;
11084        self
11085    }
11086    /// Required. The parent collection in which to add this google api source.
11087    ///
11088    /// Sets the *parent* path property to the given value.
11089    ///
11090    /// Even though the property as already been set when instantiating this call,
11091    /// we provide this method for API completeness.
11092    pub fn parent(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceCreateCall<'a, C> {
11093        self._parent = new_value.to_string();
11094        self
11095    }
11096    /// Optional. If set, validate the request and preview the review, but do not post it.
11097    ///
11098    /// Sets the *validate only* query property to the given value.
11099    pub fn validate_only(
11100        mut self,
11101        new_value: bool,
11102    ) -> ProjectLocationGoogleApiSourceCreateCall<'a, C> {
11103        self._validate_only = Some(new_value);
11104        self
11105    }
11106    /// Required. The user-provided ID to be assigned to the GoogleApiSource. It should match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
11107    ///
11108    /// Sets the *google api source id* query property to the given value.
11109    pub fn google_api_source_id(
11110        mut self,
11111        new_value: &str,
11112    ) -> ProjectLocationGoogleApiSourceCreateCall<'a, C> {
11113        self._google_api_source_id = Some(new_value.to_string());
11114        self
11115    }
11116    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11117    /// while executing the actual API request.
11118    ///
11119    /// ````text
11120    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11121    /// ````
11122    ///
11123    /// Sets the *delegate* property to the given value.
11124    pub fn delegate(
11125        mut self,
11126        new_value: &'a mut dyn common::Delegate,
11127    ) -> ProjectLocationGoogleApiSourceCreateCall<'a, C> {
11128        self._delegate = Some(new_value);
11129        self
11130    }
11131
11132    /// Set any additional parameter of the query string used in the request.
11133    /// It should be used to set parameters which are not yet available through their own
11134    /// setters.
11135    ///
11136    /// Please note that this method must not be used to set any of the known parameters
11137    /// which have their own setter method. If done anyway, the request will fail.
11138    ///
11139    /// # Additional Parameters
11140    ///
11141    /// * *$.xgafv* (query-string) - V1 error format.
11142    /// * *access_token* (query-string) - OAuth access token.
11143    /// * *alt* (query-string) - Data format for response.
11144    /// * *callback* (query-string) - JSONP
11145    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11146    /// * *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.
11147    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11148    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11149    /// * *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.
11150    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11151    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11152    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGoogleApiSourceCreateCall<'a, C>
11153    where
11154        T: AsRef<str>,
11155    {
11156        self._additional_params
11157            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11158        self
11159    }
11160
11161    /// Identifies the authorization scope for the method you are building.
11162    ///
11163    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11164    /// [`Scope::CloudPlatform`].
11165    ///
11166    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11167    /// tokens for more than one scope.
11168    ///
11169    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11170    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11171    /// sufficient, a read-write scope will do as well.
11172    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGoogleApiSourceCreateCall<'a, C>
11173    where
11174        St: AsRef<str>,
11175    {
11176        self._scopes.insert(String::from(scope.as_ref()));
11177        self
11178    }
11179    /// Identifies the authorization scope(s) for the method you are building.
11180    ///
11181    /// See [`Self::add_scope()`] for details.
11182    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGoogleApiSourceCreateCall<'a, C>
11183    where
11184        I: IntoIterator<Item = St>,
11185        St: AsRef<str>,
11186    {
11187        self._scopes
11188            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11189        self
11190    }
11191
11192    /// Removes all scopes, and no default scope will be used either.
11193    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11194    /// for details).
11195    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourceCreateCall<'a, C> {
11196        self._scopes.clear();
11197        self
11198    }
11199}
11200
11201/// Delete a single GoogleApiSource.
11202///
11203/// A builder for the *locations.googleApiSources.delete* method supported by a *project* resource.
11204/// It is not used directly, but through a [`ProjectMethods`] instance.
11205///
11206/// # Example
11207///
11208/// Instantiate a resource method builder
11209///
11210/// ```test_harness,no_run
11211/// # extern crate hyper;
11212/// # extern crate hyper_rustls;
11213/// # extern crate google_eventarc1 as eventarc1;
11214/// # async fn dox() {
11215/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11216///
11217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11218/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11219/// #     .with_native_roots()
11220/// #     .unwrap()
11221/// #     .https_only()
11222/// #     .enable_http2()
11223/// #     .build();
11224///
11225/// # let executor = hyper_util::rt::TokioExecutor::new();
11226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11227/// #     secret,
11228/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11229/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11230/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11231/// #     ),
11232/// # ).build().await.unwrap();
11233///
11234/// # let client = hyper_util::client::legacy::Client::builder(
11235/// #     hyper_util::rt::TokioExecutor::new()
11236/// # )
11237/// # .build(
11238/// #     hyper_rustls::HttpsConnectorBuilder::new()
11239/// #         .with_native_roots()
11240/// #         .unwrap()
11241/// #         .https_or_http()
11242/// #         .enable_http2()
11243/// #         .build()
11244/// # );
11245/// # let mut hub = Eventarc::new(client, auth);
11246/// // You can configure optional parameters by calling the respective setters at will, and
11247/// // execute the final call using `doit()`.
11248/// // Values shown here are possibly random and not representative !
11249/// let result = hub.projects().locations_google_api_sources_delete("name")
11250///              .validate_only(true)
11251///              .etag("Lorem")
11252///              .allow_missing(true)
11253///              .doit().await;
11254/// # }
11255/// ```
11256pub struct ProjectLocationGoogleApiSourceDeleteCall<'a, C>
11257where
11258    C: 'a,
11259{
11260    hub: &'a Eventarc<C>,
11261    _name: String,
11262    _validate_only: Option<bool>,
11263    _etag: Option<String>,
11264    _allow_missing: Option<bool>,
11265    _delegate: Option<&'a mut dyn common::Delegate>,
11266    _additional_params: HashMap<String, String>,
11267    _scopes: BTreeSet<String>,
11268}
11269
11270impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourceDeleteCall<'a, C> {}
11271
11272impl<'a, C> ProjectLocationGoogleApiSourceDeleteCall<'a, C>
11273where
11274    C: common::Connector,
11275{
11276    /// Perform the operation you have build so far.
11277    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
11278        use std::borrow::Cow;
11279        use std::io::{Read, Seek};
11280
11281        use common::{url::Params, ToParts};
11282        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11283
11284        let mut dd = common::DefaultDelegate;
11285        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11286        dlg.begin(common::MethodInfo {
11287            id: "eventarc.projects.locations.googleApiSources.delete",
11288            http_method: hyper::Method::DELETE,
11289        });
11290
11291        for &field in ["alt", "name", "validateOnly", "etag", "allowMissing"].iter() {
11292            if self._additional_params.contains_key(field) {
11293                dlg.finished(false);
11294                return Err(common::Error::FieldClash(field));
11295            }
11296        }
11297
11298        let mut params = Params::with_capacity(6 + self._additional_params.len());
11299        params.push("name", self._name);
11300        if let Some(value) = self._validate_only.as_ref() {
11301            params.push("validateOnly", value.to_string());
11302        }
11303        if let Some(value) = self._etag.as_ref() {
11304            params.push("etag", value);
11305        }
11306        if let Some(value) = self._allow_missing.as_ref() {
11307            params.push("allowMissing", value.to_string());
11308        }
11309
11310        params.extend(self._additional_params.iter());
11311
11312        params.push("alt", "json");
11313        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11314        if self._scopes.is_empty() {
11315            self._scopes
11316                .insert(Scope::CloudPlatform.as_ref().to_string());
11317        }
11318
11319        #[allow(clippy::single_element_loop)]
11320        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11321            url = params.uri_replacement(url, param_name, find_this, true);
11322        }
11323        {
11324            let to_remove = ["name"];
11325            params.remove_params(&to_remove);
11326        }
11327
11328        let url = params.parse_with_url(&url);
11329
11330        loop {
11331            let token = match self
11332                .hub
11333                .auth
11334                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11335                .await
11336            {
11337                Ok(token) => token,
11338                Err(e) => match dlg.token(e) {
11339                    Ok(token) => token,
11340                    Err(e) => {
11341                        dlg.finished(false);
11342                        return Err(common::Error::MissingToken(e));
11343                    }
11344                },
11345            };
11346            let mut req_result = {
11347                let client = &self.hub.client;
11348                dlg.pre_request();
11349                let mut req_builder = hyper::Request::builder()
11350                    .method(hyper::Method::DELETE)
11351                    .uri(url.as_str())
11352                    .header(USER_AGENT, self.hub._user_agent.clone());
11353
11354                if let Some(token) = token.as_ref() {
11355                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11356                }
11357
11358                let request = req_builder
11359                    .header(CONTENT_LENGTH, 0_u64)
11360                    .body(common::to_body::<String>(None));
11361
11362                client.request(request.unwrap()).await
11363            };
11364
11365            match req_result {
11366                Err(err) => {
11367                    if let common::Retry::After(d) = dlg.http_error(&err) {
11368                        sleep(d).await;
11369                        continue;
11370                    }
11371                    dlg.finished(false);
11372                    return Err(common::Error::HttpError(err));
11373                }
11374                Ok(res) => {
11375                    let (mut parts, body) = res.into_parts();
11376                    let mut body = common::Body::new(body);
11377                    if !parts.status.is_success() {
11378                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11379                        let error = serde_json::from_str(&common::to_string(&bytes));
11380                        let response = common::to_response(parts, bytes.into());
11381
11382                        if let common::Retry::After(d) =
11383                            dlg.http_failure(&response, error.as_ref().ok())
11384                        {
11385                            sleep(d).await;
11386                            continue;
11387                        }
11388
11389                        dlg.finished(false);
11390
11391                        return Err(match error {
11392                            Ok(value) => common::Error::BadRequest(value),
11393                            _ => common::Error::Failure(response),
11394                        });
11395                    }
11396                    let response = {
11397                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11398                        let encoded = common::to_string(&bytes);
11399                        match serde_json::from_str(&encoded) {
11400                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11401                            Err(error) => {
11402                                dlg.response_json_decode_error(&encoded, &error);
11403                                return Err(common::Error::JsonDecodeError(
11404                                    encoded.to_string(),
11405                                    error,
11406                                ));
11407                            }
11408                        }
11409                    };
11410
11411                    dlg.finished(true);
11412                    return Ok(response);
11413                }
11414            }
11415        }
11416    }
11417
11418    /// Required. The name of the GoogleApiSource to be deleted.
11419    ///
11420    /// Sets the *name* path property to the given value.
11421    ///
11422    /// Even though the property as already been set when instantiating this call,
11423    /// we provide this method for API completeness.
11424    pub fn name(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C> {
11425        self._name = new_value.to_string();
11426        self
11427    }
11428    /// Optional. If set, validate the request and preview the review, but do not post it.
11429    ///
11430    /// Sets the *validate only* query property to the given value.
11431    pub fn validate_only(
11432        mut self,
11433        new_value: bool,
11434    ) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C> {
11435        self._validate_only = Some(new_value);
11436        self
11437    }
11438    /// Optional. If provided, the MessageBus will only be deleted if the etag matches the current etag on the resource.
11439    ///
11440    /// Sets the *etag* query property to the given value.
11441    pub fn etag(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C> {
11442        self._etag = Some(new_value.to_string());
11443        self
11444    }
11445    /// Optional. If set to true, and the MessageBus is not found, the request will succeed but no action will be taken on the server.
11446    ///
11447    /// Sets the *allow missing* query property to the given value.
11448    pub fn allow_missing(
11449        mut self,
11450        new_value: bool,
11451    ) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C> {
11452        self._allow_missing = Some(new_value);
11453        self
11454    }
11455    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11456    /// while executing the actual API request.
11457    ///
11458    /// ````text
11459    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11460    /// ````
11461    ///
11462    /// Sets the *delegate* property to the given value.
11463    pub fn delegate(
11464        mut self,
11465        new_value: &'a mut dyn common::Delegate,
11466    ) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C> {
11467        self._delegate = Some(new_value);
11468        self
11469    }
11470
11471    /// Set any additional parameter of the query string used in the request.
11472    /// It should be used to set parameters which are not yet available through their own
11473    /// setters.
11474    ///
11475    /// Please note that this method must not be used to set any of the known parameters
11476    /// which have their own setter method. If done anyway, the request will fail.
11477    ///
11478    /// # Additional Parameters
11479    ///
11480    /// * *$.xgafv* (query-string) - V1 error format.
11481    /// * *access_token* (query-string) - OAuth access token.
11482    /// * *alt* (query-string) - Data format for response.
11483    /// * *callback* (query-string) - JSONP
11484    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11485    /// * *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.
11486    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11487    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11488    /// * *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.
11489    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11490    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11491    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C>
11492    where
11493        T: AsRef<str>,
11494    {
11495        self._additional_params
11496            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11497        self
11498    }
11499
11500    /// Identifies the authorization scope for the method you are building.
11501    ///
11502    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11503    /// [`Scope::CloudPlatform`].
11504    ///
11505    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11506    /// tokens for more than one scope.
11507    ///
11508    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11509    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11510    /// sufficient, a read-write scope will do as well.
11511    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C>
11512    where
11513        St: AsRef<str>,
11514    {
11515        self._scopes.insert(String::from(scope.as_ref()));
11516        self
11517    }
11518    /// Identifies the authorization scope(s) for the method you are building.
11519    ///
11520    /// See [`Self::add_scope()`] for details.
11521    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C>
11522    where
11523        I: IntoIterator<Item = St>,
11524        St: AsRef<str>,
11525    {
11526        self._scopes
11527            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11528        self
11529    }
11530
11531    /// Removes all scopes, and no default scope will be used either.
11532    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11533    /// for details).
11534    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourceDeleteCall<'a, C> {
11535        self._scopes.clear();
11536        self
11537    }
11538}
11539
11540/// Get a single GoogleApiSource.
11541///
11542/// A builder for the *locations.googleApiSources.get* method supported by a *project* resource.
11543/// It is not used directly, but through a [`ProjectMethods`] instance.
11544///
11545/// # Example
11546///
11547/// Instantiate a resource method builder
11548///
11549/// ```test_harness,no_run
11550/// # extern crate hyper;
11551/// # extern crate hyper_rustls;
11552/// # extern crate google_eventarc1 as eventarc1;
11553/// # async fn dox() {
11554/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11555///
11556/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11557/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11558/// #     .with_native_roots()
11559/// #     .unwrap()
11560/// #     .https_only()
11561/// #     .enable_http2()
11562/// #     .build();
11563///
11564/// # let executor = hyper_util::rt::TokioExecutor::new();
11565/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11566/// #     secret,
11567/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11568/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11569/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11570/// #     ),
11571/// # ).build().await.unwrap();
11572///
11573/// # let client = hyper_util::client::legacy::Client::builder(
11574/// #     hyper_util::rt::TokioExecutor::new()
11575/// # )
11576/// # .build(
11577/// #     hyper_rustls::HttpsConnectorBuilder::new()
11578/// #         .with_native_roots()
11579/// #         .unwrap()
11580/// #         .https_or_http()
11581/// #         .enable_http2()
11582/// #         .build()
11583/// # );
11584/// # let mut hub = Eventarc::new(client, auth);
11585/// // You can configure optional parameters by calling the respective setters at will, and
11586/// // execute the final call using `doit()`.
11587/// // Values shown here are possibly random and not representative !
11588/// let result = hub.projects().locations_google_api_sources_get("name")
11589///              .doit().await;
11590/// # }
11591/// ```
11592pub struct ProjectLocationGoogleApiSourceGetCall<'a, C>
11593where
11594    C: 'a,
11595{
11596    hub: &'a Eventarc<C>,
11597    _name: String,
11598    _delegate: Option<&'a mut dyn common::Delegate>,
11599    _additional_params: HashMap<String, String>,
11600    _scopes: BTreeSet<String>,
11601}
11602
11603impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourceGetCall<'a, C> {}
11604
11605impl<'a, C> ProjectLocationGoogleApiSourceGetCall<'a, C>
11606where
11607    C: common::Connector,
11608{
11609    /// Perform the operation you have build so far.
11610    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleApiSource)> {
11611        use std::borrow::Cow;
11612        use std::io::{Read, Seek};
11613
11614        use common::{url::Params, ToParts};
11615        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11616
11617        let mut dd = common::DefaultDelegate;
11618        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11619        dlg.begin(common::MethodInfo {
11620            id: "eventarc.projects.locations.googleApiSources.get",
11621            http_method: hyper::Method::GET,
11622        });
11623
11624        for &field in ["alt", "name"].iter() {
11625            if self._additional_params.contains_key(field) {
11626                dlg.finished(false);
11627                return Err(common::Error::FieldClash(field));
11628            }
11629        }
11630
11631        let mut params = Params::with_capacity(3 + self._additional_params.len());
11632        params.push("name", self._name);
11633
11634        params.extend(self._additional_params.iter());
11635
11636        params.push("alt", "json");
11637        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11638        if self._scopes.is_empty() {
11639            self._scopes
11640                .insert(Scope::CloudPlatform.as_ref().to_string());
11641        }
11642
11643        #[allow(clippy::single_element_loop)]
11644        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11645            url = params.uri_replacement(url, param_name, find_this, true);
11646        }
11647        {
11648            let to_remove = ["name"];
11649            params.remove_params(&to_remove);
11650        }
11651
11652        let url = params.parse_with_url(&url);
11653
11654        loop {
11655            let token = match self
11656                .hub
11657                .auth
11658                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11659                .await
11660            {
11661                Ok(token) => token,
11662                Err(e) => match dlg.token(e) {
11663                    Ok(token) => token,
11664                    Err(e) => {
11665                        dlg.finished(false);
11666                        return Err(common::Error::MissingToken(e));
11667                    }
11668                },
11669            };
11670            let mut req_result = {
11671                let client = &self.hub.client;
11672                dlg.pre_request();
11673                let mut req_builder = hyper::Request::builder()
11674                    .method(hyper::Method::GET)
11675                    .uri(url.as_str())
11676                    .header(USER_AGENT, self.hub._user_agent.clone());
11677
11678                if let Some(token) = token.as_ref() {
11679                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11680                }
11681
11682                let request = req_builder
11683                    .header(CONTENT_LENGTH, 0_u64)
11684                    .body(common::to_body::<String>(None));
11685
11686                client.request(request.unwrap()).await
11687            };
11688
11689            match req_result {
11690                Err(err) => {
11691                    if let common::Retry::After(d) = dlg.http_error(&err) {
11692                        sleep(d).await;
11693                        continue;
11694                    }
11695                    dlg.finished(false);
11696                    return Err(common::Error::HttpError(err));
11697                }
11698                Ok(res) => {
11699                    let (mut parts, body) = res.into_parts();
11700                    let mut body = common::Body::new(body);
11701                    if !parts.status.is_success() {
11702                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11703                        let error = serde_json::from_str(&common::to_string(&bytes));
11704                        let response = common::to_response(parts, bytes.into());
11705
11706                        if let common::Retry::After(d) =
11707                            dlg.http_failure(&response, error.as_ref().ok())
11708                        {
11709                            sleep(d).await;
11710                            continue;
11711                        }
11712
11713                        dlg.finished(false);
11714
11715                        return Err(match error {
11716                            Ok(value) => common::Error::BadRequest(value),
11717                            _ => common::Error::Failure(response),
11718                        });
11719                    }
11720                    let response = {
11721                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11722                        let encoded = common::to_string(&bytes);
11723                        match serde_json::from_str(&encoded) {
11724                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11725                            Err(error) => {
11726                                dlg.response_json_decode_error(&encoded, &error);
11727                                return Err(common::Error::JsonDecodeError(
11728                                    encoded.to_string(),
11729                                    error,
11730                                ));
11731                            }
11732                        }
11733                    };
11734
11735                    dlg.finished(true);
11736                    return Ok(response);
11737                }
11738            }
11739        }
11740    }
11741
11742    /// Required. The name of the google api source to get.
11743    ///
11744    /// Sets the *name* path property to the given value.
11745    ///
11746    /// Even though the property as already been set when instantiating this call,
11747    /// we provide this method for API completeness.
11748    pub fn name(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceGetCall<'a, C> {
11749        self._name = new_value.to_string();
11750        self
11751    }
11752    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11753    /// while executing the actual API request.
11754    ///
11755    /// ````text
11756    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11757    /// ````
11758    ///
11759    /// Sets the *delegate* property to the given value.
11760    pub fn delegate(
11761        mut self,
11762        new_value: &'a mut dyn common::Delegate,
11763    ) -> ProjectLocationGoogleApiSourceGetCall<'a, C> {
11764        self._delegate = Some(new_value);
11765        self
11766    }
11767
11768    /// Set any additional parameter of the query string used in the request.
11769    /// It should be used to set parameters which are not yet available through their own
11770    /// setters.
11771    ///
11772    /// Please note that this method must not be used to set any of the known parameters
11773    /// which have their own setter method. If done anyway, the request will fail.
11774    ///
11775    /// # Additional Parameters
11776    ///
11777    /// * *$.xgafv* (query-string) - V1 error format.
11778    /// * *access_token* (query-string) - OAuth access token.
11779    /// * *alt* (query-string) - Data format for response.
11780    /// * *callback* (query-string) - JSONP
11781    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11782    /// * *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.
11783    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11784    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11785    /// * *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.
11786    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11787    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11788    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGoogleApiSourceGetCall<'a, C>
11789    where
11790        T: AsRef<str>,
11791    {
11792        self._additional_params
11793            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11794        self
11795    }
11796
11797    /// Identifies the authorization scope for the method you are building.
11798    ///
11799    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11800    /// [`Scope::CloudPlatform`].
11801    ///
11802    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11803    /// tokens for more than one scope.
11804    ///
11805    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11806    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11807    /// sufficient, a read-write scope will do as well.
11808    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGoogleApiSourceGetCall<'a, C>
11809    where
11810        St: AsRef<str>,
11811    {
11812        self._scopes.insert(String::from(scope.as_ref()));
11813        self
11814    }
11815    /// Identifies the authorization scope(s) for the method you are building.
11816    ///
11817    /// See [`Self::add_scope()`] for details.
11818    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGoogleApiSourceGetCall<'a, C>
11819    where
11820        I: IntoIterator<Item = St>,
11821        St: AsRef<str>,
11822    {
11823        self._scopes
11824            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11825        self
11826    }
11827
11828    /// Removes all scopes, and no default scope will be used either.
11829    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11830    /// for details).
11831    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourceGetCall<'a, C> {
11832        self._scopes.clear();
11833        self
11834    }
11835}
11836
11837/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
11838///
11839/// A builder for the *locations.googleApiSources.getIamPolicy* method supported by a *project* resource.
11840/// It is not used directly, but through a [`ProjectMethods`] instance.
11841///
11842/// # Example
11843///
11844/// Instantiate a resource method builder
11845///
11846/// ```test_harness,no_run
11847/// # extern crate hyper;
11848/// # extern crate hyper_rustls;
11849/// # extern crate google_eventarc1 as eventarc1;
11850/// # async fn dox() {
11851/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11852///
11853/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11854/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11855/// #     .with_native_roots()
11856/// #     .unwrap()
11857/// #     .https_only()
11858/// #     .enable_http2()
11859/// #     .build();
11860///
11861/// # let executor = hyper_util::rt::TokioExecutor::new();
11862/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11863/// #     secret,
11864/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11865/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11866/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11867/// #     ),
11868/// # ).build().await.unwrap();
11869///
11870/// # let client = hyper_util::client::legacy::Client::builder(
11871/// #     hyper_util::rt::TokioExecutor::new()
11872/// # )
11873/// # .build(
11874/// #     hyper_rustls::HttpsConnectorBuilder::new()
11875/// #         .with_native_roots()
11876/// #         .unwrap()
11877/// #         .https_or_http()
11878/// #         .enable_http2()
11879/// #         .build()
11880/// # );
11881/// # let mut hub = Eventarc::new(client, auth);
11882/// // You can configure optional parameters by calling the respective setters at will, and
11883/// // execute the final call using `doit()`.
11884/// // Values shown here are possibly random and not representative !
11885/// let result = hub.projects().locations_google_api_sources_get_iam_policy("resource")
11886///              .options_requested_policy_version(-59)
11887///              .doit().await;
11888/// # }
11889/// ```
11890pub struct ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C>
11891where
11892    C: 'a,
11893{
11894    hub: &'a Eventarc<C>,
11895    _resource: String,
11896    _options_requested_policy_version: Option<i32>,
11897    _delegate: Option<&'a mut dyn common::Delegate>,
11898    _additional_params: HashMap<String, String>,
11899    _scopes: BTreeSet<String>,
11900}
11901
11902impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C> {}
11903
11904impl<'a, C> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C>
11905where
11906    C: common::Connector,
11907{
11908    /// Perform the operation you have build so far.
11909    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
11910        use std::borrow::Cow;
11911        use std::io::{Read, Seek};
11912
11913        use common::{url::Params, ToParts};
11914        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11915
11916        let mut dd = common::DefaultDelegate;
11917        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11918        dlg.begin(common::MethodInfo {
11919            id: "eventarc.projects.locations.googleApiSources.getIamPolicy",
11920            http_method: hyper::Method::GET,
11921        });
11922
11923        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
11924            if self._additional_params.contains_key(field) {
11925                dlg.finished(false);
11926                return Err(common::Error::FieldClash(field));
11927            }
11928        }
11929
11930        let mut params = Params::with_capacity(4 + self._additional_params.len());
11931        params.push("resource", self._resource);
11932        if let Some(value) = self._options_requested_policy_version.as_ref() {
11933            params.push("options.requestedPolicyVersion", value.to_string());
11934        }
11935
11936        params.extend(self._additional_params.iter());
11937
11938        params.push("alt", "json");
11939        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
11940        if self._scopes.is_empty() {
11941            self._scopes
11942                .insert(Scope::CloudPlatform.as_ref().to_string());
11943        }
11944
11945        #[allow(clippy::single_element_loop)]
11946        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11947            url = params.uri_replacement(url, param_name, find_this, true);
11948        }
11949        {
11950            let to_remove = ["resource"];
11951            params.remove_params(&to_remove);
11952        }
11953
11954        let url = params.parse_with_url(&url);
11955
11956        loop {
11957            let token = match self
11958                .hub
11959                .auth
11960                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11961                .await
11962            {
11963                Ok(token) => token,
11964                Err(e) => match dlg.token(e) {
11965                    Ok(token) => token,
11966                    Err(e) => {
11967                        dlg.finished(false);
11968                        return Err(common::Error::MissingToken(e));
11969                    }
11970                },
11971            };
11972            let mut req_result = {
11973                let client = &self.hub.client;
11974                dlg.pre_request();
11975                let mut req_builder = hyper::Request::builder()
11976                    .method(hyper::Method::GET)
11977                    .uri(url.as_str())
11978                    .header(USER_AGENT, self.hub._user_agent.clone());
11979
11980                if let Some(token) = token.as_ref() {
11981                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11982                }
11983
11984                let request = req_builder
11985                    .header(CONTENT_LENGTH, 0_u64)
11986                    .body(common::to_body::<String>(None));
11987
11988                client.request(request.unwrap()).await
11989            };
11990
11991            match req_result {
11992                Err(err) => {
11993                    if let common::Retry::After(d) = dlg.http_error(&err) {
11994                        sleep(d).await;
11995                        continue;
11996                    }
11997                    dlg.finished(false);
11998                    return Err(common::Error::HttpError(err));
11999                }
12000                Ok(res) => {
12001                    let (mut parts, body) = res.into_parts();
12002                    let mut body = common::Body::new(body);
12003                    if !parts.status.is_success() {
12004                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12005                        let error = serde_json::from_str(&common::to_string(&bytes));
12006                        let response = common::to_response(parts, bytes.into());
12007
12008                        if let common::Retry::After(d) =
12009                            dlg.http_failure(&response, error.as_ref().ok())
12010                        {
12011                            sleep(d).await;
12012                            continue;
12013                        }
12014
12015                        dlg.finished(false);
12016
12017                        return Err(match error {
12018                            Ok(value) => common::Error::BadRequest(value),
12019                            _ => common::Error::Failure(response),
12020                        });
12021                    }
12022                    let response = {
12023                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12024                        let encoded = common::to_string(&bytes);
12025                        match serde_json::from_str(&encoded) {
12026                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12027                            Err(error) => {
12028                                dlg.response_json_decode_error(&encoded, &error);
12029                                return Err(common::Error::JsonDecodeError(
12030                                    encoded.to_string(),
12031                                    error,
12032                                ));
12033                            }
12034                        }
12035                    };
12036
12037                    dlg.finished(true);
12038                    return Ok(response);
12039                }
12040            }
12041        }
12042    }
12043
12044    /// 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.
12045    ///
12046    /// Sets the *resource* path property to the given value.
12047    ///
12048    /// Even though the property as already been set when instantiating this call,
12049    /// we provide this method for API completeness.
12050    pub fn resource(
12051        mut self,
12052        new_value: &str,
12053    ) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C> {
12054        self._resource = new_value.to_string();
12055        self
12056    }
12057    /// 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).
12058    ///
12059    /// Sets the *options.requested policy version* query property to the given value.
12060    pub fn options_requested_policy_version(
12061        mut self,
12062        new_value: i32,
12063    ) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C> {
12064        self._options_requested_policy_version = Some(new_value);
12065        self
12066    }
12067    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12068    /// while executing the actual API request.
12069    ///
12070    /// ````text
12071    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12072    /// ````
12073    ///
12074    /// Sets the *delegate* property to the given value.
12075    pub fn delegate(
12076        mut self,
12077        new_value: &'a mut dyn common::Delegate,
12078    ) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C> {
12079        self._delegate = Some(new_value);
12080        self
12081    }
12082
12083    /// Set any additional parameter of the query string used in the request.
12084    /// It should be used to set parameters which are not yet available through their own
12085    /// setters.
12086    ///
12087    /// Please note that this method must not be used to set any of the known parameters
12088    /// which have their own setter method. If done anyway, the request will fail.
12089    ///
12090    /// # Additional Parameters
12091    ///
12092    /// * *$.xgafv* (query-string) - V1 error format.
12093    /// * *access_token* (query-string) - OAuth access token.
12094    /// * *alt* (query-string) - Data format for response.
12095    /// * *callback* (query-string) - JSONP
12096    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12097    /// * *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.
12098    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12099    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12100    /// * *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.
12101    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12102    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12103    pub fn param<T>(
12104        mut self,
12105        name: T,
12106        value: T,
12107    ) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C>
12108    where
12109        T: AsRef<str>,
12110    {
12111        self._additional_params
12112            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12113        self
12114    }
12115
12116    /// Identifies the authorization scope for the method you are building.
12117    ///
12118    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12119    /// [`Scope::CloudPlatform`].
12120    ///
12121    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12122    /// tokens for more than one scope.
12123    ///
12124    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12125    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12126    /// sufficient, a read-write scope will do as well.
12127    pub fn add_scope<St>(
12128        mut self,
12129        scope: St,
12130    ) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C>
12131    where
12132        St: AsRef<str>,
12133    {
12134        self._scopes.insert(String::from(scope.as_ref()));
12135        self
12136    }
12137    /// Identifies the authorization scope(s) for the method you are building.
12138    ///
12139    /// See [`Self::add_scope()`] for details.
12140    pub fn add_scopes<I, St>(
12141        mut self,
12142        scopes: I,
12143    ) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C>
12144    where
12145        I: IntoIterator<Item = St>,
12146        St: AsRef<str>,
12147    {
12148        self._scopes
12149            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12150        self
12151    }
12152
12153    /// Removes all scopes, and no default scope will be used either.
12154    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12155    /// for details).
12156    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourceGetIamPolicyCall<'a, C> {
12157        self._scopes.clear();
12158        self
12159    }
12160}
12161
12162/// List GoogleApiSources.
12163///
12164/// A builder for the *locations.googleApiSources.list* method supported by a *project* resource.
12165/// It is not used directly, but through a [`ProjectMethods`] instance.
12166///
12167/// # Example
12168///
12169/// Instantiate a resource method builder
12170///
12171/// ```test_harness,no_run
12172/// # extern crate hyper;
12173/// # extern crate hyper_rustls;
12174/// # extern crate google_eventarc1 as eventarc1;
12175/// # async fn dox() {
12176/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12177///
12178/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12179/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12180/// #     .with_native_roots()
12181/// #     .unwrap()
12182/// #     .https_only()
12183/// #     .enable_http2()
12184/// #     .build();
12185///
12186/// # let executor = hyper_util::rt::TokioExecutor::new();
12187/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12188/// #     secret,
12189/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12190/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12191/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12192/// #     ),
12193/// # ).build().await.unwrap();
12194///
12195/// # let client = hyper_util::client::legacy::Client::builder(
12196/// #     hyper_util::rt::TokioExecutor::new()
12197/// # )
12198/// # .build(
12199/// #     hyper_rustls::HttpsConnectorBuilder::new()
12200/// #         .with_native_roots()
12201/// #         .unwrap()
12202/// #         .https_or_http()
12203/// #         .enable_http2()
12204/// #         .build()
12205/// # );
12206/// # let mut hub = Eventarc::new(client, auth);
12207/// // You can configure optional parameters by calling the respective setters at will, and
12208/// // execute the final call using `doit()`.
12209/// // Values shown here are possibly random and not representative !
12210/// let result = hub.projects().locations_google_api_sources_list("parent")
12211///              .page_token("voluptua.")
12212///              .page_size(-72)
12213///              .order_by("erat")
12214///              .filter("consetetur")
12215///              .doit().await;
12216/// # }
12217/// ```
12218pub struct ProjectLocationGoogleApiSourceListCall<'a, C>
12219where
12220    C: 'a,
12221{
12222    hub: &'a Eventarc<C>,
12223    _parent: String,
12224    _page_token: Option<String>,
12225    _page_size: Option<i32>,
12226    _order_by: Option<String>,
12227    _filter: Option<String>,
12228    _delegate: Option<&'a mut dyn common::Delegate>,
12229    _additional_params: HashMap<String, String>,
12230    _scopes: BTreeSet<String>,
12231}
12232
12233impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourceListCall<'a, C> {}
12234
12235impl<'a, C> ProjectLocationGoogleApiSourceListCall<'a, C>
12236where
12237    C: common::Connector,
12238{
12239    /// Perform the operation you have build so far.
12240    pub async fn doit(
12241        mut self,
12242    ) -> common::Result<(common::Response, ListGoogleApiSourcesResponse)> {
12243        use std::borrow::Cow;
12244        use std::io::{Read, Seek};
12245
12246        use common::{url::Params, ToParts};
12247        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12248
12249        let mut dd = common::DefaultDelegate;
12250        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12251        dlg.begin(common::MethodInfo {
12252            id: "eventarc.projects.locations.googleApiSources.list",
12253            http_method: hyper::Method::GET,
12254        });
12255
12256        for &field in [
12257            "alt",
12258            "parent",
12259            "pageToken",
12260            "pageSize",
12261            "orderBy",
12262            "filter",
12263        ]
12264        .iter()
12265        {
12266            if self._additional_params.contains_key(field) {
12267                dlg.finished(false);
12268                return Err(common::Error::FieldClash(field));
12269            }
12270        }
12271
12272        let mut params = Params::with_capacity(7 + self._additional_params.len());
12273        params.push("parent", self._parent);
12274        if let Some(value) = self._page_token.as_ref() {
12275            params.push("pageToken", value);
12276        }
12277        if let Some(value) = self._page_size.as_ref() {
12278            params.push("pageSize", value.to_string());
12279        }
12280        if let Some(value) = self._order_by.as_ref() {
12281            params.push("orderBy", value);
12282        }
12283        if let Some(value) = self._filter.as_ref() {
12284            params.push("filter", value);
12285        }
12286
12287        params.extend(self._additional_params.iter());
12288
12289        params.push("alt", "json");
12290        let mut url = self.hub._base_url.clone() + "v1/{+parent}/googleApiSources";
12291        if self._scopes.is_empty() {
12292            self._scopes
12293                .insert(Scope::CloudPlatform.as_ref().to_string());
12294        }
12295
12296        #[allow(clippy::single_element_loop)]
12297        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12298            url = params.uri_replacement(url, param_name, find_this, true);
12299        }
12300        {
12301            let to_remove = ["parent"];
12302            params.remove_params(&to_remove);
12303        }
12304
12305        let url = params.parse_with_url(&url);
12306
12307        loop {
12308            let token = match self
12309                .hub
12310                .auth
12311                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12312                .await
12313            {
12314                Ok(token) => token,
12315                Err(e) => match dlg.token(e) {
12316                    Ok(token) => token,
12317                    Err(e) => {
12318                        dlg.finished(false);
12319                        return Err(common::Error::MissingToken(e));
12320                    }
12321                },
12322            };
12323            let mut req_result = {
12324                let client = &self.hub.client;
12325                dlg.pre_request();
12326                let mut req_builder = hyper::Request::builder()
12327                    .method(hyper::Method::GET)
12328                    .uri(url.as_str())
12329                    .header(USER_AGENT, self.hub._user_agent.clone());
12330
12331                if let Some(token) = token.as_ref() {
12332                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12333                }
12334
12335                let request = req_builder
12336                    .header(CONTENT_LENGTH, 0_u64)
12337                    .body(common::to_body::<String>(None));
12338
12339                client.request(request.unwrap()).await
12340            };
12341
12342            match req_result {
12343                Err(err) => {
12344                    if let common::Retry::After(d) = dlg.http_error(&err) {
12345                        sleep(d).await;
12346                        continue;
12347                    }
12348                    dlg.finished(false);
12349                    return Err(common::Error::HttpError(err));
12350                }
12351                Ok(res) => {
12352                    let (mut parts, body) = res.into_parts();
12353                    let mut body = common::Body::new(body);
12354                    if !parts.status.is_success() {
12355                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12356                        let error = serde_json::from_str(&common::to_string(&bytes));
12357                        let response = common::to_response(parts, bytes.into());
12358
12359                        if let common::Retry::After(d) =
12360                            dlg.http_failure(&response, error.as_ref().ok())
12361                        {
12362                            sleep(d).await;
12363                            continue;
12364                        }
12365
12366                        dlg.finished(false);
12367
12368                        return Err(match error {
12369                            Ok(value) => common::Error::BadRequest(value),
12370                            _ => common::Error::Failure(response),
12371                        });
12372                    }
12373                    let response = {
12374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12375                        let encoded = common::to_string(&bytes);
12376                        match serde_json::from_str(&encoded) {
12377                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12378                            Err(error) => {
12379                                dlg.response_json_decode_error(&encoded, &error);
12380                                return Err(common::Error::JsonDecodeError(
12381                                    encoded.to_string(),
12382                                    error,
12383                                ));
12384                            }
12385                        }
12386                    };
12387
12388                    dlg.finished(true);
12389                    return Ok(response);
12390                }
12391            }
12392        }
12393    }
12394
12395    /// Required. The parent collection to list GoogleApiSources on.
12396    ///
12397    /// Sets the *parent* path property to the given value.
12398    ///
12399    /// Even though the property as already been set when instantiating this call,
12400    /// we provide this method for API completeness.
12401    pub fn parent(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
12402        self._parent = new_value.to_string();
12403        self
12404    }
12405    /// Optional. The page token; provide the value from the `next_page_token` field in a previous call to retrieve the subsequent page. When paginating, all other parameters provided must match the previous call that provided the page token.
12406    ///
12407    /// Sets the *page token* query property to the given value.
12408    pub fn page_token(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
12409        self._page_token = Some(new_value.to_string());
12410        self
12411    }
12412    /// Optional. The maximum number of results to return on each page. Note: The service may send fewer.
12413    ///
12414    /// Sets the *page size* query property to the given value.
12415    pub fn page_size(mut self, new_value: i32) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
12416        self._page_size = Some(new_value);
12417        self
12418    }
12419    /// Optional. The sorting order of the resources returned. Value should be a comma-separated list of fields. The default sorting order is ascending. To specify descending order for a field, append a `desc` suffix; for example: `name desc, update_time`.
12420    ///
12421    /// Sets the *order by* query property to the given value.
12422    pub fn order_by(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
12423        self._order_by = Some(new_value.to_string());
12424        self
12425    }
12426    /// Optional. The filter field that the list request will filter on. Possible filtersare described in https://google.aip.dev/160.
12427    ///
12428    /// Sets the *filter* query property to the given value.
12429    pub fn filter(mut self, new_value: &str) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
12430        self._filter = Some(new_value.to_string());
12431        self
12432    }
12433    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12434    /// while executing the actual API request.
12435    ///
12436    /// ````text
12437    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12438    /// ````
12439    ///
12440    /// Sets the *delegate* property to the given value.
12441    pub fn delegate(
12442        mut self,
12443        new_value: &'a mut dyn common::Delegate,
12444    ) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
12445        self._delegate = Some(new_value);
12446        self
12447    }
12448
12449    /// Set any additional parameter of the query string used in the request.
12450    /// It should be used to set parameters which are not yet available through their own
12451    /// setters.
12452    ///
12453    /// Please note that this method must not be used to set any of the known parameters
12454    /// which have their own setter method. If done anyway, the request will fail.
12455    ///
12456    /// # Additional Parameters
12457    ///
12458    /// * *$.xgafv* (query-string) - V1 error format.
12459    /// * *access_token* (query-string) - OAuth access token.
12460    /// * *alt* (query-string) - Data format for response.
12461    /// * *callback* (query-string) - JSONP
12462    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12463    /// * *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.
12464    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12465    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12466    /// * *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.
12467    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12468    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12469    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGoogleApiSourceListCall<'a, C>
12470    where
12471        T: AsRef<str>,
12472    {
12473        self._additional_params
12474            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12475        self
12476    }
12477
12478    /// Identifies the authorization scope for the method you are building.
12479    ///
12480    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12481    /// [`Scope::CloudPlatform`].
12482    ///
12483    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12484    /// tokens for more than one scope.
12485    ///
12486    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12487    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12488    /// sufficient, a read-write scope will do as well.
12489    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGoogleApiSourceListCall<'a, C>
12490    where
12491        St: AsRef<str>,
12492    {
12493        self._scopes.insert(String::from(scope.as_ref()));
12494        self
12495    }
12496    /// Identifies the authorization scope(s) for the method you are building.
12497    ///
12498    /// See [`Self::add_scope()`] for details.
12499    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGoogleApiSourceListCall<'a, C>
12500    where
12501        I: IntoIterator<Item = St>,
12502        St: AsRef<str>,
12503    {
12504        self._scopes
12505            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12506        self
12507    }
12508
12509    /// Removes all scopes, and no default scope will be used either.
12510    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12511    /// for details).
12512    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourceListCall<'a, C> {
12513        self._scopes.clear();
12514        self
12515    }
12516}
12517
12518/// Update a single GoogleApiSource.
12519///
12520/// A builder for the *locations.googleApiSources.patch* method supported by a *project* resource.
12521/// It is not used directly, but through a [`ProjectMethods`] instance.
12522///
12523/// # Example
12524///
12525/// Instantiate a resource method builder
12526///
12527/// ```test_harness,no_run
12528/// # extern crate hyper;
12529/// # extern crate hyper_rustls;
12530/// # extern crate google_eventarc1 as eventarc1;
12531/// use eventarc1::api::GoogleApiSource;
12532/// # async fn dox() {
12533/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12534///
12535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12536/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12537/// #     .with_native_roots()
12538/// #     .unwrap()
12539/// #     .https_only()
12540/// #     .enable_http2()
12541/// #     .build();
12542///
12543/// # let executor = hyper_util::rt::TokioExecutor::new();
12544/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12545/// #     secret,
12546/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12547/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12548/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12549/// #     ),
12550/// # ).build().await.unwrap();
12551///
12552/// # let client = hyper_util::client::legacy::Client::builder(
12553/// #     hyper_util::rt::TokioExecutor::new()
12554/// # )
12555/// # .build(
12556/// #     hyper_rustls::HttpsConnectorBuilder::new()
12557/// #         .with_native_roots()
12558/// #         .unwrap()
12559/// #         .https_or_http()
12560/// #         .enable_http2()
12561/// #         .build()
12562/// # );
12563/// # let mut hub = Eventarc::new(client, auth);
12564/// // As the method needs a request, you would usually fill it with the desired information
12565/// // into the respective structure. Some of the parts shown here might not be applicable !
12566/// // Values shown here are possibly random and not representative !
12567/// let mut req = GoogleApiSource::default();
12568///
12569/// // You can configure optional parameters by calling the respective setters at will, and
12570/// // execute the final call using `doit()`.
12571/// // Values shown here are possibly random and not representative !
12572/// let result = hub.projects().locations_google_api_sources_patch(req, "name")
12573///              .validate_only(true)
12574///              .update_mask(FieldMask::new::<&str>(&[]))
12575///              .allow_missing(false)
12576///              .doit().await;
12577/// # }
12578/// ```
12579pub struct ProjectLocationGoogleApiSourcePatchCall<'a, C>
12580where
12581    C: 'a,
12582{
12583    hub: &'a Eventarc<C>,
12584    _request: GoogleApiSource,
12585    _name: String,
12586    _validate_only: Option<bool>,
12587    _update_mask: Option<common::FieldMask>,
12588    _allow_missing: Option<bool>,
12589    _delegate: Option<&'a mut dyn common::Delegate>,
12590    _additional_params: HashMap<String, String>,
12591    _scopes: BTreeSet<String>,
12592}
12593
12594impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourcePatchCall<'a, C> {}
12595
12596impl<'a, C> ProjectLocationGoogleApiSourcePatchCall<'a, C>
12597where
12598    C: common::Connector,
12599{
12600    /// Perform the operation you have build so far.
12601    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
12602        use std::borrow::Cow;
12603        use std::io::{Read, Seek};
12604
12605        use common::{url::Params, ToParts};
12606        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12607
12608        let mut dd = common::DefaultDelegate;
12609        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12610        dlg.begin(common::MethodInfo {
12611            id: "eventarc.projects.locations.googleApiSources.patch",
12612            http_method: hyper::Method::PATCH,
12613        });
12614
12615        for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
12616            if self._additional_params.contains_key(field) {
12617                dlg.finished(false);
12618                return Err(common::Error::FieldClash(field));
12619            }
12620        }
12621
12622        let mut params = Params::with_capacity(7 + self._additional_params.len());
12623        params.push("name", self._name);
12624        if let Some(value) = self._validate_only.as_ref() {
12625            params.push("validateOnly", value.to_string());
12626        }
12627        if let Some(value) = self._update_mask.as_ref() {
12628            params.push("updateMask", value.to_string());
12629        }
12630        if let Some(value) = self._allow_missing.as_ref() {
12631            params.push("allowMissing", value.to_string());
12632        }
12633
12634        params.extend(self._additional_params.iter());
12635
12636        params.push("alt", "json");
12637        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12638        if self._scopes.is_empty() {
12639            self._scopes
12640                .insert(Scope::CloudPlatform.as_ref().to_string());
12641        }
12642
12643        #[allow(clippy::single_element_loop)]
12644        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12645            url = params.uri_replacement(url, param_name, find_this, true);
12646        }
12647        {
12648            let to_remove = ["name"];
12649            params.remove_params(&to_remove);
12650        }
12651
12652        let url = params.parse_with_url(&url);
12653
12654        let mut json_mime_type = mime::APPLICATION_JSON;
12655        let mut request_value_reader = {
12656            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12657            common::remove_json_null_values(&mut value);
12658            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12659            serde_json::to_writer(&mut dst, &value).unwrap();
12660            dst
12661        };
12662        let request_size = request_value_reader
12663            .seek(std::io::SeekFrom::End(0))
12664            .unwrap();
12665        request_value_reader
12666            .seek(std::io::SeekFrom::Start(0))
12667            .unwrap();
12668
12669        loop {
12670            let token = match self
12671                .hub
12672                .auth
12673                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12674                .await
12675            {
12676                Ok(token) => token,
12677                Err(e) => match dlg.token(e) {
12678                    Ok(token) => token,
12679                    Err(e) => {
12680                        dlg.finished(false);
12681                        return Err(common::Error::MissingToken(e));
12682                    }
12683                },
12684            };
12685            request_value_reader
12686                .seek(std::io::SeekFrom::Start(0))
12687                .unwrap();
12688            let mut req_result = {
12689                let client = &self.hub.client;
12690                dlg.pre_request();
12691                let mut req_builder = hyper::Request::builder()
12692                    .method(hyper::Method::PATCH)
12693                    .uri(url.as_str())
12694                    .header(USER_AGENT, self.hub._user_agent.clone());
12695
12696                if let Some(token) = token.as_ref() {
12697                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12698                }
12699
12700                let request = req_builder
12701                    .header(CONTENT_TYPE, json_mime_type.to_string())
12702                    .header(CONTENT_LENGTH, request_size as u64)
12703                    .body(common::to_body(
12704                        request_value_reader.get_ref().clone().into(),
12705                    ));
12706
12707                client.request(request.unwrap()).await
12708            };
12709
12710            match req_result {
12711                Err(err) => {
12712                    if let common::Retry::After(d) = dlg.http_error(&err) {
12713                        sleep(d).await;
12714                        continue;
12715                    }
12716                    dlg.finished(false);
12717                    return Err(common::Error::HttpError(err));
12718                }
12719                Ok(res) => {
12720                    let (mut parts, body) = res.into_parts();
12721                    let mut body = common::Body::new(body);
12722                    if !parts.status.is_success() {
12723                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12724                        let error = serde_json::from_str(&common::to_string(&bytes));
12725                        let response = common::to_response(parts, bytes.into());
12726
12727                        if let common::Retry::After(d) =
12728                            dlg.http_failure(&response, error.as_ref().ok())
12729                        {
12730                            sleep(d).await;
12731                            continue;
12732                        }
12733
12734                        dlg.finished(false);
12735
12736                        return Err(match error {
12737                            Ok(value) => common::Error::BadRequest(value),
12738                            _ => common::Error::Failure(response),
12739                        });
12740                    }
12741                    let response = {
12742                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12743                        let encoded = common::to_string(&bytes);
12744                        match serde_json::from_str(&encoded) {
12745                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12746                            Err(error) => {
12747                                dlg.response_json_decode_error(&encoded, &error);
12748                                return Err(common::Error::JsonDecodeError(
12749                                    encoded.to_string(),
12750                                    error,
12751                                ));
12752                            }
12753                        }
12754                    };
12755
12756                    dlg.finished(true);
12757                    return Ok(response);
12758                }
12759            }
12760        }
12761    }
12762
12763    ///
12764    /// Sets the *request* property to the given value.
12765    ///
12766    /// Even though the property as already been set when instantiating this call,
12767    /// we provide this method for API completeness.
12768    pub fn request(
12769        mut self,
12770        new_value: GoogleApiSource,
12771    ) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
12772        self._request = new_value;
12773        self
12774    }
12775    /// Identifier. Resource name of the form projects/{project}/locations/{location}/googleApiSources/{google_api_source}
12776    ///
12777    /// Sets the *name* path property to the given value.
12778    ///
12779    /// Even though the property as already been set when instantiating this call,
12780    /// we provide this method for API completeness.
12781    pub fn name(mut self, new_value: &str) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
12782        self._name = new_value.to_string();
12783        self
12784    }
12785    /// Optional. If set, validate the request and preview the review, but do not post it.
12786    ///
12787    /// Sets the *validate only* query property to the given value.
12788    pub fn validate_only(
12789        mut self,
12790        new_value: bool,
12791    ) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
12792        self._validate_only = Some(new_value);
12793        self
12794    }
12795    /// Optional. The fields to be updated; only fields explicitly provided are updated. If no field mask is provided, all provided fields in the request are updated. To update all fields, provide a field mask of "*".
12796    ///
12797    /// Sets the *update mask* query property to the given value.
12798    pub fn update_mask(
12799        mut self,
12800        new_value: common::FieldMask,
12801    ) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
12802        self._update_mask = Some(new_value);
12803        self
12804    }
12805    /// Optional. If set to true, and the GoogleApiSource is not found, a new GoogleApiSource will be created. In this situation, `update_mask` is ignored.
12806    ///
12807    /// Sets the *allow missing* query property to the given value.
12808    pub fn allow_missing(
12809        mut self,
12810        new_value: bool,
12811    ) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
12812        self._allow_missing = Some(new_value);
12813        self
12814    }
12815    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12816    /// while executing the actual API request.
12817    ///
12818    /// ````text
12819    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12820    /// ````
12821    ///
12822    /// Sets the *delegate* property to the given value.
12823    pub fn delegate(
12824        mut self,
12825        new_value: &'a mut dyn common::Delegate,
12826    ) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
12827        self._delegate = Some(new_value);
12828        self
12829    }
12830
12831    /// Set any additional parameter of the query string used in the request.
12832    /// It should be used to set parameters which are not yet available through their own
12833    /// setters.
12834    ///
12835    /// Please note that this method must not be used to set any of the known parameters
12836    /// which have their own setter method. If done anyway, the request will fail.
12837    ///
12838    /// # Additional Parameters
12839    ///
12840    /// * *$.xgafv* (query-string) - V1 error format.
12841    /// * *access_token* (query-string) - OAuth access token.
12842    /// * *alt* (query-string) - Data format for response.
12843    /// * *callback* (query-string) - JSONP
12844    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12845    /// * *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.
12846    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12847    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12848    /// * *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.
12849    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12850    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12851    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGoogleApiSourcePatchCall<'a, C>
12852    where
12853        T: AsRef<str>,
12854    {
12855        self._additional_params
12856            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12857        self
12858    }
12859
12860    /// Identifies the authorization scope for the method you are building.
12861    ///
12862    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12863    /// [`Scope::CloudPlatform`].
12864    ///
12865    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12866    /// tokens for more than one scope.
12867    ///
12868    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12869    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12870    /// sufficient, a read-write scope will do as well.
12871    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGoogleApiSourcePatchCall<'a, C>
12872    where
12873        St: AsRef<str>,
12874    {
12875        self._scopes.insert(String::from(scope.as_ref()));
12876        self
12877    }
12878    /// Identifies the authorization scope(s) for the method you are building.
12879    ///
12880    /// See [`Self::add_scope()`] for details.
12881    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGoogleApiSourcePatchCall<'a, C>
12882    where
12883        I: IntoIterator<Item = St>,
12884        St: AsRef<str>,
12885    {
12886        self._scopes
12887            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12888        self
12889    }
12890
12891    /// Removes all scopes, and no default scope will be used either.
12892    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12893    /// for details).
12894    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourcePatchCall<'a, C> {
12895        self._scopes.clear();
12896        self
12897    }
12898}
12899
12900/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
12901///
12902/// A builder for the *locations.googleApiSources.setIamPolicy* method supported by a *project* resource.
12903/// It is not used directly, but through a [`ProjectMethods`] instance.
12904///
12905/// # Example
12906///
12907/// Instantiate a resource method builder
12908///
12909/// ```test_harness,no_run
12910/// # extern crate hyper;
12911/// # extern crate hyper_rustls;
12912/// # extern crate google_eventarc1 as eventarc1;
12913/// use eventarc1::api::SetIamPolicyRequest;
12914/// # async fn dox() {
12915/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12916///
12917/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12918/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12919/// #     .with_native_roots()
12920/// #     .unwrap()
12921/// #     .https_only()
12922/// #     .enable_http2()
12923/// #     .build();
12924///
12925/// # let executor = hyper_util::rt::TokioExecutor::new();
12926/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12927/// #     secret,
12928/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12929/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12930/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12931/// #     ),
12932/// # ).build().await.unwrap();
12933///
12934/// # let client = hyper_util::client::legacy::Client::builder(
12935/// #     hyper_util::rt::TokioExecutor::new()
12936/// # )
12937/// # .build(
12938/// #     hyper_rustls::HttpsConnectorBuilder::new()
12939/// #         .with_native_roots()
12940/// #         .unwrap()
12941/// #         .https_or_http()
12942/// #         .enable_http2()
12943/// #         .build()
12944/// # );
12945/// # let mut hub = Eventarc::new(client, auth);
12946/// // As the method needs a request, you would usually fill it with the desired information
12947/// // into the respective structure. Some of the parts shown here might not be applicable !
12948/// // Values shown here are possibly random and not representative !
12949/// let mut req = SetIamPolicyRequest::default();
12950///
12951/// // You can configure optional parameters by calling the respective setters at will, and
12952/// // execute the final call using `doit()`.
12953/// // Values shown here are possibly random and not representative !
12954/// let result = hub.projects().locations_google_api_sources_set_iam_policy(req, "resource")
12955///              .doit().await;
12956/// # }
12957/// ```
12958pub struct ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C>
12959where
12960    C: 'a,
12961{
12962    hub: &'a Eventarc<C>,
12963    _request: SetIamPolicyRequest,
12964    _resource: String,
12965    _delegate: Option<&'a mut dyn common::Delegate>,
12966    _additional_params: HashMap<String, String>,
12967    _scopes: BTreeSet<String>,
12968}
12969
12970impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C> {}
12971
12972impl<'a, C> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C>
12973where
12974    C: common::Connector,
12975{
12976    /// Perform the operation you have build so far.
12977    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12978        use std::borrow::Cow;
12979        use std::io::{Read, Seek};
12980
12981        use common::{url::Params, ToParts};
12982        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12983
12984        let mut dd = common::DefaultDelegate;
12985        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12986        dlg.begin(common::MethodInfo {
12987            id: "eventarc.projects.locations.googleApiSources.setIamPolicy",
12988            http_method: hyper::Method::POST,
12989        });
12990
12991        for &field in ["alt", "resource"].iter() {
12992            if self._additional_params.contains_key(field) {
12993                dlg.finished(false);
12994                return Err(common::Error::FieldClash(field));
12995            }
12996        }
12997
12998        let mut params = Params::with_capacity(4 + self._additional_params.len());
12999        params.push("resource", self._resource);
13000
13001        params.extend(self._additional_params.iter());
13002
13003        params.push("alt", "json");
13004        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
13005        if self._scopes.is_empty() {
13006            self._scopes
13007                .insert(Scope::CloudPlatform.as_ref().to_string());
13008        }
13009
13010        #[allow(clippy::single_element_loop)]
13011        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13012            url = params.uri_replacement(url, param_name, find_this, true);
13013        }
13014        {
13015            let to_remove = ["resource"];
13016            params.remove_params(&to_remove);
13017        }
13018
13019        let url = params.parse_with_url(&url);
13020
13021        let mut json_mime_type = mime::APPLICATION_JSON;
13022        let mut request_value_reader = {
13023            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13024            common::remove_json_null_values(&mut value);
13025            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13026            serde_json::to_writer(&mut dst, &value).unwrap();
13027            dst
13028        };
13029        let request_size = request_value_reader
13030            .seek(std::io::SeekFrom::End(0))
13031            .unwrap();
13032        request_value_reader
13033            .seek(std::io::SeekFrom::Start(0))
13034            .unwrap();
13035
13036        loop {
13037            let token = match self
13038                .hub
13039                .auth
13040                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13041                .await
13042            {
13043                Ok(token) => token,
13044                Err(e) => match dlg.token(e) {
13045                    Ok(token) => token,
13046                    Err(e) => {
13047                        dlg.finished(false);
13048                        return Err(common::Error::MissingToken(e));
13049                    }
13050                },
13051            };
13052            request_value_reader
13053                .seek(std::io::SeekFrom::Start(0))
13054                .unwrap();
13055            let mut req_result = {
13056                let client = &self.hub.client;
13057                dlg.pre_request();
13058                let mut req_builder = hyper::Request::builder()
13059                    .method(hyper::Method::POST)
13060                    .uri(url.as_str())
13061                    .header(USER_AGENT, self.hub._user_agent.clone());
13062
13063                if let Some(token) = token.as_ref() {
13064                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13065                }
13066
13067                let request = req_builder
13068                    .header(CONTENT_TYPE, json_mime_type.to_string())
13069                    .header(CONTENT_LENGTH, request_size as u64)
13070                    .body(common::to_body(
13071                        request_value_reader.get_ref().clone().into(),
13072                    ));
13073
13074                client.request(request.unwrap()).await
13075            };
13076
13077            match req_result {
13078                Err(err) => {
13079                    if let common::Retry::After(d) = dlg.http_error(&err) {
13080                        sleep(d).await;
13081                        continue;
13082                    }
13083                    dlg.finished(false);
13084                    return Err(common::Error::HttpError(err));
13085                }
13086                Ok(res) => {
13087                    let (mut parts, body) = res.into_parts();
13088                    let mut body = common::Body::new(body);
13089                    if !parts.status.is_success() {
13090                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13091                        let error = serde_json::from_str(&common::to_string(&bytes));
13092                        let response = common::to_response(parts, bytes.into());
13093
13094                        if let common::Retry::After(d) =
13095                            dlg.http_failure(&response, error.as_ref().ok())
13096                        {
13097                            sleep(d).await;
13098                            continue;
13099                        }
13100
13101                        dlg.finished(false);
13102
13103                        return Err(match error {
13104                            Ok(value) => common::Error::BadRequest(value),
13105                            _ => common::Error::Failure(response),
13106                        });
13107                    }
13108                    let response = {
13109                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13110                        let encoded = common::to_string(&bytes);
13111                        match serde_json::from_str(&encoded) {
13112                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13113                            Err(error) => {
13114                                dlg.response_json_decode_error(&encoded, &error);
13115                                return Err(common::Error::JsonDecodeError(
13116                                    encoded.to_string(),
13117                                    error,
13118                                ));
13119                            }
13120                        }
13121                    };
13122
13123                    dlg.finished(true);
13124                    return Ok(response);
13125                }
13126            }
13127        }
13128    }
13129
13130    ///
13131    /// Sets the *request* property to the given value.
13132    ///
13133    /// Even though the property as already been set when instantiating this call,
13134    /// we provide this method for API completeness.
13135    pub fn request(
13136        mut self,
13137        new_value: SetIamPolicyRequest,
13138    ) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C> {
13139        self._request = new_value;
13140        self
13141    }
13142    /// 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.
13143    ///
13144    /// Sets the *resource* path property to the given value.
13145    ///
13146    /// Even though the property as already been set when instantiating this call,
13147    /// we provide this method for API completeness.
13148    pub fn resource(
13149        mut self,
13150        new_value: &str,
13151    ) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C> {
13152        self._resource = new_value.to_string();
13153        self
13154    }
13155    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13156    /// while executing the actual API request.
13157    ///
13158    /// ````text
13159    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13160    /// ````
13161    ///
13162    /// Sets the *delegate* property to the given value.
13163    pub fn delegate(
13164        mut self,
13165        new_value: &'a mut dyn common::Delegate,
13166    ) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C> {
13167        self._delegate = Some(new_value);
13168        self
13169    }
13170
13171    /// Set any additional parameter of the query string used in the request.
13172    /// It should be used to set parameters which are not yet available through their own
13173    /// setters.
13174    ///
13175    /// Please note that this method must not be used to set any of the known parameters
13176    /// which have their own setter method. If done anyway, the request will fail.
13177    ///
13178    /// # Additional Parameters
13179    ///
13180    /// * *$.xgafv* (query-string) - V1 error format.
13181    /// * *access_token* (query-string) - OAuth access token.
13182    /// * *alt* (query-string) - Data format for response.
13183    /// * *callback* (query-string) - JSONP
13184    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13185    /// * *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.
13186    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13187    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13188    /// * *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.
13189    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13190    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13191    pub fn param<T>(
13192        mut self,
13193        name: T,
13194        value: T,
13195    ) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C>
13196    where
13197        T: AsRef<str>,
13198    {
13199        self._additional_params
13200            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13201        self
13202    }
13203
13204    /// Identifies the authorization scope for the method you are building.
13205    ///
13206    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13207    /// [`Scope::CloudPlatform`].
13208    ///
13209    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13210    /// tokens for more than one scope.
13211    ///
13212    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13213    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13214    /// sufficient, a read-write scope will do as well.
13215    pub fn add_scope<St>(
13216        mut self,
13217        scope: St,
13218    ) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C>
13219    where
13220        St: AsRef<str>,
13221    {
13222        self._scopes.insert(String::from(scope.as_ref()));
13223        self
13224    }
13225    /// Identifies the authorization scope(s) for the method you are building.
13226    ///
13227    /// See [`Self::add_scope()`] for details.
13228    pub fn add_scopes<I, St>(
13229        mut self,
13230        scopes: I,
13231    ) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C>
13232    where
13233        I: IntoIterator<Item = St>,
13234        St: AsRef<str>,
13235    {
13236        self._scopes
13237            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13238        self
13239    }
13240
13241    /// Removes all scopes, and no default scope will be used either.
13242    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13243    /// for details).
13244    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourceSetIamPolicyCall<'a, C> {
13245        self._scopes.clear();
13246        self
13247    }
13248}
13249
13250/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
13251///
13252/// A builder for the *locations.googleApiSources.testIamPermissions* method supported by a *project* resource.
13253/// It is not used directly, but through a [`ProjectMethods`] instance.
13254///
13255/// # Example
13256///
13257/// Instantiate a resource method builder
13258///
13259/// ```test_harness,no_run
13260/// # extern crate hyper;
13261/// # extern crate hyper_rustls;
13262/// # extern crate google_eventarc1 as eventarc1;
13263/// use eventarc1::api::TestIamPermissionsRequest;
13264/// # async fn dox() {
13265/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13266///
13267/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13268/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13269/// #     .with_native_roots()
13270/// #     .unwrap()
13271/// #     .https_only()
13272/// #     .enable_http2()
13273/// #     .build();
13274///
13275/// # let executor = hyper_util::rt::TokioExecutor::new();
13276/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13277/// #     secret,
13278/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13279/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13280/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13281/// #     ),
13282/// # ).build().await.unwrap();
13283///
13284/// # let client = hyper_util::client::legacy::Client::builder(
13285/// #     hyper_util::rt::TokioExecutor::new()
13286/// # )
13287/// # .build(
13288/// #     hyper_rustls::HttpsConnectorBuilder::new()
13289/// #         .with_native_roots()
13290/// #         .unwrap()
13291/// #         .https_or_http()
13292/// #         .enable_http2()
13293/// #         .build()
13294/// # );
13295/// # let mut hub = Eventarc::new(client, auth);
13296/// // As the method needs a request, you would usually fill it with the desired information
13297/// // into the respective structure. Some of the parts shown here might not be applicable !
13298/// // Values shown here are possibly random and not representative !
13299/// let mut req = TestIamPermissionsRequest::default();
13300///
13301/// // You can configure optional parameters by calling the respective setters at will, and
13302/// // execute the final call using `doit()`.
13303/// // Values shown here are possibly random and not representative !
13304/// let result = hub.projects().locations_google_api_sources_test_iam_permissions(req, "resource")
13305///              .doit().await;
13306/// # }
13307/// ```
13308pub struct ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C>
13309where
13310    C: 'a,
13311{
13312    hub: &'a Eventarc<C>,
13313    _request: TestIamPermissionsRequest,
13314    _resource: String,
13315    _delegate: Option<&'a mut dyn common::Delegate>,
13316    _additional_params: HashMap<String, String>,
13317    _scopes: BTreeSet<String>,
13318}
13319
13320impl<'a, C> common::CallBuilder for ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C> {}
13321
13322impl<'a, C> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C>
13323where
13324    C: common::Connector,
13325{
13326    /// Perform the operation you have build so far.
13327    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
13328        use std::borrow::Cow;
13329        use std::io::{Read, Seek};
13330
13331        use common::{url::Params, ToParts};
13332        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13333
13334        let mut dd = common::DefaultDelegate;
13335        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13336        dlg.begin(common::MethodInfo {
13337            id: "eventarc.projects.locations.googleApiSources.testIamPermissions",
13338            http_method: hyper::Method::POST,
13339        });
13340
13341        for &field in ["alt", "resource"].iter() {
13342            if self._additional_params.contains_key(field) {
13343                dlg.finished(false);
13344                return Err(common::Error::FieldClash(field));
13345            }
13346        }
13347
13348        let mut params = Params::with_capacity(4 + self._additional_params.len());
13349        params.push("resource", self._resource);
13350
13351        params.extend(self._additional_params.iter());
13352
13353        params.push("alt", "json");
13354        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
13355        if self._scopes.is_empty() {
13356            self._scopes
13357                .insert(Scope::CloudPlatform.as_ref().to_string());
13358        }
13359
13360        #[allow(clippy::single_element_loop)]
13361        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13362            url = params.uri_replacement(url, param_name, find_this, true);
13363        }
13364        {
13365            let to_remove = ["resource"];
13366            params.remove_params(&to_remove);
13367        }
13368
13369        let url = params.parse_with_url(&url);
13370
13371        let mut json_mime_type = mime::APPLICATION_JSON;
13372        let mut request_value_reader = {
13373            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13374            common::remove_json_null_values(&mut value);
13375            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13376            serde_json::to_writer(&mut dst, &value).unwrap();
13377            dst
13378        };
13379        let request_size = request_value_reader
13380            .seek(std::io::SeekFrom::End(0))
13381            .unwrap();
13382        request_value_reader
13383            .seek(std::io::SeekFrom::Start(0))
13384            .unwrap();
13385
13386        loop {
13387            let token = match self
13388                .hub
13389                .auth
13390                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13391                .await
13392            {
13393                Ok(token) => token,
13394                Err(e) => match dlg.token(e) {
13395                    Ok(token) => token,
13396                    Err(e) => {
13397                        dlg.finished(false);
13398                        return Err(common::Error::MissingToken(e));
13399                    }
13400                },
13401            };
13402            request_value_reader
13403                .seek(std::io::SeekFrom::Start(0))
13404                .unwrap();
13405            let mut req_result = {
13406                let client = &self.hub.client;
13407                dlg.pre_request();
13408                let mut req_builder = hyper::Request::builder()
13409                    .method(hyper::Method::POST)
13410                    .uri(url.as_str())
13411                    .header(USER_AGENT, self.hub._user_agent.clone());
13412
13413                if let Some(token) = token.as_ref() {
13414                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13415                }
13416
13417                let request = req_builder
13418                    .header(CONTENT_TYPE, json_mime_type.to_string())
13419                    .header(CONTENT_LENGTH, request_size as u64)
13420                    .body(common::to_body(
13421                        request_value_reader.get_ref().clone().into(),
13422                    ));
13423
13424                client.request(request.unwrap()).await
13425            };
13426
13427            match req_result {
13428                Err(err) => {
13429                    if let common::Retry::After(d) = dlg.http_error(&err) {
13430                        sleep(d).await;
13431                        continue;
13432                    }
13433                    dlg.finished(false);
13434                    return Err(common::Error::HttpError(err));
13435                }
13436                Ok(res) => {
13437                    let (mut parts, body) = res.into_parts();
13438                    let mut body = common::Body::new(body);
13439                    if !parts.status.is_success() {
13440                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13441                        let error = serde_json::from_str(&common::to_string(&bytes));
13442                        let response = common::to_response(parts, bytes.into());
13443
13444                        if let common::Retry::After(d) =
13445                            dlg.http_failure(&response, error.as_ref().ok())
13446                        {
13447                            sleep(d).await;
13448                            continue;
13449                        }
13450
13451                        dlg.finished(false);
13452
13453                        return Err(match error {
13454                            Ok(value) => common::Error::BadRequest(value),
13455                            _ => common::Error::Failure(response),
13456                        });
13457                    }
13458                    let response = {
13459                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13460                        let encoded = common::to_string(&bytes);
13461                        match serde_json::from_str(&encoded) {
13462                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13463                            Err(error) => {
13464                                dlg.response_json_decode_error(&encoded, &error);
13465                                return Err(common::Error::JsonDecodeError(
13466                                    encoded.to_string(),
13467                                    error,
13468                                ));
13469                            }
13470                        }
13471                    };
13472
13473                    dlg.finished(true);
13474                    return Ok(response);
13475                }
13476            }
13477        }
13478    }
13479
13480    ///
13481    /// Sets the *request* property to the given value.
13482    ///
13483    /// Even though the property as already been set when instantiating this call,
13484    /// we provide this method for API completeness.
13485    pub fn request(
13486        mut self,
13487        new_value: TestIamPermissionsRequest,
13488    ) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C> {
13489        self._request = new_value;
13490        self
13491    }
13492    /// 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.
13493    ///
13494    /// Sets the *resource* path property to the given value.
13495    ///
13496    /// Even though the property as already been set when instantiating this call,
13497    /// we provide this method for API completeness.
13498    pub fn resource(
13499        mut self,
13500        new_value: &str,
13501    ) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C> {
13502        self._resource = new_value.to_string();
13503        self
13504    }
13505    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13506    /// while executing the actual API request.
13507    ///
13508    /// ````text
13509    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13510    /// ````
13511    ///
13512    /// Sets the *delegate* property to the given value.
13513    pub fn delegate(
13514        mut self,
13515        new_value: &'a mut dyn common::Delegate,
13516    ) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C> {
13517        self._delegate = Some(new_value);
13518        self
13519    }
13520
13521    /// Set any additional parameter of the query string used in the request.
13522    /// It should be used to set parameters which are not yet available through their own
13523    /// setters.
13524    ///
13525    /// Please note that this method must not be used to set any of the known parameters
13526    /// which have their own setter method. If done anyway, the request will fail.
13527    ///
13528    /// # Additional Parameters
13529    ///
13530    /// * *$.xgafv* (query-string) - V1 error format.
13531    /// * *access_token* (query-string) - OAuth access token.
13532    /// * *alt* (query-string) - Data format for response.
13533    /// * *callback* (query-string) - JSONP
13534    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13535    /// * *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.
13536    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13537    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13538    /// * *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.
13539    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13540    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13541    pub fn param<T>(
13542        mut self,
13543        name: T,
13544        value: T,
13545    ) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C>
13546    where
13547        T: AsRef<str>,
13548    {
13549        self._additional_params
13550            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13551        self
13552    }
13553
13554    /// Identifies the authorization scope for the method you are building.
13555    ///
13556    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13557    /// [`Scope::CloudPlatform`].
13558    ///
13559    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13560    /// tokens for more than one scope.
13561    ///
13562    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13563    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13564    /// sufficient, a read-write scope will do as well.
13565    pub fn add_scope<St>(
13566        mut self,
13567        scope: St,
13568    ) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C>
13569    where
13570        St: AsRef<str>,
13571    {
13572        self._scopes.insert(String::from(scope.as_ref()));
13573        self
13574    }
13575    /// Identifies the authorization scope(s) for the method you are building.
13576    ///
13577    /// See [`Self::add_scope()`] for details.
13578    pub fn add_scopes<I, St>(
13579        mut self,
13580        scopes: I,
13581    ) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C>
13582    where
13583        I: IntoIterator<Item = St>,
13584        St: AsRef<str>,
13585    {
13586        self._scopes
13587            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13588        self
13589    }
13590
13591    /// Removes all scopes, and no default scope will be used either.
13592    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13593    /// for details).
13594    pub fn clear_scopes(mut self) -> ProjectLocationGoogleApiSourceTestIamPermissionCall<'a, C> {
13595        self._scopes.clear();
13596        self
13597    }
13598}
13599
13600/// Create a new MessageBus in a particular project and location.
13601///
13602/// A builder for the *locations.messageBuses.create* method supported by a *project* resource.
13603/// It is not used directly, but through a [`ProjectMethods`] instance.
13604///
13605/// # Example
13606///
13607/// Instantiate a resource method builder
13608///
13609/// ```test_harness,no_run
13610/// # extern crate hyper;
13611/// # extern crate hyper_rustls;
13612/// # extern crate google_eventarc1 as eventarc1;
13613/// use eventarc1::api::MessageBus;
13614/// # async fn dox() {
13615/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13616///
13617/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13618/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13619/// #     .with_native_roots()
13620/// #     .unwrap()
13621/// #     .https_only()
13622/// #     .enable_http2()
13623/// #     .build();
13624///
13625/// # let executor = hyper_util::rt::TokioExecutor::new();
13626/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13627/// #     secret,
13628/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13629/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13630/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13631/// #     ),
13632/// # ).build().await.unwrap();
13633///
13634/// # let client = hyper_util::client::legacy::Client::builder(
13635/// #     hyper_util::rt::TokioExecutor::new()
13636/// # )
13637/// # .build(
13638/// #     hyper_rustls::HttpsConnectorBuilder::new()
13639/// #         .with_native_roots()
13640/// #         .unwrap()
13641/// #         .https_or_http()
13642/// #         .enable_http2()
13643/// #         .build()
13644/// # );
13645/// # let mut hub = Eventarc::new(client, auth);
13646/// // As the method needs a request, you would usually fill it with the desired information
13647/// // into the respective structure. Some of the parts shown here might not be applicable !
13648/// // Values shown here are possibly random and not representative !
13649/// let mut req = MessageBus::default();
13650///
13651/// // You can configure optional parameters by calling the respective setters at will, and
13652/// // execute the final call using `doit()`.
13653/// // Values shown here are possibly random and not representative !
13654/// let result = hub.projects().locations_message_buses_create(req, "parent")
13655///              .validate_only(false)
13656///              .message_bus_id("amet.")
13657///              .doit().await;
13658/// # }
13659/// ```
13660pub struct ProjectLocationMessageBusCreateCall<'a, C>
13661where
13662    C: 'a,
13663{
13664    hub: &'a Eventarc<C>,
13665    _request: MessageBus,
13666    _parent: String,
13667    _validate_only: Option<bool>,
13668    _message_bus_id: Option<String>,
13669    _delegate: Option<&'a mut dyn common::Delegate>,
13670    _additional_params: HashMap<String, String>,
13671    _scopes: BTreeSet<String>,
13672}
13673
13674impl<'a, C> common::CallBuilder for ProjectLocationMessageBusCreateCall<'a, C> {}
13675
13676impl<'a, C> ProjectLocationMessageBusCreateCall<'a, C>
13677where
13678    C: common::Connector,
13679{
13680    /// Perform the operation you have build so far.
13681    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
13682        use std::borrow::Cow;
13683        use std::io::{Read, Seek};
13684
13685        use common::{url::Params, ToParts};
13686        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13687
13688        let mut dd = common::DefaultDelegate;
13689        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13690        dlg.begin(common::MethodInfo {
13691            id: "eventarc.projects.locations.messageBuses.create",
13692            http_method: hyper::Method::POST,
13693        });
13694
13695        for &field in ["alt", "parent", "validateOnly", "messageBusId"].iter() {
13696            if self._additional_params.contains_key(field) {
13697                dlg.finished(false);
13698                return Err(common::Error::FieldClash(field));
13699            }
13700        }
13701
13702        let mut params = Params::with_capacity(6 + self._additional_params.len());
13703        params.push("parent", self._parent);
13704        if let Some(value) = self._validate_only.as_ref() {
13705            params.push("validateOnly", value.to_string());
13706        }
13707        if let Some(value) = self._message_bus_id.as_ref() {
13708            params.push("messageBusId", value);
13709        }
13710
13711        params.extend(self._additional_params.iter());
13712
13713        params.push("alt", "json");
13714        let mut url = self.hub._base_url.clone() + "v1/{+parent}/messageBuses";
13715        if self._scopes.is_empty() {
13716            self._scopes
13717                .insert(Scope::CloudPlatform.as_ref().to_string());
13718        }
13719
13720        #[allow(clippy::single_element_loop)]
13721        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13722            url = params.uri_replacement(url, param_name, find_this, true);
13723        }
13724        {
13725            let to_remove = ["parent"];
13726            params.remove_params(&to_remove);
13727        }
13728
13729        let url = params.parse_with_url(&url);
13730
13731        let mut json_mime_type = mime::APPLICATION_JSON;
13732        let mut request_value_reader = {
13733            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13734            common::remove_json_null_values(&mut value);
13735            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13736            serde_json::to_writer(&mut dst, &value).unwrap();
13737            dst
13738        };
13739        let request_size = request_value_reader
13740            .seek(std::io::SeekFrom::End(0))
13741            .unwrap();
13742        request_value_reader
13743            .seek(std::io::SeekFrom::Start(0))
13744            .unwrap();
13745
13746        loop {
13747            let token = match self
13748                .hub
13749                .auth
13750                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13751                .await
13752            {
13753                Ok(token) => token,
13754                Err(e) => match dlg.token(e) {
13755                    Ok(token) => token,
13756                    Err(e) => {
13757                        dlg.finished(false);
13758                        return Err(common::Error::MissingToken(e));
13759                    }
13760                },
13761            };
13762            request_value_reader
13763                .seek(std::io::SeekFrom::Start(0))
13764                .unwrap();
13765            let mut req_result = {
13766                let client = &self.hub.client;
13767                dlg.pre_request();
13768                let mut req_builder = hyper::Request::builder()
13769                    .method(hyper::Method::POST)
13770                    .uri(url.as_str())
13771                    .header(USER_AGENT, self.hub._user_agent.clone());
13772
13773                if let Some(token) = token.as_ref() {
13774                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13775                }
13776
13777                let request = req_builder
13778                    .header(CONTENT_TYPE, json_mime_type.to_string())
13779                    .header(CONTENT_LENGTH, request_size as u64)
13780                    .body(common::to_body(
13781                        request_value_reader.get_ref().clone().into(),
13782                    ));
13783
13784                client.request(request.unwrap()).await
13785            };
13786
13787            match req_result {
13788                Err(err) => {
13789                    if let common::Retry::After(d) = dlg.http_error(&err) {
13790                        sleep(d).await;
13791                        continue;
13792                    }
13793                    dlg.finished(false);
13794                    return Err(common::Error::HttpError(err));
13795                }
13796                Ok(res) => {
13797                    let (mut parts, body) = res.into_parts();
13798                    let mut body = common::Body::new(body);
13799                    if !parts.status.is_success() {
13800                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13801                        let error = serde_json::from_str(&common::to_string(&bytes));
13802                        let response = common::to_response(parts, bytes.into());
13803
13804                        if let common::Retry::After(d) =
13805                            dlg.http_failure(&response, error.as_ref().ok())
13806                        {
13807                            sleep(d).await;
13808                            continue;
13809                        }
13810
13811                        dlg.finished(false);
13812
13813                        return Err(match error {
13814                            Ok(value) => common::Error::BadRequest(value),
13815                            _ => common::Error::Failure(response),
13816                        });
13817                    }
13818                    let response = {
13819                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13820                        let encoded = common::to_string(&bytes);
13821                        match serde_json::from_str(&encoded) {
13822                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13823                            Err(error) => {
13824                                dlg.response_json_decode_error(&encoded, &error);
13825                                return Err(common::Error::JsonDecodeError(
13826                                    encoded.to_string(),
13827                                    error,
13828                                ));
13829                            }
13830                        }
13831                    };
13832
13833                    dlg.finished(true);
13834                    return Ok(response);
13835                }
13836            }
13837        }
13838    }
13839
13840    ///
13841    /// Sets the *request* property to the given value.
13842    ///
13843    /// Even though the property as already been set when instantiating this call,
13844    /// we provide this method for API completeness.
13845    pub fn request(mut self, new_value: MessageBus) -> ProjectLocationMessageBusCreateCall<'a, C> {
13846        self._request = new_value;
13847        self
13848    }
13849    /// Required. The parent collection in which to add this message bus.
13850    ///
13851    /// Sets the *parent* path property to the given value.
13852    ///
13853    /// Even though the property as already been set when instantiating this call,
13854    /// we provide this method for API completeness.
13855    pub fn parent(mut self, new_value: &str) -> ProjectLocationMessageBusCreateCall<'a, C> {
13856        self._parent = new_value.to_string();
13857        self
13858    }
13859    /// Optional. If set, validate the request and preview the review, but do not post it.
13860    ///
13861    /// Sets the *validate only* query property to the given value.
13862    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationMessageBusCreateCall<'a, C> {
13863        self._validate_only = Some(new_value);
13864        self
13865    }
13866    /// Required. The user-provided ID to be assigned to the MessageBus. It should match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
13867    ///
13868    /// Sets the *message bus id* query property to the given value.
13869    pub fn message_bus_id(mut self, new_value: &str) -> ProjectLocationMessageBusCreateCall<'a, C> {
13870        self._message_bus_id = Some(new_value.to_string());
13871        self
13872    }
13873    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13874    /// while executing the actual API request.
13875    ///
13876    /// ````text
13877    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13878    /// ````
13879    ///
13880    /// Sets the *delegate* property to the given value.
13881    pub fn delegate(
13882        mut self,
13883        new_value: &'a mut dyn common::Delegate,
13884    ) -> ProjectLocationMessageBusCreateCall<'a, C> {
13885        self._delegate = Some(new_value);
13886        self
13887    }
13888
13889    /// Set any additional parameter of the query string used in the request.
13890    /// It should be used to set parameters which are not yet available through their own
13891    /// setters.
13892    ///
13893    /// Please note that this method must not be used to set any of the known parameters
13894    /// which have their own setter method. If done anyway, the request will fail.
13895    ///
13896    /// # Additional Parameters
13897    ///
13898    /// * *$.xgafv* (query-string) - V1 error format.
13899    /// * *access_token* (query-string) - OAuth access token.
13900    /// * *alt* (query-string) - Data format for response.
13901    /// * *callback* (query-string) - JSONP
13902    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13903    /// * *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.
13904    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13905    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13906    /// * *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.
13907    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13908    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13909    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMessageBusCreateCall<'a, C>
13910    where
13911        T: AsRef<str>,
13912    {
13913        self._additional_params
13914            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13915        self
13916    }
13917
13918    /// Identifies the authorization scope for the method you are building.
13919    ///
13920    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13921    /// [`Scope::CloudPlatform`].
13922    ///
13923    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13924    /// tokens for more than one scope.
13925    ///
13926    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13927    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13928    /// sufficient, a read-write scope will do as well.
13929    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusCreateCall<'a, C>
13930    where
13931        St: AsRef<str>,
13932    {
13933        self._scopes.insert(String::from(scope.as_ref()));
13934        self
13935    }
13936    /// Identifies the authorization scope(s) for the method you are building.
13937    ///
13938    /// See [`Self::add_scope()`] for details.
13939    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMessageBusCreateCall<'a, C>
13940    where
13941        I: IntoIterator<Item = St>,
13942        St: AsRef<str>,
13943    {
13944        self._scopes
13945            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13946        self
13947    }
13948
13949    /// Removes all scopes, and no default scope will be used either.
13950    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13951    /// for details).
13952    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusCreateCall<'a, C> {
13953        self._scopes.clear();
13954        self
13955    }
13956}
13957
13958/// Delete a single message bus.
13959///
13960/// A builder for the *locations.messageBuses.delete* method supported by a *project* resource.
13961/// It is not used directly, but through a [`ProjectMethods`] instance.
13962///
13963/// # Example
13964///
13965/// Instantiate a resource method builder
13966///
13967/// ```test_harness,no_run
13968/// # extern crate hyper;
13969/// # extern crate hyper_rustls;
13970/// # extern crate google_eventarc1 as eventarc1;
13971/// # async fn dox() {
13972/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13973///
13974/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13975/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13976/// #     .with_native_roots()
13977/// #     .unwrap()
13978/// #     .https_only()
13979/// #     .enable_http2()
13980/// #     .build();
13981///
13982/// # let executor = hyper_util::rt::TokioExecutor::new();
13983/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13984/// #     secret,
13985/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13986/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13987/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13988/// #     ),
13989/// # ).build().await.unwrap();
13990///
13991/// # let client = hyper_util::client::legacy::Client::builder(
13992/// #     hyper_util::rt::TokioExecutor::new()
13993/// # )
13994/// # .build(
13995/// #     hyper_rustls::HttpsConnectorBuilder::new()
13996/// #         .with_native_roots()
13997/// #         .unwrap()
13998/// #         .https_or_http()
13999/// #         .enable_http2()
14000/// #         .build()
14001/// # );
14002/// # let mut hub = Eventarc::new(client, auth);
14003/// // You can configure optional parameters by calling the respective setters at will, and
14004/// // execute the final call using `doit()`.
14005/// // Values shown here are possibly random and not representative !
14006/// let result = hub.projects().locations_message_buses_delete("name")
14007///              .validate_only(false)
14008///              .etag("Lorem")
14009///              .allow_missing(true)
14010///              .doit().await;
14011/// # }
14012/// ```
14013pub struct ProjectLocationMessageBusDeleteCall<'a, C>
14014where
14015    C: 'a,
14016{
14017    hub: &'a Eventarc<C>,
14018    _name: String,
14019    _validate_only: Option<bool>,
14020    _etag: Option<String>,
14021    _allow_missing: Option<bool>,
14022    _delegate: Option<&'a mut dyn common::Delegate>,
14023    _additional_params: HashMap<String, String>,
14024    _scopes: BTreeSet<String>,
14025}
14026
14027impl<'a, C> common::CallBuilder for ProjectLocationMessageBusDeleteCall<'a, C> {}
14028
14029impl<'a, C> ProjectLocationMessageBusDeleteCall<'a, C>
14030where
14031    C: common::Connector,
14032{
14033    /// Perform the operation you have build so far.
14034    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
14035        use std::borrow::Cow;
14036        use std::io::{Read, Seek};
14037
14038        use common::{url::Params, ToParts};
14039        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14040
14041        let mut dd = common::DefaultDelegate;
14042        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14043        dlg.begin(common::MethodInfo {
14044            id: "eventarc.projects.locations.messageBuses.delete",
14045            http_method: hyper::Method::DELETE,
14046        });
14047
14048        for &field in ["alt", "name", "validateOnly", "etag", "allowMissing"].iter() {
14049            if self._additional_params.contains_key(field) {
14050                dlg.finished(false);
14051                return Err(common::Error::FieldClash(field));
14052            }
14053        }
14054
14055        let mut params = Params::with_capacity(6 + self._additional_params.len());
14056        params.push("name", self._name);
14057        if let Some(value) = self._validate_only.as_ref() {
14058            params.push("validateOnly", value.to_string());
14059        }
14060        if let Some(value) = self._etag.as_ref() {
14061            params.push("etag", value);
14062        }
14063        if let Some(value) = self._allow_missing.as_ref() {
14064            params.push("allowMissing", value.to_string());
14065        }
14066
14067        params.extend(self._additional_params.iter());
14068
14069        params.push("alt", "json");
14070        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14071        if self._scopes.is_empty() {
14072            self._scopes
14073                .insert(Scope::CloudPlatform.as_ref().to_string());
14074        }
14075
14076        #[allow(clippy::single_element_loop)]
14077        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14078            url = params.uri_replacement(url, param_name, find_this, true);
14079        }
14080        {
14081            let to_remove = ["name"];
14082            params.remove_params(&to_remove);
14083        }
14084
14085        let url = params.parse_with_url(&url);
14086
14087        loop {
14088            let token = match self
14089                .hub
14090                .auth
14091                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14092                .await
14093            {
14094                Ok(token) => token,
14095                Err(e) => match dlg.token(e) {
14096                    Ok(token) => token,
14097                    Err(e) => {
14098                        dlg.finished(false);
14099                        return Err(common::Error::MissingToken(e));
14100                    }
14101                },
14102            };
14103            let mut req_result = {
14104                let client = &self.hub.client;
14105                dlg.pre_request();
14106                let mut req_builder = hyper::Request::builder()
14107                    .method(hyper::Method::DELETE)
14108                    .uri(url.as_str())
14109                    .header(USER_AGENT, self.hub._user_agent.clone());
14110
14111                if let Some(token) = token.as_ref() {
14112                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14113                }
14114
14115                let request = req_builder
14116                    .header(CONTENT_LENGTH, 0_u64)
14117                    .body(common::to_body::<String>(None));
14118
14119                client.request(request.unwrap()).await
14120            };
14121
14122            match req_result {
14123                Err(err) => {
14124                    if let common::Retry::After(d) = dlg.http_error(&err) {
14125                        sleep(d).await;
14126                        continue;
14127                    }
14128                    dlg.finished(false);
14129                    return Err(common::Error::HttpError(err));
14130                }
14131                Ok(res) => {
14132                    let (mut parts, body) = res.into_parts();
14133                    let mut body = common::Body::new(body);
14134                    if !parts.status.is_success() {
14135                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14136                        let error = serde_json::from_str(&common::to_string(&bytes));
14137                        let response = common::to_response(parts, bytes.into());
14138
14139                        if let common::Retry::After(d) =
14140                            dlg.http_failure(&response, error.as_ref().ok())
14141                        {
14142                            sleep(d).await;
14143                            continue;
14144                        }
14145
14146                        dlg.finished(false);
14147
14148                        return Err(match error {
14149                            Ok(value) => common::Error::BadRequest(value),
14150                            _ => common::Error::Failure(response),
14151                        });
14152                    }
14153                    let response = {
14154                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14155                        let encoded = common::to_string(&bytes);
14156                        match serde_json::from_str(&encoded) {
14157                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14158                            Err(error) => {
14159                                dlg.response_json_decode_error(&encoded, &error);
14160                                return Err(common::Error::JsonDecodeError(
14161                                    encoded.to_string(),
14162                                    error,
14163                                ));
14164                            }
14165                        }
14166                    };
14167
14168                    dlg.finished(true);
14169                    return Ok(response);
14170                }
14171            }
14172        }
14173    }
14174
14175    /// Required. The name of the MessageBus to be deleted.
14176    ///
14177    /// Sets the *name* path property to the given value.
14178    ///
14179    /// Even though the property as already been set when instantiating this call,
14180    /// we provide this method for API completeness.
14181    pub fn name(mut self, new_value: &str) -> ProjectLocationMessageBusDeleteCall<'a, C> {
14182        self._name = new_value.to_string();
14183        self
14184    }
14185    /// Optional. If set, validate the request and preview the review, but do not post it.
14186    ///
14187    /// Sets the *validate only* query property to the given value.
14188    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationMessageBusDeleteCall<'a, C> {
14189        self._validate_only = Some(new_value);
14190        self
14191    }
14192    /// Optional. If provided, the MessageBus will only be deleted if the etag matches the current etag on the resource.
14193    ///
14194    /// Sets the *etag* query property to the given value.
14195    pub fn etag(mut self, new_value: &str) -> ProjectLocationMessageBusDeleteCall<'a, C> {
14196        self._etag = Some(new_value.to_string());
14197        self
14198    }
14199    /// Optional. If set to true, and the MessageBus is not found, the request will succeed but no action will be taken on the server.
14200    ///
14201    /// Sets the *allow missing* query property to the given value.
14202    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationMessageBusDeleteCall<'a, C> {
14203        self._allow_missing = Some(new_value);
14204        self
14205    }
14206    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14207    /// while executing the actual API request.
14208    ///
14209    /// ````text
14210    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14211    /// ````
14212    ///
14213    /// Sets the *delegate* property to the given value.
14214    pub fn delegate(
14215        mut self,
14216        new_value: &'a mut dyn common::Delegate,
14217    ) -> ProjectLocationMessageBusDeleteCall<'a, C> {
14218        self._delegate = Some(new_value);
14219        self
14220    }
14221
14222    /// Set any additional parameter of the query string used in the request.
14223    /// It should be used to set parameters which are not yet available through their own
14224    /// setters.
14225    ///
14226    /// Please note that this method must not be used to set any of the known parameters
14227    /// which have their own setter method. If done anyway, the request will fail.
14228    ///
14229    /// # Additional Parameters
14230    ///
14231    /// * *$.xgafv* (query-string) - V1 error format.
14232    /// * *access_token* (query-string) - OAuth access token.
14233    /// * *alt* (query-string) - Data format for response.
14234    /// * *callback* (query-string) - JSONP
14235    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14236    /// * *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.
14237    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14238    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14239    /// * *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.
14240    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14241    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14242    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMessageBusDeleteCall<'a, C>
14243    where
14244        T: AsRef<str>,
14245    {
14246        self._additional_params
14247            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14248        self
14249    }
14250
14251    /// Identifies the authorization scope for the method you are building.
14252    ///
14253    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14254    /// [`Scope::CloudPlatform`].
14255    ///
14256    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14257    /// tokens for more than one scope.
14258    ///
14259    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14260    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14261    /// sufficient, a read-write scope will do as well.
14262    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusDeleteCall<'a, C>
14263    where
14264        St: AsRef<str>,
14265    {
14266        self._scopes.insert(String::from(scope.as_ref()));
14267        self
14268    }
14269    /// Identifies the authorization scope(s) for the method you are building.
14270    ///
14271    /// See [`Self::add_scope()`] for details.
14272    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMessageBusDeleteCall<'a, C>
14273    where
14274        I: IntoIterator<Item = St>,
14275        St: AsRef<str>,
14276    {
14277        self._scopes
14278            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14279        self
14280    }
14281
14282    /// Removes all scopes, and no default scope will be used either.
14283    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14284    /// for details).
14285    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusDeleteCall<'a, C> {
14286        self._scopes.clear();
14287        self
14288    }
14289}
14290
14291/// Get a single MessageBus.
14292///
14293/// A builder for the *locations.messageBuses.get* method supported by a *project* resource.
14294/// It is not used directly, but through a [`ProjectMethods`] instance.
14295///
14296/// # Example
14297///
14298/// Instantiate a resource method builder
14299///
14300/// ```test_harness,no_run
14301/// # extern crate hyper;
14302/// # extern crate hyper_rustls;
14303/// # extern crate google_eventarc1 as eventarc1;
14304/// # async fn dox() {
14305/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14306///
14307/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14308/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14309/// #     .with_native_roots()
14310/// #     .unwrap()
14311/// #     .https_only()
14312/// #     .enable_http2()
14313/// #     .build();
14314///
14315/// # let executor = hyper_util::rt::TokioExecutor::new();
14316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14317/// #     secret,
14318/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14319/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14320/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14321/// #     ),
14322/// # ).build().await.unwrap();
14323///
14324/// # let client = hyper_util::client::legacy::Client::builder(
14325/// #     hyper_util::rt::TokioExecutor::new()
14326/// # )
14327/// # .build(
14328/// #     hyper_rustls::HttpsConnectorBuilder::new()
14329/// #         .with_native_roots()
14330/// #         .unwrap()
14331/// #         .https_or_http()
14332/// #         .enable_http2()
14333/// #         .build()
14334/// # );
14335/// # let mut hub = Eventarc::new(client, auth);
14336/// // You can configure optional parameters by calling the respective setters at will, and
14337/// // execute the final call using `doit()`.
14338/// // Values shown here are possibly random and not representative !
14339/// let result = hub.projects().locations_message_buses_get("name")
14340///              .doit().await;
14341/// # }
14342/// ```
14343pub struct ProjectLocationMessageBusGetCall<'a, C>
14344where
14345    C: 'a,
14346{
14347    hub: &'a Eventarc<C>,
14348    _name: String,
14349    _delegate: Option<&'a mut dyn common::Delegate>,
14350    _additional_params: HashMap<String, String>,
14351    _scopes: BTreeSet<String>,
14352}
14353
14354impl<'a, C> common::CallBuilder for ProjectLocationMessageBusGetCall<'a, C> {}
14355
14356impl<'a, C> ProjectLocationMessageBusGetCall<'a, C>
14357where
14358    C: common::Connector,
14359{
14360    /// Perform the operation you have build so far.
14361    pub async fn doit(mut self) -> common::Result<(common::Response, MessageBus)> {
14362        use std::borrow::Cow;
14363        use std::io::{Read, Seek};
14364
14365        use common::{url::Params, ToParts};
14366        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14367
14368        let mut dd = common::DefaultDelegate;
14369        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14370        dlg.begin(common::MethodInfo {
14371            id: "eventarc.projects.locations.messageBuses.get",
14372            http_method: hyper::Method::GET,
14373        });
14374
14375        for &field in ["alt", "name"].iter() {
14376            if self._additional_params.contains_key(field) {
14377                dlg.finished(false);
14378                return Err(common::Error::FieldClash(field));
14379            }
14380        }
14381
14382        let mut params = Params::with_capacity(3 + self._additional_params.len());
14383        params.push("name", self._name);
14384
14385        params.extend(self._additional_params.iter());
14386
14387        params.push("alt", "json");
14388        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14389        if self._scopes.is_empty() {
14390            self._scopes
14391                .insert(Scope::CloudPlatform.as_ref().to_string());
14392        }
14393
14394        #[allow(clippy::single_element_loop)]
14395        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14396            url = params.uri_replacement(url, param_name, find_this, true);
14397        }
14398        {
14399            let to_remove = ["name"];
14400            params.remove_params(&to_remove);
14401        }
14402
14403        let url = params.parse_with_url(&url);
14404
14405        loop {
14406            let token = match self
14407                .hub
14408                .auth
14409                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14410                .await
14411            {
14412                Ok(token) => token,
14413                Err(e) => match dlg.token(e) {
14414                    Ok(token) => token,
14415                    Err(e) => {
14416                        dlg.finished(false);
14417                        return Err(common::Error::MissingToken(e));
14418                    }
14419                },
14420            };
14421            let mut req_result = {
14422                let client = &self.hub.client;
14423                dlg.pre_request();
14424                let mut req_builder = hyper::Request::builder()
14425                    .method(hyper::Method::GET)
14426                    .uri(url.as_str())
14427                    .header(USER_AGENT, self.hub._user_agent.clone());
14428
14429                if let Some(token) = token.as_ref() {
14430                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14431                }
14432
14433                let request = req_builder
14434                    .header(CONTENT_LENGTH, 0_u64)
14435                    .body(common::to_body::<String>(None));
14436
14437                client.request(request.unwrap()).await
14438            };
14439
14440            match req_result {
14441                Err(err) => {
14442                    if let common::Retry::After(d) = dlg.http_error(&err) {
14443                        sleep(d).await;
14444                        continue;
14445                    }
14446                    dlg.finished(false);
14447                    return Err(common::Error::HttpError(err));
14448                }
14449                Ok(res) => {
14450                    let (mut parts, body) = res.into_parts();
14451                    let mut body = common::Body::new(body);
14452                    if !parts.status.is_success() {
14453                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14454                        let error = serde_json::from_str(&common::to_string(&bytes));
14455                        let response = common::to_response(parts, bytes.into());
14456
14457                        if let common::Retry::After(d) =
14458                            dlg.http_failure(&response, error.as_ref().ok())
14459                        {
14460                            sleep(d).await;
14461                            continue;
14462                        }
14463
14464                        dlg.finished(false);
14465
14466                        return Err(match error {
14467                            Ok(value) => common::Error::BadRequest(value),
14468                            _ => common::Error::Failure(response),
14469                        });
14470                    }
14471                    let response = {
14472                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14473                        let encoded = common::to_string(&bytes);
14474                        match serde_json::from_str(&encoded) {
14475                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14476                            Err(error) => {
14477                                dlg.response_json_decode_error(&encoded, &error);
14478                                return Err(common::Error::JsonDecodeError(
14479                                    encoded.to_string(),
14480                                    error,
14481                                ));
14482                            }
14483                        }
14484                    };
14485
14486                    dlg.finished(true);
14487                    return Ok(response);
14488                }
14489            }
14490        }
14491    }
14492
14493    /// Required. The name of the message bus to get.
14494    ///
14495    /// Sets the *name* path property to the given value.
14496    ///
14497    /// Even though the property as already been set when instantiating this call,
14498    /// we provide this method for API completeness.
14499    pub fn name(mut self, new_value: &str) -> ProjectLocationMessageBusGetCall<'a, C> {
14500        self._name = new_value.to_string();
14501        self
14502    }
14503    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14504    /// while executing the actual API request.
14505    ///
14506    /// ````text
14507    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14508    /// ````
14509    ///
14510    /// Sets the *delegate* property to the given value.
14511    pub fn delegate(
14512        mut self,
14513        new_value: &'a mut dyn common::Delegate,
14514    ) -> ProjectLocationMessageBusGetCall<'a, C> {
14515        self._delegate = Some(new_value);
14516        self
14517    }
14518
14519    /// Set any additional parameter of the query string used in the request.
14520    /// It should be used to set parameters which are not yet available through their own
14521    /// setters.
14522    ///
14523    /// Please note that this method must not be used to set any of the known parameters
14524    /// which have their own setter method. If done anyway, the request will fail.
14525    ///
14526    /// # Additional Parameters
14527    ///
14528    /// * *$.xgafv* (query-string) - V1 error format.
14529    /// * *access_token* (query-string) - OAuth access token.
14530    /// * *alt* (query-string) - Data format for response.
14531    /// * *callback* (query-string) - JSONP
14532    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14533    /// * *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.
14534    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14535    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14536    /// * *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.
14537    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14538    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14539    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMessageBusGetCall<'a, C>
14540    where
14541        T: AsRef<str>,
14542    {
14543        self._additional_params
14544            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14545        self
14546    }
14547
14548    /// Identifies the authorization scope for the method you are building.
14549    ///
14550    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14551    /// [`Scope::CloudPlatform`].
14552    ///
14553    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14554    /// tokens for more than one scope.
14555    ///
14556    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14557    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14558    /// sufficient, a read-write scope will do as well.
14559    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusGetCall<'a, C>
14560    where
14561        St: AsRef<str>,
14562    {
14563        self._scopes.insert(String::from(scope.as_ref()));
14564        self
14565    }
14566    /// Identifies the authorization scope(s) for the method you are building.
14567    ///
14568    /// See [`Self::add_scope()`] for details.
14569    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMessageBusGetCall<'a, C>
14570    where
14571        I: IntoIterator<Item = St>,
14572        St: AsRef<str>,
14573    {
14574        self._scopes
14575            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14576        self
14577    }
14578
14579    /// Removes all scopes, and no default scope will be used either.
14580    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14581    /// for details).
14582    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusGetCall<'a, C> {
14583        self._scopes.clear();
14584        self
14585    }
14586}
14587
14588/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
14589///
14590/// A builder for the *locations.messageBuses.getIamPolicy* method supported by a *project* resource.
14591/// It is not used directly, but through a [`ProjectMethods`] instance.
14592///
14593/// # Example
14594///
14595/// Instantiate a resource method builder
14596///
14597/// ```test_harness,no_run
14598/// # extern crate hyper;
14599/// # extern crate hyper_rustls;
14600/// # extern crate google_eventarc1 as eventarc1;
14601/// # async fn dox() {
14602/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14603///
14604/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14605/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14606/// #     .with_native_roots()
14607/// #     .unwrap()
14608/// #     .https_only()
14609/// #     .enable_http2()
14610/// #     .build();
14611///
14612/// # let executor = hyper_util::rt::TokioExecutor::new();
14613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14614/// #     secret,
14615/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14616/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14617/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14618/// #     ),
14619/// # ).build().await.unwrap();
14620///
14621/// # let client = hyper_util::client::legacy::Client::builder(
14622/// #     hyper_util::rt::TokioExecutor::new()
14623/// # )
14624/// # .build(
14625/// #     hyper_rustls::HttpsConnectorBuilder::new()
14626/// #         .with_native_roots()
14627/// #         .unwrap()
14628/// #         .https_or_http()
14629/// #         .enable_http2()
14630/// #         .build()
14631/// # );
14632/// # let mut hub = Eventarc::new(client, auth);
14633/// // You can configure optional parameters by calling the respective setters at will, and
14634/// // execute the final call using `doit()`.
14635/// // Values shown here are possibly random and not representative !
14636/// let result = hub.projects().locations_message_buses_get_iam_policy("resource")
14637///              .options_requested_policy_version(-27)
14638///              .doit().await;
14639/// # }
14640/// ```
14641pub struct ProjectLocationMessageBusGetIamPolicyCall<'a, C>
14642where
14643    C: 'a,
14644{
14645    hub: &'a Eventarc<C>,
14646    _resource: String,
14647    _options_requested_policy_version: Option<i32>,
14648    _delegate: Option<&'a mut dyn common::Delegate>,
14649    _additional_params: HashMap<String, String>,
14650    _scopes: BTreeSet<String>,
14651}
14652
14653impl<'a, C> common::CallBuilder for ProjectLocationMessageBusGetIamPolicyCall<'a, C> {}
14654
14655impl<'a, C> ProjectLocationMessageBusGetIamPolicyCall<'a, C>
14656where
14657    C: common::Connector,
14658{
14659    /// Perform the operation you have build so far.
14660    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14661        use std::borrow::Cow;
14662        use std::io::{Read, Seek};
14663
14664        use common::{url::Params, ToParts};
14665        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14666
14667        let mut dd = common::DefaultDelegate;
14668        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14669        dlg.begin(common::MethodInfo {
14670            id: "eventarc.projects.locations.messageBuses.getIamPolicy",
14671            http_method: hyper::Method::GET,
14672        });
14673
14674        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
14675            if self._additional_params.contains_key(field) {
14676                dlg.finished(false);
14677                return Err(common::Error::FieldClash(field));
14678            }
14679        }
14680
14681        let mut params = Params::with_capacity(4 + self._additional_params.len());
14682        params.push("resource", self._resource);
14683        if let Some(value) = self._options_requested_policy_version.as_ref() {
14684            params.push("options.requestedPolicyVersion", value.to_string());
14685        }
14686
14687        params.extend(self._additional_params.iter());
14688
14689        params.push("alt", "json");
14690        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
14691        if self._scopes.is_empty() {
14692            self._scopes
14693                .insert(Scope::CloudPlatform.as_ref().to_string());
14694        }
14695
14696        #[allow(clippy::single_element_loop)]
14697        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14698            url = params.uri_replacement(url, param_name, find_this, true);
14699        }
14700        {
14701            let to_remove = ["resource"];
14702            params.remove_params(&to_remove);
14703        }
14704
14705        let url = params.parse_with_url(&url);
14706
14707        loop {
14708            let token = match self
14709                .hub
14710                .auth
14711                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14712                .await
14713            {
14714                Ok(token) => token,
14715                Err(e) => match dlg.token(e) {
14716                    Ok(token) => token,
14717                    Err(e) => {
14718                        dlg.finished(false);
14719                        return Err(common::Error::MissingToken(e));
14720                    }
14721                },
14722            };
14723            let mut req_result = {
14724                let client = &self.hub.client;
14725                dlg.pre_request();
14726                let mut req_builder = hyper::Request::builder()
14727                    .method(hyper::Method::GET)
14728                    .uri(url.as_str())
14729                    .header(USER_AGENT, self.hub._user_agent.clone());
14730
14731                if let Some(token) = token.as_ref() {
14732                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14733                }
14734
14735                let request = req_builder
14736                    .header(CONTENT_LENGTH, 0_u64)
14737                    .body(common::to_body::<String>(None));
14738
14739                client.request(request.unwrap()).await
14740            };
14741
14742            match req_result {
14743                Err(err) => {
14744                    if let common::Retry::After(d) = dlg.http_error(&err) {
14745                        sleep(d).await;
14746                        continue;
14747                    }
14748                    dlg.finished(false);
14749                    return Err(common::Error::HttpError(err));
14750                }
14751                Ok(res) => {
14752                    let (mut parts, body) = res.into_parts();
14753                    let mut body = common::Body::new(body);
14754                    if !parts.status.is_success() {
14755                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14756                        let error = serde_json::from_str(&common::to_string(&bytes));
14757                        let response = common::to_response(parts, bytes.into());
14758
14759                        if let common::Retry::After(d) =
14760                            dlg.http_failure(&response, error.as_ref().ok())
14761                        {
14762                            sleep(d).await;
14763                            continue;
14764                        }
14765
14766                        dlg.finished(false);
14767
14768                        return Err(match error {
14769                            Ok(value) => common::Error::BadRequest(value),
14770                            _ => common::Error::Failure(response),
14771                        });
14772                    }
14773                    let response = {
14774                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14775                        let encoded = common::to_string(&bytes);
14776                        match serde_json::from_str(&encoded) {
14777                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14778                            Err(error) => {
14779                                dlg.response_json_decode_error(&encoded, &error);
14780                                return Err(common::Error::JsonDecodeError(
14781                                    encoded.to_string(),
14782                                    error,
14783                                ));
14784                            }
14785                        }
14786                    };
14787
14788                    dlg.finished(true);
14789                    return Ok(response);
14790                }
14791            }
14792        }
14793    }
14794
14795    /// 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.
14796    ///
14797    /// Sets the *resource* path property to the given value.
14798    ///
14799    /// Even though the property as already been set when instantiating this call,
14800    /// we provide this method for API completeness.
14801    pub fn resource(mut self, new_value: &str) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C> {
14802        self._resource = new_value.to_string();
14803        self
14804    }
14805    /// 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).
14806    ///
14807    /// Sets the *options.requested policy version* query property to the given value.
14808    pub fn options_requested_policy_version(
14809        mut self,
14810        new_value: i32,
14811    ) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C> {
14812        self._options_requested_policy_version = Some(new_value);
14813        self
14814    }
14815    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14816    /// while executing the actual API request.
14817    ///
14818    /// ````text
14819    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14820    /// ````
14821    ///
14822    /// Sets the *delegate* property to the given value.
14823    pub fn delegate(
14824        mut self,
14825        new_value: &'a mut dyn common::Delegate,
14826    ) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C> {
14827        self._delegate = Some(new_value);
14828        self
14829    }
14830
14831    /// Set any additional parameter of the query string used in the request.
14832    /// It should be used to set parameters which are not yet available through their own
14833    /// setters.
14834    ///
14835    /// Please note that this method must not be used to set any of the known parameters
14836    /// which have their own setter method. If done anyway, the request will fail.
14837    ///
14838    /// # Additional Parameters
14839    ///
14840    /// * *$.xgafv* (query-string) - V1 error format.
14841    /// * *access_token* (query-string) - OAuth access token.
14842    /// * *alt* (query-string) - Data format for response.
14843    /// * *callback* (query-string) - JSONP
14844    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14845    /// * *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.
14846    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14847    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14848    /// * *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.
14849    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14850    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14851    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C>
14852    where
14853        T: AsRef<str>,
14854    {
14855        self._additional_params
14856            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14857        self
14858    }
14859
14860    /// Identifies the authorization scope for the method you are building.
14861    ///
14862    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14863    /// [`Scope::CloudPlatform`].
14864    ///
14865    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14866    /// tokens for more than one scope.
14867    ///
14868    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14869    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14870    /// sufficient, a read-write scope will do as well.
14871    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C>
14872    where
14873        St: AsRef<str>,
14874    {
14875        self._scopes.insert(String::from(scope.as_ref()));
14876        self
14877    }
14878    /// Identifies the authorization scope(s) for the method you are building.
14879    ///
14880    /// See [`Self::add_scope()`] for details.
14881    pub fn add_scopes<I, St>(
14882        mut self,
14883        scopes: I,
14884    ) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C>
14885    where
14886        I: IntoIterator<Item = St>,
14887        St: AsRef<str>,
14888    {
14889        self._scopes
14890            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14891        self
14892    }
14893
14894    /// Removes all scopes, and no default scope will be used either.
14895    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14896    /// for details).
14897    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusGetIamPolicyCall<'a, C> {
14898        self._scopes.clear();
14899        self
14900    }
14901}
14902
14903/// List message buses.
14904///
14905/// A builder for the *locations.messageBuses.list* method supported by a *project* resource.
14906/// It is not used directly, but through a [`ProjectMethods`] instance.
14907///
14908/// # Example
14909///
14910/// Instantiate a resource method builder
14911///
14912/// ```test_harness,no_run
14913/// # extern crate hyper;
14914/// # extern crate hyper_rustls;
14915/// # extern crate google_eventarc1 as eventarc1;
14916/// # async fn dox() {
14917/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14918///
14919/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14920/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14921/// #     .with_native_roots()
14922/// #     .unwrap()
14923/// #     .https_only()
14924/// #     .enable_http2()
14925/// #     .build();
14926///
14927/// # let executor = hyper_util::rt::TokioExecutor::new();
14928/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14929/// #     secret,
14930/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14931/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14932/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14933/// #     ),
14934/// # ).build().await.unwrap();
14935///
14936/// # let client = hyper_util::client::legacy::Client::builder(
14937/// #     hyper_util::rt::TokioExecutor::new()
14938/// # )
14939/// # .build(
14940/// #     hyper_rustls::HttpsConnectorBuilder::new()
14941/// #         .with_native_roots()
14942/// #         .unwrap()
14943/// #         .https_or_http()
14944/// #         .enable_http2()
14945/// #         .build()
14946/// # );
14947/// # let mut hub = Eventarc::new(client, auth);
14948/// // You can configure optional parameters by calling the respective setters at will, and
14949/// // execute the final call using `doit()`.
14950/// // Values shown here are possibly random and not representative !
14951/// let result = hub.projects().locations_message_buses_list("parent")
14952///              .page_token("sit")
14953///              .page_size(-35)
14954///              .order_by("tempor")
14955///              .filter("aliquyam")
14956///              .doit().await;
14957/// # }
14958/// ```
14959pub struct ProjectLocationMessageBusListCall<'a, C>
14960where
14961    C: 'a,
14962{
14963    hub: &'a Eventarc<C>,
14964    _parent: String,
14965    _page_token: Option<String>,
14966    _page_size: Option<i32>,
14967    _order_by: Option<String>,
14968    _filter: Option<String>,
14969    _delegate: Option<&'a mut dyn common::Delegate>,
14970    _additional_params: HashMap<String, String>,
14971    _scopes: BTreeSet<String>,
14972}
14973
14974impl<'a, C> common::CallBuilder for ProjectLocationMessageBusListCall<'a, C> {}
14975
14976impl<'a, C> ProjectLocationMessageBusListCall<'a, C>
14977where
14978    C: common::Connector,
14979{
14980    /// Perform the operation you have build so far.
14981    pub async fn doit(mut self) -> common::Result<(common::Response, ListMessageBusesResponse)> {
14982        use std::borrow::Cow;
14983        use std::io::{Read, Seek};
14984
14985        use common::{url::Params, ToParts};
14986        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14987
14988        let mut dd = common::DefaultDelegate;
14989        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14990        dlg.begin(common::MethodInfo {
14991            id: "eventarc.projects.locations.messageBuses.list",
14992            http_method: hyper::Method::GET,
14993        });
14994
14995        for &field in [
14996            "alt",
14997            "parent",
14998            "pageToken",
14999            "pageSize",
15000            "orderBy",
15001            "filter",
15002        ]
15003        .iter()
15004        {
15005            if self._additional_params.contains_key(field) {
15006                dlg.finished(false);
15007                return Err(common::Error::FieldClash(field));
15008            }
15009        }
15010
15011        let mut params = Params::with_capacity(7 + self._additional_params.len());
15012        params.push("parent", self._parent);
15013        if let Some(value) = self._page_token.as_ref() {
15014            params.push("pageToken", value);
15015        }
15016        if let Some(value) = self._page_size.as_ref() {
15017            params.push("pageSize", value.to_string());
15018        }
15019        if let Some(value) = self._order_by.as_ref() {
15020            params.push("orderBy", value);
15021        }
15022        if let Some(value) = self._filter.as_ref() {
15023            params.push("filter", value);
15024        }
15025
15026        params.extend(self._additional_params.iter());
15027
15028        params.push("alt", "json");
15029        let mut url = self.hub._base_url.clone() + "v1/{+parent}/messageBuses";
15030        if self._scopes.is_empty() {
15031            self._scopes
15032                .insert(Scope::CloudPlatform.as_ref().to_string());
15033        }
15034
15035        #[allow(clippy::single_element_loop)]
15036        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15037            url = params.uri_replacement(url, param_name, find_this, true);
15038        }
15039        {
15040            let to_remove = ["parent"];
15041            params.remove_params(&to_remove);
15042        }
15043
15044        let url = params.parse_with_url(&url);
15045
15046        loop {
15047            let token = match self
15048                .hub
15049                .auth
15050                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15051                .await
15052            {
15053                Ok(token) => token,
15054                Err(e) => match dlg.token(e) {
15055                    Ok(token) => token,
15056                    Err(e) => {
15057                        dlg.finished(false);
15058                        return Err(common::Error::MissingToken(e));
15059                    }
15060                },
15061            };
15062            let mut req_result = {
15063                let client = &self.hub.client;
15064                dlg.pre_request();
15065                let mut req_builder = hyper::Request::builder()
15066                    .method(hyper::Method::GET)
15067                    .uri(url.as_str())
15068                    .header(USER_AGENT, self.hub._user_agent.clone());
15069
15070                if let Some(token) = token.as_ref() {
15071                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15072                }
15073
15074                let request = req_builder
15075                    .header(CONTENT_LENGTH, 0_u64)
15076                    .body(common::to_body::<String>(None));
15077
15078                client.request(request.unwrap()).await
15079            };
15080
15081            match req_result {
15082                Err(err) => {
15083                    if let common::Retry::After(d) = dlg.http_error(&err) {
15084                        sleep(d).await;
15085                        continue;
15086                    }
15087                    dlg.finished(false);
15088                    return Err(common::Error::HttpError(err));
15089                }
15090                Ok(res) => {
15091                    let (mut parts, body) = res.into_parts();
15092                    let mut body = common::Body::new(body);
15093                    if !parts.status.is_success() {
15094                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15095                        let error = serde_json::from_str(&common::to_string(&bytes));
15096                        let response = common::to_response(parts, bytes.into());
15097
15098                        if let common::Retry::After(d) =
15099                            dlg.http_failure(&response, error.as_ref().ok())
15100                        {
15101                            sleep(d).await;
15102                            continue;
15103                        }
15104
15105                        dlg.finished(false);
15106
15107                        return Err(match error {
15108                            Ok(value) => common::Error::BadRequest(value),
15109                            _ => common::Error::Failure(response),
15110                        });
15111                    }
15112                    let response = {
15113                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15114                        let encoded = common::to_string(&bytes);
15115                        match serde_json::from_str(&encoded) {
15116                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15117                            Err(error) => {
15118                                dlg.response_json_decode_error(&encoded, &error);
15119                                return Err(common::Error::JsonDecodeError(
15120                                    encoded.to_string(),
15121                                    error,
15122                                ));
15123                            }
15124                        }
15125                    };
15126
15127                    dlg.finished(true);
15128                    return Ok(response);
15129                }
15130            }
15131        }
15132    }
15133
15134    /// Required. The parent collection to list message buses on.
15135    ///
15136    /// Sets the *parent* path property to the given value.
15137    ///
15138    /// Even though the property as already been set when instantiating this call,
15139    /// we provide this method for API completeness.
15140    pub fn parent(mut self, new_value: &str) -> ProjectLocationMessageBusListCall<'a, C> {
15141        self._parent = new_value.to_string();
15142        self
15143    }
15144    /// Optional. The page token; provide the value from the `next_page_token` field in a previous call to retrieve the subsequent page. When paginating, all other parameters provided must match the previous call that provided the page token.
15145    ///
15146    /// Sets the *page token* query property to the given value.
15147    pub fn page_token(mut self, new_value: &str) -> ProjectLocationMessageBusListCall<'a, C> {
15148        self._page_token = Some(new_value.to_string());
15149        self
15150    }
15151    /// Optional. The maximum number of results to return on each page. Note: The service may send fewer.
15152    ///
15153    /// Sets the *page size* query property to the given value.
15154    pub fn page_size(mut self, new_value: i32) -> ProjectLocationMessageBusListCall<'a, C> {
15155        self._page_size = Some(new_value);
15156        self
15157    }
15158    /// Optional. The sorting order of the resources returned. Value should be a comma-separated list of fields. The default sorting order is ascending. To specify descending order for a field, append a `desc` suffix; for example: `name desc, update_time`.
15159    ///
15160    /// Sets the *order by* query property to the given value.
15161    pub fn order_by(mut self, new_value: &str) -> ProjectLocationMessageBusListCall<'a, C> {
15162        self._order_by = Some(new_value.to_string());
15163        self
15164    }
15165    /// Optional. The filter field that the list request will filter on. Possible filtersare described in https://google.aip.dev/160.
15166    ///
15167    /// Sets the *filter* query property to the given value.
15168    pub fn filter(mut self, new_value: &str) -> ProjectLocationMessageBusListCall<'a, C> {
15169        self._filter = Some(new_value.to_string());
15170        self
15171    }
15172    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15173    /// while executing the actual API request.
15174    ///
15175    /// ````text
15176    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15177    /// ````
15178    ///
15179    /// Sets the *delegate* property to the given value.
15180    pub fn delegate(
15181        mut self,
15182        new_value: &'a mut dyn common::Delegate,
15183    ) -> ProjectLocationMessageBusListCall<'a, C> {
15184        self._delegate = Some(new_value);
15185        self
15186    }
15187
15188    /// Set any additional parameter of the query string used in the request.
15189    /// It should be used to set parameters which are not yet available through their own
15190    /// setters.
15191    ///
15192    /// Please note that this method must not be used to set any of the known parameters
15193    /// which have their own setter method. If done anyway, the request will fail.
15194    ///
15195    /// # Additional Parameters
15196    ///
15197    /// * *$.xgafv* (query-string) - V1 error format.
15198    /// * *access_token* (query-string) - OAuth access token.
15199    /// * *alt* (query-string) - Data format for response.
15200    /// * *callback* (query-string) - JSONP
15201    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15202    /// * *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.
15203    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15204    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15205    /// * *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.
15206    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15207    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15208    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMessageBusListCall<'a, C>
15209    where
15210        T: AsRef<str>,
15211    {
15212        self._additional_params
15213            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15214        self
15215    }
15216
15217    /// Identifies the authorization scope for the method you are building.
15218    ///
15219    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15220    /// [`Scope::CloudPlatform`].
15221    ///
15222    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15223    /// tokens for more than one scope.
15224    ///
15225    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15226    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15227    /// sufficient, a read-write scope will do as well.
15228    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusListCall<'a, C>
15229    where
15230        St: AsRef<str>,
15231    {
15232        self._scopes.insert(String::from(scope.as_ref()));
15233        self
15234    }
15235    /// Identifies the authorization scope(s) for the method you are building.
15236    ///
15237    /// See [`Self::add_scope()`] for details.
15238    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMessageBusListCall<'a, C>
15239    where
15240        I: IntoIterator<Item = St>,
15241        St: AsRef<str>,
15242    {
15243        self._scopes
15244            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15245        self
15246    }
15247
15248    /// Removes all scopes, and no default scope will be used either.
15249    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15250    /// for details).
15251    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusListCall<'a, C> {
15252        self._scopes.clear();
15253        self
15254    }
15255}
15256
15257/// List message bus enrollments.
15258///
15259/// A builder for the *locations.messageBuses.listEnrollments* method supported by a *project* resource.
15260/// It is not used directly, but through a [`ProjectMethods`] instance.
15261///
15262/// # Example
15263///
15264/// Instantiate a resource method builder
15265///
15266/// ```test_harness,no_run
15267/// # extern crate hyper;
15268/// # extern crate hyper_rustls;
15269/// # extern crate google_eventarc1 as eventarc1;
15270/// # async fn dox() {
15271/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15272///
15273/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15274/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15275/// #     .with_native_roots()
15276/// #     .unwrap()
15277/// #     .https_only()
15278/// #     .enable_http2()
15279/// #     .build();
15280///
15281/// # let executor = hyper_util::rt::TokioExecutor::new();
15282/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15283/// #     secret,
15284/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15285/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15286/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15287/// #     ),
15288/// # ).build().await.unwrap();
15289///
15290/// # let client = hyper_util::client::legacy::Client::builder(
15291/// #     hyper_util::rt::TokioExecutor::new()
15292/// # )
15293/// # .build(
15294/// #     hyper_rustls::HttpsConnectorBuilder::new()
15295/// #         .with_native_roots()
15296/// #         .unwrap()
15297/// #         .https_or_http()
15298/// #         .enable_http2()
15299/// #         .build()
15300/// # );
15301/// # let mut hub = Eventarc::new(client, auth);
15302/// // You can configure optional parameters by calling the respective setters at will, and
15303/// // execute the final call using `doit()`.
15304/// // Values shown here are possibly random and not representative !
15305/// let result = hub.projects().locations_message_buses_list_enrollments("parent")
15306///              .page_token("et")
15307///              .page_size(-8)
15308///              .doit().await;
15309/// # }
15310/// ```
15311pub struct ProjectLocationMessageBusListEnrollmentCall<'a, C>
15312where
15313    C: 'a,
15314{
15315    hub: &'a Eventarc<C>,
15316    _parent: String,
15317    _page_token: Option<String>,
15318    _page_size: Option<i32>,
15319    _delegate: Option<&'a mut dyn common::Delegate>,
15320    _additional_params: HashMap<String, String>,
15321    _scopes: BTreeSet<String>,
15322}
15323
15324impl<'a, C> common::CallBuilder for ProjectLocationMessageBusListEnrollmentCall<'a, C> {}
15325
15326impl<'a, C> ProjectLocationMessageBusListEnrollmentCall<'a, C>
15327where
15328    C: common::Connector,
15329{
15330    /// Perform the operation you have build so far.
15331    pub async fn doit(
15332        mut self,
15333    ) -> common::Result<(common::Response, ListMessageBusEnrollmentsResponse)> {
15334        use std::borrow::Cow;
15335        use std::io::{Read, Seek};
15336
15337        use common::{url::Params, ToParts};
15338        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15339
15340        let mut dd = common::DefaultDelegate;
15341        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15342        dlg.begin(common::MethodInfo {
15343            id: "eventarc.projects.locations.messageBuses.listEnrollments",
15344            http_method: hyper::Method::GET,
15345        });
15346
15347        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
15348            if self._additional_params.contains_key(field) {
15349                dlg.finished(false);
15350                return Err(common::Error::FieldClash(field));
15351            }
15352        }
15353
15354        let mut params = Params::with_capacity(5 + self._additional_params.len());
15355        params.push("parent", self._parent);
15356        if let Some(value) = self._page_token.as_ref() {
15357            params.push("pageToken", value);
15358        }
15359        if let Some(value) = self._page_size.as_ref() {
15360            params.push("pageSize", value.to_string());
15361        }
15362
15363        params.extend(self._additional_params.iter());
15364
15365        params.push("alt", "json");
15366        let mut url = self.hub._base_url.clone() + "v1/{+parent}:listEnrollments";
15367        if self._scopes.is_empty() {
15368            self._scopes
15369                .insert(Scope::CloudPlatform.as_ref().to_string());
15370        }
15371
15372        #[allow(clippy::single_element_loop)]
15373        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15374            url = params.uri_replacement(url, param_name, find_this, true);
15375        }
15376        {
15377            let to_remove = ["parent"];
15378            params.remove_params(&to_remove);
15379        }
15380
15381        let url = params.parse_with_url(&url);
15382
15383        loop {
15384            let token = match self
15385                .hub
15386                .auth
15387                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15388                .await
15389            {
15390                Ok(token) => token,
15391                Err(e) => match dlg.token(e) {
15392                    Ok(token) => token,
15393                    Err(e) => {
15394                        dlg.finished(false);
15395                        return Err(common::Error::MissingToken(e));
15396                    }
15397                },
15398            };
15399            let mut req_result = {
15400                let client = &self.hub.client;
15401                dlg.pre_request();
15402                let mut req_builder = hyper::Request::builder()
15403                    .method(hyper::Method::GET)
15404                    .uri(url.as_str())
15405                    .header(USER_AGENT, self.hub._user_agent.clone());
15406
15407                if let Some(token) = token.as_ref() {
15408                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15409                }
15410
15411                let request = req_builder
15412                    .header(CONTENT_LENGTH, 0_u64)
15413                    .body(common::to_body::<String>(None));
15414
15415                client.request(request.unwrap()).await
15416            };
15417
15418            match req_result {
15419                Err(err) => {
15420                    if let common::Retry::After(d) = dlg.http_error(&err) {
15421                        sleep(d).await;
15422                        continue;
15423                    }
15424                    dlg.finished(false);
15425                    return Err(common::Error::HttpError(err));
15426                }
15427                Ok(res) => {
15428                    let (mut parts, body) = res.into_parts();
15429                    let mut body = common::Body::new(body);
15430                    if !parts.status.is_success() {
15431                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15432                        let error = serde_json::from_str(&common::to_string(&bytes));
15433                        let response = common::to_response(parts, bytes.into());
15434
15435                        if let common::Retry::After(d) =
15436                            dlg.http_failure(&response, error.as_ref().ok())
15437                        {
15438                            sleep(d).await;
15439                            continue;
15440                        }
15441
15442                        dlg.finished(false);
15443
15444                        return Err(match error {
15445                            Ok(value) => common::Error::BadRequest(value),
15446                            _ => common::Error::Failure(response),
15447                        });
15448                    }
15449                    let response = {
15450                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15451                        let encoded = common::to_string(&bytes);
15452                        match serde_json::from_str(&encoded) {
15453                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15454                            Err(error) => {
15455                                dlg.response_json_decode_error(&encoded, &error);
15456                                return Err(common::Error::JsonDecodeError(
15457                                    encoded.to_string(),
15458                                    error,
15459                                ));
15460                            }
15461                        }
15462                    };
15463
15464                    dlg.finished(true);
15465                    return Ok(response);
15466                }
15467            }
15468        }
15469    }
15470
15471    /// Required. The parent message bus to list enrollments on.
15472    ///
15473    /// Sets the *parent* path property to the given value.
15474    ///
15475    /// Even though the property as already been set when instantiating this call,
15476    /// we provide this method for API completeness.
15477    pub fn parent(mut self, new_value: &str) -> ProjectLocationMessageBusListEnrollmentCall<'a, C> {
15478        self._parent = new_value.to_string();
15479        self
15480    }
15481    /// Optional. The page token; provide the value from the `next_page_token` field in a previous call to retrieve the subsequent page. When paginating, all other parameters provided must match the previous call that provided the page token.
15482    ///
15483    /// Sets the *page token* query property to the given value.
15484    pub fn page_token(
15485        mut self,
15486        new_value: &str,
15487    ) -> ProjectLocationMessageBusListEnrollmentCall<'a, C> {
15488        self._page_token = Some(new_value.to_string());
15489        self
15490    }
15491    /// Optional. The maximum number of results to return on each page. Note: The service may send fewer.
15492    ///
15493    /// Sets the *page size* query property to the given value.
15494    pub fn page_size(
15495        mut self,
15496        new_value: i32,
15497    ) -> ProjectLocationMessageBusListEnrollmentCall<'a, C> {
15498        self._page_size = Some(new_value);
15499        self
15500    }
15501    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15502    /// while executing the actual API request.
15503    ///
15504    /// ````text
15505    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15506    /// ````
15507    ///
15508    /// Sets the *delegate* property to the given value.
15509    pub fn delegate(
15510        mut self,
15511        new_value: &'a mut dyn common::Delegate,
15512    ) -> ProjectLocationMessageBusListEnrollmentCall<'a, C> {
15513        self._delegate = Some(new_value);
15514        self
15515    }
15516
15517    /// Set any additional parameter of the query string used in the request.
15518    /// It should be used to set parameters which are not yet available through their own
15519    /// setters.
15520    ///
15521    /// Please note that this method must not be used to set any of the known parameters
15522    /// which have their own setter method. If done anyway, the request will fail.
15523    ///
15524    /// # Additional Parameters
15525    ///
15526    /// * *$.xgafv* (query-string) - V1 error format.
15527    /// * *access_token* (query-string) - OAuth access token.
15528    /// * *alt* (query-string) - Data format for response.
15529    /// * *callback* (query-string) - JSONP
15530    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15531    /// * *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.
15532    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15533    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15534    /// * *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.
15535    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15536    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15537    pub fn param<T>(
15538        mut self,
15539        name: T,
15540        value: T,
15541    ) -> ProjectLocationMessageBusListEnrollmentCall<'a, C>
15542    where
15543        T: AsRef<str>,
15544    {
15545        self._additional_params
15546            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15547        self
15548    }
15549
15550    /// Identifies the authorization scope for the method you are building.
15551    ///
15552    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15553    /// [`Scope::CloudPlatform`].
15554    ///
15555    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15556    /// tokens for more than one scope.
15557    ///
15558    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15559    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15560    /// sufficient, a read-write scope will do as well.
15561    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusListEnrollmentCall<'a, C>
15562    where
15563        St: AsRef<str>,
15564    {
15565        self._scopes.insert(String::from(scope.as_ref()));
15566        self
15567    }
15568    /// Identifies the authorization scope(s) for the method you are building.
15569    ///
15570    /// See [`Self::add_scope()`] for details.
15571    pub fn add_scopes<I, St>(
15572        mut self,
15573        scopes: I,
15574    ) -> ProjectLocationMessageBusListEnrollmentCall<'a, C>
15575    where
15576        I: IntoIterator<Item = St>,
15577        St: AsRef<str>,
15578    {
15579        self._scopes
15580            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15581        self
15582    }
15583
15584    /// Removes all scopes, and no default scope will be used either.
15585    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15586    /// for details).
15587    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusListEnrollmentCall<'a, C> {
15588        self._scopes.clear();
15589        self
15590    }
15591}
15592
15593/// Update a single message bus.
15594///
15595/// A builder for the *locations.messageBuses.patch* method supported by a *project* resource.
15596/// It is not used directly, but through a [`ProjectMethods`] instance.
15597///
15598/// # Example
15599///
15600/// Instantiate a resource method builder
15601///
15602/// ```test_harness,no_run
15603/// # extern crate hyper;
15604/// # extern crate hyper_rustls;
15605/// # extern crate google_eventarc1 as eventarc1;
15606/// use eventarc1::api::MessageBus;
15607/// # async fn dox() {
15608/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15609///
15610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15611/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15612/// #     .with_native_roots()
15613/// #     .unwrap()
15614/// #     .https_only()
15615/// #     .enable_http2()
15616/// #     .build();
15617///
15618/// # let executor = hyper_util::rt::TokioExecutor::new();
15619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15620/// #     secret,
15621/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15622/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15623/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15624/// #     ),
15625/// # ).build().await.unwrap();
15626///
15627/// # let client = hyper_util::client::legacy::Client::builder(
15628/// #     hyper_util::rt::TokioExecutor::new()
15629/// # )
15630/// # .build(
15631/// #     hyper_rustls::HttpsConnectorBuilder::new()
15632/// #         .with_native_roots()
15633/// #         .unwrap()
15634/// #         .https_or_http()
15635/// #         .enable_http2()
15636/// #         .build()
15637/// # );
15638/// # let mut hub = Eventarc::new(client, auth);
15639/// // As the method needs a request, you would usually fill it with the desired information
15640/// // into the respective structure. Some of the parts shown here might not be applicable !
15641/// // Values shown here are possibly random and not representative !
15642/// let mut req = MessageBus::default();
15643///
15644/// // You can configure optional parameters by calling the respective setters at will, and
15645/// // execute the final call using `doit()`.
15646/// // Values shown here are possibly random and not representative !
15647/// let result = hub.projects().locations_message_buses_patch(req, "name")
15648///              .validate_only(true)
15649///              .update_mask(FieldMask::new::<&str>(&[]))
15650///              .allow_missing(true)
15651///              .doit().await;
15652/// # }
15653/// ```
15654pub struct ProjectLocationMessageBusPatchCall<'a, C>
15655where
15656    C: 'a,
15657{
15658    hub: &'a Eventarc<C>,
15659    _request: MessageBus,
15660    _name: String,
15661    _validate_only: Option<bool>,
15662    _update_mask: Option<common::FieldMask>,
15663    _allow_missing: Option<bool>,
15664    _delegate: Option<&'a mut dyn common::Delegate>,
15665    _additional_params: HashMap<String, String>,
15666    _scopes: BTreeSet<String>,
15667}
15668
15669impl<'a, C> common::CallBuilder for ProjectLocationMessageBusPatchCall<'a, C> {}
15670
15671impl<'a, C> ProjectLocationMessageBusPatchCall<'a, C>
15672where
15673    C: common::Connector,
15674{
15675    /// Perform the operation you have build so far.
15676    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
15677        use std::borrow::Cow;
15678        use std::io::{Read, Seek};
15679
15680        use common::{url::Params, ToParts};
15681        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15682
15683        let mut dd = common::DefaultDelegate;
15684        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15685        dlg.begin(common::MethodInfo {
15686            id: "eventarc.projects.locations.messageBuses.patch",
15687            http_method: hyper::Method::PATCH,
15688        });
15689
15690        for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
15691            if self._additional_params.contains_key(field) {
15692                dlg.finished(false);
15693                return Err(common::Error::FieldClash(field));
15694            }
15695        }
15696
15697        let mut params = Params::with_capacity(7 + self._additional_params.len());
15698        params.push("name", self._name);
15699        if let Some(value) = self._validate_only.as_ref() {
15700            params.push("validateOnly", value.to_string());
15701        }
15702        if let Some(value) = self._update_mask.as_ref() {
15703            params.push("updateMask", value.to_string());
15704        }
15705        if let Some(value) = self._allow_missing.as_ref() {
15706            params.push("allowMissing", value.to_string());
15707        }
15708
15709        params.extend(self._additional_params.iter());
15710
15711        params.push("alt", "json");
15712        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15713        if self._scopes.is_empty() {
15714            self._scopes
15715                .insert(Scope::CloudPlatform.as_ref().to_string());
15716        }
15717
15718        #[allow(clippy::single_element_loop)]
15719        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15720            url = params.uri_replacement(url, param_name, find_this, true);
15721        }
15722        {
15723            let to_remove = ["name"];
15724            params.remove_params(&to_remove);
15725        }
15726
15727        let url = params.parse_with_url(&url);
15728
15729        let mut json_mime_type = mime::APPLICATION_JSON;
15730        let mut request_value_reader = {
15731            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15732            common::remove_json_null_values(&mut value);
15733            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15734            serde_json::to_writer(&mut dst, &value).unwrap();
15735            dst
15736        };
15737        let request_size = request_value_reader
15738            .seek(std::io::SeekFrom::End(0))
15739            .unwrap();
15740        request_value_reader
15741            .seek(std::io::SeekFrom::Start(0))
15742            .unwrap();
15743
15744        loop {
15745            let token = match self
15746                .hub
15747                .auth
15748                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15749                .await
15750            {
15751                Ok(token) => token,
15752                Err(e) => match dlg.token(e) {
15753                    Ok(token) => token,
15754                    Err(e) => {
15755                        dlg.finished(false);
15756                        return Err(common::Error::MissingToken(e));
15757                    }
15758                },
15759            };
15760            request_value_reader
15761                .seek(std::io::SeekFrom::Start(0))
15762                .unwrap();
15763            let mut req_result = {
15764                let client = &self.hub.client;
15765                dlg.pre_request();
15766                let mut req_builder = hyper::Request::builder()
15767                    .method(hyper::Method::PATCH)
15768                    .uri(url.as_str())
15769                    .header(USER_AGENT, self.hub._user_agent.clone());
15770
15771                if let Some(token) = token.as_ref() {
15772                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15773                }
15774
15775                let request = req_builder
15776                    .header(CONTENT_TYPE, json_mime_type.to_string())
15777                    .header(CONTENT_LENGTH, request_size as u64)
15778                    .body(common::to_body(
15779                        request_value_reader.get_ref().clone().into(),
15780                    ));
15781
15782                client.request(request.unwrap()).await
15783            };
15784
15785            match req_result {
15786                Err(err) => {
15787                    if let common::Retry::After(d) = dlg.http_error(&err) {
15788                        sleep(d).await;
15789                        continue;
15790                    }
15791                    dlg.finished(false);
15792                    return Err(common::Error::HttpError(err));
15793                }
15794                Ok(res) => {
15795                    let (mut parts, body) = res.into_parts();
15796                    let mut body = common::Body::new(body);
15797                    if !parts.status.is_success() {
15798                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15799                        let error = serde_json::from_str(&common::to_string(&bytes));
15800                        let response = common::to_response(parts, bytes.into());
15801
15802                        if let common::Retry::After(d) =
15803                            dlg.http_failure(&response, error.as_ref().ok())
15804                        {
15805                            sleep(d).await;
15806                            continue;
15807                        }
15808
15809                        dlg.finished(false);
15810
15811                        return Err(match error {
15812                            Ok(value) => common::Error::BadRequest(value),
15813                            _ => common::Error::Failure(response),
15814                        });
15815                    }
15816                    let response = {
15817                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15818                        let encoded = common::to_string(&bytes);
15819                        match serde_json::from_str(&encoded) {
15820                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15821                            Err(error) => {
15822                                dlg.response_json_decode_error(&encoded, &error);
15823                                return Err(common::Error::JsonDecodeError(
15824                                    encoded.to_string(),
15825                                    error,
15826                                ));
15827                            }
15828                        }
15829                    };
15830
15831                    dlg.finished(true);
15832                    return Ok(response);
15833                }
15834            }
15835        }
15836    }
15837
15838    ///
15839    /// Sets the *request* property to the given value.
15840    ///
15841    /// Even though the property as already been set when instantiating this call,
15842    /// we provide this method for API completeness.
15843    pub fn request(mut self, new_value: MessageBus) -> ProjectLocationMessageBusPatchCall<'a, C> {
15844        self._request = new_value;
15845        self
15846    }
15847    /// Identifier. Resource name of the form projects/{project}/locations/{location}/messageBuses/{message_bus}
15848    ///
15849    /// Sets the *name* path property to the given value.
15850    ///
15851    /// Even though the property as already been set when instantiating this call,
15852    /// we provide this method for API completeness.
15853    pub fn name(mut self, new_value: &str) -> ProjectLocationMessageBusPatchCall<'a, C> {
15854        self._name = new_value.to_string();
15855        self
15856    }
15857    /// Optional. If set, validate the request and preview the review, but do not post it.
15858    ///
15859    /// Sets the *validate only* query property to the given value.
15860    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationMessageBusPatchCall<'a, C> {
15861        self._validate_only = Some(new_value);
15862        self
15863    }
15864    /// Optional. The fields to be updated; only fields explicitly provided are updated. If no field mask is provided, all provided fields in the request are updated. To update all fields, provide a field mask of "*".
15865    ///
15866    /// Sets the *update mask* query property to the given value.
15867    pub fn update_mask(
15868        mut self,
15869        new_value: common::FieldMask,
15870    ) -> ProjectLocationMessageBusPatchCall<'a, C> {
15871        self._update_mask = Some(new_value);
15872        self
15873    }
15874    /// Optional. If set to true, and the MessageBus is not found, a new MessageBus will be created. In this situation, `update_mask` is ignored.
15875    ///
15876    /// Sets the *allow missing* query property to the given value.
15877    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationMessageBusPatchCall<'a, C> {
15878        self._allow_missing = Some(new_value);
15879        self
15880    }
15881    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15882    /// while executing the actual API request.
15883    ///
15884    /// ````text
15885    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15886    /// ````
15887    ///
15888    /// Sets the *delegate* property to the given value.
15889    pub fn delegate(
15890        mut self,
15891        new_value: &'a mut dyn common::Delegate,
15892    ) -> ProjectLocationMessageBusPatchCall<'a, C> {
15893        self._delegate = Some(new_value);
15894        self
15895    }
15896
15897    /// Set any additional parameter of the query string used in the request.
15898    /// It should be used to set parameters which are not yet available through their own
15899    /// setters.
15900    ///
15901    /// Please note that this method must not be used to set any of the known parameters
15902    /// which have their own setter method. If done anyway, the request will fail.
15903    ///
15904    /// # Additional Parameters
15905    ///
15906    /// * *$.xgafv* (query-string) - V1 error format.
15907    /// * *access_token* (query-string) - OAuth access token.
15908    /// * *alt* (query-string) - Data format for response.
15909    /// * *callback* (query-string) - JSONP
15910    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15911    /// * *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.
15912    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15913    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15914    /// * *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.
15915    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15916    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15917    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMessageBusPatchCall<'a, C>
15918    where
15919        T: AsRef<str>,
15920    {
15921        self._additional_params
15922            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15923        self
15924    }
15925
15926    /// Identifies the authorization scope for the method you are building.
15927    ///
15928    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15929    /// [`Scope::CloudPlatform`].
15930    ///
15931    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15932    /// tokens for more than one scope.
15933    ///
15934    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15935    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15936    /// sufficient, a read-write scope will do as well.
15937    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusPatchCall<'a, C>
15938    where
15939        St: AsRef<str>,
15940    {
15941        self._scopes.insert(String::from(scope.as_ref()));
15942        self
15943    }
15944    /// Identifies the authorization scope(s) for the method you are building.
15945    ///
15946    /// See [`Self::add_scope()`] for details.
15947    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMessageBusPatchCall<'a, C>
15948    where
15949        I: IntoIterator<Item = St>,
15950        St: AsRef<str>,
15951    {
15952        self._scopes
15953            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15954        self
15955    }
15956
15957    /// Removes all scopes, and no default scope will be used either.
15958    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15959    /// for details).
15960    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusPatchCall<'a, C> {
15961        self._scopes.clear();
15962        self
15963    }
15964}
15965
15966/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
15967///
15968/// A builder for the *locations.messageBuses.setIamPolicy* method supported by a *project* resource.
15969/// It is not used directly, but through a [`ProjectMethods`] instance.
15970///
15971/// # Example
15972///
15973/// Instantiate a resource method builder
15974///
15975/// ```test_harness,no_run
15976/// # extern crate hyper;
15977/// # extern crate hyper_rustls;
15978/// # extern crate google_eventarc1 as eventarc1;
15979/// use eventarc1::api::SetIamPolicyRequest;
15980/// # async fn dox() {
15981/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15982///
15983/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15984/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15985/// #     .with_native_roots()
15986/// #     .unwrap()
15987/// #     .https_only()
15988/// #     .enable_http2()
15989/// #     .build();
15990///
15991/// # let executor = hyper_util::rt::TokioExecutor::new();
15992/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15993/// #     secret,
15994/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15995/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15996/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15997/// #     ),
15998/// # ).build().await.unwrap();
15999///
16000/// # let client = hyper_util::client::legacy::Client::builder(
16001/// #     hyper_util::rt::TokioExecutor::new()
16002/// # )
16003/// # .build(
16004/// #     hyper_rustls::HttpsConnectorBuilder::new()
16005/// #         .with_native_roots()
16006/// #         .unwrap()
16007/// #         .https_or_http()
16008/// #         .enable_http2()
16009/// #         .build()
16010/// # );
16011/// # let mut hub = Eventarc::new(client, auth);
16012/// // As the method needs a request, you would usually fill it with the desired information
16013/// // into the respective structure. Some of the parts shown here might not be applicable !
16014/// // Values shown here are possibly random and not representative !
16015/// let mut req = SetIamPolicyRequest::default();
16016///
16017/// // You can configure optional parameters by calling the respective setters at will, and
16018/// // execute the final call using `doit()`.
16019/// // Values shown here are possibly random and not representative !
16020/// let result = hub.projects().locations_message_buses_set_iam_policy(req, "resource")
16021///              .doit().await;
16022/// # }
16023/// ```
16024pub struct ProjectLocationMessageBusSetIamPolicyCall<'a, C>
16025where
16026    C: 'a,
16027{
16028    hub: &'a Eventarc<C>,
16029    _request: SetIamPolicyRequest,
16030    _resource: String,
16031    _delegate: Option<&'a mut dyn common::Delegate>,
16032    _additional_params: HashMap<String, String>,
16033    _scopes: BTreeSet<String>,
16034}
16035
16036impl<'a, C> common::CallBuilder for ProjectLocationMessageBusSetIamPolicyCall<'a, C> {}
16037
16038impl<'a, C> ProjectLocationMessageBusSetIamPolicyCall<'a, C>
16039where
16040    C: common::Connector,
16041{
16042    /// Perform the operation you have build so far.
16043    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16044        use std::borrow::Cow;
16045        use std::io::{Read, Seek};
16046
16047        use common::{url::Params, ToParts};
16048        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16049
16050        let mut dd = common::DefaultDelegate;
16051        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16052        dlg.begin(common::MethodInfo {
16053            id: "eventarc.projects.locations.messageBuses.setIamPolicy",
16054            http_method: hyper::Method::POST,
16055        });
16056
16057        for &field in ["alt", "resource"].iter() {
16058            if self._additional_params.contains_key(field) {
16059                dlg.finished(false);
16060                return Err(common::Error::FieldClash(field));
16061            }
16062        }
16063
16064        let mut params = Params::with_capacity(4 + self._additional_params.len());
16065        params.push("resource", self._resource);
16066
16067        params.extend(self._additional_params.iter());
16068
16069        params.push("alt", "json");
16070        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
16071        if self._scopes.is_empty() {
16072            self._scopes
16073                .insert(Scope::CloudPlatform.as_ref().to_string());
16074        }
16075
16076        #[allow(clippy::single_element_loop)]
16077        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16078            url = params.uri_replacement(url, param_name, find_this, true);
16079        }
16080        {
16081            let to_remove = ["resource"];
16082            params.remove_params(&to_remove);
16083        }
16084
16085        let url = params.parse_with_url(&url);
16086
16087        let mut json_mime_type = mime::APPLICATION_JSON;
16088        let mut request_value_reader = {
16089            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16090            common::remove_json_null_values(&mut value);
16091            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16092            serde_json::to_writer(&mut dst, &value).unwrap();
16093            dst
16094        };
16095        let request_size = request_value_reader
16096            .seek(std::io::SeekFrom::End(0))
16097            .unwrap();
16098        request_value_reader
16099            .seek(std::io::SeekFrom::Start(0))
16100            .unwrap();
16101
16102        loop {
16103            let token = match self
16104                .hub
16105                .auth
16106                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16107                .await
16108            {
16109                Ok(token) => token,
16110                Err(e) => match dlg.token(e) {
16111                    Ok(token) => token,
16112                    Err(e) => {
16113                        dlg.finished(false);
16114                        return Err(common::Error::MissingToken(e));
16115                    }
16116                },
16117            };
16118            request_value_reader
16119                .seek(std::io::SeekFrom::Start(0))
16120                .unwrap();
16121            let mut req_result = {
16122                let client = &self.hub.client;
16123                dlg.pre_request();
16124                let mut req_builder = hyper::Request::builder()
16125                    .method(hyper::Method::POST)
16126                    .uri(url.as_str())
16127                    .header(USER_AGENT, self.hub._user_agent.clone());
16128
16129                if let Some(token) = token.as_ref() {
16130                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16131                }
16132
16133                let request = req_builder
16134                    .header(CONTENT_TYPE, json_mime_type.to_string())
16135                    .header(CONTENT_LENGTH, request_size as u64)
16136                    .body(common::to_body(
16137                        request_value_reader.get_ref().clone().into(),
16138                    ));
16139
16140                client.request(request.unwrap()).await
16141            };
16142
16143            match req_result {
16144                Err(err) => {
16145                    if let common::Retry::After(d) = dlg.http_error(&err) {
16146                        sleep(d).await;
16147                        continue;
16148                    }
16149                    dlg.finished(false);
16150                    return Err(common::Error::HttpError(err));
16151                }
16152                Ok(res) => {
16153                    let (mut parts, body) = res.into_parts();
16154                    let mut body = common::Body::new(body);
16155                    if !parts.status.is_success() {
16156                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16157                        let error = serde_json::from_str(&common::to_string(&bytes));
16158                        let response = common::to_response(parts, bytes.into());
16159
16160                        if let common::Retry::After(d) =
16161                            dlg.http_failure(&response, error.as_ref().ok())
16162                        {
16163                            sleep(d).await;
16164                            continue;
16165                        }
16166
16167                        dlg.finished(false);
16168
16169                        return Err(match error {
16170                            Ok(value) => common::Error::BadRequest(value),
16171                            _ => common::Error::Failure(response),
16172                        });
16173                    }
16174                    let response = {
16175                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16176                        let encoded = common::to_string(&bytes);
16177                        match serde_json::from_str(&encoded) {
16178                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16179                            Err(error) => {
16180                                dlg.response_json_decode_error(&encoded, &error);
16181                                return Err(common::Error::JsonDecodeError(
16182                                    encoded.to_string(),
16183                                    error,
16184                                ));
16185                            }
16186                        }
16187                    };
16188
16189                    dlg.finished(true);
16190                    return Ok(response);
16191                }
16192            }
16193        }
16194    }
16195
16196    ///
16197    /// Sets the *request* property to the given value.
16198    ///
16199    /// Even though the property as already been set when instantiating this call,
16200    /// we provide this method for API completeness.
16201    pub fn request(
16202        mut self,
16203        new_value: SetIamPolicyRequest,
16204    ) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C> {
16205        self._request = new_value;
16206        self
16207    }
16208    /// 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.
16209    ///
16210    /// Sets the *resource* path property to the given value.
16211    ///
16212    /// Even though the property as already been set when instantiating this call,
16213    /// we provide this method for API completeness.
16214    pub fn resource(mut self, new_value: &str) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C> {
16215        self._resource = new_value.to_string();
16216        self
16217    }
16218    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16219    /// while executing the actual API request.
16220    ///
16221    /// ````text
16222    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16223    /// ````
16224    ///
16225    /// Sets the *delegate* property to the given value.
16226    pub fn delegate(
16227        mut self,
16228        new_value: &'a mut dyn common::Delegate,
16229    ) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C> {
16230        self._delegate = Some(new_value);
16231        self
16232    }
16233
16234    /// Set any additional parameter of the query string used in the request.
16235    /// It should be used to set parameters which are not yet available through their own
16236    /// setters.
16237    ///
16238    /// Please note that this method must not be used to set any of the known parameters
16239    /// which have their own setter method. If done anyway, the request will fail.
16240    ///
16241    /// # Additional Parameters
16242    ///
16243    /// * *$.xgafv* (query-string) - V1 error format.
16244    /// * *access_token* (query-string) - OAuth access token.
16245    /// * *alt* (query-string) - Data format for response.
16246    /// * *callback* (query-string) - JSONP
16247    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16248    /// * *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.
16249    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16250    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16251    /// * *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.
16252    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16253    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16254    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C>
16255    where
16256        T: AsRef<str>,
16257    {
16258        self._additional_params
16259            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16260        self
16261    }
16262
16263    /// Identifies the authorization scope for the method you are building.
16264    ///
16265    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16266    /// [`Scope::CloudPlatform`].
16267    ///
16268    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16269    /// tokens for more than one scope.
16270    ///
16271    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16272    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16273    /// sufficient, a read-write scope will do as well.
16274    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C>
16275    where
16276        St: AsRef<str>,
16277    {
16278        self._scopes.insert(String::from(scope.as_ref()));
16279        self
16280    }
16281    /// Identifies the authorization scope(s) for the method you are building.
16282    ///
16283    /// See [`Self::add_scope()`] for details.
16284    pub fn add_scopes<I, St>(
16285        mut self,
16286        scopes: I,
16287    ) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C>
16288    where
16289        I: IntoIterator<Item = St>,
16290        St: AsRef<str>,
16291    {
16292        self._scopes
16293            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16294        self
16295    }
16296
16297    /// Removes all scopes, and no default scope will be used either.
16298    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16299    /// for details).
16300    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusSetIamPolicyCall<'a, C> {
16301        self._scopes.clear();
16302        self
16303    }
16304}
16305
16306/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
16307///
16308/// A builder for the *locations.messageBuses.testIamPermissions* method supported by a *project* resource.
16309/// It is not used directly, but through a [`ProjectMethods`] instance.
16310///
16311/// # Example
16312///
16313/// Instantiate a resource method builder
16314///
16315/// ```test_harness,no_run
16316/// # extern crate hyper;
16317/// # extern crate hyper_rustls;
16318/// # extern crate google_eventarc1 as eventarc1;
16319/// use eventarc1::api::TestIamPermissionsRequest;
16320/// # async fn dox() {
16321/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16322///
16323/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16324/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16325/// #     .with_native_roots()
16326/// #     .unwrap()
16327/// #     .https_only()
16328/// #     .enable_http2()
16329/// #     .build();
16330///
16331/// # let executor = hyper_util::rt::TokioExecutor::new();
16332/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16333/// #     secret,
16334/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16335/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16336/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16337/// #     ),
16338/// # ).build().await.unwrap();
16339///
16340/// # let client = hyper_util::client::legacy::Client::builder(
16341/// #     hyper_util::rt::TokioExecutor::new()
16342/// # )
16343/// # .build(
16344/// #     hyper_rustls::HttpsConnectorBuilder::new()
16345/// #         .with_native_roots()
16346/// #         .unwrap()
16347/// #         .https_or_http()
16348/// #         .enable_http2()
16349/// #         .build()
16350/// # );
16351/// # let mut hub = Eventarc::new(client, auth);
16352/// // As the method needs a request, you would usually fill it with the desired information
16353/// // into the respective structure. Some of the parts shown here might not be applicable !
16354/// // Values shown here are possibly random and not representative !
16355/// let mut req = TestIamPermissionsRequest::default();
16356///
16357/// // You can configure optional parameters by calling the respective setters at will, and
16358/// // execute the final call using `doit()`.
16359/// // Values shown here are possibly random and not representative !
16360/// let result = hub.projects().locations_message_buses_test_iam_permissions(req, "resource")
16361///              .doit().await;
16362/// # }
16363/// ```
16364pub struct ProjectLocationMessageBusTestIamPermissionCall<'a, C>
16365where
16366    C: 'a,
16367{
16368    hub: &'a Eventarc<C>,
16369    _request: TestIamPermissionsRequest,
16370    _resource: String,
16371    _delegate: Option<&'a mut dyn common::Delegate>,
16372    _additional_params: HashMap<String, String>,
16373    _scopes: BTreeSet<String>,
16374}
16375
16376impl<'a, C> common::CallBuilder for ProjectLocationMessageBusTestIamPermissionCall<'a, C> {}
16377
16378impl<'a, C> ProjectLocationMessageBusTestIamPermissionCall<'a, C>
16379where
16380    C: common::Connector,
16381{
16382    /// Perform the operation you have build so far.
16383    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
16384        use std::borrow::Cow;
16385        use std::io::{Read, Seek};
16386
16387        use common::{url::Params, ToParts};
16388        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16389
16390        let mut dd = common::DefaultDelegate;
16391        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16392        dlg.begin(common::MethodInfo {
16393            id: "eventarc.projects.locations.messageBuses.testIamPermissions",
16394            http_method: hyper::Method::POST,
16395        });
16396
16397        for &field in ["alt", "resource"].iter() {
16398            if self._additional_params.contains_key(field) {
16399                dlg.finished(false);
16400                return Err(common::Error::FieldClash(field));
16401            }
16402        }
16403
16404        let mut params = Params::with_capacity(4 + self._additional_params.len());
16405        params.push("resource", self._resource);
16406
16407        params.extend(self._additional_params.iter());
16408
16409        params.push("alt", "json");
16410        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
16411        if self._scopes.is_empty() {
16412            self._scopes
16413                .insert(Scope::CloudPlatform.as_ref().to_string());
16414        }
16415
16416        #[allow(clippy::single_element_loop)]
16417        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16418            url = params.uri_replacement(url, param_name, find_this, true);
16419        }
16420        {
16421            let to_remove = ["resource"];
16422            params.remove_params(&to_remove);
16423        }
16424
16425        let url = params.parse_with_url(&url);
16426
16427        let mut json_mime_type = mime::APPLICATION_JSON;
16428        let mut request_value_reader = {
16429            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16430            common::remove_json_null_values(&mut value);
16431            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16432            serde_json::to_writer(&mut dst, &value).unwrap();
16433            dst
16434        };
16435        let request_size = request_value_reader
16436            .seek(std::io::SeekFrom::End(0))
16437            .unwrap();
16438        request_value_reader
16439            .seek(std::io::SeekFrom::Start(0))
16440            .unwrap();
16441
16442        loop {
16443            let token = match self
16444                .hub
16445                .auth
16446                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16447                .await
16448            {
16449                Ok(token) => token,
16450                Err(e) => match dlg.token(e) {
16451                    Ok(token) => token,
16452                    Err(e) => {
16453                        dlg.finished(false);
16454                        return Err(common::Error::MissingToken(e));
16455                    }
16456                },
16457            };
16458            request_value_reader
16459                .seek(std::io::SeekFrom::Start(0))
16460                .unwrap();
16461            let mut req_result = {
16462                let client = &self.hub.client;
16463                dlg.pre_request();
16464                let mut req_builder = hyper::Request::builder()
16465                    .method(hyper::Method::POST)
16466                    .uri(url.as_str())
16467                    .header(USER_AGENT, self.hub._user_agent.clone());
16468
16469                if let Some(token) = token.as_ref() {
16470                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16471                }
16472
16473                let request = req_builder
16474                    .header(CONTENT_TYPE, json_mime_type.to_string())
16475                    .header(CONTENT_LENGTH, request_size as u64)
16476                    .body(common::to_body(
16477                        request_value_reader.get_ref().clone().into(),
16478                    ));
16479
16480                client.request(request.unwrap()).await
16481            };
16482
16483            match req_result {
16484                Err(err) => {
16485                    if let common::Retry::After(d) = dlg.http_error(&err) {
16486                        sleep(d).await;
16487                        continue;
16488                    }
16489                    dlg.finished(false);
16490                    return Err(common::Error::HttpError(err));
16491                }
16492                Ok(res) => {
16493                    let (mut parts, body) = res.into_parts();
16494                    let mut body = common::Body::new(body);
16495                    if !parts.status.is_success() {
16496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16497                        let error = serde_json::from_str(&common::to_string(&bytes));
16498                        let response = common::to_response(parts, bytes.into());
16499
16500                        if let common::Retry::After(d) =
16501                            dlg.http_failure(&response, error.as_ref().ok())
16502                        {
16503                            sleep(d).await;
16504                            continue;
16505                        }
16506
16507                        dlg.finished(false);
16508
16509                        return Err(match error {
16510                            Ok(value) => common::Error::BadRequest(value),
16511                            _ => common::Error::Failure(response),
16512                        });
16513                    }
16514                    let response = {
16515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16516                        let encoded = common::to_string(&bytes);
16517                        match serde_json::from_str(&encoded) {
16518                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16519                            Err(error) => {
16520                                dlg.response_json_decode_error(&encoded, &error);
16521                                return Err(common::Error::JsonDecodeError(
16522                                    encoded.to_string(),
16523                                    error,
16524                                ));
16525                            }
16526                        }
16527                    };
16528
16529                    dlg.finished(true);
16530                    return Ok(response);
16531                }
16532            }
16533        }
16534    }
16535
16536    ///
16537    /// Sets the *request* property to the given value.
16538    ///
16539    /// Even though the property as already been set when instantiating this call,
16540    /// we provide this method for API completeness.
16541    pub fn request(
16542        mut self,
16543        new_value: TestIamPermissionsRequest,
16544    ) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C> {
16545        self._request = new_value;
16546        self
16547    }
16548    /// 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.
16549    ///
16550    /// Sets the *resource* path property to the given value.
16551    ///
16552    /// Even though the property as already been set when instantiating this call,
16553    /// we provide this method for API completeness.
16554    pub fn resource(
16555        mut self,
16556        new_value: &str,
16557    ) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C> {
16558        self._resource = new_value.to_string();
16559        self
16560    }
16561    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16562    /// while executing the actual API request.
16563    ///
16564    /// ````text
16565    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16566    /// ````
16567    ///
16568    /// Sets the *delegate* property to the given value.
16569    pub fn delegate(
16570        mut self,
16571        new_value: &'a mut dyn common::Delegate,
16572    ) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C> {
16573        self._delegate = Some(new_value);
16574        self
16575    }
16576
16577    /// Set any additional parameter of the query string used in the request.
16578    /// It should be used to set parameters which are not yet available through their own
16579    /// setters.
16580    ///
16581    /// Please note that this method must not be used to set any of the known parameters
16582    /// which have their own setter method. If done anyway, the request will fail.
16583    ///
16584    /// # Additional Parameters
16585    ///
16586    /// * *$.xgafv* (query-string) - V1 error format.
16587    /// * *access_token* (query-string) - OAuth access token.
16588    /// * *alt* (query-string) - Data format for response.
16589    /// * *callback* (query-string) - JSONP
16590    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16591    /// * *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.
16592    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16593    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16594    /// * *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.
16595    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16596    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16597    pub fn param<T>(
16598        mut self,
16599        name: T,
16600        value: T,
16601    ) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C>
16602    where
16603        T: AsRef<str>,
16604    {
16605        self._additional_params
16606            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16607        self
16608    }
16609
16610    /// Identifies the authorization scope for the method you are building.
16611    ///
16612    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16613    /// [`Scope::CloudPlatform`].
16614    ///
16615    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16616    /// tokens for more than one scope.
16617    ///
16618    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16619    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16620    /// sufficient, a read-write scope will do as well.
16621    pub fn add_scope<St>(
16622        mut self,
16623        scope: St,
16624    ) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C>
16625    where
16626        St: AsRef<str>,
16627    {
16628        self._scopes.insert(String::from(scope.as_ref()));
16629        self
16630    }
16631    /// Identifies the authorization scope(s) for the method you are building.
16632    ///
16633    /// See [`Self::add_scope()`] for details.
16634    pub fn add_scopes<I, St>(
16635        mut self,
16636        scopes: I,
16637    ) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C>
16638    where
16639        I: IntoIterator<Item = St>,
16640        St: AsRef<str>,
16641    {
16642        self._scopes
16643            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16644        self
16645    }
16646
16647    /// Removes all scopes, and no default scope will be used either.
16648    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16649    /// for details).
16650    pub fn clear_scopes(mut self) -> ProjectLocationMessageBusTestIamPermissionCall<'a, C> {
16651        self._scopes.clear();
16652        self
16653    }
16654}
16655
16656/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
16657///
16658/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
16659/// It is not used directly, but through a [`ProjectMethods`] instance.
16660///
16661/// # Example
16662///
16663/// Instantiate a resource method builder
16664///
16665/// ```test_harness,no_run
16666/// # extern crate hyper;
16667/// # extern crate hyper_rustls;
16668/// # extern crate google_eventarc1 as eventarc1;
16669/// use eventarc1::api::GoogleLongrunningCancelOperationRequest;
16670/// # async fn dox() {
16671/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16672///
16673/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16674/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16675/// #     .with_native_roots()
16676/// #     .unwrap()
16677/// #     .https_only()
16678/// #     .enable_http2()
16679/// #     .build();
16680///
16681/// # let executor = hyper_util::rt::TokioExecutor::new();
16682/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16683/// #     secret,
16684/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16685/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16686/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16687/// #     ),
16688/// # ).build().await.unwrap();
16689///
16690/// # let client = hyper_util::client::legacy::Client::builder(
16691/// #     hyper_util::rt::TokioExecutor::new()
16692/// # )
16693/// # .build(
16694/// #     hyper_rustls::HttpsConnectorBuilder::new()
16695/// #         .with_native_roots()
16696/// #         .unwrap()
16697/// #         .https_or_http()
16698/// #         .enable_http2()
16699/// #         .build()
16700/// # );
16701/// # let mut hub = Eventarc::new(client, auth);
16702/// // As the method needs a request, you would usually fill it with the desired information
16703/// // into the respective structure. Some of the parts shown here might not be applicable !
16704/// // Values shown here are possibly random and not representative !
16705/// let mut req = GoogleLongrunningCancelOperationRequest::default();
16706///
16707/// // You can configure optional parameters by calling the respective setters at will, and
16708/// // execute the final call using `doit()`.
16709/// // Values shown here are possibly random and not representative !
16710/// let result = hub.projects().locations_operations_cancel(req, "name")
16711///              .doit().await;
16712/// # }
16713/// ```
16714pub struct ProjectLocationOperationCancelCall<'a, C>
16715where
16716    C: 'a,
16717{
16718    hub: &'a Eventarc<C>,
16719    _request: GoogleLongrunningCancelOperationRequest,
16720    _name: String,
16721    _delegate: Option<&'a mut dyn common::Delegate>,
16722    _additional_params: HashMap<String, String>,
16723    _scopes: BTreeSet<String>,
16724}
16725
16726impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
16727
16728impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
16729where
16730    C: common::Connector,
16731{
16732    /// Perform the operation you have build so far.
16733    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16734        use std::borrow::Cow;
16735        use std::io::{Read, Seek};
16736
16737        use common::{url::Params, ToParts};
16738        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16739
16740        let mut dd = common::DefaultDelegate;
16741        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16742        dlg.begin(common::MethodInfo {
16743            id: "eventarc.projects.locations.operations.cancel",
16744            http_method: hyper::Method::POST,
16745        });
16746
16747        for &field in ["alt", "name"].iter() {
16748            if self._additional_params.contains_key(field) {
16749                dlg.finished(false);
16750                return Err(common::Error::FieldClash(field));
16751            }
16752        }
16753
16754        let mut params = Params::with_capacity(4 + self._additional_params.len());
16755        params.push("name", self._name);
16756
16757        params.extend(self._additional_params.iter());
16758
16759        params.push("alt", "json");
16760        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
16761        if self._scopes.is_empty() {
16762            self._scopes
16763                .insert(Scope::CloudPlatform.as_ref().to_string());
16764        }
16765
16766        #[allow(clippy::single_element_loop)]
16767        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16768            url = params.uri_replacement(url, param_name, find_this, true);
16769        }
16770        {
16771            let to_remove = ["name"];
16772            params.remove_params(&to_remove);
16773        }
16774
16775        let url = params.parse_with_url(&url);
16776
16777        let mut json_mime_type = mime::APPLICATION_JSON;
16778        let mut request_value_reader = {
16779            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16780            common::remove_json_null_values(&mut value);
16781            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16782            serde_json::to_writer(&mut dst, &value).unwrap();
16783            dst
16784        };
16785        let request_size = request_value_reader
16786            .seek(std::io::SeekFrom::End(0))
16787            .unwrap();
16788        request_value_reader
16789            .seek(std::io::SeekFrom::Start(0))
16790            .unwrap();
16791
16792        loop {
16793            let token = match self
16794                .hub
16795                .auth
16796                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16797                .await
16798            {
16799                Ok(token) => token,
16800                Err(e) => match dlg.token(e) {
16801                    Ok(token) => token,
16802                    Err(e) => {
16803                        dlg.finished(false);
16804                        return Err(common::Error::MissingToken(e));
16805                    }
16806                },
16807            };
16808            request_value_reader
16809                .seek(std::io::SeekFrom::Start(0))
16810                .unwrap();
16811            let mut req_result = {
16812                let client = &self.hub.client;
16813                dlg.pre_request();
16814                let mut req_builder = hyper::Request::builder()
16815                    .method(hyper::Method::POST)
16816                    .uri(url.as_str())
16817                    .header(USER_AGENT, self.hub._user_agent.clone());
16818
16819                if let Some(token) = token.as_ref() {
16820                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16821                }
16822
16823                let request = req_builder
16824                    .header(CONTENT_TYPE, json_mime_type.to_string())
16825                    .header(CONTENT_LENGTH, request_size as u64)
16826                    .body(common::to_body(
16827                        request_value_reader.get_ref().clone().into(),
16828                    ));
16829
16830                client.request(request.unwrap()).await
16831            };
16832
16833            match req_result {
16834                Err(err) => {
16835                    if let common::Retry::After(d) = dlg.http_error(&err) {
16836                        sleep(d).await;
16837                        continue;
16838                    }
16839                    dlg.finished(false);
16840                    return Err(common::Error::HttpError(err));
16841                }
16842                Ok(res) => {
16843                    let (mut parts, body) = res.into_parts();
16844                    let mut body = common::Body::new(body);
16845                    if !parts.status.is_success() {
16846                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16847                        let error = serde_json::from_str(&common::to_string(&bytes));
16848                        let response = common::to_response(parts, bytes.into());
16849
16850                        if let common::Retry::After(d) =
16851                            dlg.http_failure(&response, error.as_ref().ok())
16852                        {
16853                            sleep(d).await;
16854                            continue;
16855                        }
16856
16857                        dlg.finished(false);
16858
16859                        return Err(match error {
16860                            Ok(value) => common::Error::BadRequest(value),
16861                            _ => common::Error::Failure(response),
16862                        });
16863                    }
16864                    let response = {
16865                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16866                        let encoded = common::to_string(&bytes);
16867                        match serde_json::from_str(&encoded) {
16868                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16869                            Err(error) => {
16870                                dlg.response_json_decode_error(&encoded, &error);
16871                                return Err(common::Error::JsonDecodeError(
16872                                    encoded.to_string(),
16873                                    error,
16874                                ));
16875                            }
16876                        }
16877                    };
16878
16879                    dlg.finished(true);
16880                    return Ok(response);
16881                }
16882            }
16883        }
16884    }
16885
16886    ///
16887    /// Sets the *request* property to the given value.
16888    ///
16889    /// Even though the property as already been set when instantiating this call,
16890    /// we provide this method for API completeness.
16891    pub fn request(
16892        mut self,
16893        new_value: GoogleLongrunningCancelOperationRequest,
16894    ) -> ProjectLocationOperationCancelCall<'a, C> {
16895        self._request = new_value;
16896        self
16897    }
16898    /// The name of the operation resource to be cancelled.
16899    ///
16900    /// Sets the *name* path property to the given value.
16901    ///
16902    /// Even though the property as already been set when instantiating this call,
16903    /// we provide this method for API completeness.
16904    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
16905        self._name = new_value.to_string();
16906        self
16907    }
16908    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16909    /// while executing the actual API request.
16910    ///
16911    /// ````text
16912    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16913    /// ````
16914    ///
16915    /// Sets the *delegate* property to the given value.
16916    pub fn delegate(
16917        mut self,
16918        new_value: &'a mut dyn common::Delegate,
16919    ) -> ProjectLocationOperationCancelCall<'a, C> {
16920        self._delegate = Some(new_value);
16921        self
16922    }
16923
16924    /// Set any additional parameter of the query string used in the request.
16925    /// It should be used to set parameters which are not yet available through their own
16926    /// setters.
16927    ///
16928    /// Please note that this method must not be used to set any of the known parameters
16929    /// which have their own setter method. If done anyway, the request will fail.
16930    ///
16931    /// # Additional Parameters
16932    ///
16933    /// * *$.xgafv* (query-string) - V1 error format.
16934    /// * *access_token* (query-string) - OAuth access token.
16935    /// * *alt* (query-string) - Data format for response.
16936    /// * *callback* (query-string) - JSONP
16937    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16938    /// * *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.
16939    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16940    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16941    /// * *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.
16942    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16943    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16944    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
16945    where
16946        T: AsRef<str>,
16947    {
16948        self._additional_params
16949            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16950        self
16951    }
16952
16953    /// Identifies the authorization scope for the method you are building.
16954    ///
16955    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16956    /// [`Scope::CloudPlatform`].
16957    ///
16958    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16959    /// tokens for more than one scope.
16960    ///
16961    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16962    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16963    /// sufficient, a read-write scope will do as well.
16964    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
16965    where
16966        St: AsRef<str>,
16967    {
16968        self._scopes.insert(String::from(scope.as_ref()));
16969        self
16970    }
16971    /// Identifies the authorization scope(s) for the method you are building.
16972    ///
16973    /// See [`Self::add_scope()`] for details.
16974    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
16975    where
16976        I: IntoIterator<Item = St>,
16977        St: AsRef<str>,
16978    {
16979        self._scopes
16980            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16981        self
16982    }
16983
16984    /// Removes all scopes, and no default scope will be used either.
16985    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16986    /// for details).
16987    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
16988        self._scopes.clear();
16989        self
16990    }
16991}
16992
16993/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
16994///
16995/// A builder for the *locations.operations.delete* method supported by a *project* resource.
16996/// It is not used directly, but through a [`ProjectMethods`] instance.
16997///
16998/// # Example
16999///
17000/// Instantiate a resource method builder
17001///
17002/// ```test_harness,no_run
17003/// # extern crate hyper;
17004/// # extern crate hyper_rustls;
17005/// # extern crate google_eventarc1 as eventarc1;
17006/// # async fn dox() {
17007/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17008///
17009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17010/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17011/// #     .with_native_roots()
17012/// #     .unwrap()
17013/// #     .https_only()
17014/// #     .enable_http2()
17015/// #     .build();
17016///
17017/// # let executor = hyper_util::rt::TokioExecutor::new();
17018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17019/// #     secret,
17020/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17021/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17022/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17023/// #     ),
17024/// # ).build().await.unwrap();
17025///
17026/// # let client = hyper_util::client::legacy::Client::builder(
17027/// #     hyper_util::rt::TokioExecutor::new()
17028/// # )
17029/// # .build(
17030/// #     hyper_rustls::HttpsConnectorBuilder::new()
17031/// #         .with_native_roots()
17032/// #         .unwrap()
17033/// #         .https_or_http()
17034/// #         .enable_http2()
17035/// #         .build()
17036/// # );
17037/// # let mut hub = Eventarc::new(client, auth);
17038/// // You can configure optional parameters by calling the respective setters at will, and
17039/// // execute the final call using `doit()`.
17040/// // Values shown here are possibly random and not representative !
17041/// let result = hub.projects().locations_operations_delete("name")
17042///              .doit().await;
17043/// # }
17044/// ```
17045pub struct ProjectLocationOperationDeleteCall<'a, C>
17046where
17047    C: 'a,
17048{
17049    hub: &'a Eventarc<C>,
17050    _name: String,
17051    _delegate: Option<&'a mut dyn common::Delegate>,
17052    _additional_params: HashMap<String, String>,
17053    _scopes: BTreeSet<String>,
17054}
17055
17056impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
17057
17058impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
17059where
17060    C: common::Connector,
17061{
17062    /// Perform the operation you have build so far.
17063    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
17064        use std::borrow::Cow;
17065        use std::io::{Read, Seek};
17066
17067        use common::{url::Params, ToParts};
17068        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17069
17070        let mut dd = common::DefaultDelegate;
17071        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17072        dlg.begin(common::MethodInfo {
17073            id: "eventarc.projects.locations.operations.delete",
17074            http_method: hyper::Method::DELETE,
17075        });
17076
17077        for &field in ["alt", "name"].iter() {
17078            if self._additional_params.contains_key(field) {
17079                dlg.finished(false);
17080                return Err(common::Error::FieldClash(field));
17081            }
17082        }
17083
17084        let mut params = Params::with_capacity(3 + self._additional_params.len());
17085        params.push("name", self._name);
17086
17087        params.extend(self._additional_params.iter());
17088
17089        params.push("alt", "json");
17090        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17091        if self._scopes.is_empty() {
17092            self._scopes
17093                .insert(Scope::CloudPlatform.as_ref().to_string());
17094        }
17095
17096        #[allow(clippy::single_element_loop)]
17097        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17098            url = params.uri_replacement(url, param_name, find_this, true);
17099        }
17100        {
17101            let to_remove = ["name"];
17102            params.remove_params(&to_remove);
17103        }
17104
17105        let url = params.parse_with_url(&url);
17106
17107        loop {
17108            let token = match self
17109                .hub
17110                .auth
17111                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17112                .await
17113            {
17114                Ok(token) => token,
17115                Err(e) => match dlg.token(e) {
17116                    Ok(token) => token,
17117                    Err(e) => {
17118                        dlg.finished(false);
17119                        return Err(common::Error::MissingToken(e));
17120                    }
17121                },
17122            };
17123            let mut req_result = {
17124                let client = &self.hub.client;
17125                dlg.pre_request();
17126                let mut req_builder = hyper::Request::builder()
17127                    .method(hyper::Method::DELETE)
17128                    .uri(url.as_str())
17129                    .header(USER_AGENT, self.hub._user_agent.clone());
17130
17131                if let Some(token) = token.as_ref() {
17132                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17133                }
17134
17135                let request = req_builder
17136                    .header(CONTENT_LENGTH, 0_u64)
17137                    .body(common::to_body::<String>(None));
17138
17139                client.request(request.unwrap()).await
17140            };
17141
17142            match req_result {
17143                Err(err) => {
17144                    if let common::Retry::After(d) = dlg.http_error(&err) {
17145                        sleep(d).await;
17146                        continue;
17147                    }
17148                    dlg.finished(false);
17149                    return Err(common::Error::HttpError(err));
17150                }
17151                Ok(res) => {
17152                    let (mut parts, body) = res.into_parts();
17153                    let mut body = common::Body::new(body);
17154                    if !parts.status.is_success() {
17155                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17156                        let error = serde_json::from_str(&common::to_string(&bytes));
17157                        let response = common::to_response(parts, bytes.into());
17158
17159                        if let common::Retry::After(d) =
17160                            dlg.http_failure(&response, error.as_ref().ok())
17161                        {
17162                            sleep(d).await;
17163                            continue;
17164                        }
17165
17166                        dlg.finished(false);
17167
17168                        return Err(match error {
17169                            Ok(value) => common::Error::BadRequest(value),
17170                            _ => common::Error::Failure(response),
17171                        });
17172                    }
17173                    let response = {
17174                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17175                        let encoded = common::to_string(&bytes);
17176                        match serde_json::from_str(&encoded) {
17177                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17178                            Err(error) => {
17179                                dlg.response_json_decode_error(&encoded, &error);
17180                                return Err(common::Error::JsonDecodeError(
17181                                    encoded.to_string(),
17182                                    error,
17183                                ));
17184                            }
17185                        }
17186                    };
17187
17188                    dlg.finished(true);
17189                    return Ok(response);
17190                }
17191            }
17192        }
17193    }
17194
17195    /// The name of the operation resource to be deleted.
17196    ///
17197    /// Sets the *name* path property to the given value.
17198    ///
17199    /// Even though the property as already been set when instantiating this call,
17200    /// we provide this method for API completeness.
17201    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
17202        self._name = new_value.to_string();
17203        self
17204    }
17205    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17206    /// while executing the actual API request.
17207    ///
17208    /// ````text
17209    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17210    /// ````
17211    ///
17212    /// Sets the *delegate* property to the given value.
17213    pub fn delegate(
17214        mut self,
17215        new_value: &'a mut dyn common::Delegate,
17216    ) -> ProjectLocationOperationDeleteCall<'a, C> {
17217        self._delegate = Some(new_value);
17218        self
17219    }
17220
17221    /// Set any additional parameter of the query string used in the request.
17222    /// It should be used to set parameters which are not yet available through their own
17223    /// setters.
17224    ///
17225    /// Please note that this method must not be used to set any of the known parameters
17226    /// which have their own setter method. If done anyway, the request will fail.
17227    ///
17228    /// # Additional Parameters
17229    ///
17230    /// * *$.xgafv* (query-string) - V1 error format.
17231    /// * *access_token* (query-string) - OAuth access token.
17232    /// * *alt* (query-string) - Data format for response.
17233    /// * *callback* (query-string) - JSONP
17234    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17235    /// * *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.
17236    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17237    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17238    /// * *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.
17239    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17240    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17241    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
17242    where
17243        T: AsRef<str>,
17244    {
17245        self._additional_params
17246            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17247        self
17248    }
17249
17250    /// Identifies the authorization scope for the method you are building.
17251    ///
17252    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17253    /// [`Scope::CloudPlatform`].
17254    ///
17255    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17256    /// tokens for more than one scope.
17257    ///
17258    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17259    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17260    /// sufficient, a read-write scope will do as well.
17261    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
17262    where
17263        St: AsRef<str>,
17264    {
17265        self._scopes.insert(String::from(scope.as_ref()));
17266        self
17267    }
17268    /// Identifies the authorization scope(s) for the method you are building.
17269    ///
17270    /// See [`Self::add_scope()`] for details.
17271    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
17272    where
17273        I: IntoIterator<Item = St>,
17274        St: AsRef<str>,
17275    {
17276        self._scopes
17277            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17278        self
17279    }
17280
17281    /// Removes all scopes, and no default scope will be used either.
17282    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17283    /// for details).
17284    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
17285        self._scopes.clear();
17286        self
17287    }
17288}
17289
17290/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
17291///
17292/// A builder for the *locations.operations.get* method supported by a *project* resource.
17293/// It is not used directly, but through a [`ProjectMethods`] instance.
17294///
17295/// # Example
17296///
17297/// Instantiate a resource method builder
17298///
17299/// ```test_harness,no_run
17300/// # extern crate hyper;
17301/// # extern crate hyper_rustls;
17302/// # extern crate google_eventarc1 as eventarc1;
17303/// # async fn dox() {
17304/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17305///
17306/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17307/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17308/// #     .with_native_roots()
17309/// #     .unwrap()
17310/// #     .https_only()
17311/// #     .enable_http2()
17312/// #     .build();
17313///
17314/// # let executor = hyper_util::rt::TokioExecutor::new();
17315/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17316/// #     secret,
17317/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17318/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17319/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17320/// #     ),
17321/// # ).build().await.unwrap();
17322///
17323/// # let client = hyper_util::client::legacy::Client::builder(
17324/// #     hyper_util::rt::TokioExecutor::new()
17325/// # )
17326/// # .build(
17327/// #     hyper_rustls::HttpsConnectorBuilder::new()
17328/// #         .with_native_roots()
17329/// #         .unwrap()
17330/// #         .https_or_http()
17331/// #         .enable_http2()
17332/// #         .build()
17333/// # );
17334/// # let mut hub = Eventarc::new(client, auth);
17335/// // You can configure optional parameters by calling the respective setters at will, and
17336/// // execute the final call using `doit()`.
17337/// // Values shown here are possibly random and not representative !
17338/// let result = hub.projects().locations_operations_get("name")
17339///              .doit().await;
17340/// # }
17341/// ```
17342pub struct ProjectLocationOperationGetCall<'a, C>
17343where
17344    C: 'a,
17345{
17346    hub: &'a Eventarc<C>,
17347    _name: String,
17348    _delegate: Option<&'a mut dyn common::Delegate>,
17349    _additional_params: HashMap<String, String>,
17350    _scopes: BTreeSet<String>,
17351}
17352
17353impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
17354
17355impl<'a, C> ProjectLocationOperationGetCall<'a, C>
17356where
17357    C: common::Connector,
17358{
17359    /// Perform the operation you have build so far.
17360    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
17361        use std::borrow::Cow;
17362        use std::io::{Read, Seek};
17363
17364        use common::{url::Params, ToParts};
17365        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17366
17367        let mut dd = common::DefaultDelegate;
17368        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17369        dlg.begin(common::MethodInfo {
17370            id: "eventarc.projects.locations.operations.get",
17371            http_method: hyper::Method::GET,
17372        });
17373
17374        for &field in ["alt", "name"].iter() {
17375            if self._additional_params.contains_key(field) {
17376                dlg.finished(false);
17377                return Err(common::Error::FieldClash(field));
17378            }
17379        }
17380
17381        let mut params = Params::with_capacity(3 + self._additional_params.len());
17382        params.push("name", self._name);
17383
17384        params.extend(self._additional_params.iter());
17385
17386        params.push("alt", "json");
17387        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17388        if self._scopes.is_empty() {
17389            self._scopes
17390                .insert(Scope::CloudPlatform.as_ref().to_string());
17391        }
17392
17393        #[allow(clippy::single_element_loop)]
17394        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17395            url = params.uri_replacement(url, param_name, find_this, true);
17396        }
17397        {
17398            let to_remove = ["name"];
17399            params.remove_params(&to_remove);
17400        }
17401
17402        let url = params.parse_with_url(&url);
17403
17404        loop {
17405            let token = match self
17406                .hub
17407                .auth
17408                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17409                .await
17410            {
17411                Ok(token) => token,
17412                Err(e) => match dlg.token(e) {
17413                    Ok(token) => token,
17414                    Err(e) => {
17415                        dlg.finished(false);
17416                        return Err(common::Error::MissingToken(e));
17417                    }
17418                },
17419            };
17420            let mut req_result = {
17421                let client = &self.hub.client;
17422                dlg.pre_request();
17423                let mut req_builder = hyper::Request::builder()
17424                    .method(hyper::Method::GET)
17425                    .uri(url.as_str())
17426                    .header(USER_AGENT, self.hub._user_agent.clone());
17427
17428                if let Some(token) = token.as_ref() {
17429                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17430                }
17431
17432                let request = req_builder
17433                    .header(CONTENT_LENGTH, 0_u64)
17434                    .body(common::to_body::<String>(None));
17435
17436                client.request(request.unwrap()).await
17437            };
17438
17439            match req_result {
17440                Err(err) => {
17441                    if let common::Retry::After(d) = dlg.http_error(&err) {
17442                        sleep(d).await;
17443                        continue;
17444                    }
17445                    dlg.finished(false);
17446                    return Err(common::Error::HttpError(err));
17447                }
17448                Ok(res) => {
17449                    let (mut parts, body) = res.into_parts();
17450                    let mut body = common::Body::new(body);
17451                    if !parts.status.is_success() {
17452                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17453                        let error = serde_json::from_str(&common::to_string(&bytes));
17454                        let response = common::to_response(parts, bytes.into());
17455
17456                        if let common::Retry::After(d) =
17457                            dlg.http_failure(&response, error.as_ref().ok())
17458                        {
17459                            sleep(d).await;
17460                            continue;
17461                        }
17462
17463                        dlg.finished(false);
17464
17465                        return Err(match error {
17466                            Ok(value) => common::Error::BadRequest(value),
17467                            _ => common::Error::Failure(response),
17468                        });
17469                    }
17470                    let response = {
17471                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17472                        let encoded = common::to_string(&bytes);
17473                        match serde_json::from_str(&encoded) {
17474                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17475                            Err(error) => {
17476                                dlg.response_json_decode_error(&encoded, &error);
17477                                return Err(common::Error::JsonDecodeError(
17478                                    encoded.to_string(),
17479                                    error,
17480                                ));
17481                            }
17482                        }
17483                    };
17484
17485                    dlg.finished(true);
17486                    return Ok(response);
17487                }
17488            }
17489        }
17490    }
17491
17492    /// The name of the operation resource.
17493    ///
17494    /// Sets the *name* path property to the given value.
17495    ///
17496    /// Even though the property as already been set when instantiating this call,
17497    /// we provide this method for API completeness.
17498    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
17499        self._name = new_value.to_string();
17500        self
17501    }
17502    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17503    /// while executing the actual API request.
17504    ///
17505    /// ````text
17506    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17507    /// ````
17508    ///
17509    /// Sets the *delegate* property to the given value.
17510    pub fn delegate(
17511        mut self,
17512        new_value: &'a mut dyn common::Delegate,
17513    ) -> ProjectLocationOperationGetCall<'a, C> {
17514        self._delegate = Some(new_value);
17515        self
17516    }
17517
17518    /// Set any additional parameter of the query string used in the request.
17519    /// It should be used to set parameters which are not yet available through their own
17520    /// setters.
17521    ///
17522    /// Please note that this method must not be used to set any of the known parameters
17523    /// which have their own setter method. If done anyway, the request will fail.
17524    ///
17525    /// # Additional Parameters
17526    ///
17527    /// * *$.xgafv* (query-string) - V1 error format.
17528    /// * *access_token* (query-string) - OAuth access token.
17529    /// * *alt* (query-string) - Data format for response.
17530    /// * *callback* (query-string) - JSONP
17531    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17532    /// * *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.
17533    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17534    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17535    /// * *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.
17536    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17537    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17538    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
17539    where
17540        T: AsRef<str>,
17541    {
17542        self._additional_params
17543            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17544        self
17545    }
17546
17547    /// Identifies the authorization scope for the method you are building.
17548    ///
17549    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17550    /// [`Scope::CloudPlatform`].
17551    ///
17552    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17553    /// tokens for more than one scope.
17554    ///
17555    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17556    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17557    /// sufficient, a read-write scope will do as well.
17558    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
17559    where
17560        St: AsRef<str>,
17561    {
17562        self._scopes.insert(String::from(scope.as_ref()));
17563        self
17564    }
17565    /// Identifies the authorization scope(s) for the method you are building.
17566    ///
17567    /// See [`Self::add_scope()`] for details.
17568    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
17569    where
17570        I: IntoIterator<Item = St>,
17571        St: AsRef<str>,
17572    {
17573        self._scopes
17574            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17575        self
17576    }
17577
17578    /// Removes all scopes, and no default scope will be used either.
17579    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17580    /// for details).
17581    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
17582        self._scopes.clear();
17583        self
17584    }
17585}
17586
17587/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
17588///
17589/// A builder for the *locations.operations.list* method supported by a *project* resource.
17590/// It is not used directly, but through a [`ProjectMethods`] instance.
17591///
17592/// # Example
17593///
17594/// Instantiate a resource method builder
17595///
17596/// ```test_harness,no_run
17597/// # extern crate hyper;
17598/// # extern crate hyper_rustls;
17599/// # extern crate google_eventarc1 as eventarc1;
17600/// # async fn dox() {
17601/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17602///
17603/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17604/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17605/// #     .with_native_roots()
17606/// #     .unwrap()
17607/// #     .https_only()
17608/// #     .enable_http2()
17609/// #     .build();
17610///
17611/// # let executor = hyper_util::rt::TokioExecutor::new();
17612/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17613/// #     secret,
17614/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17615/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17616/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17617/// #     ),
17618/// # ).build().await.unwrap();
17619///
17620/// # let client = hyper_util::client::legacy::Client::builder(
17621/// #     hyper_util::rt::TokioExecutor::new()
17622/// # )
17623/// # .build(
17624/// #     hyper_rustls::HttpsConnectorBuilder::new()
17625/// #         .with_native_roots()
17626/// #         .unwrap()
17627/// #         .https_or_http()
17628/// #         .enable_http2()
17629/// #         .build()
17630/// # );
17631/// # let mut hub = Eventarc::new(client, auth);
17632/// // You can configure optional parameters by calling the respective setters at will, and
17633/// // execute the final call using `doit()`.
17634/// // Values shown here are possibly random and not representative !
17635/// let result = hub.projects().locations_operations_list("name")
17636///              .return_partial_success(false)
17637///              .page_token("At")
17638///              .page_size(-45)
17639///              .filter("aliquyam")
17640///              .doit().await;
17641/// # }
17642/// ```
17643pub struct ProjectLocationOperationListCall<'a, C>
17644where
17645    C: 'a,
17646{
17647    hub: &'a Eventarc<C>,
17648    _name: String,
17649    _return_partial_success: Option<bool>,
17650    _page_token: Option<String>,
17651    _page_size: Option<i32>,
17652    _filter: Option<String>,
17653    _delegate: Option<&'a mut dyn common::Delegate>,
17654    _additional_params: HashMap<String, String>,
17655    _scopes: BTreeSet<String>,
17656}
17657
17658impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
17659
17660impl<'a, C> ProjectLocationOperationListCall<'a, C>
17661where
17662    C: common::Connector,
17663{
17664    /// Perform the operation you have build so far.
17665    pub async fn doit(
17666        mut self,
17667    ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
17668        use std::borrow::Cow;
17669        use std::io::{Read, Seek};
17670
17671        use common::{url::Params, ToParts};
17672        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17673
17674        let mut dd = common::DefaultDelegate;
17675        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17676        dlg.begin(common::MethodInfo {
17677            id: "eventarc.projects.locations.operations.list",
17678            http_method: hyper::Method::GET,
17679        });
17680
17681        for &field in [
17682            "alt",
17683            "name",
17684            "returnPartialSuccess",
17685            "pageToken",
17686            "pageSize",
17687            "filter",
17688        ]
17689        .iter()
17690        {
17691            if self._additional_params.contains_key(field) {
17692                dlg.finished(false);
17693                return Err(common::Error::FieldClash(field));
17694            }
17695        }
17696
17697        let mut params = Params::with_capacity(7 + self._additional_params.len());
17698        params.push("name", self._name);
17699        if let Some(value) = self._return_partial_success.as_ref() {
17700            params.push("returnPartialSuccess", value.to_string());
17701        }
17702        if let Some(value) = self._page_token.as_ref() {
17703            params.push("pageToken", value);
17704        }
17705        if let Some(value) = self._page_size.as_ref() {
17706            params.push("pageSize", value.to_string());
17707        }
17708        if let Some(value) = self._filter.as_ref() {
17709            params.push("filter", value);
17710        }
17711
17712        params.extend(self._additional_params.iter());
17713
17714        params.push("alt", "json");
17715        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
17716        if self._scopes.is_empty() {
17717            self._scopes
17718                .insert(Scope::CloudPlatform.as_ref().to_string());
17719        }
17720
17721        #[allow(clippy::single_element_loop)]
17722        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17723            url = params.uri_replacement(url, param_name, find_this, true);
17724        }
17725        {
17726            let to_remove = ["name"];
17727            params.remove_params(&to_remove);
17728        }
17729
17730        let url = params.parse_with_url(&url);
17731
17732        loop {
17733            let token = match self
17734                .hub
17735                .auth
17736                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17737                .await
17738            {
17739                Ok(token) => token,
17740                Err(e) => match dlg.token(e) {
17741                    Ok(token) => token,
17742                    Err(e) => {
17743                        dlg.finished(false);
17744                        return Err(common::Error::MissingToken(e));
17745                    }
17746                },
17747            };
17748            let mut req_result = {
17749                let client = &self.hub.client;
17750                dlg.pre_request();
17751                let mut req_builder = hyper::Request::builder()
17752                    .method(hyper::Method::GET)
17753                    .uri(url.as_str())
17754                    .header(USER_AGENT, self.hub._user_agent.clone());
17755
17756                if let Some(token) = token.as_ref() {
17757                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17758                }
17759
17760                let request = req_builder
17761                    .header(CONTENT_LENGTH, 0_u64)
17762                    .body(common::to_body::<String>(None));
17763
17764                client.request(request.unwrap()).await
17765            };
17766
17767            match req_result {
17768                Err(err) => {
17769                    if let common::Retry::After(d) = dlg.http_error(&err) {
17770                        sleep(d).await;
17771                        continue;
17772                    }
17773                    dlg.finished(false);
17774                    return Err(common::Error::HttpError(err));
17775                }
17776                Ok(res) => {
17777                    let (mut parts, body) = res.into_parts();
17778                    let mut body = common::Body::new(body);
17779                    if !parts.status.is_success() {
17780                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17781                        let error = serde_json::from_str(&common::to_string(&bytes));
17782                        let response = common::to_response(parts, bytes.into());
17783
17784                        if let common::Retry::After(d) =
17785                            dlg.http_failure(&response, error.as_ref().ok())
17786                        {
17787                            sleep(d).await;
17788                            continue;
17789                        }
17790
17791                        dlg.finished(false);
17792
17793                        return Err(match error {
17794                            Ok(value) => common::Error::BadRequest(value),
17795                            _ => common::Error::Failure(response),
17796                        });
17797                    }
17798                    let response = {
17799                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17800                        let encoded = common::to_string(&bytes);
17801                        match serde_json::from_str(&encoded) {
17802                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17803                            Err(error) => {
17804                                dlg.response_json_decode_error(&encoded, &error);
17805                                return Err(common::Error::JsonDecodeError(
17806                                    encoded.to_string(),
17807                                    error,
17808                                ));
17809                            }
17810                        }
17811                    };
17812
17813                    dlg.finished(true);
17814                    return Ok(response);
17815                }
17816            }
17817        }
17818    }
17819
17820    /// The name of the operation's parent resource.
17821    ///
17822    /// Sets the *name* path property to the given value.
17823    ///
17824    /// Even though the property as already been set when instantiating this call,
17825    /// we provide this method for API completeness.
17826    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17827        self._name = new_value.to_string();
17828        self
17829    }
17830    /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
17831    ///
17832    /// Sets the *return partial success* query property to the given value.
17833    pub fn return_partial_success(
17834        mut self,
17835        new_value: bool,
17836    ) -> ProjectLocationOperationListCall<'a, C> {
17837        self._return_partial_success = Some(new_value);
17838        self
17839    }
17840    /// The standard list page token.
17841    ///
17842    /// Sets the *page token* query property to the given value.
17843    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17844        self._page_token = Some(new_value.to_string());
17845        self
17846    }
17847    /// The standard list page size.
17848    ///
17849    /// Sets the *page size* query property to the given value.
17850    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
17851        self._page_size = Some(new_value);
17852        self
17853    }
17854    /// The standard list filter.
17855    ///
17856    /// Sets the *filter* query property to the given value.
17857    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17858        self._filter = Some(new_value.to_string());
17859        self
17860    }
17861    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17862    /// while executing the actual API request.
17863    ///
17864    /// ````text
17865    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17866    /// ````
17867    ///
17868    /// Sets the *delegate* property to the given value.
17869    pub fn delegate(
17870        mut self,
17871        new_value: &'a mut dyn common::Delegate,
17872    ) -> ProjectLocationOperationListCall<'a, C> {
17873        self._delegate = Some(new_value);
17874        self
17875    }
17876
17877    /// Set any additional parameter of the query string used in the request.
17878    /// It should be used to set parameters which are not yet available through their own
17879    /// setters.
17880    ///
17881    /// Please note that this method must not be used to set any of the known parameters
17882    /// which have their own setter method. If done anyway, the request will fail.
17883    ///
17884    /// # Additional Parameters
17885    ///
17886    /// * *$.xgafv* (query-string) - V1 error format.
17887    /// * *access_token* (query-string) - OAuth access token.
17888    /// * *alt* (query-string) - Data format for response.
17889    /// * *callback* (query-string) - JSONP
17890    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17891    /// * *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.
17892    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17893    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17894    /// * *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.
17895    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17896    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17897    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
17898    where
17899        T: AsRef<str>,
17900    {
17901        self._additional_params
17902            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17903        self
17904    }
17905
17906    /// Identifies the authorization scope for the method you are building.
17907    ///
17908    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17909    /// [`Scope::CloudPlatform`].
17910    ///
17911    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17912    /// tokens for more than one scope.
17913    ///
17914    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17915    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17916    /// sufficient, a read-write scope will do as well.
17917    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
17918    where
17919        St: AsRef<str>,
17920    {
17921        self._scopes.insert(String::from(scope.as_ref()));
17922        self
17923    }
17924    /// Identifies the authorization scope(s) for the method you are building.
17925    ///
17926    /// See [`Self::add_scope()`] for details.
17927    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
17928    where
17929        I: IntoIterator<Item = St>,
17930        St: AsRef<str>,
17931    {
17932        self._scopes
17933            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17934        self
17935    }
17936
17937    /// Removes all scopes, and no default scope will be used either.
17938    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17939    /// for details).
17940    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
17941        self._scopes.clear();
17942        self
17943    }
17944}
17945
17946/// Create a new Pipeline in a particular project and location.
17947///
17948/// A builder for the *locations.pipelines.create* method supported by a *project* resource.
17949/// It is not used directly, but through a [`ProjectMethods`] instance.
17950///
17951/// # Example
17952///
17953/// Instantiate a resource method builder
17954///
17955/// ```test_harness,no_run
17956/// # extern crate hyper;
17957/// # extern crate hyper_rustls;
17958/// # extern crate google_eventarc1 as eventarc1;
17959/// use eventarc1::api::Pipeline;
17960/// # async fn dox() {
17961/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17962///
17963/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17964/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17965/// #     .with_native_roots()
17966/// #     .unwrap()
17967/// #     .https_only()
17968/// #     .enable_http2()
17969/// #     .build();
17970///
17971/// # let executor = hyper_util::rt::TokioExecutor::new();
17972/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17973/// #     secret,
17974/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17975/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17976/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17977/// #     ),
17978/// # ).build().await.unwrap();
17979///
17980/// # let client = hyper_util::client::legacy::Client::builder(
17981/// #     hyper_util::rt::TokioExecutor::new()
17982/// # )
17983/// # .build(
17984/// #     hyper_rustls::HttpsConnectorBuilder::new()
17985/// #         .with_native_roots()
17986/// #         .unwrap()
17987/// #         .https_or_http()
17988/// #         .enable_http2()
17989/// #         .build()
17990/// # );
17991/// # let mut hub = Eventarc::new(client, auth);
17992/// // As the method needs a request, you would usually fill it with the desired information
17993/// // into the respective structure. Some of the parts shown here might not be applicable !
17994/// // Values shown here are possibly random and not representative !
17995/// let mut req = Pipeline::default();
17996///
17997/// // You can configure optional parameters by calling the respective setters at will, and
17998/// // execute the final call using `doit()`.
17999/// // Values shown here are possibly random and not representative !
18000/// let result = hub.projects().locations_pipelines_create(req, "parent")
18001///              .validate_only(false)
18002///              .pipeline_id("erat")
18003///              .doit().await;
18004/// # }
18005/// ```
18006pub struct ProjectLocationPipelineCreateCall<'a, C>
18007where
18008    C: 'a,
18009{
18010    hub: &'a Eventarc<C>,
18011    _request: Pipeline,
18012    _parent: String,
18013    _validate_only: Option<bool>,
18014    _pipeline_id: Option<String>,
18015    _delegate: Option<&'a mut dyn common::Delegate>,
18016    _additional_params: HashMap<String, String>,
18017    _scopes: BTreeSet<String>,
18018}
18019
18020impl<'a, C> common::CallBuilder for ProjectLocationPipelineCreateCall<'a, C> {}
18021
18022impl<'a, C> ProjectLocationPipelineCreateCall<'a, C>
18023where
18024    C: common::Connector,
18025{
18026    /// Perform the operation you have build so far.
18027    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
18028        use std::borrow::Cow;
18029        use std::io::{Read, Seek};
18030
18031        use common::{url::Params, ToParts};
18032        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18033
18034        let mut dd = common::DefaultDelegate;
18035        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18036        dlg.begin(common::MethodInfo {
18037            id: "eventarc.projects.locations.pipelines.create",
18038            http_method: hyper::Method::POST,
18039        });
18040
18041        for &field in ["alt", "parent", "validateOnly", "pipelineId"].iter() {
18042            if self._additional_params.contains_key(field) {
18043                dlg.finished(false);
18044                return Err(common::Error::FieldClash(field));
18045            }
18046        }
18047
18048        let mut params = Params::with_capacity(6 + self._additional_params.len());
18049        params.push("parent", self._parent);
18050        if let Some(value) = self._validate_only.as_ref() {
18051            params.push("validateOnly", value.to_string());
18052        }
18053        if let Some(value) = self._pipeline_id.as_ref() {
18054            params.push("pipelineId", value);
18055        }
18056
18057        params.extend(self._additional_params.iter());
18058
18059        params.push("alt", "json");
18060        let mut url = self.hub._base_url.clone() + "v1/{+parent}/pipelines";
18061        if self._scopes.is_empty() {
18062            self._scopes
18063                .insert(Scope::CloudPlatform.as_ref().to_string());
18064        }
18065
18066        #[allow(clippy::single_element_loop)]
18067        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18068            url = params.uri_replacement(url, param_name, find_this, true);
18069        }
18070        {
18071            let to_remove = ["parent"];
18072            params.remove_params(&to_remove);
18073        }
18074
18075        let url = params.parse_with_url(&url);
18076
18077        let mut json_mime_type = mime::APPLICATION_JSON;
18078        let mut request_value_reader = {
18079            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18080            common::remove_json_null_values(&mut value);
18081            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18082            serde_json::to_writer(&mut dst, &value).unwrap();
18083            dst
18084        };
18085        let request_size = request_value_reader
18086            .seek(std::io::SeekFrom::End(0))
18087            .unwrap();
18088        request_value_reader
18089            .seek(std::io::SeekFrom::Start(0))
18090            .unwrap();
18091
18092        loop {
18093            let token = match self
18094                .hub
18095                .auth
18096                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18097                .await
18098            {
18099                Ok(token) => token,
18100                Err(e) => match dlg.token(e) {
18101                    Ok(token) => token,
18102                    Err(e) => {
18103                        dlg.finished(false);
18104                        return Err(common::Error::MissingToken(e));
18105                    }
18106                },
18107            };
18108            request_value_reader
18109                .seek(std::io::SeekFrom::Start(0))
18110                .unwrap();
18111            let mut req_result = {
18112                let client = &self.hub.client;
18113                dlg.pre_request();
18114                let mut req_builder = hyper::Request::builder()
18115                    .method(hyper::Method::POST)
18116                    .uri(url.as_str())
18117                    .header(USER_AGENT, self.hub._user_agent.clone());
18118
18119                if let Some(token) = token.as_ref() {
18120                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18121                }
18122
18123                let request = req_builder
18124                    .header(CONTENT_TYPE, json_mime_type.to_string())
18125                    .header(CONTENT_LENGTH, request_size as u64)
18126                    .body(common::to_body(
18127                        request_value_reader.get_ref().clone().into(),
18128                    ));
18129
18130                client.request(request.unwrap()).await
18131            };
18132
18133            match req_result {
18134                Err(err) => {
18135                    if let common::Retry::After(d) = dlg.http_error(&err) {
18136                        sleep(d).await;
18137                        continue;
18138                    }
18139                    dlg.finished(false);
18140                    return Err(common::Error::HttpError(err));
18141                }
18142                Ok(res) => {
18143                    let (mut parts, body) = res.into_parts();
18144                    let mut body = common::Body::new(body);
18145                    if !parts.status.is_success() {
18146                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18147                        let error = serde_json::from_str(&common::to_string(&bytes));
18148                        let response = common::to_response(parts, bytes.into());
18149
18150                        if let common::Retry::After(d) =
18151                            dlg.http_failure(&response, error.as_ref().ok())
18152                        {
18153                            sleep(d).await;
18154                            continue;
18155                        }
18156
18157                        dlg.finished(false);
18158
18159                        return Err(match error {
18160                            Ok(value) => common::Error::BadRequest(value),
18161                            _ => common::Error::Failure(response),
18162                        });
18163                    }
18164                    let response = {
18165                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18166                        let encoded = common::to_string(&bytes);
18167                        match serde_json::from_str(&encoded) {
18168                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18169                            Err(error) => {
18170                                dlg.response_json_decode_error(&encoded, &error);
18171                                return Err(common::Error::JsonDecodeError(
18172                                    encoded.to_string(),
18173                                    error,
18174                                ));
18175                            }
18176                        }
18177                    };
18178
18179                    dlg.finished(true);
18180                    return Ok(response);
18181                }
18182            }
18183        }
18184    }
18185
18186    ///
18187    /// Sets the *request* property to the given value.
18188    ///
18189    /// Even though the property as already been set when instantiating this call,
18190    /// we provide this method for API completeness.
18191    pub fn request(mut self, new_value: Pipeline) -> ProjectLocationPipelineCreateCall<'a, C> {
18192        self._request = new_value;
18193        self
18194    }
18195    /// Required. The parent collection in which to add this pipeline.
18196    ///
18197    /// Sets the *parent* path property to the given value.
18198    ///
18199    /// Even though the property as already been set when instantiating this call,
18200    /// we provide this method for API completeness.
18201    pub fn parent(mut self, new_value: &str) -> ProjectLocationPipelineCreateCall<'a, C> {
18202        self._parent = new_value.to_string();
18203        self
18204    }
18205    /// Optional. If set, validate the request and preview the review, but do not post it.
18206    ///
18207    /// Sets the *validate only* query property to the given value.
18208    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationPipelineCreateCall<'a, C> {
18209        self._validate_only = Some(new_value);
18210        self
18211    }
18212    /// Required. The user-provided ID to be assigned to the Pipeline. It should match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
18213    ///
18214    /// Sets the *pipeline id* query property to the given value.
18215    pub fn pipeline_id(mut self, new_value: &str) -> ProjectLocationPipelineCreateCall<'a, C> {
18216        self._pipeline_id = Some(new_value.to_string());
18217        self
18218    }
18219    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18220    /// while executing the actual API request.
18221    ///
18222    /// ````text
18223    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18224    /// ````
18225    ///
18226    /// Sets the *delegate* property to the given value.
18227    pub fn delegate(
18228        mut self,
18229        new_value: &'a mut dyn common::Delegate,
18230    ) -> ProjectLocationPipelineCreateCall<'a, C> {
18231        self._delegate = Some(new_value);
18232        self
18233    }
18234
18235    /// Set any additional parameter of the query string used in the request.
18236    /// It should be used to set parameters which are not yet available through their own
18237    /// setters.
18238    ///
18239    /// Please note that this method must not be used to set any of the known parameters
18240    /// which have their own setter method. If done anyway, the request will fail.
18241    ///
18242    /// # Additional Parameters
18243    ///
18244    /// * *$.xgafv* (query-string) - V1 error format.
18245    /// * *access_token* (query-string) - OAuth access token.
18246    /// * *alt* (query-string) - Data format for response.
18247    /// * *callback* (query-string) - JSONP
18248    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18249    /// * *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.
18250    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18251    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18252    /// * *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.
18253    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18254    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18255    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineCreateCall<'a, C>
18256    where
18257        T: AsRef<str>,
18258    {
18259        self._additional_params
18260            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18261        self
18262    }
18263
18264    /// Identifies the authorization scope for the method you are building.
18265    ///
18266    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18267    /// [`Scope::CloudPlatform`].
18268    ///
18269    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18270    /// tokens for more than one scope.
18271    ///
18272    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18273    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18274    /// sufficient, a read-write scope will do as well.
18275    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineCreateCall<'a, C>
18276    where
18277        St: AsRef<str>,
18278    {
18279        self._scopes.insert(String::from(scope.as_ref()));
18280        self
18281    }
18282    /// Identifies the authorization scope(s) for the method you are building.
18283    ///
18284    /// See [`Self::add_scope()`] for details.
18285    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineCreateCall<'a, C>
18286    where
18287        I: IntoIterator<Item = St>,
18288        St: AsRef<str>,
18289    {
18290        self._scopes
18291            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18292        self
18293    }
18294
18295    /// Removes all scopes, and no default scope will be used either.
18296    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18297    /// for details).
18298    pub fn clear_scopes(mut self) -> ProjectLocationPipelineCreateCall<'a, C> {
18299        self._scopes.clear();
18300        self
18301    }
18302}
18303
18304/// Delete a single pipeline.
18305///
18306/// A builder for the *locations.pipelines.delete* method supported by a *project* resource.
18307/// It is not used directly, but through a [`ProjectMethods`] instance.
18308///
18309/// # Example
18310///
18311/// Instantiate a resource method builder
18312///
18313/// ```test_harness,no_run
18314/// # extern crate hyper;
18315/// # extern crate hyper_rustls;
18316/// # extern crate google_eventarc1 as eventarc1;
18317/// # async fn dox() {
18318/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18319///
18320/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18321/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18322/// #     .with_native_roots()
18323/// #     .unwrap()
18324/// #     .https_only()
18325/// #     .enable_http2()
18326/// #     .build();
18327///
18328/// # let executor = hyper_util::rt::TokioExecutor::new();
18329/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18330/// #     secret,
18331/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18332/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18333/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18334/// #     ),
18335/// # ).build().await.unwrap();
18336///
18337/// # let client = hyper_util::client::legacy::Client::builder(
18338/// #     hyper_util::rt::TokioExecutor::new()
18339/// # )
18340/// # .build(
18341/// #     hyper_rustls::HttpsConnectorBuilder::new()
18342/// #         .with_native_roots()
18343/// #         .unwrap()
18344/// #         .https_or_http()
18345/// #         .enable_http2()
18346/// #         .build()
18347/// # );
18348/// # let mut hub = Eventarc::new(client, auth);
18349/// // You can configure optional parameters by calling the respective setters at will, and
18350/// // execute the final call using `doit()`.
18351/// // Values shown here are possibly random and not representative !
18352/// let result = hub.projects().locations_pipelines_delete("name")
18353///              .validate_only(true)
18354///              .etag("est")
18355///              .allow_missing(false)
18356///              .doit().await;
18357/// # }
18358/// ```
18359pub struct ProjectLocationPipelineDeleteCall<'a, C>
18360where
18361    C: 'a,
18362{
18363    hub: &'a Eventarc<C>,
18364    _name: String,
18365    _validate_only: Option<bool>,
18366    _etag: Option<String>,
18367    _allow_missing: Option<bool>,
18368    _delegate: Option<&'a mut dyn common::Delegate>,
18369    _additional_params: HashMap<String, String>,
18370    _scopes: BTreeSet<String>,
18371}
18372
18373impl<'a, C> common::CallBuilder for ProjectLocationPipelineDeleteCall<'a, C> {}
18374
18375impl<'a, C> ProjectLocationPipelineDeleteCall<'a, C>
18376where
18377    C: common::Connector,
18378{
18379    /// Perform the operation you have build so far.
18380    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
18381        use std::borrow::Cow;
18382        use std::io::{Read, Seek};
18383
18384        use common::{url::Params, ToParts};
18385        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18386
18387        let mut dd = common::DefaultDelegate;
18388        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18389        dlg.begin(common::MethodInfo {
18390            id: "eventarc.projects.locations.pipelines.delete",
18391            http_method: hyper::Method::DELETE,
18392        });
18393
18394        for &field in ["alt", "name", "validateOnly", "etag", "allowMissing"].iter() {
18395            if self._additional_params.contains_key(field) {
18396                dlg.finished(false);
18397                return Err(common::Error::FieldClash(field));
18398            }
18399        }
18400
18401        let mut params = Params::with_capacity(6 + self._additional_params.len());
18402        params.push("name", self._name);
18403        if let Some(value) = self._validate_only.as_ref() {
18404            params.push("validateOnly", value.to_string());
18405        }
18406        if let Some(value) = self._etag.as_ref() {
18407            params.push("etag", value);
18408        }
18409        if let Some(value) = self._allow_missing.as_ref() {
18410            params.push("allowMissing", value.to_string());
18411        }
18412
18413        params.extend(self._additional_params.iter());
18414
18415        params.push("alt", "json");
18416        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18417        if self._scopes.is_empty() {
18418            self._scopes
18419                .insert(Scope::CloudPlatform.as_ref().to_string());
18420        }
18421
18422        #[allow(clippy::single_element_loop)]
18423        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18424            url = params.uri_replacement(url, param_name, find_this, true);
18425        }
18426        {
18427            let to_remove = ["name"];
18428            params.remove_params(&to_remove);
18429        }
18430
18431        let url = params.parse_with_url(&url);
18432
18433        loop {
18434            let token = match self
18435                .hub
18436                .auth
18437                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18438                .await
18439            {
18440                Ok(token) => token,
18441                Err(e) => match dlg.token(e) {
18442                    Ok(token) => token,
18443                    Err(e) => {
18444                        dlg.finished(false);
18445                        return Err(common::Error::MissingToken(e));
18446                    }
18447                },
18448            };
18449            let mut req_result = {
18450                let client = &self.hub.client;
18451                dlg.pre_request();
18452                let mut req_builder = hyper::Request::builder()
18453                    .method(hyper::Method::DELETE)
18454                    .uri(url.as_str())
18455                    .header(USER_AGENT, self.hub._user_agent.clone());
18456
18457                if let Some(token) = token.as_ref() {
18458                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18459                }
18460
18461                let request = req_builder
18462                    .header(CONTENT_LENGTH, 0_u64)
18463                    .body(common::to_body::<String>(None));
18464
18465                client.request(request.unwrap()).await
18466            };
18467
18468            match req_result {
18469                Err(err) => {
18470                    if let common::Retry::After(d) = dlg.http_error(&err) {
18471                        sleep(d).await;
18472                        continue;
18473                    }
18474                    dlg.finished(false);
18475                    return Err(common::Error::HttpError(err));
18476                }
18477                Ok(res) => {
18478                    let (mut parts, body) = res.into_parts();
18479                    let mut body = common::Body::new(body);
18480                    if !parts.status.is_success() {
18481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18482                        let error = serde_json::from_str(&common::to_string(&bytes));
18483                        let response = common::to_response(parts, bytes.into());
18484
18485                        if let common::Retry::After(d) =
18486                            dlg.http_failure(&response, error.as_ref().ok())
18487                        {
18488                            sleep(d).await;
18489                            continue;
18490                        }
18491
18492                        dlg.finished(false);
18493
18494                        return Err(match error {
18495                            Ok(value) => common::Error::BadRequest(value),
18496                            _ => common::Error::Failure(response),
18497                        });
18498                    }
18499                    let response = {
18500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18501                        let encoded = common::to_string(&bytes);
18502                        match serde_json::from_str(&encoded) {
18503                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18504                            Err(error) => {
18505                                dlg.response_json_decode_error(&encoded, &error);
18506                                return Err(common::Error::JsonDecodeError(
18507                                    encoded.to_string(),
18508                                    error,
18509                                ));
18510                            }
18511                        }
18512                    };
18513
18514                    dlg.finished(true);
18515                    return Ok(response);
18516                }
18517            }
18518        }
18519    }
18520
18521    /// Required. The name of the Pipeline to be deleted.
18522    ///
18523    /// Sets the *name* path property to the given value.
18524    ///
18525    /// Even though the property as already been set when instantiating this call,
18526    /// we provide this method for API completeness.
18527    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelineDeleteCall<'a, C> {
18528        self._name = new_value.to_string();
18529        self
18530    }
18531    /// Optional. If set, validate the request and preview the review, but do not post it.
18532    ///
18533    /// Sets the *validate only* query property to the given value.
18534    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationPipelineDeleteCall<'a, C> {
18535        self._validate_only = Some(new_value);
18536        self
18537    }
18538    /// Optional. If provided, the Pipeline will only be deleted if the etag matches the current etag on the resource.
18539    ///
18540    /// Sets the *etag* query property to the given value.
18541    pub fn etag(mut self, new_value: &str) -> ProjectLocationPipelineDeleteCall<'a, C> {
18542        self._etag = Some(new_value.to_string());
18543        self
18544    }
18545    /// Optional. If set to true, and the Pipeline is not found, the request will succeed but no action will be taken on the server.
18546    ///
18547    /// Sets the *allow missing* query property to the given value.
18548    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationPipelineDeleteCall<'a, C> {
18549        self._allow_missing = Some(new_value);
18550        self
18551    }
18552    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18553    /// while executing the actual API request.
18554    ///
18555    /// ````text
18556    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18557    /// ````
18558    ///
18559    /// Sets the *delegate* property to the given value.
18560    pub fn delegate(
18561        mut self,
18562        new_value: &'a mut dyn common::Delegate,
18563    ) -> ProjectLocationPipelineDeleteCall<'a, C> {
18564        self._delegate = Some(new_value);
18565        self
18566    }
18567
18568    /// Set any additional parameter of the query string used in the request.
18569    /// It should be used to set parameters which are not yet available through their own
18570    /// setters.
18571    ///
18572    /// Please note that this method must not be used to set any of the known parameters
18573    /// which have their own setter method. If done anyway, the request will fail.
18574    ///
18575    /// # Additional Parameters
18576    ///
18577    /// * *$.xgafv* (query-string) - V1 error format.
18578    /// * *access_token* (query-string) - OAuth access token.
18579    /// * *alt* (query-string) - Data format for response.
18580    /// * *callback* (query-string) - JSONP
18581    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18582    /// * *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.
18583    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18584    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18585    /// * *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.
18586    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18587    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18588    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineDeleteCall<'a, C>
18589    where
18590        T: AsRef<str>,
18591    {
18592        self._additional_params
18593            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18594        self
18595    }
18596
18597    /// Identifies the authorization scope for the method you are building.
18598    ///
18599    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18600    /// [`Scope::CloudPlatform`].
18601    ///
18602    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18603    /// tokens for more than one scope.
18604    ///
18605    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18606    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18607    /// sufficient, a read-write scope will do as well.
18608    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineDeleteCall<'a, C>
18609    where
18610        St: AsRef<str>,
18611    {
18612        self._scopes.insert(String::from(scope.as_ref()));
18613        self
18614    }
18615    /// Identifies the authorization scope(s) for the method you are building.
18616    ///
18617    /// See [`Self::add_scope()`] for details.
18618    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineDeleteCall<'a, C>
18619    where
18620        I: IntoIterator<Item = St>,
18621        St: AsRef<str>,
18622    {
18623        self._scopes
18624            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18625        self
18626    }
18627
18628    /// Removes all scopes, and no default scope will be used either.
18629    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18630    /// for details).
18631    pub fn clear_scopes(mut self) -> ProjectLocationPipelineDeleteCall<'a, C> {
18632        self._scopes.clear();
18633        self
18634    }
18635}
18636
18637/// Get a single Pipeline.
18638///
18639/// A builder for the *locations.pipelines.get* method supported by a *project* resource.
18640/// It is not used directly, but through a [`ProjectMethods`] instance.
18641///
18642/// # Example
18643///
18644/// Instantiate a resource method builder
18645///
18646/// ```test_harness,no_run
18647/// # extern crate hyper;
18648/// # extern crate hyper_rustls;
18649/// # extern crate google_eventarc1 as eventarc1;
18650/// # async fn dox() {
18651/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18652///
18653/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18654/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18655/// #     .with_native_roots()
18656/// #     .unwrap()
18657/// #     .https_only()
18658/// #     .enable_http2()
18659/// #     .build();
18660///
18661/// # let executor = hyper_util::rt::TokioExecutor::new();
18662/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18663/// #     secret,
18664/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18665/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18666/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18667/// #     ),
18668/// # ).build().await.unwrap();
18669///
18670/// # let client = hyper_util::client::legacy::Client::builder(
18671/// #     hyper_util::rt::TokioExecutor::new()
18672/// # )
18673/// # .build(
18674/// #     hyper_rustls::HttpsConnectorBuilder::new()
18675/// #         .with_native_roots()
18676/// #         .unwrap()
18677/// #         .https_or_http()
18678/// #         .enable_http2()
18679/// #         .build()
18680/// # );
18681/// # let mut hub = Eventarc::new(client, auth);
18682/// // You can configure optional parameters by calling the respective setters at will, and
18683/// // execute the final call using `doit()`.
18684/// // Values shown here are possibly random and not representative !
18685/// let result = hub.projects().locations_pipelines_get("name")
18686///              .doit().await;
18687/// # }
18688/// ```
18689pub struct ProjectLocationPipelineGetCall<'a, C>
18690where
18691    C: 'a,
18692{
18693    hub: &'a Eventarc<C>,
18694    _name: String,
18695    _delegate: Option<&'a mut dyn common::Delegate>,
18696    _additional_params: HashMap<String, String>,
18697    _scopes: BTreeSet<String>,
18698}
18699
18700impl<'a, C> common::CallBuilder for ProjectLocationPipelineGetCall<'a, C> {}
18701
18702impl<'a, C> ProjectLocationPipelineGetCall<'a, C>
18703where
18704    C: common::Connector,
18705{
18706    /// Perform the operation you have build so far.
18707    pub async fn doit(mut self) -> common::Result<(common::Response, Pipeline)> {
18708        use std::borrow::Cow;
18709        use std::io::{Read, Seek};
18710
18711        use common::{url::Params, ToParts};
18712        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18713
18714        let mut dd = common::DefaultDelegate;
18715        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18716        dlg.begin(common::MethodInfo {
18717            id: "eventarc.projects.locations.pipelines.get",
18718            http_method: hyper::Method::GET,
18719        });
18720
18721        for &field in ["alt", "name"].iter() {
18722            if self._additional_params.contains_key(field) {
18723                dlg.finished(false);
18724                return Err(common::Error::FieldClash(field));
18725            }
18726        }
18727
18728        let mut params = Params::with_capacity(3 + self._additional_params.len());
18729        params.push("name", self._name);
18730
18731        params.extend(self._additional_params.iter());
18732
18733        params.push("alt", "json");
18734        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18735        if self._scopes.is_empty() {
18736            self._scopes
18737                .insert(Scope::CloudPlatform.as_ref().to_string());
18738        }
18739
18740        #[allow(clippy::single_element_loop)]
18741        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18742            url = params.uri_replacement(url, param_name, find_this, true);
18743        }
18744        {
18745            let to_remove = ["name"];
18746            params.remove_params(&to_remove);
18747        }
18748
18749        let url = params.parse_with_url(&url);
18750
18751        loop {
18752            let token = match self
18753                .hub
18754                .auth
18755                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18756                .await
18757            {
18758                Ok(token) => token,
18759                Err(e) => match dlg.token(e) {
18760                    Ok(token) => token,
18761                    Err(e) => {
18762                        dlg.finished(false);
18763                        return Err(common::Error::MissingToken(e));
18764                    }
18765                },
18766            };
18767            let mut req_result = {
18768                let client = &self.hub.client;
18769                dlg.pre_request();
18770                let mut req_builder = hyper::Request::builder()
18771                    .method(hyper::Method::GET)
18772                    .uri(url.as_str())
18773                    .header(USER_AGENT, self.hub._user_agent.clone());
18774
18775                if let Some(token) = token.as_ref() {
18776                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18777                }
18778
18779                let request = req_builder
18780                    .header(CONTENT_LENGTH, 0_u64)
18781                    .body(common::to_body::<String>(None));
18782
18783                client.request(request.unwrap()).await
18784            };
18785
18786            match req_result {
18787                Err(err) => {
18788                    if let common::Retry::After(d) = dlg.http_error(&err) {
18789                        sleep(d).await;
18790                        continue;
18791                    }
18792                    dlg.finished(false);
18793                    return Err(common::Error::HttpError(err));
18794                }
18795                Ok(res) => {
18796                    let (mut parts, body) = res.into_parts();
18797                    let mut body = common::Body::new(body);
18798                    if !parts.status.is_success() {
18799                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18800                        let error = serde_json::from_str(&common::to_string(&bytes));
18801                        let response = common::to_response(parts, bytes.into());
18802
18803                        if let common::Retry::After(d) =
18804                            dlg.http_failure(&response, error.as_ref().ok())
18805                        {
18806                            sleep(d).await;
18807                            continue;
18808                        }
18809
18810                        dlg.finished(false);
18811
18812                        return Err(match error {
18813                            Ok(value) => common::Error::BadRequest(value),
18814                            _ => common::Error::Failure(response),
18815                        });
18816                    }
18817                    let response = {
18818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18819                        let encoded = common::to_string(&bytes);
18820                        match serde_json::from_str(&encoded) {
18821                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18822                            Err(error) => {
18823                                dlg.response_json_decode_error(&encoded, &error);
18824                                return Err(common::Error::JsonDecodeError(
18825                                    encoded.to_string(),
18826                                    error,
18827                                ));
18828                            }
18829                        }
18830                    };
18831
18832                    dlg.finished(true);
18833                    return Ok(response);
18834                }
18835            }
18836        }
18837    }
18838
18839    /// Required. The name of the pipeline to get.
18840    ///
18841    /// Sets the *name* path property to the given value.
18842    ///
18843    /// Even though the property as already been set when instantiating this call,
18844    /// we provide this method for API completeness.
18845    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelineGetCall<'a, C> {
18846        self._name = new_value.to_string();
18847        self
18848    }
18849    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18850    /// while executing the actual API request.
18851    ///
18852    /// ````text
18853    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18854    /// ````
18855    ///
18856    /// Sets the *delegate* property to the given value.
18857    pub fn delegate(
18858        mut self,
18859        new_value: &'a mut dyn common::Delegate,
18860    ) -> ProjectLocationPipelineGetCall<'a, C> {
18861        self._delegate = Some(new_value);
18862        self
18863    }
18864
18865    /// Set any additional parameter of the query string used in the request.
18866    /// It should be used to set parameters which are not yet available through their own
18867    /// setters.
18868    ///
18869    /// Please note that this method must not be used to set any of the known parameters
18870    /// which have their own setter method. If done anyway, the request will fail.
18871    ///
18872    /// # Additional Parameters
18873    ///
18874    /// * *$.xgafv* (query-string) - V1 error format.
18875    /// * *access_token* (query-string) - OAuth access token.
18876    /// * *alt* (query-string) - Data format for response.
18877    /// * *callback* (query-string) - JSONP
18878    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18879    /// * *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.
18880    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18881    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18882    /// * *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.
18883    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18884    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18885    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineGetCall<'a, C>
18886    where
18887        T: AsRef<str>,
18888    {
18889        self._additional_params
18890            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18891        self
18892    }
18893
18894    /// Identifies the authorization scope for the method you are building.
18895    ///
18896    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18897    /// [`Scope::CloudPlatform`].
18898    ///
18899    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18900    /// tokens for more than one scope.
18901    ///
18902    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18903    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18904    /// sufficient, a read-write scope will do as well.
18905    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineGetCall<'a, C>
18906    where
18907        St: AsRef<str>,
18908    {
18909        self._scopes.insert(String::from(scope.as_ref()));
18910        self
18911    }
18912    /// Identifies the authorization scope(s) for the method you are building.
18913    ///
18914    /// See [`Self::add_scope()`] for details.
18915    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineGetCall<'a, C>
18916    where
18917        I: IntoIterator<Item = St>,
18918        St: AsRef<str>,
18919    {
18920        self._scopes
18921            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18922        self
18923    }
18924
18925    /// Removes all scopes, and no default scope will be used either.
18926    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18927    /// for details).
18928    pub fn clear_scopes(mut self) -> ProjectLocationPipelineGetCall<'a, C> {
18929        self._scopes.clear();
18930        self
18931    }
18932}
18933
18934/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
18935///
18936/// A builder for the *locations.pipelines.getIamPolicy* method supported by a *project* resource.
18937/// It is not used directly, but through a [`ProjectMethods`] instance.
18938///
18939/// # Example
18940///
18941/// Instantiate a resource method builder
18942///
18943/// ```test_harness,no_run
18944/// # extern crate hyper;
18945/// # extern crate hyper_rustls;
18946/// # extern crate google_eventarc1 as eventarc1;
18947/// # async fn dox() {
18948/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18949///
18950/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18951/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18952/// #     .with_native_roots()
18953/// #     .unwrap()
18954/// #     .https_only()
18955/// #     .enable_http2()
18956/// #     .build();
18957///
18958/// # let executor = hyper_util::rt::TokioExecutor::new();
18959/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18960/// #     secret,
18961/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18962/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18963/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18964/// #     ),
18965/// # ).build().await.unwrap();
18966///
18967/// # let client = hyper_util::client::legacy::Client::builder(
18968/// #     hyper_util::rt::TokioExecutor::new()
18969/// # )
18970/// # .build(
18971/// #     hyper_rustls::HttpsConnectorBuilder::new()
18972/// #         .with_native_roots()
18973/// #         .unwrap()
18974/// #         .https_or_http()
18975/// #         .enable_http2()
18976/// #         .build()
18977/// # );
18978/// # let mut hub = Eventarc::new(client, auth);
18979/// // You can configure optional parameters by calling the respective setters at will, and
18980/// // execute the final call using `doit()`.
18981/// // Values shown here are possibly random and not representative !
18982/// let result = hub.projects().locations_pipelines_get_iam_policy("resource")
18983///              .options_requested_policy_version(-7)
18984///              .doit().await;
18985/// # }
18986/// ```
18987pub struct ProjectLocationPipelineGetIamPolicyCall<'a, C>
18988where
18989    C: 'a,
18990{
18991    hub: &'a Eventarc<C>,
18992    _resource: String,
18993    _options_requested_policy_version: Option<i32>,
18994    _delegate: Option<&'a mut dyn common::Delegate>,
18995    _additional_params: HashMap<String, String>,
18996    _scopes: BTreeSet<String>,
18997}
18998
18999impl<'a, C> common::CallBuilder for ProjectLocationPipelineGetIamPolicyCall<'a, C> {}
19000
19001impl<'a, C> ProjectLocationPipelineGetIamPolicyCall<'a, C>
19002where
19003    C: common::Connector,
19004{
19005    /// Perform the operation you have build so far.
19006    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
19007        use std::borrow::Cow;
19008        use std::io::{Read, Seek};
19009
19010        use common::{url::Params, ToParts};
19011        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19012
19013        let mut dd = common::DefaultDelegate;
19014        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19015        dlg.begin(common::MethodInfo {
19016            id: "eventarc.projects.locations.pipelines.getIamPolicy",
19017            http_method: hyper::Method::GET,
19018        });
19019
19020        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
19021            if self._additional_params.contains_key(field) {
19022                dlg.finished(false);
19023                return Err(common::Error::FieldClash(field));
19024            }
19025        }
19026
19027        let mut params = Params::with_capacity(4 + self._additional_params.len());
19028        params.push("resource", self._resource);
19029        if let Some(value) = self._options_requested_policy_version.as_ref() {
19030            params.push("options.requestedPolicyVersion", value.to_string());
19031        }
19032
19033        params.extend(self._additional_params.iter());
19034
19035        params.push("alt", "json");
19036        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
19037        if self._scopes.is_empty() {
19038            self._scopes
19039                .insert(Scope::CloudPlatform.as_ref().to_string());
19040        }
19041
19042        #[allow(clippy::single_element_loop)]
19043        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19044            url = params.uri_replacement(url, param_name, find_this, true);
19045        }
19046        {
19047            let to_remove = ["resource"];
19048            params.remove_params(&to_remove);
19049        }
19050
19051        let url = params.parse_with_url(&url);
19052
19053        loop {
19054            let token = match self
19055                .hub
19056                .auth
19057                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19058                .await
19059            {
19060                Ok(token) => token,
19061                Err(e) => match dlg.token(e) {
19062                    Ok(token) => token,
19063                    Err(e) => {
19064                        dlg.finished(false);
19065                        return Err(common::Error::MissingToken(e));
19066                    }
19067                },
19068            };
19069            let mut req_result = {
19070                let client = &self.hub.client;
19071                dlg.pre_request();
19072                let mut req_builder = hyper::Request::builder()
19073                    .method(hyper::Method::GET)
19074                    .uri(url.as_str())
19075                    .header(USER_AGENT, self.hub._user_agent.clone());
19076
19077                if let Some(token) = token.as_ref() {
19078                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19079                }
19080
19081                let request = req_builder
19082                    .header(CONTENT_LENGTH, 0_u64)
19083                    .body(common::to_body::<String>(None));
19084
19085                client.request(request.unwrap()).await
19086            };
19087
19088            match req_result {
19089                Err(err) => {
19090                    if let common::Retry::After(d) = dlg.http_error(&err) {
19091                        sleep(d).await;
19092                        continue;
19093                    }
19094                    dlg.finished(false);
19095                    return Err(common::Error::HttpError(err));
19096                }
19097                Ok(res) => {
19098                    let (mut parts, body) = res.into_parts();
19099                    let mut body = common::Body::new(body);
19100                    if !parts.status.is_success() {
19101                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19102                        let error = serde_json::from_str(&common::to_string(&bytes));
19103                        let response = common::to_response(parts, bytes.into());
19104
19105                        if let common::Retry::After(d) =
19106                            dlg.http_failure(&response, error.as_ref().ok())
19107                        {
19108                            sleep(d).await;
19109                            continue;
19110                        }
19111
19112                        dlg.finished(false);
19113
19114                        return Err(match error {
19115                            Ok(value) => common::Error::BadRequest(value),
19116                            _ => common::Error::Failure(response),
19117                        });
19118                    }
19119                    let response = {
19120                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19121                        let encoded = common::to_string(&bytes);
19122                        match serde_json::from_str(&encoded) {
19123                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19124                            Err(error) => {
19125                                dlg.response_json_decode_error(&encoded, &error);
19126                                return Err(common::Error::JsonDecodeError(
19127                                    encoded.to_string(),
19128                                    error,
19129                                ));
19130                            }
19131                        }
19132                    };
19133
19134                    dlg.finished(true);
19135                    return Ok(response);
19136                }
19137            }
19138        }
19139    }
19140
19141    /// 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.
19142    ///
19143    /// Sets the *resource* path property to the given value.
19144    ///
19145    /// Even though the property as already been set when instantiating this call,
19146    /// we provide this method for API completeness.
19147    pub fn resource(mut self, new_value: &str) -> ProjectLocationPipelineGetIamPolicyCall<'a, C> {
19148        self._resource = new_value.to_string();
19149        self
19150    }
19151    /// 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).
19152    ///
19153    /// Sets the *options.requested policy version* query property to the given value.
19154    pub fn options_requested_policy_version(
19155        mut self,
19156        new_value: i32,
19157    ) -> ProjectLocationPipelineGetIamPolicyCall<'a, C> {
19158        self._options_requested_policy_version = Some(new_value);
19159        self
19160    }
19161    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19162    /// while executing the actual API request.
19163    ///
19164    /// ````text
19165    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19166    /// ````
19167    ///
19168    /// Sets the *delegate* property to the given value.
19169    pub fn delegate(
19170        mut self,
19171        new_value: &'a mut dyn common::Delegate,
19172    ) -> ProjectLocationPipelineGetIamPolicyCall<'a, C> {
19173        self._delegate = Some(new_value);
19174        self
19175    }
19176
19177    /// Set any additional parameter of the query string used in the request.
19178    /// It should be used to set parameters which are not yet available through their own
19179    /// setters.
19180    ///
19181    /// Please note that this method must not be used to set any of the known parameters
19182    /// which have their own setter method. If done anyway, the request will fail.
19183    ///
19184    /// # Additional Parameters
19185    ///
19186    /// * *$.xgafv* (query-string) - V1 error format.
19187    /// * *access_token* (query-string) - OAuth access token.
19188    /// * *alt* (query-string) - Data format for response.
19189    /// * *callback* (query-string) - JSONP
19190    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19191    /// * *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.
19192    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19193    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19194    /// * *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.
19195    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19196    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19197    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineGetIamPolicyCall<'a, C>
19198    where
19199        T: AsRef<str>,
19200    {
19201        self._additional_params
19202            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19203        self
19204    }
19205
19206    /// Identifies the authorization scope for the method you are building.
19207    ///
19208    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19209    /// [`Scope::CloudPlatform`].
19210    ///
19211    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19212    /// tokens for more than one scope.
19213    ///
19214    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19215    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19216    /// sufficient, a read-write scope will do as well.
19217    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineGetIamPolicyCall<'a, C>
19218    where
19219        St: AsRef<str>,
19220    {
19221        self._scopes.insert(String::from(scope.as_ref()));
19222        self
19223    }
19224    /// Identifies the authorization scope(s) for the method you are building.
19225    ///
19226    /// See [`Self::add_scope()`] for details.
19227    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineGetIamPolicyCall<'a, C>
19228    where
19229        I: IntoIterator<Item = St>,
19230        St: AsRef<str>,
19231    {
19232        self._scopes
19233            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19234        self
19235    }
19236
19237    /// Removes all scopes, and no default scope will be used either.
19238    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19239    /// for details).
19240    pub fn clear_scopes(mut self) -> ProjectLocationPipelineGetIamPolicyCall<'a, C> {
19241        self._scopes.clear();
19242        self
19243    }
19244}
19245
19246/// List pipelines.
19247///
19248/// A builder for the *locations.pipelines.list* method supported by a *project* resource.
19249/// It is not used directly, but through a [`ProjectMethods`] instance.
19250///
19251/// # Example
19252///
19253/// Instantiate a resource method builder
19254///
19255/// ```test_harness,no_run
19256/// # extern crate hyper;
19257/// # extern crate hyper_rustls;
19258/// # extern crate google_eventarc1 as eventarc1;
19259/// # async fn dox() {
19260/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19261///
19262/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19263/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19264/// #     .with_native_roots()
19265/// #     .unwrap()
19266/// #     .https_only()
19267/// #     .enable_http2()
19268/// #     .build();
19269///
19270/// # let executor = hyper_util::rt::TokioExecutor::new();
19271/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19272/// #     secret,
19273/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19274/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19275/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19276/// #     ),
19277/// # ).build().await.unwrap();
19278///
19279/// # let client = hyper_util::client::legacy::Client::builder(
19280/// #     hyper_util::rt::TokioExecutor::new()
19281/// # )
19282/// # .build(
19283/// #     hyper_rustls::HttpsConnectorBuilder::new()
19284/// #         .with_native_roots()
19285/// #         .unwrap()
19286/// #         .https_or_http()
19287/// #         .enable_http2()
19288/// #         .build()
19289/// # );
19290/// # let mut hub = Eventarc::new(client, auth);
19291/// // You can configure optional parameters by calling the respective setters at will, and
19292/// // execute the final call using `doit()`.
19293/// // Values shown here are possibly random and not representative !
19294/// let result = hub.projects().locations_pipelines_list("parent")
19295///              .page_token("elitr")
19296///              .page_size(-20)
19297///              .order_by("diam")
19298///              .filter("est")
19299///              .doit().await;
19300/// # }
19301/// ```
19302pub struct ProjectLocationPipelineListCall<'a, C>
19303where
19304    C: 'a,
19305{
19306    hub: &'a Eventarc<C>,
19307    _parent: String,
19308    _page_token: Option<String>,
19309    _page_size: Option<i32>,
19310    _order_by: Option<String>,
19311    _filter: Option<String>,
19312    _delegate: Option<&'a mut dyn common::Delegate>,
19313    _additional_params: HashMap<String, String>,
19314    _scopes: BTreeSet<String>,
19315}
19316
19317impl<'a, C> common::CallBuilder for ProjectLocationPipelineListCall<'a, C> {}
19318
19319impl<'a, C> ProjectLocationPipelineListCall<'a, C>
19320where
19321    C: common::Connector,
19322{
19323    /// Perform the operation you have build so far.
19324    pub async fn doit(mut self) -> common::Result<(common::Response, ListPipelinesResponse)> {
19325        use std::borrow::Cow;
19326        use std::io::{Read, Seek};
19327
19328        use common::{url::Params, ToParts};
19329        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19330
19331        let mut dd = common::DefaultDelegate;
19332        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19333        dlg.begin(common::MethodInfo {
19334            id: "eventarc.projects.locations.pipelines.list",
19335            http_method: hyper::Method::GET,
19336        });
19337
19338        for &field in [
19339            "alt",
19340            "parent",
19341            "pageToken",
19342            "pageSize",
19343            "orderBy",
19344            "filter",
19345        ]
19346        .iter()
19347        {
19348            if self._additional_params.contains_key(field) {
19349                dlg.finished(false);
19350                return Err(common::Error::FieldClash(field));
19351            }
19352        }
19353
19354        let mut params = Params::with_capacity(7 + self._additional_params.len());
19355        params.push("parent", self._parent);
19356        if let Some(value) = self._page_token.as_ref() {
19357            params.push("pageToken", value);
19358        }
19359        if let Some(value) = self._page_size.as_ref() {
19360            params.push("pageSize", value.to_string());
19361        }
19362        if let Some(value) = self._order_by.as_ref() {
19363            params.push("orderBy", value);
19364        }
19365        if let Some(value) = self._filter.as_ref() {
19366            params.push("filter", value);
19367        }
19368
19369        params.extend(self._additional_params.iter());
19370
19371        params.push("alt", "json");
19372        let mut url = self.hub._base_url.clone() + "v1/{+parent}/pipelines";
19373        if self._scopes.is_empty() {
19374            self._scopes
19375                .insert(Scope::CloudPlatform.as_ref().to_string());
19376        }
19377
19378        #[allow(clippy::single_element_loop)]
19379        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19380            url = params.uri_replacement(url, param_name, find_this, true);
19381        }
19382        {
19383            let to_remove = ["parent"];
19384            params.remove_params(&to_remove);
19385        }
19386
19387        let url = params.parse_with_url(&url);
19388
19389        loop {
19390            let token = match self
19391                .hub
19392                .auth
19393                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19394                .await
19395            {
19396                Ok(token) => token,
19397                Err(e) => match dlg.token(e) {
19398                    Ok(token) => token,
19399                    Err(e) => {
19400                        dlg.finished(false);
19401                        return Err(common::Error::MissingToken(e));
19402                    }
19403                },
19404            };
19405            let mut req_result = {
19406                let client = &self.hub.client;
19407                dlg.pre_request();
19408                let mut req_builder = hyper::Request::builder()
19409                    .method(hyper::Method::GET)
19410                    .uri(url.as_str())
19411                    .header(USER_AGENT, self.hub._user_agent.clone());
19412
19413                if let Some(token) = token.as_ref() {
19414                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19415                }
19416
19417                let request = req_builder
19418                    .header(CONTENT_LENGTH, 0_u64)
19419                    .body(common::to_body::<String>(None));
19420
19421                client.request(request.unwrap()).await
19422            };
19423
19424            match req_result {
19425                Err(err) => {
19426                    if let common::Retry::After(d) = dlg.http_error(&err) {
19427                        sleep(d).await;
19428                        continue;
19429                    }
19430                    dlg.finished(false);
19431                    return Err(common::Error::HttpError(err));
19432                }
19433                Ok(res) => {
19434                    let (mut parts, body) = res.into_parts();
19435                    let mut body = common::Body::new(body);
19436                    if !parts.status.is_success() {
19437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19438                        let error = serde_json::from_str(&common::to_string(&bytes));
19439                        let response = common::to_response(parts, bytes.into());
19440
19441                        if let common::Retry::After(d) =
19442                            dlg.http_failure(&response, error.as_ref().ok())
19443                        {
19444                            sleep(d).await;
19445                            continue;
19446                        }
19447
19448                        dlg.finished(false);
19449
19450                        return Err(match error {
19451                            Ok(value) => common::Error::BadRequest(value),
19452                            _ => common::Error::Failure(response),
19453                        });
19454                    }
19455                    let response = {
19456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19457                        let encoded = common::to_string(&bytes);
19458                        match serde_json::from_str(&encoded) {
19459                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19460                            Err(error) => {
19461                                dlg.response_json_decode_error(&encoded, &error);
19462                                return Err(common::Error::JsonDecodeError(
19463                                    encoded.to_string(),
19464                                    error,
19465                                ));
19466                            }
19467                        }
19468                    };
19469
19470                    dlg.finished(true);
19471                    return Ok(response);
19472                }
19473            }
19474        }
19475    }
19476
19477    /// Required. The parent collection to list pipelines on.
19478    ///
19479    /// Sets the *parent* path property to the given value.
19480    ///
19481    /// Even though the property as already been set when instantiating this call,
19482    /// we provide this method for API completeness.
19483    pub fn parent(mut self, new_value: &str) -> ProjectLocationPipelineListCall<'a, C> {
19484        self._parent = new_value.to_string();
19485        self
19486    }
19487    /// Optional. The page token; provide the value from the `next_page_token` field in a previous call to retrieve the subsequent page. When paginating, all other parameters provided must match the previous call that provided the page token.
19488    ///
19489    /// Sets the *page token* query property to the given value.
19490    pub fn page_token(mut self, new_value: &str) -> ProjectLocationPipelineListCall<'a, C> {
19491        self._page_token = Some(new_value.to_string());
19492        self
19493    }
19494    /// Optional. The maximum number of results to return on each page. Note: The service may send fewer.
19495    ///
19496    /// Sets the *page size* query property to the given value.
19497    pub fn page_size(mut self, new_value: i32) -> ProjectLocationPipelineListCall<'a, C> {
19498        self._page_size = Some(new_value);
19499        self
19500    }
19501    /// Optional. The sorting order of the resources returned. Value should be a comma-separated list of fields. The default sorting order is ascending. To specify descending order for a field, append a `desc` suffix; for example: `name desc, update_time`.
19502    ///
19503    /// Sets the *order by* query property to the given value.
19504    pub fn order_by(mut self, new_value: &str) -> ProjectLocationPipelineListCall<'a, C> {
19505        self._order_by = Some(new_value.to_string());
19506        self
19507    }
19508    /// Optional. The filter field that the list request will filter on. Possible filters are described in https://google.aip.dev/160.
19509    ///
19510    /// Sets the *filter* query property to the given value.
19511    pub fn filter(mut self, new_value: &str) -> ProjectLocationPipelineListCall<'a, C> {
19512        self._filter = Some(new_value.to_string());
19513        self
19514    }
19515    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19516    /// while executing the actual API request.
19517    ///
19518    /// ````text
19519    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19520    /// ````
19521    ///
19522    /// Sets the *delegate* property to the given value.
19523    pub fn delegate(
19524        mut self,
19525        new_value: &'a mut dyn common::Delegate,
19526    ) -> ProjectLocationPipelineListCall<'a, C> {
19527        self._delegate = Some(new_value);
19528        self
19529    }
19530
19531    /// Set any additional parameter of the query string used in the request.
19532    /// It should be used to set parameters which are not yet available through their own
19533    /// setters.
19534    ///
19535    /// Please note that this method must not be used to set any of the known parameters
19536    /// which have their own setter method. If done anyway, the request will fail.
19537    ///
19538    /// # Additional Parameters
19539    ///
19540    /// * *$.xgafv* (query-string) - V1 error format.
19541    /// * *access_token* (query-string) - OAuth access token.
19542    /// * *alt* (query-string) - Data format for response.
19543    /// * *callback* (query-string) - JSONP
19544    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19545    /// * *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.
19546    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19547    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19548    /// * *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.
19549    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19550    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19551    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineListCall<'a, C>
19552    where
19553        T: AsRef<str>,
19554    {
19555        self._additional_params
19556            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19557        self
19558    }
19559
19560    /// Identifies the authorization scope for the method you are building.
19561    ///
19562    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19563    /// [`Scope::CloudPlatform`].
19564    ///
19565    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19566    /// tokens for more than one scope.
19567    ///
19568    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19569    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19570    /// sufficient, a read-write scope will do as well.
19571    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineListCall<'a, C>
19572    where
19573        St: AsRef<str>,
19574    {
19575        self._scopes.insert(String::from(scope.as_ref()));
19576        self
19577    }
19578    /// Identifies the authorization scope(s) for the method you are building.
19579    ///
19580    /// See [`Self::add_scope()`] for details.
19581    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineListCall<'a, C>
19582    where
19583        I: IntoIterator<Item = St>,
19584        St: AsRef<str>,
19585    {
19586        self._scopes
19587            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19588        self
19589    }
19590
19591    /// Removes all scopes, and no default scope will be used either.
19592    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19593    /// for details).
19594    pub fn clear_scopes(mut self) -> ProjectLocationPipelineListCall<'a, C> {
19595        self._scopes.clear();
19596        self
19597    }
19598}
19599
19600/// Update a single pipeline.
19601///
19602/// A builder for the *locations.pipelines.patch* method supported by a *project* resource.
19603/// It is not used directly, but through a [`ProjectMethods`] instance.
19604///
19605/// # Example
19606///
19607/// Instantiate a resource method builder
19608///
19609/// ```test_harness,no_run
19610/// # extern crate hyper;
19611/// # extern crate hyper_rustls;
19612/// # extern crate google_eventarc1 as eventarc1;
19613/// use eventarc1::api::Pipeline;
19614/// # async fn dox() {
19615/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19616///
19617/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19618/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19619/// #     .with_native_roots()
19620/// #     .unwrap()
19621/// #     .https_only()
19622/// #     .enable_http2()
19623/// #     .build();
19624///
19625/// # let executor = hyper_util::rt::TokioExecutor::new();
19626/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19627/// #     secret,
19628/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19629/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19630/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19631/// #     ),
19632/// # ).build().await.unwrap();
19633///
19634/// # let client = hyper_util::client::legacy::Client::builder(
19635/// #     hyper_util::rt::TokioExecutor::new()
19636/// # )
19637/// # .build(
19638/// #     hyper_rustls::HttpsConnectorBuilder::new()
19639/// #         .with_native_roots()
19640/// #         .unwrap()
19641/// #         .https_or_http()
19642/// #         .enable_http2()
19643/// #         .build()
19644/// # );
19645/// # let mut hub = Eventarc::new(client, auth);
19646/// // As the method needs a request, you would usually fill it with the desired information
19647/// // into the respective structure. Some of the parts shown here might not be applicable !
19648/// // Values shown here are possibly random and not representative !
19649/// let mut req = Pipeline::default();
19650///
19651/// // You can configure optional parameters by calling the respective setters at will, and
19652/// // execute the final call using `doit()`.
19653/// // Values shown here are possibly random and not representative !
19654/// let result = hub.projects().locations_pipelines_patch(req, "name")
19655///              .validate_only(false)
19656///              .update_mask(FieldMask::new::<&str>(&[]))
19657///              .allow_missing(false)
19658///              .doit().await;
19659/// # }
19660/// ```
19661pub struct ProjectLocationPipelinePatchCall<'a, C>
19662where
19663    C: 'a,
19664{
19665    hub: &'a Eventarc<C>,
19666    _request: Pipeline,
19667    _name: String,
19668    _validate_only: Option<bool>,
19669    _update_mask: Option<common::FieldMask>,
19670    _allow_missing: Option<bool>,
19671    _delegate: Option<&'a mut dyn common::Delegate>,
19672    _additional_params: HashMap<String, String>,
19673    _scopes: BTreeSet<String>,
19674}
19675
19676impl<'a, C> common::CallBuilder for ProjectLocationPipelinePatchCall<'a, C> {}
19677
19678impl<'a, C> ProjectLocationPipelinePatchCall<'a, C>
19679where
19680    C: common::Connector,
19681{
19682    /// Perform the operation you have build so far.
19683    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
19684        use std::borrow::Cow;
19685        use std::io::{Read, Seek};
19686
19687        use common::{url::Params, ToParts};
19688        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19689
19690        let mut dd = common::DefaultDelegate;
19691        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19692        dlg.begin(common::MethodInfo {
19693            id: "eventarc.projects.locations.pipelines.patch",
19694            http_method: hyper::Method::PATCH,
19695        });
19696
19697        for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
19698            if self._additional_params.contains_key(field) {
19699                dlg.finished(false);
19700                return Err(common::Error::FieldClash(field));
19701            }
19702        }
19703
19704        let mut params = Params::with_capacity(7 + self._additional_params.len());
19705        params.push("name", self._name);
19706        if let Some(value) = self._validate_only.as_ref() {
19707            params.push("validateOnly", value.to_string());
19708        }
19709        if let Some(value) = self._update_mask.as_ref() {
19710            params.push("updateMask", value.to_string());
19711        }
19712        if let Some(value) = self._allow_missing.as_ref() {
19713            params.push("allowMissing", value.to_string());
19714        }
19715
19716        params.extend(self._additional_params.iter());
19717
19718        params.push("alt", "json");
19719        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19720        if self._scopes.is_empty() {
19721            self._scopes
19722                .insert(Scope::CloudPlatform.as_ref().to_string());
19723        }
19724
19725        #[allow(clippy::single_element_loop)]
19726        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19727            url = params.uri_replacement(url, param_name, find_this, true);
19728        }
19729        {
19730            let to_remove = ["name"];
19731            params.remove_params(&to_remove);
19732        }
19733
19734        let url = params.parse_with_url(&url);
19735
19736        let mut json_mime_type = mime::APPLICATION_JSON;
19737        let mut request_value_reader = {
19738            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19739            common::remove_json_null_values(&mut value);
19740            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19741            serde_json::to_writer(&mut dst, &value).unwrap();
19742            dst
19743        };
19744        let request_size = request_value_reader
19745            .seek(std::io::SeekFrom::End(0))
19746            .unwrap();
19747        request_value_reader
19748            .seek(std::io::SeekFrom::Start(0))
19749            .unwrap();
19750
19751        loop {
19752            let token = match self
19753                .hub
19754                .auth
19755                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19756                .await
19757            {
19758                Ok(token) => token,
19759                Err(e) => match dlg.token(e) {
19760                    Ok(token) => token,
19761                    Err(e) => {
19762                        dlg.finished(false);
19763                        return Err(common::Error::MissingToken(e));
19764                    }
19765                },
19766            };
19767            request_value_reader
19768                .seek(std::io::SeekFrom::Start(0))
19769                .unwrap();
19770            let mut req_result = {
19771                let client = &self.hub.client;
19772                dlg.pre_request();
19773                let mut req_builder = hyper::Request::builder()
19774                    .method(hyper::Method::PATCH)
19775                    .uri(url.as_str())
19776                    .header(USER_AGENT, self.hub._user_agent.clone());
19777
19778                if let Some(token) = token.as_ref() {
19779                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19780                }
19781
19782                let request = req_builder
19783                    .header(CONTENT_TYPE, json_mime_type.to_string())
19784                    .header(CONTENT_LENGTH, request_size as u64)
19785                    .body(common::to_body(
19786                        request_value_reader.get_ref().clone().into(),
19787                    ));
19788
19789                client.request(request.unwrap()).await
19790            };
19791
19792            match req_result {
19793                Err(err) => {
19794                    if let common::Retry::After(d) = dlg.http_error(&err) {
19795                        sleep(d).await;
19796                        continue;
19797                    }
19798                    dlg.finished(false);
19799                    return Err(common::Error::HttpError(err));
19800                }
19801                Ok(res) => {
19802                    let (mut parts, body) = res.into_parts();
19803                    let mut body = common::Body::new(body);
19804                    if !parts.status.is_success() {
19805                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19806                        let error = serde_json::from_str(&common::to_string(&bytes));
19807                        let response = common::to_response(parts, bytes.into());
19808
19809                        if let common::Retry::After(d) =
19810                            dlg.http_failure(&response, error.as_ref().ok())
19811                        {
19812                            sleep(d).await;
19813                            continue;
19814                        }
19815
19816                        dlg.finished(false);
19817
19818                        return Err(match error {
19819                            Ok(value) => common::Error::BadRequest(value),
19820                            _ => common::Error::Failure(response),
19821                        });
19822                    }
19823                    let response = {
19824                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19825                        let encoded = common::to_string(&bytes);
19826                        match serde_json::from_str(&encoded) {
19827                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19828                            Err(error) => {
19829                                dlg.response_json_decode_error(&encoded, &error);
19830                                return Err(common::Error::JsonDecodeError(
19831                                    encoded.to_string(),
19832                                    error,
19833                                ));
19834                            }
19835                        }
19836                    };
19837
19838                    dlg.finished(true);
19839                    return Ok(response);
19840                }
19841            }
19842        }
19843    }
19844
19845    ///
19846    /// Sets the *request* property to the given value.
19847    ///
19848    /// Even though the property as already been set when instantiating this call,
19849    /// we provide this method for API completeness.
19850    pub fn request(mut self, new_value: Pipeline) -> ProjectLocationPipelinePatchCall<'a, C> {
19851        self._request = new_value;
19852        self
19853    }
19854    /// Identifier. The resource name of the Pipeline. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/pipelines/{pipeline}` format.
19855    ///
19856    /// Sets the *name* path property to the given value.
19857    ///
19858    /// Even though the property as already been set when instantiating this call,
19859    /// we provide this method for API completeness.
19860    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelinePatchCall<'a, C> {
19861        self._name = new_value.to_string();
19862        self
19863    }
19864    /// Optional. If set, validate the request and preview the review, but do not post it.
19865    ///
19866    /// Sets the *validate only* query property to the given value.
19867    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationPipelinePatchCall<'a, C> {
19868        self._validate_only = Some(new_value);
19869        self
19870    }
19871    /// Optional. The fields to be updated; only fields explicitly provided are updated. If no field mask is provided, all provided fields in the request are updated. To update all fields, provide a field mask of "*".
19872    ///
19873    /// Sets the *update mask* query property to the given value.
19874    pub fn update_mask(
19875        mut self,
19876        new_value: common::FieldMask,
19877    ) -> ProjectLocationPipelinePatchCall<'a, C> {
19878        self._update_mask = Some(new_value);
19879        self
19880    }
19881    /// Optional. If set to true, and the Pipeline is not found, a new Pipeline will be created. In this situation, `update_mask` is ignored.
19882    ///
19883    /// Sets the *allow missing* query property to the given value.
19884    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationPipelinePatchCall<'a, C> {
19885        self._allow_missing = Some(new_value);
19886        self
19887    }
19888    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19889    /// while executing the actual API request.
19890    ///
19891    /// ````text
19892    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19893    /// ````
19894    ///
19895    /// Sets the *delegate* property to the given value.
19896    pub fn delegate(
19897        mut self,
19898        new_value: &'a mut dyn common::Delegate,
19899    ) -> ProjectLocationPipelinePatchCall<'a, C> {
19900        self._delegate = Some(new_value);
19901        self
19902    }
19903
19904    /// Set any additional parameter of the query string used in the request.
19905    /// It should be used to set parameters which are not yet available through their own
19906    /// setters.
19907    ///
19908    /// Please note that this method must not be used to set any of the known parameters
19909    /// which have their own setter method. If done anyway, the request will fail.
19910    ///
19911    /// # Additional Parameters
19912    ///
19913    /// * *$.xgafv* (query-string) - V1 error format.
19914    /// * *access_token* (query-string) - OAuth access token.
19915    /// * *alt* (query-string) - Data format for response.
19916    /// * *callback* (query-string) - JSONP
19917    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19918    /// * *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.
19919    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19920    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19921    /// * *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.
19922    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19923    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19924    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelinePatchCall<'a, C>
19925    where
19926        T: AsRef<str>,
19927    {
19928        self._additional_params
19929            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19930        self
19931    }
19932
19933    /// Identifies the authorization scope for the method you are building.
19934    ///
19935    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19936    /// [`Scope::CloudPlatform`].
19937    ///
19938    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19939    /// tokens for more than one scope.
19940    ///
19941    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19942    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19943    /// sufficient, a read-write scope will do as well.
19944    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelinePatchCall<'a, C>
19945    where
19946        St: AsRef<str>,
19947    {
19948        self._scopes.insert(String::from(scope.as_ref()));
19949        self
19950    }
19951    /// Identifies the authorization scope(s) for the method you are building.
19952    ///
19953    /// See [`Self::add_scope()`] for details.
19954    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelinePatchCall<'a, C>
19955    where
19956        I: IntoIterator<Item = St>,
19957        St: AsRef<str>,
19958    {
19959        self._scopes
19960            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19961        self
19962    }
19963
19964    /// Removes all scopes, and no default scope will be used either.
19965    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19966    /// for details).
19967    pub fn clear_scopes(mut self) -> ProjectLocationPipelinePatchCall<'a, C> {
19968        self._scopes.clear();
19969        self
19970    }
19971}
19972
19973/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
19974///
19975/// A builder for the *locations.pipelines.setIamPolicy* method supported by a *project* resource.
19976/// It is not used directly, but through a [`ProjectMethods`] instance.
19977///
19978/// # Example
19979///
19980/// Instantiate a resource method builder
19981///
19982/// ```test_harness,no_run
19983/// # extern crate hyper;
19984/// # extern crate hyper_rustls;
19985/// # extern crate google_eventarc1 as eventarc1;
19986/// use eventarc1::api::SetIamPolicyRequest;
19987/// # async fn dox() {
19988/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19989///
19990/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19991/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19992/// #     .with_native_roots()
19993/// #     .unwrap()
19994/// #     .https_only()
19995/// #     .enable_http2()
19996/// #     .build();
19997///
19998/// # let executor = hyper_util::rt::TokioExecutor::new();
19999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20000/// #     secret,
20001/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20002/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20003/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20004/// #     ),
20005/// # ).build().await.unwrap();
20006///
20007/// # let client = hyper_util::client::legacy::Client::builder(
20008/// #     hyper_util::rt::TokioExecutor::new()
20009/// # )
20010/// # .build(
20011/// #     hyper_rustls::HttpsConnectorBuilder::new()
20012/// #         .with_native_roots()
20013/// #         .unwrap()
20014/// #         .https_or_http()
20015/// #         .enable_http2()
20016/// #         .build()
20017/// # );
20018/// # let mut hub = Eventarc::new(client, auth);
20019/// // As the method needs a request, you would usually fill it with the desired information
20020/// // into the respective structure. Some of the parts shown here might not be applicable !
20021/// // Values shown here are possibly random and not representative !
20022/// let mut req = SetIamPolicyRequest::default();
20023///
20024/// // You can configure optional parameters by calling the respective setters at will, and
20025/// // execute the final call using `doit()`.
20026/// // Values shown here are possibly random and not representative !
20027/// let result = hub.projects().locations_pipelines_set_iam_policy(req, "resource")
20028///              .doit().await;
20029/// # }
20030/// ```
20031pub struct ProjectLocationPipelineSetIamPolicyCall<'a, C>
20032where
20033    C: 'a,
20034{
20035    hub: &'a Eventarc<C>,
20036    _request: SetIamPolicyRequest,
20037    _resource: String,
20038    _delegate: Option<&'a mut dyn common::Delegate>,
20039    _additional_params: HashMap<String, String>,
20040    _scopes: BTreeSet<String>,
20041}
20042
20043impl<'a, C> common::CallBuilder for ProjectLocationPipelineSetIamPolicyCall<'a, C> {}
20044
20045impl<'a, C> ProjectLocationPipelineSetIamPolicyCall<'a, C>
20046where
20047    C: common::Connector,
20048{
20049    /// Perform the operation you have build so far.
20050    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
20051        use std::borrow::Cow;
20052        use std::io::{Read, Seek};
20053
20054        use common::{url::Params, ToParts};
20055        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20056
20057        let mut dd = common::DefaultDelegate;
20058        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20059        dlg.begin(common::MethodInfo {
20060            id: "eventarc.projects.locations.pipelines.setIamPolicy",
20061            http_method: hyper::Method::POST,
20062        });
20063
20064        for &field in ["alt", "resource"].iter() {
20065            if self._additional_params.contains_key(field) {
20066                dlg.finished(false);
20067                return Err(common::Error::FieldClash(field));
20068            }
20069        }
20070
20071        let mut params = Params::with_capacity(4 + self._additional_params.len());
20072        params.push("resource", self._resource);
20073
20074        params.extend(self._additional_params.iter());
20075
20076        params.push("alt", "json");
20077        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
20078        if self._scopes.is_empty() {
20079            self._scopes
20080                .insert(Scope::CloudPlatform.as_ref().to_string());
20081        }
20082
20083        #[allow(clippy::single_element_loop)]
20084        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20085            url = params.uri_replacement(url, param_name, find_this, true);
20086        }
20087        {
20088            let to_remove = ["resource"];
20089            params.remove_params(&to_remove);
20090        }
20091
20092        let url = params.parse_with_url(&url);
20093
20094        let mut json_mime_type = mime::APPLICATION_JSON;
20095        let mut request_value_reader = {
20096            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20097            common::remove_json_null_values(&mut value);
20098            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20099            serde_json::to_writer(&mut dst, &value).unwrap();
20100            dst
20101        };
20102        let request_size = request_value_reader
20103            .seek(std::io::SeekFrom::End(0))
20104            .unwrap();
20105        request_value_reader
20106            .seek(std::io::SeekFrom::Start(0))
20107            .unwrap();
20108
20109        loop {
20110            let token = match self
20111                .hub
20112                .auth
20113                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20114                .await
20115            {
20116                Ok(token) => token,
20117                Err(e) => match dlg.token(e) {
20118                    Ok(token) => token,
20119                    Err(e) => {
20120                        dlg.finished(false);
20121                        return Err(common::Error::MissingToken(e));
20122                    }
20123                },
20124            };
20125            request_value_reader
20126                .seek(std::io::SeekFrom::Start(0))
20127                .unwrap();
20128            let mut req_result = {
20129                let client = &self.hub.client;
20130                dlg.pre_request();
20131                let mut req_builder = hyper::Request::builder()
20132                    .method(hyper::Method::POST)
20133                    .uri(url.as_str())
20134                    .header(USER_AGENT, self.hub._user_agent.clone());
20135
20136                if let Some(token) = token.as_ref() {
20137                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20138                }
20139
20140                let request = req_builder
20141                    .header(CONTENT_TYPE, json_mime_type.to_string())
20142                    .header(CONTENT_LENGTH, request_size as u64)
20143                    .body(common::to_body(
20144                        request_value_reader.get_ref().clone().into(),
20145                    ));
20146
20147                client.request(request.unwrap()).await
20148            };
20149
20150            match req_result {
20151                Err(err) => {
20152                    if let common::Retry::After(d) = dlg.http_error(&err) {
20153                        sleep(d).await;
20154                        continue;
20155                    }
20156                    dlg.finished(false);
20157                    return Err(common::Error::HttpError(err));
20158                }
20159                Ok(res) => {
20160                    let (mut parts, body) = res.into_parts();
20161                    let mut body = common::Body::new(body);
20162                    if !parts.status.is_success() {
20163                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20164                        let error = serde_json::from_str(&common::to_string(&bytes));
20165                        let response = common::to_response(parts, bytes.into());
20166
20167                        if let common::Retry::After(d) =
20168                            dlg.http_failure(&response, error.as_ref().ok())
20169                        {
20170                            sleep(d).await;
20171                            continue;
20172                        }
20173
20174                        dlg.finished(false);
20175
20176                        return Err(match error {
20177                            Ok(value) => common::Error::BadRequest(value),
20178                            _ => common::Error::Failure(response),
20179                        });
20180                    }
20181                    let response = {
20182                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20183                        let encoded = common::to_string(&bytes);
20184                        match serde_json::from_str(&encoded) {
20185                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20186                            Err(error) => {
20187                                dlg.response_json_decode_error(&encoded, &error);
20188                                return Err(common::Error::JsonDecodeError(
20189                                    encoded.to_string(),
20190                                    error,
20191                                ));
20192                            }
20193                        }
20194                    };
20195
20196                    dlg.finished(true);
20197                    return Ok(response);
20198                }
20199            }
20200        }
20201    }
20202
20203    ///
20204    /// Sets the *request* property to the given value.
20205    ///
20206    /// Even though the property as already been set when instantiating this call,
20207    /// we provide this method for API completeness.
20208    pub fn request(
20209        mut self,
20210        new_value: SetIamPolicyRequest,
20211    ) -> ProjectLocationPipelineSetIamPolicyCall<'a, C> {
20212        self._request = new_value;
20213        self
20214    }
20215    /// 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.
20216    ///
20217    /// Sets the *resource* path property to the given value.
20218    ///
20219    /// Even though the property as already been set when instantiating this call,
20220    /// we provide this method for API completeness.
20221    pub fn resource(mut self, new_value: &str) -> ProjectLocationPipelineSetIamPolicyCall<'a, C> {
20222        self._resource = new_value.to_string();
20223        self
20224    }
20225    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20226    /// while executing the actual API request.
20227    ///
20228    /// ````text
20229    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20230    /// ````
20231    ///
20232    /// Sets the *delegate* property to the given value.
20233    pub fn delegate(
20234        mut self,
20235        new_value: &'a mut dyn common::Delegate,
20236    ) -> ProjectLocationPipelineSetIamPolicyCall<'a, C> {
20237        self._delegate = Some(new_value);
20238        self
20239    }
20240
20241    /// Set any additional parameter of the query string used in the request.
20242    /// It should be used to set parameters which are not yet available through their own
20243    /// setters.
20244    ///
20245    /// Please note that this method must not be used to set any of the known parameters
20246    /// which have their own setter method. If done anyway, the request will fail.
20247    ///
20248    /// # Additional Parameters
20249    ///
20250    /// * *$.xgafv* (query-string) - V1 error format.
20251    /// * *access_token* (query-string) - OAuth access token.
20252    /// * *alt* (query-string) - Data format for response.
20253    /// * *callback* (query-string) - JSONP
20254    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20255    /// * *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.
20256    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20257    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20258    /// * *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.
20259    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20260    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20261    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineSetIamPolicyCall<'a, C>
20262    where
20263        T: AsRef<str>,
20264    {
20265        self._additional_params
20266            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20267        self
20268    }
20269
20270    /// Identifies the authorization scope for the method you are building.
20271    ///
20272    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20273    /// [`Scope::CloudPlatform`].
20274    ///
20275    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20276    /// tokens for more than one scope.
20277    ///
20278    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20279    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20280    /// sufficient, a read-write scope will do as well.
20281    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineSetIamPolicyCall<'a, C>
20282    where
20283        St: AsRef<str>,
20284    {
20285        self._scopes.insert(String::from(scope.as_ref()));
20286        self
20287    }
20288    /// Identifies the authorization scope(s) for the method you are building.
20289    ///
20290    /// See [`Self::add_scope()`] for details.
20291    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineSetIamPolicyCall<'a, C>
20292    where
20293        I: IntoIterator<Item = St>,
20294        St: AsRef<str>,
20295    {
20296        self._scopes
20297            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20298        self
20299    }
20300
20301    /// Removes all scopes, and no default scope will be used either.
20302    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20303    /// for details).
20304    pub fn clear_scopes(mut self) -> ProjectLocationPipelineSetIamPolicyCall<'a, C> {
20305        self._scopes.clear();
20306        self
20307    }
20308}
20309
20310/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
20311///
20312/// A builder for the *locations.pipelines.testIamPermissions* method supported by a *project* resource.
20313/// It is not used directly, but through a [`ProjectMethods`] instance.
20314///
20315/// # Example
20316///
20317/// Instantiate a resource method builder
20318///
20319/// ```test_harness,no_run
20320/// # extern crate hyper;
20321/// # extern crate hyper_rustls;
20322/// # extern crate google_eventarc1 as eventarc1;
20323/// use eventarc1::api::TestIamPermissionsRequest;
20324/// # async fn dox() {
20325/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20326///
20327/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20328/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20329/// #     .with_native_roots()
20330/// #     .unwrap()
20331/// #     .https_only()
20332/// #     .enable_http2()
20333/// #     .build();
20334///
20335/// # let executor = hyper_util::rt::TokioExecutor::new();
20336/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20337/// #     secret,
20338/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20339/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20340/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20341/// #     ),
20342/// # ).build().await.unwrap();
20343///
20344/// # let client = hyper_util::client::legacy::Client::builder(
20345/// #     hyper_util::rt::TokioExecutor::new()
20346/// # )
20347/// # .build(
20348/// #     hyper_rustls::HttpsConnectorBuilder::new()
20349/// #         .with_native_roots()
20350/// #         .unwrap()
20351/// #         .https_or_http()
20352/// #         .enable_http2()
20353/// #         .build()
20354/// # );
20355/// # let mut hub = Eventarc::new(client, auth);
20356/// // As the method needs a request, you would usually fill it with the desired information
20357/// // into the respective structure. Some of the parts shown here might not be applicable !
20358/// // Values shown here are possibly random and not representative !
20359/// let mut req = TestIamPermissionsRequest::default();
20360///
20361/// // You can configure optional parameters by calling the respective setters at will, and
20362/// // execute the final call using `doit()`.
20363/// // Values shown here are possibly random and not representative !
20364/// let result = hub.projects().locations_pipelines_test_iam_permissions(req, "resource")
20365///              .doit().await;
20366/// # }
20367/// ```
20368pub struct ProjectLocationPipelineTestIamPermissionCall<'a, C>
20369where
20370    C: 'a,
20371{
20372    hub: &'a Eventarc<C>,
20373    _request: TestIamPermissionsRequest,
20374    _resource: String,
20375    _delegate: Option<&'a mut dyn common::Delegate>,
20376    _additional_params: HashMap<String, String>,
20377    _scopes: BTreeSet<String>,
20378}
20379
20380impl<'a, C> common::CallBuilder for ProjectLocationPipelineTestIamPermissionCall<'a, C> {}
20381
20382impl<'a, C> ProjectLocationPipelineTestIamPermissionCall<'a, C>
20383where
20384    C: common::Connector,
20385{
20386    /// Perform the operation you have build so far.
20387    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
20388        use std::borrow::Cow;
20389        use std::io::{Read, Seek};
20390
20391        use common::{url::Params, ToParts};
20392        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20393
20394        let mut dd = common::DefaultDelegate;
20395        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20396        dlg.begin(common::MethodInfo {
20397            id: "eventarc.projects.locations.pipelines.testIamPermissions",
20398            http_method: hyper::Method::POST,
20399        });
20400
20401        for &field in ["alt", "resource"].iter() {
20402            if self._additional_params.contains_key(field) {
20403                dlg.finished(false);
20404                return Err(common::Error::FieldClash(field));
20405            }
20406        }
20407
20408        let mut params = Params::with_capacity(4 + self._additional_params.len());
20409        params.push("resource", self._resource);
20410
20411        params.extend(self._additional_params.iter());
20412
20413        params.push("alt", "json");
20414        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
20415        if self._scopes.is_empty() {
20416            self._scopes
20417                .insert(Scope::CloudPlatform.as_ref().to_string());
20418        }
20419
20420        #[allow(clippy::single_element_loop)]
20421        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20422            url = params.uri_replacement(url, param_name, find_this, true);
20423        }
20424        {
20425            let to_remove = ["resource"];
20426            params.remove_params(&to_remove);
20427        }
20428
20429        let url = params.parse_with_url(&url);
20430
20431        let mut json_mime_type = mime::APPLICATION_JSON;
20432        let mut request_value_reader = {
20433            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20434            common::remove_json_null_values(&mut value);
20435            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20436            serde_json::to_writer(&mut dst, &value).unwrap();
20437            dst
20438        };
20439        let request_size = request_value_reader
20440            .seek(std::io::SeekFrom::End(0))
20441            .unwrap();
20442        request_value_reader
20443            .seek(std::io::SeekFrom::Start(0))
20444            .unwrap();
20445
20446        loop {
20447            let token = match self
20448                .hub
20449                .auth
20450                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20451                .await
20452            {
20453                Ok(token) => token,
20454                Err(e) => match dlg.token(e) {
20455                    Ok(token) => token,
20456                    Err(e) => {
20457                        dlg.finished(false);
20458                        return Err(common::Error::MissingToken(e));
20459                    }
20460                },
20461            };
20462            request_value_reader
20463                .seek(std::io::SeekFrom::Start(0))
20464                .unwrap();
20465            let mut req_result = {
20466                let client = &self.hub.client;
20467                dlg.pre_request();
20468                let mut req_builder = hyper::Request::builder()
20469                    .method(hyper::Method::POST)
20470                    .uri(url.as_str())
20471                    .header(USER_AGENT, self.hub._user_agent.clone());
20472
20473                if let Some(token) = token.as_ref() {
20474                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20475                }
20476
20477                let request = req_builder
20478                    .header(CONTENT_TYPE, json_mime_type.to_string())
20479                    .header(CONTENT_LENGTH, request_size as u64)
20480                    .body(common::to_body(
20481                        request_value_reader.get_ref().clone().into(),
20482                    ));
20483
20484                client.request(request.unwrap()).await
20485            };
20486
20487            match req_result {
20488                Err(err) => {
20489                    if let common::Retry::After(d) = dlg.http_error(&err) {
20490                        sleep(d).await;
20491                        continue;
20492                    }
20493                    dlg.finished(false);
20494                    return Err(common::Error::HttpError(err));
20495                }
20496                Ok(res) => {
20497                    let (mut parts, body) = res.into_parts();
20498                    let mut body = common::Body::new(body);
20499                    if !parts.status.is_success() {
20500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20501                        let error = serde_json::from_str(&common::to_string(&bytes));
20502                        let response = common::to_response(parts, bytes.into());
20503
20504                        if let common::Retry::After(d) =
20505                            dlg.http_failure(&response, error.as_ref().ok())
20506                        {
20507                            sleep(d).await;
20508                            continue;
20509                        }
20510
20511                        dlg.finished(false);
20512
20513                        return Err(match error {
20514                            Ok(value) => common::Error::BadRequest(value),
20515                            _ => common::Error::Failure(response),
20516                        });
20517                    }
20518                    let response = {
20519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20520                        let encoded = common::to_string(&bytes);
20521                        match serde_json::from_str(&encoded) {
20522                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20523                            Err(error) => {
20524                                dlg.response_json_decode_error(&encoded, &error);
20525                                return Err(common::Error::JsonDecodeError(
20526                                    encoded.to_string(),
20527                                    error,
20528                                ));
20529                            }
20530                        }
20531                    };
20532
20533                    dlg.finished(true);
20534                    return Ok(response);
20535                }
20536            }
20537        }
20538    }
20539
20540    ///
20541    /// Sets the *request* property to the given value.
20542    ///
20543    /// Even though the property as already been set when instantiating this call,
20544    /// we provide this method for API completeness.
20545    pub fn request(
20546        mut self,
20547        new_value: TestIamPermissionsRequest,
20548    ) -> ProjectLocationPipelineTestIamPermissionCall<'a, C> {
20549        self._request = new_value;
20550        self
20551    }
20552    /// 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.
20553    ///
20554    /// Sets the *resource* path property to the given value.
20555    ///
20556    /// Even though the property as already been set when instantiating this call,
20557    /// we provide this method for API completeness.
20558    pub fn resource(
20559        mut self,
20560        new_value: &str,
20561    ) -> ProjectLocationPipelineTestIamPermissionCall<'a, C> {
20562        self._resource = new_value.to_string();
20563        self
20564    }
20565    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20566    /// while executing the actual API request.
20567    ///
20568    /// ````text
20569    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20570    /// ````
20571    ///
20572    /// Sets the *delegate* property to the given value.
20573    pub fn delegate(
20574        mut self,
20575        new_value: &'a mut dyn common::Delegate,
20576    ) -> ProjectLocationPipelineTestIamPermissionCall<'a, C> {
20577        self._delegate = Some(new_value);
20578        self
20579    }
20580
20581    /// Set any additional parameter of the query string used in the request.
20582    /// It should be used to set parameters which are not yet available through their own
20583    /// setters.
20584    ///
20585    /// Please note that this method must not be used to set any of the known parameters
20586    /// which have their own setter method. If done anyway, the request will fail.
20587    ///
20588    /// # Additional Parameters
20589    ///
20590    /// * *$.xgafv* (query-string) - V1 error format.
20591    /// * *access_token* (query-string) - OAuth access token.
20592    /// * *alt* (query-string) - Data format for response.
20593    /// * *callback* (query-string) - JSONP
20594    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20595    /// * *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.
20596    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20597    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20598    /// * *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.
20599    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20600    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20601    pub fn param<T>(
20602        mut self,
20603        name: T,
20604        value: T,
20605    ) -> ProjectLocationPipelineTestIamPermissionCall<'a, C>
20606    where
20607        T: AsRef<str>,
20608    {
20609        self._additional_params
20610            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20611        self
20612    }
20613
20614    /// Identifies the authorization scope for the method you are building.
20615    ///
20616    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20617    /// [`Scope::CloudPlatform`].
20618    ///
20619    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20620    /// tokens for more than one scope.
20621    ///
20622    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20623    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20624    /// sufficient, a read-write scope will do as well.
20625    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineTestIamPermissionCall<'a, C>
20626    where
20627        St: AsRef<str>,
20628    {
20629        self._scopes.insert(String::from(scope.as_ref()));
20630        self
20631    }
20632    /// Identifies the authorization scope(s) for the method you are building.
20633    ///
20634    /// See [`Self::add_scope()`] for details.
20635    pub fn add_scopes<I, St>(
20636        mut self,
20637        scopes: I,
20638    ) -> ProjectLocationPipelineTestIamPermissionCall<'a, C>
20639    where
20640        I: IntoIterator<Item = St>,
20641        St: AsRef<str>,
20642    {
20643        self._scopes
20644            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20645        self
20646    }
20647
20648    /// Removes all scopes, and no default scope will be used either.
20649    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20650    /// for details).
20651    pub fn clear_scopes(mut self) -> ProjectLocationPipelineTestIamPermissionCall<'a, C> {
20652        self._scopes.clear();
20653        self
20654    }
20655}
20656
20657/// Get a single Provider.
20658///
20659/// A builder for the *locations.providers.get* method supported by a *project* resource.
20660/// It is not used directly, but through a [`ProjectMethods`] instance.
20661///
20662/// # Example
20663///
20664/// Instantiate a resource method builder
20665///
20666/// ```test_harness,no_run
20667/// # extern crate hyper;
20668/// # extern crate hyper_rustls;
20669/// # extern crate google_eventarc1 as eventarc1;
20670/// # async fn dox() {
20671/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20672///
20673/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20674/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20675/// #     .with_native_roots()
20676/// #     .unwrap()
20677/// #     .https_only()
20678/// #     .enable_http2()
20679/// #     .build();
20680///
20681/// # let executor = hyper_util::rt::TokioExecutor::new();
20682/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20683/// #     secret,
20684/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20685/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20686/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20687/// #     ),
20688/// # ).build().await.unwrap();
20689///
20690/// # let client = hyper_util::client::legacy::Client::builder(
20691/// #     hyper_util::rt::TokioExecutor::new()
20692/// # )
20693/// # .build(
20694/// #     hyper_rustls::HttpsConnectorBuilder::new()
20695/// #         .with_native_roots()
20696/// #         .unwrap()
20697/// #         .https_or_http()
20698/// #         .enable_http2()
20699/// #         .build()
20700/// # );
20701/// # let mut hub = Eventarc::new(client, auth);
20702/// // You can configure optional parameters by calling the respective setters at will, and
20703/// // execute the final call using `doit()`.
20704/// // Values shown here are possibly random and not representative !
20705/// let result = hub.projects().locations_providers_get("name")
20706///              .doit().await;
20707/// # }
20708/// ```
20709pub struct ProjectLocationProviderGetCall<'a, C>
20710where
20711    C: 'a,
20712{
20713    hub: &'a Eventarc<C>,
20714    _name: String,
20715    _delegate: Option<&'a mut dyn common::Delegate>,
20716    _additional_params: HashMap<String, String>,
20717    _scopes: BTreeSet<String>,
20718}
20719
20720impl<'a, C> common::CallBuilder for ProjectLocationProviderGetCall<'a, C> {}
20721
20722impl<'a, C> ProjectLocationProviderGetCall<'a, C>
20723where
20724    C: common::Connector,
20725{
20726    /// Perform the operation you have build so far.
20727    pub async fn doit(mut self) -> common::Result<(common::Response, Provider)> {
20728        use std::borrow::Cow;
20729        use std::io::{Read, Seek};
20730
20731        use common::{url::Params, ToParts};
20732        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20733
20734        let mut dd = common::DefaultDelegate;
20735        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20736        dlg.begin(common::MethodInfo {
20737            id: "eventarc.projects.locations.providers.get",
20738            http_method: hyper::Method::GET,
20739        });
20740
20741        for &field in ["alt", "name"].iter() {
20742            if self._additional_params.contains_key(field) {
20743                dlg.finished(false);
20744                return Err(common::Error::FieldClash(field));
20745            }
20746        }
20747
20748        let mut params = Params::with_capacity(3 + self._additional_params.len());
20749        params.push("name", self._name);
20750
20751        params.extend(self._additional_params.iter());
20752
20753        params.push("alt", "json");
20754        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20755        if self._scopes.is_empty() {
20756            self._scopes
20757                .insert(Scope::CloudPlatform.as_ref().to_string());
20758        }
20759
20760        #[allow(clippy::single_element_loop)]
20761        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20762            url = params.uri_replacement(url, param_name, find_this, true);
20763        }
20764        {
20765            let to_remove = ["name"];
20766            params.remove_params(&to_remove);
20767        }
20768
20769        let url = params.parse_with_url(&url);
20770
20771        loop {
20772            let token = match self
20773                .hub
20774                .auth
20775                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20776                .await
20777            {
20778                Ok(token) => token,
20779                Err(e) => match dlg.token(e) {
20780                    Ok(token) => token,
20781                    Err(e) => {
20782                        dlg.finished(false);
20783                        return Err(common::Error::MissingToken(e));
20784                    }
20785                },
20786            };
20787            let mut req_result = {
20788                let client = &self.hub.client;
20789                dlg.pre_request();
20790                let mut req_builder = hyper::Request::builder()
20791                    .method(hyper::Method::GET)
20792                    .uri(url.as_str())
20793                    .header(USER_AGENT, self.hub._user_agent.clone());
20794
20795                if let Some(token) = token.as_ref() {
20796                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20797                }
20798
20799                let request = req_builder
20800                    .header(CONTENT_LENGTH, 0_u64)
20801                    .body(common::to_body::<String>(None));
20802
20803                client.request(request.unwrap()).await
20804            };
20805
20806            match req_result {
20807                Err(err) => {
20808                    if let common::Retry::After(d) = dlg.http_error(&err) {
20809                        sleep(d).await;
20810                        continue;
20811                    }
20812                    dlg.finished(false);
20813                    return Err(common::Error::HttpError(err));
20814                }
20815                Ok(res) => {
20816                    let (mut parts, body) = res.into_parts();
20817                    let mut body = common::Body::new(body);
20818                    if !parts.status.is_success() {
20819                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20820                        let error = serde_json::from_str(&common::to_string(&bytes));
20821                        let response = common::to_response(parts, bytes.into());
20822
20823                        if let common::Retry::After(d) =
20824                            dlg.http_failure(&response, error.as_ref().ok())
20825                        {
20826                            sleep(d).await;
20827                            continue;
20828                        }
20829
20830                        dlg.finished(false);
20831
20832                        return Err(match error {
20833                            Ok(value) => common::Error::BadRequest(value),
20834                            _ => common::Error::Failure(response),
20835                        });
20836                    }
20837                    let response = {
20838                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20839                        let encoded = common::to_string(&bytes);
20840                        match serde_json::from_str(&encoded) {
20841                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20842                            Err(error) => {
20843                                dlg.response_json_decode_error(&encoded, &error);
20844                                return Err(common::Error::JsonDecodeError(
20845                                    encoded.to_string(),
20846                                    error,
20847                                ));
20848                            }
20849                        }
20850                    };
20851
20852                    dlg.finished(true);
20853                    return Ok(response);
20854                }
20855            }
20856        }
20857    }
20858
20859    /// Required. The name of the provider to get.
20860    ///
20861    /// Sets the *name* path property to the given value.
20862    ///
20863    /// Even though the property as already been set when instantiating this call,
20864    /// we provide this method for API completeness.
20865    pub fn name(mut self, new_value: &str) -> ProjectLocationProviderGetCall<'a, C> {
20866        self._name = new_value.to_string();
20867        self
20868    }
20869    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20870    /// while executing the actual API request.
20871    ///
20872    /// ````text
20873    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20874    /// ````
20875    ///
20876    /// Sets the *delegate* property to the given value.
20877    pub fn delegate(
20878        mut self,
20879        new_value: &'a mut dyn common::Delegate,
20880    ) -> ProjectLocationProviderGetCall<'a, C> {
20881        self._delegate = Some(new_value);
20882        self
20883    }
20884
20885    /// Set any additional parameter of the query string used in the request.
20886    /// It should be used to set parameters which are not yet available through their own
20887    /// setters.
20888    ///
20889    /// Please note that this method must not be used to set any of the known parameters
20890    /// which have their own setter method. If done anyway, the request will fail.
20891    ///
20892    /// # Additional Parameters
20893    ///
20894    /// * *$.xgafv* (query-string) - V1 error format.
20895    /// * *access_token* (query-string) - OAuth access token.
20896    /// * *alt* (query-string) - Data format for response.
20897    /// * *callback* (query-string) - JSONP
20898    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20899    /// * *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.
20900    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20901    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20902    /// * *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.
20903    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20904    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20905    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderGetCall<'a, C>
20906    where
20907        T: AsRef<str>,
20908    {
20909        self._additional_params
20910            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20911        self
20912    }
20913
20914    /// Identifies the authorization scope for the method you are building.
20915    ///
20916    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20917    /// [`Scope::CloudPlatform`].
20918    ///
20919    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20920    /// tokens for more than one scope.
20921    ///
20922    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20923    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20924    /// sufficient, a read-write scope will do as well.
20925    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderGetCall<'a, C>
20926    where
20927        St: AsRef<str>,
20928    {
20929        self._scopes.insert(String::from(scope.as_ref()));
20930        self
20931    }
20932    /// Identifies the authorization scope(s) for the method you are building.
20933    ///
20934    /// See [`Self::add_scope()`] for details.
20935    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderGetCall<'a, C>
20936    where
20937        I: IntoIterator<Item = St>,
20938        St: AsRef<str>,
20939    {
20940        self._scopes
20941            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20942        self
20943    }
20944
20945    /// Removes all scopes, and no default scope will be used either.
20946    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20947    /// for details).
20948    pub fn clear_scopes(mut self) -> ProjectLocationProviderGetCall<'a, C> {
20949        self._scopes.clear();
20950        self
20951    }
20952}
20953
20954/// List providers.
20955///
20956/// A builder for the *locations.providers.list* method supported by a *project* resource.
20957/// It is not used directly, but through a [`ProjectMethods`] instance.
20958///
20959/// # Example
20960///
20961/// Instantiate a resource method builder
20962///
20963/// ```test_harness,no_run
20964/// # extern crate hyper;
20965/// # extern crate hyper_rustls;
20966/// # extern crate google_eventarc1 as eventarc1;
20967/// # async fn dox() {
20968/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20969///
20970/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20971/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20972/// #     .with_native_roots()
20973/// #     .unwrap()
20974/// #     .https_only()
20975/// #     .enable_http2()
20976/// #     .build();
20977///
20978/// # let executor = hyper_util::rt::TokioExecutor::new();
20979/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20980/// #     secret,
20981/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20982/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20983/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20984/// #     ),
20985/// # ).build().await.unwrap();
20986///
20987/// # let client = hyper_util::client::legacy::Client::builder(
20988/// #     hyper_util::rt::TokioExecutor::new()
20989/// # )
20990/// # .build(
20991/// #     hyper_rustls::HttpsConnectorBuilder::new()
20992/// #         .with_native_roots()
20993/// #         .unwrap()
20994/// #         .https_or_http()
20995/// #         .enable_http2()
20996/// #         .build()
20997/// # );
20998/// # let mut hub = Eventarc::new(client, auth);
20999/// // You can configure optional parameters by calling the respective setters at will, and
21000/// // execute the final call using `doit()`.
21001/// // Values shown here are possibly random and not representative !
21002/// let result = hub.projects().locations_providers_list("parent")
21003///              .page_token("eos")
21004///              .page_size(-68)
21005///              .order_by("sea")
21006///              .filter("et")
21007///              .doit().await;
21008/// # }
21009/// ```
21010pub struct ProjectLocationProviderListCall<'a, C>
21011where
21012    C: 'a,
21013{
21014    hub: &'a Eventarc<C>,
21015    _parent: String,
21016    _page_token: Option<String>,
21017    _page_size: Option<i32>,
21018    _order_by: Option<String>,
21019    _filter: Option<String>,
21020    _delegate: Option<&'a mut dyn common::Delegate>,
21021    _additional_params: HashMap<String, String>,
21022    _scopes: BTreeSet<String>,
21023}
21024
21025impl<'a, C> common::CallBuilder for ProjectLocationProviderListCall<'a, C> {}
21026
21027impl<'a, C> ProjectLocationProviderListCall<'a, C>
21028where
21029    C: common::Connector,
21030{
21031    /// Perform the operation you have build so far.
21032    pub async fn doit(mut self) -> common::Result<(common::Response, ListProvidersResponse)> {
21033        use std::borrow::Cow;
21034        use std::io::{Read, Seek};
21035
21036        use common::{url::Params, ToParts};
21037        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21038
21039        let mut dd = common::DefaultDelegate;
21040        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21041        dlg.begin(common::MethodInfo {
21042            id: "eventarc.projects.locations.providers.list",
21043            http_method: hyper::Method::GET,
21044        });
21045
21046        for &field in [
21047            "alt",
21048            "parent",
21049            "pageToken",
21050            "pageSize",
21051            "orderBy",
21052            "filter",
21053        ]
21054        .iter()
21055        {
21056            if self._additional_params.contains_key(field) {
21057                dlg.finished(false);
21058                return Err(common::Error::FieldClash(field));
21059            }
21060        }
21061
21062        let mut params = Params::with_capacity(7 + self._additional_params.len());
21063        params.push("parent", self._parent);
21064        if let Some(value) = self._page_token.as_ref() {
21065            params.push("pageToken", value);
21066        }
21067        if let Some(value) = self._page_size.as_ref() {
21068            params.push("pageSize", value.to_string());
21069        }
21070        if let Some(value) = self._order_by.as_ref() {
21071            params.push("orderBy", value);
21072        }
21073        if let Some(value) = self._filter.as_ref() {
21074            params.push("filter", value);
21075        }
21076
21077        params.extend(self._additional_params.iter());
21078
21079        params.push("alt", "json");
21080        let mut url = self.hub._base_url.clone() + "v1/{+parent}/providers";
21081        if self._scopes.is_empty() {
21082            self._scopes
21083                .insert(Scope::CloudPlatform.as_ref().to_string());
21084        }
21085
21086        #[allow(clippy::single_element_loop)]
21087        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21088            url = params.uri_replacement(url, param_name, find_this, true);
21089        }
21090        {
21091            let to_remove = ["parent"];
21092            params.remove_params(&to_remove);
21093        }
21094
21095        let url = params.parse_with_url(&url);
21096
21097        loop {
21098            let token = match self
21099                .hub
21100                .auth
21101                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21102                .await
21103            {
21104                Ok(token) => token,
21105                Err(e) => match dlg.token(e) {
21106                    Ok(token) => token,
21107                    Err(e) => {
21108                        dlg.finished(false);
21109                        return Err(common::Error::MissingToken(e));
21110                    }
21111                },
21112            };
21113            let mut req_result = {
21114                let client = &self.hub.client;
21115                dlg.pre_request();
21116                let mut req_builder = hyper::Request::builder()
21117                    .method(hyper::Method::GET)
21118                    .uri(url.as_str())
21119                    .header(USER_AGENT, self.hub._user_agent.clone());
21120
21121                if let Some(token) = token.as_ref() {
21122                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21123                }
21124
21125                let request = req_builder
21126                    .header(CONTENT_LENGTH, 0_u64)
21127                    .body(common::to_body::<String>(None));
21128
21129                client.request(request.unwrap()).await
21130            };
21131
21132            match req_result {
21133                Err(err) => {
21134                    if let common::Retry::After(d) = dlg.http_error(&err) {
21135                        sleep(d).await;
21136                        continue;
21137                    }
21138                    dlg.finished(false);
21139                    return Err(common::Error::HttpError(err));
21140                }
21141                Ok(res) => {
21142                    let (mut parts, body) = res.into_parts();
21143                    let mut body = common::Body::new(body);
21144                    if !parts.status.is_success() {
21145                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21146                        let error = serde_json::from_str(&common::to_string(&bytes));
21147                        let response = common::to_response(parts, bytes.into());
21148
21149                        if let common::Retry::After(d) =
21150                            dlg.http_failure(&response, error.as_ref().ok())
21151                        {
21152                            sleep(d).await;
21153                            continue;
21154                        }
21155
21156                        dlg.finished(false);
21157
21158                        return Err(match error {
21159                            Ok(value) => common::Error::BadRequest(value),
21160                            _ => common::Error::Failure(response),
21161                        });
21162                    }
21163                    let response = {
21164                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21165                        let encoded = common::to_string(&bytes);
21166                        match serde_json::from_str(&encoded) {
21167                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21168                            Err(error) => {
21169                                dlg.response_json_decode_error(&encoded, &error);
21170                                return Err(common::Error::JsonDecodeError(
21171                                    encoded.to_string(),
21172                                    error,
21173                                ));
21174                            }
21175                        }
21176                    };
21177
21178                    dlg.finished(true);
21179                    return Ok(response);
21180                }
21181            }
21182        }
21183    }
21184
21185    /// Required. The parent of the provider to get.
21186    ///
21187    /// Sets the *parent* path property to the given value.
21188    ///
21189    /// Even though the property as already been set when instantiating this call,
21190    /// we provide this method for API completeness.
21191    pub fn parent(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
21192        self._parent = new_value.to_string();
21193        self
21194    }
21195    /// The page token; provide the value from the `next_page_token` field in a previous `ListProviders` call to retrieve the subsequent page. When paginating, all other parameters provided to `ListProviders` must match the call that provided the page token.
21196    ///
21197    /// Sets the *page token* query property to the given value.
21198    pub fn page_token(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
21199        self._page_token = Some(new_value.to_string());
21200        self
21201    }
21202    /// The maximum number of providers to return on each page.
21203    ///
21204    /// Sets the *page size* query property to the given value.
21205    pub fn page_size(mut self, new_value: i32) -> ProjectLocationProviderListCall<'a, C> {
21206        self._page_size = Some(new_value);
21207        self
21208    }
21209    /// The sorting order of the resources returned. Value should be a comma-separated list of fields. The default sorting oder is ascending. To specify descending order for a field, append a `desc` suffix; for example: `name desc, _id`.
21210    ///
21211    /// Sets the *order by* query property to the given value.
21212    pub fn order_by(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
21213        self._order_by = Some(new_value.to_string());
21214        self
21215    }
21216    /// The filter field that the list request will filter on.
21217    ///
21218    /// Sets the *filter* query property to the given value.
21219    pub fn filter(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
21220        self._filter = Some(new_value.to_string());
21221        self
21222    }
21223    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21224    /// while executing the actual API request.
21225    ///
21226    /// ````text
21227    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21228    /// ````
21229    ///
21230    /// Sets the *delegate* property to the given value.
21231    pub fn delegate(
21232        mut self,
21233        new_value: &'a mut dyn common::Delegate,
21234    ) -> ProjectLocationProviderListCall<'a, C> {
21235        self._delegate = Some(new_value);
21236        self
21237    }
21238
21239    /// Set any additional parameter of the query string used in the request.
21240    /// It should be used to set parameters which are not yet available through their own
21241    /// setters.
21242    ///
21243    /// Please note that this method must not be used to set any of the known parameters
21244    /// which have their own setter method. If done anyway, the request will fail.
21245    ///
21246    /// # Additional Parameters
21247    ///
21248    /// * *$.xgafv* (query-string) - V1 error format.
21249    /// * *access_token* (query-string) - OAuth access token.
21250    /// * *alt* (query-string) - Data format for response.
21251    /// * *callback* (query-string) - JSONP
21252    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21253    /// * *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.
21254    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21255    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21256    /// * *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.
21257    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21258    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21259    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderListCall<'a, C>
21260    where
21261        T: AsRef<str>,
21262    {
21263        self._additional_params
21264            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21265        self
21266    }
21267
21268    /// Identifies the authorization scope for the method you are building.
21269    ///
21270    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21271    /// [`Scope::CloudPlatform`].
21272    ///
21273    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21274    /// tokens for more than one scope.
21275    ///
21276    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21277    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21278    /// sufficient, a read-write scope will do as well.
21279    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderListCall<'a, C>
21280    where
21281        St: AsRef<str>,
21282    {
21283        self._scopes.insert(String::from(scope.as_ref()));
21284        self
21285    }
21286    /// Identifies the authorization scope(s) for the method you are building.
21287    ///
21288    /// See [`Self::add_scope()`] for details.
21289    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderListCall<'a, C>
21290    where
21291        I: IntoIterator<Item = St>,
21292        St: AsRef<str>,
21293    {
21294        self._scopes
21295            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21296        self
21297    }
21298
21299    /// Removes all scopes, and no default scope will be used either.
21300    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21301    /// for details).
21302    pub fn clear_scopes(mut self) -> ProjectLocationProviderListCall<'a, C> {
21303        self._scopes.clear();
21304        self
21305    }
21306}
21307
21308/// Create a new trigger in a particular project and location.
21309///
21310/// A builder for the *locations.triggers.create* method supported by a *project* resource.
21311/// It is not used directly, but through a [`ProjectMethods`] instance.
21312///
21313/// # Example
21314///
21315/// Instantiate a resource method builder
21316///
21317/// ```test_harness,no_run
21318/// # extern crate hyper;
21319/// # extern crate hyper_rustls;
21320/// # extern crate google_eventarc1 as eventarc1;
21321/// use eventarc1::api::Trigger;
21322/// # async fn dox() {
21323/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21324///
21325/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21326/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21327/// #     .with_native_roots()
21328/// #     .unwrap()
21329/// #     .https_only()
21330/// #     .enable_http2()
21331/// #     .build();
21332///
21333/// # let executor = hyper_util::rt::TokioExecutor::new();
21334/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21335/// #     secret,
21336/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21337/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21338/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21339/// #     ),
21340/// # ).build().await.unwrap();
21341///
21342/// # let client = hyper_util::client::legacy::Client::builder(
21343/// #     hyper_util::rt::TokioExecutor::new()
21344/// # )
21345/// # .build(
21346/// #     hyper_rustls::HttpsConnectorBuilder::new()
21347/// #         .with_native_roots()
21348/// #         .unwrap()
21349/// #         .https_or_http()
21350/// #         .enable_http2()
21351/// #         .build()
21352/// # );
21353/// # let mut hub = Eventarc::new(client, auth);
21354/// // As the method needs a request, you would usually fill it with the desired information
21355/// // into the respective structure. Some of the parts shown here might not be applicable !
21356/// // Values shown here are possibly random and not representative !
21357/// let mut req = Trigger::default();
21358///
21359/// // You can configure optional parameters by calling the respective setters at will, and
21360/// // execute the final call using `doit()`.
21361/// // Values shown here are possibly random and not representative !
21362/// let result = hub.projects().locations_triggers_create(req, "parent")
21363///              .validate_only(false)
21364///              .trigger_id("eirmod")
21365///              .doit().await;
21366/// # }
21367/// ```
21368pub struct ProjectLocationTriggerCreateCall<'a, C>
21369where
21370    C: 'a,
21371{
21372    hub: &'a Eventarc<C>,
21373    _request: Trigger,
21374    _parent: String,
21375    _validate_only: Option<bool>,
21376    _trigger_id: Option<String>,
21377    _delegate: Option<&'a mut dyn common::Delegate>,
21378    _additional_params: HashMap<String, String>,
21379    _scopes: BTreeSet<String>,
21380}
21381
21382impl<'a, C> common::CallBuilder for ProjectLocationTriggerCreateCall<'a, C> {}
21383
21384impl<'a, C> ProjectLocationTriggerCreateCall<'a, C>
21385where
21386    C: common::Connector,
21387{
21388    /// Perform the operation you have build so far.
21389    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
21390        use std::borrow::Cow;
21391        use std::io::{Read, Seek};
21392
21393        use common::{url::Params, ToParts};
21394        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21395
21396        let mut dd = common::DefaultDelegate;
21397        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21398        dlg.begin(common::MethodInfo {
21399            id: "eventarc.projects.locations.triggers.create",
21400            http_method: hyper::Method::POST,
21401        });
21402
21403        for &field in ["alt", "parent", "validateOnly", "triggerId"].iter() {
21404            if self._additional_params.contains_key(field) {
21405                dlg.finished(false);
21406                return Err(common::Error::FieldClash(field));
21407            }
21408        }
21409
21410        let mut params = Params::with_capacity(6 + self._additional_params.len());
21411        params.push("parent", self._parent);
21412        if let Some(value) = self._validate_only.as_ref() {
21413            params.push("validateOnly", value.to_string());
21414        }
21415        if let Some(value) = self._trigger_id.as_ref() {
21416            params.push("triggerId", value);
21417        }
21418
21419        params.extend(self._additional_params.iter());
21420
21421        params.push("alt", "json");
21422        let mut url = self.hub._base_url.clone() + "v1/{+parent}/triggers";
21423        if self._scopes.is_empty() {
21424            self._scopes
21425                .insert(Scope::CloudPlatform.as_ref().to_string());
21426        }
21427
21428        #[allow(clippy::single_element_loop)]
21429        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21430            url = params.uri_replacement(url, param_name, find_this, true);
21431        }
21432        {
21433            let to_remove = ["parent"];
21434            params.remove_params(&to_remove);
21435        }
21436
21437        let url = params.parse_with_url(&url);
21438
21439        let mut json_mime_type = mime::APPLICATION_JSON;
21440        let mut request_value_reader = {
21441            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21442            common::remove_json_null_values(&mut value);
21443            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21444            serde_json::to_writer(&mut dst, &value).unwrap();
21445            dst
21446        };
21447        let request_size = request_value_reader
21448            .seek(std::io::SeekFrom::End(0))
21449            .unwrap();
21450        request_value_reader
21451            .seek(std::io::SeekFrom::Start(0))
21452            .unwrap();
21453
21454        loop {
21455            let token = match self
21456                .hub
21457                .auth
21458                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21459                .await
21460            {
21461                Ok(token) => token,
21462                Err(e) => match dlg.token(e) {
21463                    Ok(token) => token,
21464                    Err(e) => {
21465                        dlg.finished(false);
21466                        return Err(common::Error::MissingToken(e));
21467                    }
21468                },
21469            };
21470            request_value_reader
21471                .seek(std::io::SeekFrom::Start(0))
21472                .unwrap();
21473            let mut req_result = {
21474                let client = &self.hub.client;
21475                dlg.pre_request();
21476                let mut req_builder = hyper::Request::builder()
21477                    .method(hyper::Method::POST)
21478                    .uri(url.as_str())
21479                    .header(USER_AGENT, self.hub._user_agent.clone());
21480
21481                if let Some(token) = token.as_ref() {
21482                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21483                }
21484
21485                let request = req_builder
21486                    .header(CONTENT_TYPE, json_mime_type.to_string())
21487                    .header(CONTENT_LENGTH, request_size as u64)
21488                    .body(common::to_body(
21489                        request_value_reader.get_ref().clone().into(),
21490                    ));
21491
21492                client.request(request.unwrap()).await
21493            };
21494
21495            match req_result {
21496                Err(err) => {
21497                    if let common::Retry::After(d) = dlg.http_error(&err) {
21498                        sleep(d).await;
21499                        continue;
21500                    }
21501                    dlg.finished(false);
21502                    return Err(common::Error::HttpError(err));
21503                }
21504                Ok(res) => {
21505                    let (mut parts, body) = res.into_parts();
21506                    let mut body = common::Body::new(body);
21507                    if !parts.status.is_success() {
21508                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21509                        let error = serde_json::from_str(&common::to_string(&bytes));
21510                        let response = common::to_response(parts, bytes.into());
21511
21512                        if let common::Retry::After(d) =
21513                            dlg.http_failure(&response, error.as_ref().ok())
21514                        {
21515                            sleep(d).await;
21516                            continue;
21517                        }
21518
21519                        dlg.finished(false);
21520
21521                        return Err(match error {
21522                            Ok(value) => common::Error::BadRequest(value),
21523                            _ => common::Error::Failure(response),
21524                        });
21525                    }
21526                    let response = {
21527                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21528                        let encoded = common::to_string(&bytes);
21529                        match serde_json::from_str(&encoded) {
21530                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21531                            Err(error) => {
21532                                dlg.response_json_decode_error(&encoded, &error);
21533                                return Err(common::Error::JsonDecodeError(
21534                                    encoded.to_string(),
21535                                    error,
21536                                ));
21537                            }
21538                        }
21539                    };
21540
21541                    dlg.finished(true);
21542                    return Ok(response);
21543                }
21544            }
21545        }
21546    }
21547
21548    ///
21549    /// Sets the *request* property to the given value.
21550    ///
21551    /// Even though the property as already been set when instantiating this call,
21552    /// we provide this method for API completeness.
21553    pub fn request(mut self, new_value: Trigger) -> ProjectLocationTriggerCreateCall<'a, C> {
21554        self._request = new_value;
21555        self
21556    }
21557    /// Required. The parent collection in which to add this trigger.
21558    ///
21559    /// Sets the *parent* path property to the given value.
21560    ///
21561    /// Even though the property as already been set when instantiating this call,
21562    /// we provide this method for API completeness.
21563    pub fn parent(mut self, new_value: &str) -> ProjectLocationTriggerCreateCall<'a, C> {
21564        self._parent = new_value.to_string();
21565        self
21566    }
21567    /// Optional. If set, validate the request and preview the review, but do not post it.
21568    ///
21569    /// Sets the *validate only* query property to the given value.
21570    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTriggerCreateCall<'a, C> {
21571        self._validate_only = Some(new_value);
21572        self
21573    }
21574    /// Required. The user-provided ID to be assigned to the trigger.
21575    ///
21576    /// Sets the *trigger id* query property to the given value.
21577    pub fn trigger_id(mut self, new_value: &str) -> ProjectLocationTriggerCreateCall<'a, C> {
21578        self._trigger_id = Some(new_value.to_string());
21579        self
21580    }
21581    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21582    /// while executing the actual API request.
21583    ///
21584    /// ````text
21585    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21586    /// ````
21587    ///
21588    /// Sets the *delegate* property to the given value.
21589    pub fn delegate(
21590        mut self,
21591        new_value: &'a mut dyn common::Delegate,
21592    ) -> ProjectLocationTriggerCreateCall<'a, C> {
21593        self._delegate = Some(new_value);
21594        self
21595    }
21596
21597    /// Set any additional parameter of the query string used in the request.
21598    /// It should be used to set parameters which are not yet available through their own
21599    /// setters.
21600    ///
21601    /// Please note that this method must not be used to set any of the known parameters
21602    /// which have their own setter method. If done anyway, the request will fail.
21603    ///
21604    /// # Additional Parameters
21605    ///
21606    /// * *$.xgafv* (query-string) - V1 error format.
21607    /// * *access_token* (query-string) - OAuth access token.
21608    /// * *alt* (query-string) - Data format for response.
21609    /// * *callback* (query-string) - JSONP
21610    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21611    /// * *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.
21612    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21613    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21614    /// * *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.
21615    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21616    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21617    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTriggerCreateCall<'a, C>
21618    where
21619        T: AsRef<str>,
21620    {
21621        self._additional_params
21622            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21623        self
21624    }
21625
21626    /// Identifies the authorization scope for the method you are building.
21627    ///
21628    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21629    /// [`Scope::CloudPlatform`].
21630    ///
21631    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21632    /// tokens for more than one scope.
21633    ///
21634    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21635    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21636    /// sufficient, a read-write scope will do as well.
21637    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerCreateCall<'a, C>
21638    where
21639        St: AsRef<str>,
21640    {
21641        self._scopes.insert(String::from(scope.as_ref()));
21642        self
21643    }
21644    /// Identifies the authorization scope(s) for the method you are building.
21645    ///
21646    /// See [`Self::add_scope()`] for details.
21647    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTriggerCreateCall<'a, C>
21648    where
21649        I: IntoIterator<Item = St>,
21650        St: AsRef<str>,
21651    {
21652        self._scopes
21653            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21654        self
21655    }
21656
21657    /// Removes all scopes, and no default scope will be used either.
21658    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21659    /// for details).
21660    pub fn clear_scopes(mut self) -> ProjectLocationTriggerCreateCall<'a, C> {
21661        self._scopes.clear();
21662        self
21663    }
21664}
21665
21666/// Delete a single trigger.
21667///
21668/// A builder for the *locations.triggers.delete* method supported by a *project* resource.
21669/// It is not used directly, but through a [`ProjectMethods`] instance.
21670///
21671/// # Example
21672///
21673/// Instantiate a resource method builder
21674///
21675/// ```test_harness,no_run
21676/// # extern crate hyper;
21677/// # extern crate hyper_rustls;
21678/// # extern crate google_eventarc1 as eventarc1;
21679/// # async fn dox() {
21680/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21681///
21682/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21683/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21684/// #     .with_native_roots()
21685/// #     .unwrap()
21686/// #     .https_only()
21687/// #     .enable_http2()
21688/// #     .build();
21689///
21690/// # let executor = hyper_util::rt::TokioExecutor::new();
21691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21692/// #     secret,
21693/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21694/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21695/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21696/// #     ),
21697/// # ).build().await.unwrap();
21698///
21699/// # let client = hyper_util::client::legacy::Client::builder(
21700/// #     hyper_util::rt::TokioExecutor::new()
21701/// # )
21702/// # .build(
21703/// #     hyper_rustls::HttpsConnectorBuilder::new()
21704/// #         .with_native_roots()
21705/// #         .unwrap()
21706/// #         .https_or_http()
21707/// #         .enable_http2()
21708/// #         .build()
21709/// # );
21710/// # let mut hub = Eventarc::new(client, auth);
21711/// // You can configure optional parameters by calling the respective setters at will, and
21712/// // execute the final call using `doit()`.
21713/// // Values shown here are possibly random and not representative !
21714/// let result = hub.projects().locations_triggers_delete("name")
21715///              .validate_only(true)
21716///              .etag("erat")
21717///              .allow_missing(true)
21718///              .doit().await;
21719/// # }
21720/// ```
21721pub struct ProjectLocationTriggerDeleteCall<'a, C>
21722where
21723    C: 'a,
21724{
21725    hub: &'a Eventarc<C>,
21726    _name: String,
21727    _validate_only: Option<bool>,
21728    _etag: Option<String>,
21729    _allow_missing: Option<bool>,
21730    _delegate: Option<&'a mut dyn common::Delegate>,
21731    _additional_params: HashMap<String, String>,
21732    _scopes: BTreeSet<String>,
21733}
21734
21735impl<'a, C> common::CallBuilder for ProjectLocationTriggerDeleteCall<'a, C> {}
21736
21737impl<'a, C> ProjectLocationTriggerDeleteCall<'a, C>
21738where
21739    C: common::Connector,
21740{
21741    /// Perform the operation you have build so far.
21742    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
21743        use std::borrow::Cow;
21744        use std::io::{Read, Seek};
21745
21746        use common::{url::Params, ToParts};
21747        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21748
21749        let mut dd = common::DefaultDelegate;
21750        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21751        dlg.begin(common::MethodInfo {
21752            id: "eventarc.projects.locations.triggers.delete",
21753            http_method: hyper::Method::DELETE,
21754        });
21755
21756        for &field in ["alt", "name", "validateOnly", "etag", "allowMissing"].iter() {
21757            if self._additional_params.contains_key(field) {
21758                dlg.finished(false);
21759                return Err(common::Error::FieldClash(field));
21760            }
21761        }
21762
21763        let mut params = Params::with_capacity(6 + self._additional_params.len());
21764        params.push("name", self._name);
21765        if let Some(value) = self._validate_only.as_ref() {
21766            params.push("validateOnly", value.to_string());
21767        }
21768        if let Some(value) = self._etag.as_ref() {
21769            params.push("etag", value);
21770        }
21771        if let Some(value) = self._allow_missing.as_ref() {
21772            params.push("allowMissing", value.to_string());
21773        }
21774
21775        params.extend(self._additional_params.iter());
21776
21777        params.push("alt", "json");
21778        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21779        if self._scopes.is_empty() {
21780            self._scopes
21781                .insert(Scope::CloudPlatform.as_ref().to_string());
21782        }
21783
21784        #[allow(clippy::single_element_loop)]
21785        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21786            url = params.uri_replacement(url, param_name, find_this, true);
21787        }
21788        {
21789            let to_remove = ["name"];
21790            params.remove_params(&to_remove);
21791        }
21792
21793        let url = params.parse_with_url(&url);
21794
21795        loop {
21796            let token = match self
21797                .hub
21798                .auth
21799                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21800                .await
21801            {
21802                Ok(token) => token,
21803                Err(e) => match dlg.token(e) {
21804                    Ok(token) => token,
21805                    Err(e) => {
21806                        dlg.finished(false);
21807                        return Err(common::Error::MissingToken(e));
21808                    }
21809                },
21810            };
21811            let mut req_result = {
21812                let client = &self.hub.client;
21813                dlg.pre_request();
21814                let mut req_builder = hyper::Request::builder()
21815                    .method(hyper::Method::DELETE)
21816                    .uri(url.as_str())
21817                    .header(USER_AGENT, self.hub._user_agent.clone());
21818
21819                if let Some(token) = token.as_ref() {
21820                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21821                }
21822
21823                let request = req_builder
21824                    .header(CONTENT_LENGTH, 0_u64)
21825                    .body(common::to_body::<String>(None));
21826
21827                client.request(request.unwrap()).await
21828            };
21829
21830            match req_result {
21831                Err(err) => {
21832                    if let common::Retry::After(d) = dlg.http_error(&err) {
21833                        sleep(d).await;
21834                        continue;
21835                    }
21836                    dlg.finished(false);
21837                    return Err(common::Error::HttpError(err));
21838                }
21839                Ok(res) => {
21840                    let (mut parts, body) = res.into_parts();
21841                    let mut body = common::Body::new(body);
21842                    if !parts.status.is_success() {
21843                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21844                        let error = serde_json::from_str(&common::to_string(&bytes));
21845                        let response = common::to_response(parts, bytes.into());
21846
21847                        if let common::Retry::After(d) =
21848                            dlg.http_failure(&response, error.as_ref().ok())
21849                        {
21850                            sleep(d).await;
21851                            continue;
21852                        }
21853
21854                        dlg.finished(false);
21855
21856                        return Err(match error {
21857                            Ok(value) => common::Error::BadRequest(value),
21858                            _ => common::Error::Failure(response),
21859                        });
21860                    }
21861                    let response = {
21862                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21863                        let encoded = common::to_string(&bytes);
21864                        match serde_json::from_str(&encoded) {
21865                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21866                            Err(error) => {
21867                                dlg.response_json_decode_error(&encoded, &error);
21868                                return Err(common::Error::JsonDecodeError(
21869                                    encoded.to_string(),
21870                                    error,
21871                                ));
21872                            }
21873                        }
21874                    };
21875
21876                    dlg.finished(true);
21877                    return Ok(response);
21878                }
21879            }
21880        }
21881    }
21882
21883    /// Required. The name of the trigger to be deleted.
21884    ///
21885    /// Sets the *name* path property to the given value.
21886    ///
21887    /// Even though the property as already been set when instantiating this call,
21888    /// we provide this method for API completeness.
21889    pub fn name(mut self, new_value: &str) -> ProjectLocationTriggerDeleteCall<'a, C> {
21890        self._name = new_value.to_string();
21891        self
21892    }
21893    /// Optional. If set, validate the request and preview the review, but do not post it.
21894    ///
21895    /// Sets the *validate only* query property to the given value.
21896    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTriggerDeleteCall<'a, C> {
21897        self._validate_only = Some(new_value);
21898        self
21899    }
21900    /// If provided, the trigger will only be deleted if the etag matches the current etag on the resource.
21901    ///
21902    /// Sets the *etag* query property to the given value.
21903    pub fn etag(mut self, new_value: &str) -> ProjectLocationTriggerDeleteCall<'a, C> {
21904        self._etag = Some(new_value.to_string());
21905        self
21906    }
21907    /// If set to true, and the trigger is not found, the request will succeed but no action will be taken on the server.
21908    ///
21909    /// Sets the *allow missing* query property to the given value.
21910    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationTriggerDeleteCall<'a, C> {
21911        self._allow_missing = Some(new_value);
21912        self
21913    }
21914    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21915    /// while executing the actual API request.
21916    ///
21917    /// ````text
21918    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21919    /// ````
21920    ///
21921    /// Sets the *delegate* property to the given value.
21922    pub fn delegate(
21923        mut self,
21924        new_value: &'a mut dyn common::Delegate,
21925    ) -> ProjectLocationTriggerDeleteCall<'a, C> {
21926        self._delegate = Some(new_value);
21927        self
21928    }
21929
21930    /// Set any additional parameter of the query string used in the request.
21931    /// It should be used to set parameters which are not yet available through their own
21932    /// setters.
21933    ///
21934    /// Please note that this method must not be used to set any of the known parameters
21935    /// which have their own setter method. If done anyway, the request will fail.
21936    ///
21937    /// # Additional Parameters
21938    ///
21939    /// * *$.xgafv* (query-string) - V1 error format.
21940    /// * *access_token* (query-string) - OAuth access token.
21941    /// * *alt* (query-string) - Data format for response.
21942    /// * *callback* (query-string) - JSONP
21943    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21944    /// * *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.
21945    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21946    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21947    /// * *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.
21948    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21949    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21950    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTriggerDeleteCall<'a, C>
21951    where
21952        T: AsRef<str>,
21953    {
21954        self._additional_params
21955            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21956        self
21957    }
21958
21959    /// Identifies the authorization scope for the method you are building.
21960    ///
21961    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21962    /// [`Scope::CloudPlatform`].
21963    ///
21964    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21965    /// tokens for more than one scope.
21966    ///
21967    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21968    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21969    /// sufficient, a read-write scope will do as well.
21970    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerDeleteCall<'a, C>
21971    where
21972        St: AsRef<str>,
21973    {
21974        self._scopes.insert(String::from(scope.as_ref()));
21975        self
21976    }
21977    /// Identifies the authorization scope(s) for the method you are building.
21978    ///
21979    /// See [`Self::add_scope()`] for details.
21980    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTriggerDeleteCall<'a, C>
21981    where
21982        I: IntoIterator<Item = St>,
21983        St: AsRef<str>,
21984    {
21985        self._scopes
21986            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21987        self
21988    }
21989
21990    /// Removes all scopes, and no default scope will be used either.
21991    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21992    /// for details).
21993    pub fn clear_scopes(mut self) -> ProjectLocationTriggerDeleteCall<'a, C> {
21994        self._scopes.clear();
21995        self
21996    }
21997}
21998
21999/// Get a single trigger.
22000///
22001/// A builder for the *locations.triggers.get* method supported by a *project* resource.
22002/// It is not used directly, but through a [`ProjectMethods`] instance.
22003///
22004/// # Example
22005///
22006/// Instantiate a resource method builder
22007///
22008/// ```test_harness,no_run
22009/// # extern crate hyper;
22010/// # extern crate hyper_rustls;
22011/// # extern crate google_eventarc1 as eventarc1;
22012/// # async fn dox() {
22013/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22014///
22015/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22016/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22017/// #     .with_native_roots()
22018/// #     .unwrap()
22019/// #     .https_only()
22020/// #     .enable_http2()
22021/// #     .build();
22022///
22023/// # let executor = hyper_util::rt::TokioExecutor::new();
22024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22025/// #     secret,
22026/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22027/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22028/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22029/// #     ),
22030/// # ).build().await.unwrap();
22031///
22032/// # let client = hyper_util::client::legacy::Client::builder(
22033/// #     hyper_util::rt::TokioExecutor::new()
22034/// # )
22035/// # .build(
22036/// #     hyper_rustls::HttpsConnectorBuilder::new()
22037/// #         .with_native_roots()
22038/// #         .unwrap()
22039/// #         .https_or_http()
22040/// #         .enable_http2()
22041/// #         .build()
22042/// # );
22043/// # let mut hub = Eventarc::new(client, auth);
22044/// // You can configure optional parameters by calling the respective setters at will, and
22045/// // execute the final call using `doit()`.
22046/// // Values shown here are possibly random and not representative !
22047/// let result = hub.projects().locations_triggers_get("name")
22048///              .doit().await;
22049/// # }
22050/// ```
22051pub struct ProjectLocationTriggerGetCall<'a, C>
22052where
22053    C: 'a,
22054{
22055    hub: &'a Eventarc<C>,
22056    _name: String,
22057    _delegate: Option<&'a mut dyn common::Delegate>,
22058    _additional_params: HashMap<String, String>,
22059    _scopes: BTreeSet<String>,
22060}
22061
22062impl<'a, C> common::CallBuilder for ProjectLocationTriggerGetCall<'a, C> {}
22063
22064impl<'a, C> ProjectLocationTriggerGetCall<'a, C>
22065where
22066    C: common::Connector,
22067{
22068    /// Perform the operation you have build so far.
22069    pub async fn doit(mut self) -> common::Result<(common::Response, Trigger)> {
22070        use std::borrow::Cow;
22071        use std::io::{Read, Seek};
22072
22073        use common::{url::Params, ToParts};
22074        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22075
22076        let mut dd = common::DefaultDelegate;
22077        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22078        dlg.begin(common::MethodInfo {
22079            id: "eventarc.projects.locations.triggers.get",
22080            http_method: hyper::Method::GET,
22081        });
22082
22083        for &field in ["alt", "name"].iter() {
22084            if self._additional_params.contains_key(field) {
22085                dlg.finished(false);
22086                return Err(common::Error::FieldClash(field));
22087            }
22088        }
22089
22090        let mut params = Params::with_capacity(3 + self._additional_params.len());
22091        params.push("name", self._name);
22092
22093        params.extend(self._additional_params.iter());
22094
22095        params.push("alt", "json");
22096        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22097        if self._scopes.is_empty() {
22098            self._scopes
22099                .insert(Scope::CloudPlatform.as_ref().to_string());
22100        }
22101
22102        #[allow(clippy::single_element_loop)]
22103        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22104            url = params.uri_replacement(url, param_name, find_this, true);
22105        }
22106        {
22107            let to_remove = ["name"];
22108            params.remove_params(&to_remove);
22109        }
22110
22111        let url = params.parse_with_url(&url);
22112
22113        loop {
22114            let token = match self
22115                .hub
22116                .auth
22117                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22118                .await
22119            {
22120                Ok(token) => token,
22121                Err(e) => match dlg.token(e) {
22122                    Ok(token) => token,
22123                    Err(e) => {
22124                        dlg.finished(false);
22125                        return Err(common::Error::MissingToken(e));
22126                    }
22127                },
22128            };
22129            let mut req_result = {
22130                let client = &self.hub.client;
22131                dlg.pre_request();
22132                let mut req_builder = hyper::Request::builder()
22133                    .method(hyper::Method::GET)
22134                    .uri(url.as_str())
22135                    .header(USER_AGENT, self.hub._user_agent.clone());
22136
22137                if let Some(token) = token.as_ref() {
22138                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22139                }
22140
22141                let request = req_builder
22142                    .header(CONTENT_LENGTH, 0_u64)
22143                    .body(common::to_body::<String>(None));
22144
22145                client.request(request.unwrap()).await
22146            };
22147
22148            match req_result {
22149                Err(err) => {
22150                    if let common::Retry::After(d) = dlg.http_error(&err) {
22151                        sleep(d).await;
22152                        continue;
22153                    }
22154                    dlg.finished(false);
22155                    return Err(common::Error::HttpError(err));
22156                }
22157                Ok(res) => {
22158                    let (mut parts, body) = res.into_parts();
22159                    let mut body = common::Body::new(body);
22160                    if !parts.status.is_success() {
22161                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22162                        let error = serde_json::from_str(&common::to_string(&bytes));
22163                        let response = common::to_response(parts, bytes.into());
22164
22165                        if let common::Retry::After(d) =
22166                            dlg.http_failure(&response, error.as_ref().ok())
22167                        {
22168                            sleep(d).await;
22169                            continue;
22170                        }
22171
22172                        dlg.finished(false);
22173
22174                        return Err(match error {
22175                            Ok(value) => common::Error::BadRequest(value),
22176                            _ => common::Error::Failure(response),
22177                        });
22178                    }
22179                    let response = {
22180                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22181                        let encoded = common::to_string(&bytes);
22182                        match serde_json::from_str(&encoded) {
22183                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22184                            Err(error) => {
22185                                dlg.response_json_decode_error(&encoded, &error);
22186                                return Err(common::Error::JsonDecodeError(
22187                                    encoded.to_string(),
22188                                    error,
22189                                ));
22190                            }
22191                        }
22192                    };
22193
22194                    dlg.finished(true);
22195                    return Ok(response);
22196                }
22197            }
22198        }
22199    }
22200
22201    /// Required. The name of the trigger to get.
22202    ///
22203    /// Sets the *name* path property to the given value.
22204    ///
22205    /// Even though the property as already been set when instantiating this call,
22206    /// we provide this method for API completeness.
22207    pub fn name(mut self, new_value: &str) -> ProjectLocationTriggerGetCall<'a, C> {
22208        self._name = new_value.to_string();
22209        self
22210    }
22211    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22212    /// while executing the actual API request.
22213    ///
22214    /// ````text
22215    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22216    /// ````
22217    ///
22218    /// Sets the *delegate* property to the given value.
22219    pub fn delegate(
22220        mut self,
22221        new_value: &'a mut dyn common::Delegate,
22222    ) -> ProjectLocationTriggerGetCall<'a, C> {
22223        self._delegate = Some(new_value);
22224        self
22225    }
22226
22227    /// Set any additional parameter of the query string used in the request.
22228    /// It should be used to set parameters which are not yet available through their own
22229    /// setters.
22230    ///
22231    /// Please note that this method must not be used to set any of the known parameters
22232    /// which have their own setter method. If done anyway, the request will fail.
22233    ///
22234    /// # Additional Parameters
22235    ///
22236    /// * *$.xgafv* (query-string) - V1 error format.
22237    /// * *access_token* (query-string) - OAuth access token.
22238    /// * *alt* (query-string) - Data format for response.
22239    /// * *callback* (query-string) - JSONP
22240    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22241    /// * *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.
22242    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22243    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22244    /// * *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.
22245    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22246    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22247    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTriggerGetCall<'a, C>
22248    where
22249        T: AsRef<str>,
22250    {
22251        self._additional_params
22252            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22253        self
22254    }
22255
22256    /// Identifies the authorization scope for the method you are building.
22257    ///
22258    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22259    /// [`Scope::CloudPlatform`].
22260    ///
22261    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22262    /// tokens for more than one scope.
22263    ///
22264    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22265    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22266    /// sufficient, a read-write scope will do as well.
22267    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerGetCall<'a, C>
22268    where
22269        St: AsRef<str>,
22270    {
22271        self._scopes.insert(String::from(scope.as_ref()));
22272        self
22273    }
22274    /// Identifies the authorization scope(s) for the method you are building.
22275    ///
22276    /// See [`Self::add_scope()`] for details.
22277    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTriggerGetCall<'a, C>
22278    where
22279        I: IntoIterator<Item = St>,
22280        St: AsRef<str>,
22281    {
22282        self._scopes
22283            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22284        self
22285    }
22286
22287    /// Removes all scopes, and no default scope will be used either.
22288    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22289    /// for details).
22290    pub fn clear_scopes(mut self) -> ProjectLocationTriggerGetCall<'a, C> {
22291        self._scopes.clear();
22292        self
22293    }
22294}
22295
22296/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
22297///
22298/// A builder for the *locations.triggers.getIamPolicy* method supported by a *project* resource.
22299/// It is not used directly, but through a [`ProjectMethods`] instance.
22300///
22301/// # Example
22302///
22303/// Instantiate a resource method builder
22304///
22305/// ```test_harness,no_run
22306/// # extern crate hyper;
22307/// # extern crate hyper_rustls;
22308/// # extern crate google_eventarc1 as eventarc1;
22309/// # async fn dox() {
22310/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22311///
22312/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22313/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22314/// #     .with_native_roots()
22315/// #     .unwrap()
22316/// #     .https_only()
22317/// #     .enable_http2()
22318/// #     .build();
22319///
22320/// # let executor = hyper_util::rt::TokioExecutor::new();
22321/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22322/// #     secret,
22323/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22324/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22325/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22326/// #     ),
22327/// # ).build().await.unwrap();
22328///
22329/// # let client = hyper_util::client::legacy::Client::builder(
22330/// #     hyper_util::rt::TokioExecutor::new()
22331/// # )
22332/// # .build(
22333/// #     hyper_rustls::HttpsConnectorBuilder::new()
22334/// #         .with_native_roots()
22335/// #         .unwrap()
22336/// #         .https_or_http()
22337/// #         .enable_http2()
22338/// #         .build()
22339/// # );
22340/// # let mut hub = Eventarc::new(client, auth);
22341/// // You can configure optional parameters by calling the respective setters at will, and
22342/// // execute the final call using `doit()`.
22343/// // Values shown here are possibly random and not representative !
22344/// let result = hub.projects().locations_triggers_get_iam_policy("resource")
22345///              .options_requested_policy_version(-10)
22346///              .doit().await;
22347/// # }
22348/// ```
22349pub struct ProjectLocationTriggerGetIamPolicyCall<'a, C>
22350where
22351    C: 'a,
22352{
22353    hub: &'a Eventarc<C>,
22354    _resource: String,
22355    _options_requested_policy_version: Option<i32>,
22356    _delegate: Option<&'a mut dyn common::Delegate>,
22357    _additional_params: HashMap<String, String>,
22358    _scopes: BTreeSet<String>,
22359}
22360
22361impl<'a, C> common::CallBuilder for ProjectLocationTriggerGetIamPolicyCall<'a, C> {}
22362
22363impl<'a, C> ProjectLocationTriggerGetIamPolicyCall<'a, C>
22364where
22365    C: common::Connector,
22366{
22367    /// Perform the operation you have build so far.
22368    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22369        use std::borrow::Cow;
22370        use std::io::{Read, Seek};
22371
22372        use common::{url::Params, ToParts};
22373        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22374
22375        let mut dd = common::DefaultDelegate;
22376        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22377        dlg.begin(common::MethodInfo {
22378            id: "eventarc.projects.locations.triggers.getIamPolicy",
22379            http_method: hyper::Method::GET,
22380        });
22381
22382        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
22383            if self._additional_params.contains_key(field) {
22384                dlg.finished(false);
22385                return Err(common::Error::FieldClash(field));
22386            }
22387        }
22388
22389        let mut params = Params::with_capacity(4 + self._additional_params.len());
22390        params.push("resource", self._resource);
22391        if let Some(value) = self._options_requested_policy_version.as_ref() {
22392            params.push("options.requestedPolicyVersion", value.to_string());
22393        }
22394
22395        params.extend(self._additional_params.iter());
22396
22397        params.push("alt", "json");
22398        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
22399        if self._scopes.is_empty() {
22400            self._scopes
22401                .insert(Scope::CloudPlatform.as_ref().to_string());
22402        }
22403
22404        #[allow(clippy::single_element_loop)]
22405        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22406            url = params.uri_replacement(url, param_name, find_this, true);
22407        }
22408        {
22409            let to_remove = ["resource"];
22410            params.remove_params(&to_remove);
22411        }
22412
22413        let url = params.parse_with_url(&url);
22414
22415        loop {
22416            let token = match self
22417                .hub
22418                .auth
22419                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22420                .await
22421            {
22422                Ok(token) => token,
22423                Err(e) => match dlg.token(e) {
22424                    Ok(token) => token,
22425                    Err(e) => {
22426                        dlg.finished(false);
22427                        return Err(common::Error::MissingToken(e));
22428                    }
22429                },
22430            };
22431            let mut req_result = {
22432                let client = &self.hub.client;
22433                dlg.pre_request();
22434                let mut req_builder = hyper::Request::builder()
22435                    .method(hyper::Method::GET)
22436                    .uri(url.as_str())
22437                    .header(USER_AGENT, self.hub._user_agent.clone());
22438
22439                if let Some(token) = token.as_ref() {
22440                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22441                }
22442
22443                let request = req_builder
22444                    .header(CONTENT_LENGTH, 0_u64)
22445                    .body(common::to_body::<String>(None));
22446
22447                client.request(request.unwrap()).await
22448            };
22449
22450            match req_result {
22451                Err(err) => {
22452                    if let common::Retry::After(d) = dlg.http_error(&err) {
22453                        sleep(d).await;
22454                        continue;
22455                    }
22456                    dlg.finished(false);
22457                    return Err(common::Error::HttpError(err));
22458                }
22459                Ok(res) => {
22460                    let (mut parts, body) = res.into_parts();
22461                    let mut body = common::Body::new(body);
22462                    if !parts.status.is_success() {
22463                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22464                        let error = serde_json::from_str(&common::to_string(&bytes));
22465                        let response = common::to_response(parts, bytes.into());
22466
22467                        if let common::Retry::After(d) =
22468                            dlg.http_failure(&response, error.as_ref().ok())
22469                        {
22470                            sleep(d).await;
22471                            continue;
22472                        }
22473
22474                        dlg.finished(false);
22475
22476                        return Err(match error {
22477                            Ok(value) => common::Error::BadRequest(value),
22478                            _ => common::Error::Failure(response),
22479                        });
22480                    }
22481                    let response = {
22482                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22483                        let encoded = common::to_string(&bytes);
22484                        match serde_json::from_str(&encoded) {
22485                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22486                            Err(error) => {
22487                                dlg.response_json_decode_error(&encoded, &error);
22488                                return Err(common::Error::JsonDecodeError(
22489                                    encoded.to_string(),
22490                                    error,
22491                                ));
22492                            }
22493                        }
22494                    };
22495
22496                    dlg.finished(true);
22497                    return Ok(response);
22498                }
22499            }
22500        }
22501    }
22502
22503    /// 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.
22504    ///
22505    /// Sets the *resource* path property to the given value.
22506    ///
22507    /// Even though the property as already been set when instantiating this call,
22508    /// we provide this method for API completeness.
22509    pub fn resource(mut self, new_value: &str) -> ProjectLocationTriggerGetIamPolicyCall<'a, C> {
22510        self._resource = new_value.to_string();
22511        self
22512    }
22513    /// 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).
22514    ///
22515    /// Sets the *options.requested policy version* query property to the given value.
22516    pub fn options_requested_policy_version(
22517        mut self,
22518        new_value: i32,
22519    ) -> ProjectLocationTriggerGetIamPolicyCall<'a, C> {
22520        self._options_requested_policy_version = Some(new_value);
22521        self
22522    }
22523    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22524    /// while executing the actual API request.
22525    ///
22526    /// ````text
22527    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22528    /// ````
22529    ///
22530    /// Sets the *delegate* property to the given value.
22531    pub fn delegate(
22532        mut self,
22533        new_value: &'a mut dyn common::Delegate,
22534    ) -> ProjectLocationTriggerGetIamPolicyCall<'a, C> {
22535        self._delegate = Some(new_value);
22536        self
22537    }
22538
22539    /// Set any additional parameter of the query string used in the request.
22540    /// It should be used to set parameters which are not yet available through their own
22541    /// setters.
22542    ///
22543    /// Please note that this method must not be used to set any of the known parameters
22544    /// which have their own setter method. If done anyway, the request will fail.
22545    ///
22546    /// # Additional Parameters
22547    ///
22548    /// * *$.xgafv* (query-string) - V1 error format.
22549    /// * *access_token* (query-string) - OAuth access token.
22550    /// * *alt* (query-string) - Data format for response.
22551    /// * *callback* (query-string) - JSONP
22552    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22553    /// * *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.
22554    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22555    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22556    /// * *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.
22557    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22558    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22559    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTriggerGetIamPolicyCall<'a, C>
22560    where
22561        T: AsRef<str>,
22562    {
22563        self._additional_params
22564            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22565        self
22566    }
22567
22568    /// Identifies the authorization scope for the method you are building.
22569    ///
22570    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22571    /// [`Scope::CloudPlatform`].
22572    ///
22573    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22574    /// tokens for more than one scope.
22575    ///
22576    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22577    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22578    /// sufficient, a read-write scope will do as well.
22579    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerGetIamPolicyCall<'a, C>
22580    where
22581        St: AsRef<str>,
22582    {
22583        self._scopes.insert(String::from(scope.as_ref()));
22584        self
22585    }
22586    /// Identifies the authorization scope(s) for the method you are building.
22587    ///
22588    /// See [`Self::add_scope()`] for details.
22589    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTriggerGetIamPolicyCall<'a, C>
22590    where
22591        I: IntoIterator<Item = St>,
22592        St: AsRef<str>,
22593    {
22594        self._scopes
22595            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22596        self
22597    }
22598
22599    /// Removes all scopes, and no default scope will be used either.
22600    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22601    /// for details).
22602    pub fn clear_scopes(mut self) -> ProjectLocationTriggerGetIamPolicyCall<'a, C> {
22603        self._scopes.clear();
22604        self
22605    }
22606}
22607
22608/// List triggers.
22609///
22610/// A builder for the *locations.triggers.list* method supported by a *project* resource.
22611/// It is not used directly, but through a [`ProjectMethods`] instance.
22612///
22613/// # Example
22614///
22615/// Instantiate a resource method builder
22616///
22617/// ```test_harness,no_run
22618/// # extern crate hyper;
22619/// # extern crate hyper_rustls;
22620/// # extern crate google_eventarc1 as eventarc1;
22621/// # async fn dox() {
22622/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22623///
22624/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22625/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22626/// #     .with_native_roots()
22627/// #     .unwrap()
22628/// #     .https_only()
22629/// #     .enable_http2()
22630/// #     .build();
22631///
22632/// # let executor = hyper_util::rt::TokioExecutor::new();
22633/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22634/// #     secret,
22635/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22636/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22637/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22638/// #     ),
22639/// # ).build().await.unwrap();
22640///
22641/// # let client = hyper_util::client::legacy::Client::builder(
22642/// #     hyper_util::rt::TokioExecutor::new()
22643/// # )
22644/// # .build(
22645/// #     hyper_rustls::HttpsConnectorBuilder::new()
22646/// #         .with_native_roots()
22647/// #         .unwrap()
22648/// #         .https_or_http()
22649/// #         .enable_http2()
22650/// #         .build()
22651/// # );
22652/// # let mut hub = Eventarc::new(client, auth);
22653/// // You can configure optional parameters by calling the respective setters at will, and
22654/// // execute the final call using `doit()`.
22655/// // Values shown here are possibly random and not representative !
22656/// let result = hub.projects().locations_triggers_list("parent")
22657///              .page_token("Lorem")
22658///              .page_size(-22)
22659///              .order_by("At")
22660///              .filter("dolor")
22661///              .doit().await;
22662/// # }
22663/// ```
22664pub struct ProjectLocationTriggerListCall<'a, C>
22665where
22666    C: 'a,
22667{
22668    hub: &'a Eventarc<C>,
22669    _parent: String,
22670    _page_token: Option<String>,
22671    _page_size: Option<i32>,
22672    _order_by: Option<String>,
22673    _filter: Option<String>,
22674    _delegate: Option<&'a mut dyn common::Delegate>,
22675    _additional_params: HashMap<String, String>,
22676    _scopes: BTreeSet<String>,
22677}
22678
22679impl<'a, C> common::CallBuilder for ProjectLocationTriggerListCall<'a, C> {}
22680
22681impl<'a, C> ProjectLocationTriggerListCall<'a, C>
22682where
22683    C: common::Connector,
22684{
22685    /// Perform the operation you have build so far.
22686    pub async fn doit(mut self) -> common::Result<(common::Response, ListTriggersResponse)> {
22687        use std::borrow::Cow;
22688        use std::io::{Read, Seek};
22689
22690        use common::{url::Params, ToParts};
22691        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22692
22693        let mut dd = common::DefaultDelegate;
22694        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22695        dlg.begin(common::MethodInfo {
22696            id: "eventarc.projects.locations.triggers.list",
22697            http_method: hyper::Method::GET,
22698        });
22699
22700        for &field in [
22701            "alt",
22702            "parent",
22703            "pageToken",
22704            "pageSize",
22705            "orderBy",
22706            "filter",
22707        ]
22708        .iter()
22709        {
22710            if self._additional_params.contains_key(field) {
22711                dlg.finished(false);
22712                return Err(common::Error::FieldClash(field));
22713            }
22714        }
22715
22716        let mut params = Params::with_capacity(7 + self._additional_params.len());
22717        params.push("parent", self._parent);
22718        if let Some(value) = self._page_token.as_ref() {
22719            params.push("pageToken", value);
22720        }
22721        if let Some(value) = self._page_size.as_ref() {
22722            params.push("pageSize", value.to_string());
22723        }
22724        if let Some(value) = self._order_by.as_ref() {
22725            params.push("orderBy", value);
22726        }
22727        if let Some(value) = self._filter.as_ref() {
22728            params.push("filter", value);
22729        }
22730
22731        params.extend(self._additional_params.iter());
22732
22733        params.push("alt", "json");
22734        let mut url = self.hub._base_url.clone() + "v1/{+parent}/triggers";
22735        if self._scopes.is_empty() {
22736            self._scopes
22737                .insert(Scope::CloudPlatform.as_ref().to_string());
22738        }
22739
22740        #[allow(clippy::single_element_loop)]
22741        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22742            url = params.uri_replacement(url, param_name, find_this, true);
22743        }
22744        {
22745            let to_remove = ["parent"];
22746            params.remove_params(&to_remove);
22747        }
22748
22749        let url = params.parse_with_url(&url);
22750
22751        loop {
22752            let token = match self
22753                .hub
22754                .auth
22755                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22756                .await
22757            {
22758                Ok(token) => token,
22759                Err(e) => match dlg.token(e) {
22760                    Ok(token) => token,
22761                    Err(e) => {
22762                        dlg.finished(false);
22763                        return Err(common::Error::MissingToken(e));
22764                    }
22765                },
22766            };
22767            let mut req_result = {
22768                let client = &self.hub.client;
22769                dlg.pre_request();
22770                let mut req_builder = hyper::Request::builder()
22771                    .method(hyper::Method::GET)
22772                    .uri(url.as_str())
22773                    .header(USER_AGENT, self.hub._user_agent.clone());
22774
22775                if let Some(token) = token.as_ref() {
22776                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22777                }
22778
22779                let request = req_builder
22780                    .header(CONTENT_LENGTH, 0_u64)
22781                    .body(common::to_body::<String>(None));
22782
22783                client.request(request.unwrap()).await
22784            };
22785
22786            match req_result {
22787                Err(err) => {
22788                    if let common::Retry::After(d) = dlg.http_error(&err) {
22789                        sleep(d).await;
22790                        continue;
22791                    }
22792                    dlg.finished(false);
22793                    return Err(common::Error::HttpError(err));
22794                }
22795                Ok(res) => {
22796                    let (mut parts, body) = res.into_parts();
22797                    let mut body = common::Body::new(body);
22798                    if !parts.status.is_success() {
22799                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22800                        let error = serde_json::from_str(&common::to_string(&bytes));
22801                        let response = common::to_response(parts, bytes.into());
22802
22803                        if let common::Retry::After(d) =
22804                            dlg.http_failure(&response, error.as_ref().ok())
22805                        {
22806                            sleep(d).await;
22807                            continue;
22808                        }
22809
22810                        dlg.finished(false);
22811
22812                        return Err(match error {
22813                            Ok(value) => common::Error::BadRequest(value),
22814                            _ => common::Error::Failure(response),
22815                        });
22816                    }
22817                    let response = {
22818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22819                        let encoded = common::to_string(&bytes);
22820                        match serde_json::from_str(&encoded) {
22821                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22822                            Err(error) => {
22823                                dlg.response_json_decode_error(&encoded, &error);
22824                                return Err(common::Error::JsonDecodeError(
22825                                    encoded.to_string(),
22826                                    error,
22827                                ));
22828                            }
22829                        }
22830                    };
22831
22832                    dlg.finished(true);
22833                    return Ok(response);
22834                }
22835            }
22836        }
22837    }
22838
22839    /// Required. The parent collection to list triggers on.
22840    ///
22841    /// Sets the *parent* path property to the given value.
22842    ///
22843    /// Even though the property as already been set when instantiating this call,
22844    /// we provide this method for API completeness.
22845    pub fn parent(mut self, new_value: &str) -> ProjectLocationTriggerListCall<'a, C> {
22846        self._parent = new_value.to_string();
22847        self
22848    }
22849    /// The page token; provide the value from the `next_page_token` field in a previous `ListTriggers` call to retrieve the subsequent page. When paginating, all other parameters provided to `ListTriggers` must match the call that provided the page token.
22850    ///
22851    /// Sets the *page token* query property to the given value.
22852    pub fn page_token(mut self, new_value: &str) -> ProjectLocationTriggerListCall<'a, C> {
22853        self._page_token = Some(new_value.to_string());
22854        self
22855    }
22856    /// The maximum number of triggers to return on each page. Note: The service may send fewer.
22857    ///
22858    /// Sets the *page size* query property to the given value.
22859    pub fn page_size(mut self, new_value: i32) -> ProjectLocationTriggerListCall<'a, C> {
22860        self._page_size = Some(new_value);
22861        self
22862    }
22863    /// The sorting order of the resources returned. Value should be a comma-separated list of fields. The default sorting order is ascending. To specify descending order for a field, append a `desc` suffix; for example: `name desc, trigger_id`.
22864    ///
22865    /// Sets the *order by* query property to the given value.
22866    pub fn order_by(mut self, new_value: &str) -> ProjectLocationTriggerListCall<'a, C> {
22867        self._order_by = Some(new_value.to_string());
22868        self
22869    }
22870    /// Filter field. Used to filter the Triggers to be listed. Possible filters are described in https://google.aip.dev/160. For example, using "?filter=destination:gke" would list only Triggers with a gke destination.
22871    ///
22872    /// Sets the *filter* query property to the given value.
22873    pub fn filter(mut self, new_value: &str) -> ProjectLocationTriggerListCall<'a, C> {
22874        self._filter = Some(new_value.to_string());
22875        self
22876    }
22877    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22878    /// while executing the actual API request.
22879    ///
22880    /// ````text
22881    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22882    /// ````
22883    ///
22884    /// Sets the *delegate* property to the given value.
22885    pub fn delegate(
22886        mut self,
22887        new_value: &'a mut dyn common::Delegate,
22888    ) -> ProjectLocationTriggerListCall<'a, C> {
22889        self._delegate = Some(new_value);
22890        self
22891    }
22892
22893    /// Set any additional parameter of the query string used in the request.
22894    /// It should be used to set parameters which are not yet available through their own
22895    /// setters.
22896    ///
22897    /// Please note that this method must not be used to set any of the known parameters
22898    /// which have their own setter method. If done anyway, the request will fail.
22899    ///
22900    /// # Additional Parameters
22901    ///
22902    /// * *$.xgafv* (query-string) - V1 error format.
22903    /// * *access_token* (query-string) - OAuth access token.
22904    /// * *alt* (query-string) - Data format for response.
22905    /// * *callback* (query-string) - JSONP
22906    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22907    /// * *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.
22908    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22909    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22910    /// * *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.
22911    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22912    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22913    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTriggerListCall<'a, C>
22914    where
22915        T: AsRef<str>,
22916    {
22917        self._additional_params
22918            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22919        self
22920    }
22921
22922    /// Identifies the authorization scope for the method you are building.
22923    ///
22924    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22925    /// [`Scope::CloudPlatform`].
22926    ///
22927    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22928    /// tokens for more than one scope.
22929    ///
22930    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22931    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22932    /// sufficient, a read-write scope will do as well.
22933    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerListCall<'a, C>
22934    where
22935        St: AsRef<str>,
22936    {
22937        self._scopes.insert(String::from(scope.as_ref()));
22938        self
22939    }
22940    /// Identifies the authorization scope(s) for the method you are building.
22941    ///
22942    /// See [`Self::add_scope()`] for details.
22943    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTriggerListCall<'a, C>
22944    where
22945        I: IntoIterator<Item = St>,
22946        St: AsRef<str>,
22947    {
22948        self._scopes
22949            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22950        self
22951    }
22952
22953    /// Removes all scopes, and no default scope will be used either.
22954    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22955    /// for details).
22956    pub fn clear_scopes(mut self) -> ProjectLocationTriggerListCall<'a, C> {
22957        self._scopes.clear();
22958        self
22959    }
22960}
22961
22962/// Update a single trigger.
22963///
22964/// A builder for the *locations.triggers.patch* method supported by a *project* resource.
22965/// It is not used directly, but through a [`ProjectMethods`] instance.
22966///
22967/// # Example
22968///
22969/// Instantiate a resource method builder
22970///
22971/// ```test_harness,no_run
22972/// # extern crate hyper;
22973/// # extern crate hyper_rustls;
22974/// # extern crate google_eventarc1 as eventarc1;
22975/// use eventarc1::api::Trigger;
22976/// # async fn dox() {
22977/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22978///
22979/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22980/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22981/// #     .with_native_roots()
22982/// #     .unwrap()
22983/// #     .https_only()
22984/// #     .enable_http2()
22985/// #     .build();
22986///
22987/// # let executor = hyper_util::rt::TokioExecutor::new();
22988/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22989/// #     secret,
22990/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22991/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22992/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22993/// #     ),
22994/// # ).build().await.unwrap();
22995///
22996/// # let client = hyper_util::client::legacy::Client::builder(
22997/// #     hyper_util::rt::TokioExecutor::new()
22998/// # )
22999/// # .build(
23000/// #     hyper_rustls::HttpsConnectorBuilder::new()
23001/// #         .with_native_roots()
23002/// #         .unwrap()
23003/// #         .https_or_http()
23004/// #         .enable_http2()
23005/// #         .build()
23006/// # );
23007/// # let mut hub = Eventarc::new(client, auth);
23008/// // As the method needs a request, you would usually fill it with the desired information
23009/// // into the respective structure. Some of the parts shown here might not be applicable !
23010/// // Values shown here are possibly random and not representative !
23011/// let mut req = Trigger::default();
23012///
23013/// // You can configure optional parameters by calling the respective setters at will, and
23014/// // execute the final call using `doit()`.
23015/// // Values shown here are possibly random and not representative !
23016/// let result = hub.projects().locations_triggers_patch(req, "name")
23017///              .validate_only(true)
23018///              .update_mask(FieldMask::new::<&str>(&[]))
23019///              .allow_missing(false)
23020///              .doit().await;
23021/// # }
23022/// ```
23023pub struct ProjectLocationTriggerPatchCall<'a, C>
23024where
23025    C: 'a,
23026{
23027    hub: &'a Eventarc<C>,
23028    _request: Trigger,
23029    _name: String,
23030    _validate_only: Option<bool>,
23031    _update_mask: Option<common::FieldMask>,
23032    _allow_missing: Option<bool>,
23033    _delegate: Option<&'a mut dyn common::Delegate>,
23034    _additional_params: HashMap<String, String>,
23035    _scopes: BTreeSet<String>,
23036}
23037
23038impl<'a, C> common::CallBuilder for ProjectLocationTriggerPatchCall<'a, C> {}
23039
23040impl<'a, C> ProjectLocationTriggerPatchCall<'a, C>
23041where
23042    C: common::Connector,
23043{
23044    /// Perform the operation you have build so far.
23045    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
23046        use std::borrow::Cow;
23047        use std::io::{Read, Seek};
23048
23049        use common::{url::Params, ToParts};
23050        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23051
23052        let mut dd = common::DefaultDelegate;
23053        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23054        dlg.begin(common::MethodInfo {
23055            id: "eventarc.projects.locations.triggers.patch",
23056            http_method: hyper::Method::PATCH,
23057        });
23058
23059        for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
23060            if self._additional_params.contains_key(field) {
23061                dlg.finished(false);
23062                return Err(common::Error::FieldClash(field));
23063            }
23064        }
23065
23066        let mut params = Params::with_capacity(7 + self._additional_params.len());
23067        params.push("name", self._name);
23068        if let Some(value) = self._validate_only.as_ref() {
23069            params.push("validateOnly", value.to_string());
23070        }
23071        if let Some(value) = self._update_mask.as_ref() {
23072            params.push("updateMask", value.to_string());
23073        }
23074        if let Some(value) = self._allow_missing.as_ref() {
23075            params.push("allowMissing", value.to_string());
23076        }
23077
23078        params.extend(self._additional_params.iter());
23079
23080        params.push("alt", "json");
23081        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23082        if self._scopes.is_empty() {
23083            self._scopes
23084                .insert(Scope::CloudPlatform.as_ref().to_string());
23085        }
23086
23087        #[allow(clippy::single_element_loop)]
23088        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23089            url = params.uri_replacement(url, param_name, find_this, true);
23090        }
23091        {
23092            let to_remove = ["name"];
23093            params.remove_params(&to_remove);
23094        }
23095
23096        let url = params.parse_with_url(&url);
23097
23098        let mut json_mime_type = mime::APPLICATION_JSON;
23099        let mut request_value_reader = {
23100            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23101            common::remove_json_null_values(&mut value);
23102            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23103            serde_json::to_writer(&mut dst, &value).unwrap();
23104            dst
23105        };
23106        let request_size = request_value_reader
23107            .seek(std::io::SeekFrom::End(0))
23108            .unwrap();
23109        request_value_reader
23110            .seek(std::io::SeekFrom::Start(0))
23111            .unwrap();
23112
23113        loop {
23114            let token = match self
23115                .hub
23116                .auth
23117                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23118                .await
23119            {
23120                Ok(token) => token,
23121                Err(e) => match dlg.token(e) {
23122                    Ok(token) => token,
23123                    Err(e) => {
23124                        dlg.finished(false);
23125                        return Err(common::Error::MissingToken(e));
23126                    }
23127                },
23128            };
23129            request_value_reader
23130                .seek(std::io::SeekFrom::Start(0))
23131                .unwrap();
23132            let mut req_result = {
23133                let client = &self.hub.client;
23134                dlg.pre_request();
23135                let mut req_builder = hyper::Request::builder()
23136                    .method(hyper::Method::PATCH)
23137                    .uri(url.as_str())
23138                    .header(USER_AGENT, self.hub._user_agent.clone());
23139
23140                if let Some(token) = token.as_ref() {
23141                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23142                }
23143
23144                let request = req_builder
23145                    .header(CONTENT_TYPE, json_mime_type.to_string())
23146                    .header(CONTENT_LENGTH, request_size as u64)
23147                    .body(common::to_body(
23148                        request_value_reader.get_ref().clone().into(),
23149                    ));
23150
23151                client.request(request.unwrap()).await
23152            };
23153
23154            match req_result {
23155                Err(err) => {
23156                    if let common::Retry::After(d) = dlg.http_error(&err) {
23157                        sleep(d).await;
23158                        continue;
23159                    }
23160                    dlg.finished(false);
23161                    return Err(common::Error::HttpError(err));
23162                }
23163                Ok(res) => {
23164                    let (mut parts, body) = res.into_parts();
23165                    let mut body = common::Body::new(body);
23166                    if !parts.status.is_success() {
23167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23168                        let error = serde_json::from_str(&common::to_string(&bytes));
23169                        let response = common::to_response(parts, bytes.into());
23170
23171                        if let common::Retry::After(d) =
23172                            dlg.http_failure(&response, error.as_ref().ok())
23173                        {
23174                            sleep(d).await;
23175                            continue;
23176                        }
23177
23178                        dlg.finished(false);
23179
23180                        return Err(match error {
23181                            Ok(value) => common::Error::BadRequest(value),
23182                            _ => common::Error::Failure(response),
23183                        });
23184                    }
23185                    let response = {
23186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23187                        let encoded = common::to_string(&bytes);
23188                        match serde_json::from_str(&encoded) {
23189                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23190                            Err(error) => {
23191                                dlg.response_json_decode_error(&encoded, &error);
23192                                return Err(common::Error::JsonDecodeError(
23193                                    encoded.to_string(),
23194                                    error,
23195                                ));
23196                            }
23197                        }
23198                    };
23199
23200                    dlg.finished(true);
23201                    return Ok(response);
23202                }
23203            }
23204        }
23205    }
23206
23207    ///
23208    /// Sets the *request* property to the given value.
23209    ///
23210    /// Even though the property as already been set when instantiating this call,
23211    /// we provide this method for API completeness.
23212    pub fn request(mut self, new_value: Trigger) -> ProjectLocationTriggerPatchCall<'a, C> {
23213        self._request = new_value;
23214        self
23215    }
23216    /// Required. The resource name of the trigger. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/triggers/{trigger}` format.
23217    ///
23218    /// Sets the *name* path property to the given value.
23219    ///
23220    /// Even though the property as already been set when instantiating this call,
23221    /// we provide this method for API completeness.
23222    pub fn name(mut self, new_value: &str) -> ProjectLocationTriggerPatchCall<'a, C> {
23223        self._name = new_value.to_string();
23224        self
23225    }
23226    /// Optional. If set, validate the request and preview the review, but do not post it.
23227    ///
23228    /// Sets the *validate only* query property to the given value.
23229    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTriggerPatchCall<'a, C> {
23230        self._validate_only = Some(new_value);
23231        self
23232    }
23233    /// The fields to be updated; only fields explicitly provided are updated. If no field mask is provided, all provided fields in the request are updated. To update all fields, provide a field mask of "*".
23234    ///
23235    /// Sets the *update mask* query property to the given value.
23236    pub fn update_mask(
23237        mut self,
23238        new_value: common::FieldMask,
23239    ) -> ProjectLocationTriggerPatchCall<'a, C> {
23240        self._update_mask = Some(new_value);
23241        self
23242    }
23243    /// If set to true, and the trigger is not found, a new trigger will be created. In this situation, `update_mask` is ignored.
23244    ///
23245    /// Sets the *allow missing* query property to the given value.
23246    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationTriggerPatchCall<'a, C> {
23247        self._allow_missing = Some(new_value);
23248        self
23249    }
23250    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23251    /// while executing the actual API request.
23252    ///
23253    /// ````text
23254    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23255    /// ````
23256    ///
23257    /// Sets the *delegate* property to the given value.
23258    pub fn delegate(
23259        mut self,
23260        new_value: &'a mut dyn common::Delegate,
23261    ) -> ProjectLocationTriggerPatchCall<'a, C> {
23262        self._delegate = Some(new_value);
23263        self
23264    }
23265
23266    /// Set any additional parameter of the query string used in the request.
23267    /// It should be used to set parameters which are not yet available through their own
23268    /// setters.
23269    ///
23270    /// Please note that this method must not be used to set any of the known parameters
23271    /// which have their own setter method. If done anyway, the request will fail.
23272    ///
23273    /// # Additional Parameters
23274    ///
23275    /// * *$.xgafv* (query-string) - V1 error format.
23276    /// * *access_token* (query-string) - OAuth access token.
23277    /// * *alt* (query-string) - Data format for response.
23278    /// * *callback* (query-string) - JSONP
23279    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23280    /// * *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.
23281    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23282    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23283    /// * *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.
23284    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23285    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23286    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTriggerPatchCall<'a, C>
23287    where
23288        T: AsRef<str>,
23289    {
23290        self._additional_params
23291            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23292        self
23293    }
23294
23295    /// Identifies the authorization scope for the method you are building.
23296    ///
23297    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23298    /// [`Scope::CloudPlatform`].
23299    ///
23300    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23301    /// tokens for more than one scope.
23302    ///
23303    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23304    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23305    /// sufficient, a read-write scope will do as well.
23306    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerPatchCall<'a, C>
23307    where
23308        St: AsRef<str>,
23309    {
23310        self._scopes.insert(String::from(scope.as_ref()));
23311        self
23312    }
23313    /// Identifies the authorization scope(s) for the method you are building.
23314    ///
23315    /// See [`Self::add_scope()`] for details.
23316    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTriggerPatchCall<'a, C>
23317    where
23318        I: IntoIterator<Item = St>,
23319        St: AsRef<str>,
23320    {
23321        self._scopes
23322            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23323        self
23324    }
23325
23326    /// Removes all scopes, and no default scope will be used either.
23327    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23328    /// for details).
23329    pub fn clear_scopes(mut self) -> ProjectLocationTriggerPatchCall<'a, C> {
23330        self._scopes.clear();
23331        self
23332    }
23333}
23334
23335/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
23336///
23337/// A builder for the *locations.triggers.setIamPolicy* method supported by a *project* resource.
23338/// It is not used directly, but through a [`ProjectMethods`] instance.
23339///
23340/// # Example
23341///
23342/// Instantiate a resource method builder
23343///
23344/// ```test_harness,no_run
23345/// # extern crate hyper;
23346/// # extern crate hyper_rustls;
23347/// # extern crate google_eventarc1 as eventarc1;
23348/// use eventarc1::api::SetIamPolicyRequest;
23349/// # async fn dox() {
23350/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23351///
23352/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23353/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23354/// #     .with_native_roots()
23355/// #     .unwrap()
23356/// #     .https_only()
23357/// #     .enable_http2()
23358/// #     .build();
23359///
23360/// # let executor = hyper_util::rt::TokioExecutor::new();
23361/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23362/// #     secret,
23363/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23364/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23365/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23366/// #     ),
23367/// # ).build().await.unwrap();
23368///
23369/// # let client = hyper_util::client::legacy::Client::builder(
23370/// #     hyper_util::rt::TokioExecutor::new()
23371/// # )
23372/// # .build(
23373/// #     hyper_rustls::HttpsConnectorBuilder::new()
23374/// #         .with_native_roots()
23375/// #         .unwrap()
23376/// #         .https_or_http()
23377/// #         .enable_http2()
23378/// #         .build()
23379/// # );
23380/// # let mut hub = Eventarc::new(client, auth);
23381/// // As the method needs a request, you would usually fill it with the desired information
23382/// // into the respective structure. Some of the parts shown here might not be applicable !
23383/// // Values shown here are possibly random and not representative !
23384/// let mut req = SetIamPolicyRequest::default();
23385///
23386/// // You can configure optional parameters by calling the respective setters at will, and
23387/// // execute the final call using `doit()`.
23388/// // Values shown here are possibly random and not representative !
23389/// let result = hub.projects().locations_triggers_set_iam_policy(req, "resource")
23390///              .doit().await;
23391/// # }
23392/// ```
23393pub struct ProjectLocationTriggerSetIamPolicyCall<'a, C>
23394where
23395    C: 'a,
23396{
23397    hub: &'a Eventarc<C>,
23398    _request: SetIamPolicyRequest,
23399    _resource: String,
23400    _delegate: Option<&'a mut dyn common::Delegate>,
23401    _additional_params: HashMap<String, String>,
23402    _scopes: BTreeSet<String>,
23403}
23404
23405impl<'a, C> common::CallBuilder for ProjectLocationTriggerSetIamPolicyCall<'a, C> {}
23406
23407impl<'a, C> ProjectLocationTriggerSetIamPolicyCall<'a, C>
23408where
23409    C: common::Connector,
23410{
23411    /// Perform the operation you have build so far.
23412    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
23413        use std::borrow::Cow;
23414        use std::io::{Read, Seek};
23415
23416        use common::{url::Params, ToParts};
23417        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23418
23419        let mut dd = common::DefaultDelegate;
23420        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23421        dlg.begin(common::MethodInfo {
23422            id: "eventarc.projects.locations.triggers.setIamPolicy",
23423            http_method: hyper::Method::POST,
23424        });
23425
23426        for &field in ["alt", "resource"].iter() {
23427            if self._additional_params.contains_key(field) {
23428                dlg.finished(false);
23429                return Err(common::Error::FieldClash(field));
23430            }
23431        }
23432
23433        let mut params = Params::with_capacity(4 + self._additional_params.len());
23434        params.push("resource", self._resource);
23435
23436        params.extend(self._additional_params.iter());
23437
23438        params.push("alt", "json");
23439        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
23440        if self._scopes.is_empty() {
23441            self._scopes
23442                .insert(Scope::CloudPlatform.as_ref().to_string());
23443        }
23444
23445        #[allow(clippy::single_element_loop)]
23446        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23447            url = params.uri_replacement(url, param_name, find_this, true);
23448        }
23449        {
23450            let to_remove = ["resource"];
23451            params.remove_params(&to_remove);
23452        }
23453
23454        let url = params.parse_with_url(&url);
23455
23456        let mut json_mime_type = mime::APPLICATION_JSON;
23457        let mut request_value_reader = {
23458            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23459            common::remove_json_null_values(&mut value);
23460            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23461            serde_json::to_writer(&mut dst, &value).unwrap();
23462            dst
23463        };
23464        let request_size = request_value_reader
23465            .seek(std::io::SeekFrom::End(0))
23466            .unwrap();
23467        request_value_reader
23468            .seek(std::io::SeekFrom::Start(0))
23469            .unwrap();
23470
23471        loop {
23472            let token = match self
23473                .hub
23474                .auth
23475                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23476                .await
23477            {
23478                Ok(token) => token,
23479                Err(e) => match dlg.token(e) {
23480                    Ok(token) => token,
23481                    Err(e) => {
23482                        dlg.finished(false);
23483                        return Err(common::Error::MissingToken(e));
23484                    }
23485                },
23486            };
23487            request_value_reader
23488                .seek(std::io::SeekFrom::Start(0))
23489                .unwrap();
23490            let mut req_result = {
23491                let client = &self.hub.client;
23492                dlg.pre_request();
23493                let mut req_builder = hyper::Request::builder()
23494                    .method(hyper::Method::POST)
23495                    .uri(url.as_str())
23496                    .header(USER_AGENT, self.hub._user_agent.clone());
23497
23498                if let Some(token) = token.as_ref() {
23499                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23500                }
23501
23502                let request = req_builder
23503                    .header(CONTENT_TYPE, json_mime_type.to_string())
23504                    .header(CONTENT_LENGTH, request_size as u64)
23505                    .body(common::to_body(
23506                        request_value_reader.get_ref().clone().into(),
23507                    ));
23508
23509                client.request(request.unwrap()).await
23510            };
23511
23512            match req_result {
23513                Err(err) => {
23514                    if let common::Retry::After(d) = dlg.http_error(&err) {
23515                        sleep(d).await;
23516                        continue;
23517                    }
23518                    dlg.finished(false);
23519                    return Err(common::Error::HttpError(err));
23520                }
23521                Ok(res) => {
23522                    let (mut parts, body) = res.into_parts();
23523                    let mut body = common::Body::new(body);
23524                    if !parts.status.is_success() {
23525                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23526                        let error = serde_json::from_str(&common::to_string(&bytes));
23527                        let response = common::to_response(parts, bytes.into());
23528
23529                        if let common::Retry::After(d) =
23530                            dlg.http_failure(&response, error.as_ref().ok())
23531                        {
23532                            sleep(d).await;
23533                            continue;
23534                        }
23535
23536                        dlg.finished(false);
23537
23538                        return Err(match error {
23539                            Ok(value) => common::Error::BadRequest(value),
23540                            _ => common::Error::Failure(response),
23541                        });
23542                    }
23543                    let response = {
23544                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23545                        let encoded = common::to_string(&bytes);
23546                        match serde_json::from_str(&encoded) {
23547                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23548                            Err(error) => {
23549                                dlg.response_json_decode_error(&encoded, &error);
23550                                return Err(common::Error::JsonDecodeError(
23551                                    encoded.to_string(),
23552                                    error,
23553                                ));
23554                            }
23555                        }
23556                    };
23557
23558                    dlg.finished(true);
23559                    return Ok(response);
23560                }
23561            }
23562        }
23563    }
23564
23565    ///
23566    /// Sets the *request* property to the given value.
23567    ///
23568    /// Even though the property as already been set when instantiating this call,
23569    /// we provide this method for API completeness.
23570    pub fn request(
23571        mut self,
23572        new_value: SetIamPolicyRequest,
23573    ) -> ProjectLocationTriggerSetIamPolicyCall<'a, C> {
23574        self._request = new_value;
23575        self
23576    }
23577    /// 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.
23578    ///
23579    /// Sets the *resource* path property to the given value.
23580    ///
23581    /// Even though the property as already been set when instantiating this call,
23582    /// we provide this method for API completeness.
23583    pub fn resource(mut self, new_value: &str) -> ProjectLocationTriggerSetIamPolicyCall<'a, C> {
23584        self._resource = new_value.to_string();
23585        self
23586    }
23587    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23588    /// while executing the actual API request.
23589    ///
23590    /// ````text
23591    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23592    /// ````
23593    ///
23594    /// Sets the *delegate* property to the given value.
23595    pub fn delegate(
23596        mut self,
23597        new_value: &'a mut dyn common::Delegate,
23598    ) -> ProjectLocationTriggerSetIamPolicyCall<'a, C> {
23599        self._delegate = Some(new_value);
23600        self
23601    }
23602
23603    /// Set any additional parameter of the query string used in the request.
23604    /// It should be used to set parameters which are not yet available through their own
23605    /// setters.
23606    ///
23607    /// Please note that this method must not be used to set any of the known parameters
23608    /// which have their own setter method. If done anyway, the request will fail.
23609    ///
23610    /// # Additional Parameters
23611    ///
23612    /// * *$.xgafv* (query-string) - V1 error format.
23613    /// * *access_token* (query-string) - OAuth access token.
23614    /// * *alt* (query-string) - Data format for response.
23615    /// * *callback* (query-string) - JSONP
23616    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23617    /// * *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.
23618    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23619    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23620    /// * *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.
23621    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23622    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23623    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTriggerSetIamPolicyCall<'a, C>
23624    where
23625        T: AsRef<str>,
23626    {
23627        self._additional_params
23628            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23629        self
23630    }
23631
23632    /// Identifies the authorization scope for the method you are building.
23633    ///
23634    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23635    /// [`Scope::CloudPlatform`].
23636    ///
23637    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23638    /// tokens for more than one scope.
23639    ///
23640    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23641    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23642    /// sufficient, a read-write scope will do as well.
23643    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerSetIamPolicyCall<'a, C>
23644    where
23645        St: AsRef<str>,
23646    {
23647        self._scopes.insert(String::from(scope.as_ref()));
23648        self
23649    }
23650    /// Identifies the authorization scope(s) for the method you are building.
23651    ///
23652    /// See [`Self::add_scope()`] for details.
23653    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTriggerSetIamPolicyCall<'a, C>
23654    where
23655        I: IntoIterator<Item = St>,
23656        St: AsRef<str>,
23657    {
23658        self._scopes
23659            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23660        self
23661    }
23662
23663    /// Removes all scopes, and no default scope will be used either.
23664    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23665    /// for details).
23666    pub fn clear_scopes(mut self) -> ProjectLocationTriggerSetIamPolicyCall<'a, C> {
23667        self._scopes.clear();
23668        self
23669    }
23670}
23671
23672/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
23673///
23674/// A builder for the *locations.triggers.testIamPermissions* method supported by a *project* resource.
23675/// It is not used directly, but through a [`ProjectMethods`] instance.
23676///
23677/// # Example
23678///
23679/// Instantiate a resource method builder
23680///
23681/// ```test_harness,no_run
23682/// # extern crate hyper;
23683/// # extern crate hyper_rustls;
23684/// # extern crate google_eventarc1 as eventarc1;
23685/// use eventarc1::api::TestIamPermissionsRequest;
23686/// # async fn dox() {
23687/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23688///
23689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23690/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23691/// #     .with_native_roots()
23692/// #     .unwrap()
23693/// #     .https_only()
23694/// #     .enable_http2()
23695/// #     .build();
23696///
23697/// # let executor = hyper_util::rt::TokioExecutor::new();
23698/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23699/// #     secret,
23700/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23701/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23702/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23703/// #     ),
23704/// # ).build().await.unwrap();
23705///
23706/// # let client = hyper_util::client::legacy::Client::builder(
23707/// #     hyper_util::rt::TokioExecutor::new()
23708/// # )
23709/// # .build(
23710/// #     hyper_rustls::HttpsConnectorBuilder::new()
23711/// #         .with_native_roots()
23712/// #         .unwrap()
23713/// #         .https_or_http()
23714/// #         .enable_http2()
23715/// #         .build()
23716/// # );
23717/// # let mut hub = Eventarc::new(client, auth);
23718/// // As the method needs a request, you would usually fill it with the desired information
23719/// // into the respective structure. Some of the parts shown here might not be applicable !
23720/// // Values shown here are possibly random and not representative !
23721/// let mut req = TestIamPermissionsRequest::default();
23722///
23723/// // You can configure optional parameters by calling the respective setters at will, and
23724/// // execute the final call using `doit()`.
23725/// // Values shown here are possibly random and not representative !
23726/// let result = hub.projects().locations_triggers_test_iam_permissions(req, "resource")
23727///              .doit().await;
23728/// # }
23729/// ```
23730pub struct ProjectLocationTriggerTestIamPermissionCall<'a, C>
23731where
23732    C: 'a,
23733{
23734    hub: &'a Eventarc<C>,
23735    _request: TestIamPermissionsRequest,
23736    _resource: String,
23737    _delegate: Option<&'a mut dyn common::Delegate>,
23738    _additional_params: HashMap<String, String>,
23739    _scopes: BTreeSet<String>,
23740}
23741
23742impl<'a, C> common::CallBuilder for ProjectLocationTriggerTestIamPermissionCall<'a, C> {}
23743
23744impl<'a, C> ProjectLocationTriggerTestIamPermissionCall<'a, C>
23745where
23746    C: common::Connector,
23747{
23748    /// Perform the operation you have build so far.
23749    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
23750        use std::borrow::Cow;
23751        use std::io::{Read, Seek};
23752
23753        use common::{url::Params, ToParts};
23754        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23755
23756        let mut dd = common::DefaultDelegate;
23757        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23758        dlg.begin(common::MethodInfo {
23759            id: "eventarc.projects.locations.triggers.testIamPermissions",
23760            http_method: hyper::Method::POST,
23761        });
23762
23763        for &field in ["alt", "resource"].iter() {
23764            if self._additional_params.contains_key(field) {
23765                dlg.finished(false);
23766                return Err(common::Error::FieldClash(field));
23767            }
23768        }
23769
23770        let mut params = Params::with_capacity(4 + self._additional_params.len());
23771        params.push("resource", self._resource);
23772
23773        params.extend(self._additional_params.iter());
23774
23775        params.push("alt", "json");
23776        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
23777        if self._scopes.is_empty() {
23778            self._scopes
23779                .insert(Scope::CloudPlatform.as_ref().to_string());
23780        }
23781
23782        #[allow(clippy::single_element_loop)]
23783        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23784            url = params.uri_replacement(url, param_name, find_this, true);
23785        }
23786        {
23787            let to_remove = ["resource"];
23788            params.remove_params(&to_remove);
23789        }
23790
23791        let url = params.parse_with_url(&url);
23792
23793        let mut json_mime_type = mime::APPLICATION_JSON;
23794        let mut request_value_reader = {
23795            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23796            common::remove_json_null_values(&mut value);
23797            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23798            serde_json::to_writer(&mut dst, &value).unwrap();
23799            dst
23800        };
23801        let request_size = request_value_reader
23802            .seek(std::io::SeekFrom::End(0))
23803            .unwrap();
23804        request_value_reader
23805            .seek(std::io::SeekFrom::Start(0))
23806            .unwrap();
23807
23808        loop {
23809            let token = match self
23810                .hub
23811                .auth
23812                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23813                .await
23814            {
23815                Ok(token) => token,
23816                Err(e) => match dlg.token(e) {
23817                    Ok(token) => token,
23818                    Err(e) => {
23819                        dlg.finished(false);
23820                        return Err(common::Error::MissingToken(e));
23821                    }
23822                },
23823            };
23824            request_value_reader
23825                .seek(std::io::SeekFrom::Start(0))
23826                .unwrap();
23827            let mut req_result = {
23828                let client = &self.hub.client;
23829                dlg.pre_request();
23830                let mut req_builder = hyper::Request::builder()
23831                    .method(hyper::Method::POST)
23832                    .uri(url.as_str())
23833                    .header(USER_AGENT, self.hub._user_agent.clone());
23834
23835                if let Some(token) = token.as_ref() {
23836                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23837                }
23838
23839                let request = req_builder
23840                    .header(CONTENT_TYPE, json_mime_type.to_string())
23841                    .header(CONTENT_LENGTH, request_size as u64)
23842                    .body(common::to_body(
23843                        request_value_reader.get_ref().clone().into(),
23844                    ));
23845
23846                client.request(request.unwrap()).await
23847            };
23848
23849            match req_result {
23850                Err(err) => {
23851                    if let common::Retry::After(d) = dlg.http_error(&err) {
23852                        sleep(d).await;
23853                        continue;
23854                    }
23855                    dlg.finished(false);
23856                    return Err(common::Error::HttpError(err));
23857                }
23858                Ok(res) => {
23859                    let (mut parts, body) = res.into_parts();
23860                    let mut body = common::Body::new(body);
23861                    if !parts.status.is_success() {
23862                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23863                        let error = serde_json::from_str(&common::to_string(&bytes));
23864                        let response = common::to_response(parts, bytes.into());
23865
23866                        if let common::Retry::After(d) =
23867                            dlg.http_failure(&response, error.as_ref().ok())
23868                        {
23869                            sleep(d).await;
23870                            continue;
23871                        }
23872
23873                        dlg.finished(false);
23874
23875                        return Err(match error {
23876                            Ok(value) => common::Error::BadRequest(value),
23877                            _ => common::Error::Failure(response),
23878                        });
23879                    }
23880                    let response = {
23881                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23882                        let encoded = common::to_string(&bytes);
23883                        match serde_json::from_str(&encoded) {
23884                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23885                            Err(error) => {
23886                                dlg.response_json_decode_error(&encoded, &error);
23887                                return Err(common::Error::JsonDecodeError(
23888                                    encoded.to_string(),
23889                                    error,
23890                                ));
23891                            }
23892                        }
23893                    };
23894
23895                    dlg.finished(true);
23896                    return Ok(response);
23897                }
23898            }
23899        }
23900    }
23901
23902    ///
23903    /// Sets the *request* property to the given value.
23904    ///
23905    /// Even though the property as already been set when instantiating this call,
23906    /// we provide this method for API completeness.
23907    pub fn request(
23908        mut self,
23909        new_value: TestIamPermissionsRequest,
23910    ) -> ProjectLocationTriggerTestIamPermissionCall<'a, C> {
23911        self._request = new_value;
23912        self
23913    }
23914    /// 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.
23915    ///
23916    /// Sets the *resource* path property to the given value.
23917    ///
23918    /// Even though the property as already been set when instantiating this call,
23919    /// we provide this method for API completeness.
23920    pub fn resource(
23921        mut self,
23922        new_value: &str,
23923    ) -> ProjectLocationTriggerTestIamPermissionCall<'a, C> {
23924        self._resource = new_value.to_string();
23925        self
23926    }
23927    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23928    /// while executing the actual API request.
23929    ///
23930    /// ````text
23931    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23932    /// ````
23933    ///
23934    /// Sets the *delegate* property to the given value.
23935    pub fn delegate(
23936        mut self,
23937        new_value: &'a mut dyn common::Delegate,
23938    ) -> ProjectLocationTriggerTestIamPermissionCall<'a, C> {
23939        self._delegate = Some(new_value);
23940        self
23941    }
23942
23943    /// Set any additional parameter of the query string used in the request.
23944    /// It should be used to set parameters which are not yet available through their own
23945    /// setters.
23946    ///
23947    /// Please note that this method must not be used to set any of the known parameters
23948    /// which have their own setter method. If done anyway, the request will fail.
23949    ///
23950    /// # Additional Parameters
23951    ///
23952    /// * *$.xgafv* (query-string) - V1 error format.
23953    /// * *access_token* (query-string) - OAuth access token.
23954    /// * *alt* (query-string) - Data format for response.
23955    /// * *callback* (query-string) - JSONP
23956    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23957    /// * *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.
23958    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23959    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23960    /// * *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.
23961    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23962    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23963    pub fn param<T>(
23964        mut self,
23965        name: T,
23966        value: T,
23967    ) -> ProjectLocationTriggerTestIamPermissionCall<'a, C>
23968    where
23969        T: AsRef<str>,
23970    {
23971        self._additional_params
23972            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23973        self
23974    }
23975
23976    /// Identifies the authorization scope for the method you are building.
23977    ///
23978    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23979    /// [`Scope::CloudPlatform`].
23980    ///
23981    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23982    /// tokens for more than one scope.
23983    ///
23984    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23985    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23986    /// sufficient, a read-write scope will do as well.
23987    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTriggerTestIamPermissionCall<'a, C>
23988    where
23989        St: AsRef<str>,
23990    {
23991        self._scopes.insert(String::from(scope.as_ref()));
23992        self
23993    }
23994    /// Identifies the authorization scope(s) for the method you are building.
23995    ///
23996    /// See [`Self::add_scope()`] for details.
23997    pub fn add_scopes<I, St>(
23998        mut self,
23999        scopes: I,
24000    ) -> ProjectLocationTriggerTestIamPermissionCall<'a, C>
24001    where
24002        I: IntoIterator<Item = St>,
24003        St: AsRef<str>,
24004    {
24005        self._scopes
24006            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24007        self
24008    }
24009
24010    /// Removes all scopes, and no default scope will be used either.
24011    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24012    /// for details).
24013    pub fn clear_scopes(mut self) -> ProjectLocationTriggerTestIamPermissionCall<'a, C> {
24014        self._scopes.clear();
24015        self
24016    }
24017}
24018
24019/// Gets information about a location.
24020///
24021/// A builder for the *locations.get* method supported by a *project* resource.
24022/// It is not used directly, but through a [`ProjectMethods`] instance.
24023///
24024/// # Example
24025///
24026/// Instantiate a resource method builder
24027///
24028/// ```test_harness,no_run
24029/// # extern crate hyper;
24030/// # extern crate hyper_rustls;
24031/// # extern crate google_eventarc1 as eventarc1;
24032/// # async fn dox() {
24033/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24034///
24035/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24036/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24037/// #     .with_native_roots()
24038/// #     .unwrap()
24039/// #     .https_only()
24040/// #     .enable_http2()
24041/// #     .build();
24042///
24043/// # let executor = hyper_util::rt::TokioExecutor::new();
24044/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24045/// #     secret,
24046/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24047/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24048/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24049/// #     ),
24050/// # ).build().await.unwrap();
24051///
24052/// # let client = hyper_util::client::legacy::Client::builder(
24053/// #     hyper_util::rt::TokioExecutor::new()
24054/// # )
24055/// # .build(
24056/// #     hyper_rustls::HttpsConnectorBuilder::new()
24057/// #         .with_native_roots()
24058/// #         .unwrap()
24059/// #         .https_or_http()
24060/// #         .enable_http2()
24061/// #         .build()
24062/// # );
24063/// # let mut hub = Eventarc::new(client, auth);
24064/// // You can configure optional parameters by calling the respective setters at will, and
24065/// // execute the final call using `doit()`.
24066/// // Values shown here are possibly random and not representative !
24067/// let result = hub.projects().locations_get("name")
24068///              .doit().await;
24069/// # }
24070/// ```
24071pub struct ProjectLocationGetCall<'a, C>
24072where
24073    C: 'a,
24074{
24075    hub: &'a Eventarc<C>,
24076    _name: String,
24077    _delegate: Option<&'a mut dyn common::Delegate>,
24078    _additional_params: HashMap<String, String>,
24079    _scopes: BTreeSet<String>,
24080}
24081
24082impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
24083
24084impl<'a, C> ProjectLocationGetCall<'a, C>
24085where
24086    C: common::Connector,
24087{
24088    /// Perform the operation you have build so far.
24089    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
24090        use std::borrow::Cow;
24091        use std::io::{Read, Seek};
24092
24093        use common::{url::Params, ToParts};
24094        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24095
24096        let mut dd = common::DefaultDelegate;
24097        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24098        dlg.begin(common::MethodInfo {
24099            id: "eventarc.projects.locations.get",
24100            http_method: hyper::Method::GET,
24101        });
24102
24103        for &field in ["alt", "name"].iter() {
24104            if self._additional_params.contains_key(field) {
24105                dlg.finished(false);
24106                return Err(common::Error::FieldClash(field));
24107            }
24108        }
24109
24110        let mut params = Params::with_capacity(3 + self._additional_params.len());
24111        params.push("name", self._name);
24112
24113        params.extend(self._additional_params.iter());
24114
24115        params.push("alt", "json");
24116        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24117        if self._scopes.is_empty() {
24118            self._scopes
24119                .insert(Scope::CloudPlatform.as_ref().to_string());
24120        }
24121
24122        #[allow(clippy::single_element_loop)]
24123        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24124            url = params.uri_replacement(url, param_name, find_this, true);
24125        }
24126        {
24127            let to_remove = ["name"];
24128            params.remove_params(&to_remove);
24129        }
24130
24131        let url = params.parse_with_url(&url);
24132
24133        loop {
24134            let token = match self
24135                .hub
24136                .auth
24137                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24138                .await
24139            {
24140                Ok(token) => token,
24141                Err(e) => match dlg.token(e) {
24142                    Ok(token) => token,
24143                    Err(e) => {
24144                        dlg.finished(false);
24145                        return Err(common::Error::MissingToken(e));
24146                    }
24147                },
24148            };
24149            let mut req_result = {
24150                let client = &self.hub.client;
24151                dlg.pre_request();
24152                let mut req_builder = hyper::Request::builder()
24153                    .method(hyper::Method::GET)
24154                    .uri(url.as_str())
24155                    .header(USER_AGENT, self.hub._user_agent.clone());
24156
24157                if let Some(token) = token.as_ref() {
24158                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24159                }
24160
24161                let request = req_builder
24162                    .header(CONTENT_LENGTH, 0_u64)
24163                    .body(common::to_body::<String>(None));
24164
24165                client.request(request.unwrap()).await
24166            };
24167
24168            match req_result {
24169                Err(err) => {
24170                    if let common::Retry::After(d) = dlg.http_error(&err) {
24171                        sleep(d).await;
24172                        continue;
24173                    }
24174                    dlg.finished(false);
24175                    return Err(common::Error::HttpError(err));
24176                }
24177                Ok(res) => {
24178                    let (mut parts, body) = res.into_parts();
24179                    let mut body = common::Body::new(body);
24180                    if !parts.status.is_success() {
24181                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24182                        let error = serde_json::from_str(&common::to_string(&bytes));
24183                        let response = common::to_response(parts, bytes.into());
24184
24185                        if let common::Retry::After(d) =
24186                            dlg.http_failure(&response, error.as_ref().ok())
24187                        {
24188                            sleep(d).await;
24189                            continue;
24190                        }
24191
24192                        dlg.finished(false);
24193
24194                        return Err(match error {
24195                            Ok(value) => common::Error::BadRequest(value),
24196                            _ => common::Error::Failure(response),
24197                        });
24198                    }
24199                    let response = {
24200                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24201                        let encoded = common::to_string(&bytes);
24202                        match serde_json::from_str(&encoded) {
24203                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24204                            Err(error) => {
24205                                dlg.response_json_decode_error(&encoded, &error);
24206                                return Err(common::Error::JsonDecodeError(
24207                                    encoded.to_string(),
24208                                    error,
24209                                ));
24210                            }
24211                        }
24212                    };
24213
24214                    dlg.finished(true);
24215                    return Ok(response);
24216                }
24217            }
24218        }
24219    }
24220
24221    /// Resource name for the location.
24222    ///
24223    /// Sets the *name* path property to the given value.
24224    ///
24225    /// Even though the property as already been set when instantiating this call,
24226    /// we provide this method for API completeness.
24227    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
24228        self._name = new_value.to_string();
24229        self
24230    }
24231    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24232    /// while executing the actual API request.
24233    ///
24234    /// ````text
24235    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24236    /// ````
24237    ///
24238    /// Sets the *delegate* property to the given value.
24239    pub fn delegate(
24240        mut self,
24241        new_value: &'a mut dyn common::Delegate,
24242    ) -> ProjectLocationGetCall<'a, C> {
24243        self._delegate = Some(new_value);
24244        self
24245    }
24246
24247    /// Set any additional parameter of the query string used in the request.
24248    /// It should be used to set parameters which are not yet available through their own
24249    /// setters.
24250    ///
24251    /// Please note that this method must not be used to set any of the known parameters
24252    /// which have their own setter method. If done anyway, the request will fail.
24253    ///
24254    /// # Additional Parameters
24255    ///
24256    /// * *$.xgafv* (query-string) - V1 error format.
24257    /// * *access_token* (query-string) - OAuth access token.
24258    /// * *alt* (query-string) - Data format for response.
24259    /// * *callback* (query-string) - JSONP
24260    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24261    /// * *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.
24262    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24263    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24264    /// * *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.
24265    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24266    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24267    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
24268    where
24269        T: AsRef<str>,
24270    {
24271        self._additional_params
24272            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24273        self
24274    }
24275
24276    /// Identifies the authorization scope for the method you are building.
24277    ///
24278    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24279    /// [`Scope::CloudPlatform`].
24280    ///
24281    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24282    /// tokens for more than one scope.
24283    ///
24284    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24285    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24286    /// sufficient, a read-write scope will do as well.
24287    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
24288    where
24289        St: AsRef<str>,
24290    {
24291        self._scopes.insert(String::from(scope.as_ref()));
24292        self
24293    }
24294    /// Identifies the authorization scope(s) for the method you are building.
24295    ///
24296    /// See [`Self::add_scope()`] for details.
24297    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
24298    where
24299        I: IntoIterator<Item = St>,
24300        St: AsRef<str>,
24301    {
24302        self._scopes
24303            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24304        self
24305    }
24306
24307    /// Removes all scopes, and no default scope will be used either.
24308    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24309    /// for details).
24310    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
24311        self._scopes.clear();
24312        self
24313    }
24314}
24315
24316/// Get a GoogleChannelConfig. The name of the GoogleChannelConfig in the response is ALWAYS coded with projectID.
24317///
24318/// A builder for the *locations.getGoogleChannelConfig* method supported by a *project* resource.
24319/// It is not used directly, but through a [`ProjectMethods`] instance.
24320///
24321/// # Example
24322///
24323/// Instantiate a resource method builder
24324///
24325/// ```test_harness,no_run
24326/// # extern crate hyper;
24327/// # extern crate hyper_rustls;
24328/// # extern crate google_eventarc1 as eventarc1;
24329/// # async fn dox() {
24330/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24331///
24332/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24333/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24334/// #     .with_native_roots()
24335/// #     .unwrap()
24336/// #     .https_only()
24337/// #     .enable_http2()
24338/// #     .build();
24339///
24340/// # let executor = hyper_util::rt::TokioExecutor::new();
24341/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24342/// #     secret,
24343/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24344/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24345/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24346/// #     ),
24347/// # ).build().await.unwrap();
24348///
24349/// # let client = hyper_util::client::legacy::Client::builder(
24350/// #     hyper_util::rt::TokioExecutor::new()
24351/// # )
24352/// # .build(
24353/// #     hyper_rustls::HttpsConnectorBuilder::new()
24354/// #         .with_native_roots()
24355/// #         .unwrap()
24356/// #         .https_or_http()
24357/// #         .enable_http2()
24358/// #         .build()
24359/// # );
24360/// # let mut hub = Eventarc::new(client, auth);
24361/// // You can configure optional parameters by calling the respective setters at will, and
24362/// // execute the final call using `doit()`.
24363/// // Values shown here are possibly random and not representative !
24364/// let result = hub.projects().locations_get_google_channel_config("name")
24365///              .doit().await;
24366/// # }
24367/// ```
24368pub struct ProjectLocationGetGoogleChannelConfigCall<'a, C>
24369where
24370    C: 'a,
24371{
24372    hub: &'a Eventarc<C>,
24373    _name: String,
24374    _delegate: Option<&'a mut dyn common::Delegate>,
24375    _additional_params: HashMap<String, String>,
24376    _scopes: BTreeSet<String>,
24377}
24378
24379impl<'a, C> common::CallBuilder for ProjectLocationGetGoogleChannelConfigCall<'a, C> {}
24380
24381impl<'a, C> ProjectLocationGetGoogleChannelConfigCall<'a, C>
24382where
24383    C: common::Connector,
24384{
24385    /// Perform the operation you have build so far.
24386    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleChannelConfig)> {
24387        use std::borrow::Cow;
24388        use std::io::{Read, Seek};
24389
24390        use common::{url::Params, ToParts};
24391        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24392
24393        let mut dd = common::DefaultDelegate;
24394        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24395        dlg.begin(common::MethodInfo {
24396            id: "eventarc.projects.locations.getGoogleChannelConfig",
24397            http_method: hyper::Method::GET,
24398        });
24399
24400        for &field in ["alt", "name"].iter() {
24401            if self._additional_params.contains_key(field) {
24402                dlg.finished(false);
24403                return Err(common::Error::FieldClash(field));
24404            }
24405        }
24406
24407        let mut params = Params::with_capacity(3 + self._additional_params.len());
24408        params.push("name", self._name);
24409
24410        params.extend(self._additional_params.iter());
24411
24412        params.push("alt", "json");
24413        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24414        if self._scopes.is_empty() {
24415            self._scopes
24416                .insert(Scope::CloudPlatform.as_ref().to_string());
24417        }
24418
24419        #[allow(clippy::single_element_loop)]
24420        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24421            url = params.uri_replacement(url, param_name, find_this, true);
24422        }
24423        {
24424            let to_remove = ["name"];
24425            params.remove_params(&to_remove);
24426        }
24427
24428        let url = params.parse_with_url(&url);
24429
24430        loop {
24431            let token = match self
24432                .hub
24433                .auth
24434                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24435                .await
24436            {
24437                Ok(token) => token,
24438                Err(e) => match dlg.token(e) {
24439                    Ok(token) => token,
24440                    Err(e) => {
24441                        dlg.finished(false);
24442                        return Err(common::Error::MissingToken(e));
24443                    }
24444                },
24445            };
24446            let mut req_result = {
24447                let client = &self.hub.client;
24448                dlg.pre_request();
24449                let mut req_builder = hyper::Request::builder()
24450                    .method(hyper::Method::GET)
24451                    .uri(url.as_str())
24452                    .header(USER_AGENT, self.hub._user_agent.clone());
24453
24454                if let Some(token) = token.as_ref() {
24455                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24456                }
24457
24458                let request = req_builder
24459                    .header(CONTENT_LENGTH, 0_u64)
24460                    .body(common::to_body::<String>(None));
24461
24462                client.request(request.unwrap()).await
24463            };
24464
24465            match req_result {
24466                Err(err) => {
24467                    if let common::Retry::After(d) = dlg.http_error(&err) {
24468                        sleep(d).await;
24469                        continue;
24470                    }
24471                    dlg.finished(false);
24472                    return Err(common::Error::HttpError(err));
24473                }
24474                Ok(res) => {
24475                    let (mut parts, body) = res.into_parts();
24476                    let mut body = common::Body::new(body);
24477                    if !parts.status.is_success() {
24478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24479                        let error = serde_json::from_str(&common::to_string(&bytes));
24480                        let response = common::to_response(parts, bytes.into());
24481
24482                        if let common::Retry::After(d) =
24483                            dlg.http_failure(&response, error.as_ref().ok())
24484                        {
24485                            sleep(d).await;
24486                            continue;
24487                        }
24488
24489                        dlg.finished(false);
24490
24491                        return Err(match error {
24492                            Ok(value) => common::Error::BadRequest(value),
24493                            _ => common::Error::Failure(response),
24494                        });
24495                    }
24496                    let response = {
24497                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24498                        let encoded = common::to_string(&bytes);
24499                        match serde_json::from_str(&encoded) {
24500                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24501                            Err(error) => {
24502                                dlg.response_json_decode_error(&encoded, &error);
24503                                return Err(common::Error::JsonDecodeError(
24504                                    encoded.to_string(),
24505                                    error,
24506                                ));
24507                            }
24508                        }
24509                    };
24510
24511                    dlg.finished(true);
24512                    return Ok(response);
24513                }
24514            }
24515        }
24516    }
24517
24518    /// Required. The name of the config to get.
24519    ///
24520    /// Sets the *name* path property to the given value.
24521    ///
24522    /// Even though the property as already been set when instantiating this call,
24523    /// we provide this method for API completeness.
24524    pub fn name(mut self, new_value: &str) -> ProjectLocationGetGoogleChannelConfigCall<'a, C> {
24525        self._name = new_value.to_string();
24526        self
24527    }
24528    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24529    /// while executing the actual API request.
24530    ///
24531    /// ````text
24532    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24533    /// ````
24534    ///
24535    /// Sets the *delegate* property to the given value.
24536    pub fn delegate(
24537        mut self,
24538        new_value: &'a mut dyn common::Delegate,
24539    ) -> ProjectLocationGetGoogleChannelConfigCall<'a, C> {
24540        self._delegate = Some(new_value);
24541        self
24542    }
24543
24544    /// Set any additional parameter of the query string used in the request.
24545    /// It should be used to set parameters which are not yet available through their own
24546    /// setters.
24547    ///
24548    /// Please note that this method must not be used to set any of the known parameters
24549    /// which have their own setter method. If done anyway, the request will fail.
24550    ///
24551    /// # Additional Parameters
24552    ///
24553    /// * *$.xgafv* (query-string) - V1 error format.
24554    /// * *access_token* (query-string) - OAuth access token.
24555    /// * *alt* (query-string) - Data format for response.
24556    /// * *callback* (query-string) - JSONP
24557    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24558    /// * *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.
24559    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24560    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24561    /// * *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.
24562    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24563    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24564    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetGoogleChannelConfigCall<'a, C>
24565    where
24566        T: AsRef<str>,
24567    {
24568        self._additional_params
24569            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24570        self
24571    }
24572
24573    /// Identifies the authorization scope for the method you are building.
24574    ///
24575    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24576    /// [`Scope::CloudPlatform`].
24577    ///
24578    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24579    /// tokens for more than one scope.
24580    ///
24581    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24582    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24583    /// sufficient, a read-write scope will do as well.
24584    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetGoogleChannelConfigCall<'a, C>
24585    where
24586        St: AsRef<str>,
24587    {
24588        self._scopes.insert(String::from(scope.as_ref()));
24589        self
24590    }
24591    /// Identifies the authorization scope(s) for the method you are building.
24592    ///
24593    /// See [`Self::add_scope()`] for details.
24594    pub fn add_scopes<I, St>(
24595        mut self,
24596        scopes: I,
24597    ) -> ProjectLocationGetGoogleChannelConfigCall<'a, C>
24598    where
24599        I: IntoIterator<Item = St>,
24600        St: AsRef<str>,
24601    {
24602        self._scopes
24603            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24604        self
24605    }
24606
24607    /// Removes all scopes, and no default scope will be used either.
24608    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24609    /// for details).
24610    pub fn clear_scopes(mut self) -> ProjectLocationGetGoogleChannelConfigCall<'a, C> {
24611        self._scopes.clear();
24612        self
24613    }
24614}
24615
24616/// Lists information about the supported locations for this service.
24617///
24618/// A builder for the *locations.list* method supported by a *project* resource.
24619/// It is not used directly, but through a [`ProjectMethods`] instance.
24620///
24621/// # Example
24622///
24623/// Instantiate a resource method builder
24624///
24625/// ```test_harness,no_run
24626/// # extern crate hyper;
24627/// # extern crate hyper_rustls;
24628/// # extern crate google_eventarc1 as eventarc1;
24629/// # async fn dox() {
24630/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24631///
24632/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24633/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24634/// #     .with_native_roots()
24635/// #     .unwrap()
24636/// #     .https_only()
24637/// #     .enable_http2()
24638/// #     .build();
24639///
24640/// # let executor = hyper_util::rt::TokioExecutor::new();
24641/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24642/// #     secret,
24643/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24644/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24645/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24646/// #     ),
24647/// # ).build().await.unwrap();
24648///
24649/// # let client = hyper_util::client::legacy::Client::builder(
24650/// #     hyper_util::rt::TokioExecutor::new()
24651/// # )
24652/// # .build(
24653/// #     hyper_rustls::HttpsConnectorBuilder::new()
24654/// #         .with_native_roots()
24655/// #         .unwrap()
24656/// #         .https_or_http()
24657/// #         .enable_http2()
24658/// #         .build()
24659/// # );
24660/// # let mut hub = Eventarc::new(client, auth);
24661/// // You can configure optional parameters by calling the respective setters at will, and
24662/// // execute the final call using `doit()`.
24663/// // Values shown here are possibly random and not representative !
24664/// let result = hub.projects().locations_list("name")
24665///              .page_token("sea")
24666///              .page_size(-96)
24667///              .filter("sit")
24668///              .add_extra_location_types("aliquyam")
24669///              .doit().await;
24670/// # }
24671/// ```
24672pub struct ProjectLocationListCall<'a, C>
24673where
24674    C: 'a,
24675{
24676    hub: &'a Eventarc<C>,
24677    _name: String,
24678    _page_token: Option<String>,
24679    _page_size: Option<i32>,
24680    _filter: Option<String>,
24681    _extra_location_types: Vec<String>,
24682    _delegate: Option<&'a mut dyn common::Delegate>,
24683    _additional_params: HashMap<String, String>,
24684    _scopes: BTreeSet<String>,
24685}
24686
24687impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
24688
24689impl<'a, C> ProjectLocationListCall<'a, C>
24690where
24691    C: common::Connector,
24692{
24693    /// Perform the operation you have build so far.
24694    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
24695        use std::borrow::Cow;
24696        use std::io::{Read, Seek};
24697
24698        use common::{url::Params, ToParts};
24699        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24700
24701        let mut dd = common::DefaultDelegate;
24702        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24703        dlg.begin(common::MethodInfo {
24704            id: "eventarc.projects.locations.list",
24705            http_method: hyper::Method::GET,
24706        });
24707
24708        for &field in [
24709            "alt",
24710            "name",
24711            "pageToken",
24712            "pageSize",
24713            "filter",
24714            "extraLocationTypes",
24715        ]
24716        .iter()
24717        {
24718            if self._additional_params.contains_key(field) {
24719                dlg.finished(false);
24720                return Err(common::Error::FieldClash(field));
24721            }
24722        }
24723
24724        let mut params = Params::with_capacity(7 + self._additional_params.len());
24725        params.push("name", self._name);
24726        if let Some(value) = self._page_token.as_ref() {
24727            params.push("pageToken", value);
24728        }
24729        if let Some(value) = self._page_size.as_ref() {
24730            params.push("pageSize", value.to_string());
24731        }
24732        if let Some(value) = self._filter.as_ref() {
24733            params.push("filter", value);
24734        }
24735        if !self._extra_location_types.is_empty() {
24736            for f in self._extra_location_types.iter() {
24737                params.push("extraLocationTypes", f);
24738            }
24739        }
24740
24741        params.extend(self._additional_params.iter());
24742
24743        params.push("alt", "json");
24744        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
24745        if self._scopes.is_empty() {
24746            self._scopes
24747                .insert(Scope::CloudPlatform.as_ref().to_string());
24748        }
24749
24750        #[allow(clippy::single_element_loop)]
24751        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24752            url = params.uri_replacement(url, param_name, find_this, true);
24753        }
24754        {
24755            let to_remove = ["name"];
24756            params.remove_params(&to_remove);
24757        }
24758
24759        let url = params.parse_with_url(&url);
24760
24761        loop {
24762            let token = match self
24763                .hub
24764                .auth
24765                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24766                .await
24767            {
24768                Ok(token) => token,
24769                Err(e) => match dlg.token(e) {
24770                    Ok(token) => token,
24771                    Err(e) => {
24772                        dlg.finished(false);
24773                        return Err(common::Error::MissingToken(e));
24774                    }
24775                },
24776            };
24777            let mut req_result = {
24778                let client = &self.hub.client;
24779                dlg.pre_request();
24780                let mut req_builder = hyper::Request::builder()
24781                    .method(hyper::Method::GET)
24782                    .uri(url.as_str())
24783                    .header(USER_AGENT, self.hub._user_agent.clone());
24784
24785                if let Some(token) = token.as_ref() {
24786                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24787                }
24788
24789                let request = req_builder
24790                    .header(CONTENT_LENGTH, 0_u64)
24791                    .body(common::to_body::<String>(None));
24792
24793                client.request(request.unwrap()).await
24794            };
24795
24796            match req_result {
24797                Err(err) => {
24798                    if let common::Retry::After(d) = dlg.http_error(&err) {
24799                        sleep(d).await;
24800                        continue;
24801                    }
24802                    dlg.finished(false);
24803                    return Err(common::Error::HttpError(err));
24804                }
24805                Ok(res) => {
24806                    let (mut parts, body) = res.into_parts();
24807                    let mut body = common::Body::new(body);
24808                    if !parts.status.is_success() {
24809                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24810                        let error = serde_json::from_str(&common::to_string(&bytes));
24811                        let response = common::to_response(parts, bytes.into());
24812
24813                        if let common::Retry::After(d) =
24814                            dlg.http_failure(&response, error.as_ref().ok())
24815                        {
24816                            sleep(d).await;
24817                            continue;
24818                        }
24819
24820                        dlg.finished(false);
24821
24822                        return Err(match error {
24823                            Ok(value) => common::Error::BadRequest(value),
24824                            _ => common::Error::Failure(response),
24825                        });
24826                    }
24827                    let response = {
24828                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24829                        let encoded = common::to_string(&bytes);
24830                        match serde_json::from_str(&encoded) {
24831                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24832                            Err(error) => {
24833                                dlg.response_json_decode_error(&encoded, &error);
24834                                return Err(common::Error::JsonDecodeError(
24835                                    encoded.to_string(),
24836                                    error,
24837                                ));
24838                            }
24839                        }
24840                    };
24841
24842                    dlg.finished(true);
24843                    return Ok(response);
24844                }
24845            }
24846        }
24847    }
24848
24849    /// The resource that owns the locations collection, if applicable.
24850    ///
24851    /// Sets the *name* path property to the given value.
24852    ///
24853    /// Even though the property as already been set when instantiating this call,
24854    /// we provide this method for API completeness.
24855    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
24856        self._name = new_value.to_string();
24857        self
24858    }
24859    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
24860    ///
24861    /// Sets the *page token* query property to the given value.
24862    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
24863        self._page_token = Some(new_value.to_string());
24864        self
24865    }
24866    /// The maximum number of results to return. If not set, the service selects a default.
24867    ///
24868    /// Sets the *page size* query property to the given value.
24869    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
24870        self._page_size = Some(new_value);
24871        self
24872    }
24873    /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
24874    ///
24875    /// Sets the *filter* query property to the given value.
24876    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
24877        self._filter = Some(new_value.to_string());
24878        self
24879    }
24880    /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
24881    ///
24882    /// Append the given value to the *extra location types* query property.
24883    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
24884    pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
24885        self._extra_location_types.push(new_value.to_string());
24886        self
24887    }
24888    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24889    /// while executing the actual API request.
24890    ///
24891    /// ````text
24892    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24893    /// ````
24894    ///
24895    /// Sets the *delegate* property to the given value.
24896    pub fn delegate(
24897        mut self,
24898        new_value: &'a mut dyn common::Delegate,
24899    ) -> ProjectLocationListCall<'a, C> {
24900        self._delegate = Some(new_value);
24901        self
24902    }
24903
24904    /// Set any additional parameter of the query string used in the request.
24905    /// It should be used to set parameters which are not yet available through their own
24906    /// setters.
24907    ///
24908    /// Please note that this method must not be used to set any of the known parameters
24909    /// which have their own setter method. If done anyway, the request will fail.
24910    ///
24911    /// # Additional Parameters
24912    ///
24913    /// * *$.xgafv* (query-string) - V1 error format.
24914    /// * *access_token* (query-string) - OAuth access token.
24915    /// * *alt* (query-string) - Data format for response.
24916    /// * *callback* (query-string) - JSONP
24917    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24918    /// * *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.
24919    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24920    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24921    /// * *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.
24922    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24923    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24924    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
24925    where
24926        T: AsRef<str>,
24927    {
24928        self._additional_params
24929            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24930        self
24931    }
24932
24933    /// Identifies the authorization scope for the method you are building.
24934    ///
24935    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24936    /// [`Scope::CloudPlatform`].
24937    ///
24938    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24939    /// tokens for more than one scope.
24940    ///
24941    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24942    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24943    /// sufficient, a read-write scope will do as well.
24944    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
24945    where
24946        St: AsRef<str>,
24947    {
24948        self._scopes.insert(String::from(scope.as_ref()));
24949        self
24950    }
24951    /// Identifies the authorization scope(s) for the method you are building.
24952    ///
24953    /// See [`Self::add_scope()`] for details.
24954    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
24955    where
24956        I: IntoIterator<Item = St>,
24957        St: AsRef<str>,
24958    {
24959        self._scopes
24960            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24961        self
24962    }
24963
24964    /// Removes all scopes, and no default scope will be used either.
24965    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24966    /// for details).
24967    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
24968        self._scopes.clear();
24969        self
24970    }
24971}
24972
24973/// Update a single GoogleChannelConfig
24974///
24975/// A builder for the *locations.updateGoogleChannelConfig* method supported by a *project* resource.
24976/// It is not used directly, but through a [`ProjectMethods`] instance.
24977///
24978/// # Example
24979///
24980/// Instantiate a resource method builder
24981///
24982/// ```test_harness,no_run
24983/// # extern crate hyper;
24984/// # extern crate hyper_rustls;
24985/// # extern crate google_eventarc1 as eventarc1;
24986/// use eventarc1::api::GoogleChannelConfig;
24987/// # async fn dox() {
24988/// # use eventarc1::{Eventarc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24989///
24990/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24991/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24992/// #     .with_native_roots()
24993/// #     .unwrap()
24994/// #     .https_only()
24995/// #     .enable_http2()
24996/// #     .build();
24997///
24998/// # let executor = hyper_util::rt::TokioExecutor::new();
24999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25000/// #     secret,
25001/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25002/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25003/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25004/// #     ),
25005/// # ).build().await.unwrap();
25006///
25007/// # let client = hyper_util::client::legacy::Client::builder(
25008/// #     hyper_util::rt::TokioExecutor::new()
25009/// # )
25010/// # .build(
25011/// #     hyper_rustls::HttpsConnectorBuilder::new()
25012/// #         .with_native_roots()
25013/// #         .unwrap()
25014/// #         .https_or_http()
25015/// #         .enable_http2()
25016/// #         .build()
25017/// # );
25018/// # let mut hub = Eventarc::new(client, auth);
25019/// // As the method needs a request, you would usually fill it with the desired information
25020/// // into the respective structure. Some of the parts shown here might not be applicable !
25021/// // Values shown here are possibly random and not representative !
25022/// let mut req = GoogleChannelConfig::default();
25023///
25024/// // You can configure optional parameters by calling the respective setters at will, and
25025/// // execute the final call using `doit()`.
25026/// // Values shown here are possibly random and not representative !
25027/// let result = hub.projects().locations_update_google_channel_config(req, "name")
25028///              .update_mask(FieldMask::new::<&str>(&[]))
25029///              .doit().await;
25030/// # }
25031/// ```
25032pub struct ProjectLocationUpdateGoogleChannelConfigCall<'a, C>
25033where
25034    C: 'a,
25035{
25036    hub: &'a Eventarc<C>,
25037    _request: GoogleChannelConfig,
25038    _name: String,
25039    _update_mask: Option<common::FieldMask>,
25040    _delegate: Option<&'a mut dyn common::Delegate>,
25041    _additional_params: HashMap<String, String>,
25042    _scopes: BTreeSet<String>,
25043}
25044
25045impl<'a, C> common::CallBuilder for ProjectLocationUpdateGoogleChannelConfigCall<'a, C> {}
25046
25047impl<'a, C> ProjectLocationUpdateGoogleChannelConfigCall<'a, C>
25048where
25049    C: common::Connector,
25050{
25051    /// Perform the operation you have build so far.
25052    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleChannelConfig)> {
25053        use std::borrow::Cow;
25054        use std::io::{Read, Seek};
25055
25056        use common::{url::Params, ToParts};
25057        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25058
25059        let mut dd = common::DefaultDelegate;
25060        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25061        dlg.begin(common::MethodInfo {
25062            id: "eventarc.projects.locations.updateGoogleChannelConfig",
25063            http_method: hyper::Method::PATCH,
25064        });
25065
25066        for &field in ["alt", "name", "updateMask"].iter() {
25067            if self._additional_params.contains_key(field) {
25068                dlg.finished(false);
25069                return Err(common::Error::FieldClash(field));
25070            }
25071        }
25072
25073        let mut params = Params::with_capacity(5 + self._additional_params.len());
25074        params.push("name", self._name);
25075        if let Some(value) = self._update_mask.as_ref() {
25076            params.push("updateMask", value.to_string());
25077        }
25078
25079        params.extend(self._additional_params.iter());
25080
25081        params.push("alt", "json");
25082        let mut url = self.hub._base_url.clone() + "v1/{+name}";
25083        if self._scopes.is_empty() {
25084            self._scopes
25085                .insert(Scope::CloudPlatform.as_ref().to_string());
25086        }
25087
25088        #[allow(clippy::single_element_loop)]
25089        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25090            url = params.uri_replacement(url, param_name, find_this, true);
25091        }
25092        {
25093            let to_remove = ["name"];
25094            params.remove_params(&to_remove);
25095        }
25096
25097        let url = params.parse_with_url(&url);
25098
25099        let mut json_mime_type = mime::APPLICATION_JSON;
25100        let mut request_value_reader = {
25101            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25102            common::remove_json_null_values(&mut value);
25103            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25104            serde_json::to_writer(&mut dst, &value).unwrap();
25105            dst
25106        };
25107        let request_size = request_value_reader
25108            .seek(std::io::SeekFrom::End(0))
25109            .unwrap();
25110        request_value_reader
25111            .seek(std::io::SeekFrom::Start(0))
25112            .unwrap();
25113
25114        loop {
25115            let token = match self
25116                .hub
25117                .auth
25118                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25119                .await
25120            {
25121                Ok(token) => token,
25122                Err(e) => match dlg.token(e) {
25123                    Ok(token) => token,
25124                    Err(e) => {
25125                        dlg.finished(false);
25126                        return Err(common::Error::MissingToken(e));
25127                    }
25128                },
25129            };
25130            request_value_reader
25131                .seek(std::io::SeekFrom::Start(0))
25132                .unwrap();
25133            let mut req_result = {
25134                let client = &self.hub.client;
25135                dlg.pre_request();
25136                let mut req_builder = hyper::Request::builder()
25137                    .method(hyper::Method::PATCH)
25138                    .uri(url.as_str())
25139                    .header(USER_AGENT, self.hub._user_agent.clone());
25140
25141                if let Some(token) = token.as_ref() {
25142                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25143                }
25144
25145                let request = req_builder
25146                    .header(CONTENT_TYPE, json_mime_type.to_string())
25147                    .header(CONTENT_LENGTH, request_size as u64)
25148                    .body(common::to_body(
25149                        request_value_reader.get_ref().clone().into(),
25150                    ));
25151
25152                client.request(request.unwrap()).await
25153            };
25154
25155            match req_result {
25156                Err(err) => {
25157                    if let common::Retry::After(d) = dlg.http_error(&err) {
25158                        sleep(d).await;
25159                        continue;
25160                    }
25161                    dlg.finished(false);
25162                    return Err(common::Error::HttpError(err));
25163                }
25164                Ok(res) => {
25165                    let (mut parts, body) = res.into_parts();
25166                    let mut body = common::Body::new(body);
25167                    if !parts.status.is_success() {
25168                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25169                        let error = serde_json::from_str(&common::to_string(&bytes));
25170                        let response = common::to_response(parts, bytes.into());
25171
25172                        if let common::Retry::After(d) =
25173                            dlg.http_failure(&response, error.as_ref().ok())
25174                        {
25175                            sleep(d).await;
25176                            continue;
25177                        }
25178
25179                        dlg.finished(false);
25180
25181                        return Err(match error {
25182                            Ok(value) => common::Error::BadRequest(value),
25183                            _ => common::Error::Failure(response),
25184                        });
25185                    }
25186                    let response = {
25187                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25188                        let encoded = common::to_string(&bytes);
25189                        match serde_json::from_str(&encoded) {
25190                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25191                            Err(error) => {
25192                                dlg.response_json_decode_error(&encoded, &error);
25193                                return Err(common::Error::JsonDecodeError(
25194                                    encoded.to_string(),
25195                                    error,
25196                                ));
25197                            }
25198                        }
25199                    };
25200
25201                    dlg.finished(true);
25202                    return Ok(response);
25203                }
25204            }
25205        }
25206    }
25207
25208    ///
25209    /// Sets the *request* property to the given value.
25210    ///
25211    /// Even though the property as already been set when instantiating this call,
25212    /// we provide this method for API completeness.
25213    pub fn request(
25214        mut self,
25215        new_value: GoogleChannelConfig,
25216    ) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C> {
25217        self._request = new_value;
25218        self
25219    }
25220    /// Required. The resource name of the config. Must be in the format of, `projects/{project}/locations/{location}/googleChannelConfig`. In API responses, the config name always includes the projectID, regardless of whether the projectID or projectNumber was provided.
25221    ///
25222    /// Sets the *name* path property to the given value.
25223    ///
25224    /// Even though the property as already been set when instantiating this call,
25225    /// we provide this method for API completeness.
25226    pub fn name(mut self, new_value: &str) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C> {
25227        self._name = new_value.to_string();
25228        self
25229    }
25230    /// The fields to be updated; only fields explicitly provided are updated. If no field mask is provided, all provided fields in the request are updated. To update all fields, provide a field mask of "*".
25231    ///
25232    /// Sets the *update mask* query property to the given value.
25233    pub fn update_mask(
25234        mut self,
25235        new_value: common::FieldMask,
25236    ) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C> {
25237        self._update_mask = Some(new_value);
25238        self
25239    }
25240    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25241    /// while executing the actual API request.
25242    ///
25243    /// ````text
25244    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25245    /// ````
25246    ///
25247    /// Sets the *delegate* property to the given value.
25248    pub fn delegate(
25249        mut self,
25250        new_value: &'a mut dyn common::Delegate,
25251    ) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C> {
25252        self._delegate = Some(new_value);
25253        self
25254    }
25255
25256    /// Set any additional parameter of the query string used in the request.
25257    /// It should be used to set parameters which are not yet available through their own
25258    /// setters.
25259    ///
25260    /// Please note that this method must not be used to set any of the known parameters
25261    /// which have their own setter method. If done anyway, the request will fail.
25262    ///
25263    /// # Additional Parameters
25264    ///
25265    /// * *$.xgafv* (query-string) - V1 error format.
25266    /// * *access_token* (query-string) - OAuth access token.
25267    /// * *alt* (query-string) - Data format for response.
25268    /// * *callback* (query-string) - JSONP
25269    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25270    /// * *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.
25271    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25272    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25273    /// * *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.
25274    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25275    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25276    pub fn param<T>(
25277        mut self,
25278        name: T,
25279        value: T,
25280    ) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C>
25281    where
25282        T: AsRef<str>,
25283    {
25284        self._additional_params
25285            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25286        self
25287    }
25288
25289    /// Identifies the authorization scope for the method you are building.
25290    ///
25291    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25292    /// [`Scope::CloudPlatform`].
25293    ///
25294    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25295    /// tokens for more than one scope.
25296    ///
25297    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25298    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25299    /// sufficient, a read-write scope will do as well.
25300    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C>
25301    where
25302        St: AsRef<str>,
25303    {
25304        self._scopes.insert(String::from(scope.as_ref()));
25305        self
25306    }
25307    /// Identifies the authorization scope(s) for the method you are building.
25308    ///
25309    /// See [`Self::add_scope()`] for details.
25310    pub fn add_scopes<I, St>(
25311        mut self,
25312        scopes: I,
25313    ) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C>
25314    where
25315        I: IntoIterator<Item = St>,
25316        St: AsRef<str>,
25317    {
25318        self._scopes
25319            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25320        self
25321    }
25322
25323    /// Removes all scopes, and no default scope will be used either.
25324    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25325    /// for details).
25326    pub fn clear_scopes(mut self) -> ProjectLocationUpdateGoogleChannelConfigCall<'a, C> {
25327        self._scopes.clear();
25328        self
25329    }
25330}