google_networkconnectivity1/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 Networkconnectivity 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_networkconnectivity1 as networkconnectivity1;
49/// use networkconnectivity1::api::ServiceConnectionPolicy;
50/// use networkconnectivity1::{Result, Error};
51/// # async fn dox() {
52/// use networkconnectivity1::{Networkconnectivity, 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 = Networkconnectivity::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 = ServiceConnectionPolicy::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_service_connection_policies_create(req, "parent")
99/// .subnetwork_mode("gubergren")
100/// .service_connection_policy_id("eos")
101/// .request_id("dolor")
102/// .auto_subnetwork_config_prefix_length(-17)
103/// .auto_subnetwork_config_ip_stack("ipsum")
104/// .add_auto_subnetwork_config_alloc_range_space("invidunt")
105/// .doit().await;
106///
107/// match result {
108/// Err(e) => match e {
109/// // The Error enum provides details about what exactly happened.
110/// // You can also just use its `Debug`, `Display` or `Error` traits
111/// Error::HttpError(_)
112/// |Error::Io(_)
113/// |Error::MissingAPIKey
114/// |Error::MissingToken(_)
115/// |Error::Cancelled
116/// |Error::UploadSizeLimitExceeded(_, _)
117/// |Error::Failure(_)
118/// |Error::BadRequest(_)
119/// |Error::FieldClash(_)
120/// |Error::JsonDecodeError(_, _) => println!("{}", e),
121/// },
122/// Ok(res) => println!("Success: {:?}", res),
123/// }
124/// # }
125/// ```
126#[derive(Clone)]
127pub struct Networkconnectivity<C> {
128 pub client: common::Client<C>,
129 pub auth: Box<dyn common::GetToken>,
130 _user_agent: String,
131 _base_url: String,
132 _root_url: String,
133}
134
135impl<C> common::Hub for Networkconnectivity<C> {}
136
137impl<'a, C> Networkconnectivity<C> {
138 pub fn new<A: 'static + common::GetToken>(
139 client: common::Client<C>,
140 auth: A,
141 ) -> Networkconnectivity<C> {
142 Networkconnectivity {
143 client,
144 auth: Box::new(auth),
145 _user_agent: "google-api-rust-client/7.0.0".to_string(),
146 _base_url: "https://networkconnectivity.googleapis.com/".to_string(),
147 _root_url: "https://networkconnectivity.googleapis.com/".to_string(),
148 }
149 }
150
151 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
152 ProjectMethods { hub: self }
153 }
154
155 /// Set the user-agent header field to use in all requests to the server.
156 /// It defaults to `google-api-rust-client/7.0.0`.
157 ///
158 /// Returns the previously set user-agent.
159 pub fn user_agent(&mut self, agent_name: String) -> String {
160 std::mem::replace(&mut self._user_agent, agent_name)
161 }
162
163 /// Set the base url to use in all requests to the server.
164 /// It defaults to `https://networkconnectivity.googleapis.com/`.
165 ///
166 /// Returns the previously set base url.
167 pub fn base_url(&mut self, new_base_url: String) -> String {
168 std::mem::replace(&mut self._base_url, new_base_url)
169 }
170
171 /// Set the root url to use in all requests to the server.
172 /// It defaults to `https://networkconnectivity.googleapis.com/`.
173 ///
174 /// Returns the previously set root url.
175 pub fn root_url(&mut self, new_root_url: String) -> String {
176 std::mem::replace(&mut self._root_url, new_root_url)
177 }
178}
179
180// ############
181// SCHEMAS ###
182// ##########
183/// The request for HubService.AcceptHubSpoke.
184///
185/// # Activities
186///
187/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
188/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
189///
190/// * [locations global hubs accept spoke projects](ProjectLocationGlobalHubAcceptSpokeCall) (request)
191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
192#[serde_with::serde_as]
193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
194pub struct AcceptHubSpokeRequest {
195 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
196 #[serde(rename = "requestId")]
197 pub request_id: Option<String>,
198 /// Required. The URI of the spoke to accept into the hub.
199 #[serde(rename = "spokeUri")]
200 pub spoke_uri: Option<String>,
201}
202
203impl common::RequestValue for AcceptHubSpokeRequest {}
204
205/// The request for HubService.AcceptSpokeUpdate.
206///
207/// # Activities
208///
209/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
210/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
211///
212/// * [locations global hubs accept spoke update projects](ProjectLocationGlobalHubAcceptSpokeUpdateCall) (request)
213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
214#[serde_with::serde_as]
215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
216pub struct AcceptSpokeUpdateRequest {
217 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
218 #[serde(rename = "requestId")]
219 pub request_id: Option<String>,
220 /// Required. The etag of the spoke to accept update.
221 #[serde(rename = "spokeEtag")]
222 pub spoke_etag: Option<String>,
223 /// Required. The URI of the spoke to accept update.
224 #[serde(rename = "spokeUri")]
225 pub spoke_uri: Option<String>,
226}
227
228impl common::RequestValue for AcceptSpokeUpdateRequest {}
229
230/// Range auto-allocation options, to be optionally used when CIDR block is not explicitly set.
231///
232/// This type is not used in any activity, and only used as *part* of another schema.
233///
234#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
235#[serde_with::serde_as]
236#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
237pub struct AllocationOptions {
238 /// Optional. Allocation strategy Not setting this field when the allocation is requested means an implementation defined strategy is used.
239 #[serde(rename = "allocationStrategy")]
240 pub allocation_strategy: Option<String>,
241 /// Optional. This field must be set only when allocation_strategy is set to RANDOM_FIRST_N_AVAILABLE. The value should be the maximum expected parallelism of range creation requests issued to the same space of peered netwroks.
242 #[serde(rename = "firstAvailableRangesLookupSize")]
243 pub first_available_ranges_lookup_size: Option<i32>,
244}
245
246impl common::Part for AllocationOptions {}
247
248/// 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.
249///
250/// This type is not used in any activity, and only used as *part* of another schema.
251///
252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
253#[serde_with::serde_as]
254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
255pub struct AuditConfig {
256 /// The configuration for logging of each type of permission.
257 #[serde(rename = "auditLogConfigs")]
258 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
259 /// 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.
260 pub service: Option<String>,
261}
262
263impl common::Part for AuditConfig {}
264
265/// 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.
266///
267/// This type is not used in any activity, and only used as *part* of another schema.
268///
269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
270#[serde_with::serde_as]
271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
272pub struct AuditLogConfig {
273 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
274 #[serde(rename = "exemptedMembers")]
275 pub exempted_members: Option<Vec<String>>,
276 /// The log type that this config enables.
277 #[serde(rename = "logType")]
278 pub log_type: Option<String>,
279}
280
281impl common::Part for AuditLogConfig {}
282
283/// The auto-accept setting for a group controls whether proposed spokes are automatically attached to the hub. If auto-accept is enabled, the spoke immediately is attached to the hub and becomes part of the group. In this case, the new spoke is in the ACTIVE state. If auto-accept is disabled, the spoke goes to the INACTIVE state, and it must be reviewed and accepted by a hub administrator.
284///
285/// This type is not used in any activity, and only used as *part* of another schema.
286///
287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
288#[serde_with::serde_as]
289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
290pub struct AutoAccept {
291 /// Optional. A list of project ids or project numbers for which you want to enable auto-accept. The auto-accept setting is applied to spokes being created or updated in these projects.
292 #[serde(rename = "autoAcceptProjects")]
293 pub auto_accept_projects: Option<Vec<String>>,
294}
295
296impl common::Part for AutoAccept {}
297
298/// Information for the automatically created subnetwork and its associated IR.
299///
300/// This type is not used in any activity, and only used as *part* of another schema.
301///
302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
303#[serde_with::serde_as]
304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
305pub struct AutoCreatedSubnetworkInfo {
306 /// Output only. URI of the automatically created Internal Range. Only set if the subnetwork mode is AUTO_CREATED during creation.
307 #[serde(rename = "internalRange")]
308 pub internal_range: Option<String>,
309 /// Output only. URI of the automatically created Internal Range reference. Only set if the subnetwork mode is AUTO_CREATED during creation.
310 #[serde(rename = "internalRangeRef")]
311 pub internal_range_ref: Option<String>,
312 /// Output only. URI of the automatically created subnetwork. Only set if the subnetwork mode is AUTO_CREATED during creation.
313 pub subnetwork: Option<String>,
314 /// Output only. URI of the automatically created subnetwork reference. Only set if the subnetwork mode is AUTO_CREATED during creation.
315 #[serde(rename = "subnetworkRef")]
316 pub subnetwork_ref: Option<String>,
317}
318
319impl common::Part for AutoCreatedSubnetworkInfo {}
320
321/// The specification for automatically creating a DNS record.
322///
323/// This type is not used in any activity, and only used as *part* of another schema.
324///
325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
326#[serde_with::serde_as]
327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
328pub struct AutomatedDnsCreationSpec {
329 /// Required. The DNS suffix to use for the DNS record. Must end with a dot. This should be a valid DNS domain name as per RFC 1035. Each label (between dots) can contain letters, digits, and hyphens, and must not start or end with a hyphen. Example: "my-service.example.com.", "internal."
330 #[serde(rename = "dnsSuffix")]
331 pub dns_suffix: Option<String>,
332 /// Required. The hostname (the first label of the FQDN) to use for the DNS record. This should be a valid DNS label as per RFC 1035. Generally, this means the hostname can contain letters, digits, and hyphens, and must not start or end with a hyphen. Example: "my-instance", "db-1"
333 pub hostname: Option<String>,
334 /// Optional. The Time To Live for the DNS record, in seconds. If not provided, a default of 30 seconds will be used.
335 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
336 pub ttl: Option<chrono::Duration>,
337}
338
339impl common::Part for AutomatedDnsCreationSpec {}
340
341/// Associates `members`, or principals, with a `role`.
342///
343/// This type is not used in any activity, and only used as *part* of another schema.
344///
345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
346#[serde_with::serde_as]
347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
348pub struct Binding {
349 /// 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).
350 pub condition: Option<Expr>,
351 /// 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`.
352 pub members: Option<Vec<String>>,
353 /// 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).
354 pub role: Option<String>,
355}
356
357impl common::Part for Binding {}
358
359/// Request for CheckConsumerConfig.
360///
361/// # Activities
362///
363/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
364/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
365///
366/// * [locations check consumer config projects](ProjectLocationCheckConsumerConfigCall) (request)
367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
368#[serde_with::serde_as]
369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
370pub struct CheckConsumerConfigRequest {
371 /// Required. Full resource name of the consumer network. Example: - projects/{project}/global/networks/{network}.
372 #[serde(rename = "consumerNetwork")]
373 pub consumer_network: Option<String>,
374 /// The project number or ID where the PSC endpoint is to be created.
375 #[serde(rename = "endpointProject")]
376 pub endpoint_project: Option<String>,
377 /// The requested IP Version
378 #[serde(rename = "requestedIpVersion")]
379 pub requested_ip_version: Option<String>,
380 /// Required. The service class identifier of the producer.
381 #[serde(rename = "serviceClass")]
382 pub service_class: Option<String>,
383}
384
385impl common::RequestValue for CheckConsumerConfigRequest {}
386
387/// Response for CheckConsumerConfig.
388///
389/// # Activities
390///
391/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
392/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
393///
394/// * [locations check consumer config projects](ProjectLocationCheckConsumerConfigCall) (response)
395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
396#[serde_with::serde_as]
397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
398pub struct CheckConsumerConfigResponse {
399 /// List of validation errors. If the list is empty, the consumer config is valid.
400 pub errors: Option<Vec<String>>,
401}
402
403impl common::ResponseResult for CheckConsumerConfigResponse {}
404
405/// Allow the producer to specify which consumers can connect to it.
406///
407/// This type is not used in any activity, and only used as *part* of another schema.
408///
409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
410#[serde_with::serde_as]
411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
412pub struct ConsumerPscConfig {
413 /// Required. The project ID or project number of the consumer project. This project is the one that the consumer uses to interact with the producer instance. From the perspective of a consumer who's created a producer instance, this is the project of the producer instance. Format: 'projects/' Eg. 'projects/consumer-project' or 'projects/1234'
414 #[serde(rename = "consumerInstanceProject")]
415 pub consumer_instance_project: Option<String>,
416 /// This is used in PSC consumer ForwardingRule to control whether the PSC endpoint can be accessed from another region.
417 #[serde(rename = "disableGlobalAccess")]
418 pub disable_global_access: Option<bool>,
419 /// The requested IP version for the PSC connection.
420 #[serde(rename = "ipVersion")]
421 pub ip_version: Option<String>,
422 /// The resource path of the consumer network where PSC connections are allowed to be created in. Note, this network does not need be in the ConsumerPscConfig.project in the case of SharedVPC. Example: projects/{projectNumOrId}/global/networks/{networkId}.
423 pub network: Option<String>,
424 /// Immutable. Deprecated. Use producer_instance_metadata instead. An immutable identifier for the producer instance.
425 #[serde(rename = "producerInstanceId")]
426 pub producer_instance_id: Option<String>,
427 /// Immutable. An immutable map for the producer instance metadata.
428 #[serde(rename = "producerInstanceMetadata")]
429 pub producer_instance_metadata: Option<HashMap<String, String>>,
430 /// The consumer project where PSC connections are allowed to be created in.
431 pub project: Option<String>,
432 /// Optional. A map to store mapping between customer vip and target service attachment. This field can be used to specify a static IP address for a PSC connection.
433 #[serde(rename = "serviceAttachmentIpAddressMap")]
434 pub service_attachment_ip_address_map: Option<HashMap<String, String>>,
435 /// Output only. Overall state of PSC Connections management for this consumer psc config.
436 pub state: Option<String>,
437}
438
439impl common::Part for ConsumerPscConfig {}
440
441/// PSC connection details on consumer side.
442///
443/// This type is not used in any activity, and only used as *part* of another schema.
444///
445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
446#[serde_with::serde_as]
447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
448pub struct ConsumerPscConnection {
449 /// Output only. The status of DNS automation for this PSC connection.
450 #[serde(rename = "dnsAutomationStatus")]
451 pub dns_automation_status: Option<DnsAutomationStatus>,
452 /// The most recent error during operating this connection.
453 pub error: Option<GoogleRpcStatus>,
454 /// Output only. The error info for the latest error during operating this connection.
455 #[serde(rename = "errorInfo")]
456 pub error_info: Option<GoogleRpcErrorInfo>,
457 /// The error type indicates whether the error is consumer facing, producer facing or system internal.
458 #[serde(rename = "errorType")]
459 pub error_type: Option<String>,
460 /// The URI of the consumer forwarding rule created. Example: projects/{projectNumOrId}/regions/us-east1/networks/{resourceId}.
461 #[serde(rename = "forwardingRule")]
462 pub forwarding_rule: Option<String>,
463 /// The last Compute Engine operation to setup PSC connection.
464 #[serde(rename = "gceOperation")]
465 pub gce_operation: Option<String>,
466 /// The IP literal allocated on the consumer network for the PSC forwarding rule that is created to connect to the producer service attachment in this service connection map.
467 pub ip: Option<String>,
468 /// The requested IP version for the PSC connection.
469 #[serde(rename = "ipVersion")]
470 pub ip_version: Option<String>,
471 /// The consumer network whose PSC forwarding rule is connected to the service attachments in this service connection map. Note that the network could be on a different project (shared VPC).
472 pub network: Option<String>,
473 /// Immutable. Deprecated. Use producer_instance_metadata instead. An immutable identifier for the producer instance.
474 #[serde(rename = "producerInstanceId")]
475 pub producer_instance_id: Option<String>,
476 /// Immutable. An immutable map for the producer instance metadata.
477 #[serde(rename = "producerInstanceMetadata")]
478 pub producer_instance_metadata: Option<HashMap<String, String>>,
479 /// The consumer project whose PSC forwarding rule is connected to the service attachments in this service connection map.
480 pub project: Option<String>,
481 /// The PSC connection id of the PSC forwarding rule connected to the service attachments in this service connection map.
482 #[serde(rename = "pscConnectionId")]
483 pub psc_connection_id: Option<String>,
484 /// Output only. The URI of the selected subnetwork selected to allocate IP address for this connection.
485 #[serde(rename = "selectedSubnetwork")]
486 pub selected_subnetwork: Option<String>,
487 /// The URI of a service attachment which is the target of the PSC connection.
488 #[serde(rename = "serviceAttachmentUri")]
489 pub service_attachment_uri: Option<String>,
490 /// The state of the PSC connection.
491 pub state: Option<String>,
492}
493
494impl common::Part for ConsumerPscConnection {}
495
496/// The `Destination` resource. It specifies the IP prefix and the associated autonomous system numbers (ASN) that you want to include in a `MulticloudDataTransferConfig` resource.
497///
498/// # Activities
499///
500/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
501/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
502///
503/// * [locations multicloud data transfer configs destinations create projects](ProjectLocationMulticloudDataTransferConfigDestinationCreateCall) (request)
504/// * [locations multicloud data transfer configs destinations get projects](ProjectLocationMulticloudDataTransferConfigDestinationGetCall) (response)
505/// * [locations multicloud data transfer configs destinations patch projects](ProjectLocationMulticloudDataTransferConfigDestinationPatchCall) (request)
506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
507#[serde_with::serde_as]
508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
509pub struct Destination {
510 /// Output only. Time when the `Destination` resource was created.
511 #[serde(rename = "createTime")]
512 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
513 /// Optional. A description of this resource.
514 pub description: Option<String>,
515 /// Required. Unordered list. The list of `DestinationEndpoint` resources configured for the IP prefix.
516 pub endpoints: Option<Vec<DestinationEndpoint>>,
517 /// The etag is computed by the server, and might be sent with update and delete requests so that the client has an up-to-date value before proceeding.
518 pub etag: Option<String>,
519 /// Required. Immutable. The IP prefix that represents your workload on another CSP.
520 #[serde(rename = "ipPrefix")]
521 pub ip_prefix: Option<String>,
522 /// Optional. User-defined labels.
523 pub labels: Option<HashMap<String, String>>,
524 /// Identifier. The name of the `Destination` resource. Format: `projects/{project}/locations/{location}/multicloudDataTransferConfigs/{multicloud_data_transfer_config}/destinations/{destination}`.
525 pub name: Option<String>,
526 /// Output only. The timeline of the expected `Destination` states or the current rest state. If a state change is expected, the value is `ADDING`, `DELETING` or `SUSPENDING`, depending on the action specified. Example: "state_timeline": { "states": [ { // The time when the `Destination` resource will be activated. "effectiveTime": "2024-12-01T08:00:00Z", "state": "ADDING" }, { // The time when the `Destination` resource will be suspended. "effectiveTime": "2024-12-01T20:00:00Z", "state": "SUSPENDING" } ] }
527 #[serde(rename = "stateTimeline")]
528 pub state_timeline: Option<StateTimeline>,
529 /// Output only. The Google-generated unique ID for the `Destination` resource. This value is unique across all `Destination` resources. If a resource is deleted and another with the same name is created, the new resource is assigned a different and unique ID.
530 pub uid: Option<String>,
531 /// Output only. Time when the `Destination` resource was updated.
532 #[serde(rename = "updateTime")]
533 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
534}
535
536impl common::RequestValue for Destination {}
537impl common::ResponseResult for Destination {}
538
539/// The metadata for a `DestinationEndpoint` resource.
540///
541/// This type is not used in any activity, and only used as *part* of another schema.
542///
543#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
544#[serde_with::serde_as]
545#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
546pub struct DestinationEndpoint {
547 /// Required. The ASN of the remote IP prefix.
548 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
549 pub asn: Option<i64>,
550 /// Required. The CSP of the remote IP prefix.
551 pub csp: Option<String>,
552 /// Output only. The state of the `DestinationEndpoint` resource.
553 pub state: Option<String>,
554 /// Output only. Time when the `DestinationEndpoint` resource was updated.
555 #[serde(rename = "updateTime")]
556 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
557}
558
559impl common::Part for DestinationEndpoint {}
560
561/// The status of DNS automation for a PSC connection.
562///
563/// This type is not used in any activity, and only used as *part* of another schema.
564///
565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
566#[serde_with::serde_as]
567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
568pub struct DnsAutomationStatus {
569 /// Output only. The error details if the state is CREATE_FAILED or DELETE_FAILED.
570 pub error: Option<GoogleRpcStatus>,
571 /// Output only. The fully qualified domain name of the DNS record.
572 pub fqdn: Option<String>,
573 /// Output only. The current state of DNS automation.
574 pub state: Option<String>,
575}
576
577impl common::Part for DnsAutomationStatus {}
578
579/// 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); }
580///
581/// # Activities
582///
583/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
584/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
585///
586/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
587/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
588#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
589#[serde_with::serde_as]
590#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
591pub struct Empty {
592 _never_set: Option<bool>,
593}
594
595impl common::ResponseResult for Empty {}
596
597/// 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.
598///
599/// This type is not used in any activity, and only used as *part* of another schema.
600///
601#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
602#[serde_with::serde_as]
603#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
604pub struct Expr {
605 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
606 pub description: Option<String>,
607 /// Textual representation of an expression in Common Expression Language syntax.
608 pub expression: Option<String>,
609 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
610 pub location: Option<String>,
611 /// 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.
612 pub title: Option<String>,
613}
614
615impl common::Part for Expr {}
616
617/// Filter matches L4 traffic.
618///
619/// This type is not used in any activity, and only used as *part* of another schema.
620///
621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
622#[serde_with::serde_as]
623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
624pub struct Filter {
625 /// Optional. The destination IP range of outgoing packets that this policy-based route applies to. Default is "0.0.0.0/0" if protocol version is IPv4 and "::/0" if protocol version is IPv6.
626 #[serde(rename = "destRange")]
627 pub dest_range: Option<String>,
628 /// Optional. The IP protocol that this policy-based route applies to. Valid values are 'TCP', 'UDP', and 'ALL'. Default is 'ALL'.
629 #[serde(rename = "ipProtocol")]
630 pub ip_protocol: Option<String>,
631 /// Required. Internet protocol versions this policy-based route applies to. IPV4 and IPV6 is supported.
632 #[serde(rename = "protocolVersion")]
633 pub protocol_version: Option<String>,
634 /// Optional. The source IP range of outgoing packets that this policy-based route applies to. Default is "0.0.0.0/0" if protocol version is IPv4 and "::/0" if protocol version is IPv6.
635 #[serde(rename = "srcRange")]
636 pub src_range: Option<String>,
637}
638
639impl common::Part for Filter {}
640
641/// The request message for Operations.CancelOperation.
642///
643/// # Activities
644///
645/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
646/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
647///
648/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
650#[serde_with::serde_as]
651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
652pub struct GoogleLongrunningCancelOperationRequest {
653 _never_set: Option<bool>,
654}
655
656impl common::RequestValue for GoogleLongrunningCancelOperationRequest {}
657
658/// The response message for Operations.ListOperations.
659///
660/// # Activities
661///
662/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
663/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
664///
665/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
667#[serde_with::serde_as]
668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
669pub struct GoogleLongrunningListOperationsResponse {
670 /// The standard List next-page token.
671 #[serde(rename = "nextPageToken")]
672 pub next_page_token: Option<String>,
673 /// A list of operations that matches the specified filter in the request.
674 pub operations: Option<Vec<GoogleLongrunningOperation>>,
675 /// 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.
676 pub unreachable: Option<Vec<String>>,
677}
678
679impl common::ResponseResult for GoogleLongrunningListOperationsResponse {}
680
681/// This resource represents a long-running operation that is the result of a network API call.
682///
683/// # Activities
684///
685/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
686/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
687///
688/// * [locations global hubs groups patch projects](ProjectLocationGlobalHubGroupPatchCall) (response)
689/// * [locations global hubs accept spoke projects](ProjectLocationGlobalHubAcceptSpokeCall) (response)
690/// * [locations global hubs accept spoke update projects](ProjectLocationGlobalHubAcceptSpokeUpdateCall) (response)
691/// * [locations global hubs create projects](ProjectLocationGlobalHubCreateCall) (response)
692/// * [locations global hubs delete projects](ProjectLocationGlobalHubDeleteCall) (response)
693/// * [locations global hubs patch projects](ProjectLocationGlobalHubPatchCall) (response)
694/// * [locations global hubs reject spoke projects](ProjectLocationGlobalHubRejectSpokeCall) (response)
695/// * [locations global hubs reject spoke update projects](ProjectLocationGlobalHubRejectSpokeUpdateCall) (response)
696/// * [locations global policy based routes create projects](ProjectLocationGlobalPolicyBasedRouteCreateCall) (response)
697/// * [locations global policy based routes delete projects](ProjectLocationGlobalPolicyBasedRouteDeleteCall) (response)
698/// * [locations internal ranges create projects](ProjectLocationInternalRangeCreateCall) (response)
699/// * [locations internal ranges delete projects](ProjectLocationInternalRangeDeleteCall) (response)
700/// * [locations internal ranges patch projects](ProjectLocationInternalRangePatchCall) (response)
701/// * [locations multicloud data transfer configs destinations create projects](ProjectLocationMulticloudDataTransferConfigDestinationCreateCall) (response)
702/// * [locations multicloud data transfer configs destinations delete projects](ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall) (response)
703/// * [locations multicloud data transfer configs destinations patch projects](ProjectLocationMulticloudDataTransferConfigDestinationPatchCall) (response)
704/// * [locations multicloud data transfer configs create projects](ProjectLocationMulticloudDataTransferConfigCreateCall) (response)
705/// * [locations multicloud data transfer configs delete projects](ProjectLocationMulticloudDataTransferConfigDeleteCall) (response)
706/// * [locations multicloud data transfer configs patch projects](ProjectLocationMulticloudDataTransferConfigPatchCall) (response)
707/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
708/// * [locations regional endpoints create projects](ProjectLocationRegionalEndpointCreateCall) (response)
709/// * [locations regional endpoints delete projects](ProjectLocationRegionalEndpointDeleteCall) (response)
710/// * [locations service classes delete projects](ProjectLocationServiceClassDeleteCall) (response)
711/// * [locations service classes patch projects](ProjectLocationServiceClassPatchCall) (response)
712/// * [locations service connection maps create projects](ProjectLocationServiceConnectionMapCreateCall) (response)
713/// * [locations service connection maps delete projects](ProjectLocationServiceConnectionMapDeleteCall) (response)
714/// * [locations service connection maps patch projects](ProjectLocationServiceConnectionMapPatchCall) (response)
715/// * [locations service connection policies create projects](ProjectLocationServiceConnectionPolicyCreateCall) (response)
716/// * [locations service connection policies delete projects](ProjectLocationServiceConnectionPolicyDeleteCall) (response)
717/// * [locations service connection policies patch projects](ProjectLocationServiceConnectionPolicyPatchCall) (response)
718/// * [locations service connection tokens create projects](ProjectLocationServiceConnectionTokenCreateCall) (response)
719/// * [locations service connection tokens delete projects](ProjectLocationServiceConnectionTokenDeleteCall) (response)
720/// * [locations spokes create projects](ProjectLocationSpokeCreateCall) (response)
721/// * [locations spokes delete projects](ProjectLocationSpokeDeleteCall) (response)
722/// * [locations spokes patch projects](ProjectLocationSpokePatchCall) (response)
723#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
724#[serde_with::serde_as]
725#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
726pub struct GoogleLongrunningOperation {
727 /// 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.
728 pub done: Option<bool>,
729 /// The error result of the operation in case of failure or cancellation.
730 pub error: Option<GoogleRpcStatus>,
731 /// 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.
732 pub metadata: Option<HashMap<String, serde_json::Value>>,
733 /// 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}`.
734 pub name: Option<String>,
735 /// 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`.
736 pub response: Option<HashMap<String, serde_json::Value>>,
737}
738
739impl common::ResponseResult for GoogleLongrunningOperation {}
740
741/// Describes the cause of the error with structured details. Example of an error when contacting the "pubsub.googleapis.com" API when it is not enabled: { "reason": "API_DISABLED" "domain": "googleapis.com" "metadata": { "resource": "projects/123", "service": "pubsub.googleapis.com" } } This response indicates that the pubsub.googleapis.com API is not enabled. Example of an error that is returned when attempting to create a Spanner instance in a region that is out of stock: { "reason": "STOCKOUT" "domain": "spanner.googleapis.com", "metadata": { "availableRegions": "us-central1,us-east2" } }
742///
743/// This type is not used in any activity, and only used as *part* of another schema.
744///
745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
746#[serde_with::serde_as]
747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
748pub struct GoogleRpcErrorInfo {
749 /// The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
750 pub domain: Option<String>,
751 /// Additional structured details about this error. Keys must match a regular expression of `a-z+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.
752 pub metadata: Option<HashMap<String, String>>,
753 /// The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `A-Z+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
754 pub reason: Option<String>,
755}
756
757impl common::Part for GoogleRpcErrorInfo {}
758
759/// 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).
760///
761/// This type is not used in any activity, and only used as *part* of another schema.
762///
763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
764#[serde_with::serde_as]
765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
766pub struct GoogleRpcStatus {
767 /// The status code, which should be an enum value of google.rpc.Code.
768 pub code: Option<i32>,
769 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
770 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
771 /// 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.
772 pub message: Option<String>,
773}
774
775impl common::Part for GoogleRpcStatus {}
776
777/// A group represents a subset of spokes attached to a hub.
778///
779/// # Activities
780///
781/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
782/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
783///
784/// * [locations global hubs groups get projects](ProjectLocationGlobalHubGroupGetCall) (response)
785/// * [locations global hubs groups patch projects](ProjectLocationGlobalHubGroupPatchCall) (request)
786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
787#[serde_with::serde_as]
788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
789pub struct Group {
790 /// Optional. The auto-accept setting for this group.
791 #[serde(rename = "autoAccept")]
792 pub auto_accept: Option<AutoAccept>,
793 /// Output only. The time the group was created.
794 #[serde(rename = "createTime")]
795 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
796 /// Optional. The description of the group.
797 pub description: Option<String>,
798 /// Optional. Labels in key-value pair format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
799 pub labels: Option<HashMap<String, String>>,
800 /// Immutable. The name of the group. Group names must be unique. They use the following form: `projects/{project_number}/locations/global/hubs/{hub}/groups/{group_id}`
801 pub name: Option<String>,
802 /// Output only. The name of the route table that corresponds to this group. They use the following form: `projects/{project_number}/locations/global/hubs/{hub_id}/routeTables/{route_table_id}`
803 #[serde(rename = "routeTable")]
804 pub route_table: Option<String>,
805 /// Output only. The current lifecycle state of this group.
806 pub state: Option<String>,
807 /// Output only. The Google-generated UUID for the group. This value is unique across all group resources. If a group is deleted and another with the same name is created, the new route table is assigned a different unique_id.
808 pub uid: Option<String>,
809 /// Output only. The time the group was last updated.
810 #[serde(rename = "updateTime")]
811 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
812}
813
814impl common::RequestValue for Group {}
815impl common::ResponseResult for Group {}
816
817/// A Network Connectivity Center hub is a global management resource to which you attach spokes. A single hub can contain spokes from multiple regions. However, if any of a hub’s spokes use the site-to-site data transfer feature, the resources associated with those spokes must all be in the same VPC network. Spokes that do not use site-to-site data transfer can be associated with any VPC network in your project.
818///
819/// # Activities
820///
821/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
822/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
823///
824/// * [locations global hubs create projects](ProjectLocationGlobalHubCreateCall) (request)
825/// * [locations global hubs get projects](ProjectLocationGlobalHubGetCall) (response)
826/// * [locations global hubs patch projects](ProjectLocationGlobalHubPatchCall) (request)
827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
828#[serde_with::serde_as]
829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
830pub struct Hub {
831 /// Output only. The time the hub was created.
832 #[serde(rename = "createTime")]
833 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
834 /// Optional. An optional description of the hub.
835 pub description: Option<String>,
836 /// Optional. Whether Private Service Connect connection propagation is enabled for the hub. If true, Private Service Connect endpoints in VPC spokes attached to the hub are made accessible to other VPC spokes attached to the hub. The default value is false.
837 #[serde(rename = "exportPsc")]
838 pub export_psc: Option<bool>,
839 /// Optional labels in key-value pair format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
840 pub labels: Option<HashMap<String, String>>,
841 /// Immutable. The name of the hub. Hub names must be unique. They use the following form: `projects/{project_number}/locations/global/hubs/{hub_id}`
842 pub name: Option<String>,
843 /// Optional. The policy mode of this hub. This field can be either PRESET or CUSTOM. If unspecified, the policy_mode defaults to PRESET.
844 #[serde(rename = "policyMode")]
845 pub policy_mode: Option<String>,
846 /// Optional. The topology implemented in this hub. Currently, this field is only used when policy_mode = PRESET. The available preset topologies are MESH and STAR. If preset_topology is unspecified and policy_mode = PRESET, the preset_topology defaults to MESH. When policy_mode = CUSTOM, the preset_topology is set to PRESET_TOPOLOGY_UNSPECIFIED.
847 #[serde(rename = "presetTopology")]
848 pub preset_topology: Option<String>,
849 /// Output only. The route tables that belong to this hub. They use the following form: `projects/{project_number}/locations/global/hubs/{hub_id}/routeTables/{route_table_id}` This field is read-only. Network Connectivity Center automatically populates it based on the route tables nested under the hub.
850 #[serde(rename = "routeTables")]
851 pub route_tables: Option<Vec<String>>,
852 /// Output only. The VPC networks associated with this hub's spokes. This field is read-only. Network Connectivity Center automatically populates it based on the set of spokes attached to the hub.
853 #[serde(rename = "routingVpcs")]
854 pub routing_vpcs: Option<Vec<RoutingVPC>>,
855 /// Output only. A summary of the spokes associated with a hub. The summary includes a count of spokes according to type and according to state. If any spokes are inactive, the summary also lists the reasons they are inactive, including a count for each reason.
856 #[serde(rename = "spokeSummary")]
857 pub spoke_summary: Option<SpokeSummary>,
858 /// Output only. The current lifecycle state of this hub.
859 pub state: Option<String>,
860 /// Output only. The Google-generated UUID for the hub. This value is unique across all hub resources. If a hub is deleted and another with the same name is created, the new hub is assigned a different unique_id.
861 #[serde(rename = "uniqueId")]
862 pub unique_id: Option<String>,
863 /// Output only. The time the hub was last updated.
864 #[serde(rename = "updateTime")]
865 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
866}
867
868impl common::RequestValue for Hub {}
869impl common::ResponseResult for Hub {}
870
871/// A hub status entry represents the status of a set of propagated Private Service Connect connections grouped by certain fields.
872///
873/// This type is not used in any activity, and only used as *part* of another schema.
874///
875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
876#[serde_with::serde_as]
877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
878pub struct HubStatusEntry {
879 /// The number of propagated Private Service Connect connections with this status. If the `group_by` field was not set in the request message, the value of this field is 1.
880 pub count: Option<i32>,
881 /// The fields that this entry is grouped by. This has the same value as the `group_by` field in the request message.
882 #[serde(rename = "groupBy")]
883 pub group_by: Option<String>,
884 /// The Private Service Connect propagation status.
885 #[serde(rename = "pscPropagationStatus")]
886 pub psc_propagation_status: Option<PscPropagationStatus>,
887}
888
889impl common::Part for HubStatusEntry {}
890
891/// InterconnectAttachment that this route applies to.
892///
893/// This type is not used in any activity, and only used as *part* of another schema.
894///
895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
896#[serde_with::serde_as]
897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
898pub struct InterconnectAttachment {
899 /// Optional. Cloud region to install this policy-based route on interconnect attachment. Use `all` to install it on all interconnect attachments.
900 pub region: Option<String>,
901}
902
903impl common::Part for InterconnectAttachment {}
904
905/// The internal range resource for IPAM operations within a VPC network. Used to represent a private address range along with behavioral characteristics of that range (its usage and peering behavior). Networking resources can link to this range if they are created as belonging to it.
906///
907/// # Activities
908///
909/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
910/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
911///
912/// * [locations internal ranges create projects](ProjectLocationInternalRangeCreateCall) (request)
913/// * [locations internal ranges get projects](ProjectLocationInternalRangeGetCall) (response)
914/// * [locations internal ranges patch projects](ProjectLocationInternalRangePatchCall) (request)
915#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
916#[serde_with::serde_as]
917#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
918pub struct InternalRange {
919 /// Optional. Range auto-allocation options, may be set only when auto-allocation is selected by not setting ip_cidr_range (and setting prefix_length).
920 #[serde(rename = "allocationOptions")]
921 pub allocation_options: Option<AllocationOptions>,
922 /// Time when the internal range was created.
923 #[serde(rename = "createTime")]
924 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
925 /// Optional. A description of this resource.
926 pub description: Option<String>,
927 /// Optional. ExcludeCidrRanges flag. Specifies a set of CIDR blocks that allows exclusion of particular CIDR ranges from the auto-allocation process, without having to reserve these blocks
928 #[serde(rename = "excludeCidrRanges")]
929 pub exclude_cidr_ranges: Option<Vec<String>>,
930 /// Optional. Immutable ranges cannot have their fields modified, except for labels and description.
931 pub immutable: Option<bool>,
932 /// Optional. The IP range that this internal range defines. NOTE: IPv6 ranges are limited to usage=EXTERNAL_TO_VPC and peering=FOR_SELF. NOTE: For IPv6 Ranges this field is compulsory, i.e. the address range must be specified explicitly.
933 #[serde(rename = "ipCidrRange")]
934 pub ip_cidr_range: Option<String>,
935 /// User-defined labels.
936 pub labels: Option<HashMap<String, String>>,
937 /// Optional. Must be present if usage is set to FOR_MIGRATION.
938 pub migration: Option<Migration>,
939 /// Identifier. The name of an internal range. Format: projects/{project}/locations/{location}/internalRanges/{internal_range} See: https://google.aip.dev/122#fields-representing-resource-names
940 pub name: Option<String>,
941 /// Immutable. The URL or resource ID of the network in which to reserve the internal range. The network cannot be deleted if there are any reserved internal ranges referring to it. Legacy networks are not supported. For example: https://www.googleapis.com/compute/v1/projects/{project}/locations/global/networks/{network} projects/{project}/locations/global/networks/{network} {network}
942 pub network: Option<String>,
943 /// Optional. Types of resources that are allowed to overlap with the current internal range.
944 pub overlaps: Option<Vec<String>>,
945 /// Optional. The type of peering set for this internal range.
946 pub peering: Option<String>,
947 /// Optional. An alternate to ip_cidr_range. Can be set when trying to create an IPv4 reservation that automatically finds a free range of the given size. If both ip_cidr_range and prefix_length are set, there is an error if the range sizes do not match. Can also be used during updates to change the range size. NOTE: For IPv6 this field only works if ip_cidr_range is set as well, and both fields must match. In other words, with IPv6 this field only works as a redundant parameter.
948 #[serde(rename = "prefixLength")]
949 pub prefix_length: Option<i32>,
950 /// Optional. Can be set to narrow down or pick a different address space while searching for a free range. If not set, defaults to the ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"] address space (for auto-mode networks, the "10.0.0.0/9" range is used instead of "10.0.0.0/8"). This can be used to target the search in other rfc-1918 address spaces like "172.16.0.0/12" and "192.168.0.0/16" or non-rfc-1918 address spaces used in the VPC.
951 #[serde(rename = "targetCidrRange")]
952 pub target_cidr_range: Option<Vec<String>>,
953 /// Time when the internal range was updated.
954 #[serde(rename = "updateTime")]
955 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
956 /// Optional. The type of usage set for this InternalRange.
957 pub usage: Option<String>,
958 /// Output only. The list of resources that refer to this internal range. Resources that use the internal range for their range allocation are referred to as users of the range. Other resources mark themselves as users while doing so by creating a reference to this internal range. Having a user, based on this reference, prevents deletion of the internal range referred to. Can be empty.
959 pub users: Option<Vec<String>>,
960}
961
962impl common::RequestValue for InternalRange {}
963impl common::ResponseResult for InternalRange {}
964
965/// A collection of VLAN attachment resources. These resources should be redundant attachments that all advertise the same prefixes to Google Cloud. Alternatively, in active/passive configurations, all attachments should be capable of advertising the same prefixes.
966///
967/// This type is not used in any activity, and only used as *part* of another schema.
968///
969#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
970#[serde_with::serde_as]
971#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
972pub struct LinkedInterconnectAttachments {
973 /// Optional. Hub routes fully encompassed by include import ranges are included during import from hub.
974 #[serde(rename = "includeImportRanges")]
975 pub include_import_ranges: Option<Vec<String>>,
976 /// A value that controls whether site-to-site data transfer is enabled for these resources. Data transfer is available only in [supported locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
977 #[serde(rename = "siteToSiteDataTransfer")]
978 pub site_to_site_data_transfer: Option<bool>,
979 /// The URIs of linked interconnect attachment resources
980 pub uris: Option<Vec<String>>,
981 /// Output only. The VPC network where these VLAN attachments are located.
982 #[serde(rename = "vpcNetwork")]
983 pub vpc_network: Option<String>,
984}
985
986impl common::Part for LinkedInterconnectAttachments {}
987
988/// There is no detailed description.
989///
990/// This type is not used in any activity, and only used as *part* of another schema.
991///
992#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
993#[serde_with::serde_as]
994#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
995pub struct LinkedProducerVpcNetwork {
996 /// Optional. IP ranges encompassing the subnets to be excluded from peering.
997 #[serde(rename = "excludeExportRanges")]
998 pub exclude_export_ranges: Option<Vec<String>>,
999 /// Optional. IP ranges allowed to be included from peering.
1000 #[serde(rename = "includeExportRanges")]
1001 pub include_export_ranges: Option<Vec<String>>,
1002 /// Immutable. The URI of the Service Consumer VPC that the Producer VPC is peered with.
1003 pub network: Option<String>,
1004 /// Immutable. The name of the VPC peering between the Service Consumer VPC and the Producer VPC (defined in the Tenant project) which is added to the NCC hub. This peering must be in ACTIVE state.
1005 pub peering: Option<String>,
1006 /// Output only. The URI of the Producer VPC.
1007 #[serde(rename = "producerNetwork")]
1008 pub producer_network: Option<String>,
1009 /// Output only. The proposed exclude export IP ranges waiting for hub administration's approval.
1010 #[serde(rename = "proposedExcludeExportRanges")]
1011 pub proposed_exclude_export_ranges: Option<Vec<String>>,
1012 /// Output only. The proposed include export IP ranges waiting for hub administration's approval.
1013 #[serde(rename = "proposedIncludeExportRanges")]
1014 pub proposed_include_export_ranges: Option<Vec<String>>,
1015 /// Output only. The Service Consumer Network spoke.
1016 #[serde(rename = "serviceConsumerVpcSpoke")]
1017 pub service_consumer_vpc_spoke: Option<String>,
1018}
1019
1020impl common::Part for LinkedProducerVpcNetwork {}
1021
1022/// A collection of router appliance instances. If you configure multiple router appliance instances to receive data from the same set of sites outside of Google Cloud, we recommend that you associate those instances with the same spoke.
1023///
1024/// This type is not used in any activity, and only used as *part* of another schema.
1025///
1026#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1027#[serde_with::serde_as]
1028#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1029pub struct LinkedRouterApplianceInstances {
1030 /// Optional. Hub routes fully encompassed by include import ranges are included during import from hub.
1031 #[serde(rename = "includeImportRanges")]
1032 pub include_import_ranges: Option<Vec<String>>,
1033 /// The list of router appliance instances.
1034 pub instances: Option<Vec<RouterApplianceInstance>>,
1035 /// A value that controls whether site-to-site data transfer is enabled for these resources. Data transfer is available only in [supported locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
1036 #[serde(rename = "siteToSiteDataTransfer")]
1037 pub site_to_site_data_transfer: Option<bool>,
1038 /// Output only. The VPC network where these router appliance instances are located.
1039 #[serde(rename = "vpcNetwork")]
1040 pub vpc_network: Option<String>,
1041}
1042
1043impl common::Part for LinkedRouterApplianceInstances {}
1044
1045/// An existing VPC network.
1046///
1047/// This type is not used in any activity, and only used as *part* of another schema.
1048///
1049#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1050#[serde_with::serde_as]
1051#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1052pub struct LinkedVpcNetwork {
1053 /// Optional. IP ranges encompassing the subnets to be excluded from peering.
1054 #[serde(rename = "excludeExportRanges")]
1055 pub exclude_export_ranges: Option<Vec<String>>,
1056 /// Optional. IP ranges allowed to be included from peering.
1057 #[serde(rename = "includeExportRanges")]
1058 pub include_export_ranges: Option<Vec<String>>,
1059 /// Output only. The list of Producer VPC spokes that this VPC spoke is a service consumer VPC spoke for. These producer VPCs are connected through VPC peering to this spoke's backing VPC network. Because they are directly connected through VPC peering, NCC export filters do not apply between the service consumer VPC spoke and any of its producer VPC spokes. This VPC spoke cannot be deleted as long as any of these producer VPC spokes are connected to the NCC Hub.
1060 #[serde(rename = "producerVpcSpokes")]
1061 pub producer_vpc_spokes: Option<Vec<String>>,
1062 /// Output only. The proposed exclude export IP ranges waiting for hub administration's approval.
1063 #[serde(rename = "proposedExcludeExportRanges")]
1064 pub proposed_exclude_export_ranges: Option<Vec<String>>,
1065 /// Output only. The proposed include export IP ranges waiting for hub administration's approval.
1066 #[serde(rename = "proposedIncludeExportRanges")]
1067 pub proposed_include_export_ranges: Option<Vec<String>>,
1068 /// Required. The URI of the VPC network resource.
1069 pub uri: Option<String>,
1070}
1071
1072impl common::Part for LinkedVpcNetwork {}
1073
1074/// A collection of Cloud VPN tunnel resources. These resources should be redundant HA VPN tunnels that all advertise the same prefixes to Google Cloud. Alternatively, in a passive/active configuration, all tunnels should be capable of advertising the same prefixes.
1075///
1076/// This type is not used in any activity, and only used as *part* of another schema.
1077///
1078#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1079#[serde_with::serde_as]
1080#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1081pub struct LinkedVpnTunnels {
1082 /// Optional. Hub routes fully encompassed by include import ranges are included during import from hub.
1083 #[serde(rename = "includeImportRanges")]
1084 pub include_import_ranges: Option<Vec<String>>,
1085 /// A value that controls whether site-to-site data transfer is enabled for these resources. Data transfer is available only in [supported locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
1086 #[serde(rename = "siteToSiteDataTransfer")]
1087 pub site_to_site_data_transfer: Option<bool>,
1088 /// The URIs of linked VPN tunnel resources.
1089 pub uris: Option<Vec<String>>,
1090 /// Output only. The VPC network where these VPN tunnels are located.
1091 #[serde(rename = "vpcNetwork")]
1092 pub vpc_network: Option<String>,
1093}
1094
1095impl common::Part for LinkedVpnTunnels {}
1096
1097/// Response message to list `Destination` resources.
1098///
1099/// # Activities
1100///
1101/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1102/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1103///
1104/// * [locations multicloud data transfer configs destinations list projects](ProjectLocationMulticloudDataTransferConfigDestinationListCall) (response)
1105#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1106#[serde_with::serde_as]
1107#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1108pub struct ListDestinationsResponse {
1109 /// The list of `Destination` resources to be listed.
1110 pub destinations: Option<Vec<Destination>>,
1111 /// The next page token.
1112 #[serde(rename = "nextPageToken")]
1113 pub next_page_token: Option<String>,
1114 /// Locations that could not be reached.
1115 pub unreachable: Option<Vec<String>>,
1116}
1117
1118impl common::ResponseResult for ListDestinationsResponse {}
1119
1120/// Response for HubService.ListGroups method.
1121///
1122/// # Activities
1123///
1124/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1125/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1126///
1127/// * [locations global hubs groups list projects](ProjectLocationGlobalHubGroupListCall) (response)
1128#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1129#[serde_with::serde_as]
1130#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1131pub struct ListGroupsResponse {
1132 /// The requested groups.
1133 pub groups: Option<Vec<Group>>,
1134 /// The token for the next page of the response. To see more results, use this value as the page_token for your next request. If this value is empty, there are no more results.
1135 #[serde(rename = "nextPageToken")]
1136 pub next_page_token: Option<String>,
1137 /// Hubs that could not be reached.
1138 pub unreachable: Option<Vec<String>>,
1139}
1140
1141impl common::ResponseResult for ListGroupsResponse {}
1142
1143/// The response for HubService.ListHubSpokes.
1144///
1145/// # Activities
1146///
1147/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1148/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1149///
1150/// * [locations global hubs list spokes projects](ProjectLocationGlobalHubListSpokeCall) (response)
1151#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1152#[serde_with::serde_as]
1153#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1154pub struct ListHubSpokesResponse {
1155 /// The token for the next page of the response. To see more results, use this value as the page_token for your next request. If this value is empty, there are no more results.
1156 #[serde(rename = "nextPageToken")]
1157 pub next_page_token: Option<String>,
1158 /// The requested spokes. The spoke fields can be partially populated based on the `view` field in the request message.
1159 pub spokes: Option<Vec<Spoke>>,
1160 /// Locations that could not be reached.
1161 pub unreachable: Option<Vec<String>>,
1162}
1163
1164impl common::ResponseResult for ListHubSpokesResponse {}
1165
1166/// Response for HubService.ListHubs method.
1167///
1168/// # Activities
1169///
1170/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1171/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1172///
1173/// * [locations global hubs list projects](ProjectLocationGlobalHubListCall) (response)
1174#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1175#[serde_with::serde_as]
1176#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1177pub struct ListHubsResponse {
1178 /// The requested hubs.
1179 pub hubs: Option<Vec<Hub>>,
1180 /// The token for the next page of the response. To see more results, use this value as the page_token for your next request. If this value is empty, there are no more results.
1181 #[serde(rename = "nextPageToken")]
1182 pub next_page_token: Option<String>,
1183 /// Locations that could not be reached.
1184 pub unreachable: Option<Vec<String>>,
1185}
1186
1187impl common::ResponseResult for ListHubsResponse {}
1188
1189/// Response for InternalRange.ListInternalRanges
1190///
1191/// # Activities
1192///
1193/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1194/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1195///
1196/// * [locations internal ranges list projects](ProjectLocationInternalRangeListCall) (response)
1197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1198#[serde_with::serde_as]
1199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1200pub struct ListInternalRangesResponse {
1201 /// Internal ranges to be returned.
1202 #[serde(rename = "internalRanges")]
1203 pub internal_ranges: Option<Vec<InternalRange>>,
1204 /// The next pagination token in the List response. It should be used as page_token for the following request. An empty value means no more result.
1205 #[serde(rename = "nextPageToken")]
1206 pub next_page_token: Option<String>,
1207 /// Locations that could not be reached.
1208 pub unreachable: Option<Vec<String>>,
1209}
1210
1211impl common::ResponseResult for ListInternalRangesResponse {}
1212
1213/// The response message for Locations.ListLocations.
1214///
1215/// # Activities
1216///
1217/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1218/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1219///
1220/// * [locations list projects](ProjectLocationListCall) (response)
1221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1222#[serde_with::serde_as]
1223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1224pub struct ListLocationsResponse {
1225 /// A list of locations that matches the specified filter in the request.
1226 pub locations: Option<Vec<Location>>,
1227 /// The standard List next-page token.
1228 #[serde(rename = "nextPageToken")]
1229 pub next_page_token: Option<String>,
1230}
1231
1232impl common::ResponseResult for ListLocationsResponse {}
1233
1234/// Response message to list `MulticloudDataTransferConfig` resources.
1235///
1236/// # Activities
1237///
1238/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1239/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1240///
1241/// * [locations multicloud data transfer configs list projects](ProjectLocationMulticloudDataTransferConfigListCall) (response)
1242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1243#[serde_with::serde_as]
1244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1245pub struct ListMulticloudDataTransferConfigsResponse {
1246 /// The list of `MulticloudDataTransferConfig` resources to be listed.
1247 #[serde(rename = "multicloudDataTransferConfigs")]
1248 pub multicloud_data_transfer_configs: Option<Vec<MulticloudDataTransferConfig>>,
1249 /// The next page token.
1250 #[serde(rename = "nextPageToken")]
1251 pub next_page_token: Option<String>,
1252 /// Locations that could not be reached.
1253 pub unreachable: Option<Vec<String>>,
1254}
1255
1256impl common::ResponseResult for ListMulticloudDataTransferConfigsResponse {}
1257
1258/// Response message to list the services in your project in regions that are eligible for Data Transfer Essentials configuration.
1259///
1260/// # Activities
1261///
1262/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1263/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1264///
1265/// * [locations multicloud data transfer supported services list projects](ProjectLocationMulticloudDataTransferSupportedServiceListCall) (response)
1266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1267#[serde_with::serde_as]
1268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1269pub struct ListMulticloudDataTransferSupportedServicesResponse {
1270 /// The list of supported services.
1271 #[serde(rename = "multicloudDataTransferSupportedServices")]
1272 pub multicloud_data_transfer_supported_services:
1273 Option<Vec<MulticloudDataTransferSupportedService>>,
1274 /// The next page token.
1275 #[serde(rename = "nextPageToken")]
1276 pub next_page_token: Option<String>,
1277}
1278
1279impl common::ResponseResult for ListMulticloudDataTransferSupportedServicesResponse {}
1280
1281/// Response for PolicyBasedRoutingService.ListPolicyBasedRoutes method.
1282///
1283/// # Activities
1284///
1285/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1286/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1287///
1288/// * [locations global policy based routes list projects](ProjectLocationGlobalPolicyBasedRouteListCall) (response)
1289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1290#[serde_with::serde_as]
1291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1292pub struct ListPolicyBasedRoutesResponse {
1293 /// The next pagination token in the List response. It should be used as page_token for the following request. An empty value means no more result.
1294 #[serde(rename = "nextPageToken")]
1295 pub next_page_token: Option<String>,
1296 /// Policy-based routes to be returned.
1297 #[serde(rename = "policyBasedRoutes")]
1298 pub policy_based_routes: Option<Vec<PolicyBasedRoute>>,
1299 /// Locations that could not be reached.
1300 pub unreachable: Option<Vec<String>>,
1301}
1302
1303impl common::ResponseResult for ListPolicyBasedRoutesResponse {}
1304
1305/// Response for ListRegionalEndpoints.
1306///
1307/// # Activities
1308///
1309/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1310/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1311///
1312/// * [locations regional endpoints list projects](ProjectLocationRegionalEndpointListCall) (response)
1313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1314#[serde_with::serde_as]
1315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1316pub struct ListRegionalEndpointsResponse {
1317 /// The next pagination token in the List response. It should be used as page_token for the following request. An empty value means no more result.
1318 #[serde(rename = "nextPageToken")]
1319 pub next_page_token: Option<String>,
1320 /// Regional endpoints to be returned.
1321 #[serde(rename = "regionalEndpoints")]
1322 pub regional_endpoints: Option<Vec<RegionalEndpoint>>,
1323 /// Locations that could not be reached.
1324 pub unreachable: Option<Vec<String>>,
1325}
1326
1327impl common::ResponseResult for ListRegionalEndpointsResponse {}
1328
1329/// Response for HubService.ListRouteTables method.
1330///
1331/// # Activities
1332///
1333/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1334/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1335///
1336/// * [locations global hubs route tables list projects](ProjectLocationGlobalHubRouteTableListCall) (response)
1337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1338#[serde_with::serde_as]
1339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1340pub struct ListRouteTablesResponse {
1341 /// The token for the next page of the response. To see more results, use this value as the page_token for your next request. If this value is empty, there are no more results.
1342 #[serde(rename = "nextPageToken")]
1343 pub next_page_token: Option<String>,
1344 /// The requested route tables.
1345 #[serde(rename = "routeTables")]
1346 pub route_tables: Option<Vec<RouteTable>>,
1347 /// Hubs that could not be reached.
1348 pub unreachable: Option<Vec<String>>,
1349}
1350
1351impl common::ResponseResult for ListRouteTablesResponse {}
1352
1353/// Response for HubService.ListRoutes method.
1354///
1355/// # Activities
1356///
1357/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1358/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1359///
1360/// * [locations global hubs route tables routes list projects](ProjectLocationGlobalHubRouteTableRouteListCall) (response)
1361#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1362#[serde_with::serde_as]
1363#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1364pub struct ListRoutesResponse {
1365 /// The token for the next page of the response. To see more results, use this value as the page_token for your next request. If this value is empty, there are no more results.
1366 #[serde(rename = "nextPageToken")]
1367 pub next_page_token: Option<String>,
1368 /// The requested routes.
1369 pub routes: Option<Vec<Route>>,
1370 /// RouteTables that could not be reached.
1371 pub unreachable: Option<Vec<String>>,
1372}
1373
1374impl common::ResponseResult for ListRoutesResponse {}
1375
1376/// Response for ListServiceClasses.
1377///
1378/// # Activities
1379///
1380/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1381/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1382///
1383/// * [locations service classes list projects](ProjectLocationServiceClassListCall) (response)
1384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1385#[serde_with::serde_as]
1386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1387pub struct ListServiceClassesResponse {
1388 /// The next pagination token in the List response. It should be used as page_token for the following request. An empty value means no more result.
1389 #[serde(rename = "nextPageToken")]
1390 pub next_page_token: Option<String>,
1391 /// ServiceClasses to be returned.
1392 #[serde(rename = "serviceClasses")]
1393 pub service_classes: Option<Vec<ServiceClass>>,
1394 /// Locations that could not be reached.
1395 pub unreachable: Option<Vec<String>>,
1396}
1397
1398impl common::ResponseResult for ListServiceClassesResponse {}
1399
1400/// Response for ListServiceConnectionMaps.
1401///
1402/// # Activities
1403///
1404/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1405/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1406///
1407/// * [locations service connection maps list projects](ProjectLocationServiceConnectionMapListCall) (response)
1408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1409#[serde_with::serde_as]
1410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1411pub struct ListServiceConnectionMapsResponse {
1412 /// The next pagination token in the List response. It should be used as page_token for the following request. An empty value means no more result.
1413 #[serde(rename = "nextPageToken")]
1414 pub next_page_token: Option<String>,
1415 /// ServiceConnectionMaps to be returned.
1416 #[serde(rename = "serviceConnectionMaps")]
1417 pub service_connection_maps: Option<Vec<ServiceConnectionMap>>,
1418 /// Locations that could not be reached.
1419 pub unreachable: Option<Vec<String>>,
1420}
1421
1422impl common::ResponseResult for ListServiceConnectionMapsResponse {}
1423
1424/// Response for ListServiceConnectionPolicies.
1425///
1426/// # Activities
1427///
1428/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1429/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1430///
1431/// * [locations service connection policies list projects](ProjectLocationServiceConnectionPolicyListCall) (response)
1432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1433#[serde_with::serde_as]
1434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1435pub struct ListServiceConnectionPoliciesResponse {
1436 /// The next pagination token in the List response. It should be used as page_token for the following request. An empty value means no more result.
1437 #[serde(rename = "nextPageToken")]
1438 pub next_page_token: Option<String>,
1439 /// ServiceConnectionPolicies to be returned.
1440 #[serde(rename = "serviceConnectionPolicies")]
1441 pub service_connection_policies: Option<Vec<ServiceConnectionPolicy>>,
1442 /// Locations that could not be reached.
1443 pub unreachable: Option<Vec<String>>,
1444}
1445
1446impl common::ResponseResult for ListServiceConnectionPoliciesResponse {}
1447
1448/// Response for ListServiceConnectionTokens.
1449///
1450/// # Activities
1451///
1452/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1453/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1454///
1455/// * [locations service connection tokens list projects](ProjectLocationServiceConnectionTokenListCall) (response)
1456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1457#[serde_with::serde_as]
1458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1459pub struct ListServiceConnectionTokensResponse {
1460 /// The next pagination token in the List response. It should be used as page_token for the following request. An empty value means no more result.
1461 #[serde(rename = "nextPageToken")]
1462 pub next_page_token: Option<String>,
1463 /// ServiceConnectionTokens to be returned.
1464 #[serde(rename = "serviceConnectionTokens")]
1465 pub service_connection_tokens: Option<Vec<ServiceConnectionToken>>,
1466 /// Locations that could not be reached.
1467 pub unreachable: Option<Vec<String>>,
1468}
1469
1470impl common::ResponseResult for ListServiceConnectionTokensResponse {}
1471
1472/// The response for HubService.ListSpokes.
1473///
1474/// # Activities
1475///
1476/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1477/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1478///
1479/// * [locations spokes list projects](ProjectLocationSpokeListCall) (response)
1480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1481#[serde_with::serde_as]
1482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1483pub struct ListSpokesResponse {
1484 /// The token for the next page of the response. To see more results, use this value as the page_token for your next request. If this value is empty, there are no more results.
1485 #[serde(rename = "nextPageToken")]
1486 pub next_page_token: Option<String>,
1487 /// The requested spokes.
1488 pub spokes: Option<Vec<Spoke>>,
1489 /// Locations that could not be reached.
1490 pub unreachable: Option<Vec<String>>,
1491}
1492
1493impl common::ResponseResult for ListSpokesResponse {}
1494
1495/// A resource that represents a Google Cloud location.
1496///
1497/// # Activities
1498///
1499/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1500/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1501///
1502/// * [locations get projects](ProjectLocationGetCall) (response)
1503#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1504#[serde_with::serde_as]
1505#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1506pub struct Location {
1507 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1508 #[serde(rename = "displayName")]
1509 pub display_name: Option<String>,
1510 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1511 pub labels: Option<HashMap<String, String>>,
1512 /// The canonical id for this location. For example: `"us-east1"`.
1513 #[serde(rename = "locationId")]
1514 pub location_id: Option<String>,
1515 /// Service-specific metadata. For example the available capacity at the given location.
1516 pub metadata: Option<HashMap<String, serde_json::Value>>,
1517 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1518 pub name: Option<String>,
1519}
1520
1521impl common::ResponseResult for Location {}
1522
1523/// Specification for migration with source and target resource names.
1524///
1525/// This type is not used in any activity, and only used as *part* of another schema.
1526///
1527#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1528#[serde_with::serde_as]
1529#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1530pub struct Migration {
1531 /// Immutable. Resource path as an URI of the source resource, for example a subnet. The project for the source resource should match the project for the InternalRange. An example: /projects/{project}/regions/{region}/subnetworks/{subnet}
1532 pub source: Option<String>,
1533 /// Immutable. Resource path of the target resource. The target project can be different, as in the cases when migrating to peer networks. For example: /projects/{project}/regions/{region}/subnetworks/{subnet}
1534 pub target: Option<String>,
1535}
1536
1537impl common::Part for Migration {}
1538
1539/// The `MulticloudDataTransferConfig` resource. It lists the services that you configure for Data Transfer Essentials billing and metering.
1540///
1541/// # Activities
1542///
1543/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1544/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1545///
1546/// * [locations multicloud data transfer configs create projects](ProjectLocationMulticloudDataTransferConfigCreateCall) (request)
1547/// * [locations multicloud data transfer configs get projects](ProjectLocationMulticloudDataTransferConfigGetCall) (response)
1548/// * [locations multicloud data transfer configs patch projects](ProjectLocationMulticloudDataTransferConfigPatchCall) (request)
1549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1550#[serde_with::serde_as]
1551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1552pub struct MulticloudDataTransferConfig {
1553 /// Output only. Time when the `MulticloudDataTransferConfig` resource was created.
1554 #[serde(rename = "createTime")]
1555 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1556 /// Optional. A description of this resource.
1557 pub description: Option<String>,
1558 /// Output only. The number of `Destination` resources in use with the `MulticloudDataTransferConfig` resource.
1559 #[serde(rename = "destinationsActiveCount")]
1560 pub destinations_active_count: Option<i32>,
1561 /// Output only. The number of `Destination` resources configured for the `MulticloudDataTransferConfig` resource.
1562 #[serde(rename = "destinationsCount")]
1563 pub destinations_count: Option<i32>,
1564 /// The etag is computed by the server, and might be sent with update and delete requests so that the client has an up-to-date value before proceeding.
1565 pub etag: Option<String>,
1566 /// Optional. User-defined labels.
1567 pub labels: Option<HashMap<String, String>>,
1568 /// Identifier. The name of the `MulticloudDataTransferConfig` resource. Format: `projects/{project}/locations/{location}/multicloudDataTransferConfigs/{multicloud_data_transfer_config}`.
1569 pub name: Option<String>,
1570 /// Optional. Maps services to their current or planned states. Service names are keys, and the associated values describe the state of the service. If a state change is expected, the value is either `ADDING` or `DELETING`, depending on the actions taken. Sample output: "services": { "big-query": { "states": [ { "effectiveTime": "2024-12-12T08:00:00Z" "state": "ADDING", }, ] }, "cloud-storage": { "states": [ { "state": "ACTIVE", } ] } }
1571 pub services: Option<HashMap<String, StateTimeline>>,
1572 /// Output only. The Google-generated unique ID for the `MulticloudDataTransferConfig` resource. This value is unique across all `MulticloudDataTransferConfig` resources. If a resource is deleted and another with the same name is created, the new resource is assigned a different and unique ID.
1573 pub uid: Option<String>,
1574 /// Output only. Time when the `MulticloudDataTransferConfig` resource was updated.
1575 #[serde(rename = "updateTime")]
1576 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1577}
1578
1579impl common::RequestValue for MulticloudDataTransferConfig {}
1580impl common::ResponseResult for MulticloudDataTransferConfig {}
1581
1582/// A service in your project in a region that is eligible for Data Transfer Essentials configuration.
1583///
1584/// # Activities
1585///
1586/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1587/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1588///
1589/// * [locations multicloud data transfer supported services get projects](ProjectLocationMulticloudDataTransferSupportedServiceGetCall) (response)
1590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1591#[serde_with::serde_as]
1592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1593pub struct MulticloudDataTransferSupportedService {
1594 /// Identifier. The name of the service.
1595 pub name: Option<String>,
1596 /// Output only. The network service tier or regional endpoint supported for the service.
1597 #[serde(rename = "serviceConfigs")]
1598 pub service_configs: Option<Vec<ServiceConfig>>,
1599}
1600
1601impl common::ResponseResult for MulticloudDataTransferSupportedService {}
1602
1603/// A route next hop that leads to an interconnect attachment resource.
1604///
1605/// This type is not used in any activity, and only used as *part* of another schema.
1606///
1607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1608#[serde_with::serde_as]
1609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1610pub struct NextHopInterconnectAttachment {
1611 /// Indicates whether site-to-site data transfer is allowed for this interconnect attachment resource. Data transfer is available only in [supported locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
1612 #[serde(rename = "siteToSiteDataTransfer")]
1613 pub site_to_site_data_transfer: Option<bool>,
1614 /// The URI of the interconnect attachment resource.
1615 pub uri: Option<String>,
1616 /// The VPC network where this interconnect attachment is located.
1617 #[serde(rename = "vpcNetwork")]
1618 pub vpc_network: Option<String>,
1619}
1620
1621impl common::Part for NextHopInterconnectAttachment {}
1622
1623/// A route next hop that leads to a Router appliance instance.
1624///
1625/// This type is not used in any activity, and only used as *part* of another schema.
1626///
1627#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1628#[serde_with::serde_as]
1629#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1630pub struct NextHopRouterApplianceInstance {
1631 /// Indicates whether site-to-site data transfer is allowed for this Router appliance instance resource. Data transfer is available only in [supported locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
1632 #[serde(rename = "siteToSiteDataTransfer")]
1633 pub site_to_site_data_transfer: Option<bool>,
1634 /// The URI of the Router appliance instance.
1635 pub uri: Option<String>,
1636 /// The VPC network where this VM is located.
1637 #[serde(rename = "vpcNetwork")]
1638 pub vpc_network: Option<String>,
1639}
1640
1641impl common::Part for NextHopRouterApplianceInstance {}
1642
1643/// A route next hop that leads to a spoke resource.
1644///
1645/// This type is not used in any activity, and only used as *part* of another schema.
1646///
1647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1648#[serde_with::serde_as]
1649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1650pub struct NextHopSpoke {
1651 /// Indicates whether site-to-site data transfer is allowed for this spoke resource. Data transfer is available only in [supported locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). Whether this route is accessible to other hybrid spokes with site-to-site data transfer enabled. If this is false, the route is only accessible to VPC spokes of the connected Hub.
1652 #[serde(rename = "siteToSiteDataTransfer")]
1653 pub site_to_site_data_transfer: Option<bool>,
1654 /// The URI of the spoke resource.
1655 pub uri: Option<String>,
1656}
1657
1658impl common::Part for NextHopSpoke {}
1659
1660/// A route next hop that leads to a VPN tunnel resource.
1661///
1662/// This type is not used in any activity, and only used as *part* of another schema.
1663///
1664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1665#[serde_with::serde_as]
1666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1667pub struct NextHopVPNTunnel {
1668 /// Indicates whether site-to-site data transfer is allowed for this VPN tunnel resource. Data transfer is available only in [supported locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
1669 #[serde(rename = "siteToSiteDataTransfer")]
1670 pub site_to_site_data_transfer: Option<bool>,
1671 /// The URI of the VPN tunnel resource.
1672 pub uri: Option<String>,
1673 /// The VPC network where this VPN tunnel is located.
1674 #[serde(rename = "vpcNetwork")]
1675 pub vpc_network: Option<String>,
1676}
1677
1678impl common::Part for NextHopVPNTunnel {}
1679
1680/// There is no detailed description.
1681///
1682/// This type is not used in any activity, and only used as *part* of another schema.
1683///
1684#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1685#[serde_with::serde_as]
1686#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1687pub struct NextHopVpcNetwork {
1688 /// The URI of the VPC network resource
1689 pub uri: Option<String>,
1690}
1691
1692impl common::Part for NextHopVpcNetwork {}
1693
1694/// 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/).
1695///
1696/// # Activities
1697///
1698/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1699/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1700///
1701/// * [locations global hubs groups get iam policy projects](ProjectLocationGlobalHubGroupGetIamPolicyCall) (response)
1702/// * [locations global hubs groups set iam policy projects](ProjectLocationGlobalHubGroupSetIamPolicyCall) (response)
1703/// * [locations global hubs get iam policy projects](ProjectLocationGlobalHubGetIamPolicyCall) (response)
1704/// * [locations global hubs set iam policy projects](ProjectLocationGlobalHubSetIamPolicyCall) (response)
1705/// * [locations global policy based routes get iam policy projects](ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall) (response)
1706/// * [locations global policy based routes set iam policy projects](ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall) (response)
1707/// * [locations internal ranges get iam policy projects](ProjectLocationInternalRangeGetIamPolicyCall) (response)
1708/// * [locations internal ranges set iam policy projects](ProjectLocationInternalRangeSetIamPolicyCall) (response)
1709/// * [locations service classes get iam policy projects](ProjectLocationServiceClassGetIamPolicyCall) (response)
1710/// * [locations service classes set iam policy projects](ProjectLocationServiceClassSetIamPolicyCall) (response)
1711/// * [locations service connection maps get iam policy projects](ProjectLocationServiceConnectionMapGetIamPolicyCall) (response)
1712/// * [locations service connection maps set iam policy projects](ProjectLocationServiceConnectionMapSetIamPolicyCall) (response)
1713/// * [locations service connection policies get iam policy projects](ProjectLocationServiceConnectionPolicyGetIamPolicyCall) (response)
1714/// * [locations service connection policies set iam policy projects](ProjectLocationServiceConnectionPolicySetIamPolicyCall) (response)
1715/// * [locations spokes get iam policy projects](ProjectLocationSpokeGetIamPolicyCall) (response)
1716/// * [locations spokes set iam policy projects](ProjectLocationSpokeSetIamPolicyCall) (response)
1717#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1718#[serde_with::serde_as]
1719#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1720pub struct Policy {
1721 /// Specifies cloud audit logging configuration for this policy.
1722 #[serde(rename = "auditConfigs")]
1723 pub audit_configs: Option<Vec<AuditConfig>>,
1724 /// 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`.
1725 pub bindings: Option<Vec<Binding>>,
1726 /// `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.
1727 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1728 pub etag: Option<Vec<u8>>,
1729 /// 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).
1730 pub version: Option<i32>,
1731}
1732
1733impl common::ResponseResult for Policy {}
1734
1735/// Policy-based routes route L4 network traffic based on not just destination IP address, but also source IP address, protocol, and more. If a policy-based route conflicts with other types of routes, the policy-based route always takes precedence.
1736///
1737/// # Activities
1738///
1739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1741///
1742/// * [locations global policy based routes create projects](ProjectLocationGlobalPolicyBasedRouteCreateCall) (request)
1743/// * [locations global policy based routes get projects](ProjectLocationGlobalPolicyBasedRouteGetCall) (response)
1744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1745#[serde_with::serde_as]
1746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1747pub struct PolicyBasedRoute {
1748 /// Output only. Time when the policy-based route was created.
1749 #[serde(rename = "createTime")]
1750 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1751 /// Optional. An optional description of this resource. Provide this field when you create the resource.
1752 pub description: Option<String>,
1753 /// Required. The filter to match L4 traffic.
1754 pub filter: Option<Filter>,
1755 /// Optional. The interconnect attachments that this policy-based route applies to.
1756 #[serde(rename = "interconnectAttachment")]
1757 pub interconnect_attachment: Option<InterconnectAttachment>,
1758 /// Output only. Type of this resource. Always networkconnectivity#policyBasedRoute for policy-based Route resources.
1759 pub kind: Option<String>,
1760 /// User-defined labels.
1761 pub labels: Option<HashMap<String, String>>,
1762 /// Immutable. Identifier. A unique name of the resource in the form of `projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`
1763 pub name: Option<String>,
1764 /// Required. Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network.
1765 pub network: Option<String>,
1766 /// Optional. The IP address of a global-access-enabled L4 ILB that is the next hop for matching packets. For this version, only nextHopIlbIp is supported.
1767 #[serde(rename = "nextHopIlbIp")]
1768 pub next_hop_ilb_ip: Option<String>,
1769 /// Optional. Other routes that will be referenced to determine the next hop of the packet.
1770 #[serde(rename = "nextHopOtherRoutes")]
1771 pub next_hop_other_routes: Option<String>,
1772 /// Optional. The priority of this policy-based route. Priority is used to break ties in cases where there are more than one matching policy-based routes found. In cases where multiple policy-based routes are matched, the one with the lowest-numbered priority value wins. The default value is 1000. The priority value must be from 1 to 65535, inclusive.
1773 pub priority: Option<i32>,
1774 /// Output only. Server-defined fully-qualified URL for this resource.
1775 #[serde(rename = "selfLink")]
1776 pub self_link: Option<String>,
1777 /// Output only. Time when the policy-based route was updated.
1778 #[serde(rename = "updateTime")]
1779 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1780 /// Optional. VM instances that this policy-based route applies to.
1781 #[serde(rename = "virtualMachine")]
1782 pub virtual_machine: Option<VirtualMachine>,
1783 /// Output only. If potential misconfigurations are detected for this route, this field will be populated with warning messages.
1784 pub warnings: Option<Vec<Warnings>>,
1785}
1786
1787impl common::RequestValue for PolicyBasedRoute {}
1788impl common::ResponseResult for PolicyBasedRoute {}
1789
1790/// The PSC configurations on producer side.
1791///
1792/// This type is not used in any activity, and only used as *part* of another schema.
1793///
1794#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1795#[serde_with::serde_as]
1796#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1797pub struct ProducerPscConfig {
1798 /// Optional. The specification for automatically creating a DNS record for this PSC connection.
1799 #[serde(rename = "automatedDnsCreationSpec")]
1800 pub automated_dns_creation_spec: Option<AutomatedDnsCreationSpec>,
1801 /// The resource path of a service attachment. Example: projects/{projectNumOrId}/regions/{region}/serviceAttachments/{resourceId}.
1802 #[serde(rename = "serviceAttachmentUri")]
1803 pub service_attachment_uri: Option<String>,
1804}
1805
1806impl common::Part for ProducerPscConfig {}
1807
1808/// Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
1809///
1810/// This type is not used in any activity, and only used as *part* of another schema.
1811///
1812#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1813#[serde_with::serde_as]
1814#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1815pub struct PscConfig {
1816 /// Optional. List of Projects, Folders, or Organizations from where the Producer instance can be within. For example, a network administrator can provide both 'organizations/foo' and 'projects/bar' as allowed_google_producers_resource_hierarchy_levels. This allowlists this network to connect with any Producer instance within the 'foo' organization or the 'bar' project. By default, allowed_google_producers_resource_hierarchy_level is empty. The format for each allowed_google_producers_resource_hierarchy_level is / where is one of 'projects', 'folders', or 'organizations' and is either the ID or the number of the resource type. Format for each allowed_google_producers_resource_hierarchy_level value: 'projects/' or 'folders/' or 'organizations/' Eg. [projects/my-project-id, projects/567, folders/891, organizations/123]
1817 #[serde(rename = "allowedGoogleProducersResourceHierarchyLevel")]
1818 pub allowed_google_producers_resource_hierarchy_level: Option<Vec<String>>,
1819 /// Optional. Max number of PSC connections for this policy.
1820 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1821 pub limit: Option<i64>,
1822 /// Optional. ProducerInstanceLocation is used to specify which authorization mechanism to use to determine which projects the Producer instance can be within.
1823 #[serde(rename = "producerInstanceLocation")]
1824 pub producer_instance_location: Option<String>,
1825 /// The resource paths of subnetworks to use for IP address management. Example: projects/{projectNumOrId}/regions/{region}/subnetworks/{resourceId}.
1826 pub subnetworks: Option<Vec<String>>,
1827}
1828
1829impl common::Part for PscConfig {}
1830
1831/// Information about a specific Private Service Connect connection.
1832///
1833/// This type is not used in any activity, and only used as *part* of another schema.
1834///
1835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1836#[serde_with::serde_as]
1837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1838pub struct PscConnection {
1839 /// The resource reference of the consumer address.
1840 #[serde(rename = "consumerAddress")]
1841 pub consumer_address: Option<String>,
1842 /// The resource reference of the PSC Forwarding Rule within the consumer VPC.
1843 #[serde(rename = "consumerForwardingRule")]
1844 pub consumer_forwarding_rule: Option<String>,
1845 /// The project where the PSC connection is created.
1846 #[serde(rename = "consumerTargetProject")]
1847 pub consumer_target_project: Option<String>,
1848 /// The most recent error during operating this connection. Deprecated, please use error_info instead.
1849 pub error: Option<GoogleRpcStatus>,
1850 /// Output only. The error info for the latest error during operating this connection.
1851 #[serde(rename = "errorInfo")]
1852 pub error_info: Option<GoogleRpcErrorInfo>,
1853 /// The error type indicates whether the error is consumer facing, producer facing or system internal.
1854 #[serde(rename = "errorType")]
1855 pub error_type: Option<String>,
1856 /// The last Compute Engine operation to setup PSC connection.
1857 #[serde(rename = "gceOperation")]
1858 pub gce_operation: Option<String>,
1859 /// The requested IP version for the PSC connection.
1860 #[serde(rename = "ipVersion")]
1861 pub ip_version: Option<String>,
1862 /// Immutable. Deprecated. Use producer_instance_metadata instead. An immutable identifier for the producer instance.
1863 #[serde(rename = "producerInstanceId")]
1864 pub producer_instance_id: Option<String>,
1865 /// Immutable. An immutable map for the producer instance metadata.
1866 #[serde(rename = "producerInstanceMetadata")]
1867 pub producer_instance_metadata: Option<HashMap<String, String>>,
1868 /// The PSC connection id of the PSC forwarding rule.
1869 #[serde(rename = "pscConnectionId")]
1870 pub psc_connection_id: Option<String>,
1871 /// Output only. The URI of the subnetwork selected to allocate IP address for this connection.
1872 #[serde(rename = "selectedSubnetwork")]
1873 pub selected_subnetwork: Option<String>,
1874 /// Output only. [Output only] The service class associated with this PSC Connection. The value is derived from the SCPolicy and matches the service class name provided by the customer.
1875 #[serde(rename = "serviceClass")]
1876 pub service_class: Option<String>,
1877 /// State of the PSC Connection
1878 pub state: Option<String>,
1879}
1880
1881impl common::Part for PscConnection {}
1882
1883/// The status of one or more propagated Private Service Connect connections in a hub.
1884///
1885/// This type is not used in any activity, and only used as *part* of another schema.
1886///
1887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1888#[serde_with::serde_as]
1889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1890pub struct PscPropagationStatus {
1891 /// The propagation status.
1892 pub code: Option<String>,
1893 /// The human-readable summary of the Private Service Connect connection propagation status.
1894 pub message: Option<String>,
1895 /// The name of the forwarding rule exported to the hub.
1896 #[serde(rename = "sourceForwardingRule")]
1897 pub source_forwarding_rule: Option<String>,
1898 /// The name of the group that the source spoke belongs to.
1899 #[serde(rename = "sourceGroup")]
1900 pub source_group: Option<String>,
1901 /// The name of the spoke that the source forwarding rule belongs to.
1902 #[serde(rename = "sourceSpoke")]
1903 pub source_spoke: Option<String>,
1904 /// The name of the group that the target spoke belongs to.
1905 #[serde(rename = "targetGroup")]
1906 pub target_group: Option<String>,
1907 /// The name of the spoke that the source forwarding rule propagates to.
1908 #[serde(rename = "targetSpoke")]
1909 pub target_spoke: Option<String>,
1910}
1911
1912impl common::Part for PscPropagationStatus {}
1913
1914/// The response for HubService.QueryHubStatus.
1915///
1916/// # Activities
1917///
1918/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1919/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1920///
1921/// * [locations global hubs query status projects](ProjectLocationGlobalHubQueryStatuCall) (response)
1922#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1923#[serde_with::serde_as]
1924#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1925pub struct QueryHubStatusResponse {
1926 /// The list of hub status.
1927 #[serde(rename = "hubStatusEntries")]
1928 pub hub_status_entries: Option<Vec<HubStatusEntry>>,
1929 /// The token for the next page of the response. To see more results, use this value as the page_token for your next request. If this value is empty, there are no more results.
1930 #[serde(rename = "nextPageToken")]
1931 pub next_page_token: Option<String>,
1932}
1933
1934impl common::ResponseResult for QueryHubStatusResponse {}
1935
1936/// The RegionalEndpoint resource.
1937///
1938/// # Activities
1939///
1940/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1941/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1942///
1943/// * [locations regional endpoints create projects](ProjectLocationRegionalEndpointCreateCall) (request)
1944/// * [locations regional endpoints get projects](ProjectLocationRegionalEndpointGetCall) (response)
1945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1946#[serde_with::serde_as]
1947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1948pub struct RegionalEndpoint {
1949 /// Required. The access type of this regional endpoint. This field is reflected in the PSC Forwarding Rule configuration to enable global access.
1950 #[serde(rename = "accessType")]
1951 pub access_type: Option<String>,
1952 /// Optional. The IP Address of the Regional Endpoint. When no address is provided, an IP from the subnetwork is allocated. Use one of the following formats: * IPv4 address as in `10.0.0.1` * Address resource URI as in `projects/{project}/regions/{region}/addresses/{address_name}` for an IPv4 or IPv6 address.
1953 pub address: Option<String>,
1954 /// Output only. Time when the RegionalEndpoint was created.
1955 #[serde(rename = "createTime")]
1956 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1957 /// Optional. A description of this resource.
1958 pub description: Option<String>,
1959 /// Output only. The literal IP address of the PSC Forwarding Rule created on behalf of the customer. This field is deprecated. Use address instead.
1960 #[serde(rename = "ipAddress")]
1961 pub ip_address: Option<String>,
1962 /// User-defined labels.
1963 pub labels: Option<HashMap<String, String>>,
1964 /// Output only. The name of a RegionalEndpoint. Pattern: `projects/{project}/locations/{location}/regionalEndpoints/^[-a-z0-9](?:[-a-z0-9]{0,44})[a-z0-9]$`.
1965 pub name: Option<String>,
1966 /// Optional. The name of the VPC network for this private regional endpoint. Format: `projects/{project}/global/networks/{network}`
1967 pub network: Option<String>,
1968 /// Output only. The resource reference of the PSC Forwarding Rule created on behalf of the customer. Format: `//compute.googleapis.com/projects/{project}/regions/{region}/forwardingRules/{forwarding_rule_name}`
1969 #[serde(rename = "pscForwardingRule")]
1970 pub psc_forwarding_rule: Option<String>,
1971 /// Optional. The name of the subnetwork from which the IP address will be allocated. Format: `projects/{project}/regions/{region}/subnetworks/{subnetwork}`
1972 pub subnetwork: Option<String>,
1973 /// Required. The service endpoint this private regional endpoint connects to. Format: `{apiname}.{region}.p.rep.googleapis.com` Example: "cloudkms.us-central1.p.rep.googleapis.com".
1974 #[serde(rename = "targetGoogleApi")]
1975 pub target_google_api: Option<String>,
1976 /// Output only. Time when the RegionalEndpoint was updated.
1977 #[serde(rename = "updateTime")]
1978 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1979}
1980
1981impl common::RequestValue for RegionalEndpoint {}
1982impl common::ResponseResult for RegionalEndpoint {}
1983
1984/// The request for HubService.RejectHubSpoke.
1985///
1986/// # Activities
1987///
1988/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1989/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1990///
1991/// * [locations global hubs reject spoke projects](ProjectLocationGlobalHubRejectSpokeCall) (request)
1992#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1993#[serde_with::serde_as]
1994#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1995pub struct RejectHubSpokeRequest {
1996 /// Optional. Additional information provided by the hub administrator.
1997 pub details: Option<String>,
1998 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
1999 #[serde(rename = "requestId")]
2000 pub request_id: Option<String>,
2001 /// Required. The URI of the spoke to reject from the hub.
2002 #[serde(rename = "spokeUri")]
2003 pub spoke_uri: Option<String>,
2004}
2005
2006impl common::RequestValue for RejectHubSpokeRequest {}
2007
2008/// The request for HubService.RejectSpokeUpdate.
2009///
2010/// # Activities
2011///
2012/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2013/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2014///
2015/// * [locations global hubs reject spoke update projects](ProjectLocationGlobalHubRejectSpokeUpdateCall) (request)
2016#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2017#[serde_with::serde_as]
2018#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2019pub struct RejectSpokeUpdateRequest {
2020 /// Optional. Additional information provided by the hub administrator.
2021 pub details: Option<String>,
2022 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
2023 #[serde(rename = "requestId")]
2024 pub request_id: Option<String>,
2025 /// Required. The etag of the spoke to reject update.
2026 #[serde(rename = "spokeEtag")]
2027 pub spoke_etag: Option<String>,
2028 /// Required. The URI of the spoke to reject update.
2029 #[serde(rename = "spokeUri")]
2030 pub spoke_uri: Option<String>,
2031}
2032
2033impl common::RequestValue for RejectSpokeUpdateRequest {}
2034
2035/// A route defines a path from VM instances within a spoke to a specific destination resource. Only VPC spokes have routes.
2036///
2037/// # Activities
2038///
2039/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2040/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2041///
2042/// * [locations global hubs route tables routes get projects](ProjectLocationGlobalHubRouteTableRouteGetCall) (response)
2043#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2044#[serde_with::serde_as]
2045#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2046pub struct Route {
2047 /// Output only. The time the route was created.
2048 #[serde(rename = "createTime")]
2049 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2050 /// An optional description of the route.
2051 pub description: Option<String>,
2052 /// The destination IP address range.
2053 #[serde(rename = "ipCidrRange")]
2054 pub ip_cidr_range: Option<String>,
2055 /// Optional labels in key-value pair format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
2056 pub labels: Option<HashMap<String, String>>,
2057 /// Output only. The origin location of the route. Uses the following form: "projects/{project}/locations/{location}" Example: projects/1234/locations/us-central1
2058 pub location: Option<String>,
2059 /// Immutable. The name of the route. Route names must be unique. Route names use the following form: `projects/{project_number}/locations/global/hubs/{hub}/routeTables/{route_table_id}/routes/{route_id}`
2060 pub name: Option<String>,
2061 /// Immutable. The next-hop VLAN attachment for packets on this route.
2062 #[serde(rename = "nextHopInterconnectAttachment")]
2063 pub next_hop_interconnect_attachment: Option<NextHopInterconnectAttachment>,
2064 /// Immutable. The next-hop Router appliance instance for packets on this route.
2065 #[serde(rename = "nextHopRouterApplianceInstance")]
2066 pub next_hop_router_appliance_instance: Option<NextHopRouterApplianceInstance>,
2067 /// Immutable. The next-hop spoke for packets on this route.
2068 #[serde(rename = "nextHopSpoke")]
2069 pub next_hop_spoke: Option<NextHopSpoke>,
2070 /// Immutable. The destination VPC network for packets on this route.
2071 #[serde(rename = "nextHopVpcNetwork")]
2072 pub next_hop_vpc_network: Option<NextHopVpcNetwork>,
2073 /// Immutable. The next-hop VPN tunnel for packets on this route.
2074 #[serde(rename = "nextHopVpnTunnel")]
2075 pub next_hop_vpn_tunnel: Option<NextHopVPNTunnel>,
2076 /// Output only. The priority of this route. Priority is used to break ties in cases where a destination matches more than one route. In these cases the route with the lowest-numbered priority value wins.
2077 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2078 pub priority: Option<i64>,
2079 /// Immutable. The spoke that this route leads to. Example: projects/12345/locations/global/spokes/SPOKE
2080 pub spoke: Option<String>,
2081 /// Output only. The current lifecycle state of the route.
2082 pub state: Option<String>,
2083 /// Output only. The route's type. Its type is determined by the properties of its IP address range.
2084 #[serde(rename = "type")]
2085 pub type_: Option<String>,
2086 /// Output only. The Google-generated UUID for the route. This value is unique across all Network Connectivity Center route resources. If a route is deleted and another with the same name is created, the new route is assigned a different `uid`.
2087 pub uid: Option<String>,
2088 /// Output only. The time the route was last updated.
2089 #[serde(rename = "updateTime")]
2090 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2091}
2092
2093impl common::ResponseResult for Route {}
2094
2095/// There is no detailed description.
2096///
2097/// # Activities
2098///
2099/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2100/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2101///
2102/// * [locations global hubs route tables get projects](ProjectLocationGlobalHubRouteTableGetCall) (response)
2103#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2104#[serde_with::serde_as]
2105#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2106pub struct RouteTable {
2107 /// Output only. The time the route table was created.
2108 #[serde(rename = "createTime")]
2109 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2110 /// An optional description of the route table.
2111 pub description: Option<String>,
2112 /// Optional labels in key-value pair format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
2113 pub labels: Option<HashMap<String, String>>,
2114 /// Immutable. The name of the route table. Route table names must be unique. They use the following form: `projects/{project_number}/locations/global/hubs/{hub}/routeTables/{route_table_id}`
2115 pub name: Option<String>,
2116 /// Output only. The current lifecycle state of this route table.
2117 pub state: Option<String>,
2118 /// Output only. The Google-generated UUID for the route table. This value is unique across all route table resources. If a route table is deleted and another with the same name is created, the new route table is assigned a different `uid`.
2119 pub uid: Option<String>,
2120 /// Output only. The time the route table was last updated.
2121 #[serde(rename = "updateTime")]
2122 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2123}
2124
2125impl common::ResponseResult for RouteTable {}
2126
2127/// A router appliance instance is a Compute Engine virtual machine (VM) instance that acts as a BGP speaker. A router appliance instance is specified by the URI of the VM and the internal IP address of one of the VM's network interfaces.
2128///
2129/// This type is not used in any activity, and only used as *part* of another schema.
2130///
2131#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2132#[serde_with::serde_as]
2133#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2134pub struct RouterApplianceInstance {
2135 /// The IP address on the VM to use for peering.
2136 #[serde(rename = "ipAddress")]
2137 pub ip_address: Option<String>,
2138 /// The URI of the VM.
2139 #[serde(rename = "virtualMachine")]
2140 pub virtual_machine: Option<String>,
2141}
2142
2143impl common::Part for RouterApplianceInstance {}
2144
2145/// RoutingVPC contains information about the VPC networks associated with the spokes of a Network Connectivity Center hub.
2146///
2147/// This type is not used in any activity, and only used as *part* of another schema.
2148///
2149#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2150#[serde_with::serde_as]
2151#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2152pub struct RoutingVPC {
2153 /// Output only. If true, indicates that this VPC network is currently associated with spokes that use the data transfer feature (spokes where the site_to_site_data_transfer field is set to true). If you create new spokes that use data transfer, they must be associated with this VPC network. At most, one VPC network will have this field set to true.
2154 #[serde(rename = "requiredForNewSiteToSiteDataTransferSpokes")]
2155 pub required_for_new_site_to_site_data_transfer_spokes: Option<bool>,
2156 /// The URI of the VPC network.
2157 pub uri: Option<String>,
2158}
2159
2160impl common::Part for RoutingVPC {}
2161
2162/// The ServiceClass resource.
2163///
2164/// # Activities
2165///
2166/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2167/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2168///
2169/// * [locations service classes get projects](ProjectLocationServiceClassGetCall) (response)
2170/// * [locations service classes patch projects](ProjectLocationServiceClassPatchCall) (request)
2171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2172#[serde_with::serde_as]
2173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2174pub struct ServiceClass {
2175 /// Output only. Time when the ServiceClass was created.
2176 #[serde(rename = "createTime")]
2177 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2178 /// A description of this resource.
2179 pub description: Option<String>,
2180 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2181 pub etag: Option<String>,
2182 /// User-defined labels.
2183 pub labels: Option<HashMap<String, String>>,
2184 /// Immutable. The name of a ServiceClass resource. Format: projects/{project}/locations/{location}/serviceClasses/{service_class} See: https://google.aip.dev/122#fields-representing-resource-names
2185 pub name: Option<String>,
2186 /// Output only. The generated service class name. Use this name to refer to the Service class in Service Connection Maps and Service Connection Policies.
2187 #[serde(rename = "serviceClass")]
2188 pub service_class: Option<String>,
2189 /// Output only. Time when the ServiceClass was updated.
2190 #[serde(rename = "updateTime")]
2191 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2192}
2193
2194impl common::RequestValue for ServiceClass {}
2195impl common::ResponseResult for ServiceClass {}
2196
2197/// Specifies eligibility information for the service.
2198///
2199/// This type is not used in any activity, and only used as *part* of another schema.
2200///
2201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2202#[serde_with::serde_as]
2203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2204pub struct ServiceConfig {
2205 /// Output only. The eligibility criteria for the service.
2206 #[serde(rename = "eligibilityCriteria")]
2207 pub eligibility_criteria: Option<String>,
2208 /// Output only. The end time for eligibility criteria support. If not specified, no planned end time is set.
2209 #[serde(rename = "supportEndTime")]
2210 pub support_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2211}
2212
2213impl common::Part for ServiceConfig {}
2214
2215/// The ServiceConnectionMap resource.
2216///
2217/// # Activities
2218///
2219/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2220/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2221///
2222/// * [locations service connection maps create projects](ProjectLocationServiceConnectionMapCreateCall) (request)
2223/// * [locations service connection maps get projects](ProjectLocationServiceConnectionMapGetCall) (response)
2224/// * [locations service connection maps patch projects](ProjectLocationServiceConnectionMapPatchCall) (request)
2225#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2226#[serde_with::serde_as]
2227#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2228pub struct ServiceConnectionMap {
2229 /// The PSC configurations on consumer side.
2230 #[serde(rename = "consumerPscConfigs")]
2231 pub consumer_psc_configs: Option<Vec<ConsumerPscConfig>>,
2232 /// Output only. PSC connection details on consumer side.
2233 #[serde(rename = "consumerPscConnections")]
2234 pub consumer_psc_connections: Option<Vec<ConsumerPscConnection>>,
2235 /// Output only. Time when the ServiceConnectionMap was created.
2236 #[serde(rename = "createTime")]
2237 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2238 /// A description of this resource.
2239 pub description: Option<String>,
2240 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2241 pub etag: Option<String>,
2242 /// Output only. The infrastructure used for connections between consumers/producers.
2243 pub infrastructure: Option<String>,
2244 /// User-defined labels.
2245 pub labels: Option<HashMap<String, String>>,
2246 /// Immutable. The name of a ServiceConnectionMap. Format: projects/{project}/locations/{location}/serviceConnectionMaps/{service_connection_map} See: https://google.aip.dev/122#fields-representing-resource-names
2247 pub name: Option<String>,
2248 /// The PSC configurations on producer side.
2249 #[serde(rename = "producerPscConfigs")]
2250 pub producer_psc_configs: Option<Vec<ProducerPscConfig>>,
2251 /// The service class identifier this ServiceConnectionMap is for. The user of ServiceConnectionMap create API needs to have networkconnectivity.serviceClasses.use IAM permission for the service class.
2252 #[serde(rename = "serviceClass")]
2253 pub service_class: Option<String>,
2254 /// Output only. The service class uri this ServiceConnectionMap is for.
2255 #[serde(rename = "serviceClassUri")]
2256 pub service_class_uri: Option<String>,
2257 /// The token provided by the consumer. This token authenticates that the consumer can create a connection within the specified project and network.
2258 pub token: Option<String>,
2259 /// Output only. Time when the ServiceConnectionMap was updated.
2260 #[serde(rename = "updateTime")]
2261 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2262}
2263
2264impl common::RequestValue for ServiceConnectionMap {}
2265impl common::ResponseResult for ServiceConnectionMap {}
2266
2267/// The ServiceConnectionPolicy resource.
2268///
2269/// # Activities
2270///
2271/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2272/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2273///
2274/// * [locations service connection policies create projects](ProjectLocationServiceConnectionPolicyCreateCall) (request)
2275/// * [locations service connection policies get projects](ProjectLocationServiceConnectionPolicyGetCall) (response)
2276/// * [locations service connection policies patch projects](ProjectLocationServiceConnectionPolicyPatchCall) (request)
2277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2278#[serde_with::serde_as]
2279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2280pub struct ServiceConnectionPolicy {
2281 /// Output only. Information for the automatically created subnetwork and its associated IR.
2282 #[serde(rename = "autoCreatedSubnetInfo")]
2283 pub auto_created_subnet_info: Option<AutoCreatedSubnetworkInfo>,
2284 /// Output only. Time when the ServiceConnectionPolicy was created.
2285 #[serde(rename = "createTime")]
2286 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2287 /// A description of this resource.
2288 pub description: Option<String>,
2289 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2290 pub etag: Option<String>,
2291 /// Output only. The type of underlying resources used to create the connection.
2292 pub infrastructure: Option<String>,
2293 /// User-defined labels.
2294 pub labels: Option<HashMap<String, String>>,
2295 /// Immutable. The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
2296 pub name: Option<String>,
2297 /// The resource path of the consumer network. Example: - projects/{projectNumOrId}/global/networks/{resourceId}.
2298 pub network: Option<String>,
2299 /// Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
2300 #[serde(rename = "pscConfig")]
2301 pub psc_config: Option<PscConfig>,
2302 /// Output only. [Output only] Information about each Private Service Connect connection.
2303 #[serde(rename = "pscConnections")]
2304 pub psc_connections: Option<Vec<PscConnection>>,
2305 /// The service class identifier for which this ServiceConnectionPolicy is for. The service class identifier is a unique, symbolic representation of a ServiceClass. It is provided by the Service Producer. Google services have a prefix of gcp or google-cloud. For example, gcp-memorystore-redis or google-cloud-sql. 3rd party services do not. For example, test-service-a3dfcx.
2306 #[serde(rename = "serviceClass")]
2307 pub service_class: Option<String>,
2308 /// Output only. Time when the ServiceConnectionPolicy was updated.
2309 #[serde(rename = "updateTime")]
2310 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2311}
2312
2313impl common::RequestValue for ServiceConnectionPolicy {}
2314impl common::ResponseResult for ServiceConnectionPolicy {}
2315
2316/// The ServiceConnectionToken resource.
2317///
2318/// # Activities
2319///
2320/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2321/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2322///
2323/// * [locations service connection tokens create projects](ProjectLocationServiceConnectionTokenCreateCall) (request)
2324/// * [locations service connection tokens get projects](ProjectLocationServiceConnectionTokenGetCall) (response)
2325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2326#[serde_with::serde_as]
2327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2328pub struct ServiceConnectionToken {
2329 /// Output only. Time when the ServiceConnectionToken was created.
2330 #[serde(rename = "createTime")]
2331 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2332 /// A description of this resource.
2333 pub description: Option<String>,
2334 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2335 pub etag: Option<String>,
2336 /// Output only. The time to which this token is valid.
2337 #[serde(rename = "expireTime")]
2338 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2339 /// User-defined labels.
2340 pub labels: Option<HashMap<String, String>>,
2341 /// Immutable. The name of a ServiceConnectionToken. Format: projects/{project}/locations/{location}/ServiceConnectionTokens/{service_connection_token} See: https://google.aip.dev/122#fields-representing-resource-names
2342 pub name: Option<String>,
2343 /// The resource path of the network associated with this token. Example: projects/{projectNumOrId}/global/networks/{resourceId}.
2344 pub network: Option<String>,
2345 /// Output only. The token generated by Automation.
2346 pub token: Option<String>,
2347 /// Output only. Time when the ServiceConnectionToken was updated.
2348 #[serde(rename = "updateTime")]
2349 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2350}
2351
2352impl common::RequestValue for ServiceConnectionToken {}
2353impl common::ResponseResult for ServiceConnectionToken {}
2354
2355/// Request message for `SetIamPolicy` method.
2356///
2357/// # Activities
2358///
2359/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2360/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2361///
2362/// * [locations global hubs groups set iam policy projects](ProjectLocationGlobalHubGroupSetIamPolicyCall) (request)
2363/// * [locations global hubs set iam policy projects](ProjectLocationGlobalHubSetIamPolicyCall) (request)
2364/// * [locations global policy based routes set iam policy projects](ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall) (request)
2365/// * [locations internal ranges set iam policy projects](ProjectLocationInternalRangeSetIamPolicyCall) (request)
2366/// * [locations service classes set iam policy projects](ProjectLocationServiceClassSetIamPolicyCall) (request)
2367/// * [locations service connection maps set iam policy projects](ProjectLocationServiceConnectionMapSetIamPolicyCall) (request)
2368/// * [locations service connection policies set iam policy projects](ProjectLocationServiceConnectionPolicySetIamPolicyCall) (request)
2369/// * [locations spokes set iam policy projects](ProjectLocationSpokeSetIamPolicyCall) (request)
2370#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2371#[serde_with::serde_as]
2372#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2373pub struct SetIamPolicyRequest {
2374 /// 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.
2375 pub policy: Option<Policy>,
2376 /// 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"`
2377 #[serde(rename = "updateMask")]
2378 pub update_mask: Option<common::FieldMask>,
2379}
2380
2381impl common::RequestValue for SetIamPolicyRequest {}
2382
2383/// A Network Connectivity Center spoke represents one or more network connectivity resources. When you create a spoke, you associate it with a hub. You must also identify a value for exactly one of the following fields: * linked_vpn_tunnels * linked_interconnect_attachments * linked_router_appliance_instances * linked_vpc_network
2384///
2385/// # Activities
2386///
2387/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2388/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2389///
2390/// * [locations spokes create projects](ProjectLocationSpokeCreateCall) (request)
2391/// * [locations spokes get projects](ProjectLocationSpokeGetCall) (response)
2392/// * [locations spokes patch projects](ProjectLocationSpokePatchCall) (request)
2393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2394#[serde_with::serde_as]
2395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2396pub struct Spoke {
2397 /// Output only. The time the spoke was created.
2398 #[serde(rename = "createTime")]
2399 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2400 /// Optional. An optional description of the spoke.
2401 pub description: Option<String>,
2402 /// Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2403 pub etag: Option<String>,
2404 /// Optional. The list of fields waiting for hub administration's approval.
2405 #[serde(rename = "fieldPathsPendingUpdate")]
2406 pub field_paths_pending_update: Option<Vec<String>>,
2407 /// Optional. The name of the group that this spoke is associated with.
2408 pub group: Option<String>,
2409 /// Immutable. The name of the hub that this spoke is attached to.
2410 pub hub: Option<String>,
2411 /// Optional labels in key-value pair format. For more information about labels, see [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
2412 pub labels: Option<HashMap<String, String>>,
2413 /// Optional. VLAN attachments that are associated with the spoke.
2414 #[serde(rename = "linkedInterconnectAttachments")]
2415 pub linked_interconnect_attachments: Option<LinkedInterconnectAttachments>,
2416 /// Optional. The linked producer VPC that is associated with the spoke.
2417 #[serde(rename = "linkedProducerVpcNetwork")]
2418 pub linked_producer_vpc_network: Option<LinkedProducerVpcNetwork>,
2419 /// Optional. Router appliance instances that are associated with the spoke.
2420 #[serde(rename = "linkedRouterApplianceInstances")]
2421 pub linked_router_appliance_instances: Option<LinkedRouterApplianceInstances>,
2422 /// Optional. VPC network that is associated with the spoke.
2423 #[serde(rename = "linkedVpcNetwork")]
2424 pub linked_vpc_network: Option<LinkedVpcNetwork>,
2425 /// Optional. VPN tunnels that are associated with the spoke.
2426 #[serde(rename = "linkedVpnTunnels")]
2427 pub linked_vpn_tunnels: Option<LinkedVpnTunnels>,
2428 /// Immutable. The name of the spoke. Spoke names must be unique. They use the following form: `projects/{project_number}/locations/{region}/spokes/{spoke_id}`
2429 pub name: Option<String>,
2430 /// Output only. The reasons for current state of the spoke.
2431 pub reasons: Option<Vec<StateReason>>,
2432 /// Output only. The type of resource associated with the spoke.
2433 #[serde(rename = "spokeType")]
2434 pub spoke_type: Option<String>,
2435 /// Output only. The current lifecycle state of this spoke.
2436 pub state: Option<String>,
2437 /// Output only. The Google-generated UUID for the spoke. This value is unique across all spoke resources. If a spoke is deleted and another with the same name is created, the new spoke is assigned a different `unique_id`.
2438 #[serde(rename = "uniqueId")]
2439 pub unique_id: Option<String>,
2440 /// Output only. The time the spoke was last updated.
2441 #[serde(rename = "updateTime")]
2442 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2443}
2444
2445impl common::RequestValue for Spoke {}
2446impl common::ResponseResult for Spoke {}
2447
2448/// The number of spokes that are in a particular state and associated with a given hub.
2449///
2450/// This type is not used in any activity, and only used as *part* of another schema.
2451///
2452#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2453#[serde_with::serde_as]
2454#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2455pub struct SpokeStateCount {
2456 /// Output only. The total number of spokes that are in this state and associated with a given hub.
2457 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2458 pub count: Option<i64>,
2459 /// Output only. The state of the spokes.
2460 pub state: Option<String>,
2461}
2462
2463impl common::Part for SpokeStateCount {}
2464
2465/// The number of spokes in the hub that are inactive for this reason.
2466///
2467/// This type is not used in any activity, and only used as *part* of another schema.
2468///
2469#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2470#[serde_with::serde_as]
2471#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2472pub struct SpokeStateReasonCount {
2473 /// Output only. The total number of spokes that are inactive for a particular reason and associated with a given hub.
2474 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2475 pub count: Option<i64>,
2476 /// Output only. The reason that a spoke is inactive.
2477 #[serde(rename = "stateReasonCode")]
2478 pub state_reason_code: Option<String>,
2479}
2480
2481impl common::Part for SpokeStateReasonCount {}
2482
2483/// Summarizes information about the spokes associated with a hub. The summary includes a count of spokes according to type and according to state. If any spokes are inactive, the summary also lists the reasons they are inactive, including a count for each reason.
2484///
2485/// This type is not used in any activity, and only used as *part* of another schema.
2486///
2487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2488#[serde_with::serde_as]
2489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2490pub struct SpokeSummary {
2491 /// Output only. Counts the number of spokes that are in each state and associated with a given hub.
2492 #[serde(rename = "spokeStateCounts")]
2493 pub spoke_state_counts: Option<Vec<SpokeStateCount>>,
2494 /// Output only. Counts the number of spokes that are inactive for each possible reason and associated with a given hub.
2495 #[serde(rename = "spokeStateReasonCounts")]
2496 pub spoke_state_reason_counts: Option<Vec<SpokeStateReasonCount>>,
2497 /// Output only. Counts the number of spokes of each type that are associated with a specific hub.
2498 #[serde(rename = "spokeTypeCounts")]
2499 pub spoke_type_counts: Option<Vec<SpokeTypeCount>>,
2500}
2501
2502impl common::Part for SpokeSummary {}
2503
2504/// The number of spokes of a given type that are associated with a specific hub. The type indicates what kind of resource is associated with the spoke.
2505///
2506/// This type is not used in any activity, and only used as *part* of another schema.
2507///
2508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2509#[serde_with::serde_as]
2510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2511pub struct SpokeTypeCount {
2512 /// Output only. The total number of spokes of this type that are associated with the hub.
2513 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2514 pub count: Option<i64>,
2515 /// Output only. The type of the spokes.
2516 #[serde(rename = "spokeType")]
2517 pub spoke_type: Option<String>,
2518}
2519
2520impl common::Part for SpokeTypeCount {}
2521
2522/// The state and activation time details of the resource state.
2523///
2524/// This type is not used in any activity, and only used as *part* of another schema.
2525///
2526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2527#[serde_with::serde_as]
2528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2529pub struct StateMetadata {
2530 /// Output only. Accompanies only the transient states, which include `ADDING`, `DELETING`, and `SUSPENDING`, to denote the time until which the transient state of the resource will be effective. For instance, if the state is `ADDING`, this field shows the time when the resource state transitions to `ACTIVE`.
2531 #[serde(rename = "effectiveTime")]
2532 pub effective_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2533 /// Output only. The state of the resource.
2534 pub state: Option<String>,
2535}
2536
2537impl common::Part for StateMetadata {}
2538
2539/// The reason a spoke is inactive.
2540///
2541/// This type is not used in any activity, and only used as *part* of another schema.
2542///
2543#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2544#[serde_with::serde_as]
2545#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2546pub struct StateReason {
2547 /// The code associated with this reason.
2548 pub code: Option<String>,
2549 /// Human-readable details about this reason.
2550 pub message: Option<String>,
2551 /// Additional information provided by the user in the RejectSpoke call.
2552 #[serde(rename = "userDetails")]
2553 pub user_details: Option<String>,
2554}
2555
2556impl common::Part for StateReason {}
2557
2558/// The timeline of the pending states for a resource.
2559///
2560/// This type is not used in any activity, and only used as *part* of another schema.
2561///
2562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2563#[serde_with::serde_as]
2564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2565pub struct StateTimeline {
2566 /// Output only. The state and activation time details of the resource state.
2567 pub states: Option<Vec<StateMetadata>>,
2568}
2569
2570impl common::Part for StateTimeline {}
2571
2572/// Request message for `TestIamPermissions` method.
2573///
2574/// # Activities
2575///
2576/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2577/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2578///
2579/// * [locations global hubs groups test iam permissions projects](ProjectLocationGlobalHubGroupTestIamPermissionCall) (request)
2580/// * [locations global hubs test iam permissions projects](ProjectLocationGlobalHubTestIamPermissionCall) (request)
2581/// * [locations global policy based routes test iam permissions projects](ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall) (request)
2582/// * [locations internal ranges test iam permissions projects](ProjectLocationInternalRangeTestIamPermissionCall) (request)
2583/// * [locations service classes test iam permissions projects](ProjectLocationServiceClassTestIamPermissionCall) (request)
2584/// * [locations service connection maps test iam permissions projects](ProjectLocationServiceConnectionMapTestIamPermissionCall) (request)
2585/// * [locations service connection policies test iam permissions projects](ProjectLocationServiceConnectionPolicyTestIamPermissionCall) (request)
2586/// * [locations spokes test iam permissions projects](ProjectLocationSpokeTestIamPermissionCall) (request)
2587#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2588#[serde_with::serde_as]
2589#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2590pub struct TestIamPermissionsRequest {
2591 /// 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).
2592 pub permissions: Option<Vec<String>>,
2593}
2594
2595impl common::RequestValue for TestIamPermissionsRequest {}
2596
2597/// Response message for `TestIamPermissions` method.
2598///
2599/// # Activities
2600///
2601/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2602/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2603///
2604/// * [locations global hubs groups test iam permissions projects](ProjectLocationGlobalHubGroupTestIamPermissionCall) (response)
2605/// * [locations global hubs test iam permissions projects](ProjectLocationGlobalHubTestIamPermissionCall) (response)
2606/// * [locations global policy based routes test iam permissions projects](ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall) (response)
2607/// * [locations internal ranges test iam permissions projects](ProjectLocationInternalRangeTestIamPermissionCall) (response)
2608/// * [locations service classes test iam permissions projects](ProjectLocationServiceClassTestIamPermissionCall) (response)
2609/// * [locations service connection maps test iam permissions projects](ProjectLocationServiceConnectionMapTestIamPermissionCall) (response)
2610/// * [locations service connection policies test iam permissions projects](ProjectLocationServiceConnectionPolicyTestIamPermissionCall) (response)
2611/// * [locations spokes test iam permissions projects](ProjectLocationSpokeTestIamPermissionCall) (response)
2612#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2613#[serde_with::serde_as]
2614#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2615pub struct TestIamPermissionsResponse {
2616 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2617 pub permissions: Option<Vec<String>>,
2618}
2619
2620impl common::ResponseResult for TestIamPermissionsResponse {}
2621
2622/// VM instances that this policy-based route applies to.
2623///
2624/// This type is not used in any activity, and only used as *part* of another schema.
2625///
2626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2627#[serde_with::serde_as]
2628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2629pub struct VirtualMachine {
2630 /// Optional. A list of VM instance tags that this policy-based route applies to. VM instances that have ANY of tags specified here installs this PBR.
2631 pub tags: Option<Vec<String>>,
2632}
2633
2634impl common::Part for VirtualMachine {}
2635
2636/// Informational warning message.
2637///
2638/// This type is not used in any activity, and only used as *part* of another schema.
2639///
2640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2641#[serde_with::serde_as]
2642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2643pub struct Warnings {
2644 /// Output only. A warning code, if applicable.
2645 pub code: Option<String>,
2646 /// Output only. Metadata about this warning in key: value format. The key should provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement.
2647 pub data: Option<HashMap<String, String>>,
2648 /// Output only. A human-readable description of the warning code.
2649 #[serde(rename = "warningMessage")]
2650 pub warning_message: Option<String>,
2651}
2652
2653impl common::Part for Warnings {}
2654
2655// ###################
2656// MethodBuilders ###
2657// #################
2658
2659/// A builder providing access to all methods supported on *project* resources.
2660/// It is not used directly, but through the [`Networkconnectivity`] hub.
2661///
2662/// # Example
2663///
2664/// Instantiate a resource builder
2665///
2666/// ```test_harness,no_run
2667/// extern crate hyper;
2668/// extern crate hyper_rustls;
2669/// extern crate google_networkconnectivity1 as networkconnectivity1;
2670///
2671/// # async fn dox() {
2672/// use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2673///
2674/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2675/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2676/// .with_native_roots()
2677/// .unwrap()
2678/// .https_only()
2679/// .enable_http2()
2680/// .build();
2681///
2682/// let executor = hyper_util::rt::TokioExecutor::new();
2683/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2684/// secret,
2685/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2686/// yup_oauth2::client::CustomHyperClientBuilder::from(
2687/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2688/// ),
2689/// ).build().await.unwrap();
2690///
2691/// let client = hyper_util::client::legacy::Client::builder(
2692/// hyper_util::rt::TokioExecutor::new()
2693/// )
2694/// .build(
2695/// hyper_rustls::HttpsConnectorBuilder::new()
2696/// .with_native_roots()
2697/// .unwrap()
2698/// .https_or_http()
2699/// .enable_http2()
2700/// .build()
2701/// );
2702/// let mut hub = Networkconnectivity::new(client, auth);
2703/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2704/// // like `locations_check_consumer_config(...)`, `locations_get(...)`, `locations_global_hubs_accept_spoke(...)`, `locations_global_hubs_accept_spoke_update(...)`, `locations_global_hubs_create(...)`, `locations_global_hubs_delete(...)`, `locations_global_hubs_get(...)`, `locations_global_hubs_get_iam_policy(...)`, `locations_global_hubs_groups_get(...)`, `locations_global_hubs_groups_get_iam_policy(...)`, `locations_global_hubs_groups_list(...)`, `locations_global_hubs_groups_patch(...)`, `locations_global_hubs_groups_set_iam_policy(...)`, `locations_global_hubs_groups_test_iam_permissions(...)`, `locations_global_hubs_list(...)`, `locations_global_hubs_list_spokes(...)`, `locations_global_hubs_patch(...)`, `locations_global_hubs_query_status(...)`, `locations_global_hubs_reject_spoke(...)`, `locations_global_hubs_reject_spoke_update(...)`, `locations_global_hubs_route_tables_get(...)`, `locations_global_hubs_route_tables_list(...)`, `locations_global_hubs_route_tables_routes_get(...)`, `locations_global_hubs_route_tables_routes_list(...)`, `locations_global_hubs_set_iam_policy(...)`, `locations_global_hubs_test_iam_permissions(...)`, `locations_global_policy_based_routes_create(...)`, `locations_global_policy_based_routes_delete(...)`, `locations_global_policy_based_routes_get(...)`, `locations_global_policy_based_routes_get_iam_policy(...)`, `locations_global_policy_based_routes_list(...)`, `locations_global_policy_based_routes_set_iam_policy(...)`, `locations_global_policy_based_routes_test_iam_permissions(...)`, `locations_internal_ranges_create(...)`, `locations_internal_ranges_delete(...)`, `locations_internal_ranges_get(...)`, `locations_internal_ranges_get_iam_policy(...)`, `locations_internal_ranges_list(...)`, `locations_internal_ranges_patch(...)`, `locations_internal_ranges_set_iam_policy(...)`, `locations_internal_ranges_test_iam_permissions(...)`, `locations_list(...)`, `locations_multicloud_data_transfer_configs_create(...)`, `locations_multicloud_data_transfer_configs_delete(...)`, `locations_multicloud_data_transfer_configs_destinations_create(...)`, `locations_multicloud_data_transfer_configs_destinations_delete(...)`, `locations_multicloud_data_transfer_configs_destinations_get(...)`, `locations_multicloud_data_transfer_configs_destinations_list(...)`, `locations_multicloud_data_transfer_configs_destinations_patch(...)`, `locations_multicloud_data_transfer_configs_get(...)`, `locations_multicloud_data_transfer_configs_list(...)`, `locations_multicloud_data_transfer_configs_patch(...)`, `locations_multicloud_data_transfer_supported_services_get(...)`, `locations_multicloud_data_transfer_supported_services_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_regional_endpoints_create(...)`, `locations_regional_endpoints_delete(...)`, `locations_regional_endpoints_get(...)`, `locations_regional_endpoints_list(...)`, `locations_service_classes_delete(...)`, `locations_service_classes_get(...)`, `locations_service_classes_get_iam_policy(...)`, `locations_service_classes_list(...)`, `locations_service_classes_patch(...)`, `locations_service_classes_set_iam_policy(...)`, `locations_service_classes_test_iam_permissions(...)`, `locations_service_connection_maps_create(...)`, `locations_service_connection_maps_delete(...)`, `locations_service_connection_maps_get(...)`, `locations_service_connection_maps_get_iam_policy(...)`, `locations_service_connection_maps_list(...)`, `locations_service_connection_maps_patch(...)`, `locations_service_connection_maps_set_iam_policy(...)`, `locations_service_connection_maps_test_iam_permissions(...)`, `locations_service_connection_policies_create(...)`, `locations_service_connection_policies_delete(...)`, `locations_service_connection_policies_get(...)`, `locations_service_connection_policies_get_iam_policy(...)`, `locations_service_connection_policies_list(...)`, `locations_service_connection_policies_patch(...)`, `locations_service_connection_policies_set_iam_policy(...)`, `locations_service_connection_policies_test_iam_permissions(...)`, `locations_service_connection_tokens_create(...)`, `locations_service_connection_tokens_delete(...)`, `locations_service_connection_tokens_get(...)`, `locations_service_connection_tokens_list(...)`, `locations_spokes_create(...)`, `locations_spokes_delete(...)`, `locations_spokes_get(...)`, `locations_spokes_get_iam_policy(...)`, `locations_spokes_list(...)`, `locations_spokes_patch(...)`, `locations_spokes_set_iam_policy(...)` and `locations_spokes_test_iam_permissions(...)`
2705/// // to build up your call.
2706/// let rb = hub.projects();
2707/// # }
2708/// ```
2709pub struct ProjectMethods<'a, C>
2710where
2711 C: 'a,
2712{
2713 hub: &'a Networkconnectivity<C>,
2714}
2715
2716impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2717
2718impl<'a, C> ProjectMethods<'a, C> {
2719 /// Create a builder to help you perform the following task:
2720 ///
2721 /// Gets details about a Network Connectivity Center group.
2722 ///
2723 /// # Arguments
2724 ///
2725 /// * `name` - Required. The name of the route table resource.
2726 pub fn locations_global_hubs_groups_get(
2727 &self,
2728 name: &str,
2729 ) -> ProjectLocationGlobalHubGroupGetCall<'a, C> {
2730 ProjectLocationGlobalHubGroupGetCall {
2731 hub: self.hub,
2732 _name: name.to_string(),
2733 _delegate: Default::default(),
2734 _additional_params: Default::default(),
2735 _scopes: Default::default(),
2736 }
2737 }
2738
2739 /// Create a builder to help you perform the following task:
2740 ///
2741 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2742 ///
2743 /// # Arguments
2744 ///
2745 /// * `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.
2746 pub fn locations_global_hubs_groups_get_iam_policy(
2747 &self,
2748 resource: &str,
2749 ) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C> {
2750 ProjectLocationGlobalHubGroupGetIamPolicyCall {
2751 hub: self.hub,
2752 _resource: resource.to_string(),
2753 _options_requested_policy_version: Default::default(),
2754 _delegate: Default::default(),
2755 _additional_params: Default::default(),
2756 _scopes: Default::default(),
2757 }
2758 }
2759
2760 /// Create a builder to help you perform the following task:
2761 ///
2762 /// Lists groups in a given hub.
2763 ///
2764 /// # Arguments
2765 ///
2766 /// * `parent` - Required. The parent resource's name.
2767 pub fn locations_global_hubs_groups_list(
2768 &self,
2769 parent: &str,
2770 ) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
2771 ProjectLocationGlobalHubGroupListCall {
2772 hub: self.hub,
2773 _parent: parent.to_string(),
2774 _page_token: Default::default(),
2775 _page_size: Default::default(),
2776 _order_by: Default::default(),
2777 _filter: Default::default(),
2778 _delegate: Default::default(),
2779 _additional_params: Default::default(),
2780 _scopes: Default::default(),
2781 }
2782 }
2783
2784 /// Create a builder to help you perform the following task:
2785 ///
2786 /// Updates the parameters of a Network Connectivity Center group.
2787 ///
2788 /// # Arguments
2789 ///
2790 /// * `request` - No description provided.
2791 /// * `name` - Immutable. The name of the group. Group names must be unique. They use the following form: `projects/{project_number}/locations/global/hubs/{hub}/groups/{group_id}`
2792 pub fn locations_global_hubs_groups_patch(
2793 &self,
2794 request: Group,
2795 name: &str,
2796 ) -> ProjectLocationGlobalHubGroupPatchCall<'a, C> {
2797 ProjectLocationGlobalHubGroupPatchCall {
2798 hub: self.hub,
2799 _request: request,
2800 _name: name.to_string(),
2801 _update_mask: Default::default(),
2802 _request_id: Default::default(),
2803 _delegate: Default::default(),
2804 _additional_params: Default::default(),
2805 _scopes: Default::default(),
2806 }
2807 }
2808
2809 /// Create a builder to help you perform the following task:
2810 ///
2811 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2812 ///
2813 /// # Arguments
2814 ///
2815 /// * `request` - No description provided.
2816 /// * `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.
2817 pub fn locations_global_hubs_groups_set_iam_policy(
2818 &self,
2819 request: SetIamPolicyRequest,
2820 resource: &str,
2821 ) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C> {
2822 ProjectLocationGlobalHubGroupSetIamPolicyCall {
2823 hub: self.hub,
2824 _request: request,
2825 _resource: resource.to_string(),
2826 _delegate: Default::default(),
2827 _additional_params: Default::default(),
2828 _scopes: Default::default(),
2829 }
2830 }
2831
2832 /// Create a builder to help you perform the following task:
2833 ///
2834 /// 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.
2835 ///
2836 /// # Arguments
2837 ///
2838 /// * `request` - No description provided.
2839 /// * `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.
2840 pub fn locations_global_hubs_groups_test_iam_permissions(
2841 &self,
2842 request: TestIamPermissionsRequest,
2843 resource: &str,
2844 ) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C> {
2845 ProjectLocationGlobalHubGroupTestIamPermissionCall {
2846 hub: self.hub,
2847 _request: request,
2848 _resource: resource.to_string(),
2849 _delegate: Default::default(),
2850 _additional_params: Default::default(),
2851 _scopes: Default::default(),
2852 }
2853 }
2854
2855 /// Create a builder to help you perform the following task:
2856 ///
2857 /// Gets details about the specified route.
2858 ///
2859 /// # Arguments
2860 ///
2861 /// * `name` - Required. The name of the route resource.
2862 pub fn locations_global_hubs_route_tables_routes_get(
2863 &self,
2864 name: &str,
2865 ) -> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C> {
2866 ProjectLocationGlobalHubRouteTableRouteGetCall {
2867 hub: self.hub,
2868 _name: name.to_string(),
2869 _delegate: Default::default(),
2870 _additional_params: Default::default(),
2871 _scopes: Default::default(),
2872 }
2873 }
2874
2875 /// Create a builder to help you perform the following task:
2876 ///
2877 /// Lists routes in a given route table.
2878 ///
2879 /// # Arguments
2880 ///
2881 /// * `parent` - Required. The parent resource's name.
2882 pub fn locations_global_hubs_route_tables_routes_list(
2883 &self,
2884 parent: &str,
2885 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
2886 ProjectLocationGlobalHubRouteTableRouteListCall {
2887 hub: self.hub,
2888 _parent: parent.to_string(),
2889 _page_token: Default::default(),
2890 _page_size: Default::default(),
2891 _order_by: Default::default(),
2892 _filter: Default::default(),
2893 _delegate: Default::default(),
2894 _additional_params: Default::default(),
2895 _scopes: Default::default(),
2896 }
2897 }
2898
2899 /// Create a builder to help you perform the following task:
2900 ///
2901 /// Gets details about a Network Connectivity Center route table.
2902 ///
2903 /// # Arguments
2904 ///
2905 /// * `name` - Required. The name of the route table resource.
2906 pub fn locations_global_hubs_route_tables_get(
2907 &self,
2908 name: &str,
2909 ) -> ProjectLocationGlobalHubRouteTableGetCall<'a, C> {
2910 ProjectLocationGlobalHubRouteTableGetCall {
2911 hub: self.hub,
2912 _name: name.to_string(),
2913 _delegate: Default::default(),
2914 _additional_params: Default::default(),
2915 _scopes: Default::default(),
2916 }
2917 }
2918
2919 /// Create a builder to help you perform the following task:
2920 ///
2921 /// Lists route tables in a given hub.
2922 ///
2923 /// # Arguments
2924 ///
2925 /// * `parent` - Required. The parent resource's name.
2926 pub fn locations_global_hubs_route_tables_list(
2927 &self,
2928 parent: &str,
2929 ) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
2930 ProjectLocationGlobalHubRouteTableListCall {
2931 hub: self.hub,
2932 _parent: parent.to_string(),
2933 _page_token: Default::default(),
2934 _page_size: Default::default(),
2935 _order_by: Default::default(),
2936 _filter: Default::default(),
2937 _delegate: Default::default(),
2938 _additional_params: Default::default(),
2939 _scopes: Default::default(),
2940 }
2941 }
2942
2943 /// Create a builder to help you perform the following task:
2944 ///
2945 /// Accepts a proposal to attach a Network Connectivity Center spoke to a hub.
2946 ///
2947 /// # Arguments
2948 ///
2949 /// * `request` - No description provided.
2950 /// * `name` - Required. The name of the hub into which to accept the spoke.
2951 pub fn locations_global_hubs_accept_spoke(
2952 &self,
2953 request: AcceptHubSpokeRequest,
2954 name: &str,
2955 ) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C> {
2956 ProjectLocationGlobalHubAcceptSpokeCall {
2957 hub: self.hub,
2958 _request: request,
2959 _name: name.to_string(),
2960 _delegate: Default::default(),
2961 _additional_params: Default::default(),
2962 _scopes: Default::default(),
2963 }
2964 }
2965
2966 /// Create a builder to help you perform the following task:
2967 ///
2968 /// Accepts a proposal to update a Network Connectivity Center spoke in a hub.
2969 ///
2970 /// # Arguments
2971 ///
2972 /// * `request` - No description provided.
2973 /// * `name` - Required. The name of the hub to accept spoke update.
2974 pub fn locations_global_hubs_accept_spoke_update(
2975 &self,
2976 request: AcceptSpokeUpdateRequest,
2977 name: &str,
2978 ) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C> {
2979 ProjectLocationGlobalHubAcceptSpokeUpdateCall {
2980 hub: self.hub,
2981 _request: request,
2982 _name: name.to_string(),
2983 _delegate: Default::default(),
2984 _additional_params: Default::default(),
2985 _scopes: Default::default(),
2986 }
2987 }
2988
2989 /// Create a builder to help you perform the following task:
2990 ///
2991 /// Creates a new Network Connectivity Center hub in the specified project.
2992 ///
2993 /// # Arguments
2994 ///
2995 /// * `request` - No description provided.
2996 /// * `parent` - Required. The parent resource.
2997 pub fn locations_global_hubs_create(
2998 &self,
2999 request: Hub,
3000 parent: &str,
3001 ) -> ProjectLocationGlobalHubCreateCall<'a, C> {
3002 ProjectLocationGlobalHubCreateCall {
3003 hub: self.hub,
3004 _request: request,
3005 _parent: parent.to_string(),
3006 _request_id: Default::default(),
3007 _hub_id: Default::default(),
3008 _delegate: Default::default(),
3009 _additional_params: Default::default(),
3010 _scopes: Default::default(),
3011 }
3012 }
3013
3014 /// Create a builder to help you perform the following task:
3015 ///
3016 /// Deletes a Network Connectivity Center hub.
3017 ///
3018 /// # Arguments
3019 ///
3020 /// * `name` - Required. The name of the hub to delete.
3021 pub fn locations_global_hubs_delete(
3022 &self,
3023 name: &str,
3024 ) -> ProjectLocationGlobalHubDeleteCall<'a, C> {
3025 ProjectLocationGlobalHubDeleteCall {
3026 hub: self.hub,
3027 _name: name.to_string(),
3028 _request_id: Default::default(),
3029 _delegate: Default::default(),
3030 _additional_params: Default::default(),
3031 _scopes: Default::default(),
3032 }
3033 }
3034
3035 /// Create a builder to help you perform the following task:
3036 ///
3037 /// Gets details about a Network Connectivity Center hub.
3038 ///
3039 /// # Arguments
3040 ///
3041 /// * `name` - Required. The name of the hub resource to get.
3042 pub fn locations_global_hubs_get(&self, name: &str) -> ProjectLocationGlobalHubGetCall<'a, C> {
3043 ProjectLocationGlobalHubGetCall {
3044 hub: self.hub,
3045 _name: name.to_string(),
3046 _delegate: Default::default(),
3047 _additional_params: Default::default(),
3048 _scopes: Default::default(),
3049 }
3050 }
3051
3052 /// Create a builder to help you perform the following task:
3053 ///
3054 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3055 ///
3056 /// # Arguments
3057 ///
3058 /// * `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.
3059 pub fn locations_global_hubs_get_iam_policy(
3060 &self,
3061 resource: &str,
3062 ) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C> {
3063 ProjectLocationGlobalHubGetIamPolicyCall {
3064 hub: self.hub,
3065 _resource: resource.to_string(),
3066 _options_requested_policy_version: Default::default(),
3067 _delegate: Default::default(),
3068 _additional_params: Default::default(),
3069 _scopes: Default::default(),
3070 }
3071 }
3072
3073 /// Create a builder to help you perform the following task:
3074 ///
3075 /// Lists the Network Connectivity Center hubs associated with a given project.
3076 ///
3077 /// # Arguments
3078 ///
3079 /// * `parent` - Required. The parent resource's name.
3080 pub fn locations_global_hubs_list(
3081 &self,
3082 parent: &str,
3083 ) -> ProjectLocationGlobalHubListCall<'a, C> {
3084 ProjectLocationGlobalHubListCall {
3085 hub: self.hub,
3086 _parent: parent.to_string(),
3087 _page_token: Default::default(),
3088 _page_size: Default::default(),
3089 _order_by: Default::default(),
3090 _filter: Default::default(),
3091 _delegate: Default::default(),
3092 _additional_params: Default::default(),
3093 _scopes: Default::default(),
3094 }
3095 }
3096
3097 /// Create a builder to help you perform the following task:
3098 ///
3099 /// Lists the Network Connectivity Center spokes associated with a specified hub and location. The list includes both spokes that are attached to the hub and spokes that have been proposed but not yet accepted.
3100 ///
3101 /// # Arguments
3102 ///
3103 /// * `name` - Required. The name of the hub.
3104 pub fn locations_global_hubs_list_spokes(
3105 &self,
3106 name: &str,
3107 ) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
3108 ProjectLocationGlobalHubListSpokeCall {
3109 hub: self.hub,
3110 _name: name.to_string(),
3111 _view: Default::default(),
3112 _spoke_locations: Default::default(),
3113 _page_token: Default::default(),
3114 _page_size: Default::default(),
3115 _order_by: Default::default(),
3116 _filter: Default::default(),
3117 _delegate: Default::default(),
3118 _additional_params: Default::default(),
3119 _scopes: Default::default(),
3120 }
3121 }
3122
3123 /// Create a builder to help you perform the following task:
3124 ///
3125 /// Updates the description and/or labels of a Network Connectivity Center hub.
3126 ///
3127 /// # Arguments
3128 ///
3129 /// * `request` - No description provided.
3130 /// * `name` - Immutable. The name of the hub. Hub names must be unique. They use the following form: `projects/{project_number}/locations/global/hubs/{hub_id}`
3131 pub fn locations_global_hubs_patch(
3132 &self,
3133 request: Hub,
3134 name: &str,
3135 ) -> ProjectLocationGlobalHubPatchCall<'a, C> {
3136 ProjectLocationGlobalHubPatchCall {
3137 hub: self.hub,
3138 _request: request,
3139 _name: name.to_string(),
3140 _update_mask: Default::default(),
3141 _request_id: Default::default(),
3142 _delegate: Default::default(),
3143 _additional_params: Default::default(),
3144 _scopes: Default::default(),
3145 }
3146 }
3147
3148 /// Create a builder to help you perform the following task:
3149 ///
3150 /// Query the Private Service Connect propagation status of a Network Connectivity Center hub.
3151 ///
3152 /// # Arguments
3153 ///
3154 /// * `name` - Required. The name of the hub.
3155 pub fn locations_global_hubs_query_status(
3156 &self,
3157 name: &str,
3158 ) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
3159 ProjectLocationGlobalHubQueryStatuCall {
3160 hub: self.hub,
3161 _name: name.to_string(),
3162 _page_token: Default::default(),
3163 _page_size: Default::default(),
3164 _order_by: Default::default(),
3165 _group_by: Default::default(),
3166 _filter: Default::default(),
3167 _delegate: Default::default(),
3168 _additional_params: Default::default(),
3169 _scopes: Default::default(),
3170 }
3171 }
3172
3173 /// Create a builder to help you perform the following task:
3174 ///
3175 /// Rejects a Network Connectivity Center spoke from being attached to a hub. If the spoke was previously in the `ACTIVE` state, it transitions to the `INACTIVE` state and is no longer able to connect to other spokes that are attached to the hub.
3176 ///
3177 /// # Arguments
3178 ///
3179 /// * `request` - No description provided.
3180 /// * `name` - Required. The name of the hub from which to reject the spoke.
3181 pub fn locations_global_hubs_reject_spoke(
3182 &self,
3183 request: RejectHubSpokeRequest,
3184 name: &str,
3185 ) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C> {
3186 ProjectLocationGlobalHubRejectSpokeCall {
3187 hub: self.hub,
3188 _request: request,
3189 _name: name.to_string(),
3190 _delegate: Default::default(),
3191 _additional_params: Default::default(),
3192 _scopes: Default::default(),
3193 }
3194 }
3195
3196 /// Create a builder to help you perform the following task:
3197 ///
3198 /// Rejects a proposal to update a Network Connectivity Center spoke in a hub.
3199 ///
3200 /// # Arguments
3201 ///
3202 /// * `request` - No description provided.
3203 /// * `name` - Required. The name of the hub to reject spoke update.
3204 pub fn locations_global_hubs_reject_spoke_update(
3205 &self,
3206 request: RejectSpokeUpdateRequest,
3207 name: &str,
3208 ) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C> {
3209 ProjectLocationGlobalHubRejectSpokeUpdateCall {
3210 hub: self.hub,
3211 _request: request,
3212 _name: name.to_string(),
3213 _delegate: Default::default(),
3214 _additional_params: Default::default(),
3215 _scopes: Default::default(),
3216 }
3217 }
3218
3219 /// Create a builder to help you perform the following task:
3220 ///
3221 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3222 ///
3223 /// # Arguments
3224 ///
3225 /// * `request` - No description provided.
3226 /// * `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.
3227 pub fn locations_global_hubs_set_iam_policy(
3228 &self,
3229 request: SetIamPolicyRequest,
3230 resource: &str,
3231 ) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C> {
3232 ProjectLocationGlobalHubSetIamPolicyCall {
3233 hub: self.hub,
3234 _request: request,
3235 _resource: resource.to_string(),
3236 _delegate: Default::default(),
3237 _additional_params: Default::default(),
3238 _scopes: Default::default(),
3239 }
3240 }
3241
3242 /// Create a builder to help you perform the following task:
3243 ///
3244 /// 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.
3245 ///
3246 /// # Arguments
3247 ///
3248 /// * `request` - No description provided.
3249 /// * `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.
3250 pub fn locations_global_hubs_test_iam_permissions(
3251 &self,
3252 request: TestIamPermissionsRequest,
3253 resource: &str,
3254 ) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C> {
3255 ProjectLocationGlobalHubTestIamPermissionCall {
3256 hub: self.hub,
3257 _request: request,
3258 _resource: resource.to_string(),
3259 _delegate: Default::default(),
3260 _additional_params: Default::default(),
3261 _scopes: Default::default(),
3262 }
3263 }
3264
3265 /// Create a builder to help you perform the following task:
3266 ///
3267 /// Creates a new policy-based route in a given project and location.
3268 ///
3269 /// # Arguments
3270 ///
3271 /// * `request` - No description provided.
3272 /// * `parent` - Required. The parent resource's name of the PolicyBasedRoute.
3273 pub fn locations_global_policy_based_routes_create(
3274 &self,
3275 request: PolicyBasedRoute,
3276 parent: &str,
3277 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {
3278 ProjectLocationGlobalPolicyBasedRouteCreateCall {
3279 hub: self.hub,
3280 _request: request,
3281 _parent: parent.to_string(),
3282 _request_id: Default::default(),
3283 _policy_based_route_id: Default::default(),
3284 _delegate: Default::default(),
3285 _additional_params: Default::default(),
3286 _scopes: Default::default(),
3287 }
3288 }
3289
3290 /// Create a builder to help you perform the following task:
3291 ///
3292 /// Deletes a single policy-based route.
3293 ///
3294 /// # Arguments
3295 ///
3296 /// * `name` - Required. Name of the policy-based route resource to delete.
3297 pub fn locations_global_policy_based_routes_delete(
3298 &self,
3299 name: &str,
3300 ) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C> {
3301 ProjectLocationGlobalPolicyBasedRouteDeleteCall {
3302 hub: self.hub,
3303 _name: name.to_string(),
3304 _request_id: Default::default(),
3305 _delegate: Default::default(),
3306 _additional_params: Default::default(),
3307 _scopes: Default::default(),
3308 }
3309 }
3310
3311 /// Create a builder to help you perform the following task:
3312 ///
3313 /// Gets details of a single policy-based route.
3314 ///
3315 /// # Arguments
3316 ///
3317 /// * `name` - Required. Name of the PolicyBasedRoute resource to get.
3318 pub fn locations_global_policy_based_routes_get(
3319 &self,
3320 name: &str,
3321 ) -> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C> {
3322 ProjectLocationGlobalPolicyBasedRouteGetCall {
3323 hub: self.hub,
3324 _name: name.to_string(),
3325 _delegate: Default::default(),
3326 _additional_params: Default::default(),
3327 _scopes: Default::default(),
3328 }
3329 }
3330
3331 /// Create a builder to help you perform the following task:
3332 ///
3333 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3334 ///
3335 /// # Arguments
3336 ///
3337 /// * `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.
3338 pub fn locations_global_policy_based_routes_get_iam_policy(
3339 &self,
3340 resource: &str,
3341 ) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C> {
3342 ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall {
3343 hub: self.hub,
3344 _resource: resource.to_string(),
3345 _options_requested_policy_version: Default::default(),
3346 _delegate: Default::default(),
3347 _additional_params: Default::default(),
3348 _scopes: Default::default(),
3349 }
3350 }
3351
3352 /// Create a builder to help you perform the following task:
3353 ///
3354 /// Lists policy-based routes in a given project and location.
3355 ///
3356 /// # Arguments
3357 ///
3358 /// * `parent` - Required. The parent resource's name.
3359 pub fn locations_global_policy_based_routes_list(
3360 &self,
3361 parent: &str,
3362 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
3363 ProjectLocationGlobalPolicyBasedRouteListCall {
3364 hub: self.hub,
3365 _parent: parent.to_string(),
3366 _page_token: Default::default(),
3367 _page_size: Default::default(),
3368 _order_by: Default::default(),
3369 _filter: Default::default(),
3370 _delegate: Default::default(),
3371 _additional_params: Default::default(),
3372 _scopes: Default::default(),
3373 }
3374 }
3375
3376 /// Create a builder to help you perform the following task:
3377 ///
3378 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3379 ///
3380 /// # Arguments
3381 ///
3382 /// * `request` - No description provided.
3383 /// * `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.
3384 pub fn locations_global_policy_based_routes_set_iam_policy(
3385 &self,
3386 request: SetIamPolicyRequest,
3387 resource: &str,
3388 ) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C> {
3389 ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall {
3390 hub: self.hub,
3391 _request: request,
3392 _resource: resource.to_string(),
3393 _delegate: Default::default(),
3394 _additional_params: Default::default(),
3395 _scopes: Default::default(),
3396 }
3397 }
3398
3399 /// Create a builder to help you perform the following task:
3400 ///
3401 /// 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.
3402 ///
3403 /// # Arguments
3404 ///
3405 /// * `request` - No description provided.
3406 /// * `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.
3407 pub fn locations_global_policy_based_routes_test_iam_permissions(
3408 &self,
3409 request: TestIamPermissionsRequest,
3410 resource: &str,
3411 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C> {
3412 ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall {
3413 hub: self.hub,
3414 _request: request,
3415 _resource: resource.to_string(),
3416 _delegate: Default::default(),
3417 _additional_params: Default::default(),
3418 _scopes: Default::default(),
3419 }
3420 }
3421
3422 /// Create a builder to help you perform the following task:
3423 ///
3424 /// Creates a new internal range in a given project and location.
3425 ///
3426 /// # Arguments
3427 ///
3428 /// * `request` - No description provided.
3429 /// * `parent` - Required. The parent resource's name of the internal range.
3430 pub fn locations_internal_ranges_create(
3431 &self,
3432 request: InternalRange,
3433 parent: &str,
3434 ) -> ProjectLocationInternalRangeCreateCall<'a, C> {
3435 ProjectLocationInternalRangeCreateCall {
3436 hub: self.hub,
3437 _request: request,
3438 _parent: parent.to_string(),
3439 _request_id: Default::default(),
3440 _internal_range_id: Default::default(),
3441 _delegate: Default::default(),
3442 _additional_params: Default::default(),
3443 _scopes: Default::default(),
3444 }
3445 }
3446
3447 /// Create a builder to help you perform the following task:
3448 ///
3449 /// Deletes a single internal range.
3450 ///
3451 /// # Arguments
3452 ///
3453 /// * `name` - Required. The name of the internal range to delete.
3454 pub fn locations_internal_ranges_delete(
3455 &self,
3456 name: &str,
3457 ) -> ProjectLocationInternalRangeDeleteCall<'a, C> {
3458 ProjectLocationInternalRangeDeleteCall {
3459 hub: self.hub,
3460 _name: name.to_string(),
3461 _request_id: Default::default(),
3462 _delegate: Default::default(),
3463 _additional_params: Default::default(),
3464 _scopes: Default::default(),
3465 }
3466 }
3467
3468 /// Create a builder to help you perform the following task:
3469 ///
3470 /// Gets details of a single internal range.
3471 ///
3472 /// # Arguments
3473 ///
3474 /// * `name` - Required. Name of the InternalRange to get.
3475 pub fn locations_internal_ranges_get(
3476 &self,
3477 name: &str,
3478 ) -> ProjectLocationInternalRangeGetCall<'a, C> {
3479 ProjectLocationInternalRangeGetCall {
3480 hub: self.hub,
3481 _name: name.to_string(),
3482 _delegate: Default::default(),
3483 _additional_params: Default::default(),
3484 _scopes: Default::default(),
3485 }
3486 }
3487
3488 /// Create a builder to help you perform the following task:
3489 ///
3490 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3491 ///
3492 /// # Arguments
3493 ///
3494 /// * `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.
3495 pub fn locations_internal_ranges_get_iam_policy(
3496 &self,
3497 resource: &str,
3498 ) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C> {
3499 ProjectLocationInternalRangeGetIamPolicyCall {
3500 hub: self.hub,
3501 _resource: resource.to_string(),
3502 _options_requested_policy_version: Default::default(),
3503 _delegate: Default::default(),
3504 _additional_params: Default::default(),
3505 _scopes: Default::default(),
3506 }
3507 }
3508
3509 /// Create a builder to help you perform the following task:
3510 ///
3511 /// Lists internal ranges in a given project and location.
3512 ///
3513 /// # Arguments
3514 ///
3515 /// * `parent` - Required. The parent resource's name.
3516 pub fn locations_internal_ranges_list(
3517 &self,
3518 parent: &str,
3519 ) -> ProjectLocationInternalRangeListCall<'a, C> {
3520 ProjectLocationInternalRangeListCall {
3521 hub: self.hub,
3522 _parent: parent.to_string(),
3523 _page_token: Default::default(),
3524 _page_size: Default::default(),
3525 _order_by: Default::default(),
3526 _filter: Default::default(),
3527 _delegate: Default::default(),
3528 _additional_params: Default::default(),
3529 _scopes: Default::default(),
3530 }
3531 }
3532
3533 /// Create a builder to help you perform the following task:
3534 ///
3535 /// Updates the parameters of a single internal range.
3536 ///
3537 /// # Arguments
3538 ///
3539 /// * `request` - No description provided.
3540 /// * `name` - Identifier. The name of an internal range. Format: projects/{project}/locations/{location}/internalRanges/{internal_range} See: https://google.aip.dev/122#fields-representing-resource-names
3541 pub fn locations_internal_ranges_patch(
3542 &self,
3543 request: InternalRange,
3544 name: &str,
3545 ) -> ProjectLocationInternalRangePatchCall<'a, C> {
3546 ProjectLocationInternalRangePatchCall {
3547 hub: self.hub,
3548 _request: request,
3549 _name: name.to_string(),
3550 _update_mask: Default::default(),
3551 _request_id: Default::default(),
3552 _delegate: Default::default(),
3553 _additional_params: Default::default(),
3554 _scopes: Default::default(),
3555 }
3556 }
3557
3558 /// Create a builder to help you perform the following task:
3559 ///
3560 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3561 ///
3562 /// # Arguments
3563 ///
3564 /// * `request` - No description provided.
3565 /// * `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.
3566 pub fn locations_internal_ranges_set_iam_policy(
3567 &self,
3568 request: SetIamPolicyRequest,
3569 resource: &str,
3570 ) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C> {
3571 ProjectLocationInternalRangeSetIamPolicyCall {
3572 hub: self.hub,
3573 _request: request,
3574 _resource: resource.to_string(),
3575 _delegate: Default::default(),
3576 _additional_params: Default::default(),
3577 _scopes: Default::default(),
3578 }
3579 }
3580
3581 /// Create a builder to help you perform the following task:
3582 ///
3583 /// 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.
3584 ///
3585 /// # Arguments
3586 ///
3587 /// * `request` - No description provided.
3588 /// * `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.
3589 pub fn locations_internal_ranges_test_iam_permissions(
3590 &self,
3591 request: TestIamPermissionsRequest,
3592 resource: &str,
3593 ) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C> {
3594 ProjectLocationInternalRangeTestIamPermissionCall {
3595 hub: self.hub,
3596 _request: request,
3597 _resource: resource.to_string(),
3598 _delegate: Default::default(),
3599 _additional_params: Default::default(),
3600 _scopes: Default::default(),
3601 }
3602 }
3603
3604 /// Create a builder to help you perform the following task:
3605 ///
3606 /// Creates a `Destination` resource in a specified project and location.
3607 ///
3608 /// # Arguments
3609 ///
3610 /// * `request` - No description provided.
3611 /// * `parent` - Required. The name of the parent resource.
3612 pub fn locations_multicloud_data_transfer_configs_destinations_create(
3613 &self,
3614 request: Destination,
3615 parent: &str,
3616 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C> {
3617 ProjectLocationMulticloudDataTransferConfigDestinationCreateCall {
3618 hub: self.hub,
3619 _request: request,
3620 _parent: parent.to_string(),
3621 _request_id: Default::default(),
3622 _destination_id: Default::default(),
3623 _delegate: Default::default(),
3624 _additional_params: Default::default(),
3625 _scopes: Default::default(),
3626 }
3627 }
3628
3629 /// Create a builder to help you perform the following task:
3630 ///
3631 /// Deletes a `Destination` resource.
3632 ///
3633 /// # Arguments
3634 ///
3635 /// * `name` - Required. The name of the `Destination` resource to delete.
3636 pub fn locations_multicloud_data_transfer_configs_destinations_delete(
3637 &self,
3638 name: &str,
3639 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C> {
3640 ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall {
3641 hub: self.hub,
3642 _name: name.to_string(),
3643 _request_id: Default::default(),
3644 _etag: Default::default(),
3645 _delegate: Default::default(),
3646 _additional_params: Default::default(),
3647 _scopes: Default::default(),
3648 }
3649 }
3650
3651 /// Create a builder to help you perform the following task:
3652 ///
3653 /// Gets the details of a `Destination` resource.
3654 ///
3655 /// # Arguments
3656 ///
3657 /// * `name` - Required. The name of the `Destination` resource to get.
3658 pub fn locations_multicloud_data_transfer_configs_destinations_get(
3659 &self,
3660 name: &str,
3661 ) -> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C> {
3662 ProjectLocationMulticloudDataTransferConfigDestinationGetCall {
3663 hub: self.hub,
3664 _name: name.to_string(),
3665 _delegate: Default::default(),
3666 _additional_params: Default::default(),
3667 _scopes: Default::default(),
3668 }
3669 }
3670
3671 /// Create a builder to help you perform the following task:
3672 ///
3673 /// Lists the `Destination` resources in a specified project and location.
3674 ///
3675 /// # Arguments
3676 ///
3677 /// * `parent` - Required. The name of the parent resource.
3678 pub fn locations_multicloud_data_transfer_configs_destinations_list(
3679 &self,
3680 parent: &str,
3681 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
3682 ProjectLocationMulticloudDataTransferConfigDestinationListCall {
3683 hub: self.hub,
3684 _parent: parent.to_string(),
3685 _return_partial_success: Default::default(),
3686 _page_token: Default::default(),
3687 _page_size: Default::default(),
3688 _order_by: Default::default(),
3689 _filter: Default::default(),
3690 _delegate: Default::default(),
3691 _additional_params: Default::default(),
3692 _scopes: Default::default(),
3693 }
3694 }
3695
3696 /// Create a builder to help you perform the following task:
3697 ///
3698 /// Updates a `Destination` resource in a specified project and location.
3699 ///
3700 /// # Arguments
3701 ///
3702 /// * `request` - No description provided.
3703 /// * `name` - Identifier. The name of the `Destination` resource. Format: `projects/{project}/locations/{location}/multicloudDataTransferConfigs/{multicloud_data_transfer_config}/destinations/{destination}`.
3704 pub fn locations_multicloud_data_transfer_configs_destinations_patch(
3705 &self,
3706 request: Destination,
3707 name: &str,
3708 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C> {
3709 ProjectLocationMulticloudDataTransferConfigDestinationPatchCall {
3710 hub: self.hub,
3711 _request: request,
3712 _name: name.to_string(),
3713 _update_mask: Default::default(),
3714 _request_id: Default::default(),
3715 _delegate: Default::default(),
3716 _additional_params: Default::default(),
3717 _scopes: Default::default(),
3718 }
3719 }
3720
3721 /// Create a builder to help you perform the following task:
3722 ///
3723 /// Creates a `MulticloudDataTransferConfig` resource in a specified project and location.
3724 ///
3725 /// # Arguments
3726 ///
3727 /// * `request` - No description provided.
3728 /// * `parent` - Required. The name of the parent resource.
3729 pub fn locations_multicloud_data_transfer_configs_create(
3730 &self,
3731 request: MulticloudDataTransferConfig,
3732 parent: &str,
3733 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {
3734 ProjectLocationMulticloudDataTransferConfigCreateCall {
3735 hub: self.hub,
3736 _request: request,
3737 _parent: parent.to_string(),
3738 _request_id: Default::default(),
3739 _multicloud_data_transfer_config_id: Default::default(),
3740 _delegate: Default::default(),
3741 _additional_params: Default::default(),
3742 _scopes: Default::default(),
3743 }
3744 }
3745
3746 /// Create a builder to help you perform the following task:
3747 ///
3748 /// Deletes a `MulticloudDataTransferConfig` resource.
3749 ///
3750 /// # Arguments
3751 ///
3752 /// * `name` - Required. The name of the `MulticloudDataTransferConfig` resource to delete.
3753 pub fn locations_multicloud_data_transfer_configs_delete(
3754 &self,
3755 name: &str,
3756 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C> {
3757 ProjectLocationMulticloudDataTransferConfigDeleteCall {
3758 hub: self.hub,
3759 _name: name.to_string(),
3760 _request_id: Default::default(),
3761 _etag: Default::default(),
3762 _delegate: Default::default(),
3763 _additional_params: Default::default(),
3764 _scopes: Default::default(),
3765 }
3766 }
3767
3768 /// Create a builder to help you perform the following task:
3769 ///
3770 /// Gets the details of a `MulticloudDataTransferConfig` resource.
3771 ///
3772 /// # Arguments
3773 ///
3774 /// * `name` - Required. The name of the `MulticloudDataTransferConfig` resource to get.
3775 pub fn locations_multicloud_data_transfer_configs_get(
3776 &self,
3777 name: &str,
3778 ) -> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C> {
3779 ProjectLocationMulticloudDataTransferConfigGetCall {
3780 hub: self.hub,
3781 _name: name.to_string(),
3782 _delegate: Default::default(),
3783 _additional_params: Default::default(),
3784 _scopes: Default::default(),
3785 }
3786 }
3787
3788 /// Create a builder to help you perform the following task:
3789 ///
3790 /// Lists the `MulticloudDataTransferConfig` resources in a specified project and location.
3791 ///
3792 /// # Arguments
3793 ///
3794 /// * `parent` - Required. The name of the parent resource.
3795 pub fn locations_multicloud_data_transfer_configs_list(
3796 &self,
3797 parent: &str,
3798 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
3799 ProjectLocationMulticloudDataTransferConfigListCall {
3800 hub: self.hub,
3801 _parent: parent.to_string(),
3802 _return_partial_success: Default::default(),
3803 _page_token: Default::default(),
3804 _page_size: Default::default(),
3805 _order_by: Default::default(),
3806 _filter: Default::default(),
3807 _delegate: Default::default(),
3808 _additional_params: Default::default(),
3809 _scopes: Default::default(),
3810 }
3811 }
3812
3813 /// Create a builder to help you perform the following task:
3814 ///
3815 /// Updates a `MulticloudDataTransferConfig` resource in a specified project and location.
3816 ///
3817 /// # Arguments
3818 ///
3819 /// * `request` - No description provided.
3820 /// * `name` - Identifier. The name of the `MulticloudDataTransferConfig` resource. Format: `projects/{project}/locations/{location}/multicloudDataTransferConfigs/{multicloud_data_transfer_config}`.
3821 pub fn locations_multicloud_data_transfer_configs_patch(
3822 &self,
3823 request: MulticloudDataTransferConfig,
3824 name: &str,
3825 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {
3826 ProjectLocationMulticloudDataTransferConfigPatchCall {
3827 hub: self.hub,
3828 _request: request,
3829 _name: name.to_string(),
3830 _update_mask: Default::default(),
3831 _request_id: Default::default(),
3832 _delegate: Default::default(),
3833 _additional_params: Default::default(),
3834 _scopes: Default::default(),
3835 }
3836 }
3837
3838 /// Create a builder to help you perform the following task:
3839 ///
3840 /// Gets the details of a service that is supported for Data Transfer Essentials.
3841 ///
3842 /// # Arguments
3843 ///
3844 /// * `name` - Required. The name of the service.
3845 pub fn locations_multicloud_data_transfer_supported_services_get(
3846 &self,
3847 name: &str,
3848 ) -> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C> {
3849 ProjectLocationMulticloudDataTransferSupportedServiceGetCall {
3850 hub: self.hub,
3851 _name: name.to_string(),
3852 _delegate: Default::default(),
3853 _additional_params: Default::default(),
3854 _scopes: Default::default(),
3855 }
3856 }
3857
3858 /// Create a builder to help you perform the following task:
3859 ///
3860 /// Lists the services in the project for a region that are supported for Data Transfer Essentials.
3861 ///
3862 /// # Arguments
3863 ///
3864 /// * `parent` - Required. The name of the parent resource.
3865 pub fn locations_multicloud_data_transfer_supported_services_list(
3866 &self,
3867 parent: &str,
3868 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C> {
3869 ProjectLocationMulticloudDataTransferSupportedServiceListCall {
3870 hub: self.hub,
3871 _parent: parent.to_string(),
3872 _page_token: Default::default(),
3873 _page_size: Default::default(),
3874 _delegate: Default::default(),
3875 _additional_params: Default::default(),
3876 _scopes: Default::default(),
3877 }
3878 }
3879
3880 /// Create a builder to help you perform the following task:
3881 ///
3882 /// 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`.
3883 ///
3884 /// # Arguments
3885 ///
3886 /// * `request` - No description provided.
3887 /// * `name` - The name of the operation resource to be cancelled.
3888 pub fn locations_operations_cancel(
3889 &self,
3890 request: GoogleLongrunningCancelOperationRequest,
3891 name: &str,
3892 ) -> ProjectLocationOperationCancelCall<'a, C> {
3893 ProjectLocationOperationCancelCall {
3894 hub: self.hub,
3895 _request: request,
3896 _name: name.to_string(),
3897 _delegate: Default::default(),
3898 _additional_params: Default::default(),
3899 _scopes: Default::default(),
3900 }
3901 }
3902
3903 /// Create a builder to help you perform the following task:
3904 ///
3905 /// 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`.
3906 ///
3907 /// # Arguments
3908 ///
3909 /// * `name` - The name of the operation resource to be deleted.
3910 pub fn locations_operations_delete(
3911 &self,
3912 name: &str,
3913 ) -> ProjectLocationOperationDeleteCall<'a, C> {
3914 ProjectLocationOperationDeleteCall {
3915 hub: self.hub,
3916 _name: name.to_string(),
3917 _delegate: Default::default(),
3918 _additional_params: Default::default(),
3919 _scopes: Default::default(),
3920 }
3921 }
3922
3923 /// Create a builder to help you perform the following task:
3924 ///
3925 /// 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.
3926 ///
3927 /// # Arguments
3928 ///
3929 /// * `name` - The name of the operation resource.
3930 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
3931 ProjectLocationOperationGetCall {
3932 hub: self.hub,
3933 _name: name.to_string(),
3934 _delegate: Default::default(),
3935 _additional_params: Default::default(),
3936 _scopes: Default::default(),
3937 }
3938 }
3939
3940 /// Create a builder to help you perform the following task:
3941 ///
3942 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3943 ///
3944 /// # Arguments
3945 ///
3946 /// * `name` - The name of the operation's parent resource.
3947 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
3948 ProjectLocationOperationListCall {
3949 hub: self.hub,
3950 _name: name.to_string(),
3951 _return_partial_success: Default::default(),
3952 _page_token: Default::default(),
3953 _page_size: Default::default(),
3954 _filter: Default::default(),
3955 _delegate: Default::default(),
3956 _additional_params: Default::default(),
3957 _scopes: Default::default(),
3958 }
3959 }
3960
3961 /// Create a builder to help you perform the following task:
3962 ///
3963 /// Creates a new RegionalEndpoint in a given project and location.
3964 ///
3965 /// # Arguments
3966 ///
3967 /// * `request` - No description provided.
3968 /// * `parent` - Required. The parent resource's name of the RegionalEndpoint.
3969 pub fn locations_regional_endpoints_create(
3970 &self,
3971 request: RegionalEndpoint,
3972 parent: &str,
3973 ) -> ProjectLocationRegionalEndpointCreateCall<'a, C> {
3974 ProjectLocationRegionalEndpointCreateCall {
3975 hub: self.hub,
3976 _request: request,
3977 _parent: parent.to_string(),
3978 _request_id: Default::default(),
3979 _regional_endpoint_id: Default::default(),
3980 _delegate: Default::default(),
3981 _additional_params: Default::default(),
3982 _scopes: Default::default(),
3983 }
3984 }
3985
3986 /// Create a builder to help you perform the following task:
3987 ///
3988 /// Deletes a single RegionalEndpoint.
3989 ///
3990 /// # Arguments
3991 ///
3992 /// * `name` - Required. The name of the RegionalEndpoint to delete.
3993 pub fn locations_regional_endpoints_delete(
3994 &self,
3995 name: &str,
3996 ) -> ProjectLocationRegionalEndpointDeleteCall<'a, C> {
3997 ProjectLocationRegionalEndpointDeleteCall {
3998 hub: self.hub,
3999 _name: name.to_string(),
4000 _request_id: Default::default(),
4001 _delegate: Default::default(),
4002 _additional_params: Default::default(),
4003 _scopes: Default::default(),
4004 }
4005 }
4006
4007 /// Create a builder to help you perform the following task:
4008 ///
4009 /// Gets details of a single RegionalEndpoint.
4010 ///
4011 /// # Arguments
4012 ///
4013 /// * `name` - Required. Name of the RegionalEndpoint resource to get. Format: `projects/{project}/locations/{location}/regionalEndpoints/{regional_endpoint}`
4014 pub fn locations_regional_endpoints_get(
4015 &self,
4016 name: &str,
4017 ) -> ProjectLocationRegionalEndpointGetCall<'a, C> {
4018 ProjectLocationRegionalEndpointGetCall {
4019 hub: self.hub,
4020 _name: name.to_string(),
4021 _delegate: Default::default(),
4022 _additional_params: Default::default(),
4023 _scopes: Default::default(),
4024 }
4025 }
4026
4027 /// Create a builder to help you perform the following task:
4028 ///
4029 /// Lists RegionalEndpoints in a given project and location.
4030 ///
4031 /// # Arguments
4032 ///
4033 /// * `parent` - Required. The parent resource's name of the RegionalEndpoint.
4034 pub fn locations_regional_endpoints_list(
4035 &self,
4036 parent: &str,
4037 ) -> ProjectLocationRegionalEndpointListCall<'a, C> {
4038 ProjectLocationRegionalEndpointListCall {
4039 hub: self.hub,
4040 _parent: parent.to_string(),
4041 _page_token: Default::default(),
4042 _page_size: Default::default(),
4043 _order_by: Default::default(),
4044 _filter: Default::default(),
4045 _delegate: Default::default(),
4046 _additional_params: Default::default(),
4047 _scopes: Default::default(),
4048 }
4049 }
4050
4051 /// Create a builder to help you perform the following task:
4052 ///
4053 /// Deletes a single ServiceClass.
4054 ///
4055 /// # Arguments
4056 ///
4057 /// * `name` - Required. The name of the ServiceClass to delete.
4058 pub fn locations_service_classes_delete(
4059 &self,
4060 name: &str,
4061 ) -> ProjectLocationServiceClassDeleteCall<'a, C> {
4062 ProjectLocationServiceClassDeleteCall {
4063 hub: self.hub,
4064 _name: name.to_string(),
4065 _request_id: Default::default(),
4066 _etag: Default::default(),
4067 _delegate: Default::default(),
4068 _additional_params: Default::default(),
4069 _scopes: Default::default(),
4070 }
4071 }
4072
4073 /// Create a builder to help you perform the following task:
4074 ///
4075 /// Gets details of a single ServiceClass.
4076 ///
4077 /// # Arguments
4078 ///
4079 /// * `name` - Required. Name of the ServiceClass to get.
4080 pub fn locations_service_classes_get(
4081 &self,
4082 name: &str,
4083 ) -> ProjectLocationServiceClassGetCall<'a, C> {
4084 ProjectLocationServiceClassGetCall {
4085 hub: self.hub,
4086 _name: name.to_string(),
4087 _delegate: Default::default(),
4088 _additional_params: Default::default(),
4089 _scopes: Default::default(),
4090 }
4091 }
4092
4093 /// Create a builder to help you perform the following task:
4094 ///
4095 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4096 ///
4097 /// # Arguments
4098 ///
4099 /// * `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.
4100 pub fn locations_service_classes_get_iam_policy(
4101 &self,
4102 resource: &str,
4103 ) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C> {
4104 ProjectLocationServiceClassGetIamPolicyCall {
4105 hub: self.hub,
4106 _resource: resource.to_string(),
4107 _options_requested_policy_version: Default::default(),
4108 _delegate: Default::default(),
4109 _additional_params: Default::default(),
4110 _scopes: Default::default(),
4111 }
4112 }
4113
4114 /// Create a builder to help you perform the following task:
4115 ///
4116 /// Lists ServiceClasses in a given project and location.
4117 ///
4118 /// # Arguments
4119 ///
4120 /// * `parent` - Required. The parent resource's name. ex. projects/123/locations/us-east1
4121 pub fn locations_service_classes_list(
4122 &self,
4123 parent: &str,
4124 ) -> ProjectLocationServiceClassListCall<'a, C> {
4125 ProjectLocationServiceClassListCall {
4126 hub: self.hub,
4127 _parent: parent.to_string(),
4128 _page_token: Default::default(),
4129 _page_size: Default::default(),
4130 _order_by: Default::default(),
4131 _filter: Default::default(),
4132 _delegate: Default::default(),
4133 _additional_params: Default::default(),
4134 _scopes: Default::default(),
4135 }
4136 }
4137
4138 /// Create a builder to help you perform the following task:
4139 ///
4140 /// Updates the parameters of a single ServiceClass.
4141 ///
4142 /// # Arguments
4143 ///
4144 /// * `request` - No description provided.
4145 /// * `name` - Immutable. The name of a ServiceClass resource. Format: projects/{project}/locations/{location}/serviceClasses/{service_class} See: https://google.aip.dev/122#fields-representing-resource-names
4146 pub fn locations_service_classes_patch(
4147 &self,
4148 request: ServiceClass,
4149 name: &str,
4150 ) -> ProjectLocationServiceClassPatchCall<'a, C> {
4151 ProjectLocationServiceClassPatchCall {
4152 hub: self.hub,
4153 _request: request,
4154 _name: name.to_string(),
4155 _update_mask: Default::default(),
4156 _request_id: Default::default(),
4157 _delegate: Default::default(),
4158 _additional_params: Default::default(),
4159 _scopes: Default::default(),
4160 }
4161 }
4162
4163 /// Create a builder to help you perform the following task:
4164 ///
4165 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4166 ///
4167 /// # Arguments
4168 ///
4169 /// * `request` - No description provided.
4170 /// * `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.
4171 pub fn locations_service_classes_set_iam_policy(
4172 &self,
4173 request: SetIamPolicyRequest,
4174 resource: &str,
4175 ) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C> {
4176 ProjectLocationServiceClassSetIamPolicyCall {
4177 hub: self.hub,
4178 _request: request,
4179 _resource: resource.to_string(),
4180 _delegate: Default::default(),
4181 _additional_params: Default::default(),
4182 _scopes: Default::default(),
4183 }
4184 }
4185
4186 /// Create a builder to help you perform the following task:
4187 ///
4188 /// 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.
4189 ///
4190 /// # Arguments
4191 ///
4192 /// * `request` - No description provided.
4193 /// * `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.
4194 pub fn locations_service_classes_test_iam_permissions(
4195 &self,
4196 request: TestIamPermissionsRequest,
4197 resource: &str,
4198 ) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C> {
4199 ProjectLocationServiceClassTestIamPermissionCall {
4200 hub: self.hub,
4201 _request: request,
4202 _resource: resource.to_string(),
4203 _delegate: Default::default(),
4204 _additional_params: Default::default(),
4205 _scopes: Default::default(),
4206 }
4207 }
4208
4209 /// Create a builder to help you perform the following task:
4210 ///
4211 /// Creates a new ServiceConnectionMap in a given project and location.
4212 ///
4213 /// # Arguments
4214 ///
4215 /// * `request` - No description provided.
4216 /// * `parent` - Required. The parent resource's name of the ServiceConnectionMap. ex. projects/123/locations/us-east1
4217 pub fn locations_service_connection_maps_create(
4218 &self,
4219 request: ServiceConnectionMap,
4220 parent: &str,
4221 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C> {
4222 ProjectLocationServiceConnectionMapCreateCall {
4223 hub: self.hub,
4224 _request: request,
4225 _parent: parent.to_string(),
4226 _service_connection_map_id: Default::default(),
4227 _request_id: Default::default(),
4228 _delegate: Default::default(),
4229 _additional_params: Default::default(),
4230 _scopes: Default::default(),
4231 }
4232 }
4233
4234 /// Create a builder to help you perform the following task:
4235 ///
4236 /// Deletes a single ServiceConnectionMap.
4237 ///
4238 /// # Arguments
4239 ///
4240 /// * `name` - Required. The name of the ServiceConnectionMap to delete.
4241 pub fn locations_service_connection_maps_delete(
4242 &self,
4243 name: &str,
4244 ) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C> {
4245 ProjectLocationServiceConnectionMapDeleteCall {
4246 hub: self.hub,
4247 _name: name.to_string(),
4248 _request_id: Default::default(),
4249 _etag: Default::default(),
4250 _delegate: Default::default(),
4251 _additional_params: Default::default(),
4252 _scopes: Default::default(),
4253 }
4254 }
4255
4256 /// Create a builder to help you perform the following task:
4257 ///
4258 /// Gets details of a single ServiceConnectionMap.
4259 ///
4260 /// # Arguments
4261 ///
4262 /// * `name` - Required. Name of the ServiceConnectionMap to get.
4263 pub fn locations_service_connection_maps_get(
4264 &self,
4265 name: &str,
4266 ) -> ProjectLocationServiceConnectionMapGetCall<'a, C> {
4267 ProjectLocationServiceConnectionMapGetCall {
4268 hub: self.hub,
4269 _name: name.to_string(),
4270 _delegate: Default::default(),
4271 _additional_params: Default::default(),
4272 _scopes: Default::default(),
4273 }
4274 }
4275
4276 /// Create a builder to help you perform the following task:
4277 ///
4278 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4279 ///
4280 /// # Arguments
4281 ///
4282 /// * `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.
4283 pub fn locations_service_connection_maps_get_iam_policy(
4284 &self,
4285 resource: &str,
4286 ) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C> {
4287 ProjectLocationServiceConnectionMapGetIamPolicyCall {
4288 hub: self.hub,
4289 _resource: resource.to_string(),
4290 _options_requested_policy_version: Default::default(),
4291 _delegate: Default::default(),
4292 _additional_params: Default::default(),
4293 _scopes: Default::default(),
4294 }
4295 }
4296
4297 /// Create a builder to help you perform the following task:
4298 ///
4299 /// Lists ServiceConnectionMaps in a given project and location.
4300 ///
4301 /// # Arguments
4302 ///
4303 /// * `parent` - Required. The parent resource's name. ex. projects/123/locations/us-east1
4304 pub fn locations_service_connection_maps_list(
4305 &self,
4306 parent: &str,
4307 ) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
4308 ProjectLocationServiceConnectionMapListCall {
4309 hub: self.hub,
4310 _parent: parent.to_string(),
4311 _page_token: Default::default(),
4312 _page_size: Default::default(),
4313 _order_by: Default::default(),
4314 _filter: Default::default(),
4315 _delegate: Default::default(),
4316 _additional_params: Default::default(),
4317 _scopes: Default::default(),
4318 }
4319 }
4320
4321 /// Create a builder to help you perform the following task:
4322 ///
4323 /// Updates the parameters of a single ServiceConnectionMap.
4324 ///
4325 /// # Arguments
4326 ///
4327 /// * `request` - No description provided.
4328 /// * `name` - Immutable. The name of a ServiceConnectionMap. Format: projects/{project}/locations/{location}/serviceConnectionMaps/{service_connection_map} See: https://google.aip.dev/122#fields-representing-resource-names
4329 pub fn locations_service_connection_maps_patch(
4330 &self,
4331 request: ServiceConnectionMap,
4332 name: &str,
4333 ) -> ProjectLocationServiceConnectionMapPatchCall<'a, C> {
4334 ProjectLocationServiceConnectionMapPatchCall {
4335 hub: self.hub,
4336 _request: request,
4337 _name: name.to_string(),
4338 _update_mask: Default::default(),
4339 _request_id: Default::default(),
4340 _delegate: Default::default(),
4341 _additional_params: Default::default(),
4342 _scopes: Default::default(),
4343 }
4344 }
4345
4346 /// Create a builder to help you perform the following task:
4347 ///
4348 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4349 ///
4350 /// # Arguments
4351 ///
4352 /// * `request` - No description provided.
4353 /// * `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.
4354 pub fn locations_service_connection_maps_set_iam_policy(
4355 &self,
4356 request: SetIamPolicyRequest,
4357 resource: &str,
4358 ) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C> {
4359 ProjectLocationServiceConnectionMapSetIamPolicyCall {
4360 hub: self.hub,
4361 _request: request,
4362 _resource: resource.to_string(),
4363 _delegate: Default::default(),
4364 _additional_params: Default::default(),
4365 _scopes: Default::default(),
4366 }
4367 }
4368
4369 /// Create a builder to help you perform the following task:
4370 ///
4371 /// 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.
4372 ///
4373 /// # Arguments
4374 ///
4375 /// * `request` - No description provided.
4376 /// * `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.
4377 pub fn locations_service_connection_maps_test_iam_permissions(
4378 &self,
4379 request: TestIamPermissionsRequest,
4380 resource: &str,
4381 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C> {
4382 ProjectLocationServiceConnectionMapTestIamPermissionCall {
4383 hub: self.hub,
4384 _request: request,
4385 _resource: resource.to_string(),
4386 _delegate: Default::default(),
4387 _additional_params: Default::default(),
4388 _scopes: Default::default(),
4389 }
4390 }
4391
4392 /// Create a builder to help you perform the following task:
4393 ///
4394 /// Creates a new ServiceConnectionPolicy in a given project and location.
4395 ///
4396 /// # Arguments
4397 ///
4398 /// * `request` - No description provided.
4399 /// * `parent` - Required. The parent resource's name of the ServiceConnectionPolicy. ex. projects/123/locations/us-east1
4400 pub fn locations_service_connection_policies_create(
4401 &self,
4402 request: ServiceConnectionPolicy,
4403 parent: &str,
4404 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
4405 ProjectLocationServiceConnectionPolicyCreateCall {
4406 hub: self.hub,
4407 _request: request,
4408 _parent: parent.to_string(),
4409 _subnetwork_mode: Default::default(),
4410 _service_connection_policy_id: Default::default(),
4411 _request_id: Default::default(),
4412 _auto_subnetwork_config_prefix_length: Default::default(),
4413 _auto_subnetwork_config_ip_stack: Default::default(),
4414 _auto_subnetwork_config_alloc_range_space: Default::default(),
4415 _delegate: Default::default(),
4416 _additional_params: Default::default(),
4417 _scopes: Default::default(),
4418 }
4419 }
4420
4421 /// Create a builder to help you perform the following task:
4422 ///
4423 /// Deletes a single ServiceConnectionPolicy.
4424 ///
4425 /// # Arguments
4426 ///
4427 /// * `name` - Required. The name of the ServiceConnectionPolicy to delete.
4428 pub fn locations_service_connection_policies_delete(
4429 &self,
4430 name: &str,
4431 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C> {
4432 ProjectLocationServiceConnectionPolicyDeleteCall {
4433 hub: self.hub,
4434 _name: name.to_string(),
4435 _request_id: Default::default(),
4436 _etag: Default::default(),
4437 _delegate: Default::default(),
4438 _additional_params: Default::default(),
4439 _scopes: Default::default(),
4440 }
4441 }
4442
4443 /// Create a builder to help you perform the following task:
4444 ///
4445 /// Gets details of a single ServiceConnectionPolicy.
4446 ///
4447 /// # Arguments
4448 ///
4449 /// * `name` - Required. Name of the ServiceConnectionPolicy to get.
4450 pub fn locations_service_connection_policies_get(
4451 &self,
4452 name: &str,
4453 ) -> ProjectLocationServiceConnectionPolicyGetCall<'a, C> {
4454 ProjectLocationServiceConnectionPolicyGetCall {
4455 hub: self.hub,
4456 _name: name.to_string(),
4457 _delegate: Default::default(),
4458 _additional_params: Default::default(),
4459 _scopes: Default::default(),
4460 }
4461 }
4462
4463 /// Create a builder to help you perform the following task:
4464 ///
4465 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4466 ///
4467 /// # Arguments
4468 ///
4469 /// * `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.
4470 pub fn locations_service_connection_policies_get_iam_policy(
4471 &self,
4472 resource: &str,
4473 ) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C> {
4474 ProjectLocationServiceConnectionPolicyGetIamPolicyCall {
4475 hub: self.hub,
4476 _resource: resource.to_string(),
4477 _options_requested_policy_version: Default::default(),
4478 _delegate: Default::default(),
4479 _additional_params: Default::default(),
4480 _scopes: Default::default(),
4481 }
4482 }
4483
4484 /// Create a builder to help you perform the following task:
4485 ///
4486 /// Lists ServiceConnectionPolicies in a given project and location.
4487 ///
4488 /// # Arguments
4489 ///
4490 /// * `parent` - Required. The parent resource's name. ex. projects/123/locations/us-east1
4491 pub fn locations_service_connection_policies_list(
4492 &self,
4493 parent: &str,
4494 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
4495 ProjectLocationServiceConnectionPolicyListCall {
4496 hub: self.hub,
4497 _parent: parent.to_string(),
4498 _page_token: Default::default(),
4499 _page_size: Default::default(),
4500 _order_by: Default::default(),
4501 _filter: Default::default(),
4502 _delegate: Default::default(),
4503 _additional_params: Default::default(),
4504 _scopes: Default::default(),
4505 }
4506 }
4507
4508 /// Create a builder to help you perform the following task:
4509 ///
4510 /// Updates the parameters of a single ServiceConnectionPolicy.
4511 ///
4512 /// # Arguments
4513 ///
4514 /// * `request` - No description provided.
4515 /// * `name` - Immutable. The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
4516 pub fn locations_service_connection_policies_patch(
4517 &self,
4518 request: ServiceConnectionPolicy,
4519 name: &str,
4520 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {
4521 ProjectLocationServiceConnectionPolicyPatchCall {
4522 hub: self.hub,
4523 _request: request,
4524 _name: name.to_string(),
4525 _update_mask: Default::default(),
4526 _request_id: Default::default(),
4527 _delegate: Default::default(),
4528 _additional_params: Default::default(),
4529 _scopes: Default::default(),
4530 }
4531 }
4532
4533 /// Create a builder to help you perform the following task:
4534 ///
4535 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4536 ///
4537 /// # Arguments
4538 ///
4539 /// * `request` - No description provided.
4540 /// * `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.
4541 pub fn locations_service_connection_policies_set_iam_policy(
4542 &self,
4543 request: SetIamPolicyRequest,
4544 resource: &str,
4545 ) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C> {
4546 ProjectLocationServiceConnectionPolicySetIamPolicyCall {
4547 hub: self.hub,
4548 _request: request,
4549 _resource: resource.to_string(),
4550 _delegate: Default::default(),
4551 _additional_params: Default::default(),
4552 _scopes: Default::default(),
4553 }
4554 }
4555
4556 /// Create a builder to help you perform the following task:
4557 ///
4558 /// 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.
4559 ///
4560 /// # Arguments
4561 ///
4562 /// * `request` - No description provided.
4563 /// * `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.
4564 pub fn locations_service_connection_policies_test_iam_permissions(
4565 &self,
4566 request: TestIamPermissionsRequest,
4567 resource: &str,
4568 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C> {
4569 ProjectLocationServiceConnectionPolicyTestIamPermissionCall {
4570 hub: self.hub,
4571 _request: request,
4572 _resource: resource.to_string(),
4573 _delegate: Default::default(),
4574 _additional_params: Default::default(),
4575 _scopes: Default::default(),
4576 }
4577 }
4578
4579 /// Create a builder to help you perform the following task:
4580 ///
4581 /// Creates a new ServiceConnectionToken in a given project and location.
4582 ///
4583 /// # Arguments
4584 ///
4585 /// * `request` - No description provided.
4586 /// * `parent` - Required. The parent resource's name of the ServiceConnectionToken. ex. projects/123/locations/us-east1
4587 pub fn locations_service_connection_tokens_create(
4588 &self,
4589 request: ServiceConnectionToken,
4590 parent: &str,
4591 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C> {
4592 ProjectLocationServiceConnectionTokenCreateCall {
4593 hub: self.hub,
4594 _request: request,
4595 _parent: parent.to_string(),
4596 _service_connection_token_id: Default::default(),
4597 _request_id: Default::default(),
4598 _delegate: Default::default(),
4599 _additional_params: Default::default(),
4600 _scopes: Default::default(),
4601 }
4602 }
4603
4604 /// Create a builder to help you perform the following task:
4605 ///
4606 /// Deletes a single ServiceConnectionToken.
4607 ///
4608 /// # Arguments
4609 ///
4610 /// * `name` - Required. The name of the ServiceConnectionToken to delete.
4611 pub fn locations_service_connection_tokens_delete(
4612 &self,
4613 name: &str,
4614 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C> {
4615 ProjectLocationServiceConnectionTokenDeleteCall {
4616 hub: self.hub,
4617 _name: name.to_string(),
4618 _request_id: Default::default(),
4619 _etag: Default::default(),
4620 _delegate: Default::default(),
4621 _additional_params: Default::default(),
4622 _scopes: Default::default(),
4623 }
4624 }
4625
4626 /// Create a builder to help you perform the following task:
4627 ///
4628 /// Gets details of a single ServiceConnectionToken.
4629 ///
4630 /// # Arguments
4631 ///
4632 /// * `name` - Required. Name of the ServiceConnectionToken to get.
4633 pub fn locations_service_connection_tokens_get(
4634 &self,
4635 name: &str,
4636 ) -> ProjectLocationServiceConnectionTokenGetCall<'a, C> {
4637 ProjectLocationServiceConnectionTokenGetCall {
4638 hub: self.hub,
4639 _name: name.to_string(),
4640 _delegate: Default::default(),
4641 _additional_params: Default::default(),
4642 _scopes: Default::default(),
4643 }
4644 }
4645
4646 /// Create a builder to help you perform the following task:
4647 ///
4648 /// Lists ServiceConnectionTokens in a given project and location.
4649 ///
4650 /// # Arguments
4651 ///
4652 /// * `parent` - Required. The parent resource's name. ex. projects/123/locations/us-east1
4653 pub fn locations_service_connection_tokens_list(
4654 &self,
4655 parent: &str,
4656 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
4657 ProjectLocationServiceConnectionTokenListCall {
4658 hub: self.hub,
4659 _parent: parent.to_string(),
4660 _page_token: Default::default(),
4661 _page_size: Default::default(),
4662 _order_by: Default::default(),
4663 _filter: Default::default(),
4664 _delegate: Default::default(),
4665 _additional_params: Default::default(),
4666 _scopes: Default::default(),
4667 }
4668 }
4669
4670 /// Create a builder to help you perform the following task:
4671 ///
4672 /// Creates a Network Connectivity Center spoke.
4673 ///
4674 /// # Arguments
4675 ///
4676 /// * `request` - No description provided.
4677 /// * `parent` - Required. The parent resource.
4678 pub fn locations_spokes_create(
4679 &self,
4680 request: Spoke,
4681 parent: &str,
4682 ) -> ProjectLocationSpokeCreateCall<'a, C> {
4683 ProjectLocationSpokeCreateCall {
4684 hub: self.hub,
4685 _request: request,
4686 _parent: parent.to_string(),
4687 _spoke_id: Default::default(),
4688 _request_id: Default::default(),
4689 _delegate: Default::default(),
4690 _additional_params: Default::default(),
4691 _scopes: Default::default(),
4692 }
4693 }
4694
4695 /// Create a builder to help you perform the following task:
4696 ///
4697 /// Deletes a Network Connectivity Center spoke.
4698 ///
4699 /// # Arguments
4700 ///
4701 /// * `name` - Required. The name of the spoke to delete.
4702 pub fn locations_spokes_delete(&self, name: &str) -> ProjectLocationSpokeDeleteCall<'a, C> {
4703 ProjectLocationSpokeDeleteCall {
4704 hub: self.hub,
4705 _name: name.to_string(),
4706 _request_id: Default::default(),
4707 _delegate: Default::default(),
4708 _additional_params: Default::default(),
4709 _scopes: Default::default(),
4710 }
4711 }
4712
4713 /// Create a builder to help you perform the following task:
4714 ///
4715 /// Gets details about a Network Connectivity Center spoke.
4716 ///
4717 /// # Arguments
4718 ///
4719 /// * `name` - Required. The name of the spoke resource.
4720 pub fn locations_spokes_get(&self, name: &str) -> ProjectLocationSpokeGetCall<'a, C> {
4721 ProjectLocationSpokeGetCall {
4722 hub: self.hub,
4723 _name: name.to_string(),
4724 _delegate: Default::default(),
4725 _additional_params: Default::default(),
4726 _scopes: Default::default(),
4727 }
4728 }
4729
4730 /// Create a builder to help you perform the following task:
4731 ///
4732 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4733 ///
4734 /// # Arguments
4735 ///
4736 /// * `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.
4737 pub fn locations_spokes_get_iam_policy(
4738 &self,
4739 resource: &str,
4740 ) -> ProjectLocationSpokeGetIamPolicyCall<'a, C> {
4741 ProjectLocationSpokeGetIamPolicyCall {
4742 hub: self.hub,
4743 _resource: resource.to_string(),
4744 _options_requested_policy_version: Default::default(),
4745 _delegate: Default::default(),
4746 _additional_params: Default::default(),
4747 _scopes: Default::default(),
4748 }
4749 }
4750
4751 /// Create a builder to help you perform the following task:
4752 ///
4753 /// Lists the Network Connectivity Center spokes in a specified project and location.
4754 ///
4755 /// # Arguments
4756 ///
4757 /// * `parent` - Required. The parent resource.
4758 pub fn locations_spokes_list(&self, parent: &str) -> ProjectLocationSpokeListCall<'a, C> {
4759 ProjectLocationSpokeListCall {
4760 hub: self.hub,
4761 _parent: parent.to_string(),
4762 _page_token: Default::default(),
4763 _page_size: Default::default(),
4764 _order_by: Default::default(),
4765 _filter: Default::default(),
4766 _delegate: Default::default(),
4767 _additional_params: Default::default(),
4768 _scopes: Default::default(),
4769 }
4770 }
4771
4772 /// Create a builder to help you perform the following task:
4773 ///
4774 /// Updates the parameters of a Network Connectivity Center spoke.
4775 ///
4776 /// # Arguments
4777 ///
4778 /// * `request` - No description provided.
4779 /// * `name` - Immutable. The name of the spoke. Spoke names must be unique. They use the following form: `projects/{project_number}/locations/{region}/spokes/{spoke_id}`
4780 pub fn locations_spokes_patch(
4781 &self,
4782 request: Spoke,
4783 name: &str,
4784 ) -> ProjectLocationSpokePatchCall<'a, C> {
4785 ProjectLocationSpokePatchCall {
4786 hub: self.hub,
4787 _request: request,
4788 _name: name.to_string(),
4789 _update_mask: Default::default(),
4790 _request_id: Default::default(),
4791 _delegate: Default::default(),
4792 _additional_params: Default::default(),
4793 _scopes: Default::default(),
4794 }
4795 }
4796
4797 /// Create a builder to help you perform the following task:
4798 ///
4799 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4800 ///
4801 /// # Arguments
4802 ///
4803 /// * `request` - No description provided.
4804 /// * `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.
4805 pub fn locations_spokes_set_iam_policy(
4806 &self,
4807 request: SetIamPolicyRequest,
4808 resource: &str,
4809 ) -> ProjectLocationSpokeSetIamPolicyCall<'a, C> {
4810 ProjectLocationSpokeSetIamPolicyCall {
4811 hub: self.hub,
4812 _request: request,
4813 _resource: resource.to_string(),
4814 _delegate: Default::default(),
4815 _additional_params: Default::default(),
4816 _scopes: Default::default(),
4817 }
4818 }
4819
4820 /// Create a builder to help you perform the following task:
4821 ///
4822 /// 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.
4823 ///
4824 /// # Arguments
4825 ///
4826 /// * `request` - No description provided.
4827 /// * `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.
4828 pub fn locations_spokes_test_iam_permissions(
4829 &self,
4830 request: TestIamPermissionsRequest,
4831 resource: &str,
4832 ) -> ProjectLocationSpokeTestIamPermissionCall<'a, C> {
4833 ProjectLocationSpokeTestIamPermissionCall {
4834 hub: self.hub,
4835 _request: request,
4836 _resource: resource.to_string(),
4837 _delegate: Default::default(),
4838 _additional_params: Default::default(),
4839 _scopes: Default::default(),
4840 }
4841 }
4842
4843 /// Create a builder to help you perform the following task:
4844 ///
4845 /// CheckConsumerConfig validates the consumer network and project for potential PSC connection creation. This method performs several checks, including: - Validating the existence and permissions of the service class. - Ensuring the consumer network exists and is accessible. - Verifying XPN relationships if applicable. - Checking for compatible IP versions between the consumer network and the requested version. This method performs a dynamic IAM check for the `networkconnectivity.serviceClasses.use` permission on the service class resource in the Prepare phase.
4846 ///
4847 /// # Arguments
4848 ///
4849 /// * `request` - No description provided.
4850 /// * `location` - Required. The location resource path. Example: - projects/{project}/locations/{location}
4851 pub fn locations_check_consumer_config(
4852 &self,
4853 request: CheckConsumerConfigRequest,
4854 location: &str,
4855 ) -> ProjectLocationCheckConsumerConfigCall<'a, C> {
4856 ProjectLocationCheckConsumerConfigCall {
4857 hub: self.hub,
4858 _request: request,
4859 _location: location.to_string(),
4860 _delegate: Default::default(),
4861 _additional_params: Default::default(),
4862 _scopes: Default::default(),
4863 }
4864 }
4865
4866 /// Create a builder to help you perform the following task:
4867 ///
4868 /// Gets information about a location.
4869 ///
4870 /// # Arguments
4871 ///
4872 /// * `name` - Resource name for the location.
4873 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
4874 ProjectLocationGetCall {
4875 hub: self.hub,
4876 _name: name.to_string(),
4877 _delegate: Default::default(),
4878 _additional_params: Default::default(),
4879 _scopes: Default::default(),
4880 }
4881 }
4882
4883 /// Create a builder to help you perform the following task:
4884 ///
4885 /// Lists information about the supported locations for this service.
4886 ///
4887 /// # Arguments
4888 ///
4889 /// * `name` - The resource that owns the locations collection, if applicable.
4890 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
4891 ProjectLocationListCall {
4892 hub: self.hub,
4893 _name: name.to_string(),
4894 _page_token: Default::default(),
4895 _page_size: Default::default(),
4896 _filter: Default::default(),
4897 _extra_location_types: Default::default(),
4898 _delegate: Default::default(),
4899 _additional_params: Default::default(),
4900 _scopes: Default::default(),
4901 }
4902 }
4903}
4904
4905// ###################
4906// CallBuilders ###
4907// #################
4908
4909/// Gets details about a Network Connectivity Center group.
4910///
4911/// A builder for the *locations.global.hubs.groups.get* method supported by a *project* resource.
4912/// It is not used directly, but through a [`ProjectMethods`] instance.
4913///
4914/// # Example
4915///
4916/// Instantiate a resource method builder
4917///
4918/// ```test_harness,no_run
4919/// # extern crate hyper;
4920/// # extern crate hyper_rustls;
4921/// # extern crate google_networkconnectivity1 as networkconnectivity1;
4922/// # async fn dox() {
4923/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4924///
4925/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4926/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4927/// # .with_native_roots()
4928/// # .unwrap()
4929/// # .https_only()
4930/// # .enable_http2()
4931/// # .build();
4932///
4933/// # let executor = hyper_util::rt::TokioExecutor::new();
4934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4935/// # secret,
4936/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4937/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4938/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4939/// # ),
4940/// # ).build().await.unwrap();
4941///
4942/// # let client = hyper_util::client::legacy::Client::builder(
4943/// # hyper_util::rt::TokioExecutor::new()
4944/// # )
4945/// # .build(
4946/// # hyper_rustls::HttpsConnectorBuilder::new()
4947/// # .with_native_roots()
4948/// # .unwrap()
4949/// # .https_or_http()
4950/// # .enable_http2()
4951/// # .build()
4952/// # );
4953/// # let mut hub = Networkconnectivity::new(client, auth);
4954/// // You can configure optional parameters by calling the respective setters at will, and
4955/// // execute the final call using `doit()`.
4956/// // Values shown here are possibly random and not representative !
4957/// let result = hub.projects().locations_global_hubs_groups_get("name")
4958/// .doit().await;
4959/// # }
4960/// ```
4961pub struct ProjectLocationGlobalHubGroupGetCall<'a, C>
4962where
4963 C: 'a,
4964{
4965 hub: &'a Networkconnectivity<C>,
4966 _name: String,
4967 _delegate: Option<&'a mut dyn common::Delegate>,
4968 _additional_params: HashMap<String, String>,
4969 _scopes: BTreeSet<String>,
4970}
4971
4972impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGroupGetCall<'a, C> {}
4973
4974impl<'a, C> ProjectLocationGlobalHubGroupGetCall<'a, C>
4975where
4976 C: common::Connector,
4977{
4978 /// Perform the operation you have build so far.
4979 pub async fn doit(mut self) -> common::Result<(common::Response, Group)> {
4980 use std::borrow::Cow;
4981 use std::io::{Read, Seek};
4982
4983 use common::{url::Params, ToParts};
4984 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4985
4986 let mut dd = common::DefaultDelegate;
4987 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4988 dlg.begin(common::MethodInfo {
4989 id: "networkconnectivity.projects.locations.global.hubs.groups.get",
4990 http_method: hyper::Method::GET,
4991 });
4992
4993 for &field in ["alt", "name"].iter() {
4994 if self._additional_params.contains_key(field) {
4995 dlg.finished(false);
4996 return Err(common::Error::FieldClash(field));
4997 }
4998 }
4999
5000 let mut params = Params::with_capacity(3 + self._additional_params.len());
5001 params.push("name", self._name);
5002
5003 params.extend(self._additional_params.iter());
5004
5005 params.push("alt", "json");
5006 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5007 if self._scopes.is_empty() {
5008 self._scopes
5009 .insert(Scope::CloudPlatform.as_ref().to_string());
5010 }
5011
5012 #[allow(clippy::single_element_loop)]
5013 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5014 url = params.uri_replacement(url, param_name, find_this, true);
5015 }
5016 {
5017 let to_remove = ["name"];
5018 params.remove_params(&to_remove);
5019 }
5020
5021 let url = params.parse_with_url(&url);
5022
5023 loop {
5024 let token = match self
5025 .hub
5026 .auth
5027 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5028 .await
5029 {
5030 Ok(token) => token,
5031 Err(e) => match dlg.token(e) {
5032 Ok(token) => token,
5033 Err(e) => {
5034 dlg.finished(false);
5035 return Err(common::Error::MissingToken(e));
5036 }
5037 },
5038 };
5039 let mut req_result = {
5040 let client = &self.hub.client;
5041 dlg.pre_request();
5042 let mut req_builder = hyper::Request::builder()
5043 .method(hyper::Method::GET)
5044 .uri(url.as_str())
5045 .header(USER_AGENT, self.hub._user_agent.clone());
5046
5047 if let Some(token) = token.as_ref() {
5048 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5049 }
5050
5051 let request = req_builder
5052 .header(CONTENT_LENGTH, 0_u64)
5053 .body(common::to_body::<String>(None));
5054
5055 client.request(request.unwrap()).await
5056 };
5057
5058 match req_result {
5059 Err(err) => {
5060 if let common::Retry::After(d) = dlg.http_error(&err) {
5061 sleep(d).await;
5062 continue;
5063 }
5064 dlg.finished(false);
5065 return Err(common::Error::HttpError(err));
5066 }
5067 Ok(res) => {
5068 let (mut parts, body) = res.into_parts();
5069 let mut body = common::Body::new(body);
5070 if !parts.status.is_success() {
5071 let bytes = common::to_bytes(body).await.unwrap_or_default();
5072 let error = serde_json::from_str(&common::to_string(&bytes));
5073 let response = common::to_response(parts, bytes.into());
5074
5075 if let common::Retry::After(d) =
5076 dlg.http_failure(&response, error.as_ref().ok())
5077 {
5078 sleep(d).await;
5079 continue;
5080 }
5081
5082 dlg.finished(false);
5083
5084 return Err(match error {
5085 Ok(value) => common::Error::BadRequest(value),
5086 _ => common::Error::Failure(response),
5087 });
5088 }
5089 let response = {
5090 let bytes = common::to_bytes(body).await.unwrap_or_default();
5091 let encoded = common::to_string(&bytes);
5092 match serde_json::from_str(&encoded) {
5093 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5094 Err(error) => {
5095 dlg.response_json_decode_error(&encoded, &error);
5096 return Err(common::Error::JsonDecodeError(
5097 encoded.to_string(),
5098 error,
5099 ));
5100 }
5101 }
5102 };
5103
5104 dlg.finished(true);
5105 return Ok(response);
5106 }
5107 }
5108 }
5109 }
5110
5111 /// Required. The name of the route table resource.
5112 ///
5113 /// Sets the *name* path property to the given value.
5114 ///
5115 /// Even though the property as already been set when instantiating this call,
5116 /// we provide this method for API completeness.
5117 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubGroupGetCall<'a, C> {
5118 self._name = new_value.to_string();
5119 self
5120 }
5121 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5122 /// while executing the actual API request.
5123 ///
5124 /// ````text
5125 /// It should be used to handle progress information, and to implement a certain level of resilience.
5126 /// ````
5127 ///
5128 /// Sets the *delegate* property to the given value.
5129 pub fn delegate(
5130 mut self,
5131 new_value: &'a mut dyn common::Delegate,
5132 ) -> ProjectLocationGlobalHubGroupGetCall<'a, C> {
5133 self._delegate = Some(new_value);
5134 self
5135 }
5136
5137 /// Set any additional parameter of the query string used in the request.
5138 /// It should be used to set parameters which are not yet available through their own
5139 /// setters.
5140 ///
5141 /// Please note that this method must not be used to set any of the known parameters
5142 /// which have their own setter method. If done anyway, the request will fail.
5143 ///
5144 /// # Additional Parameters
5145 ///
5146 /// * *$.xgafv* (query-string) - V1 error format.
5147 /// * *access_token* (query-string) - OAuth access token.
5148 /// * *alt* (query-string) - Data format for response.
5149 /// * *callback* (query-string) - JSONP
5150 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5151 /// * *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.
5152 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5153 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5154 /// * *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.
5155 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5156 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5157 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubGroupGetCall<'a, C>
5158 where
5159 T: AsRef<str>,
5160 {
5161 self._additional_params
5162 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5163 self
5164 }
5165
5166 /// Identifies the authorization scope for the method you are building.
5167 ///
5168 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5169 /// [`Scope::CloudPlatform`].
5170 ///
5171 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5172 /// tokens for more than one scope.
5173 ///
5174 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5175 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5176 /// sufficient, a read-write scope will do as well.
5177 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubGroupGetCall<'a, C>
5178 where
5179 St: AsRef<str>,
5180 {
5181 self._scopes.insert(String::from(scope.as_ref()));
5182 self
5183 }
5184 /// Identifies the authorization scope(s) for the method you are building.
5185 ///
5186 /// See [`Self::add_scope()`] for details.
5187 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubGroupGetCall<'a, C>
5188 where
5189 I: IntoIterator<Item = St>,
5190 St: AsRef<str>,
5191 {
5192 self._scopes
5193 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5194 self
5195 }
5196
5197 /// Removes all scopes, and no default scope will be used either.
5198 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5199 /// for details).
5200 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGroupGetCall<'a, C> {
5201 self._scopes.clear();
5202 self
5203 }
5204}
5205
5206/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5207///
5208/// A builder for the *locations.global.hubs.groups.getIamPolicy* method supported by a *project* resource.
5209/// It is not used directly, but through a [`ProjectMethods`] instance.
5210///
5211/// # Example
5212///
5213/// Instantiate a resource method builder
5214///
5215/// ```test_harness,no_run
5216/// # extern crate hyper;
5217/// # extern crate hyper_rustls;
5218/// # extern crate google_networkconnectivity1 as networkconnectivity1;
5219/// # async fn dox() {
5220/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5221///
5222/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5223/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5224/// # .with_native_roots()
5225/// # .unwrap()
5226/// # .https_only()
5227/// # .enable_http2()
5228/// # .build();
5229///
5230/// # let executor = hyper_util::rt::TokioExecutor::new();
5231/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5232/// # secret,
5233/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5234/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5235/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5236/// # ),
5237/// # ).build().await.unwrap();
5238///
5239/// # let client = hyper_util::client::legacy::Client::builder(
5240/// # hyper_util::rt::TokioExecutor::new()
5241/// # )
5242/// # .build(
5243/// # hyper_rustls::HttpsConnectorBuilder::new()
5244/// # .with_native_roots()
5245/// # .unwrap()
5246/// # .https_or_http()
5247/// # .enable_http2()
5248/// # .build()
5249/// # );
5250/// # let mut hub = Networkconnectivity::new(client, auth);
5251/// // You can configure optional parameters by calling the respective setters at will, and
5252/// // execute the final call using `doit()`.
5253/// // Values shown here are possibly random and not representative !
5254/// let result = hub.projects().locations_global_hubs_groups_get_iam_policy("resource")
5255/// .options_requested_policy_version(-50)
5256/// .doit().await;
5257/// # }
5258/// ```
5259pub struct ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C>
5260where
5261 C: 'a,
5262{
5263 hub: &'a Networkconnectivity<C>,
5264 _resource: String,
5265 _options_requested_policy_version: Option<i32>,
5266 _delegate: Option<&'a mut dyn common::Delegate>,
5267 _additional_params: HashMap<String, String>,
5268 _scopes: BTreeSet<String>,
5269}
5270
5271impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C> {}
5272
5273impl<'a, C> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C>
5274where
5275 C: common::Connector,
5276{
5277 /// Perform the operation you have build so far.
5278 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5279 use std::borrow::Cow;
5280 use std::io::{Read, Seek};
5281
5282 use common::{url::Params, ToParts};
5283 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5284
5285 let mut dd = common::DefaultDelegate;
5286 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5287 dlg.begin(common::MethodInfo {
5288 id: "networkconnectivity.projects.locations.global.hubs.groups.getIamPolicy",
5289 http_method: hyper::Method::GET,
5290 });
5291
5292 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
5293 if self._additional_params.contains_key(field) {
5294 dlg.finished(false);
5295 return Err(common::Error::FieldClash(field));
5296 }
5297 }
5298
5299 let mut params = Params::with_capacity(4 + self._additional_params.len());
5300 params.push("resource", self._resource);
5301 if let Some(value) = self._options_requested_policy_version.as_ref() {
5302 params.push("options.requestedPolicyVersion", value.to_string());
5303 }
5304
5305 params.extend(self._additional_params.iter());
5306
5307 params.push("alt", "json");
5308 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
5309 if self._scopes.is_empty() {
5310 self._scopes
5311 .insert(Scope::CloudPlatform.as_ref().to_string());
5312 }
5313
5314 #[allow(clippy::single_element_loop)]
5315 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5316 url = params.uri_replacement(url, param_name, find_this, true);
5317 }
5318 {
5319 let to_remove = ["resource"];
5320 params.remove_params(&to_remove);
5321 }
5322
5323 let url = params.parse_with_url(&url);
5324
5325 loop {
5326 let token = match self
5327 .hub
5328 .auth
5329 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5330 .await
5331 {
5332 Ok(token) => token,
5333 Err(e) => match dlg.token(e) {
5334 Ok(token) => token,
5335 Err(e) => {
5336 dlg.finished(false);
5337 return Err(common::Error::MissingToken(e));
5338 }
5339 },
5340 };
5341 let mut req_result = {
5342 let client = &self.hub.client;
5343 dlg.pre_request();
5344 let mut req_builder = hyper::Request::builder()
5345 .method(hyper::Method::GET)
5346 .uri(url.as_str())
5347 .header(USER_AGENT, self.hub._user_agent.clone());
5348
5349 if let Some(token) = token.as_ref() {
5350 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5351 }
5352
5353 let request = req_builder
5354 .header(CONTENT_LENGTH, 0_u64)
5355 .body(common::to_body::<String>(None));
5356
5357 client.request(request.unwrap()).await
5358 };
5359
5360 match req_result {
5361 Err(err) => {
5362 if let common::Retry::After(d) = dlg.http_error(&err) {
5363 sleep(d).await;
5364 continue;
5365 }
5366 dlg.finished(false);
5367 return Err(common::Error::HttpError(err));
5368 }
5369 Ok(res) => {
5370 let (mut parts, body) = res.into_parts();
5371 let mut body = common::Body::new(body);
5372 if !parts.status.is_success() {
5373 let bytes = common::to_bytes(body).await.unwrap_or_default();
5374 let error = serde_json::from_str(&common::to_string(&bytes));
5375 let response = common::to_response(parts, bytes.into());
5376
5377 if let common::Retry::After(d) =
5378 dlg.http_failure(&response, error.as_ref().ok())
5379 {
5380 sleep(d).await;
5381 continue;
5382 }
5383
5384 dlg.finished(false);
5385
5386 return Err(match error {
5387 Ok(value) => common::Error::BadRequest(value),
5388 _ => common::Error::Failure(response),
5389 });
5390 }
5391 let response = {
5392 let bytes = common::to_bytes(body).await.unwrap_or_default();
5393 let encoded = common::to_string(&bytes);
5394 match serde_json::from_str(&encoded) {
5395 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5396 Err(error) => {
5397 dlg.response_json_decode_error(&encoded, &error);
5398 return Err(common::Error::JsonDecodeError(
5399 encoded.to_string(),
5400 error,
5401 ));
5402 }
5403 }
5404 };
5405
5406 dlg.finished(true);
5407 return Ok(response);
5408 }
5409 }
5410 }
5411 }
5412
5413 /// 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.
5414 ///
5415 /// Sets the *resource* path property to the given value.
5416 ///
5417 /// Even though the property as already been set when instantiating this call,
5418 /// we provide this method for API completeness.
5419 pub fn resource(
5420 mut self,
5421 new_value: &str,
5422 ) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C> {
5423 self._resource = new_value.to_string();
5424 self
5425 }
5426 /// 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).
5427 ///
5428 /// Sets the *options.requested policy version* query property to the given value.
5429 pub fn options_requested_policy_version(
5430 mut self,
5431 new_value: i32,
5432 ) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C> {
5433 self._options_requested_policy_version = Some(new_value);
5434 self
5435 }
5436 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5437 /// while executing the actual API request.
5438 ///
5439 /// ````text
5440 /// It should be used to handle progress information, and to implement a certain level of resilience.
5441 /// ````
5442 ///
5443 /// Sets the *delegate* property to the given value.
5444 pub fn delegate(
5445 mut self,
5446 new_value: &'a mut dyn common::Delegate,
5447 ) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C> {
5448 self._delegate = Some(new_value);
5449 self
5450 }
5451
5452 /// Set any additional parameter of the query string used in the request.
5453 /// It should be used to set parameters which are not yet available through their own
5454 /// setters.
5455 ///
5456 /// Please note that this method must not be used to set any of the known parameters
5457 /// which have their own setter method. If done anyway, the request will fail.
5458 ///
5459 /// # Additional Parameters
5460 ///
5461 /// * *$.xgafv* (query-string) - V1 error format.
5462 /// * *access_token* (query-string) - OAuth access token.
5463 /// * *alt* (query-string) - Data format for response.
5464 /// * *callback* (query-string) - JSONP
5465 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5466 /// * *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.
5467 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5468 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5469 /// * *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.
5470 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5471 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5472 pub fn param<T>(
5473 mut self,
5474 name: T,
5475 value: T,
5476 ) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C>
5477 where
5478 T: AsRef<str>,
5479 {
5480 self._additional_params
5481 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5482 self
5483 }
5484
5485 /// Identifies the authorization scope for the method you are building.
5486 ///
5487 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5488 /// [`Scope::CloudPlatform`].
5489 ///
5490 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5491 /// tokens for more than one scope.
5492 ///
5493 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5494 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5495 /// sufficient, a read-write scope will do as well.
5496 pub fn add_scope<St>(
5497 mut self,
5498 scope: St,
5499 ) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C>
5500 where
5501 St: AsRef<str>,
5502 {
5503 self._scopes.insert(String::from(scope.as_ref()));
5504 self
5505 }
5506 /// Identifies the authorization scope(s) for the method you are building.
5507 ///
5508 /// See [`Self::add_scope()`] for details.
5509 pub fn add_scopes<I, St>(
5510 mut self,
5511 scopes: I,
5512 ) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C>
5513 where
5514 I: IntoIterator<Item = St>,
5515 St: AsRef<str>,
5516 {
5517 self._scopes
5518 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5519 self
5520 }
5521
5522 /// Removes all scopes, and no default scope will be used either.
5523 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5524 /// for details).
5525 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGroupGetIamPolicyCall<'a, C> {
5526 self._scopes.clear();
5527 self
5528 }
5529}
5530
5531/// Lists groups in a given hub.
5532///
5533/// A builder for the *locations.global.hubs.groups.list* method supported by a *project* resource.
5534/// It is not used directly, but through a [`ProjectMethods`] instance.
5535///
5536/// # Example
5537///
5538/// Instantiate a resource method builder
5539///
5540/// ```test_harness,no_run
5541/// # extern crate hyper;
5542/// # extern crate hyper_rustls;
5543/// # extern crate google_networkconnectivity1 as networkconnectivity1;
5544/// # async fn dox() {
5545/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5546///
5547/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5548/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5549/// # .with_native_roots()
5550/// # .unwrap()
5551/// # .https_only()
5552/// # .enable_http2()
5553/// # .build();
5554///
5555/// # let executor = hyper_util::rt::TokioExecutor::new();
5556/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5557/// # secret,
5558/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5559/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5560/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5561/// # ),
5562/// # ).build().await.unwrap();
5563///
5564/// # let client = hyper_util::client::legacy::Client::builder(
5565/// # hyper_util::rt::TokioExecutor::new()
5566/// # )
5567/// # .build(
5568/// # hyper_rustls::HttpsConnectorBuilder::new()
5569/// # .with_native_roots()
5570/// # .unwrap()
5571/// # .https_or_http()
5572/// # .enable_http2()
5573/// # .build()
5574/// # );
5575/// # let mut hub = Networkconnectivity::new(client, auth);
5576/// // You can configure optional parameters by calling the respective setters at will, and
5577/// // execute the final call using `doit()`.
5578/// // Values shown here are possibly random and not representative !
5579/// let result = hub.projects().locations_global_hubs_groups_list("parent")
5580/// .page_token("ut")
5581/// .page_size(-12)
5582/// .order_by("rebum.")
5583/// .filter("est")
5584/// .doit().await;
5585/// # }
5586/// ```
5587pub struct ProjectLocationGlobalHubGroupListCall<'a, C>
5588where
5589 C: 'a,
5590{
5591 hub: &'a Networkconnectivity<C>,
5592 _parent: String,
5593 _page_token: Option<String>,
5594 _page_size: Option<i32>,
5595 _order_by: Option<String>,
5596 _filter: Option<String>,
5597 _delegate: Option<&'a mut dyn common::Delegate>,
5598 _additional_params: HashMap<String, String>,
5599 _scopes: BTreeSet<String>,
5600}
5601
5602impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGroupListCall<'a, C> {}
5603
5604impl<'a, C> ProjectLocationGlobalHubGroupListCall<'a, C>
5605where
5606 C: common::Connector,
5607{
5608 /// Perform the operation you have build so far.
5609 pub async fn doit(mut self) -> common::Result<(common::Response, ListGroupsResponse)> {
5610 use std::borrow::Cow;
5611 use std::io::{Read, Seek};
5612
5613 use common::{url::Params, ToParts};
5614 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5615
5616 let mut dd = common::DefaultDelegate;
5617 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5618 dlg.begin(common::MethodInfo {
5619 id: "networkconnectivity.projects.locations.global.hubs.groups.list",
5620 http_method: hyper::Method::GET,
5621 });
5622
5623 for &field in [
5624 "alt",
5625 "parent",
5626 "pageToken",
5627 "pageSize",
5628 "orderBy",
5629 "filter",
5630 ]
5631 .iter()
5632 {
5633 if self._additional_params.contains_key(field) {
5634 dlg.finished(false);
5635 return Err(common::Error::FieldClash(field));
5636 }
5637 }
5638
5639 let mut params = Params::with_capacity(7 + self._additional_params.len());
5640 params.push("parent", self._parent);
5641 if let Some(value) = self._page_token.as_ref() {
5642 params.push("pageToken", value);
5643 }
5644 if let Some(value) = self._page_size.as_ref() {
5645 params.push("pageSize", value.to_string());
5646 }
5647 if let Some(value) = self._order_by.as_ref() {
5648 params.push("orderBy", value);
5649 }
5650 if let Some(value) = self._filter.as_ref() {
5651 params.push("filter", value);
5652 }
5653
5654 params.extend(self._additional_params.iter());
5655
5656 params.push("alt", "json");
5657 let mut url = self.hub._base_url.clone() + "v1/{+parent}/groups";
5658 if self._scopes.is_empty() {
5659 self._scopes
5660 .insert(Scope::CloudPlatform.as_ref().to_string());
5661 }
5662
5663 #[allow(clippy::single_element_loop)]
5664 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5665 url = params.uri_replacement(url, param_name, find_this, true);
5666 }
5667 {
5668 let to_remove = ["parent"];
5669 params.remove_params(&to_remove);
5670 }
5671
5672 let url = params.parse_with_url(&url);
5673
5674 loop {
5675 let token = match self
5676 .hub
5677 .auth
5678 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5679 .await
5680 {
5681 Ok(token) => token,
5682 Err(e) => match dlg.token(e) {
5683 Ok(token) => token,
5684 Err(e) => {
5685 dlg.finished(false);
5686 return Err(common::Error::MissingToken(e));
5687 }
5688 },
5689 };
5690 let mut req_result = {
5691 let client = &self.hub.client;
5692 dlg.pre_request();
5693 let mut req_builder = hyper::Request::builder()
5694 .method(hyper::Method::GET)
5695 .uri(url.as_str())
5696 .header(USER_AGENT, self.hub._user_agent.clone());
5697
5698 if let Some(token) = token.as_ref() {
5699 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5700 }
5701
5702 let request = req_builder
5703 .header(CONTENT_LENGTH, 0_u64)
5704 .body(common::to_body::<String>(None));
5705
5706 client.request(request.unwrap()).await
5707 };
5708
5709 match req_result {
5710 Err(err) => {
5711 if let common::Retry::After(d) = dlg.http_error(&err) {
5712 sleep(d).await;
5713 continue;
5714 }
5715 dlg.finished(false);
5716 return Err(common::Error::HttpError(err));
5717 }
5718 Ok(res) => {
5719 let (mut parts, body) = res.into_parts();
5720 let mut body = common::Body::new(body);
5721 if !parts.status.is_success() {
5722 let bytes = common::to_bytes(body).await.unwrap_or_default();
5723 let error = serde_json::from_str(&common::to_string(&bytes));
5724 let response = common::to_response(parts, bytes.into());
5725
5726 if let common::Retry::After(d) =
5727 dlg.http_failure(&response, error.as_ref().ok())
5728 {
5729 sleep(d).await;
5730 continue;
5731 }
5732
5733 dlg.finished(false);
5734
5735 return Err(match error {
5736 Ok(value) => common::Error::BadRequest(value),
5737 _ => common::Error::Failure(response),
5738 });
5739 }
5740 let response = {
5741 let bytes = common::to_bytes(body).await.unwrap_or_default();
5742 let encoded = common::to_string(&bytes);
5743 match serde_json::from_str(&encoded) {
5744 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5745 Err(error) => {
5746 dlg.response_json_decode_error(&encoded, &error);
5747 return Err(common::Error::JsonDecodeError(
5748 encoded.to_string(),
5749 error,
5750 ));
5751 }
5752 }
5753 };
5754
5755 dlg.finished(true);
5756 return Ok(response);
5757 }
5758 }
5759 }
5760 }
5761
5762 /// Required. The parent resource's name.
5763 ///
5764 /// Sets the *parent* path property to the given value.
5765 ///
5766 /// Even though the property as already been set when instantiating this call,
5767 /// we provide this method for API completeness.
5768 pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
5769 self._parent = new_value.to_string();
5770 self
5771 }
5772 /// The page token.
5773 ///
5774 /// Sets the *page token* query property to the given value.
5775 pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
5776 self._page_token = Some(new_value.to_string());
5777 self
5778 }
5779 /// The maximum number of results to return per page.
5780 ///
5781 /// Sets the *page size* query property to the given value.
5782 pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
5783 self._page_size = Some(new_value);
5784 self
5785 }
5786 /// Sort the results by a certain order.
5787 ///
5788 /// Sets the *order by* query property to the given value.
5789 pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
5790 self._order_by = Some(new_value.to_string());
5791 self
5792 }
5793 /// An expression that filters the list of results.
5794 ///
5795 /// Sets the *filter* query property to the given value.
5796 pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
5797 self._filter = Some(new_value.to_string());
5798 self
5799 }
5800 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5801 /// while executing the actual API request.
5802 ///
5803 /// ````text
5804 /// It should be used to handle progress information, and to implement a certain level of resilience.
5805 /// ````
5806 ///
5807 /// Sets the *delegate* property to the given value.
5808 pub fn delegate(
5809 mut self,
5810 new_value: &'a mut dyn common::Delegate,
5811 ) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
5812 self._delegate = Some(new_value);
5813 self
5814 }
5815
5816 /// Set any additional parameter of the query string used in the request.
5817 /// It should be used to set parameters which are not yet available through their own
5818 /// setters.
5819 ///
5820 /// Please note that this method must not be used to set any of the known parameters
5821 /// which have their own setter method. If done anyway, the request will fail.
5822 ///
5823 /// # Additional Parameters
5824 ///
5825 /// * *$.xgafv* (query-string) - V1 error format.
5826 /// * *access_token* (query-string) - OAuth access token.
5827 /// * *alt* (query-string) - Data format for response.
5828 /// * *callback* (query-string) - JSONP
5829 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5830 /// * *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.
5831 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5832 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5833 /// * *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.
5834 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5835 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5836 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubGroupListCall<'a, C>
5837 where
5838 T: AsRef<str>,
5839 {
5840 self._additional_params
5841 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5842 self
5843 }
5844
5845 /// Identifies the authorization scope for the method you are building.
5846 ///
5847 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5848 /// [`Scope::CloudPlatform`].
5849 ///
5850 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5851 /// tokens for more than one scope.
5852 ///
5853 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5854 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5855 /// sufficient, a read-write scope will do as well.
5856 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubGroupListCall<'a, C>
5857 where
5858 St: AsRef<str>,
5859 {
5860 self._scopes.insert(String::from(scope.as_ref()));
5861 self
5862 }
5863 /// Identifies the authorization scope(s) for the method you are building.
5864 ///
5865 /// See [`Self::add_scope()`] for details.
5866 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubGroupListCall<'a, C>
5867 where
5868 I: IntoIterator<Item = St>,
5869 St: AsRef<str>,
5870 {
5871 self._scopes
5872 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5873 self
5874 }
5875
5876 /// Removes all scopes, and no default scope will be used either.
5877 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5878 /// for details).
5879 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGroupListCall<'a, C> {
5880 self._scopes.clear();
5881 self
5882 }
5883}
5884
5885/// Updates the parameters of a Network Connectivity Center group.
5886///
5887/// A builder for the *locations.global.hubs.groups.patch* method supported by a *project* resource.
5888/// It is not used directly, but through a [`ProjectMethods`] instance.
5889///
5890/// # Example
5891///
5892/// Instantiate a resource method builder
5893///
5894/// ```test_harness,no_run
5895/// # extern crate hyper;
5896/// # extern crate hyper_rustls;
5897/// # extern crate google_networkconnectivity1 as networkconnectivity1;
5898/// use networkconnectivity1::api::Group;
5899/// # async fn dox() {
5900/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5901///
5902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5903/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5904/// # .with_native_roots()
5905/// # .unwrap()
5906/// # .https_only()
5907/// # .enable_http2()
5908/// # .build();
5909///
5910/// # let executor = hyper_util::rt::TokioExecutor::new();
5911/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5912/// # secret,
5913/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5914/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5915/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5916/// # ),
5917/// # ).build().await.unwrap();
5918///
5919/// # let client = hyper_util::client::legacy::Client::builder(
5920/// # hyper_util::rt::TokioExecutor::new()
5921/// # )
5922/// # .build(
5923/// # hyper_rustls::HttpsConnectorBuilder::new()
5924/// # .with_native_roots()
5925/// # .unwrap()
5926/// # .https_or_http()
5927/// # .enable_http2()
5928/// # .build()
5929/// # );
5930/// # let mut hub = Networkconnectivity::new(client, auth);
5931/// // As the method needs a request, you would usually fill it with the desired information
5932/// // into the respective structure. Some of the parts shown here might not be applicable !
5933/// // Values shown here are possibly random and not representative !
5934/// let mut req = Group::default();
5935///
5936/// // You can configure optional parameters by calling the respective setters at will, and
5937/// // execute the final call using `doit()`.
5938/// // Values shown here are possibly random and not representative !
5939/// let result = hub.projects().locations_global_hubs_groups_patch(req, "name")
5940/// .update_mask(FieldMask::new::<&str>(&[]))
5941/// .request_id("ipsum")
5942/// .doit().await;
5943/// # }
5944/// ```
5945pub struct ProjectLocationGlobalHubGroupPatchCall<'a, C>
5946where
5947 C: 'a,
5948{
5949 hub: &'a Networkconnectivity<C>,
5950 _request: Group,
5951 _name: String,
5952 _update_mask: Option<common::FieldMask>,
5953 _request_id: Option<String>,
5954 _delegate: Option<&'a mut dyn common::Delegate>,
5955 _additional_params: HashMap<String, String>,
5956 _scopes: BTreeSet<String>,
5957}
5958
5959impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGroupPatchCall<'a, C> {}
5960
5961impl<'a, C> ProjectLocationGlobalHubGroupPatchCall<'a, C>
5962where
5963 C: common::Connector,
5964{
5965 /// Perform the operation you have build so far.
5966 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
5967 use std::borrow::Cow;
5968 use std::io::{Read, Seek};
5969
5970 use common::{url::Params, ToParts};
5971 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5972
5973 let mut dd = common::DefaultDelegate;
5974 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5975 dlg.begin(common::MethodInfo {
5976 id: "networkconnectivity.projects.locations.global.hubs.groups.patch",
5977 http_method: hyper::Method::PATCH,
5978 });
5979
5980 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
5981 if self._additional_params.contains_key(field) {
5982 dlg.finished(false);
5983 return Err(common::Error::FieldClash(field));
5984 }
5985 }
5986
5987 let mut params = Params::with_capacity(6 + self._additional_params.len());
5988 params.push("name", self._name);
5989 if let Some(value) = self._update_mask.as_ref() {
5990 params.push("updateMask", value.to_string());
5991 }
5992 if let Some(value) = self._request_id.as_ref() {
5993 params.push("requestId", value);
5994 }
5995
5996 params.extend(self._additional_params.iter());
5997
5998 params.push("alt", "json");
5999 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6000 if self._scopes.is_empty() {
6001 self._scopes
6002 .insert(Scope::CloudPlatform.as_ref().to_string());
6003 }
6004
6005 #[allow(clippy::single_element_loop)]
6006 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6007 url = params.uri_replacement(url, param_name, find_this, true);
6008 }
6009 {
6010 let to_remove = ["name"];
6011 params.remove_params(&to_remove);
6012 }
6013
6014 let url = params.parse_with_url(&url);
6015
6016 let mut json_mime_type = mime::APPLICATION_JSON;
6017 let mut request_value_reader = {
6018 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6019 common::remove_json_null_values(&mut value);
6020 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6021 serde_json::to_writer(&mut dst, &value).unwrap();
6022 dst
6023 };
6024 let request_size = request_value_reader
6025 .seek(std::io::SeekFrom::End(0))
6026 .unwrap();
6027 request_value_reader
6028 .seek(std::io::SeekFrom::Start(0))
6029 .unwrap();
6030
6031 loop {
6032 let token = match self
6033 .hub
6034 .auth
6035 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6036 .await
6037 {
6038 Ok(token) => token,
6039 Err(e) => match dlg.token(e) {
6040 Ok(token) => token,
6041 Err(e) => {
6042 dlg.finished(false);
6043 return Err(common::Error::MissingToken(e));
6044 }
6045 },
6046 };
6047 request_value_reader
6048 .seek(std::io::SeekFrom::Start(0))
6049 .unwrap();
6050 let mut req_result = {
6051 let client = &self.hub.client;
6052 dlg.pre_request();
6053 let mut req_builder = hyper::Request::builder()
6054 .method(hyper::Method::PATCH)
6055 .uri(url.as_str())
6056 .header(USER_AGENT, self.hub._user_agent.clone());
6057
6058 if let Some(token) = token.as_ref() {
6059 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6060 }
6061
6062 let request = req_builder
6063 .header(CONTENT_TYPE, json_mime_type.to_string())
6064 .header(CONTENT_LENGTH, request_size as u64)
6065 .body(common::to_body(
6066 request_value_reader.get_ref().clone().into(),
6067 ));
6068
6069 client.request(request.unwrap()).await
6070 };
6071
6072 match req_result {
6073 Err(err) => {
6074 if let common::Retry::After(d) = dlg.http_error(&err) {
6075 sleep(d).await;
6076 continue;
6077 }
6078 dlg.finished(false);
6079 return Err(common::Error::HttpError(err));
6080 }
6081 Ok(res) => {
6082 let (mut parts, body) = res.into_parts();
6083 let mut body = common::Body::new(body);
6084 if !parts.status.is_success() {
6085 let bytes = common::to_bytes(body).await.unwrap_or_default();
6086 let error = serde_json::from_str(&common::to_string(&bytes));
6087 let response = common::to_response(parts, bytes.into());
6088
6089 if let common::Retry::After(d) =
6090 dlg.http_failure(&response, error.as_ref().ok())
6091 {
6092 sleep(d).await;
6093 continue;
6094 }
6095
6096 dlg.finished(false);
6097
6098 return Err(match error {
6099 Ok(value) => common::Error::BadRequest(value),
6100 _ => common::Error::Failure(response),
6101 });
6102 }
6103 let response = {
6104 let bytes = common::to_bytes(body).await.unwrap_or_default();
6105 let encoded = common::to_string(&bytes);
6106 match serde_json::from_str(&encoded) {
6107 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6108 Err(error) => {
6109 dlg.response_json_decode_error(&encoded, &error);
6110 return Err(common::Error::JsonDecodeError(
6111 encoded.to_string(),
6112 error,
6113 ));
6114 }
6115 }
6116 };
6117
6118 dlg.finished(true);
6119 return Ok(response);
6120 }
6121 }
6122 }
6123 }
6124
6125 ///
6126 /// Sets the *request* property to the given value.
6127 ///
6128 /// Even though the property as already been set when instantiating this call,
6129 /// we provide this method for API completeness.
6130 pub fn request(mut self, new_value: Group) -> ProjectLocationGlobalHubGroupPatchCall<'a, C> {
6131 self._request = new_value;
6132 self
6133 }
6134 /// Immutable. The name of the group. Group names must be unique. They use the following form: `projects/{project_number}/locations/global/hubs/{hub}/groups/{group_id}`
6135 ///
6136 /// Sets the *name* path property to the given value.
6137 ///
6138 /// Even though the property as already been set when instantiating this call,
6139 /// we provide this method for API completeness.
6140 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubGroupPatchCall<'a, C> {
6141 self._name = new_value.to_string();
6142 self
6143 }
6144 /// Optional. In the case of an update to an existing group, field mask is used to specify the fields to be overwritten. The fields specified in the update_mask are relative to the resource, not the full request. A field is overwritten if it is in the mask. If the user does not provide a mask, then all fields are overwritten.
6145 ///
6146 /// Sets the *update mask* query property to the given value.
6147 pub fn update_mask(
6148 mut self,
6149 new_value: common::FieldMask,
6150 ) -> ProjectLocationGlobalHubGroupPatchCall<'a, C> {
6151 self._update_mask = Some(new_value);
6152 self
6153 }
6154 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
6155 ///
6156 /// Sets the *request id* query property to the given value.
6157 pub fn request_id(mut self, new_value: &str) -> ProjectLocationGlobalHubGroupPatchCall<'a, C> {
6158 self._request_id = Some(new_value.to_string());
6159 self
6160 }
6161 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6162 /// while executing the actual API request.
6163 ///
6164 /// ````text
6165 /// It should be used to handle progress information, and to implement a certain level of resilience.
6166 /// ````
6167 ///
6168 /// Sets the *delegate* property to the given value.
6169 pub fn delegate(
6170 mut self,
6171 new_value: &'a mut dyn common::Delegate,
6172 ) -> ProjectLocationGlobalHubGroupPatchCall<'a, C> {
6173 self._delegate = Some(new_value);
6174 self
6175 }
6176
6177 /// Set any additional parameter of the query string used in the request.
6178 /// It should be used to set parameters which are not yet available through their own
6179 /// setters.
6180 ///
6181 /// Please note that this method must not be used to set any of the known parameters
6182 /// which have their own setter method. If done anyway, the request will fail.
6183 ///
6184 /// # Additional Parameters
6185 ///
6186 /// * *$.xgafv* (query-string) - V1 error format.
6187 /// * *access_token* (query-string) - OAuth access token.
6188 /// * *alt* (query-string) - Data format for response.
6189 /// * *callback* (query-string) - JSONP
6190 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6191 /// * *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.
6192 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6193 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6194 /// * *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.
6195 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6196 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6197 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubGroupPatchCall<'a, C>
6198 where
6199 T: AsRef<str>,
6200 {
6201 self._additional_params
6202 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6203 self
6204 }
6205
6206 /// Identifies the authorization scope for the method you are building.
6207 ///
6208 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6209 /// [`Scope::CloudPlatform`].
6210 ///
6211 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6212 /// tokens for more than one scope.
6213 ///
6214 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6215 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6216 /// sufficient, a read-write scope will do as well.
6217 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubGroupPatchCall<'a, C>
6218 where
6219 St: AsRef<str>,
6220 {
6221 self._scopes.insert(String::from(scope.as_ref()));
6222 self
6223 }
6224 /// Identifies the authorization scope(s) for the method you are building.
6225 ///
6226 /// See [`Self::add_scope()`] for details.
6227 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubGroupPatchCall<'a, C>
6228 where
6229 I: IntoIterator<Item = St>,
6230 St: AsRef<str>,
6231 {
6232 self._scopes
6233 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6234 self
6235 }
6236
6237 /// Removes all scopes, and no default scope will be used either.
6238 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6239 /// for details).
6240 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGroupPatchCall<'a, C> {
6241 self._scopes.clear();
6242 self
6243 }
6244}
6245
6246/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
6247///
6248/// A builder for the *locations.global.hubs.groups.setIamPolicy* method supported by a *project* resource.
6249/// It is not used directly, but through a [`ProjectMethods`] instance.
6250///
6251/// # Example
6252///
6253/// Instantiate a resource method builder
6254///
6255/// ```test_harness,no_run
6256/// # extern crate hyper;
6257/// # extern crate hyper_rustls;
6258/// # extern crate google_networkconnectivity1 as networkconnectivity1;
6259/// use networkconnectivity1::api::SetIamPolicyRequest;
6260/// # async fn dox() {
6261/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6262///
6263/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6264/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6265/// # .with_native_roots()
6266/// # .unwrap()
6267/// # .https_only()
6268/// # .enable_http2()
6269/// # .build();
6270///
6271/// # let executor = hyper_util::rt::TokioExecutor::new();
6272/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6273/// # secret,
6274/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6275/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6276/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6277/// # ),
6278/// # ).build().await.unwrap();
6279///
6280/// # let client = hyper_util::client::legacy::Client::builder(
6281/// # hyper_util::rt::TokioExecutor::new()
6282/// # )
6283/// # .build(
6284/// # hyper_rustls::HttpsConnectorBuilder::new()
6285/// # .with_native_roots()
6286/// # .unwrap()
6287/// # .https_or_http()
6288/// # .enable_http2()
6289/// # .build()
6290/// # );
6291/// # let mut hub = Networkconnectivity::new(client, auth);
6292/// // As the method needs a request, you would usually fill it with the desired information
6293/// // into the respective structure. Some of the parts shown here might not be applicable !
6294/// // Values shown here are possibly random and not representative !
6295/// let mut req = SetIamPolicyRequest::default();
6296///
6297/// // You can configure optional parameters by calling the respective setters at will, and
6298/// // execute the final call using `doit()`.
6299/// // Values shown here are possibly random and not representative !
6300/// let result = hub.projects().locations_global_hubs_groups_set_iam_policy(req, "resource")
6301/// .doit().await;
6302/// # }
6303/// ```
6304pub struct ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C>
6305where
6306 C: 'a,
6307{
6308 hub: &'a Networkconnectivity<C>,
6309 _request: SetIamPolicyRequest,
6310 _resource: String,
6311 _delegate: Option<&'a mut dyn common::Delegate>,
6312 _additional_params: HashMap<String, String>,
6313 _scopes: BTreeSet<String>,
6314}
6315
6316impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C> {}
6317
6318impl<'a, C> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C>
6319where
6320 C: common::Connector,
6321{
6322 /// Perform the operation you have build so far.
6323 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6324 use std::borrow::Cow;
6325 use std::io::{Read, Seek};
6326
6327 use common::{url::Params, ToParts};
6328 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6329
6330 let mut dd = common::DefaultDelegate;
6331 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6332 dlg.begin(common::MethodInfo {
6333 id: "networkconnectivity.projects.locations.global.hubs.groups.setIamPolicy",
6334 http_method: hyper::Method::POST,
6335 });
6336
6337 for &field in ["alt", "resource"].iter() {
6338 if self._additional_params.contains_key(field) {
6339 dlg.finished(false);
6340 return Err(common::Error::FieldClash(field));
6341 }
6342 }
6343
6344 let mut params = Params::with_capacity(4 + self._additional_params.len());
6345 params.push("resource", self._resource);
6346
6347 params.extend(self._additional_params.iter());
6348
6349 params.push("alt", "json");
6350 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
6351 if self._scopes.is_empty() {
6352 self._scopes
6353 .insert(Scope::CloudPlatform.as_ref().to_string());
6354 }
6355
6356 #[allow(clippy::single_element_loop)]
6357 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6358 url = params.uri_replacement(url, param_name, find_this, true);
6359 }
6360 {
6361 let to_remove = ["resource"];
6362 params.remove_params(&to_remove);
6363 }
6364
6365 let url = params.parse_with_url(&url);
6366
6367 let mut json_mime_type = mime::APPLICATION_JSON;
6368 let mut request_value_reader = {
6369 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6370 common::remove_json_null_values(&mut value);
6371 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6372 serde_json::to_writer(&mut dst, &value).unwrap();
6373 dst
6374 };
6375 let request_size = request_value_reader
6376 .seek(std::io::SeekFrom::End(0))
6377 .unwrap();
6378 request_value_reader
6379 .seek(std::io::SeekFrom::Start(0))
6380 .unwrap();
6381
6382 loop {
6383 let token = match self
6384 .hub
6385 .auth
6386 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6387 .await
6388 {
6389 Ok(token) => token,
6390 Err(e) => match dlg.token(e) {
6391 Ok(token) => token,
6392 Err(e) => {
6393 dlg.finished(false);
6394 return Err(common::Error::MissingToken(e));
6395 }
6396 },
6397 };
6398 request_value_reader
6399 .seek(std::io::SeekFrom::Start(0))
6400 .unwrap();
6401 let mut req_result = {
6402 let client = &self.hub.client;
6403 dlg.pre_request();
6404 let mut req_builder = hyper::Request::builder()
6405 .method(hyper::Method::POST)
6406 .uri(url.as_str())
6407 .header(USER_AGENT, self.hub._user_agent.clone());
6408
6409 if let Some(token) = token.as_ref() {
6410 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6411 }
6412
6413 let request = req_builder
6414 .header(CONTENT_TYPE, json_mime_type.to_string())
6415 .header(CONTENT_LENGTH, request_size as u64)
6416 .body(common::to_body(
6417 request_value_reader.get_ref().clone().into(),
6418 ));
6419
6420 client.request(request.unwrap()).await
6421 };
6422
6423 match req_result {
6424 Err(err) => {
6425 if let common::Retry::After(d) = dlg.http_error(&err) {
6426 sleep(d).await;
6427 continue;
6428 }
6429 dlg.finished(false);
6430 return Err(common::Error::HttpError(err));
6431 }
6432 Ok(res) => {
6433 let (mut parts, body) = res.into_parts();
6434 let mut body = common::Body::new(body);
6435 if !parts.status.is_success() {
6436 let bytes = common::to_bytes(body).await.unwrap_or_default();
6437 let error = serde_json::from_str(&common::to_string(&bytes));
6438 let response = common::to_response(parts, bytes.into());
6439
6440 if let common::Retry::After(d) =
6441 dlg.http_failure(&response, error.as_ref().ok())
6442 {
6443 sleep(d).await;
6444 continue;
6445 }
6446
6447 dlg.finished(false);
6448
6449 return Err(match error {
6450 Ok(value) => common::Error::BadRequest(value),
6451 _ => common::Error::Failure(response),
6452 });
6453 }
6454 let response = {
6455 let bytes = common::to_bytes(body).await.unwrap_or_default();
6456 let encoded = common::to_string(&bytes);
6457 match serde_json::from_str(&encoded) {
6458 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6459 Err(error) => {
6460 dlg.response_json_decode_error(&encoded, &error);
6461 return Err(common::Error::JsonDecodeError(
6462 encoded.to_string(),
6463 error,
6464 ));
6465 }
6466 }
6467 };
6468
6469 dlg.finished(true);
6470 return Ok(response);
6471 }
6472 }
6473 }
6474 }
6475
6476 ///
6477 /// Sets the *request* property to the given value.
6478 ///
6479 /// Even though the property as already been set when instantiating this call,
6480 /// we provide this method for API completeness.
6481 pub fn request(
6482 mut self,
6483 new_value: SetIamPolicyRequest,
6484 ) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C> {
6485 self._request = new_value;
6486 self
6487 }
6488 /// 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.
6489 ///
6490 /// Sets the *resource* path property to the given value.
6491 ///
6492 /// Even though the property as already been set when instantiating this call,
6493 /// we provide this method for API completeness.
6494 pub fn resource(
6495 mut self,
6496 new_value: &str,
6497 ) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C> {
6498 self._resource = new_value.to_string();
6499 self
6500 }
6501 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6502 /// while executing the actual API request.
6503 ///
6504 /// ````text
6505 /// It should be used to handle progress information, and to implement a certain level of resilience.
6506 /// ````
6507 ///
6508 /// Sets the *delegate* property to the given value.
6509 pub fn delegate(
6510 mut self,
6511 new_value: &'a mut dyn common::Delegate,
6512 ) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C> {
6513 self._delegate = Some(new_value);
6514 self
6515 }
6516
6517 /// Set any additional parameter of the query string used in the request.
6518 /// It should be used to set parameters which are not yet available through their own
6519 /// setters.
6520 ///
6521 /// Please note that this method must not be used to set any of the known parameters
6522 /// which have their own setter method. If done anyway, the request will fail.
6523 ///
6524 /// # Additional Parameters
6525 ///
6526 /// * *$.xgafv* (query-string) - V1 error format.
6527 /// * *access_token* (query-string) - OAuth access token.
6528 /// * *alt* (query-string) - Data format for response.
6529 /// * *callback* (query-string) - JSONP
6530 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6531 /// * *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.
6532 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6533 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6534 /// * *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.
6535 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6536 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6537 pub fn param<T>(
6538 mut self,
6539 name: T,
6540 value: T,
6541 ) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C>
6542 where
6543 T: AsRef<str>,
6544 {
6545 self._additional_params
6546 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6547 self
6548 }
6549
6550 /// Identifies the authorization scope for the method you are building.
6551 ///
6552 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6553 /// [`Scope::CloudPlatform`].
6554 ///
6555 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6556 /// tokens for more than one scope.
6557 ///
6558 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6559 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6560 /// sufficient, a read-write scope will do as well.
6561 pub fn add_scope<St>(
6562 mut self,
6563 scope: St,
6564 ) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C>
6565 where
6566 St: AsRef<str>,
6567 {
6568 self._scopes.insert(String::from(scope.as_ref()));
6569 self
6570 }
6571 /// Identifies the authorization scope(s) for the method you are building.
6572 ///
6573 /// See [`Self::add_scope()`] for details.
6574 pub fn add_scopes<I, St>(
6575 mut self,
6576 scopes: I,
6577 ) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C>
6578 where
6579 I: IntoIterator<Item = St>,
6580 St: AsRef<str>,
6581 {
6582 self._scopes
6583 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6584 self
6585 }
6586
6587 /// Removes all scopes, and no default scope will be used either.
6588 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6589 /// for details).
6590 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGroupSetIamPolicyCall<'a, C> {
6591 self._scopes.clear();
6592 self
6593 }
6594}
6595
6596/// 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.
6597///
6598/// A builder for the *locations.global.hubs.groups.testIamPermissions* method supported by a *project* resource.
6599/// It is not used directly, but through a [`ProjectMethods`] instance.
6600///
6601/// # Example
6602///
6603/// Instantiate a resource method builder
6604///
6605/// ```test_harness,no_run
6606/// # extern crate hyper;
6607/// # extern crate hyper_rustls;
6608/// # extern crate google_networkconnectivity1 as networkconnectivity1;
6609/// use networkconnectivity1::api::TestIamPermissionsRequest;
6610/// # async fn dox() {
6611/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6612///
6613/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6614/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6615/// # .with_native_roots()
6616/// # .unwrap()
6617/// # .https_only()
6618/// # .enable_http2()
6619/// # .build();
6620///
6621/// # let executor = hyper_util::rt::TokioExecutor::new();
6622/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6623/// # secret,
6624/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6625/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6626/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6627/// # ),
6628/// # ).build().await.unwrap();
6629///
6630/// # let client = hyper_util::client::legacy::Client::builder(
6631/// # hyper_util::rt::TokioExecutor::new()
6632/// # )
6633/// # .build(
6634/// # hyper_rustls::HttpsConnectorBuilder::new()
6635/// # .with_native_roots()
6636/// # .unwrap()
6637/// # .https_or_http()
6638/// # .enable_http2()
6639/// # .build()
6640/// # );
6641/// # let mut hub = Networkconnectivity::new(client, auth);
6642/// // As the method needs a request, you would usually fill it with the desired information
6643/// // into the respective structure. Some of the parts shown here might not be applicable !
6644/// // Values shown here are possibly random and not representative !
6645/// let mut req = TestIamPermissionsRequest::default();
6646///
6647/// // You can configure optional parameters by calling the respective setters at will, and
6648/// // execute the final call using `doit()`.
6649/// // Values shown here are possibly random and not representative !
6650/// let result = hub.projects().locations_global_hubs_groups_test_iam_permissions(req, "resource")
6651/// .doit().await;
6652/// # }
6653/// ```
6654pub struct ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C>
6655where
6656 C: 'a,
6657{
6658 hub: &'a Networkconnectivity<C>,
6659 _request: TestIamPermissionsRequest,
6660 _resource: String,
6661 _delegate: Option<&'a mut dyn common::Delegate>,
6662 _additional_params: HashMap<String, String>,
6663 _scopes: BTreeSet<String>,
6664}
6665
6666impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C> {}
6667
6668impl<'a, C> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C>
6669where
6670 C: common::Connector,
6671{
6672 /// Perform the operation you have build so far.
6673 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
6674 use std::borrow::Cow;
6675 use std::io::{Read, Seek};
6676
6677 use common::{url::Params, ToParts};
6678 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6679
6680 let mut dd = common::DefaultDelegate;
6681 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6682 dlg.begin(common::MethodInfo {
6683 id: "networkconnectivity.projects.locations.global.hubs.groups.testIamPermissions",
6684 http_method: hyper::Method::POST,
6685 });
6686
6687 for &field in ["alt", "resource"].iter() {
6688 if self._additional_params.contains_key(field) {
6689 dlg.finished(false);
6690 return Err(common::Error::FieldClash(field));
6691 }
6692 }
6693
6694 let mut params = Params::with_capacity(4 + self._additional_params.len());
6695 params.push("resource", self._resource);
6696
6697 params.extend(self._additional_params.iter());
6698
6699 params.push("alt", "json");
6700 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
6701 if self._scopes.is_empty() {
6702 self._scopes
6703 .insert(Scope::CloudPlatform.as_ref().to_string());
6704 }
6705
6706 #[allow(clippy::single_element_loop)]
6707 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6708 url = params.uri_replacement(url, param_name, find_this, true);
6709 }
6710 {
6711 let to_remove = ["resource"];
6712 params.remove_params(&to_remove);
6713 }
6714
6715 let url = params.parse_with_url(&url);
6716
6717 let mut json_mime_type = mime::APPLICATION_JSON;
6718 let mut request_value_reader = {
6719 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6720 common::remove_json_null_values(&mut value);
6721 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6722 serde_json::to_writer(&mut dst, &value).unwrap();
6723 dst
6724 };
6725 let request_size = request_value_reader
6726 .seek(std::io::SeekFrom::End(0))
6727 .unwrap();
6728 request_value_reader
6729 .seek(std::io::SeekFrom::Start(0))
6730 .unwrap();
6731
6732 loop {
6733 let token = match self
6734 .hub
6735 .auth
6736 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6737 .await
6738 {
6739 Ok(token) => token,
6740 Err(e) => match dlg.token(e) {
6741 Ok(token) => token,
6742 Err(e) => {
6743 dlg.finished(false);
6744 return Err(common::Error::MissingToken(e));
6745 }
6746 },
6747 };
6748 request_value_reader
6749 .seek(std::io::SeekFrom::Start(0))
6750 .unwrap();
6751 let mut req_result = {
6752 let client = &self.hub.client;
6753 dlg.pre_request();
6754 let mut req_builder = hyper::Request::builder()
6755 .method(hyper::Method::POST)
6756 .uri(url.as_str())
6757 .header(USER_AGENT, self.hub._user_agent.clone());
6758
6759 if let Some(token) = token.as_ref() {
6760 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6761 }
6762
6763 let request = req_builder
6764 .header(CONTENT_TYPE, json_mime_type.to_string())
6765 .header(CONTENT_LENGTH, request_size as u64)
6766 .body(common::to_body(
6767 request_value_reader.get_ref().clone().into(),
6768 ));
6769
6770 client.request(request.unwrap()).await
6771 };
6772
6773 match req_result {
6774 Err(err) => {
6775 if let common::Retry::After(d) = dlg.http_error(&err) {
6776 sleep(d).await;
6777 continue;
6778 }
6779 dlg.finished(false);
6780 return Err(common::Error::HttpError(err));
6781 }
6782 Ok(res) => {
6783 let (mut parts, body) = res.into_parts();
6784 let mut body = common::Body::new(body);
6785 if !parts.status.is_success() {
6786 let bytes = common::to_bytes(body).await.unwrap_or_default();
6787 let error = serde_json::from_str(&common::to_string(&bytes));
6788 let response = common::to_response(parts, bytes.into());
6789
6790 if let common::Retry::After(d) =
6791 dlg.http_failure(&response, error.as_ref().ok())
6792 {
6793 sleep(d).await;
6794 continue;
6795 }
6796
6797 dlg.finished(false);
6798
6799 return Err(match error {
6800 Ok(value) => common::Error::BadRequest(value),
6801 _ => common::Error::Failure(response),
6802 });
6803 }
6804 let response = {
6805 let bytes = common::to_bytes(body).await.unwrap_or_default();
6806 let encoded = common::to_string(&bytes);
6807 match serde_json::from_str(&encoded) {
6808 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6809 Err(error) => {
6810 dlg.response_json_decode_error(&encoded, &error);
6811 return Err(common::Error::JsonDecodeError(
6812 encoded.to_string(),
6813 error,
6814 ));
6815 }
6816 }
6817 };
6818
6819 dlg.finished(true);
6820 return Ok(response);
6821 }
6822 }
6823 }
6824 }
6825
6826 ///
6827 /// Sets the *request* property to the given value.
6828 ///
6829 /// Even though the property as already been set when instantiating this call,
6830 /// we provide this method for API completeness.
6831 pub fn request(
6832 mut self,
6833 new_value: TestIamPermissionsRequest,
6834 ) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C> {
6835 self._request = new_value;
6836 self
6837 }
6838 /// 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.
6839 ///
6840 /// Sets the *resource* path property to the given value.
6841 ///
6842 /// Even though the property as already been set when instantiating this call,
6843 /// we provide this method for API completeness.
6844 pub fn resource(
6845 mut self,
6846 new_value: &str,
6847 ) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C> {
6848 self._resource = new_value.to_string();
6849 self
6850 }
6851 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6852 /// while executing the actual API request.
6853 ///
6854 /// ````text
6855 /// It should be used to handle progress information, and to implement a certain level of resilience.
6856 /// ````
6857 ///
6858 /// Sets the *delegate* property to the given value.
6859 pub fn delegate(
6860 mut self,
6861 new_value: &'a mut dyn common::Delegate,
6862 ) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C> {
6863 self._delegate = Some(new_value);
6864 self
6865 }
6866
6867 /// Set any additional parameter of the query string used in the request.
6868 /// It should be used to set parameters which are not yet available through their own
6869 /// setters.
6870 ///
6871 /// Please note that this method must not be used to set any of the known parameters
6872 /// which have their own setter method. If done anyway, the request will fail.
6873 ///
6874 /// # Additional Parameters
6875 ///
6876 /// * *$.xgafv* (query-string) - V1 error format.
6877 /// * *access_token* (query-string) - OAuth access token.
6878 /// * *alt* (query-string) - Data format for response.
6879 /// * *callback* (query-string) - JSONP
6880 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6881 /// * *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.
6882 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6883 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6884 /// * *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.
6885 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6886 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6887 pub fn param<T>(
6888 mut self,
6889 name: T,
6890 value: T,
6891 ) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C>
6892 where
6893 T: AsRef<str>,
6894 {
6895 self._additional_params
6896 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6897 self
6898 }
6899
6900 /// Identifies the authorization scope for the method you are building.
6901 ///
6902 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6903 /// [`Scope::CloudPlatform`].
6904 ///
6905 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6906 /// tokens for more than one scope.
6907 ///
6908 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6909 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6910 /// sufficient, a read-write scope will do as well.
6911 pub fn add_scope<St>(
6912 mut self,
6913 scope: St,
6914 ) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C>
6915 where
6916 St: AsRef<str>,
6917 {
6918 self._scopes.insert(String::from(scope.as_ref()));
6919 self
6920 }
6921 /// Identifies the authorization scope(s) for the method you are building.
6922 ///
6923 /// See [`Self::add_scope()`] for details.
6924 pub fn add_scopes<I, St>(
6925 mut self,
6926 scopes: I,
6927 ) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C>
6928 where
6929 I: IntoIterator<Item = St>,
6930 St: AsRef<str>,
6931 {
6932 self._scopes
6933 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6934 self
6935 }
6936
6937 /// Removes all scopes, and no default scope will be used either.
6938 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6939 /// for details).
6940 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGroupTestIamPermissionCall<'a, C> {
6941 self._scopes.clear();
6942 self
6943 }
6944}
6945
6946/// Gets details about the specified route.
6947///
6948/// A builder for the *locations.global.hubs.routeTables.routes.get* method supported by a *project* resource.
6949/// It is not used directly, but through a [`ProjectMethods`] instance.
6950///
6951/// # Example
6952///
6953/// Instantiate a resource method builder
6954///
6955/// ```test_harness,no_run
6956/// # extern crate hyper;
6957/// # extern crate hyper_rustls;
6958/// # extern crate google_networkconnectivity1 as networkconnectivity1;
6959/// # async fn dox() {
6960/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6961///
6962/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6963/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6964/// # .with_native_roots()
6965/// # .unwrap()
6966/// # .https_only()
6967/// # .enable_http2()
6968/// # .build();
6969///
6970/// # let executor = hyper_util::rt::TokioExecutor::new();
6971/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6972/// # secret,
6973/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6974/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6975/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6976/// # ),
6977/// # ).build().await.unwrap();
6978///
6979/// # let client = hyper_util::client::legacy::Client::builder(
6980/// # hyper_util::rt::TokioExecutor::new()
6981/// # )
6982/// # .build(
6983/// # hyper_rustls::HttpsConnectorBuilder::new()
6984/// # .with_native_roots()
6985/// # .unwrap()
6986/// # .https_or_http()
6987/// # .enable_http2()
6988/// # .build()
6989/// # );
6990/// # let mut hub = Networkconnectivity::new(client, auth);
6991/// // You can configure optional parameters by calling the respective setters at will, and
6992/// // execute the final call using `doit()`.
6993/// // Values shown here are possibly random and not representative !
6994/// let result = hub.projects().locations_global_hubs_route_tables_routes_get("name")
6995/// .doit().await;
6996/// # }
6997/// ```
6998pub struct ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C>
6999where
7000 C: 'a,
7001{
7002 hub: &'a Networkconnectivity<C>,
7003 _name: String,
7004 _delegate: Option<&'a mut dyn common::Delegate>,
7005 _additional_params: HashMap<String, String>,
7006 _scopes: BTreeSet<String>,
7007}
7008
7009impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C> {}
7010
7011impl<'a, C> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C>
7012where
7013 C: common::Connector,
7014{
7015 /// Perform the operation you have build so far.
7016 pub async fn doit(mut self) -> common::Result<(common::Response, Route)> {
7017 use std::borrow::Cow;
7018 use std::io::{Read, Seek};
7019
7020 use common::{url::Params, ToParts};
7021 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7022
7023 let mut dd = common::DefaultDelegate;
7024 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7025 dlg.begin(common::MethodInfo {
7026 id: "networkconnectivity.projects.locations.global.hubs.routeTables.routes.get",
7027 http_method: hyper::Method::GET,
7028 });
7029
7030 for &field in ["alt", "name"].iter() {
7031 if self._additional_params.contains_key(field) {
7032 dlg.finished(false);
7033 return Err(common::Error::FieldClash(field));
7034 }
7035 }
7036
7037 let mut params = Params::with_capacity(3 + self._additional_params.len());
7038 params.push("name", self._name);
7039
7040 params.extend(self._additional_params.iter());
7041
7042 params.push("alt", "json");
7043 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7044 if self._scopes.is_empty() {
7045 self._scopes
7046 .insert(Scope::CloudPlatform.as_ref().to_string());
7047 }
7048
7049 #[allow(clippy::single_element_loop)]
7050 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7051 url = params.uri_replacement(url, param_name, find_this, true);
7052 }
7053 {
7054 let to_remove = ["name"];
7055 params.remove_params(&to_remove);
7056 }
7057
7058 let url = params.parse_with_url(&url);
7059
7060 loop {
7061 let token = match self
7062 .hub
7063 .auth
7064 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7065 .await
7066 {
7067 Ok(token) => token,
7068 Err(e) => match dlg.token(e) {
7069 Ok(token) => token,
7070 Err(e) => {
7071 dlg.finished(false);
7072 return Err(common::Error::MissingToken(e));
7073 }
7074 },
7075 };
7076 let mut req_result = {
7077 let client = &self.hub.client;
7078 dlg.pre_request();
7079 let mut req_builder = hyper::Request::builder()
7080 .method(hyper::Method::GET)
7081 .uri(url.as_str())
7082 .header(USER_AGENT, self.hub._user_agent.clone());
7083
7084 if let Some(token) = token.as_ref() {
7085 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7086 }
7087
7088 let request = req_builder
7089 .header(CONTENT_LENGTH, 0_u64)
7090 .body(common::to_body::<String>(None));
7091
7092 client.request(request.unwrap()).await
7093 };
7094
7095 match req_result {
7096 Err(err) => {
7097 if let common::Retry::After(d) = dlg.http_error(&err) {
7098 sleep(d).await;
7099 continue;
7100 }
7101 dlg.finished(false);
7102 return Err(common::Error::HttpError(err));
7103 }
7104 Ok(res) => {
7105 let (mut parts, body) = res.into_parts();
7106 let mut body = common::Body::new(body);
7107 if !parts.status.is_success() {
7108 let bytes = common::to_bytes(body).await.unwrap_or_default();
7109 let error = serde_json::from_str(&common::to_string(&bytes));
7110 let response = common::to_response(parts, bytes.into());
7111
7112 if let common::Retry::After(d) =
7113 dlg.http_failure(&response, error.as_ref().ok())
7114 {
7115 sleep(d).await;
7116 continue;
7117 }
7118
7119 dlg.finished(false);
7120
7121 return Err(match error {
7122 Ok(value) => common::Error::BadRequest(value),
7123 _ => common::Error::Failure(response),
7124 });
7125 }
7126 let response = {
7127 let bytes = common::to_bytes(body).await.unwrap_or_default();
7128 let encoded = common::to_string(&bytes);
7129 match serde_json::from_str(&encoded) {
7130 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7131 Err(error) => {
7132 dlg.response_json_decode_error(&encoded, &error);
7133 return Err(common::Error::JsonDecodeError(
7134 encoded.to_string(),
7135 error,
7136 ));
7137 }
7138 }
7139 };
7140
7141 dlg.finished(true);
7142 return Ok(response);
7143 }
7144 }
7145 }
7146 }
7147
7148 /// Required. The name of the route resource.
7149 ///
7150 /// Sets the *name* path property to the given value.
7151 ///
7152 /// Even though the property as already been set when instantiating this call,
7153 /// we provide this method for API completeness.
7154 pub fn name(
7155 mut self,
7156 new_value: &str,
7157 ) -> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C> {
7158 self._name = new_value.to_string();
7159 self
7160 }
7161 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7162 /// while executing the actual API request.
7163 ///
7164 /// ````text
7165 /// It should be used to handle progress information, and to implement a certain level of resilience.
7166 /// ````
7167 ///
7168 /// Sets the *delegate* property to the given value.
7169 pub fn delegate(
7170 mut self,
7171 new_value: &'a mut dyn common::Delegate,
7172 ) -> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C> {
7173 self._delegate = Some(new_value);
7174 self
7175 }
7176
7177 /// Set any additional parameter of the query string used in the request.
7178 /// It should be used to set parameters which are not yet available through their own
7179 /// setters.
7180 ///
7181 /// Please note that this method must not be used to set any of the known parameters
7182 /// which have their own setter method. If done anyway, the request will fail.
7183 ///
7184 /// # Additional Parameters
7185 ///
7186 /// * *$.xgafv* (query-string) - V1 error format.
7187 /// * *access_token* (query-string) - OAuth access token.
7188 /// * *alt* (query-string) - Data format for response.
7189 /// * *callback* (query-string) - JSONP
7190 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7191 /// * *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.
7192 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7193 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7194 /// * *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.
7195 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7196 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7197 pub fn param<T>(
7198 mut self,
7199 name: T,
7200 value: T,
7201 ) -> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C>
7202 where
7203 T: AsRef<str>,
7204 {
7205 self._additional_params
7206 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7207 self
7208 }
7209
7210 /// Identifies the authorization scope for the method you are building.
7211 ///
7212 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7213 /// [`Scope::CloudPlatform`].
7214 ///
7215 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7216 /// tokens for more than one scope.
7217 ///
7218 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7219 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7220 /// sufficient, a read-write scope will do as well.
7221 pub fn add_scope<St>(
7222 mut self,
7223 scope: St,
7224 ) -> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C>
7225 where
7226 St: AsRef<str>,
7227 {
7228 self._scopes.insert(String::from(scope.as_ref()));
7229 self
7230 }
7231 /// Identifies the authorization scope(s) for the method you are building.
7232 ///
7233 /// See [`Self::add_scope()`] for details.
7234 pub fn add_scopes<I, St>(
7235 mut self,
7236 scopes: I,
7237 ) -> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C>
7238 where
7239 I: IntoIterator<Item = St>,
7240 St: AsRef<str>,
7241 {
7242 self._scopes
7243 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7244 self
7245 }
7246
7247 /// Removes all scopes, and no default scope will be used either.
7248 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7249 /// for details).
7250 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubRouteTableRouteGetCall<'a, C> {
7251 self._scopes.clear();
7252 self
7253 }
7254}
7255
7256/// Lists routes in a given route table.
7257///
7258/// A builder for the *locations.global.hubs.routeTables.routes.list* method supported by a *project* resource.
7259/// It is not used directly, but through a [`ProjectMethods`] instance.
7260///
7261/// # Example
7262///
7263/// Instantiate a resource method builder
7264///
7265/// ```test_harness,no_run
7266/// # extern crate hyper;
7267/// # extern crate hyper_rustls;
7268/// # extern crate google_networkconnectivity1 as networkconnectivity1;
7269/// # async fn dox() {
7270/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7271///
7272/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7273/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7274/// # .with_native_roots()
7275/// # .unwrap()
7276/// # .https_only()
7277/// # .enable_http2()
7278/// # .build();
7279///
7280/// # let executor = hyper_util::rt::TokioExecutor::new();
7281/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7282/// # secret,
7283/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7284/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7285/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7286/// # ),
7287/// # ).build().await.unwrap();
7288///
7289/// # let client = hyper_util::client::legacy::Client::builder(
7290/// # hyper_util::rt::TokioExecutor::new()
7291/// # )
7292/// # .build(
7293/// # hyper_rustls::HttpsConnectorBuilder::new()
7294/// # .with_native_roots()
7295/// # .unwrap()
7296/// # .https_or_http()
7297/// # .enable_http2()
7298/// # .build()
7299/// # );
7300/// # let mut hub = Networkconnectivity::new(client, auth);
7301/// // You can configure optional parameters by calling the respective setters at will, and
7302/// // execute the final call using `doit()`.
7303/// // Values shown here are possibly random and not representative !
7304/// let result = hub.projects().locations_global_hubs_route_tables_routes_list("parent")
7305/// .page_token("Lorem")
7306/// .page_size(-25)
7307/// .order_by("labore")
7308/// .filter("sed")
7309/// .doit().await;
7310/// # }
7311/// ```
7312pub struct ProjectLocationGlobalHubRouteTableRouteListCall<'a, C>
7313where
7314 C: 'a,
7315{
7316 hub: &'a Networkconnectivity<C>,
7317 _parent: String,
7318 _page_token: Option<String>,
7319 _page_size: Option<i32>,
7320 _order_by: Option<String>,
7321 _filter: Option<String>,
7322 _delegate: Option<&'a mut dyn common::Delegate>,
7323 _additional_params: HashMap<String, String>,
7324 _scopes: BTreeSet<String>,
7325}
7326
7327impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {}
7328
7329impl<'a, C> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C>
7330where
7331 C: common::Connector,
7332{
7333 /// Perform the operation you have build so far.
7334 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutesResponse)> {
7335 use std::borrow::Cow;
7336 use std::io::{Read, Seek};
7337
7338 use common::{url::Params, ToParts};
7339 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7340
7341 let mut dd = common::DefaultDelegate;
7342 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7343 dlg.begin(common::MethodInfo {
7344 id: "networkconnectivity.projects.locations.global.hubs.routeTables.routes.list",
7345 http_method: hyper::Method::GET,
7346 });
7347
7348 for &field in [
7349 "alt",
7350 "parent",
7351 "pageToken",
7352 "pageSize",
7353 "orderBy",
7354 "filter",
7355 ]
7356 .iter()
7357 {
7358 if self._additional_params.contains_key(field) {
7359 dlg.finished(false);
7360 return Err(common::Error::FieldClash(field));
7361 }
7362 }
7363
7364 let mut params = Params::with_capacity(7 + self._additional_params.len());
7365 params.push("parent", self._parent);
7366 if let Some(value) = self._page_token.as_ref() {
7367 params.push("pageToken", value);
7368 }
7369 if let Some(value) = self._page_size.as_ref() {
7370 params.push("pageSize", value.to_string());
7371 }
7372 if let Some(value) = self._order_by.as_ref() {
7373 params.push("orderBy", value);
7374 }
7375 if let Some(value) = self._filter.as_ref() {
7376 params.push("filter", value);
7377 }
7378
7379 params.extend(self._additional_params.iter());
7380
7381 params.push("alt", "json");
7382 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routes";
7383 if self._scopes.is_empty() {
7384 self._scopes
7385 .insert(Scope::CloudPlatform.as_ref().to_string());
7386 }
7387
7388 #[allow(clippy::single_element_loop)]
7389 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7390 url = params.uri_replacement(url, param_name, find_this, true);
7391 }
7392 {
7393 let to_remove = ["parent"];
7394 params.remove_params(&to_remove);
7395 }
7396
7397 let url = params.parse_with_url(&url);
7398
7399 loop {
7400 let token = match self
7401 .hub
7402 .auth
7403 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7404 .await
7405 {
7406 Ok(token) => token,
7407 Err(e) => match dlg.token(e) {
7408 Ok(token) => token,
7409 Err(e) => {
7410 dlg.finished(false);
7411 return Err(common::Error::MissingToken(e));
7412 }
7413 },
7414 };
7415 let mut req_result = {
7416 let client = &self.hub.client;
7417 dlg.pre_request();
7418 let mut req_builder = hyper::Request::builder()
7419 .method(hyper::Method::GET)
7420 .uri(url.as_str())
7421 .header(USER_AGENT, self.hub._user_agent.clone());
7422
7423 if let Some(token) = token.as_ref() {
7424 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7425 }
7426
7427 let request = req_builder
7428 .header(CONTENT_LENGTH, 0_u64)
7429 .body(common::to_body::<String>(None));
7430
7431 client.request(request.unwrap()).await
7432 };
7433
7434 match req_result {
7435 Err(err) => {
7436 if let common::Retry::After(d) = dlg.http_error(&err) {
7437 sleep(d).await;
7438 continue;
7439 }
7440 dlg.finished(false);
7441 return Err(common::Error::HttpError(err));
7442 }
7443 Ok(res) => {
7444 let (mut parts, body) = res.into_parts();
7445 let mut body = common::Body::new(body);
7446 if !parts.status.is_success() {
7447 let bytes = common::to_bytes(body).await.unwrap_or_default();
7448 let error = serde_json::from_str(&common::to_string(&bytes));
7449 let response = common::to_response(parts, bytes.into());
7450
7451 if let common::Retry::After(d) =
7452 dlg.http_failure(&response, error.as_ref().ok())
7453 {
7454 sleep(d).await;
7455 continue;
7456 }
7457
7458 dlg.finished(false);
7459
7460 return Err(match error {
7461 Ok(value) => common::Error::BadRequest(value),
7462 _ => common::Error::Failure(response),
7463 });
7464 }
7465 let response = {
7466 let bytes = common::to_bytes(body).await.unwrap_or_default();
7467 let encoded = common::to_string(&bytes);
7468 match serde_json::from_str(&encoded) {
7469 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7470 Err(error) => {
7471 dlg.response_json_decode_error(&encoded, &error);
7472 return Err(common::Error::JsonDecodeError(
7473 encoded.to_string(),
7474 error,
7475 ));
7476 }
7477 }
7478 };
7479
7480 dlg.finished(true);
7481 return Ok(response);
7482 }
7483 }
7484 }
7485 }
7486
7487 /// Required. The parent resource's name.
7488 ///
7489 /// Sets the *parent* path property to the given value.
7490 ///
7491 /// Even though the property as already been set when instantiating this call,
7492 /// we provide this method for API completeness.
7493 pub fn parent(
7494 mut self,
7495 new_value: &str,
7496 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
7497 self._parent = new_value.to_string();
7498 self
7499 }
7500 /// The page token.
7501 ///
7502 /// Sets the *page token* query property to the given value.
7503 pub fn page_token(
7504 mut self,
7505 new_value: &str,
7506 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
7507 self._page_token = Some(new_value.to_string());
7508 self
7509 }
7510 /// The maximum number of results to return per page.
7511 ///
7512 /// Sets the *page size* query property to the given value.
7513 pub fn page_size(
7514 mut self,
7515 new_value: i32,
7516 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
7517 self._page_size = Some(new_value);
7518 self
7519 }
7520 /// Sort the results by a certain order.
7521 ///
7522 /// Sets the *order by* query property to the given value.
7523 pub fn order_by(
7524 mut self,
7525 new_value: &str,
7526 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
7527 self._order_by = Some(new_value.to_string());
7528 self
7529 }
7530 /// An expression that filters the list of results.
7531 ///
7532 /// Sets the *filter* query property to the given value.
7533 pub fn filter(
7534 mut self,
7535 new_value: &str,
7536 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
7537 self._filter = Some(new_value.to_string());
7538 self
7539 }
7540 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7541 /// while executing the actual API request.
7542 ///
7543 /// ````text
7544 /// It should be used to handle progress information, and to implement a certain level of resilience.
7545 /// ````
7546 ///
7547 /// Sets the *delegate* property to the given value.
7548 pub fn delegate(
7549 mut self,
7550 new_value: &'a mut dyn common::Delegate,
7551 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
7552 self._delegate = Some(new_value);
7553 self
7554 }
7555
7556 /// Set any additional parameter of the query string used in the request.
7557 /// It should be used to set parameters which are not yet available through their own
7558 /// setters.
7559 ///
7560 /// Please note that this method must not be used to set any of the known parameters
7561 /// which have their own setter method. If done anyway, the request will fail.
7562 ///
7563 /// # Additional Parameters
7564 ///
7565 /// * *$.xgafv* (query-string) - V1 error format.
7566 /// * *access_token* (query-string) - OAuth access token.
7567 /// * *alt* (query-string) - Data format for response.
7568 /// * *callback* (query-string) - JSONP
7569 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7570 /// * *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.
7571 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7572 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7573 /// * *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.
7574 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7575 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7576 pub fn param<T>(
7577 mut self,
7578 name: T,
7579 value: T,
7580 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C>
7581 where
7582 T: AsRef<str>,
7583 {
7584 self._additional_params
7585 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7586 self
7587 }
7588
7589 /// Identifies the authorization scope for the method you are building.
7590 ///
7591 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7592 /// [`Scope::CloudPlatform`].
7593 ///
7594 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7595 /// tokens for more than one scope.
7596 ///
7597 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7598 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7599 /// sufficient, a read-write scope will do as well.
7600 pub fn add_scope<St>(
7601 mut self,
7602 scope: St,
7603 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C>
7604 where
7605 St: AsRef<str>,
7606 {
7607 self._scopes.insert(String::from(scope.as_ref()));
7608 self
7609 }
7610 /// Identifies the authorization scope(s) for the method you are building.
7611 ///
7612 /// See [`Self::add_scope()`] for details.
7613 pub fn add_scopes<I, St>(
7614 mut self,
7615 scopes: I,
7616 ) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C>
7617 where
7618 I: IntoIterator<Item = St>,
7619 St: AsRef<str>,
7620 {
7621 self._scopes
7622 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7623 self
7624 }
7625
7626 /// Removes all scopes, and no default scope will be used either.
7627 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7628 /// for details).
7629 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubRouteTableRouteListCall<'a, C> {
7630 self._scopes.clear();
7631 self
7632 }
7633}
7634
7635/// Gets details about a Network Connectivity Center route table.
7636///
7637/// A builder for the *locations.global.hubs.routeTables.get* method supported by a *project* resource.
7638/// It is not used directly, but through a [`ProjectMethods`] instance.
7639///
7640/// # Example
7641///
7642/// Instantiate a resource method builder
7643///
7644/// ```test_harness,no_run
7645/// # extern crate hyper;
7646/// # extern crate hyper_rustls;
7647/// # extern crate google_networkconnectivity1 as networkconnectivity1;
7648/// # async fn dox() {
7649/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7650///
7651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7652/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7653/// # .with_native_roots()
7654/// # .unwrap()
7655/// # .https_only()
7656/// # .enable_http2()
7657/// # .build();
7658///
7659/// # let executor = hyper_util::rt::TokioExecutor::new();
7660/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7661/// # secret,
7662/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7663/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7664/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7665/// # ),
7666/// # ).build().await.unwrap();
7667///
7668/// # let client = hyper_util::client::legacy::Client::builder(
7669/// # hyper_util::rt::TokioExecutor::new()
7670/// # )
7671/// # .build(
7672/// # hyper_rustls::HttpsConnectorBuilder::new()
7673/// # .with_native_roots()
7674/// # .unwrap()
7675/// # .https_or_http()
7676/// # .enable_http2()
7677/// # .build()
7678/// # );
7679/// # let mut hub = Networkconnectivity::new(client, auth);
7680/// // You can configure optional parameters by calling the respective setters at will, and
7681/// // execute the final call using `doit()`.
7682/// // Values shown here are possibly random and not representative !
7683/// let result = hub.projects().locations_global_hubs_route_tables_get("name")
7684/// .doit().await;
7685/// # }
7686/// ```
7687pub struct ProjectLocationGlobalHubRouteTableGetCall<'a, C>
7688where
7689 C: 'a,
7690{
7691 hub: &'a Networkconnectivity<C>,
7692 _name: String,
7693 _delegate: Option<&'a mut dyn common::Delegate>,
7694 _additional_params: HashMap<String, String>,
7695 _scopes: BTreeSet<String>,
7696}
7697
7698impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubRouteTableGetCall<'a, C> {}
7699
7700impl<'a, C> ProjectLocationGlobalHubRouteTableGetCall<'a, C>
7701where
7702 C: common::Connector,
7703{
7704 /// Perform the operation you have build so far.
7705 pub async fn doit(mut self) -> common::Result<(common::Response, RouteTable)> {
7706 use std::borrow::Cow;
7707 use std::io::{Read, Seek};
7708
7709 use common::{url::Params, ToParts};
7710 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7711
7712 let mut dd = common::DefaultDelegate;
7713 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7714 dlg.begin(common::MethodInfo {
7715 id: "networkconnectivity.projects.locations.global.hubs.routeTables.get",
7716 http_method: hyper::Method::GET,
7717 });
7718
7719 for &field in ["alt", "name"].iter() {
7720 if self._additional_params.contains_key(field) {
7721 dlg.finished(false);
7722 return Err(common::Error::FieldClash(field));
7723 }
7724 }
7725
7726 let mut params = Params::with_capacity(3 + self._additional_params.len());
7727 params.push("name", self._name);
7728
7729 params.extend(self._additional_params.iter());
7730
7731 params.push("alt", "json");
7732 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7733 if self._scopes.is_empty() {
7734 self._scopes
7735 .insert(Scope::CloudPlatform.as_ref().to_string());
7736 }
7737
7738 #[allow(clippy::single_element_loop)]
7739 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7740 url = params.uri_replacement(url, param_name, find_this, true);
7741 }
7742 {
7743 let to_remove = ["name"];
7744 params.remove_params(&to_remove);
7745 }
7746
7747 let url = params.parse_with_url(&url);
7748
7749 loop {
7750 let token = match self
7751 .hub
7752 .auth
7753 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7754 .await
7755 {
7756 Ok(token) => token,
7757 Err(e) => match dlg.token(e) {
7758 Ok(token) => token,
7759 Err(e) => {
7760 dlg.finished(false);
7761 return Err(common::Error::MissingToken(e));
7762 }
7763 },
7764 };
7765 let mut req_result = {
7766 let client = &self.hub.client;
7767 dlg.pre_request();
7768 let mut req_builder = hyper::Request::builder()
7769 .method(hyper::Method::GET)
7770 .uri(url.as_str())
7771 .header(USER_AGENT, self.hub._user_agent.clone());
7772
7773 if let Some(token) = token.as_ref() {
7774 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7775 }
7776
7777 let request = req_builder
7778 .header(CONTENT_LENGTH, 0_u64)
7779 .body(common::to_body::<String>(None));
7780
7781 client.request(request.unwrap()).await
7782 };
7783
7784 match req_result {
7785 Err(err) => {
7786 if let common::Retry::After(d) = dlg.http_error(&err) {
7787 sleep(d).await;
7788 continue;
7789 }
7790 dlg.finished(false);
7791 return Err(common::Error::HttpError(err));
7792 }
7793 Ok(res) => {
7794 let (mut parts, body) = res.into_parts();
7795 let mut body = common::Body::new(body);
7796 if !parts.status.is_success() {
7797 let bytes = common::to_bytes(body).await.unwrap_or_default();
7798 let error = serde_json::from_str(&common::to_string(&bytes));
7799 let response = common::to_response(parts, bytes.into());
7800
7801 if let common::Retry::After(d) =
7802 dlg.http_failure(&response, error.as_ref().ok())
7803 {
7804 sleep(d).await;
7805 continue;
7806 }
7807
7808 dlg.finished(false);
7809
7810 return Err(match error {
7811 Ok(value) => common::Error::BadRequest(value),
7812 _ => common::Error::Failure(response),
7813 });
7814 }
7815 let response = {
7816 let bytes = common::to_bytes(body).await.unwrap_or_default();
7817 let encoded = common::to_string(&bytes);
7818 match serde_json::from_str(&encoded) {
7819 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7820 Err(error) => {
7821 dlg.response_json_decode_error(&encoded, &error);
7822 return Err(common::Error::JsonDecodeError(
7823 encoded.to_string(),
7824 error,
7825 ));
7826 }
7827 }
7828 };
7829
7830 dlg.finished(true);
7831 return Ok(response);
7832 }
7833 }
7834 }
7835 }
7836
7837 /// Required. The name of the route table resource.
7838 ///
7839 /// Sets the *name* path property to the given value.
7840 ///
7841 /// Even though the property as already been set when instantiating this call,
7842 /// we provide this method for API completeness.
7843 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubRouteTableGetCall<'a, C> {
7844 self._name = new_value.to_string();
7845 self
7846 }
7847 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7848 /// while executing the actual API request.
7849 ///
7850 /// ````text
7851 /// It should be used to handle progress information, and to implement a certain level of resilience.
7852 /// ````
7853 ///
7854 /// Sets the *delegate* property to the given value.
7855 pub fn delegate(
7856 mut self,
7857 new_value: &'a mut dyn common::Delegate,
7858 ) -> ProjectLocationGlobalHubRouteTableGetCall<'a, C> {
7859 self._delegate = Some(new_value);
7860 self
7861 }
7862
7863 /// Set any additional parameter of the query string used in the request.
7864 /// It should be used to set parameters which are not yet available through their own
7865 /// setters.
7866 ///
7867 /// Please note that this method must not be used to set any of the known parameters
7868 /// which have their own setter method. If done anyway, the request will fail.
7869 ///
7870 /// # Additional Parameters
7871 ///
7872 /// * *$.xgafv* (query-string) - V1 error format.
7873 /// * *access_token* (query-string) - OAuth access token.
7874 /// * *alt* (query-string) - Data format for response.
7875 /// * *callback* (query-string) - JSONP
7876 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7877 /// * *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.
7878 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7879 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7880 /// * *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.
7881 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7882 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7883 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubRouteTableGetCall<'a, C>
7884 where
7885 T: AsRef<str>,
7886 {
7887 self._additional_params
7888 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7889 self
7890 }
7891
7892 /// Identifies the authorization scope for the method you are building.
7893 ///
7894 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7895 /// [`Scope::CloudPlatform`].
7896 ///
7897 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7898 /// tokens for more than one scope.
7899 ///
7900 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7901 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7902 /// sufficient, a read-write scope will do as well.
7903 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubRouteTableGetCall<'a, C>
7904 where
7905 St: AsRef<str>,
7906 {
7907 self._scopes.insert(String::from(scope.as_ref()));
7908 self
7909 }
7910 /// Identifies the authorization scope(s) for the method you are building.
7911 ///
7912 /// See [`Self::add_scope()`] for details.
7913 pub fn add_scopes<I, St>(
7914 mut self,
7915 scopes: I,
7916 ) -> ProjectLocationGlobalHubRouteTableGetCall<'a, C>
7917 where
7918 I: IntoIterator<Item = St>,
7919 St: AsRef<str>,
7920 {
7921 self._scopes
7922 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7923 self
7924 }
7925
7926 /// Removes all scopes, and no default scope will be used either.
7927 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7928 /// for details).
7929 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubRouteTableGetCall<'a, C> {
7930 self._scopes.clear();
7931 self
7932 }
7933}
7934
7935/// Lists route tables in a given hub.
7936///
7937/// A builder for the *locations.global.hubs.routeTables.list* method supported by a *project* resource.
7938/// It is not used directly, but through a [`ProjectMethods`] instance.
7939///
7940/// # Example
7941///
7942/// Instantiate a resource method builder
7943///
7944/// ```test_harness,no_run
7945/// # extern crate hyper;
7946/// # extern crate hyper_rustls;
7947/// # extern crate google_networkconnectivity1 as networkconnectivity1;
7948/// # async fn dox() {
7949/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7950///
7951/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7952/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7953/// # .with_native_roots()
7954/// # .unwrap()
7955/// # .https_only()
7956/// # .enable_http2()
7957/// # .build();
7958///
7959/// # let executor = hyper_util::rt::TokioExecutor::new();
7960/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7961/// # secret,
7962/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7963/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7964/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7965/// # ),
7966/// # ).build().await.unwrap();
7967///
7968/// # let client = hyper_util::client::legacy::Client::builder(
7969/// # hyper_util::rt::TokioExecutor::new()
7970/// # )
7971/// # .build(
7972/// # hyper_rustls::HttpsConnectorBuilder::new()
7973/// # .with_native_roots()
7974/// # .unwrap()
7975/// # .https_or_http()
7976/// # .enable_http2()
7977/// # .build()
7978/// # );
7979/// # let mut hub = Networkconnectivity::new(client, auth);
7980/// // You can configure optional parameters by calling the respective setters at will, and
7981/// // execute the final call using `doit()`.
7982/// // Values shown here are possibly random and not representative !
7983/// let result = hub.projects().locations_global_hubs_route_tables_list("parent")
7984/// .page_token("no")
7985/// .page_size(-15)
7986/// .order_by("kasd")
7987/// .filter("et")
7988/// .doit().await;
7989/// # }
7990/// ```
7991pub struct ProjectLocationGlobalHubRouteTableListCall<'a, C>
7992where
7993 C: 'a,
7994{
7995 hub: &'a Networkconnectivity<C>,
7996 _parent: String,
7997 _page_token: Option<String>,
7998 _page_size: Option<i32>,
7999 _order_by: Option<String>,
8000 _filter: Option<String>,
8001 _delegate: Option<&'a mut dyn common::Delegate>,
8002 _additional_params: HashMap<String, String>,
8003 _scopes: BTreeSet<String>,
8004}
8005
8006impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubRouteTableListCall<'a, C> {}
8007
8008impl<'a, C> ProjectLocationGlobalHubRouteTableListCall<'a, C>
8009where
8010 C: common::Connector,
8011{
8012 /// Perform the operation you have build so far.
8013 pub async fn doit(mut self) -> common::Result<(common::Response, ListRouteTablesResponse)> {
8014 use std::borrow::Cow;
8015 use std::io::{Read, Seek};
8016
8017 use common::{url::Params, ToParts};
8018 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8019
8020 let mut dd = common::DefaultDelegate;
8021 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8022 dlg.begin(common::MethodInfo {
8023 id: "networkconnectivity.projects.locations.global.hubs.routeTables.list",
8024 http_method: hyper::Method::GET,
8025 });
8026
8027 for &field in [
8028 "alt",
8029 "parent",
8030 "pageToken",
8031 "pageSize",
8032 "orderBy",
8033 "filter",
8034 ]
8035 .iter()
8036 {
8037 if self._additional_params.contains_key(field) {
8038 dlg.finished(false);
8039 return Err(common::Error::FieldClash(field));
8040 }
8041 }
8042
8043 let mut params = Params::with_capacity(7 + self._additional_params.len());
8044 params.push("parent", self._parent);
8045 if let Some(value) = self._page_token.as_ref() {
8046 params.push("pageToken", value);
8047 }
8048 if let Some(value) = self._page_size.as_ref() {
8049 params.push("pageSize", value.to_string());
8050 }
8051 if let Some(value) = self._order_by.as_ref() {
8052 params.push("orderBy", value);
8053 }
8054 if let Some(value) = self._filter.as_ref() {
8055 params.push("filter", value);
8056 }
8057
8058 params.extend(self._additional_params.iter());
8059
8060 params.push("alt", "json");
8061 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routeTables";
8062 if self._scopes.is_empty() {
8063 self._scopes
8064 .insert(Scope::CloudPlatform.as_ref().to_string());
8065 }
8066
8067 #[allow(clippy::single_element_loop)]
8068 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8069 url = params.uri_replacement(url, param_name, find_this, true);
8070 }
8071 {
8072 let to_remove = ["parent"];
8073 params.remove_params(&to_remove);
8074 }
8075
8076 let url = params.parse_with_url(&url);
8077
8078 loop {
8079 let token = match self
8080 .hub
8081 .auth
8082 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8083 .await
8084 {
8085 Ok(token) => token,
8086 Err(e) => match dlg.token(e) {
8087 Ok(token) => token,
8088 Err(e) => {
8089 dlg.finished(false);
8090 return Err(common::Error::MissingToken(e));
8091 }
8092 },
8093 };
8094 let mut req_result = {
8095 let client = &self.hub.client;
8096 dlg.pre_request();
8097 let mut req_builder = hyper::Request::builder()
8098 .method(hyper::Method::GET)
8099 .uri(url.as_str())
8100 .header(USER_AGENT, self.hub._user_agent.clone());
8101
8102 if let Some(token) = token.as_ref() {
8103 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8104 }
8105
8106 let request = req_builder
8107 .header(CONTENT_LENGTH, 0_u64)
8108 .body(common::to_body::<String>(None));
8109
8110 client.request(request.unwrap()).await
8111 };
8112
8113 match req_result {
8114 Err(err) => {
8115 if let common::Retry::After(d) = dlg.http_error(&err) {
8116 sleep(d).await;
8117 continue;
8118 }
8119 dlg.finished(false);
8120 return Err(common::Error::HttpError(err));
8121 }
8122 Ok(res) => {
8123 let (mut parts, body) = res.into_parts();
8124 let mut body = common::Body::new(body);
8125 if !parts.status.is_success() {
8126 let bytes = common::to_bytes(body).await.unwrap_or_default();
8127 let error = serde_json::from_str(&common::to_string(&bytes));
8128 let response = common::to_response(parts, bytes.into());
8129
8130 if let common::Retry::After(d) =
8131 dlg.http_failure(&response, error.as_ref().ok())
8132 {
8133 sleep(d).await;
8134 continue;
8135 }
8136
8137 dlg.finished(false);
8138
8139 return Err(match error {
8140 Ok(value) => common::Error::BadRequest(value),
8141 _ => common::Error::Failure(response),
8142 });
8143 }
8144 let response = {
8145 let bytes = common::to_bytes(body).await.unwrap_or_default();
8146 let encoded = common::to_string(&bytes);
8147 match serde_json::from_str(&encoded) {
8148 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8149 Err(error) => {
8150 dlg.response_json_decode_error(&encoded, &error);
8151 return Err(common::Error::JsonDecodeError(
8152 encoded.to_string(),
8153 error,
8154 ));
8155 }
8156 }
8157 };
8158
8159 dlg.finished(true);
8160 return Ok(response);
8161 }
8162 }
8163 }
8164 }
8165
8166 /// Required. The parent resource's name.
8167 ///
8168 /// Sets the *parent* path property to the given value.
8169 ///
8170 /// Even though the property as already been set when instantiating this call,
8171 /// we provide this method for API completeness.
8172 pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
8173 self._parent = new_value.to_string();
8174 self
8175 }
8176 /// The page token.
8177 ///
8178 /// Sets the *page token* query property to the given value.
8179 pub fn page_token(
8180 mut self,
8181 new_value: &str,
8182 ) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
8183 self._page_token = Some(new_value.to_string());
8184 self
8185 }
8186 /// The maximum number of results to return per page.
8187 ///
8188 /// Sets the *page size* query property to the given value.
8189 pub fn page_size(
8190 mut self,
8191 new_value: i32,
8192 ) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
8193 self._page_size = Some(new_value);
8194 self
8195 }
8196 /// Sort the results by a certain order.
8197 ///
8198 /// Sets the *order by* query property to the given value.
8199 pub fn order_by(
8200 mut self,
8201 new_value: &str,
8202 ) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
8203 self._order_by = Some(new_value.to_string());
8204 self
8205 }
8206 /// An expression that filters the list of results.
8207 ///
8208 /// Sets the *filter* query property to the given value.
8209 pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
8210 self._filter = Some(new_value.to_string());
8211 self
8212 }
8213 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8214 /// while executing the actual API request.
8215 ///
8216 /// ````text
8217 /// It should be used to handle progress information, and to implement a certain level of resilience.
8218 /// ````
8219 ///
8220 /// Sets the *delegate* property to the given value.
8221 pub fn delegate(
8222 mut self,
8223 new_value: &'a mut dyn common::Delegate,
8224 ) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
8225 self._delegate = Some(new_value);
8226 self
8227 }
8228
8229 /// Set any additional parameter of the query string used in the request.
8230 /// It should be used to set parameters which are not yet available through their own
8231 /// setters.
8232 ///
8233 /// Please note that this method must not be used to set any of the known parameters
8234 /// which have their own setter method. If done anyway, the request will fail.
8235 ///
8236 /// # Additional Parameters
8237 ///
8238 /// * *$.xgafv* (query-string) - V1 error format.
8239 /// * *access_token* (query-string) - OAuth access token.
8240 /// * *alt* (query-string) - Data format for response.
8241 /// * *callback* (query-string) - JSONP
8242 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8243 /// * *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.
8244 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8245 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8246 /// * *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.
8247 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8248 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8249 pub fn param<T>(
8250 mut self,
8251 name: T,
8252 value: T,
8253 ) -> ProjectLocationGlobalHubRouteTableListCall<'a, C>
8254 where
8255 T: AsRef<str>,
8256 {
8257 self._additional_params
8258 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8259 self
8260 }
8261
8262 /// Identifies the authorization scope for the method you are building.
8263 ///
8264 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8265 /// [`Scope::CloudPlatform`].
8266 ///
8267 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8268 /// tokens for more than one scope.
8269 ///
8270 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8271 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8272 /// sufficient, a read-write scope will do as well.
8273 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubRouteTableListCall<'a, C>
8274 where
8275 St: AsRef<str>,
8276 {
8277 self._scopes.insert(String::from(scope.as_ref()));
8278 self
8279 }
8280 /// Identifies the authorization scope(s) for the method you are building.
8281 ///
8282 /// See [`Self::add_scope()`] for details.
8283 pub fn add_scopes<I, St>(
8284 mut self,
8285 scopes: I,
8286 ) -> ProjectLocationGlobalHubRouteTableListCall<'a, C>
8287 where
8288 I: IntoIterator<Item = St>,
8289 St: AsRef<str>,
8290 {
8291 self._scopes
8292 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8293 self
8294 }
8295
8296 /// Removes all scopes, and no default scope will be used either.
8297 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8298 /// for details).
8299 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubRouteTableListCall<'a, C> {
8300 self._scopes.clear();
8301 self
8302 }
8303}
8304
8305/// Accepts a proposal to attach a Network Connectivity Center spoke to a hub.
8306///
8307/// A builder for the *locations.global.hubs.acceptSpoke* method supported by a *project* resource.
8308/// It is not used directly, but through a [`ProjectMethods`] instance.
8309///
8310/// # Example
8311///
8312/// Instantiate a resource method builder
8313///
8314/// ```test_harness,no_run
8315/// # extern crate hyper;
8316/// # extern crate hyper_rustls;
8317/// # extern crate google_networkconnectivity1 as networkconnectivity1;
8318/// use networkconnectivity1::api::AcceptHubSpokeRequest;
8319/// # async fn dox() {
8320/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8321///
8322/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8323/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8324/// # .with_native_roots()
8325/// # .unwrap()
8326/// # .https_only()
8327/// # .enable_http2()
8328/// # .build();
8329///
8330/// # let executor = hyper_util::rt::TokioExecutor::new();
8331/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8332/// # secret,
8333/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8334/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8335/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8336/// # ),
8337/// # ).build().await.unwrap();
8338///
8339/// # let client = hyper_util::client::legacy::Client::builder(
8340/// # hyper_util::rt::TokioExecutor::new()
8341/// # )
8342/// # .build(
8343/// # hyper_rustls::HttpsConnectorBuilder::new()
8344/// # .with_native_roots()
8345/// # .unwrap()
8346/// # .https_or_http()
8347/// # .enable_http2()
8348/// # .build()
8349/// # );
8350/// # let mut hub = Networkconnectivity::new(client, auth);
8351/// // As the method needs a request, you would usually fill it with the desired information
8352/// // into the respective structure. Some of the parts shown here might not be applicable !
8353/// // Values shown here are possibly random and not representative !
8354/// let mut req = AcceptHubSpokeRequest::default();
8355///
8356/// // You can configure optional parameters by calling the respective setters at will, and
8357/// // execute the final call using `doit()`.
8358/// // Values shown here are possibly random and not representative !
8359/// let result = hub.projects().locations_global_hubs_accept_spoke(req, "name")
8360/// .doit().await;
8361/// # }
8362/// ```
8363pub struct ProjectLocationGlobalHubAcceptSpokeCall<'a, C>
8364where
8365 C: 'a,
8366{
8367 hub: &'a Networkconnectivity<C>,
8368 _request: AcceptHubSpokeRequest,
8369 _name: String,
8370 _delegate: Option<&'a mut dyn common::Delegate>,
8371 _additional_params: HashMap<String, String>,
8372 _scopes: BTreeSet<String>,
8373}
8374
8375impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubAcceptSpokeCall<'a, C> {}
8376
8377impl<'a, C> ProjectLocationGlobalHubAcceptSpokeCall<'a, C>
8378where
8379 C: common::Connector,
8380{
8381 /// Perform the operation you have build so far.
8382 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
8383 use std::borrow::Cow;
8384 use std::io::{Read, Seek};
8385
8386 use common::{url::Params, ToParts};
8387 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8388
8389 let mut dd = common::DefaultDelegate;
8390 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8391 dlg.begin(common::MethodInfo {
8392 id: "networkconnectivity.projects.locations.global.hubs.acceptSpoke",
8393 http_method: hyper::Method::POST,
8394 });
8395
8396 for &field in ["alt", "name"].iter() {
8397 if self._additional_params.contains_key(field) {
8398 dlg.finished(false);
8399 return Err(common::Error::FieldClash(field));
8400 }
8401 }
8402
8403 let mut params = Params::with_capacity(4 + self._additional_params.len());
8404 params.push("name", self._name);
8405
8406 params.extend(self._additional_params.iter());
8407
8408 params.push("alt", "json");
8409 let mut url = self.hub._base_url.clone() + "v1/{+name}:acceptSpoke";
8410 if self._scopes.is_empty() {
8411 self._scopes
8412 .insert(Scope::CloudPlatform.as_ref().to_string());
8413 }
8414
8415 #[allow(clippy::single_element_loop)]
8416 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8417 url = params.uri_replacement(url, param_name, find_this, true);
8418 }
8419 {
8420 let to_remove = ["name"];
8421 params.remove_params(&to_remove);
8422 }
8423
8424 let url = params.parse_with_url(&url);
8425
8426 let mut json_mime_type = mime::APPLICATION_JSON;
8427 let mut request_value_reader = {
8428 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8429 common::remove_json_null_values(&mut value);
8430 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8431 serde_json::to_writer(&mut dst, &value).unwrap();
8432 dst
8433 };
8434 let request_size = request_value_reader
8435 .seek(std::io::SeekFrom::End(0))
8436 .unwrap();
8437 request_value_reader
8438 .seek(std::io::SeekFrom::Start(0))
8439 .unwrap();
8440
8441 loop {
8442 let token = match self
8443 .hub
8444 .auth
8445 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8446 .await
8447 {
8448 Ok(token) => token,
8449 Err(e) => match dlg.token(e) {
8450 Ok(token) => token,
8451 Err(e) => {
8452 dlg.finished(false);
8453 return Err(common::Error::MissingToken(e));
8454 }
8455 },
8456 };
8457 request_value_reader
8458 .seek(std::io::SeekFrom::Start(0))
8459 .unwrap();
8460 let mut req_result = {
8461 let client = &self.hub.client;
8462 dlg.pre_request();
8463 let mut req_builder = hyper::Request::builder()
8464 .method(hyper::Method::POST)
8465 .uri(url.as_str())
8466 .header(USER_AGENT, self.hub._user_agent.clone());
8467
8468 if let Some(token) = token.as_ref() {
8469 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8470 }
8471
8472 let request = req_builder
8473 .header(CONTENT_TYPE, json_mime_type.to_string())
8474 .header(CONTENT_LENGTH, request_size as u64)
8475 .body(common::to_body(
8476 request_value_reader.get_ref().clone().into(),
8477 ));
8478
8479 client.request(request.unwrap()).await
8480 };
8481
8482 match req_result {
8483 Err(err) => {
8484 if let common::Retry::After(d) = dlg.http_error(&err) {
8485 sleep(d).await;
8486 continue;
8487 }
8488 dlg.finished(false);
8489 return Err(common::Error::HttpError(err));
8490 }
8491 Ok(res) => {
8492 let (mut parts, body) = res.into_parts();
8493 let mut body = common::Body::new(body);
8494 if !parts.status.is_success() {
8495 let bytes = common::to_bytes(body).await.unwrap_or_default();
8496 let error = serde_json::from_str(&common::to_string(&bytes));
8497 let response = common::to_response(parts, bytes.into());
8498
8499 if let common::Retry::After(d) =
8500 dlg.http_failure(&response, error.as_ref().ok())
8501 {
8502 sleep(d).await;
8503 continue;
8504 }
8505
8506 dlg.finished(false);
8507
8508 return Err(match error {
8509 Ok(value) => common::Error::BadRequest(value),
8510 _ => common::Error::Failure(response),
8511 });
8512 }
8513 let response = {
8514 let bytes = common::to_bytes(body).await.unwrap_or_default();
8515 let encoded = common::to_string(&bytes);
8516 match serde_json::from_str(&encoded) {
8517 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8518 Err(error) => {
8519 dlg.response_json_decode_error(&encoded, &error);
8520 return Err(common::Error::JsonDecodeError(
8521 encoded.to_string(),
8522 error,
8523 ));
8524 }
8525 }
8526 };
8527
8528 dlg.finished(true);
8529 return Ok(response);
8530 }
8531 }
8532 }
8533 }
8534
8535 ///
8536 /// Sets the *request* property to the given value.
8537 ///
8538 /// Even though the property as already been set when instantiating this call,
8539 /// we provide this method for API completeness.
8540 pub fn request(
8541 mut self,
8542 new_value: AcceptHubSpokeRequest,
8543 ) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C> {
8544 self._request = new_value;
8545 self
8546 }
8547 /// Required. The name of the hub into which to accept the spoke.
8548 ///
8549 /// Sets the *name* path property to the given value.
8550 ///
8551 /// Even though the property as already been set when instantiating this call,
8552 /// we provide this method for API completeness.
8553 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C> {
8554 self._name = new_value.to_string();
8555 self
8556 }
8557 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8558 /// while executing the actual API request.
8559 ///
8560 /// ````text
8561 /// It should be used to handle progress information, and to implement a certain level of resilience.
8562 /// ````
8563 ///
8564 /// Sets the *delegate* property to the given value.
8565 pub fn delegate(
8566 mut self,
8567 new_value: &'a mut dyn common::Delegate,
8568 ) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C> {
8569 self._delegate = Some(new_value);
8570 self
8571 }
8572
8573 /// Set any additional parameter of the query string used in the request.
8574 /// It should be used to set parameters which are not yet available through their own
8575 /// setters.
8576 ///
8577 /// Please note that this method must not be used to set any of the known parameters
8578 /// which have their own setter method. If done anyway, the request will fail.
8579 ///
8580 /// # Additional Parameters
8581 ///
8582 /// * *$.xgafv* (query-string) - V1 error format.
8583 /// * *access_token* (query-string) - OAuth access token.
8584 /// * *alt* (query-string) - Data format for response.
8585 /// * *callback* (query-string) - JSONP
8586 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8587 /// * *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.
8588 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8589 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8590 /// * *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.
8591 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8592 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8593 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C>
8594 where
8595 T: AsRef<str>,
8596 {
8597 self._additional_params
8598 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8599 self
8600 }
8601
8602 /// Identifies the authorization scope for the method you are building.
8603 ///
8604 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8605 /// [`Scope::CloudPlatform`].
8606 ///
8607 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8608 /// tokens for more than one scope.
8609 ///
8610 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8611 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8612 /// sufficient, a read-write scope will do as well.
8613 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C>
8614 where
8615 St: AsRef<str>,
8616 {
8617 self._scopes.insert(String::from(scope.as_ref()));
8618 self
8619 }
8620 /// Identifies the authorization scope(s) for the method you are building.
8621 ///
8622 /// See [`Self::add_scope()`] for details.
8623 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C>
8624 where
8625 I: IntoIterator<Item = St>,
8626 St: AsRef<str>,
8627 {
8628 self._scopes
8629 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8630 self
8631 }
8632
8633 /// Removes all scopes, and no default scope will be used either.
8634 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8635 /// for details).
8636 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubAcceptSpokeCall<'a, C> {
8637 self._scopes.clear();
8638 self
8639 }
8640}
8641
8642/// Accepts a proposal to update a Network Connectivity Center spoke in a hub.
8643///
8644/// A builder for the *locations.global.hubs.acceptSpokeUpdate* method supported by a *project* resource.
8645/// It is not used directly, but through a [`ProjectMethods`] instance.
8646///
8647/// # Example
8648///
8649/// Instantiate a resource method builder
8650///
8651/// ```test_harness,no_run
8652/// # extern crate hyper;
8653/// # extern crate hyper_rustls;
8654/// # extern crate google_networkconnectivity1 as networkconnectivity1;
8655/// use networkconnectivity1::api::AcceptSpokeUpdateRequest;
8656/// # async fn dox() {
8657/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8658///
8659/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8660/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8661/// # .with_native_roots()
8662/// # .unwrap()
8663/// # .https_only()
8664/// # .enable_http2()
8665/// # .build();
8666///
8667/// # let executor = hyper_util::rt::TokioExecutor::new();
8668/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8669/// # secret,
8670/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8671/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8672/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8673/// # ),
8674/// # ).build().await.unwrap();
8675///
8676/// # let client = hyper_util::client::legacy::Client::builder(
8677/// # hyper_util::rt::TokioExecutor::new()
8678/// # )
8679/// # .build(
8680/// # hyper_rustls::HttpsConnectorBuilder::new()
8681/// # .with_native_roots()
8682/// # .unwrap()
8683/// # .https_or_http()
8684/// # .enable_http2()
8685/// # .build()
8686/// # );
8687/// # let mut hub = Networkconnectivity::new(client, auth);
8688/// // As the method needs a request, you would usually fill it with the desired information
8689/// // into the respective structure. Some of the parts shown here might not be applicable !
8690/// // Values shown here are possibly random and not representative !
8691/// let mut req = AcceptSpokeUpdateRequest::default();
8692///
8693/// // You can configure optional parameters by calling the respective setters at will, and
8694/// // execute the final call using `doit()`.
8695/// // Values shown here are possibly random and not representative !
8696/// let result = hub.projects().locations_global_hubs_accept_spoke_update(req, "name")
8697/// .doit().await;
8698/// # }
8699/// ```
8700pub struct ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C>
8701where
8702 C: 'a,
8703{
8704 hub: &'a Networkconnectivity<C>,
8705 _request: AcceptSpokeUpdateRequest,
8706 _name: String,
8707 _delegate: Option<&'a mut dyn common::Delegate>,
8708 _additional_params: HashMap<String, String>,
8709 _scopes: BTreeSet<String>,
8710}
8711
8712impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C> {}
8713
8714impl<'a, C> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C>
8715where
8716 C: common::Connector,
8717{
8718 /// Perform the operation you have build so far.
8719 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
8720 use std::borrow::Cow;
8721 use std::io::{Read, Seek};
8722
8723 use common::{url::Params, ToParts};
8724 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8725
8726 let mut dd = common::DefaultDelegate;
8727 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8728 dlg.begin(common::MethodInfo {
8729 id: "networkconnectivity.projects.locations.global.hubs.acceptSpokeUpdate",
8730 http_method: hyper::Method::POST,
8731 });
8732
8733 for &field in ["alt", "name"].iter() {
8734 if self._additional_params.contains_key(field) {
8735 dlg.finished(false);
8736 return Err(common::Error::FieldClash(field));
8737 }
8738 }
8739
8740 let mut params = Params::with_capacity(4 + self._additional_params.len());
8741 params.push("name", self._name);
8742
8743 params.extend(self._additional_params.iter());
8744
8745 params.push("alt", "json");
8746 let mut url = self.hub._base_url.clone() + "v1/{+name}:acceptSpokeUpdate";
8747 if self._scopes.is_empty() {
8748 self._scopes
8749 .insert(Scope::CloudPlatform.as_ref().to_string());
8750 }
8751
8752 #[allow(clippy::single_element_loop)]
8753 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8754 url = params.uri_replacement(url, param_name, find_this, true);
8755 }
8756 {
8757 let to_remove = ["name"];
8758 params.remove_params(&to_remove);
8759 }
8760
8761 let url = params.parse_with_url(&url);
8762
8763 let mut json_mime_type = mime::APPLICATION_JSON;
8764 let mut request_value_reader = {
8765 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8766 common::remove_json_null_values(&mut value);
8767 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8768 serde_json::to_writer(&mut dst, &value).unwrap();
8769 dst
8770 };
8771 let request_size = request_value_reader
8772 .seek(std::io::SeekFrom::End(0))
8773 .unwrap();
8774 request_value_reader
8775 .seek(std::io::SeekFrom::Start(0))
8776 .unwrap();
8777
8778 loop {
8779 let token = match self
8780 .hub
8781 .auth
8782 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8783 .await
8784 {
8785 Ok(token) => token,
8786 Err(e) => match dlg.token(e) {
8787 Ok(token) => token,
8788 Err(e) => {
8789 dlg.finished(false);
8790 return Err(common::Error::MissingToken(e));
8791 }
8792 },
8793 };
8794 request_value_reader
8795 .seek(std::io::SeekFrom::Start(0))
8796 .unwrap();
8797 let mut req_result = {
8798 let client = &self.hub.client;
8799 dlg.pre_request();
8800 let mut req_builder = hyper::Request::builder()
8801 .method(hyper::Method::POST)
8802 .uri(url.as_str())
8803 .header(USER_AGENT, self.hub._user_agent.clone());
8804
8805 if let Some(token) = token.as_ref() {
8806 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8807 }
8808
8809 let request = req_builder
8810 .header(CONTENT_TYPE, json_mime_type.to_string())
8811 .header(CONTENT_LENGTH, request_size as u64)
8812 .body(common::to_body(
8813 request_value_reader.get_ref().clone().into(),
8814 ));
8815
8816 client.request(request.unwrap()).await
8817 };
8818
8819 match req_result {
8820 Err(err) => {
8821 if let common::Retry::After(d) = dlg.http_error(&err) {
8822 sleep(d).await;
8823 continue;
8824 }
8825 dlg.finished(false);
8826 return Err(common::Error::HttpError(err));
8827 }
8828 Ok(res) => {
8829 let (mut parts, body) = res.into_parts();
8830 let mut body = common::Body::new(body);
8831 if !parts.status.is_success() {
8832 let bytes = common::to_bytes(body).await.unwrap_or_default();
8833 let error = serde_json::from_str(&common::to_string(&bytes));
8834 let response = common::to_response(parts, bytes.into());
8835
8836 if let common::Retry::After(d) =
8837 dlg.http_failure(&response, error.as_ref().ok())
8838 {
8839 sleep(d).await;
8840 continue;
8841 }
8842
8843 dlg.finished(false);
8844
8845 return Err(match error {
8846 Ok(value) => common::Error::BadRequest(value),
8847 _ => common::Error::Failure(response),
8848 });
8849 }
8850 let response = {
8851 let bytes = common::to_bytes(body).await.unwrap_or_default();
8852 let encoded = common::to_string(&bytes);
8853 match serde_json::from_str(&encoded) {
8854 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8855 Err(error) => {
8856 dlg.response_json_decode_error(&encoded, &error);
8857 return Err(common::Error::JsonDecodeError(
8858 encoded.to_string(),
8859 error,
8860 ));
8861 }
8862 }
8863 };
8864
8865 dlg.finished(true);
8866 return Ok(response);
8867 }
8868 }
8869 }
8870 }
8871
8872 ///
8873 /// Sets the *request* property to the given value.
8874 ///
8875 /// Even though the property as already been set when instantiating this call,
8876 /// we provide this method for API completeness.
8877 pub fn request(
8878 mut self,
8879 new_value: AcceptSpokeUpdateRequest,
8880 ) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C> {
8881 self._request = new_value;
8882 self
8883 }
8884 /// Required. The name of the hub to accept spoke update.
8885 ///
8886 /// Sets the *name* path property to the given value.
8887 ///
8888 /// Even though the property as already been set when instantiating this call,
8889 /// we provide this method for API completeness.
8890 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C> {
8891 self._name = new_value.to_string();
8892 self
8893 }
8894 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8895 /// while executing the actual API request.
8896 ///
8897 /// ````text
8898 /// It should be used to handle progress information, and to implement a certain level of resilience.
8899 /// ````
8900 ///
8901 /// Sets the *delegate* property to the given value.
8902 pub fn delegate(
8903 mut self,
8904 new_value: &'a mut dyn common::Delegate,
8905 ) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C> {
8906 self._delegate = Some(new_value);
8907 self
8908 }
8909
8910 /// Set any additional parameter of the query string used in the request.
8911 /// It should be used to set parameters which are not yet available through their own
8912 /// setters.
8913 ///
8914 /// Please note that this method must not be used to set any of the known parameters
8915 /// which have their own setter method. If done anyway, the request will fail.
8916 ///
8917 /// # Additional Parameters
8918 ///
8919 /// * *$.xgafv* (query-string) - V1 error format.
8920 /// * *access_token* (query-string) - OAuth access token.
8921 /// * *alt* (query-string) - Data format for response.
8922 /// * *callback* (query-string) - JSONP
8923 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8924 /// * *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.
8925 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8926 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8927 /// * *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.
8928 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8929 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8930 pub fn param<T>(
8931 mut self,
8932 name: T,
8933 value: T,
8934 ) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C>
8935 where
8936 T: AsRef<str>,
8937 {
8938 self._additional_params
8939 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8940 self
8941 }
8942
8943 /// Identifies the authorization scope for the method you are building.
8944 ///
8945 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8946 /// [`Scope::CloudPlatform`].
8947 ///
8948 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8949 /// tokens for more than one scope.
8950 ///
8951 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8952 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8953 /// sufficient, a read-write scope will do as well.
8954 pub fn add_scope<St>(
8955 mut self,
8956 scope: St,
8957 ) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C>
8958 where
8959 St: AsRef<str>,
8960 {
8961 self._scopes.insert(String::from(scope.as_ref()));
8962 self
8963 }
8964 /// Identifies the authorization scope(s) for the method you are building.
8965 ///
8966 /// See [`Self::add_scope()`] for details.
8967 pub fn add_scopes<I, St>(
8968 mut self,
8969 scopes: I,
8970 ) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C>
8971 where
8972 I: IntoIterator<Item = St>,
8973 St: AsRef<str>,
8974 {
8975 self._scopes
8976 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8977 self
8978 }
8979
8980 /// Removes all scopes, and no default scope will be used either.
8981 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8982 /// for details).
8983 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubAcceptSpokeUpdateCall<'a, C> {
8984 self._scopes.clear();
8985 self
8986 }
8987}
8988
8989/// Creates a new Network Connectivity Center hub in the specified project.
8990///
8991/// A builder for the *locations.global.hubs.create* method supported by a *project* resource.
8992/// It is not used directly, but through a [`ProjectMethods`] instance.
8993///
8994/// # Example
8995///
8996/// Instantiate a resource method builder
8997///
8998/// ```test_harness,no_run
8999/// # extern crate hyper;
9000/// # extern crate hyper_rustls;
9001/// # extern crate google_networkconnectivity1 as networkconnectivity1;
9002/// use networkconnectivity1::api::Hub;
9003/// # async fn dox() {
9004/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9005///
9006/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9007/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9008/// # .with_native_roots()
9009/// # .unwrap()
9010/// # .https_only()
9011/// # .enable_http2()
9012/// # .build();
9013///
9014/// # let executor = hyper_util::rt::TokioExecutor::new();
9015/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9016/// # secret,
9017/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9018/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9019/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9020/// # ),
9021/// # ).build().await.unwrap();
9022///
9023/// # let client = hyper_util::client::legacy::Client::builder(
9024/// # hyper_util::rt::TokioExecutor::new()
9025/// # )
9026/// # .build(
9027/// # hyper_rustls::HttpsConnectorBuilder::new()
9028/// # .with_native_roots()
9029/// # .unwrap()
9030/// # .https_or_http()
9031/// # .enable_http2()
9032/// # .build()
9033/// # );
9034/// # let mut hub = Networkconnectivity::new(client, auth);
9035/// // As the method needs a request, you would usually fill it with the desired information
9036/// // into the respective structure. Some of the parts shown here might not be applicable !
9037/// // Values shown here are possibly random and not representative !
9038/// let mut req = Hub::default();
9039///
9040/// // You can configure optional parameters by calling the respective setters at will, and
9041/// // execute the final call using `doit()`.
9042/// // Values shown here are possibly random and not representative !
9043/// let result = hub.projects().locations_global_hubs_create(req, "parent")
9044/// .request_id("vero")
9045/// .hub_id("erat")
9046/// .doit().await;
9047/// # }
9048/// ```
9049pub struct ProjectLocationGlobalHubCreateCall<'a, C>
9050where
9051 C: 'a,
9052{
9053 hub: &'a Networkconnectivity<C>,
9054 _request: Hub,
9055 _parent: String,
9056 _request_id: Option<String>,
9057 _hub_id: Option<String>,
9058 _delegate: Option<&'a mut dyn common::Delegate>,
9059 _additional_params: HashMap<String, String>,
9060 _scopes: BTreeSet<String>,
9061}
9062
9063impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubCreateCall<'a, C> {}
9064
9065impl<'a, C> ProjectLocationGlobalHubCreateCall<'a, C>
9066where
9067 C: common::Connector,
9068{
9069 /// Perform the operation you have build so far.
9070 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
9071 use std::borrow::Cow;
9072 use std::io::{Read, Seek};
9073
9074 use common::{url::Params, ToParts};
9075 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9076
9077 let mut dd = common::DefaultDelegate;
9078 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9079 dlg.begin(common::MethodInfo {
9080 id: "networkconnectivity.projects.locations.global.hubs.create",
9081 http_method: hyper::Method::POST,
9082 });
9083
9084 for &field in ["alt", "parent", "requestId", "hubId"].iter() {
9085 if self._additional_params.contains_key(field) {
9086 dlg.finished(false);
9087 return Err(common::Error::FieldClash(field));
9088 }
9089 }
9090
9091 let mut params = Params::with_capacity(6 + self._additional_params.len());
9092 params.push("parent", self._parent);
9093 if let Some(value) = self._request_id.as_ref() {
9094 params.push("requestId", value);
9095 }
9096 if let Some(value) = self._hub_id.as_ref() {
9097 params.push("hubId", value);
9098 }
9099
9100 params.extend(self._additional_params.iter());
9101
9102 params.push("alt", "json");
9103 let mut url = self.hub._base_url.clone() + "v1/{+parent}/hubs";
9104 if self._scopes.is_empty() {
9105 self._scopes
9106 .insert(Scope::CloudPlatform.as_ref().to_string());
9107 }
9108
9109 #[allow(clippy::single_element_loop)]
9110 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9111 url = params.uri_replacement(url, param_name, find_this, true);
9112 }
9113 {
9114 let to_remove = ["parent"];
9115 params.remove_params(&to_remove);
9116 }
9117
9118 let url = params.parse_with_url(&url);
9119
9120 let mut json_mime_type = mime::APPLICATION_JSON;
9121 let mut request_value_reader = {
9122 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9123 common::remove_json_null_values(&mut value);
9124 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9125 serde_json::to_writer(&mut dst, &value).unwrap();
9126 dst
9127 };
9128 let request_size = request_value_reader
9129 .seek(std::io::SeekFrom::End(0))
9130 .unwrap();
9131 request_value_reader
9132 .seek(std::io::SeekFrom::Start(0))
9133 .unwrap();
9134
9135 loop {
9136 let token = match self
9137 .hub
9138 .auth
9139 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9140 .await
9141 {
9142 Ok(token) => token,
9143 Err(e) => match dlg.token(e) {
9144 Ok(token) => token,
9145 Err(e) => {
9146 dlg.finished(false);
9147 return Err(common::Error::MissingToken(e));
9148 }
9149 },
9150 };
9151 request_value_reader
9152 .seek(std::io::SeekFrom::Start(0))
9153 .unwrap();
9154 let mut req_result = {
9155 let client = &self.hub.client;
9156 dlg.pre_request();
9157 let mut req_builder = hyper::Request::builder()
9158 .method(hyper::Method::POST)
9159 .uri(url.as_str())
9160 .header(USER_AGENT, self.hub._user_agent.clone());
9161
9162 if let Some(token) = token.as_ref() {
9163 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9164 }
9165
9166 let request = req_builder
9167 .header(CONTENT_TYPE, json_mime_type.to_string())
9168 .header(CONTENT_LENGTH, request_size as u64)
9169 .body(common::to_body(
9170 request_value_reader.get_ref().clone().into(),
9171 ));
9172
9173 client.request(request.unwrap()).await
9174 };
9175
9176 match req_result {
9177 Err(err) => {
9178 if let common::Retry::After(d) = dlg.http_error(&err) {
9179 sleep(d).await;
9180 continue;
9181 }
9182 dlg.finished(false);
9183 return Err(common::Error::HttpError(err));
9184 }
9185 Ok(res) => {
9186 let (mut parts, body) = res.into_parts();
9187 let mut body = common::Body::new(body);
9188 if !parts.status.is_success() {
9189 let bytes = common::to_bytes(body).await.unwrap_or_default();
9190 let error = serde_json::from_str(&common::to_string(&bytes));
9191 let response = common::to_response(parts, bytes.into());
9192
9193 if let common::Retry::After(d) =
9194 dlg.http_failure(&response, error.as_ref().ok())
9195 {
9196 sleep(d).await;
9197 continue;
9198 }
9199
9200 dlg.finished(false);
9201
9202 return Err(match error {
9203 Ok(value) => common::Error::BadRequest(value),
9204 _ => common::Error::Failure(response),
9205 });
9206 }
9207 let response = {
9208 let bytes = common::to_bytes(body).await.unwrap_or_default();
9209 let encoded = common::to_string(&bytes);
9210 match serde_json::from_str(&encoded) {
9211 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9212 Err(error) => {
9213 dlg.response_json_decode_error(&encoded, &error);
9214 return Err(common::Error::JsonDecodeError(
9215 encoded.to_string(),
9216 error,
9217 ));
9218 }
9219 }
9220 };
9221
9222 dlg.finished(true);
9223 return Ok(response);
9224 }
9225 }
9226 }
9227 }
9228
9229 ///
9230 /// Sets the *request* property to the given value.
9231 ///
9232 /// Even though the property as already been set when instantiating this call,
9233 /// we provide this method for API completeness.
9234 pub fn request(mut self, new_value: Hub) -> ProjectLocationGlobalHubCreateCall<'a, C> {
9235 self._request = new_value;
9236 self
9237 }
9238 /// Required. The parent resource.
9239 ///
9240 /// Sets the *parent* path property to the given value.
9241 ///
9242 /// Even though the property as already been set when instantiating this call,
9243 /// we provide this method for API completeness.
9244 pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalHubCreateCall<'a, C> {
9245 self._parent = new_value.to_string();
9246 self
9247 }
9248 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
9249 ///
9250 /// Sets the *request id* query property to the given value.
9251 pub fn request_id(mut self, new_value: &str) -> ProjectLocationGlobalHubCreateCall<'a, C> {
9252 self._request_id = Some(new_value.to_string());
9253 self
9254 }
9255 /// Required. A unique identifier for the hub.
9256 ///
9257 /// Sets the *hub id* query property to the given value.
9258 pub fn hub_id(mut self, new_value: &str) -> ProjectLocationGlobalHubCreateCall<'a, C> {
9259 self._hub_id = Some(new_value.to_string());
9260 self
9261 }
9262 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9263 /// while executing the actual API request.
9264 ///
9265 /// ````text
9266 /// It should be used to handle progress information, and to implement a certain level of resilience.
9267 /// ````
9268 ///
9269 /// Sets the *delegate* property to the given value.
9270 pub fn delegate(
9271 mut self,
9272 new_value: &'a mut dyn common::Delegate,
9273 ) -> ProjectLocationGlobalHubCreateCall<'a, C> {
9274 self._delegate = Some(new_value);
9275 self
9276 }
9277
9278 /// Set any additional parameter of the query string used in the request.
9279 /// It should be used to set parameters which are not yet available through their own
9280 /// setters.
9281 ///
9282 /// Please note that this method must not be used to set any of the known parameters
9283 /// which have their own setter method. If done anyway, the request will fail.
9284 ///
9285 /// # Additional Parameters
9286 ///
9287 /// * *$.xgafv* (query-string) - V1 error format.
9288 /// * *access_token* (query-string) - OAuth access token.
9289 /// * *alt* (query-string) - Data format for response.
9290 /// * *callback* (query-string) - JSONP
9291 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9292 /// * *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.
9293 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9294 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9295 /// * *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.
9296 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9297 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9298 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubCreateCall<'a, C>
9299 where
9300 T: AsRef<str>,
9301 {
9302 self._additional_params
9303 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9304 self
9305 }
9306
9307 /// Identifies the authorization scope for the method you are building.
9308 ///
9309 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9310 /// [`Scope::CloudPlatform`].
9311 ///
9312 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9313 /// tokens for more than one scope.
9314 ///
9315 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9316 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9317 /// sufficient, a read-write scope will do as well.
9318 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubCreateCall<'a, C>
9319 where
9320 St: AsRef<str>,
9321 {
9322 self._scopes.insert(String::from(scope.as_ref()));
9323 self
9324 }
9325 /// Identifies the authorization scope(s) for the method you are building.
9326 ///
9327 /// See [`Self::add_scope()`] for details.
9328 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubCreateCall<'a, C>
9329 where
9330 I: IntoIterator<Item = St>,
9331 St: AsRef<str>,
9332 {
9333 self._scopes
9334 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9335 self
9336 }
9337
9338 /// Removes all scopes, and no default scope will be used either.
9339 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9340 /// for details).
9341 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubCreateCall<'a, C> {
9342 self._scopes.clear();
9343 self
9344 }
9345}
9346
9347/// Deletes a Network Connectivity Center hub.
9348///
9349/// A builder for the *locations.global.hubs.delete* method supported by a *project* resource.
9350/// It is not used directly, but through a [`ProjectMethods`] instance.
9351///
9352/// # Example
9353///
9354/// Instantiate a resource method builder
9355///
9356/// ```test_harness,no_run
9357/// # extern crate hyper;
9358/// # extern crate hyper_rustls;
9359/// # extern crate google_networkconnectivity1 as networkconnectivity1;
9360/// # async fn dox() {
9361/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9362///
9363/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9364/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9365/// # .with_native_roots()
9366/// # .unwrap()
9367/// # .https_only()
9368/// # .enable_http2()
9369/// # .build();
9370///
9371/// # let executor = hyper_util::rt::TokioExecutor::new();
9372/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9373/// # secret,
9374/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9375/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9376/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9377/// # ),
9378/// # ).build().await.unwrap();
9379///
9380/// # let client = hyper_util::client::legacy::Client::builder(
9381/// # hyper_util::rt::TokioExecutor::new()
9382/// # )
9383/// # .build(
9384/// # hyper_rustls::HttpsConnectorBuilder::new()
9385/// # .with_native_roots()
9386/// # .unwrap()
9387/// # .https_or_http()
9388/// # .enable_http2()
9389/// # .build()
9390/// # );
9391/// # let mut hub = Networkconnectivity::new(client, auth);
9392/// // You can configure optional parameters by calling the respective setters at will, and
9393/// // execute the final call using `doit()`.
9394/// // Values shown here are possibly random and not representative !
9395/// let result = hub.projects().locations_global_hubs_delete("name")
9396/// .request_id("duo")
9397/// .doit().await;
9398/// # }
9399/// ```
9400pub struct ProjectLocationGlobalHubDeleteCall<'a, C>
9401where
9402 C: 'a,
9403{
9404 hub: &'a Networkconnectivity<C>,
9405 _name: String,
9406 _request_id: Option<String>,
9407 _delegate: Option<&'a mut dyn common::Delegate>,
9408 _additional_params: HashMap<String, String>,
9409 _scopes: BTreeSet<String>,
9410}
9411
9412impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubDeleteCall<'a, C> {}
9413
9414impl<'a, C> ProjectLocationGlobalHubDeleteCall<'a, C>
9415where
9416 C: common::Connector,
9417{
9418 /// Perform the operation you have build so far.
9419 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
9420 use std::borrow::Cow;
9421 use std::io::{Read, Seek};
9422
9423 use common::{url::Params, ToParts};
9424 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9425
9426 let mut dd = common::DefaultDelegate;
9427 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9428 dlg.begin(common::MethodInfo {
9429 id: "networkconnectivity.projects.locations.global.hubs.delete",
9430 http_method: hyper::Method::DELETE,
9431 });
9432
9433 for &field in ["alt", "name", "requestId"].iter() {
9434 if self._additional_params.contains_key(field) {
9435 dlg.finished(false);
9436 return Err(common::Error::FieldClash(field));
9437 }
9438 }
9439
9440 let mut params = Params::with_capacity(4 + self._additional_params.len());
9441 params.push("name", self._name);
9442 if let Some(value) = self._request_id.as_ref() {
9443 params.push("requestId", value);
9444 }
9445
9446 params.extend(self._additional_params.iter());
9447
9448 params.push("alt", "json");
9449 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9450 if self._scopes.is_empty() {
9451 self._scopes
9452 .insert(Scope::CloudPlatform.as_ref().to_string());
9453 }
9454
9455 #[allow(clippy::single_element_loop)]
9456 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9457 url = params.uri_replacement(url, param_name, find_this, true);
9458 }
9459 {
9460 let to_remove = ["name"];
9461 params.remove_params(&to_remove);
9462 }
9463
9464 let url = params.parse_with_url(&url);
9465
9466 loop {
9467 let token = match self
9468 .hub
9469 .auth
9470 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9471 .await
9472 {
9473 Ok(token) => token,
9474 Err(e) => match dlg.token(e) {
9475 Ok(token) => token,
9476 Err(e) => {
9477 dlg.finished(false);
9478 return Err(common::Error::MissingToken(e));
9479 }
9480 },
9481 };
9482 let mut req_result = {
9483 let client = &self.hub.client;
9484 dlg.pre_request();
9485 let mut req_builder = hyper::Request::builder()
9486 .method(hyper::Method::DELETE)
9487 .uri(url.as_str())
9488 .header(USER_AGENT, self.hub._user_agent.clone());
9489
9490 if let Some(token) = token.as_ref() {
9491 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9492 }
9493
9494 let request = req_builder
9495 .header(CONTENT_LENGTH, 0_u64)
9496 .body(common::to_body::<String>(None));
9497
9498 client.request(request.unwrap()).await
9499 };
9500
9501 match req_result {
9502 Err(err) => {
9503 if let common::Retry::After(d) = dlg.http_error(&err) {
9504 sleep(d).await;
9505 continue;
9506 }
9507 dlg.finished(false);
9508 return Err(common::Error::HttpError(err));
9509 }
9510 Ok(res) => {
9511 let (mut parts, body) = res.into_parts();
9512 let mut body = common::Body::new(body);
9513 if !parts.status.is_success() {
9514 let bytes = common::to_bytes(body).await.unwrap_or_default();
9515 let error = serde_json::from_str(&common::to_string(&bytes));
9516 let response = common::to_response(parts, bytes.into());
9517
9518 if let common::Retry::After(d) =
9519 dlg.http_failure(&response, error.as_ref().ok())
9520 {
9521 sleep(d).await;
9522 continue;
9523 }
9524
9525 dlg.finished(false);
9526
9527 return Err(match error {
9528 Ok(value) => common::Error::BadRequest(value),
9529 _ => common::Error::Failure(response),
9530 });
9531 }
9532 let response = {
9533 let bytes = common::to_bytes(body).await.unwrap_or_default();
9534 let encoded = common::to_string(&bytes);
9535 match serde_json::from_str(&encoded) {
9536 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9537 Err(error) => {
9538 dlg.response_json_decode_error(&encoded, &error);
9539 return Err(common::Error::JsonDecodeError(
9540 encoded.to_string(),
9541 error,
9542 ));
9543 }
9544 }
9545 };
9546
9547 dlg.finished(true);
9548 return Ok(response);
9549 }
9550 }
9551 }
9552 }
9553
9554 /// Required. The name of the hub to delete.
9555 ///
9556 /// Sets the *name* path property to the given value.
9557 ///
9558 /// Even though the property as already been set when instantiating this call,
9559 /// we provide this method for API completeness.
9560 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubDeleteCall<'a, C> {
9561 self._name = new_value.to_string();
9562 self
9563 }
9564 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
9565 ///
9566 /// Sets the *request id* query property to the given value.
9567 pub fn request_id(mut self, new_value: &str) -> ProjectLocationGlobalHubDeleteCall<'a, C> {
9568 self._request_id = Some(new_value.to_string());
9569 self
9570 }
9571 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9572 /// while executing the actual API request.
9573 ///
9574 /// ````text
9575 /// It should be used to handle progress information, and to implement a certain level of resilience.
9576 /// ````
9577 ///
9578 /// Sets the *delegate* property to the given value.
9579 pub fn delegate(
9580 mut self,
9581 new_value: &'a mut dyn common::Delegate,
9582 ) -> ProjectLocationGlobalHubDeleteCall<'a, C> {
9583 self._delegate = Some(new_value);
9584 self
9585 }
9586
9587 /// Set any additional parameter of the query string used in the request.
9588 /// It should be used to set parameters which are not yet available through their own
9589 /// setters.
9590 ///
9591 /// Please note that this method must not be used to set any of the known parameters
9592 /// which have their own setter method. If done anyway, the request will fail.
9593 ///
9594 /// # Additional Parameters
9595 ///
9596 /// * *$.xgafv* (query-string) - V1 error format.
9597 /// * *access_token* (query-string) - OAuth access token.
9598 /// * *alt* (query-string) - Data format for response.
9599 /// * *callback* (query-string) - JSONP
9600 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9601 /// * *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.
9602 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9603 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9604 /// * *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.
9605 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9606 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9607 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubDeleteCall<'a, C>
9608 where
9609 T: AsRef<str>,
9610 {
9611 self._additional_params
9612 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9613 self
9614 }
9615
9616 /// Identifies the authorization scope for the method you are building.
9617 ///
9618 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9619 /// [`Scope::CloudPlatform`].
9620 ///
9621 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9622 /// tokens for more than one scope.
9623 ///
9624 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9625 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9626 /// sufficient, a read-write scope will do as well.
9627 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubDeleteCall<'a, C>
9628 where
9629 St: AsRef<str>,
9630 {
9631 self._scopes.insert(String::from(scope.as_ref()));
9632 self
9633 }
9634 /// Identifies the authorization scope(s) for the method you are building.
9635 ///
9636 /// See [`Self::add_scope()`] for details.
9637 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubDeleteCall<'a, C>
9638 where
9639 I: IntoIterator<Item = St>,
9640 St: AsRef<str>,
9641 {
9642 self._scopes
9643 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9644 self
9645 }
9646
9647 /// Removes all scopes, and no default scope will be used either.
9648 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9649 /// for details).
9650 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubDeleteCall<'a, C> {
9651 self._scopes.clear();
9652 self
9653 }
9654}
9655
9656/// Gets details about a Network Connectivity Center hub.
9657///
9658/// A builder for the *locations.global.hubs.get* method supported by a *project* resource.
9659/// It is not used directly, but through a [`ProjectMethods`] instance.
9660///
9661/// # Example
9662///
9663/// Instantiate a resource method builder
9664///
9665/// ```test_harness,no_run
9666/// # extern crate hyper;
9667/// # extern crate hyper_rustls;
9668/// # extern crate google_networkconnectivity1 as networkconnectivity1;
9669/// # async fn dox() {
9670/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9671///
9672/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9673/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9674/// # .with_native_roots()
9675/// # .unwrap()
9676/// # .https_only()
9677/// # .enable_http2()
9678/// # .build();
9679///
9680/// # let executor = hyper_util::rt::TokioExecutor::new();
9681/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9682/// # secret,
9683/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9684/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9685/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9686/// # ),
9687/// # ).build().await.unwrap();
9688///
9689/// # let client = hyper_util::client::legacy::Client::builder(
9690/// # hyper_util::rt::TokioExecutor::new()
9691/// # )
9692/// # .build(
9693/// # hyper_rustls::HttpsConnectorBuilder::new()
9694/// # .with_native_roots()
9695/// # .unwrap()
9696/// # .https_or_http()
9697/// # .enable_http2()
9698/// # .build()
9699/// # );
9700/// # let mut hub = Networkconnectivity::new(client, auth);
9701/// // You can configure optional parameters by calling the respective setters at will, and
9702/// // execute the final call using `doit()`.
9703/// // Values shown here are possibly random and not representative !
9704/// let result = hub.projects().locations_global_hubs_get("name")
9705/// .doit().await;
9706/// # }
9707/// ```
9708pub struct ProjectLocationGlobalHubGetCall<'a, C>
9709where
9710 C: 'a,
9711{
9712 hub: &'a Networkconnectivity<C>,
9713 _name: String,
9714 _delegate: Option<&'a mut dyn common::Delegate>,
9715 _additional_params: HashMap<String, String>,
9716 _scopes: BTreeSet<String>,
9717}
9718
9719impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGetCall<'a, C> {}
9720
9721impl<'a, C> ProjectLocationGlobalHubGetCall<'a, C>
9722where
9723 C: common::Connector,
9724{
9725 /// Perform the operation you have build so far.
9726 pub async fn doit(mut self) -> common::Result<(common::Response, Hub)> {
9727 use std::borrow::Cow;
9728 use std::io::{Read, Seek};
9729
9730 use common::{url::Params, ToParts};
9731 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9732
9733 let mut dd = common::DefaultDelegate;
9734 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9735 dlg.begin(common::MethodInfo {
9736 id: "networkconnectivity.projects.locations.global.hubs.get",
9737 http_method: hyper::Method::GET,
9738 });
9739
9740 for &field in ["alt", "name"].iter() {
9741 if self._additional_params.contains_key(field) {
9742 dlg.finished(false);
9743 return Err(common::Error::FieldClash(field));
9744 }
9745 }
9746
9747 let mut params = Params::with_capacity(3 + self._additional_params.len());
9748 params.push("name", self._name);
9749
9750 params.extend(self._additional_params.iter());
9751
9752 params.push("alt", "json");
9753 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9754 if self._scopes.is_empty() {
9755 self._scopes
9756 .insert(Scope::CloudPlatform.as_ref().to_string());
9757 }
9758
9759 #[allow(clippy::single_element_loop)]
9760 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9761 url = params.uri_replacement(url, param_name, find_this, true);
9762 }
9763 {
9764 let to_remove = ["name"];
9765 params.remove_params(&to_remove);
9766 }
9767
9768 let url = params.parse_with_url(&url);
9769
9770 loop {
9771 let token = match self
9772 .hub
9773 .auth
9774 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9775 .await
9776 {
9777 Ok(token) => token,
9778 Err(e) => match dlg.token(e) {
9779 Ok(token) => token,
9780 Err(e) => {
9781 dlg.finished(false);
9782 return Err(common::Error::MissingToken(e));
9783 }
9784 },
9785 };
9786 let mut req_result = {
9787 let client = &self.hub.client;
9788 dlg.pre_request();
9789 let mut req_builder = hyper::Request::builder()
9790 .method(hyper::Method::GET)
9791 .uri(url.as_str())
9792 .header(USER_AGENT, self.hub._user_agent.clone());
9793
9794 if let Some(token) = token.as_ref() {
9795 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9796 }
9797
9798 let request = req_builder
9799 .header(CONTENT_LENGTH, 0_u64)
9800 .body(common::to_body::<String>(None));
9801
9802 client.request(request.unwrap()).await
9803 };
9804
9805 match req_result {
9806 Err(err) => {
9807 if let common::Retry::After(d) = dlg.http_error(&err) {
9808 sleep(d).await;
9809 continue;
9810 }
9811 dlg.finished(false);
9812 return Err(common::Error::HttpError(err));
9813 }
9814 Ok(res) => {
9815 let (mut parts, body) = res.into_parts();
9816 let mut body = common::Body::new(body);
9817 if !parts.status.is_success() {
9818 let bytes = common::to_bytes(body).await.unwrap_or_default();
9819 let error = serde_json::from_str(&common::to_string(&bytes));
9820 let response = common::to_response(parts, bytes.into());
9821
9822 if let common::Retry::After(d) =
9823 dlg.http_failure(&response, error.as_ref().ok())
9824 {
9825 sleep(d).await;
9826 continue;
9827 }
9828
9829 dlg.finished(false);
9830
9831 return Err(match error {
9832 Ok(value) => common::Error::BadRequest(value),
9833 _ => common::Error::Failure(response),
9834 });
9835 }
9836 let response = {
9837 let bytes = common::to_bytes(body).await.unwrap_or_default();
9838 let encoded = common::to_string(&bytes);
9839 match serde_json::from_str(&encoded) {
9840 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9841 Err(error) => {
9842 dlg.response_json_decode_error(&encoded, &error);
9843 return Err(common::Error::JsonDecodeError(
9844 encoded.to_string(),
9845 error,
9846 ));
9847 }
9848 }
9849 };
9850
9851 dlg.finished(true);
9852 return Ok(response);
9853 }
9854 }
9855 }
9856 }
9857
9858 /// Required. The name of the hub resource to get.
9859 ///
9860 /// Sets the *name* path property to the given value.
9861 ///
9862 /// Even though the property as already been set when instantiating this call,
9863 /// we provide this method for API completeness.
9864 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubGetCall<'a, C> {
9865 self._name = new_value.to_string();
9866 self
9867 }
9868 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9869 /// while executing the actual API request.
9870 ///
9871 /// ````text
9872 /// It should be used to handle progress information, and to implement a certain level of resilience.
9873 /// ````
9874 ///
9875 /// Sets the *delegate* property to the given value.
9876 pub fn delegate(
9877 mut self,
9878 new_value: &'a mut dyn common::Delegate,
9879 ) -> ProjectLocationGlobalHubGetCall<'a, C> {
9880 self._delegate = Some(new_value);
9881 self
9882 }
9883
9884 /// Set any additional parameter of the query string used in the request.
9885 /// It should be used to set parameters which are not yet available through their own
9886 /// setters.
9887 ///
9888 /// Please note that this method must not be used to set any of the known parameters
9889 /// which have their own setter method. If done anyway, the request will fail.
9890 ///
9891 /// # Additional Parameters
9892 ///
9893 /// * *$.xgafv* (query-string) - V1 error format.
9894 /// * *access_token* (query-string) - OAuth access token.
9895 /// * *alt* (query-string) - Data format for response.
9896 /// * *callback* (query-string) - JSONP
9897 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9898 /// * *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.
9899 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9900 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9901 /// * *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.
9902 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9903 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9904 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubGetCall<'a, C>
9905 where
9906 T: AsRef<str>,
9907 {
9908 self._additional_params
9909 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9910 self
9911 }
9912
9913 /// Identifies the authorization scope for the method you are building.
9914 ///
9915 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9916 /// [`Scope::CloudPlatform`].
9917 ///
9918 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9919 /// tokens for more than one scope.
9920 ///
9921 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9922 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9923 /// sufficient, a read-write scope will do as well.
9924 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubGetCall<'a, C>
9925 where
9926 St: AsRef<str>,
9927 {
9928 self._scopes.insert(String::from(scope.as_ref()));
9929 self
9930 }
9931 /// Identifies the authorization scope(s) for the method you are building.
9932 ///
9933 /// See [`Self::add_scope()`] for details.
9934 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubGetCall<'a, C>
9935 where
9936 I: IntoIterator<Item = St>,
9937 St: AsRef<str>,
9938 {
9939 self._scopes
9940 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9941 self
9942 }
9943
9944 /// Removes all scopes, and no default scope will be used either.
9945 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9946 /// for details).
9947 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGetCall<'a, C> {
9948 self._scopes.clear();
9949 self
9950 }
9951}
9952
9953/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
9954///
9955/// A builder for the *locations.global.hubs.getIamPolicy* method supported by a *project* resource.
9956/// It is not used directly, but through a [`ProjectMethods`] instance.
9957///
9958/// # Example
9959///
9960/// Instantiate a resource method builder
9961///
9962/// ```test_harness,no_run
9963/// # extern crate hyper;
9964/// # extern crate hyper_rustls;
9965/// # extern crate google_networkconnectivity1 as networkconnectivity1;
9966/// # async fn dox() {
9967/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9968///
9969/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9970/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9971/// # .with_native_roots()
9972/// # .unwrap()
9973/// # .https_only()
9974/// # .enable_http2()
9975/// # .build();
9976///
9977/// # let executor = hyper_util::rt::TokioExecutor::new();
9978/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9979/// # secret,
9980/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9981/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9982/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9983/// # ),
9984/// # ).build().await.unwrap();
9985///
9986/// # let client = hyper_util::client::legacy::Client::builder(
9987/// # hyper_util::rt::TokioExecutor::new()
9988/// # )
9989/// # .build(
9990/// # hyper_rustls::HttpsConnectorBuilder::new()
9991/// # .with_native_roots()
9992/// # .unwrap()
9993/// # .https_or_http()
9994/// # .enable_http2()
9995/// # .build()
9996/// # );
9997/// # let mut hub = Networkconnectivity::new(client, auth);
9998/// // You can configure optional parameters by calling the respective setters at will, and
9999/// // execute the final call using `doit()`.
10000/// // Values shown here are possibly random and not representative !
10001/// let result = hub.projects().locations_global_hubs_get_iam_policy("resource")
10002/// .options_requested_policy_version(-28)
10003/// .doit().await;
10004/// # }
10005/// ```
10006pub struct ProjectLocationGlobalHubGetIamPolicyCall<'a, C>
10007where
10008 C: 'a,
10009{
10010 hub: &'a Networkconnectivity<C>,
10011 _resource: String,
10012 _options_requested_policy_version: Option<i32>,
10013 _delegate: Option<&'a mut dyn common::Delegate>,
10014 _additional_params: HashMap<String, String>,
10015 _scopes: BTreeSet<String>,
10016}
10017
10018impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubGetIamPolicyCall<'a, C> {}
10019
10020impl<'a, C> ProjectLocationGlobalHubGetIamPolicyCall<'a, C>
10021where
10022 C: common::Connector,
10023{
10024 /// Perform the operation you have build so far.
10025 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10026 use std::borrow::Cow;
10027 use std::io::{Read, Seek};
10028
10029 use common::{url::Params, ToParts};
10030 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10031
10032 let mut dd = common::DefaultDelegate;
10033 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10034 dlg.begin(common::MethodInfo {
10035 id: "networkconnectivity.projects.locations.global.hubs.getIamPolicy",
10036 http_method: hyper::Method::GET,
10037 });
10038
10039 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
10040 if self._additional_params.contains_key(field) {
10041 dlg.finished(false);
10042 return Err(common::Error::FieldClash(field));
10043 }
10044 }
10045
10046 let mut params = Params::with_capacity(4 + self._additional_params.len());
10047 params.push("resource", self._resource);
10048 if let Some(value) = self._options_requested_policy_version.as_ref() {
10049 params.push("options.requestedPolicyVersion", value.to_string());
10050 }
10051
10052 params.extend(self._additional_params.iter());
10053
10054 params.push("alt", "json");
10055 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
10056 if self._scopes.is_empty() {
10057 self._scopes
10058 .insert(Scope::CloudPlatform.as_ref().to_string());
10059 }
10060
10061 #[allow(clippy::single_element_loop)]
10062 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10063 url = params.uri_replacement(url, param_name, find_this, true);
10064 }
10065 {
10066 let to_remove = ["resource"];
10067 params.remove_params(&to_remove);
10068 }
10069
10070 let url = params.parse_with_url(&url);
10071
10072 loop {
10073 let token = match self
10074 .hub
10075 .auth
10076 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10077 .await
10078 {
10079 Ok(token) => token,
10080 Err(e) => match dlg.token(e) {
10081 Ok(token) => token,
10082 Err(e) => {
10083 dlg.finished(false);
10084 return Err(common::Error::MissingToken(e));
10085 }
10086 },
10087 };
10088 let mut req_result = {
10089 let client = &self.hub.client;
10090 dlg.pre_request();
10091 let mut req_builder = hyper::Request::builder()
10092 .method(hyper::Method::GET)
10093 .uri(url.as_str())
10094 .header(USER_AGENT, self.hub._user_agent.clone());
10095
10096 if let Some(token) = token.as_ref() {
10097 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10098 }
10099
10100 let request = req_builder
10101 .header(CONTENT_LENGTH, 0_u64)
10102 .body(common::to_body::<String>(None));
10103
10104 client.request(request.unwrap()).await
10105 };
10106
10107 match req_result {
10108 Err(err) => {
10109 if let common::Retry::After(d) = dlg.http_error(&err) {
10110 sleep(d).await;
10111 continue;
10112 }
10113 dlg.finished(false);
10114 return Err(common::Error::HttpError(err));
10115 }
10116 Ok(res) => {
10117 let (mut parts, body) = res.into_parts();
10118 let mut body = common::Body::new(body);
10119 if !parts.status.is_success() {
10120 let bytes = common::to_bytes(body).await.unwrap_or_default();
10121 let error = serde_json::from_str(&common::to_string(&bytes));
10122 let response = common::to_response(parts, bytes.into());
10123
10124 if let common::Retry::After(d) =
10125 dlg.http_failure(&response, error.as_ref().ok())
10126 {
10127 sleep(d).await;
10128 continue;
10129 }
10130
10131 dlg.finished(false);
10132
10133 return Err(match error {
10134 Ok(value) => common::Error::BadRequest(value),
10135 _ => common::Error::Failure(response),
10136 });
10137 }
10138 let response = {
10139 let bytes = common::to_bytes(body).await.unwrap_or_default();
10140 let encoded = common::to_string(&bytes);
10141 match serde_json::from_str(&encoded) {
10142 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10143 Err(error) => {
10144 dlg.response_json_decode_error(&encoded, &error);
10145 return Err(common::Error::JsonDecodeError(
10146 encoded.to_string(),
10147 error,
10148 ));
10149 }
10150 }
10151 };
10152
10153 dlg.finished(true);
10154 return Ok(response);
10155 }
10156 }
10157 }
10158 }
10159
10160 /// 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.
10161 ///
10162 /// Sets the *resource* path property to the given value.
10163 ///
10164 /// Even though the property as already been set when instantiating this call,
10165 /// we provide this method for API completeness.
10166 pub fn resource(mut self, new_value: &str) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C> {
10167 self._resource = new_value.to_string();
10168 self
10169 }
10170 /// 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).
10171 ///
10172 /// Sets the *options.requested policy version* query property to the given value.
10173 pub fn options_requested_policy_version(
10174 mut self,
10175 new_value: i32,
10176 ) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C> {
10177 self._options_requested_policy_version = Some(new_value);
10178 self
10179 }
10180 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10181 /// while executing the actual API request.
10182 ///
10183 /// ````text
10184 /// It should be used to handle progress information, and to implement a certain level of resilience.
10185 /// ````
10186 ///
10187 /// Sets the *delegate* property to the given value.
10188 pub fn delegate(
10189 mut self,
10190 new_value: &'a mut dyn common::Delegate,
10191 ) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C> {
10192 self._delegate = Some(new_value);
10193 self
10194 }
10195
10196 /// Set any additional parameter of the query string used in the request.
10197 /// It should be used to set parameters which are not yet available through their own
10198 /// setters.
10199 ///
10200 /// Please note that this method must not be used to set any of the known parameters
10201 /// which have their own setter method. If done anyway, the request will fail.
10202 ///
10203 /// # Additional Parameters
10204 ///
10205 /// * *$.xgafv* (query-string) - V1 error format.
10206 /// * *access_token* (query-string) - OAuth access token.
10207 /// * *alt* (query-string) - Data format for response.
10208 /// * *callback* (query-string) - JSONP
10209 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10210 /// * *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.
10211 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10212 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10213 /// * *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.
10214 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10215 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10216 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C>
10217 where
10218 T: AsRef<str>,
10219 {
10220 self._additional_params
10221 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10222 self
10223 }
10224
10225 /// Identifies the authorization scope for the method you are building.
10226 ///
10227 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10228 /// [`Scope::CloudPlatform`].
10229 ///
10230 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10231 /// tokens for more than one scope.
10232 ///
10233 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10234 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10235 /// sufficient, a read-write scope will do as well.
10236 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C>
10237 where
10238 St: AsRef<str>,
10239 {
10240 self._scopes.insert(String::from(scope.as_ref()));
10241 self
10242 }
10243 /// Identifies the authorization scope(s) for the method you are building.
10244 ///
10245 /// See [`Self::add_scope()`] for details.
10246 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C>
10247 where
10248 I: IntoIterator<Item = St>,
10249 St: AsRef<str>,
10250 {
10251 self._scopes
10252 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10253 self
10254 }
10255
10256 /// Removes all scopes, and no default scope will be used either.
10257 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10258 /// for details).
10259 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubGetIamPolicyCall<'a, C> {
10260 self._scopes.clear();
10261 self
10262 }
10263}
10264
10265/// Lists the Network Connectivity Center hubs associated with a given project.
10266///
10267/// A builder for the *locations.global.hubs.list* method supported by a *project* resource.
10268/// It is not used directly, but through a [`ProjectMethods`] instance.
10269///
10270/// # Example
10271///
10272/// Instantiate a resource method builder
10273///
10274/// ```test_harness,no_run
10275/// # extern crate hyper;
10276/// # extern crate hyper_rustls;
10277/// # extern crate google_networkconnectivity1 as networkconnectivity1;
10278/// # async fn dox() {
10279/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10280///
10281/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10282/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10283/// # .with_native_roots()
10284/// # .unwrap()
10285/// # .https_only()
10286/// # .enable_http2()
10287/// # .build();
10288///
10289/// # let executor = hyper_util::rt::TokioExecutor::new();
10290/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10291/// # secret,
10292/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10293/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10294/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10295/// # ),
10296/// # ).build().await.unwrap();
10297///
10298/// # let client = hyper_util::client::legacy::Client::builder(
10299/// # hyper_util::rt::TokioExecutor::new()
10300/// # )
10301/// # .build(
10302/// # hyper_rustls::HttpsConnectorBuilder::new()
10303/// # .with_native_roots()
10304/// # .unwrap()
10305/// # .https_or_http()
10306/// # .enable_http2()
10307/// # .build()
10308/// # );
10309/// # let mut hub = Networkconnectivity::new(client, auth);
10310/// // You can configure optional parameters by calling the respective setters at will, and
10311/// // execute the final call using `doit()`.
10312/// // Values shown here are possibly random and not representative !
10313/// let result = hub.projects().locations_global_hubs_list("parent")
10314/// .page_token("consetetur")
10315/// .page_size(-92)
10316/// .order_by("dolor")
10317/// .filter("et")
10318/// .doit().await;
10319/// # }
10320/// ```
10321pub struct ProjectLocationGlobalHubListCall<'a, C>
10322where
10323 C: 'a,
10324{
10325 hub: &'a Networkconnectivity<C>,
10326 _parent: String,
10327 _page_token: Option<String>,
10328 _page_size: Option<i32>,
10329 _order_by: Option<String>,
10330 _filter: Option<String>,
10331 _delegate: Option<&'a mut dyn common::Delegate>,
10332 _additional_params: HashMap<String, String>,
10333 _scopes: BTreeSet<String>,
10334}
10335
10336impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubListCall<'a, C> {}
10337
10338impl<'a, C> ProjectLocationGlobalHubListCall<'a, C>
10339where
10340 C: common::Connector,
10341{
10342 /// Perform the operation you have build so far.
10343 pub async fn doit(mut self) -> common::Result<(common::Response, ListHubsResponse)> {
10344 use std::borrow::Cow;
10345 use std::io::{Read, Seek};
10346
10347 use common::{url::Params, ToParts};
10348 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10349
10350 let mut dd = common::DefaultDelegate;
10351 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10352 dlg.begin(common::MethodInfo {
10353 id: "networkconnectivity.projects.locations.global.hubs.list",
10354 http_method: hyper::Method::GET,
10355 });
10356
10357 for &field in [
10358 "alt",
10359 "parent",
10360 "pageToken",
10361 "pageSize",
10362 "orderBy",
10363 "filter",
10364 ]
10365 .iter()
10366 {
10367 if self._additional_params.contains_key(field) {
10368 dlg.finished(false);
10369 return Err(common::Error::FieldClash(field));
10370 }
10371 }
10372
10373 let mut params = Params::with_capacity(7 + self._additional_params.len());
10374 params.push("parent", self._parent);
10375 if let Some(value) = self._page_token.as_ref() {
10376 params.push("pageToken", value);
10377 }
10378 if let Some(value) = self._page_size.as_ref() {
10379 params.push("pageSize", value.to_string());
10380 }
10381 if let Some(value) = self._order_by.as_ref() {
10382 params.push("orderBy", value);
10383 }
10384 if let Some(value) = self._filter.as_ref() {
10385 params.push("filter", value);
10386 }
10387
10388 params.extend(self._additional_params.iter());
10389
10390 params.push("alt", "json");
10391 let mut url = self.hub._base_url.clone() + "v1/{+parent}/hubs";
10392 if self._scopes.is_empty() {
10393 self._scopes
10394 .insert(Scope::CloudPlatform.as_ref().to_string());
10395 }
10396
10397 #[allow(clippy::single_element_loop)]
10398 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10399 url = params.uri_replacement(url, param_name, find_this, true);
10400 }
10401 {
10402 let to_remove = ["parent"];
10403 params.remove_params(&to_remove);
10404 }
10405
10406 let url = params.parse_with_url(&url);
10407
10408 loop {
10409 let token = match self
10410 .hub
10411 .auth
10412 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10413 .await
10414 {
10415 Ok(token) => token,
10416 Err(e) => match dlg.token(e) {
10417 Ok(token) => token,
10418 Err(e) => {
10419 dlg.finished(false);
10420 return Err(common::Error::MissingToken(e));
10421 }
10422 },
10423 };
10424 let mut req_result = {
10425 let client = &self.hub.client;
10426 dlg.pre_request();
10427 let mut req_builder = hyper::Request::builder()
10428 .method(hyper::Method::GET)
10429 .uri(url.as_str())
10430 .header(USER_AGENT, self.hub._user_agent.clone());
10431
10432 if let Some(token) = token.as_ref() {
10433 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10434 }
10435
10436 let request = req_builder
10437 .header(CONTENT_LENGTH, 0_u64)
10438 .body(common::to_body::<String>(None));
10439
10440 client.request(request.unwrap()).await
10441 };
10442
10443 match req_result {
10444 Err(err) => {
10445 if let common::Retry::After(d) = dlg.http_error(&err) {
10446 sleep(d).await;
10447 continue;
10448 }
10449 dlg.finished(false);
10450 return Err(common::Error::HttpError(err));
10451 }
10452 Ok(res) => {
10453 let (mut parts, body) = res.into_parts();
10454 let mut body = common::Body::new(body);
10455 if !parts.status.is_success() {
10456 let bytes = common::to_bytes(body).await.unwrap_or_default();
10457 let error = serde_json::from_str(&common::to_string(&bytes));
10458 let response = common::to_response(parts, bytes.into());
10459
10460 if let common::Retry::After(d) =
10461 dlg.http_failure(&response, error.as_ref().ok())
10462 {
10463 sleep(d).await;
10464 continue;
10465 }
10466
10467 dlg.finished(false);
10468
10469 return Err(match error {
10470 Ok(value) => common::Error::BadRequest(value),
10471 _ => common::Error::Failure(response),
10472 });
10473 }
10474 let response = {
10475 let bytes = common::to_bytes(body).await.unwrap_or_default();
10476 let encoded = common::to_string(&bytes);
10477 match serde_json::from_str(&encoded) {
10478 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10479 Err(error) => {
10480 dlg.response_json_decode_error(&encoded, &error);
10481 return Err(common::Error::JsonDecodeError(
10482 encoded.to_string(),
10483 error,
10484 ));
10485 }
10486 }
10487 };
10488
10489 dlg.finished(true);
10490 return Ok(response);
10491 }
10492 }
10493 }
10494 }
10495
10496 /// Required. The parent resource's name.
10497 ///
10498 /// Sets the *parent* path property to the given value.
10499 ///
10500 /// Even though the property as already been set when instantiating this call,
10501 /// we provide this method for API completeness.
10502 pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalHubListCall<'a, C> {
10503 self._parent = new_value.to_string();
10504 self
10505 }
10506 /// The page token.
10507 ///
10508 /// Sets the *page token* query property to the given value.
10509 pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalHubListCall<'a, C> {
10510 self._page_token = Some(new_value.to_string());
10511 self
10512 }
10513 /// The maximum number of results per page to return.
10514 ///
10515 /// Sets the *page size* query property to the given value.
10516 pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalHubListCall<'a, C> {
10517 self._page_size = Some(new_value);
10518 self
10519 }
10520 /// Sort the results by a certain order.
10521 ///
10522 /// Sets the *order by* query property to the given value.
10523 pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalHubListCall<'a, C> {
10524 self._order_by = Some(new_value.to_string());
10525 self
10526 }
10527 /// An expression that filters the list of results.
10528 ///
10529 /// Sets the *filter* query property to the given value.
10530 pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalHubListCall<'a, C> {
10531 self._filter = Some(new_value.to_string());
10532 self
10533 }
10534 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10535 /// while executing the actual API request.
10536 ///
10537 /// ````text
10538 /// It should be used to handle progress information, and to implement a certain level of resilience.
10539 /// ````
10540 ///
10541 /// Sets the *delegate* property to the given value.
10542 pub fn delegate(
10543 mut self,
10544 new_value: &'a mut dyn common::Delegate,
10545 ) -> ProjectLocationGlobalHubListCall<'a, C> {
10546 self._delegate = Some(new_value);
10547 self
10548 }
10549
10550 /// Set any additional parameter of the query string used in the request.
10551 /// It should be used to set parameters which are not yet available through their own
10552 /// setters.
10553 ///
10554 /// Please note that this method must not be used to set any of the known parameters
10555 /// which have their own setter method. If done anyway, the request will fail.
10556 ///
10557 /// # Additional Parameters
10558 ///
10559 /// * *$.xgafv* (query-string) - V1 error format.
10560 /// * *access_token* (query-string) - OAuth access token.
10561 /// * *alt* (query-string) - Data format for response.
10562 /// * *callback* (query-string) - JSONP
10563 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10564 /// * *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.
10565 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10566 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10567 /// * *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.
10568 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10569 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10570 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubListCall<'a, C>
10571 where
10572 T: AsRef<str>,
10573 {
10574 self._additional_params
10575 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10576 self
10577 }
10578
10579 /// Identifies the authorization scope for the method you are building.
10580 ///
10581 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10582 /// [`Scope::CloudPlatform`].
10583 ///
10584 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10585 /// tokens for more than one scope.
10586 ///
10587 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10588 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10589 /// sufficient, a read-write scope will do as well.
10590 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubListCall<'a, C>
10591 where
10592 St: AsRef<str>,
10593 {
10594 self._scopes.insert(String::from(scope.as_ref()));
10595 self
10596 }
10597 /// Identifies the authorization scope(s) for the method you are building.
10598 ///
10599 /// See [`Self::add_scope()`] for details.
10600 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubListCall<'a, C>
10601 where
10602 I: IntoIterator<Item = St>,
10603 St: AsRef<str>,
10604 {
10605 self._scopes
10606 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10607 self
10608 }
10609
10610 /// Removes all scopes, and no default scope will be used either.
10611 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10612 /// for details).
10613 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubListCall<'a, C> {
10614 self._scopes.clear();
10615 self
10616 }
10617}
10618
10619/// Lists the Network Connectivity Center spokes associated with a specified hub and location. The list includes both spokes that are attached to the hub and spokes that have been proposed but not yet accepted.
10620///
10621/// A builder for the *locations.global.hubs.listSpokes* method supported by a *project* resource.
10622/// It is not used directly, but through a [`ProjectMethods`] instance.
10623///
10624/// # Example
10625///
10626/// Instantiate a resource method builder
10627///
10628/// ```test_harness,no_run
10629/// # extern crate hyper;
10630/// # extern crate hyper_rustls;
10631/// # extern crate google_networkconnectivity1 as networkconnectivity1;
10632/// # async fn dox() {
10633/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10634///
10635/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10636/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10637/// # .with_native_roots()
10638/// # .unwrap()
10639/// # .https_only()
10640/// # .enable_http2()
10641/// # .build();
10642///
10643/// # let executor = hyper_util::rt::TokioExecutor::new();
10644/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10645/// # secret,
10646/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10647/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10648/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10649/// # ),
10650/// # ).build().await.unwrap();
10651///
10652/// # let client = hyper_util::client::legacy::Client::builder(
10653/// # hyper_util::rt::TokioExecutor::new()
10654/// # )
10655/// # .build(
10656/// # hyper_rustls::HttpsConnectorBuilder::new()
10657/// # .with_native_roots()
10658/// # .unwrap()
10659/// # .https_or_http()
10660/// # .enable_http2()
10661/// # .build()
10662/// # );
10663/// # let mut hub = Networkconnectivity::new(client, auth);
10664/// // You can configure optional parameters by calling the respective setters at will, and
10665/// // execute the final call using `doit()`.
10666/// // Values shown here are possibly random and not representative !
10667/// let result = hub.projects().locations_global_hubs_list_spokes("name")
10668/// .view("sadipscing")
10669/// .add_spoke_locations("Stet")
10670/// .page_token("dolor")
10671/// .page_size(-20)
10672/// .order_by("vero")
10673/// .filter("vero")
10674/// .doit().await;
10675/// # }
10676/// ```
10677pub struct ProjectLocationGlobalHubListSpokeCall<'a, C>
10678where
10679 C: 'a,
10680{
10681 hub: &'a Networkconnectivity<C>,
10682 _name: String,
10683 _view: Option<String>,
10684 _spoke_locations: Vec<String>,
10685 _page_token: Option<String>,
10686 _page_size: Option<i32>,
10687 _order_by: Option<String>,
10688 _filter: Option<String>,
10689 _delegate: Option<&'a mut dyn common::Delegate>,
10690 _additional_params: HashMap<String, String>,
10691 _scopes: BTreeSet<String>,
10692}
10693
10694impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubListSpokeCall<'a, C> {}
10695
10696impl<'a, C> ProjectLocationGlobalHubListSpokeCall<'a, C>
10697where
10698 C: common::Connector,
10699{
10700 /// Perform the operation you have build so far.
10701 pub async fn doit(mut self) -> common::Result<(common::Response, ListHubSpokesResponse)> {
10702 use std::borrow::Cow;
10703 use std::io::{Read, Seek};
10704
10705 use common::{url::Params, ToParts};
10706 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10707
10708 let mut dd = common::DefaultDelegate;
10709 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10710 dlg.begin(common::MethodInfo {
10711 id: "networkconnectivity.projects.locations.global.hubs.listSpokes",
10712 http_method: hyper::Method::GET,
10713 });
10714
10715 for &field in [
10716 "alt",
10717 "name",
10718 "view",
10719 "spokeLocations",
10720 "pageToken",
10721 "pageSize",
10722 "orderBy",
10723 "filter",
10724 ]
10725 .iter()
10726 {
10727 if self._additional_params.contains_key(field) {
10728 dlg.finished(false);
10729 return Err(common::Error::FieldClash(field));
10730 }
10731 }
10732
10733 let mut params = Params::with_capacity(9 + self._additional_params.len());
10734 params.push("name", self._name);
10735 if let Some(value) = self._view.as_ref() {
10736 params.push("view", value);
10737 }
10738 if !self._spoke_locations.is_empty() {
10739 for f in self._spoke_locations.iter() {
10740 params.push("spokeLocations", f);
10741 }
10742 }
10743 if let Some(value) = self._page_token.as_ref() {
10744 params.push("pageToken", value);
10745 }
10746 if let Some(value) = self._page_size.as_ref() {
10747 params.push("pageSize", value.to_string());
10748 }
10749 if let Some(value) = self._order_by.as_ref() {
10750 params.push("orderBy", value);
10751 }
10752 if let Some(value) = self._filter.as_ref() {
10753 params.push("filter", value);
10754 }
10755
10756 params.extend(self._additional_params.iter());
10757
10758 params.push("alt", "json");
10759 let mut url = self.hub._base_url.clone() + "v1/{+name}:listSpokes";
10760 if self._scopes.is_empty() {
10761 self._scopes
10762 .insert(Scope::CloudPlatform.as_ref().to_string());
10763 }
10764
10765 #[allow(clippy::single_element_loop)]
10766 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10767 url = params.uri_replacement(url, param_name, find_this, true);
10768 }
10769 {
10770 let to_remove = ["name"];
10771 params.remove_params(&to_remove);
10772 }
10773
10774 let url = params.parse_with_url(&url);
10775
10776 loop {
10777 let token = match self
10778 .hub
10779 .auth
10780 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10781 .await
10782 {
10783 Ok(token) => token,
10784 Err(e) => match dlg.token(e) {
10785 Ok(token) => token,
10786 Err(e) => {
10787 dlg.finished(false);
10788 return Err(common::Error::MissingToken(e));
10789 }
10790 },
10791 };
10792 let mut req_result = {
10793 let client = &self.hub.client;
10794 dlg.pre_request();
10795 let mut req_builder = hyper::Request::builder()
10796 .method(hyper::Method::GET)
10797 .uri(url.as_str())
10798 .header(USER_AGENT, self.hub._user_agent.clone());
10799
10800 if let Some(token) = token.as_ref() {
10801 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10802 }
10803
10804 let request = req_builder
10805 .header(CONTENT_LENGTH, 0_u64)
10806 .body(common::to_body::<String>(None));
10807
10808 client.request(request.unwrap()).await
10809 };
10810
10811 match req_result {
10812 Err(err) => {
10813 if let common::Retry::After(d) = dlg.http_error(&err) {
10814 sleep(d).await;
10815 continue;
10816 }
10817 dlg.finished(false);
10818 return Err(common::Error::HttpError(err));
10819 }
10820 Ok(res) => {
10821 let (mut parts, body) = res.into_parts();
10822 let mut body = common::Body::new(body);
10823 if !parts.status.is_success() {
10824 let bytes = common::to_bytes(body).await.unwrap_or_default();
10825 let error = serde_json::from_str(&common::to_string(&bytes));
10826 let response = common::to_response(parts, bytes.into());
10827
10828 if let common::Retry::After(d) =
10829 dlg.http_failure(&response, error.as_ref().ok())
10830 {
10831 sleep(d).await;
10832 continue;
10833 }
10834
10835 dlg.finished(false);
10836
10837 return Err(match error {
10838 Ok(value) => common::Error::BadRequest(value),
10839 _ => common::Error::Failure(response),
10840 });
10841 }
10842 let response = {
10843 let bytes = common::to_bytes(body).await.unwrap_or_default();
10844 let encoded = common::to_string(&bytes);
10845 match serde_json::from_str(&encoded) {
10846 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10847 Err(error) => {
10848 dlg.response_json_decode_error(&encoded, &error);
10849 return Err(common::Error::JsonDecodeError(
10850 encoded.to_string(),
10851 error,
10852 ));
10853 }
10854 }
10855 };
10856
10857 dlg.finished(true);
10858 return Ok(response);
10859 }
10860 }
10861 }
10862 }
10863
10864 /// Required. The name of the hub.
10865 ///
10866 /// Sets the *name* path property to the given value.
10867 ///
10868 /// Even though the property as already been set when instantiating this call,
10869 /// we provide this method for API completeness.
10870 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10871 self._name = new_value.to_string();
10872 self
10873 }
10874 /// The view of the spoke to return. The view that you use determines which spoke fields are included in the response.
10875 ///
10876 /// Sets the *view* query property to the given value.
10877 pub fn view(mut self, new_value: &str) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10878 self._view = Some(new_value.to_string());
10879 self
10880 }
10881 /// A list of locations. Specify one of the following: `[global]`, a single region (for example, `[us-central1]`), or a combination of values (for example, `[global, us-central1, us-west1]`). If the spoke_locations field is populated, the list of results includes only spokes in the specified location. If the spoke_locations field is not populated, the list of results includes spokes in all locations.
10882 ///
10883 /// Append the given value to the *spoke locations* query property.
10884 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10885 pub fn add_spoke_locations(
10886 mut self,
10887 new_value: &str,
10888 ) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10889 self._spoke_locations.push(new_value.to_string());
10890 self
10891 }
10892 /// The page token.
10893 ///
10894 /// Sets the *page token* query property to the given value.
10895 pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10896 self._page_token = Some(new_value.to_string());
10897 self
10898 }
10899 /// The maximum number of results to return per page.
10900 ///
10901 /// Sets the *page size* query property to the given value.
10902 pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10903 self._page_size = Some(new_value);
10904 self
10905 }
10906 /// Sort the results by name or create_time.
10907 ///
10908 /// Sets the *order by* query property to the given value.
10909 pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10910 self._order_by = Some(new_value.to_string());
10911 self
10912 }
10913 /// An expression that filters the list of results.
10914 ///
10915 /// Sets the *filter* query property to the given value.
10916 pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10917 self._filter = Some(new_value.to_string());
10918 self
10919 }
10920 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10921 /// while executing the actual API request.
10922 ///
10923 /// ````text
10924 /// It should be used to handle progress information, and to implement a certain level of resilience.
10925 /// ````
10926 ///
10927 /// Sets the *delegate* property to the given value.
10928 pub fn delegate(
10929 mut self,
10930 new_value: &'a mut dyn common::Delegate,
10931 ) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
10932 self._delegate = Some(new_value);
10933 self
10934 }
10935
10936 /// Set any additional parameter of the query string used in the request.
10937 /// It should be used to set parameters which are not yet available through their own
10938 /// setters.
10939 ///
10940 /// Please note that this method must not be used to set any of the known parameters
10941 /// which have their own setter method. If done anyway, the request will fail.
10942 ///
10943 /// # Additional Parameters
10944 ///
10945 /// * *$.xgafv* (query-string) - V1 error format.
10946 /// * *access_token* (query-string) - OAuth access token.
10947 /// * *alt* (query-string) - Data format for response.
10948 /// * *callback* (query-string) - JSONP
10949 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10950 /// * *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.
10951 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10952 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10953 /// * *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.
10954 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10955 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10956 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubListSpokeCall<'a, C>
10957 where
10958 T: AsRef<str>,
10959 {
10960 self._additional_params
10961 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10962 self
10963 }
10964
10965 /// Identifies the authorization scope for the method you are building.
10966 ///
10967 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10968 /// [`Scope::CloudPlatform`].
10969 ///
10970 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10971 /// tokens for more than one scope.
10972 ///
10973 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10974 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10975 /// sufficient, a read-write scope will do as well.
10976 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubListSpokeCall<'a, C>
10977 where
10978 St: AsRef<str>,
10979 {
10980 self._scopes.insert(String::from(scope.as_ref()));
10981 self
10982 }
10983 /// Identifies the authorization scope(s) for the method you are building.
10984 ///
10985 /// See [`Self::add_scope()`] for details.
10986 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubListSpokeCall<'a, C>
10987 where
10988 I: IntoIterator<Item = St>,
10989 St: AsRef<str>,
10990 {
10991 self._scopes
10992 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10993 self
10994 }
10995
10996 /// Removes all scopes, and no default scope will be used either.
10997 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10998 /// for details).
10999 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubListSpokeCall<'a, C> {
11000 self._scopes.clear();
11001 self
11002 }
11003}
11004
11005/// Updates the description and/or labels of a Network Connectivity Center hub.
11006///
11007/// A builder for the *locations.global.hubs.patch* method supported by a *project* resource.
11008/// It is not used directly, but through a [`ProjectMethods`] instance.
11009///
11010/// # Example
11011///
11012/// Instantiate a resource method builder
11013///
11014/// ```test_harness,no_run
11015/// # extern crate hyper;
11016/// # extern crate hyper_rustls;
11017/// # extern crate google_networkconnectivity1 as networkconnectivity1;
11018/// use networkconnectivity1::api::Hub;
11019/// # async fn dox() {
11020/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11021///
11022/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11023/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11024/// # .with_native_roots()
11025/// # .unwrap()
11026/// # .https_only()
11027/// # .enable_http2()
11028/// # .build();
11029///
11030/// # let executor = hyper_util::rt::TokioExecutor::new();
11031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11032/// # secret,
11033/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11034/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11035/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11036/// # ),
11037/// # ).build().await.unwrap();
11038///
11039/// # let client = hyper_util::client::legacy::Client::builder(
11040/// # hyper_util::rt::TokioExecutor::new()
11041/// # )
11042/// # .build(
11043/// # hyper_rustls::HttpsConnectorBuilder::new()
11044/// # .with_native_roots()
11045/// # .unwrap()
11046/// # .https_or_http()
11047/// # .enable_http2()
11048/// # .build()
11049/// # );
11050/// # let mut hub = Networkconnectivity::new(client, auth);
11051/// // As the method needs a request, you would usually fill it with the desired information
11052/// // into the respective structure. Some of the parts shown here might not be applicable !
11053/// // Values shown here are possibly random and not representative !
11054/// let mut req = Hub::default();
11055///
11056/// // You can configure optional parameters by calling the respective setters at will, and
11057/// // execute the final call using `doit()`.
11058/// // Values shown here are possibly random and not representative !
11059/// let result = hub.projects().locations_global_hubs_patch(req, "name")
11060/// .update_mask(FieldMask::new::<&str>(&[]))
11061/// .request_id("Stet")
11062/// .doit().await;
11063/// # }
11064/// ```
11065pub struct ProjectLocationGlobalHubPatchCall<'a, C>
11066where
11067 C: 'a,
11068{
11069 hub: &'a Networkconnectivity<C>,
11070 _request: Hub,
11071 _name: String,
11072 _update_mask: Option<common::FieldMask>,
11073 _request_id: Option<String>,
11074 _delegate: Option<&'a mut dyn common::Delegate>,
11075 _additional_params: HashMap<String, String>,
11076 _scopes: BTreeSet<String>,
11077}
11078
11079impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubPatchCall<'a, C> {}
11080
11081impl<'a, C> ProjectLocationGlobalHubPatchCall<'a, C>
11082where
11083 C: common::Connector,
11084{
11085 /// Perform the operation you have build so far.
11086 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
11087 use std::borrow::Cow;
11088 use std::io::{Read, Seek};
11089
11090 use common::{url::Params, ToParts};
11091 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11092
11093 let mut dd = common::DefaultDelegate;
11094 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11095 dlg.begin(common::MethodInfo {
11096 id: "networkconnectivity.projects.locations.global.hubs.patch",
11097 http_method: hyper::Method::PATCH,
11098 });
11099
11100 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
11101 if self._additional_params.contains_key(field) {
11102 dlg.finished(false);
11103 return Err(common::Error::FieldClash(field));
11104 }
11105 }
11106
11107 let mut params = Params::with_capacity(6 + self._additional_params.len());
11108 params.push("name", self._name);
11109 if let Some(value) = self._update_mask.as_ref() {
11110 params.push("updateMask", value.to_string());
11111 }
11112 if let Some(value) = self._request_id.as_ref() {
11113 params.push("requestId", value);
11114 }
11115
11116 params.extend(self._additional_params.iter());
11117
11118 params.push("alt", "json");
11119 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11120 if self._scopes.is_empty() {
11121 self._scopes
11122 .insert(Scope::CloudPlatform.as_ref().to_string());
11123 }
11124
11125 #[allow(clippy::single_element_loop)]
11126 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11127 url = params.uri_replacement(url, param_name, find_this, true);
11128 }
11129 {
11130 let to_remove = ["name"];
11131 params.remove_params(&to_remove);
11132 }
11133
11134 let url = params.parse_with_url(&url);
11135
11136 let mut json_mime_type = mime::APPLICATION_JSON;
11137 let mut request_value_reader = {
11138 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11139 common::remove_json_null_values(&mut value);
11140 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11141 serde_json::to_writer(&mut dst, &value).unwrap();
11142 dst
11143 };
11144 let request_size = request_value_reader
11145 .seek(std::io::SeekFrom::End(0))
11146 .unwrap();
11147 request_value_reader
11148 .seek(std::io::SeekFrom::Start(0))
11149 .unwrap();
11150
11151 loop {
11152 let token = match self
11153 .hub
11154 .auth
11155 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11156 .await
11157 {
11158 Ok(token) => token,
11159 Err(e) => match dlg.token(e) {
11160 Ok(token) => token,
11161 Err(e) => {
11162 dlg.finished(false);
11163 return Err(common::Error::MissingToken(e));
11164 }
11165 },
11166 };
11167 request_value_reader
11168 .seek(std::io::SeekFrom::Start(0))
11169 .unwrap();
11170 let mut req_result = {
11171 let client = &self.hub.client;
11172 dlg.pre_request();
11173 let mut req_builder = hyper::Request::builder()
11174 .method(hyper::Method::PATCH)
11175 .uri(url.as_str())
11176 .header(USER_AGENT, self.hub._user_agent.clone());
11177
11178 if let Some(token) = token.as_ref() {
11179 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11180 }
11181
11182 let request = req_builder
11183 .header(CONTENT_TYPE, json_mime_type.to_string())
11184 .header(CONTENT_LENGTH, request_size as u64)
11185 .body(common::to_body(
11186 request_value_reader.get_ref().clone().into(),
11187 ));
11188
11189 client.request(request.unwrap()).await
11190 };
11191
11192 match req_result {
11193 Err(err) => {
11194 if let common::Retry::After(d) = dlg.http_error(&err) {
11195 sleep(d).await;
11196 continue;
11197 }
11198 dlg.finished(false);
11199 return Err(common::Error::HttpError(err));
11200 }
11201 Ok(res) => {
11202 let (mut parts, body) = res.into_parts();
11203 let mut body = common::Body::new(body);
11204 if !parts.status.is_success() {
11205 let bytes = common::to_bytes(body).await.unwrap_or_default();
11206 let error = serde_json::from_str(&common::to_string(&bytes));
11207 let response = common::to_response(parts, bytes.into());
11208
11209 if let common::Retry::After(d) =
11210 dlg.http_failure(&response, error.as_ref().ok())
11211 {
11212 sleep(d).await;
11213 continue;
11214 }
11215
11216 dlg.finished(false);
11217
11218 return Err(match error {
11219 Ok(value) => common::Error::BadRequest(value),
11220 _ => common::Error::Failure(response),
11221 });
11222 }
11223 let response = {
11224 let bytes = common::to_bytes(body).await.unwrap_or_default();
11225 let encoded = common::to_string(&bytes);
11226 match serde_json::from_str(&encoded) {
11227 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11228 Err(error) => {
11229 dlg.response_json_decode_error(&encoded, &error);
11230 return Err(common::Error::JsonDecodeError(
11231 encoded.to_string(),
11232 error,
11233 ));
11234 }
11235 }
11236 };
11237
11238 dlg.finished(true);
11239 return Ok(response);
11240 }
11241 }
11242 }
11243 }
11244
11245 ///
11246 /// Sets the *request* property to the given value.
11247 ///
11248 /// Even though the property as already been set when instantiating this call,
11249 /// we provide this method for API completeness.
11250 pub fn request(mut self, new_value: Hub) -> ProjectLocationGlobalHubPatchCall<'a, C> {
11251 self._request = new_value;
11252 self
11253 }
11254 /// Immutable. The name of the hub. Hub names must be unique. They use the following form: `projects/{project_number}/locations/global/hubs/{hub_id}`
11255 ///
11256 /// Sets the *name* path property to the given value.
11257 ///
11258 /// Even though the property as already been set when instantiating this call,
11259 /// we provide this method for API completeness.
11260 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubPatchCall<'a, C> {
11261 self._name = new_value.to_string();
11262 self
11263 }
11264 /// Optional. In the case of an update to an existing hub, field mask is used to specify the fields to be overwritten. The fields specified in the update_mask are relative to the resource, not the full request. A field is overwritten if it is in the mask. If the user does not provide a mask, then all fields are overwritten.
11265 ///
11266 /// Sets the *update mask* query property to the given value.
11267 pub fn update_mask(
11268 mut self,
11269 new_value: common::FieldMask,
11270 ) -> ProjectLocationGlobalHubPatchCall<'a, C> {
11271 self._update_mask = Some(new_value);
11272 self
11273 }
11274 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
11275 ///
11276 /// Sets the *request id* query property to the given value.
11277 pub fn request_id(mut self, new_value: &str) -> ProjectLocationGlobalHubPatchCall<'a, C> {
11278 self._request_id = Some(new_value.to_string());
11279 self
11280 }
11281 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11282 /// while executing the actual API request.
11283 ///
11284 /// ````text
11285 /// It should be used to handle progress information, and to implement a certain level of resilience.
11286 /// ````
11287 ///
11288 /// Sets the *delegate* property to the given value.
11289 pub fn delegate(
11290 mut self,
11291 new_value: &'a mut dyn common::Delegate,
11292 ) -> ProjectLocationGlobalHubPatchCall<'a, C> {
11293 self._delegate = Some(new_value);
11294 self
11295 }
11296
11297 /// Set any additional parameter of the query string used in the request.
11298 /// It should be used to set parameters which are not yet available through their own
11299 /// setters.
11300 ///
11301 /// Please note that this method must not be used to set any of the known parameters
11302 /// which have their own setter method. If done anyway, the request will fail.
11303 ///
11304 /// # Additional Parameters
11305 ///
11306 /// * *$.xgafv* (query-string) - V1 error format.
11307 /// * *access_token* (query-string) - OAuth access token.
11308 /// * *alt* (query-string) - Data format for response.
11309 /// * *callback* (query-string) - JSONP
11310 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11311 /// * *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.
11312 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11313 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11314 /// * *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.
11315 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11316 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11317 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubPatchCall<'a, C>
11318 where
11319 T: AsRef<str>,
11320 {
11321 self._additional_params
11322 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11323 self
11324 }
11325
11326 /// Identifies the authorization scope for the method you are building.
11327 ///
11328 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11329 /// [`Scope::CloudPlatform`].
11330 ///
11331 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11332 /// tokens for more than one scope.
11333 ///
11334 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11335 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11336 /// sufficient, a read-write scope will do as well.
11337 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubPatchCall<'a, C>
11338 where
11339 St: AsRef<str>,
11340 {
11341 self._scopes.insert(String::from(scope.as_ref()));
11342 self
11343 }
11344 /// Identifies the authorization scope(s) for the method you are building.
11345 ///
11346 /// See [`Self::add_scope()`] for details.
11347 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubPatchCall<'a, C>
11348 where
11349 I: IntoIterator<Item = St>,
11350 St: AsRef<str>,
11351 {
11352 self._scopes
11353 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11354 self
11355 }
11356
11357 /// Removes all scopes, and no default scope will be used either.
11358 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11359 /// for details).
11360 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubPatchCall<'a, C> {
11361 self._scopes.clear();
11362 self
11363 }
11364}
11365
11366/// Query the Private Service Connect propagation status of a Network Connectivity Center hub.
11367///
11368/// A builder for the *locations.global.hubs.queryStatus* method supported by a *project* resource.
11369/// It is not used directly, but through a [`ProjectMethods`] instance.
11370///
11371/// # Example
11372///
11373/// Instantiate a resource method builder
11374///
11375/// ```test_harness,no_run
11376/// # extern crate hyper;
11377/// # extern crate hyper_rustls;
11378/// # extern crate google_networkconnectivity1 as networkconnectivity1;
11379/// # async fn dox() {
11380/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11381///
11382/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11383/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11384/// # .with_native_roots()
11385/// # .unwrap()
11386/// # .https_only()
11387/// # .enable_http2()
11388/// # .build();
11389///
11390/// # let executor = hyper_util::rt::TokioExecutor::new();
11391/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11392/// # secret,
11393/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11394/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11395/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11396/// # ),
11397/// # ).build().await.unwrap();
11398///
11399/// # let client = hyper_util::client::legacy::Client::builder(
11400/// # hyper_util::rt::TokioExecutor::new()
11401/// # )
11402/// # .build(
11403/// # hyper_rustls::HttpsConnectorBuilder::new()
11404/// # .with_native_roots()
11405/// # .unwrap()
11406/// # .https_or_http()
11407/// # .enable_http2()
11408/// # .build()
11409/// # );
11410/// # let mut hub = Networkconnectivity::new(client, auth);
11411/// // You can configure optional parameters by calling the respective setters at will, and
11412/// // execute the final call using `doit()`.
11413/// // Values shown here are possibly random and not representative !
11414/// let result = hub.projects().locations_global_hubs_query_status("name")
11415/// .page_token("elitr")
11416/// .page_size(-6)
11417/// .order_by("diam")
11418/// .group_by("no")
11419/// .filter("ipsum")
11420/// .doit().await;
11421/// # }
11422/// ```
11423pub struct ProjectLocationGlobalHubQueryStatuCall<'a, C>
11424where
11425 C: 'a,
11426{
11427 hub: &'a Networkconnectivity<C>,
11428 _name: String,
11429 _page_token: Option<String>,
11430 _page_size: Option<i32>,
11431 _order_by: Option<String>,
11432 _group_by: Option<String>,
11433 _filter: Option<String>,
11434 _delegate: Option<&'a mut dyn common::Delegate>,
11435 _additional_params: HashMap<String, String>,
11436 _scopes: BTreeSet<String>,
11437}
11438
11439impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubQueryStatuCall<'a, C> {}
11440
11441impl<'a, C> ProjectLocationGlobalHubQueryStatuCall<'a, C>
11442where
11443 C: common::Connector,
11444{
11445 /// Perform the operation you have build so far.
11446 pub async fn doit(mut self) -> common::Result<(common::Response, QueryHubStatusResponse)> {
11447 use std::borrow::Cow;
11448 use std::io::{Read, Seek};
11449
11450 use common::{url::Params, ToParts};
11451 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11452
11453 let mut dd = common::DefaultDelegate;
11454 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11455 dlg.begin(common::MethodInfo {
11456 id: "networkconnectivity.projects.locations.global.hubs.queryStatus",
11457 http_method: hyper::Method::GET,
11458 });
11459
11460 for &field in [
11461 "alt",
11462 "name",
11463 "pageToken",
11464 "pageSize",
11465 "orderBy",
11466 "groupBy",
11467 "filter",
11468 ]
11469 .iter()
11470 {
11471 if self._additional_params.contains_key(field) {
11472 dlg.finished(false);
11473 return Err(common::Error::FieldClash(field));
11474 }
11475 }
11476
11477 let mut params = Params::with_capacity(8 + self._additional_params.len());
11478 params.push("name", self._name);
11479 if let Some(value) = self._page_token.as_ref() {
11480 params.push("pageToken", value);
11481 }
11482 if let Some(value) = self._page_size.as_ref() {
11483 params.push("pageSize", value.to_string());
11484 }
11485 if let Some(value) = self._order_by.as_ref() {
11486 params.push("orderBy", value);
11487 }
11488 if let Some(value) = self._group_by.as_ref() {
11489 params.push("groupBy", value);
11490 }
11491 if let Some(value) = self._filter.as_ref() {
11492 params.push("filter", value);
11493 }
11494
11495 params.extend(self._additional_params.iter());
11496
11497 params.push("alt", "json");
11498 let mut url = self.hub._base_url.clone() + "v1/{+name}:queryStatus";
11499 if self._scopes.is_empty() {
11500 self._scopes
11501 .insert(Scope::CloudPlatform.as_ref().to_string());
11502 }
11503
11504 #[allow(clippy::single_element_loop)]
11505 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11506 url = params.uri_replacement(url, param_name, find_this, true);
11507 }
11508 {
11509 let to_remove = ["name"];
11510 params.remove_params(&to_remove);
11511 }
11512
11513 let url = params.parse_with_url(&url);
11514
11515 loop {
11516 let token = match self
11517 .hub
11518 .auth
11519 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11520 .await
11521 {
11522 Ok(token) => token,
11523 Err(e) => match dlg.token(e) {
11524 Ok(token) => token,
11525 Err(e) => {
11526 dlg.finished(false);
11527 return Err(common::Error::MissingToken(e));
11528 }
11529 },
11530 };
11531 let mut req_result = {
11532 let client = &self.hub.client;
11533 dlg.pre_request();
11534 let mut req_builder = hyper::Request::builder()
11535 .method(hyper::Method::GET)
11536 .uri(url.as_str())
11537 .header(USER_AGENT, self.hub._user_agent.clone());
11538
11539 if let Some(token) = token.as_ref() {
11540 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11541 }
11542
11543 let request = req_builder
11544 .header(CONTENT_LENGTH, 0_u64)
11545 .body(common::to_body::<String>(None));
11546
11547 client.request(request.unwrap()).await
11548 };
11549
11550 match req_result {
11551 Err(err) => {
11552 if let common::Retry::After(d) = dlg.http_error(&err) {
11553 sleep(d).await;
11554 continue;
11555 }
11556 dlg.finished(false);
11557 return Err(common::Error::HttpError(err));
11558 }
11559 Ok(res) => {
11560 let (mut parts, body) = res.into_parts();
11561 let mut body = common::Body::new(body);
11562 if !parts.status.is_success() {
11563 let bytes = common::to_bytes(body).await.unwrap_or_default();
11564 let error = serde_json::from_str(&common::to_string(&bytes));
11565 let response = common::to_response(parts, bytes.into());
11566
11567 if let common::Retry::After(d) =
11568 dlg.http_failure(&response, error.as_ref().ok())
11569 {
11570 sleep(d).await;
11571 continue;
11572 }
11573
11574 dlg.finished(false);
11575
11576 return Err(match error {
11577 Ok(value) => common::Error::BadRequest(value),
11578 _ => common::Error::Failure(response),
11579 });
11580 }
11581 let response = {
11582 let bytes = common::to_bytes(body).await.unwrap_or_default();
11583 let encoded = common::to_string(&bytes);
11584 match serde_json::from_str(&encoded) {
11585 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11586 Err(error) => {
11587 dlg.response_json_decode_error(&encoded, &error);
11588 return Err(common::Error::JsonDecodeError(
11589 encoded.to_string(),
11590 error,
11591 ));
11592 }
11593 }
11594 };
11595
11596 dlg.finished(true);
11597 return Ok(response);
11598 }
11599 }
11600 }
11601 }
11602
11603 /// Required. The name of the hub.
11604 ///
11605 /// Sets the *name* path property to the given value.
11606 ///
11607 /// Even though the property as already been set when instantiating this call,
11608 /// we provide this method for API completeness.
11609 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11610 self._name = new_value.to_string();
11611 self
11612 }
11613 /// Optional. The page token.
11614 ///
11615 /// Sets the *page token* query property to the given value.
11616 pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11617 self._page_token = Some(new_value.to_string());
11618 self
11619 }
11620 /// Optional. The maximum number of results to return per page.
11621 ///
11622 /// Sets the *page size* query property to the given value.
11623 pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11624 self._page_size = Some(new_value);
11625 self
11626 }
11627 /// Optional. Sort the results in ascending order by the specified fields. A comma-separated list of any of these fields: * `psc_propagation_status.source_spoke` * `psc_propagation_status.source_group` * `psc_propagation_status.source_forwarding_rule` * `psc_propagation_status.target_spoke` * `psc_propagation_status.target_group` * `psc_propagation_status.code` If `group_by` is set, the value of the `order_by` field must be the same as or a subset of the `group_by` field.
11628 ///
11629 /// Sets the *order by* query property to the given value.
11630 pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11631 self._order_by = Some(new_value.to_string());
11632 self
11633 }
11634 /// Optional. Aggregate the results by the specified fields. A comma-separated list of any of these fields: * `psc_propagation_status.source_spoke` * `psc_propagation_status.source_group` * `psc_propagation_status.source_forwarding_rule` * `psc_propagation_status.target_spoke` * `psc_propagation_status.target_group` * `psc_propagation_status.code`
11635 ///
11636 /// Sets the *group by* query property to the given value.
11637 pub fn group_by(mut self, new_value: &str) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11638 self._group_by = Some(new_value.to_string());
11639 self
11640 }
11641 /// Optional. An expression that filters the list of results. The filter can be used to filter the results by the following fields: * `psc_propagation_status.source_spoke` * `psc_propagation_status.source_group` * `psc_propagation_status.source_forwarding_rule` * `psc_propagation_status.target_spoke` * `psc_propagation_status.target_group` * `psc_propagation_status.code` * `psc_propagation_status.message`
11642 ///
11643 /// Sets the *filter* query property to the given value.
11644 pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11645 self._filter = Some(new_value.to_string());
11646 self
11647 }
11648 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11649 /// while executing the actual API request.
11650 ///
11651 /// ````text
11652 /// It should be used to handle progress information, and to implement a certain level of resilience.
11653 /// ````
11654 ///
11655 /// Sets the *delegate* property to the given value.
11656 pub fn delegate(
11657 mut self,
11658 new_value: &'a mut dyn common::Delegate,
11659 ) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11660 self._delegate = Some(new_value);
11661 self
11662 }
11663
11664 /// Set any additional parameter of the query string used in the request.
11665 /// It should be used to set parameters which are not yet available through their own
11666 /// setters.
11667 ///
11668 /// Please note that this method must not be used to set any of the known parameters
11669 /// which have their own setter method. If done anyway, the request will fail.
11670 ///
11671 /// # Additional Parameters
11672 ///
11673 /// * *$.xgafv* (query-string) - V1 error format.
11674 /// * *access_token* (query-string) - OAuth access token.
11675 /// * *alt* (query-string) - Data format for response.
11676 /// * *callback* (query-string) - JSONP
11677 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11678 /// * *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.
11679 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11680 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11681 /// * *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.
11682 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11683 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11684 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubQueryStatuCall<'a, C>
11685 where
11686 T: AsRef<str>,
11687 {
11688 self._additional_params
11689 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11690 self
11691 }
11692
11693 /// Identifies the authorization scope for the method you are building.
11694 ///
11695 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11696 /// [`Scope::CloudPlatform`].
11697 ///
11698 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11699 /// tokens for more than one scope.
11700 ///
11701 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11702 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11703 /// sufficient, a read-write scope will do as well.
11704 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubQueryStatuCall<'a, C>
11705 where
11706 St: AsRef<str>,
11707 {
11708 self._scopes.insert(String::from(scope.as_ref()));
11709 self
11710 }
11711 /// Identifies the authorization scope(s) for the method you are building.
11712 ///
11713 /// See [`Self::add_scope()`] for details.
11714 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubQueryStatuCall<'a, C>
11715 where
11716 I: IntoIterator<Item = St>,
11717 St: AsRef<str>,
11718 {
11719 self._scopes
11720 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11721 self
11722 }
11723
11724 /// Removes all scopes, and no default scope will be used either.
11725 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11726 /// for details).
11727 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubQueryStatuCall<'a, C> {
11728 self._scopes.clear();
11729 self
11730 }
11731}
11732
11733/// Rejects a Network Connectivity Center spoke from being attached to a hub. If the spoke was previously in the `ACTIVE` state, it transitions to the `INACTIVE` state and is no longer able to connect to other spokes that are attached to the hub.
11734///
11735/// A builder for the *locations.global.hubs.rejectSpoke* method supported by a *project* resource.
11736/// It is not used directly, but through a [`ProjectMethods`] instance.
11737///
11738/// # Example
11739///
11740/// Instantiate a resource method builder
11741///
11742/// ```test_harness,no_run
11743/// # extern crate hyper;
11744/// # extern crate hyper_rustls;
11745/// # extern crate google_networkconnectivity1 as networkconnectivity1;
11746/// use networkconnectivity1::api::RejectHubSpokeRequest;
11747/// # async fn dox() {
11748/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11749///
11750/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11751/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11752/// # .with_native_roots()
11753/// # .unwrap()
11754/// # .https_only()
11755/// # .enable_http2()
11756/// # .build();
11757///
11758/// # let executor = hyper_util::rt::TokioExecutor::new();
11759/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11760/// # secret,
11761/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11762/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11763/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11764/// # ),
11765/// # ).build().await.unwrap();
11766///
11767/// # let client = hyper_util::client::legacy::Client::builder(
11768/// # hyper_util::rt::TokioExecutor::new()
11769/// # )
11770/// # .build(
11771/// # hyper_rustls::HttpsConnectorBuilder::new()
11772/// # .with_native_roots()
11773/// # .unwrap()
11774/// # .https_or_http()
11775/// # .enable_http2()
11776/// # .build()
11777/// # );
11778/// # let mut hub = Networkconnectivity::new(client, auth);
11779/// // As the method needs a request, you would usually fill it with the desired information
11780/// // into the respective structure. Some of the parts shown here might not be applicable !
11781/// // Values shown here are possibly random and not representative !
11782/// let mut req = RejectHubSpokeRequest::default();
11783///
11784/// // You can configure optional parameters by calling the respective setters at will, and
11785/// // execute the final call using `doit()`.
11786/// // Values shown here are possibly random and not representative !
11787/// let result = hub.projects().locations_global_hubs_reject_spoke(req, "name")
11788/// .doit().await;
11789/// # }
11790/// ```
11791pub struct ProjectLocationGlobalHubRejectSpokeCall<'a, C>
11792where
11793 C: 'a,
11794{
11795 hub: &'a Networkconnectivity<C>,
11796 _request: RejectHubSpokeRequest,
11797 _name: String,
11798 _delegate: Option<&'a mut dyn common::Delegate>,
11799 _additional_params: HashMap<String, String>,
11800 _scopes: BTreeSet<String>,
11801}
11802
11803impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubRejectSpokeCall<'a, C> {}
11804
11805impl<'a, C> ProjectLocationGlobalHubRejectSpokeCall<'a, C>
11806where
11807 C: common::Connector,
11808{
11809 /// Perform the operation you have build so far.
11810 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
11811 use std::borrow::Cow;
11812 use std::io::{Read, Seek};
11813
11814 use common::{url::Params, ToParts};
11815 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11816
11817 let mut dd = common::DefaultDelegate;
11818 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11819 dlg.begin(common::MethodInfo {
11820 id: "networkconnectivity.projects.locations.global.hubs.rejectSpoke",
11821 http_method: hyper::Method::POST,
11822 });
11823
11824 for &field in ["alt", "name"].iter() {
11825 if self._additional_params.contains_key(field) {
11826 dlg.finished(false);
11827 return Err(common::Error::FieldClash(field));
11828 }
11829 }
11830
11831 let mut params = Params::with_capacity(4 + self._additional_params.len());
11832 params.push("name", self._name);
11833
11834 params.extend(self._additional_params.iter());
11835
11836 params.push("alt", "json");
11837 let mut url = self.hub._base_url.clone() + "v1/{+name}:rejectSpoke";
11838 if self._scopes.is_empty() {
11839 self._scopes
11840 .insert(Scope::CloudPlatform.as_ref().to_string());
11841 }
11842
11843 #[allow(clippy::single_element_loop)]
11844 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11845 url = params.uri_replacement(url, param_name, find_this, true);
11846 }
11847 {
11848 let to_remove = ["name"];
11849 params.remove_params(&to_remove);
11850 }
11851
11852 let url = params.parse_with_url(&url);
11853
11854 let mut json_mime_type = mime::APPLICATION_JSON;
11855 let mut request_value_reader = {
11856 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11857 common::remove_json_null_values(&mut value);
11858 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11859 serde_json::to_writer(&mut dst, &value).unwrap();
11860 dst
11861 };
11862 let request_size = request_value_reader
11863 .seek(std::io::SeekFrom::End(0))
11864 .unwrap();
11865 request_value_reader
11866 .seek(std::io::SeekFrom::Start(0))
11867 .unwrap();
11868
11869 loop {
11870 let token = match self
11871 .hub
11872 .auth
11873 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11874 .await
11875 {
11876 Ok(token) => token,
11877 Err(e) => match dlg.token(e) {
11878 Ok(token) => token,
11879 Err(e) => {
11880 dlg.finished(false);
11881 return Err(common::Error::MissingToken(e));
11882 }
11883 },
11884 };
11885 request_value_reader
11886 .seek(std::io::SeekFrom::Start(0))
11887 .unwrap();
11888 let mut req_result = {
11889 let client = &self.hub.client;
11890 dlg.pre_request();
11891 let mut req_builder = hyper::Request::builder()
11892 .method(hyper::Method::POST)
11893 .uri(url.as_str())
11894 .header(USER_AGENT, self.hub._user_agent.clone());
11895
11896 if let Some(token) = token.as_ref() {
11897 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11898 }
11899
11900 let request = req_builder
11901 .header(CONTENT_TYPE, json_mime_type.to_string())
11902 .header(CONTENT_LENGTH, request_size as u64)
11903 .body(common::to_body(
11904 request_value_reader.get_ref().clone().into(),
11905 ));
11906
11907 client.request(request.unwrap()).await
11908 };
11909
11910 match req_result {
11911 Err(err) => {
11912 if let common::Retry::After(d) = dlg.http_error(&err) {
11913 sleep(d).await;
11914 continue;
11915 }
11916 dlg.finished(false);
11917 return Err(common::Error::HttpError(err));
11918 }
11919 Ok(res) => {
11920 let (mut parts, body) = res.into_parts();
11921 let mut body = common::Body::new(body);
11922 if !parts.status.is_success() {
11923 let bytes = common::to_bytes(body).await.unwrap_or_default();
11924 let error = serde_json::from_str(&common::to_string(&bytes));
11925 let response = common::to_response(parts, bytes.into());
11926
11927 if let common::Retry::After(d) =
11928 dlg.http_failure(&response, error.as_ref().ok())
11929 {
11930 sleep(d).await;
11931 continue;
11932 }
11933
11934 dlg.finished(false);
11935
11936 return Err(match error {
11937 Ok(value) => common::Error::BadRequest(value),
11938 _ => common::Error::Failure(response),
11939 });
11940 }
11941 let response = {
11942 let bytes = common::to_bytes(body).await.unwrap_or_default();
11943 let encoded = common::to_string(&bytes);
11944 match serde_json::from_str(&encoded) {
11945 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11946 Err(error) => {
11947 dlg.response_json_decode_error(&encoded, &error);
11948 return Err(common::Error::JsonDecodeError(
11949 encoded.to_string(),
11950 error,
11951 ));
11952 }
11953 }
11954 };
11955
11956 dlg.finished(true);
11957 return Ok(response);
11958 }
11959 }
11960 }
11961 }
11962
11963 ///
11964 /// Sets the *request* property to the given value.
11965 ///
11966 /// Even though the property as already been set when instantiating this call,
11967 /// we provide this method for API completeness.
11968 pub fn request(
11969 mut self,
11970 new_value: RejectHubSpokeRequest,
11971 ) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C> {
11972 self._request = new_value;
11973 self
11974 }
11975 /// Required. The name of the hub from which to reject the spoke.
11976 ///
11977 /// Sets the *name* path property to the given value.
11978 ///
11979 /// Even though the property as already been set when instantiating this call,
11980 /// we provide this method for API completeness.
11981 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C> {
11982 self._name = new_value.to_string();
11983 self
11984 }
11985 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11986 /// while executing the actual API request.
11987 ///
11988 /// ````text
11989 /// It should be used to handle progress information, and to implement a certain level of resilience.
11990 /// ````
11991 ///
11992 /// Sets the *delegate* property to the given value.
11993 pub fn delegate(
11994 mut self,
11995 new_value: &'a mut dyn common::Delegate,
11996 ) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C> {
11997 self._delegate = Some(new_value);
11998 self
11999 }
12000
12001 /// Set any additional parameter of the query string used in the request.
12002 /// It should be used to set parameters which are not yet available through their own
12003 /// setters.
12004 ///
12005 /// Please note that this method must not be used to set any of the known parameters
12006 /// which have their own setter method. If done anyway, the request will fail.
12007 ///
12008 /// # Additional Parameters
12009 ///
12010 /// * *$.xgafv* (query-string) - V1 error format.
12011 /// * *access_token* (query-string) - OAuth access token.
12012 /// * *alt* (query-string) - Data format for response.
12013 /// * *callback* (query-string) - JSONP
12014 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12015 /// * *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.
12016 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12017 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12018 /// * *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.
12019 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12020 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12021 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C>
12022 where
12023 T: AsRef<str>,
12024 {
12025 self._additional_params
12026 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12027 self
12028 }
12029
12030 /// Identifies the authorization scope for the method you are building.
12031 ///
12032 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12033 /// [`Scope::CloudPlatform`].
12034 ///
12035 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12036 /// tokens for more than one scope.
12037 ///
12038 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12039 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12040 /// sufficient, a read-write scope will do as well.
12041 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C>
12042 where
12043 St: AsRef<str>,
12044 {
12045 self._scopes.insert(String::from(scope.as_ref()));
12046 self
12047 }
12048 /// Identifies the authorization scope(s) for the method you are building.
12049 ///
12050 /// See [`Self::add_scope()`] for details.
12051 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C>
12052 where
12053 I: IntoIterator<Item = St>,
12054 St: AsRef<str>,
12055 {
12056 self._scopes
12057 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12058 self
12059 }
12060
12061 /// Removes all scopes, and no default scope will be used either.
12062 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12063 /// for details).
12064 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubRejectSpokeCall<'a, C> {
12065 self._scopes.clear();
12066 self
12067 }
12068}
12069
12070/// Rejects a proposal to update a Network Connectivity Center spoke in a hub.
12071///
12072/// A builder for the *locations.global.hubs.rejectSpokeUpdate* method supported by a *project* resource.
12073/// It is not used directly, but through a [`ProjectMethods`] instance.
12074///
12075/// # Example
12076///
12077/// Instantiate a resource method builder
12078///
12079/// ```test_harness,no_run
12080/// # extern crate hyper;
12081/// # extern crate hyper_rustls;
12082/// # extern crate google_networkconnectivity1 as networkconnectivity1;
12083/// use networkconnectivity1::api::RejectSpokeUpdateRequest;
12084/// # async fn dox() {
12085/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12086///
12087/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12088/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12089/// # .with_native_roots()
12090/// # .unwrap()
12091/// # .https_only()
12092/// # .enable_http2()
12093/// # .build();
12094///
12095/// # let executor = hyper_util::rt::TokioExecutor::new();
12096/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12097/// # secret,
12098/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12099/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12100/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12101/// # ),
12102/// # ).build().await.unwrap();
12103///
12104/// # let client = hyper_util::client::legacy::Client::builder(
12105/// # hyper_util::rt::TokioExecutor::new()
12106/// # )
12107/// # .build(
12108/// # hyper_rustls::HttpsConnectorBuilder::new()
12109/// # .with_native_roots()
12110/// # .unwrap()
12111/// # .https_or_http()
12112/// # .enable_http2()
12113/// # .build()
12114/// # );
12115/// # let mut hub = Networkconnectivity::new(client, auth);
12116/// // As the method needs a request, you would usually fill it with the desired information
12117/// // into the respective structure. Some of the parts shown here might not be applicable !
12118/// // Values shown here are possibly random and not representative !
12119/// let mut req = RejectSpokeUpdateRequest::default();
12120///
12121/// // You can configure optional parameters by calling the respective setters at will, and
12122/// // execute the final call using `doit()`.
12123/// // Values shown here are possibly random and not representative !
12124/// let result = hub.projects().locations_global_hubs_reject_spoke_update(req, "name")
12125/// .doit().await;
12126/// # }
12127/// ```
12128pub struct ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C>
12129where
12130 C: 'a,
12131{
12132 hub: &'a Networkconnectivity<C>,
12133 _request: RejectSpokeUpdateRequest,
12134 _name: String,
12135 _delegate: Option<&'a mut dyn common::Delegate>,
12136 _additional_params: HashMap<String, String>,
12137 _scopes: BTreeSet<String>,
12138}
12139
12140impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C> {}
12141
12142impl<'a, C> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C>
12143where
12144 C: common::Connector,
12145{
12146 /// Perform the operation you have build so far.
12147 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
12148 use std::borrow::Cow;
12149 use std::io::{Read, Seek};
12150
12151 use common::{url::Params, ToParts};
12152 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12153
12154 let mut dd = common::DefaultDelegate;
12155 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12156 dlg.begin(common::MethodInfo {
12157 id: "networkconnectivity.projects.locations.global.hubs.rejectSpokeUpdate",
12158 http_method: hyper::Method::POST,
12159 });
12160
12161 for &field in ["alt", "name"].iter() {
12162 if self._additional_params.contains_key(field) {
12163 dlg.finished(false);
12164 return Err(common::Error::FieldClash(field));
12165 }
12166 }
12167
12168 let mut params = Params::with_capacity(4 + self._additional_params.len());
12169 params.push("name", self._name);
12170
12171 params.extend(self._additional_params.iter());
12172
12173 params.push("alt", "json");
12174 let mut url = self.hub._base_url.clone() + "v1/{+name}:rejectSpokeUpdate";
12175 if self._scopes.is_empty() {
12176 self._scopes
12177 .insert(Scope::CloudPlatform.as_ref().to_string());
12178 }
12179
12180 #[allow(clippy::single_element_loop)]
12181 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12182 url = params.uri_replacement(url, param_name, find_this, true);
12183 }
12184 {
12185 let to_remove = ["name"];
12186 params.remove_params(&to_remove);
12187 }
12188
12189 let url = params.parse_with_url(&url);
12190
12191 let mut json_mime_type = mime::APPLICATION_JSON;
12192 let mut request_value_reader = {
12193 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12194 common::remove_json_null_values(&mut value);
12195 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12196 serde_json::to_writer(&mut dst, &value).unwrap();
12197 dst
12198 };
12199 let request_size = request_value_reader
12200 .seek(std::io::SeekFrom::End(0))
12201 .unwrap();
12202 request_value_reader
12203 .seek(std::io::SeekFrom::Start(0))
12204 .unwrap();
12205
12206 loop {
12207 let token = match self
12208 .hub
12209 .auth
12210 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12211 .await
12212 {
12213 Ok(token) => token,
12214 Err(e) => match dlg.token(e) {
12215 Ok(token) => token,
12216 Err(e) => {
12217 dlg.finished(false);
12218 return Err(common::Error::MissingToken(e));
12219 }
12220 },
12221 };
12222 request_value_reader
12223 .seek(std::io::SeekFrom::Start(0))
12224 .unwrap();
12225 let mut req_result = {
12226 let client = &self.hub.client;
12227 dlg.pre_request();
12228 let mut req_builder = hyper::Request::builder()
12229 .method(hyper::Method::POST)
12230 .uri(url.as_str())
12231 .header(USER_AGENT, self.hub._user_agent.clone());
12232
12233 if let Some(token) = token.as_ref() {
12234 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12235 }
12236
12237 let request = req_builder
12238 .header(CONTENT_TYPE, json_mime_type.to_string())
12239 .header(CONTENT_LENGTH, request_size as u64)
12240 .body(common::to_body(
12241 request_value_reader.get_ref().clone().into(),
12242 ));
12243
12244 client.request(request.unwrap()).await
12245 };
12246
12247 match req_result {
12248 Err(err) => {
12249 if let common::Retry::After(d) = dlg.http_error(&err) {
12250 sleep(d).await;
12251 continue;
12252 }
12253 dlg.finished(false);
12254 return Err(common::Error::HttpError(err));
12255 }
12256 Ok(res) => {
12257 let (mut parts, body) = res.into_parts();
12258 let mut body = common::Body::new(body);
12259 if !parts.status.is_success() {
12260 let bytes = common::to_bytes(body).await.unwrap_or_default();
12261 let error = serde_json::from_str(&common::to_string(&bytes));
12262 let response = common::to_response(parts, bytes.into());
12263
12264 if let common::Retry::After(d) =
12265 dlg.http_failure(&response, error.as_ref().ok())
12266 {
12267 sleep(d).await;
12268 continue;
12269 }
12270
12271 dlg.finished(false);
12272
12273 return Err(match error {
12274 Ok(value) => common::Error::BadRequest(value),
12275 _ => common::Error::Failure(response),
12276 });
12277 }
12278 let response = {
12279 let bytes = common::to_bytes(body).await.unwrap_or_default();
12280 let encoded = common::to_string(&bytes);
12281 match serde_json::from_str(&encoded) {
12282 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12283 Err(error) => {
12284 dlg.response_json_decode_error(&encoded, &error);
12285 return Err(common::Error::JsonDecodeError(
12286 encoded.to_string(),
12287 error,
12288 ));
12289 }
12290 }
12291 };
12292
12293 dlg.finished(true);
12294 return Ok(response);
12295 }
12296 }
12297 }
12298 }
12299
12300 ///
12301 /// Sets the *request* property to the given value.
12302 ///
12303 /// Even though the property as already been set when instantiating this call,
12304 /// we provide this method for API completeness.
12305 pub fn request(
12306 mut self,
12307 new_value: RejectSpokeUpdateRequest,
12308 ) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C> {
12309 self._request = new_value;
12310 self
12311 }
12312 /// Required. The name of the hub to reject spoke update.
12313 ///
12314 /// Sets the *name* path property to the given value.
12315 ///
12316 /// Even though the property as already been set when instantiating this call,
12317 /// we provide this method for API completeness.
12318 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C> {
12319 self._name = new_value.to_string();
12320 self
12321 }
12322 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12323 /// while executing the actual API request.
12324 ///
12325 /// ````text
12326 /// It should be used to handle progress information, and to implement a certain level of resilience.
12327 /// ````
12328 ///
12329 /// Sets the *delegate* property to the given value.
12330 pub fn delegate(
12331 mut self,
12332 new_value: &'a mut dyn common::Delegate,
12333 ) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C> {
12334 self._delegate = Some(new_value);
12335 self
12336 }
12337
12338 /// Set any additional parameter of the query string used in the request.
12339 /// It should be used to set parameters which are not yet available through their own
12340 /// setters.
12341 ///
12342 /// Please note that this method must not be used to set any of the known parameters
12343 /// which have their own setter method. If done anyway, the request will fail.
12344 ///
12345 /// # Additional Parameters
12346 ///
12347 /// * *$.xgafv* (query-string) - V1 error format.
12348 /// * *access_token* (query-string) - OAuth access token.
12349 /// * *alt* (query-string) - Data format for response.
12350 /// * *callback* (query-string) - JSONP
12351 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12352 /// * *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.
12353 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12354 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12355 /// * *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.
12356 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12357 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12358 pub fn param<T>(
12359 mut self,
12360 name: T,
12361 value: T,
12362 ) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C>
12363 where
12364 T: AsRef<str>,
12365 {
12366 self._additional_params
12367 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12368 self
12369 }
12370
12371 /// Identifies the authorization scope for the method you are building.
12372 ///
12373 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12374 /// [`Scope::CloudPlatform`].
12375 ///
12376 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12377 /// tokens for more than one scope.
12378 ///
12379 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12380 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12381 /// sufficient, a read-write scope will do as well.
12382 pub fn add_scope<St>(
12383 mut self,
12384 scope: St,
12385 ) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C>
12386 where
12387 St: AsRef<str>,
12388 {
12389 self._scopes.insert(String::from(scope.as_ref()));
12390 self
12391 }
12392 /// Identifies the authorization scope(s) for the method you are building.
12393 ///
12394 /// See [`Self::add_scope()`] for details.
12395 pub fn add_scopes<I, St>(
12396 mut self,
12397 scopes: I,
12398 ) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C>
12399 where
12400 I: IntoIterator<Item = St>,
12401 St: AsRef<str>,
12402 {
12403 self._scopes
12404 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12405 self
12406 }
12407
12408 /// Removes all scopes, and no default scope will be used either.
12409 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12410 /// for details).
12411 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubRejectSpokeUpdateCall<'a, C> {
12412 self._scopes.clear();
12413 self
12414 }
12415}
12416
12417/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
12418///
12419/// A builder for the *locations.global.hubs.setIamPolicy* method supported by a *project* resource.
12420/// It is not used directly, but through a [`ProjectMethods`] instance.
12421///
12422/// # Example
12423///
12424/// Instantiate a resource method builder
12425///
12426/// ```test_harness,no_run
12427/// # extern crate hyper;
12428/// # extern crate hyper_rustls;
12429/// # extern crate google_networkconnectivity1 as networkconnectivity1;
12430/// use networkconnectivity1::api::SetIamPolicyRequest;
12431/// # async fn dox() {
12432/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12433///
12434/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12435/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12436/// # .with_native_roots()
12437/// # .unwrap()
12438/// # .https_only()
12439/// # .enable_http2()
12440/// # .build();
12441///
12442/// # let executor = hyper_util::rt::TokioExecutor::new();
12443/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12444/// # secret,
12445/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12446/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12447/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12448/// # ),
12449/// # ).build().await.unwrap();
12450///
12451/// # let client = hyper_util::client::legacy::Client::builder(
12452/// # hyper_util::rt::TokioExecutor::new()
12453/// # )
12454/// # .build(
12455/// # hyper_rustls::HttpsConnectorBuilder::new()
12456/// # .with_native_roots()
12457/// # .unwrap()
12458/// # .https_or_http()
12459/// # .enable_http2()
12460/// # .build()
12461/// # );
12462/// # let mut hub = Networkconnectivity::new(client, auth);
12463/// // As the method needs a request, you would usually fill it with the desired information
12464/// // into the respective structure. Some of the parts shown here might not be applicable !
12465/// // Values shown here are possibly random and not representative !
12466/// let mut req = SetIamPolicyRequest::default();
12467///
12468/// // You can configure optional parameters by calling the respective setters at will, and
12469/// // execute the final call using `doit()`.
12470/// // Values shown here are possibly random and not representative !
12471/// let result = hub.projects().locations_global_hubs_set_iam_policy(req, "resource")
12472/// .doit().await;
12473/// # }
12474/// ```
12475pub struct ProjectLocationGlobalHubSetIamPolicyCall<'a, C>
12476where
12477 C: 'a,
12478{
12479 hub: &'a Networkconnectivity<C>,
12480 _request: SetIamPolicyRequest,
12481 _resource: String,
12482 _delegate: Option<&'a mut dyn common::Delegate>,
12483 _additional_params: HashMap<String, String>,
12484 _scopes: BTreeSet<String>,
12485}
12486
12487impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubSetIamPolicyCall<'a, C> {}
12488
12489impl<'a, C> ProjectLocationGlobalHubSetIamPolicyCall<'a, C>
12490where
12491 C: common::Connector,
12492{
12493 /// Perform the operation you have build so far.
12494 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12495 use std::borrow::Cow;
12496 use std::io::{Read, Seek};
12497
12498 use common::{url::Params, ToParts};
12499 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12500
12501 let mut dd = common::DefaultDelegate;
12502 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12503 dlg.begin(common::MethodInfo {
12504 id: "networkconnectivity.projects.locations.global.hubs.setIamPolicy",
12505 http_method: hyper::Method::POST,
12506 });
12507
12508 for &field in ["alt", "resource"].iter() {
12509 if self._additional_params.contains_key(field) {
12510 dlg.finished(false);
12511 return Err(common::Error::FieldClash(field));
12512 }
12513 }
12514
12515 let mut params = Params::with_capacity(4 + self._additional_params.len());
12516 params.push("resource", self._resource);
12517
12518 params.extend(self._additional_params.iter());
12519
12520 params.push("alt", "json");
12521 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
12522 if self._scopes.is_empty() {
12523 self._scopes
12524 .insert(Scope::CloudPlatform.as_ref().to_string());
12525 }
12526
12527 #[allow(clippy::single_element_loop)]
12528 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12529 url = params.uri_replacement(url, param_name, find_this, true);
12530 }
12531 {
12532 let to_remove = ["resource"];
12533 params.remove_params(&to_remove);
12534 }
12535
12536 let url = params.parse_with_url(&url);
12537
12538 let mut json_mime_type = mime::APPLICATION_JSON;
12539 let mut request_value_reader = {
12540 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12541 common::remove_json_null_values(&mut value);
12542 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12543 serde_json::to_writer(&mut dst, &value).unwrap();
12544 dst
12545 };
12546 let request_size = request_value_reader
12547 .seek(std::io::SeekFrom::End(0))
12548 .unwrap();
12549 request_value_reader
12550 .seek(std::io::SeekFrom::Start(0))
12551 .unwrap();
12552
12553 loop {
12554 let token = match self
12555 .hub
12556 .auth
12557 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12558 .await
12559 {
12560 Ok(token) => token,
12561 Err(e) => match dlg.token(e) {
12562 Ok(token) => token,
12563 Err(e) => {
12564 dlg.finished(false);
12565 return Err(common::Error::MissingToken(e));
12566 }
12567 },
12568 };
12569 request_value_reader
12570 .seek(std::io::SeekFrom::Start(0))
12571 .unwrap();
12572 let mut req_result = {
12573 let client = &self.hub.client;
12574 dlg.pre_request();
12575 let mut req_builder = hyper::Request::builder()
12576 .method(hyper::Method::POST)
12577 .uri(url.as_str())
12578 .header(USER_AGENT, self.hub._user_agent.clone());
12579
12580 if let Some(token) = token.as_ref() {
12581 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12582 }
12583
12584 let request = req_builder
12585 .header(CONTENT_TYPE, json_mime_type.to_string())
12586 .header(CONTENT_LENGTH, request_size as u64)
12587 .body(common::to_body(
12588 request_value_reader.get_ref().clone().into(),
12589 ));
12590
12591 client.request(request.unwrap()).await
12592 };
12593
12594 match req_result {
12595 Err(err) => {
12596 if let common::Retry::After(d) = dlg.http_error(&err) {
12597 sleep(d).await;
12598 continue;
12599 }
12600 dlg.finished(false);
12601 return Err(common::Error::HttpError(err));
12602 }
12603 Ok(res) => {
12604 let (mut parts, body) = res.into_parts();
12605 let mut body = common::Body::new(body);
12606 if !parts.status.is_success() {
12607 let bytes = common::to_bytes(body).await.unwrap_or_default();
12608 let error = serde_json::from_str(&common::to_string(&bytes));
12609 let response = common::to_response(parts, bytes.into());
12610
12611 if let common::Retry::After(d) =
12612 dlg.http_failure(&response, error.as_ref().ok())
12613 {
12614 sleep(d).await;
12615 continue;
12616 }
12617
12618 dlg.finished(false);
12619
12620 return Err(match error {
12621 Ok(value) => common::Error::BadRequest(value),
12622 _ => common::Error::Failure(response),
12623 });
12624 }
12625 let response = {
12626 let bytes = common::to_bytes(body).await.unwrap_or_default();
12627 let encoded = common::to_string(&bytes);
12628 match serde_json::from_str(&encoded) {
12629 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12630 Err(error) => {
12631 dlg.response_json_decode_error(&encoded, &error);
12632 return Err(common::Error::JsonDecodeError(
12633 encoded.to_string(),
12634 error,
12635 ));
12636 }
12637 }
12638 };
12639
12640 dlg.finished(true);
12641 return Ok(response);
12642 }
12643 }
12644 }
12645 }
12646
12647 ///
12648 /// Sets the *request* property to the given value.
12649 ///
12650 /// Even though the property as already been set when instantiating this call,
12651 /// we provide this method for API completeness.
12652 pub fn request(
12653 mut self,
12654 new_value: SetIamPolicyRequest,
12655 ) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C> {
12656 self._request = new_value;
12657 self
12658 }
12659 /// 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.
12660 ///
12661 /// Sets the *resource* path property to the given value.
12662 ///
12663 /// Even though the property as already been set when instantiating this call,
12664 /// we provide this method for API completeness.
12665 pub fn resource(mut self, new_value: &str) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C> {
12666 self._resource = new_value.to_string();
12667 self
12668 }
12669 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12670 /// while executing the actual API request.
12671 ///
12672 /// ````text
12673 /// It should be used to handle progress information, and to implement a certain level of resilience.
12674 /// ````
12675 ///
12676 /// Sets the *delegate* property to the given value.
12677 pub fn delegate(
12678 mut self,
12679 new_value: &'a mut dyn common::Delegate,
12680 ) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C> {
12681 self._delegate = Some(new_value);
12682 self
12683 }
12684
12685 /// Set any additional parameter of the query string used in the request.
12686 /// It should be used to set parameters which are not yet available through their own
12687 /// setters.
12688 ///
12689 /// Please note that this method must not be used to set any of the known parameters
12690 /// which have their own setter method. If done anyway, the request will fail.
12691 ///
12692 /// # Additional Parameters
12693 ///
12694 /// * *$.xgafv* (query-string) - V1 error format.
12695 /// * *access_token* (query-string) - OAuth access token.
12696 /// * *alt* (query-string) - Data format for response.
12697 /// * *callback* (query-string) - JSONP
12698 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12699 /// * *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.
12700 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12701 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12702 /// * *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.
12703 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12704 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12705 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C>
12706 where
12707 T: AsRef<str>,
12708 {
12709 self._additional_params
12710 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12711 self
12712 }
12713
12714 /// Identifies the authorization scope for the method you are building.
12715 ///
12716 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12717 /// [`Scope::CloudPlatform`].
12718 ///
12719 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12720 /// tokens for more than one scope.
12721 ///
12722 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12723 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12724 /// sufficient, a read-write scope will do as well.
12725 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C>
12726 where
12727 St: AsRef<str>,
12728 {
12729 self._scopes.insert(String::from(scope.as_ref()));
12730 self
12731 }
12732 /// Identifies the authorization scope(s) for the method you are building.
12733 ///
12734 /// See [`Self::add_scope()`] for details.
12735 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C>
12736 where
12737 I: IntoIterator<Item = St>,
12738 St: AsRef<str>,
12739 {
12740 self._scopes
12741 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12742 self
12743 }
12744
12745 /// Removes all scopes, and no default scope will be used either.
12746 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12747 /// for details).
12748 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubSetIamPolicyCall<'a, C> {
12749 self._scopes.clear();
12750 self
12751 }
12752}
12753
12754/// 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.
12755///
12756/// A builder for the *locations.global.hubs.testIamPermissions* method supported by a *project* resource.
12757/// It is not used directly, but through a [`ProjectMethods`] instance.
12758///
12759/// # Example
12760///
12761/// Instantiate a resource method builder
12762///
12763/// ```test_harness,no_run
12764/// # extern crate hyper;
12765/// # extern crate hyper_rustls;
12766/// # extern crate google_networkconnectivity1 as networkconnectivity1;
12767/// use networkconnectivity1::api::TestIamPermissionsRequest;
12768/// # async fn dox() {
12769/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12770///
12771/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12772/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12773/// # .with_native_roots()
12774/// # .unwrap()
12775/// # .https_only()
12776/// # .enable_http2()
12777/// # .build();
12778///
12779/// # let executor = hyper_util::rt::TokioExecutor::new();
12780/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12781/// # secret,
12782/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12783/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12784/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12785/// # ),
12786/// # ).build().await.unwrap();
12787///
12788/// # let client = hyper_util::client::legacy::Client::builder(
12789/// # hyper_util::rt::TokioExecutor::new()
12790/// # )
12791/// # .build(
12792/// # hyper_rustls::HttpsConnectorBuilder::new()
12793/// # .with_native_roots()
12794/// # .unwrap()
12795/// # .https_or_http()
12796/// # .enable_http2()
12797/// # .build()
12798/// # );
12799/// # let mut hub = Networkconnectivity::new(client, auth);
12800/// // As the method needs a request, you would usually fill it with the desired information
12801/// // into the respective structure. Some of the parts shown here might not be applicable !
12802/// // Values shown here are possibly random and not representative !
12803/// let mut req = TestIamPermissionsRequest::default();
12804///
12805/// // You can configure optional parameters by calling the respective setters at will, and
12806/// // execute the final call using `doit()`.
12807/// // Values shown here are possibly random and not representative !
12808/// let result = hub.projects().locations_global_hubs_test_iam_permissions(req, "resource")
12809/// .doit().await;
12810/// # }
12811/// ```
12812pub struct ProjectLocationGlobalHubTestIamPermissionCall<'a, C>
12813where
12814 C: 'a,
12815{
12816 hub: &'a Networkconnectivity<C>,
12817 _request: TestIamPermissionsRequest,
12818 _resource: String,
12819 _delegate: Option<&'a mut dyn common::Delegate>,
12820 _additional_params: HashMap<String, String>,
12821 _scopes: BTreeSet<String>,
12822}
12823
12824impl<'a, C> common::CallBuilder for ProjectLocationGlobalHubTestIamPermissionCall<'a, C> {}
12825
12826impl<'a, C> ProjectLocationGlobalHubTestIamPermissionCall<'a, C>
12827where
12828 C: common::Connector,
12829{
12830 /// Perform the operation you have build so far.
12831 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
12832 use std::borrow::Cow;
12833 use std::io::{Read, Seek};
12834
12835 use common::{url::Params, ToParts};
12836 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12837
12838 let mut dd = common::DefaultDelegate;
12839 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12840 dlg.begin(common::MethodInfo {
12841 id: "networkconnectivity.projects.locations.global.hubs.testIamPermissions",
12842 http_method: hyper::Method::POST,
12843 });
12844
12845 for &field in ["alt", "resource"].iter() {
12846 if self._additional_params.contains_key(field) {
12847 dlg.finished(false);
12848 return Err(common::Error::FieldClash(field));
12849 }
12850 }
12851
12852 let mut params = Params::with_capacity(4 + self._additional_params.len());
12853 params.push("resource", self._resource);
12854
12855 params.extend(self._additional_params.iter());
12856
12857 params.push("alt", "json");
12858 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
12859 if self._scopes.is_empty() {
12860 self._scopes
12861 .insert(Scope::CloudPlatform.as_ref().to_string());
12862 }
12863
12864 #[allow(clippy::single_element_loop)]
12865 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12866 url = params.uri_replacement(url, param_name, find_this, true);
12867 }
12868 {
12869 let to_remove = ["resource"];
12870 params.remove_params(&to_remove);
12871 }
12872
12873 let url = params.parse_with_url(&url);
12874
12875 let mut json_mime_type = mime::APPLICATION_JSON;
12876 let mut request_value_reader = {
12877 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12878 common::remove_json_null_values(&mut value);
12879 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12880 serde_json::to_writer(&mut dst, &value).unwrap();
12881 dst
12882 };
12883 let request_size = request_value_reader
12884 .seek(std::io::SeekFrom::End(0))
12885 .unwrap();
12886 request_value_reader
12887 .seek(std::io::SeekFrom::Start(0))
12888 .unwrap();
12889
12890 loop {
12891 let token = match self
12892 .hub
12893 .auth
12894 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12895 .await
12896 {
12897 Ok(token) => token,
12898 Err(e) => match dlg.token(e) {
12899 Ok(token) => token,
12900 Err(e) => {
12901 dlg.finished(false);
12902 return Err(common::Error::MissingToken(e));
12903 }
12904 },
12905 };
12906 request_value_reader
12907 .seek(std::io::SeekFrom::Start(0))
12908 .unwrap();
12909 let mut req_result = {
12910 let client = &self.hub.client;
12911 dlg.pre_request();
12912 let mut req_builder = hyper::Request::builder()
12913 .method(hyper::Method::POST)
12914 .uri(url.as_str())
12915 .header(USER_AGENT, self.hub._user_agent.clone());
12916
12917 if let Some(token) = token.as_ref() {
12918 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12919 }
12920
12921 let request = req_builder
12922 .header(CONTENT_TYPE, json_mime_type.to_string())
12923 .header(CONTENT_LENGTH, request_size as u64)
12924 .body(common::to_body(
12925 request_value_reader.get_ref().clone().into(),
12926 ));
12927
12928 client.request(request.unwrap()).await
12929 };
12930
12931 match req_result {
12932 Err(err) => {
12933 if let common::Retry::After(d) = dlg.http_error(&err) {
12934 sleep(d).await;
12935 continue;
12936 }
12937 dlg.finished(false);
12938 return Err(common::Error::HttpError(err));
12939 }
12940 Ok(res) => {
12941 let (mut parts, body) = res.into_parts();
12942 let mut body = common::Body::new(body);
12943 if !parts.status.is_success() {
12944 let bytes = common::to_bytes(body).await.unwrap_or_default();
12945 let error = serde_json::from_str(&common::to_string(&bytes));
12946 let response = common::to_response(parts, bytes.into());
12947
12948 if let common::Retry::After(d) =
12949 dlg.http_failure(&response, error.as_ref().ok())
12950 {
12951 sleep(d).await;
12952 continue;
12953 }
12954
12955 dlg.finished(false);
12956
12957 return Err(match error {
12958 Ok(value) => common::Error::BadRequest(value),
12959 _ => common::Error::Failure(response),
12960 });
12961 }
12962 let response = {
12963 let bytes = common::to_bytes(body).await.unwrap_or_default();
12964 let encoded = common::to_string(&bytes);
12965 match serde_json::from_str(&encoded) {
12966 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12967 Err(error) => {
12968 dlg.response_json_decode_error(&encoded, &error);
12969 return Err(common::Error::JsonDecodeError(
12970 encoded.to_string(),
12971 error,
12972 ));
12973 }
12974 }
12975 };
12976
12977 dlg.finished(true);
12978 return Ok(response);
12979 }
12980 }
12981 }
12982 }
12983
12984 ///
12985 /// Sets the *request* property to the given value.
12986 ///
12987 /// Even though the property as already been set when instantiating this call,
12988 /// we provide this method for API completeness.
12989 pub fn request(
12990 mut self,
12991 new_value: TestIamPermissionsRequest,
12992 ) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C> {
12993 self._request = new_value;
12994 self
12995 }
12996 /// 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.
12997 ///
12998 /// Sets the *resource* path property to the given value.
12999 ///
13000 /// Even though the property as already been set when instantiating this call,
13001 /// we provide this method for API completeness.
13002 pub fn resource(
13003 mut self,
13004 new_value: &str,
13005 ) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C> {
13006 self._resource = new_value.to_string();
13007 self
13008 }
13009 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13010 /// while executing the actual API request.
13011 ///
13012 /// ````text
13013 /// It should be used to handle progress information, and to implement a certain level of resilience.
13014 /// ````
13015 ///
13016 /// Sets the *delegate* property to the given value.
13017 pub fn delegate(
13018 mut self,
13019 new_value: &'a mut dyn common::Delegate,
13020 ) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C> {
13021 self._delegate = Some(new_value);
13022 self
13023 }
13024
13025 /// Set any additional parameter of the query string used in the request.
13026 /// It should be used to set parameters which are not yet available through their own
13027 /// setters.
13028 ///
13029 /// Please note that this method must not be used to set any of the known parameters
13030 /// which have their own setter method. If done anyway, the request will fail.
13031 ///
13032 /// # Additional Parameters
13033 ///
13034 /// * *$.xgafv* (query-string) - V1 error format.
13035 /// * *access_token* (query-string) - OAuth access token.
13036 /// * *alt* (query-string) - Data format for response.
13037 /// * *callback* (query-string) - JSONP
13038 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13039 /// * *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.
13040 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13041 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13042 /// * *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.
13043 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13044 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13045 pub fn param<T>(
13046 mut self,
13047 name: T,
13048 value: T,
13049 ) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C>
13050 where
13051 T: AsRef<str>,
13052 {
13053 self._additional_params
13054 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13055 self
13056 }
13057
13058 /// Identifies the authorization scope for the method you are building.
13059 ///
13060 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13061 /// [`Scope::CloudPlatform`].
13062 ///
13063 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13064 /// tokens for more than one scope.
13065 ///
13066 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13067 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13068 /// sufficient, a read-write scope will do as well.
13069 pub fn add_scope<St>(
13070 mut self,
13071 scope: St,
13072 ) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C>
13073 where
13074 St: AsRef<str>,
13075 {
13076 self._scopes.insert(String::from(scope.as_ref()));
13077 self
13078 }
13079 /// Identifies the authorization scope(s) for the method you are building.
13080 ///
13081 /// See [`Self::add_scope()`] for details.
13082 pub fn add_scopes<I, St>(
13083 mut self,
13084 scopes: I,
13085 ) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C>
13086 where
13087 I: IntoIterator<Item = St>,
13088 St: AsRef<str>,
13089 {
13090 self._scopes
13091 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13092 self
13093 }
13094
13095 /// Removes all scopes, and no default scope will be used either.
13096 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13097 /// for details).
13098 pub fn clear_scopes(mut self) -> ProjectLocationGlobalHubTestIamPermissionCall<'a, C> {
13099 self._scopes.clear();
13100 self
13101 }
13102}
13103
13104/// Creates a new policy-based route in a given project and location.
13105///
13106/// A builder for the *locations.global.policyBasedRoutes.create* method supported by a *project* resource.
13107/// It is not used directly, but through a [`ProjectMethods`] instance.
13108///
13109/// # Example
13110///
13111/// Instantiate a resource method builder
13112///
13113/// ```test_harness,no_run
13114/// # extern crate hyper;
13115/// # extern crate hyper_rustls;
13116/// # extern crate google_networkconnectivity1 as networkconnectivity1;
13117/// use networkconnectivity1::api::PolicyBasedRoute;
13118/// # async fn dox() {
13119/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13120///
13121/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13122/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13123/// # .with_native_roots()
13124/// # .unwrap()
13125/// # .https_only()
13126/// # .enable_http2()
13127/// # .build();
13128///
13129/// # let executor = hyper_util::rt::TokioExecutor::new();
13130/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13131/// # secret,
13132/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13133/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13134/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13135/// # ),
13136/// # ).build().await.unwrap();
13137///
13138/// # let client = hyper_util::client::legacy::Client::builder(
13139/// # hyper_util::rt::TokioExecutor::new()
13140/// # )
13141/// # .build(
13142/// # hyper_rustls::HttpsConnectorBuilder::new()
13143/// # .with_native_roots()
13144/// # .unwrap()
13145/// # .https_or_http()
13146/// # .enable_http2()
13147/// # .build()
13148/// # );
13149/// # let mut hub = Networkconnectivity::new(client, auth);
13150/// // As the method needs a request, you would usually fill it with the desired information
13151/// // into the respective structure. Some of the parts shown here might not be applicable !
13152/// // Values shown here are possibly random and not representative !
13153/// let mut req = PolicyBasedRoute::default();
13154///
13155/// // You can configure optional parameters by calling the respective setters at will, and
13156/// // execute the final call using `doit()`.
13157/// // Values shown here are possibly random and not representative !
13158/// let result = hub.projects().locations_global_policy_based_routes_create(req, "parent")
13159/// .request_id("erat")
13160/// .policy_based_route_id("consetetur")
13161/// .doit().await;
13162/// # }
13163/// ```
13164pub struct ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C>
13165where
13166 C: 'a,
13167{
13168 hub: &'a Networkconnectivity<C>,
13169 _request: PolicyBasedRoute,
13170 _parent: String,
13171 _request_id: Option<String>,
13172 _policy_based_route_id: Option<String>,
13173 _delegate: Option<&'a mut dyn common::Delegate>,
13174 _additional_params: HashMap<String, String>,
13175 _scopes: BTreeSet<String>,
13176}
13177
13178impl<'a, C> common::CallBuilder for ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {}
13179
13180impl<'a, C> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C>
13181where
13182 C: common::Connector,
13183{
13184 /// Perform the operation you have build so far.
13185 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
13186 use std::borrow::Cow;
13187 use std::io::{Read, Seek};
13188
13189 use common::{url::Params, ToParts};
13190 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13191
13192 let mut dd = common::DefaultDelegate;
13193 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13194 dlg.begin(common::MethodInfo {
13195 id: "networkconnectivity.projects.locations.global.policyBasedRoutes.create",
13196 http_method: hyper::Method::POST,
13197 });
13198
13199 for &field in ["alt", "parent", "requestId", "policyBasedRouteId"].iter() {
13200 if self._additional_params.contains_key(field) {
13201 dlg.finished(false);
13202 return Err(common::Error::FieldClash(field));
13203 }
13204 }
13205
13206 let mut params = Params::with_capacity(6 + self._additional_params.len());
13207 params.push("parent", self._parent);
13208 if let Some(value) = self._request_id.as_ref() {
13209 params.push("requestId", value);
13210 }
13211 if let Some(value) = self._policy_based_route_id.as_ref() {
13212 params.push("policyBasedRouteId", value);
13213 }
13214
13215 params.extend(self._additional_params.iter());
13216
13217 params.push("alt", "json");
13218 let mut url = self.hub._base_url.clone() + "v1/{+parent}/policyBasedRoutes";
13219 if self._scopes.is_empty() {
13220 self._scopes
13221 .insert(Scope::CloudPlatform.as_ref().to_string());
13222 }
13223
13224 #[allow(clippy::single_element_loop)]
13225 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13226 url = params.uri_replacement(url, param_name, find_this, true);
13227 }
13228 {
13229 let to_remove = ["parent"];
13230 params.remove_params(&to_remove);
13231 }
13232
13233 let url = params.parse_with_url(&url);
13234
13235 let mut json_mime_type = mime::APPLICATION_JSON;
13236 let mut request_value_reader = {
13237 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13238 common::remove_json_null_values(&mut value);
13239 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13240 serde_json::to_writer(&mut dst, &value).unwrap();
13241 dst
13242 };
13243 let request_size = request_value_reader
13244 .seek(std::io::SeekFrom::End(0))
13245 .unwrap();
13246 request_value_reader
13247 .seek(std::io::SeekFrom::Start(0))
13248 .unwrap();
13249
13250 loop {
13251 let token = match self
13252 .hub
13253 .auth
13254 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13255 .await
13256 {
13257 Ok(token) => token,
13258 Err(e) => match dlg.token(e) {
13259 Ok(token) => token,
13260 Err(e) => {
13261 dlg.finished(false);
13262 return Err(common::Error::MissingToken(e));
13263 }
13264 },
13265 };
13266 request_value_reader
13267 .seek(std::io::SeekFrom::Start(0))
13268 .unwrap();
13269 let mut req_result = {
13270 let client = &self.hub.client;
13271 dlg.pre_request();
13272 let mut req_builder = hyper::Request::builder()
13273 .method(hyper::Method::POST)
13274 .uri(url.as_str())
13275 .header(USER_AGENT, self.hub._user_agent.clone());
13276
13277 if let Some(token) = token.as_ref() {
13278 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13279 }
13280
13281 let request = req_builder
13282 .header(CONTENT_TYPE, json_mime_type.to_string())
13283 .header(CONTENT_LENGTH, request_size as u64)
13284 .body(common::to_body(
13285 request_value_reader.get_ref().clone().into(),
13286 ));
13287
13288 client.request(request.unwrap()).await
13289 };
13290
13291 match req_result {
13292 Err(err) => {
13293 if let common::Retry::After(d) = dlg.http_error(&err) {
13294 sleep(d).await;
13295 continue;
13296 }
13297 dlg.finished(false);
13298 return Err(common::Error::HttpError(err));
13299 }
13300 Ok(res) => {
13301 let (mut parts, body) = res.into_parts();
13302 let mut body = common::Body::new(body);
13303 if !parts.status.is_success() {
13304 let bytes = common::to_bytes(body).await.unwrap_or_default();
13305 let error = serde_json::from_str(&common::to_string(&bytes));
13306 let response = common::to_response(parts, bytes.into());
13307
13308 if let common::Retry::After(d) =
13309 dlg.http_failure(&response, error.as_ref().ok())
13310 {
13311 sleep(d).await;
13312 continue;
13313 }
13314
13315 dlg.finished(false);
13316
13317 return Err(match error {
13318 Ok(value) => common::Error::BadRequest(value),
13319 _ => common::Error::Failure(response),
13320 });
13321 }
13322 let response = {
13323 let bytes = common::to_bytes(body).await.unwrap_or_default();
13324 let encoded = common::to_string(&bytes);
13325 match serde_json::from_str(&encoded) {
13326 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13327 Err(error) => {
13328 dlg.response_json_decode_error(&encoded, &error);
13329 return Err(common::Error::JsonDecodeError(
13330 encoded.to_string(),
13331 error,
13332 ));
13333 }
13334 }
13335 };
13336
13337 dlg.finished(true);
13338 return Ok(response);
13339 }
13340 }
13341 }
13342 }
13343
13344 ///
13345 /// Sets the *request* property to the given value.
13346 ///
13347 /// Even though the property as already been set when instantiating this call,
13348 /// we provide this method for API completeness.
13349 pub fn request(
13350 mut self,
13351 new_value: PolicyBasedRoute,
13352 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {
13353 self._request = new_value;
13354 self
13355 }
13356 /// Required. The parent resource's name of the PolicyBasedRoute.
13357 ///
13358 /// Sets the *parent* path property to the given value.
13359 ///
13360 /// Even though the property as already been set when instantiating this call,
13361 /// we provide this method for API completeness.
13362 pub fn parent(
13363 mut self,
13364 new_value: &str,
13365 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {
13366 self._parent = new_value.to_string();
13367 self
13368 }
13369 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
13370 ///
13371 /// Sets the *request id* query property to the given value.
13372 pub fn request_id(
13373 mut self,
13374 new_value: &str,
13375 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {
13376 self._request_id = Some(new_value.to_string());
13377 self
13378 }
13379 /// Required. Unique id for the policy-based route to create. Provided by the client when the resource is created. The name must comply with https://google.aip.dev/122#resource-id-segments. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([a-z0-9-]*[a-z0-9])?. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit.
13380 ///
13381 /// Sets the *policy based route id* query property to the given value.
13382 pub fn policy_based_route_id(
13383 mut self,
13384 new_value: &str,
13385 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {
13386 self._policy_based_route_id = Some(new_value.to_string());
13387 self
13388 }
13389 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13390 /// while executing the actual API request.
13391 ///
13392 /// ````text
13393 /// It should be used to handle progress information, and to implement a certain level of resilience.
13394 /// ````
13395 ///
13396 /// Sets the *delegate* property to the given value.
13397 pub fn delegate(
13398 mut self,
13399 new_value: &'a mut dyn common::Delegate,
13400 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {
13401 self._delegate = Some(new_value);
13402 self
13403 }
13404
13405 /// Set any additional parameter of the query string used in the request.
13406 /// It should be used to set parameters which are not yet available through their own
13407 /// setters.
13408 ///
13409 /// Please note that this method must not be used to set any of the known parameters
13410 /// which have their own setter method. If done anyway, the request will fail.
13411 ///
13412 /// # Additional Parameters
13413 ///
13414 /// * *$.xgafv* (query-string) - V1 error format.
13415 /// * *access_token* (query-string) - OAuth access token.
13416 /// * *alt* (query-string) - Data format for response.
13417 /// * *callback* (query-string) - JSONP
13418 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13419 /// * *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.
13420 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13421 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13422 /// * *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.
13423 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13424 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13425 pub fn param<T>(
13426 mut self,
13427 name: T,
13428 value: T,
13429 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C>
13430 where
13431 T: AsRef<str>,
13432 {
13433 self._additional_params
13434 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13435 self
13436 }
13437
13438 /// Identifies the authorization scope for the method you are building.
13439 ///
13440 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13441 /// [`Scope::CloudPlatform`].
13442 ///
13443 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13444 /// tokens for more than one scope.
13445 ///
13446 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13447 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13448 /// sufficient, a read-write scope will do as well.
13449 pub fn add_scope<St>(
13450 mut self,
13451 scope: St,
13452 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C>
13453 where
13454 St: AsRef<str>,
13455 {
13456 self._scopes.insert(String::from(scope.as_ref()));
13457 self
13458 }
13459 /// Identifies the authorization scope(s) for the method you are building.
13460 ///
13461 /// See [`Self::add_scope()`] for details.
13462 pub fn add_scopes<I, St>(
13463 mut self,
13464 scopes: I,
13465 ) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C>
13466 where
13467 I: IntoIterator<Item = St>,
13468 St: AsRef<str>,
13469 {
13470 self._scopes
13471 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13472 self
13473 }
13474
13475 /// Removes all scopes, and no default scope will be used either.
13476 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13477 /// for details).
13478 pub fn clear_scopes(mut self) -> ProjectLocationGlobalPolicyBasedRouteCreateCall<'a, C> {
13479 self._scopes.clear();
13480 self
13481 }
13482}
13483
13484/// Deletes a single policy-based route.
13485///
13486/// A builder for the *locations.global.policyBasedRoutes.delete* method supported by a *project* resource.
13487/// It is not used directly, but through a [`ProjectMethods`] instance.
13488///
13489/// # Example
13490///
13491/// Instantiate a resource method builder
13492///
13493/// ```test_harness,no_run
13494/// # extern crate hyper;
13495/// # extern crate hyper_rustls;
13496/// # extern crate google_networkconnectivity1 as networkconnectivity1;
13497/// # async fn dox() {
13498/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13499///
13500/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13501/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13502/// # .with_native_roots()
13503/// # .unwrap()
13504/// # .https_only()
13505/// # .enable_http2()
13506/// # .build();
13507///
13508/// # let executor = hyper_util::rt::TokioExecutor::new();
13509/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13510/// # secret,
13511/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13512/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13513/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13514/// # ),
13515/// # ).build().await.unwrap();
13516///
13517/// # let client = hyper_util::client::legacy::Client::builder(
13518/// # hyper_util::rt::TokioExecutor::new()
13519/// # )
13520/// # .build(
13521/// # hyper_rustls::HttpsConnectorBuilder::new()
13522/// # .with_native_roots()
13523/// # .unwrap()
13524/// # .https_or_http()
13525/// # .enable_http2()
13526/// # .build()
13527/// # );
13528/// # let mut hub = Networkconnectivity::new(client, auth);
13529/// // You can configure optional parameters by calling the respective setters at will, and
13530/// // execute the final call using `doit()`.
13531/// // Values shown here are possibly random and not representative !
13532/// let result = hub.projects().locations_global_policy_based_routes_delete("name")
13533/// .request_id("sed")
13534/// .doit().await;
13535/// # }
13536/// ```
13537pub struct ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C>
13538where
13539 C: 'a,
13540{
13541 hub: &'a Networkconnectivity<C>,
13542 _name: String,
13543 _request_id: Option<String>,
13544 _delegate: Option<&'a mut dyn common::Delegate>,
13545 _additional_params: HashMap<String, String>,
13546 _scopes: BTreeSet<String>,
13547}
13548
13549impl<'a, C> common::CallBuilder for ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C> {}
13550
13551impl<'a, C> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C>
13552where
13553 C: common::Connector,
13554{
13555 /// Perform the operation you have build so far.
13556 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
13557 use std::borrow::Cow;
13558 use std::io::{Read, Seek};
13559
13560 use common::{url::Params, ToParts};
13561 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13562
13563 let mut dd = common::DefaultDelegate;
13564 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13565 dlg.begin(common::MethodInfo {
13566 id: "networkconnectivity.projects.locations.global.policyBasedRoutes.delete",
13567 http_method: hyper::Method::DELETE,
13568 });
13569
13570 for &field in ["alt", "name", "requestId"].iter() {
13571 if self._additional_params.contains_key(field) {
13572 dlg.finished(false);
13573 return Err(common::Error::FieldClash(field));
13574 }
13575 }
13576
13577 let mut params = Params::with_capacity(4 + self._additional_params.len());
13578 params.push("name", self._name);
13579 if let Some(value) = self._request_id.as_ref() {
13580 params.push("requestId", value);
13581 }
13582
13583 params.extend(self._additional_params.iter());
13584
13585 params.push("alt", "json");
13586 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13587 if self._scopes.is_empty() {
13588 self._scopes
13589 .insert(Scope::CloudPlatform.as_ref().to_string());
13590 }
13591
13592 #[allow(clippy::single_element_loop)]
13593 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13594 url = params.uri_replacement(url, param_name, find_this, true);
13595 }
13596 {
13597 let to_remove = ["name"];
13598 params.remove_params(&to_remove);
13599 }
13600
13601 let url = params.parse_with_url(&url);
13602
13603 loop {
13604 let token = match self
13605 .hub
13606 .auth
13607 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13608 .await
13609 {
13610 Ok(token) => token,
13611 Err(e) => match dlg.token(e) {
13612 Ok(token) => token,
13613 Err(e) => {
13614 dlg.finished(false);
13615 return Err(common::Error::MissingToken(e));
13616 }
13617 },
13618 };
13619 let mut req_result = {
13620 let client = &self.hub.client;
13621 dlg.pre_request();
13622 let mut req_builder = hyper::Request::builder()
13623 .method(hyper::Method::DELETE)
13624 .uri(url.as_str())
13625 .header(USER_AGENT, self.hub._user_agent.clone());
13626
13627 if let Some(token) = token.as_ref() {
13628 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13629 }
13630
13631 let request = req_builder
13632 .header(CONTENT_LENGTH, 0_u64)
13633 .body(common::to_body::<String>(None));
13634
13635 client.request(request.unwrap()).await
13636 };
13637
13638 match req_result {
13639 Err(err) => {
13640 if let common::Retry::After(d) = dlg.http_error(&err) {
13641 sleep(d).await;
13642 continue;
13643 }
13644 dlg.finished(false);
13645 return Err(common::Error::HttpError(err));
13646 }
13647 Ok(res) => {
13648 let (mut parts, body) = res.into_parts();
13649 let mut body = common::Body::new(body);
13650 if !parts.status.is_success() {
13651 let bytes = common::to_bytes(body).await.unwrap_or_default();
13652 let error = serde_json::from_str(&common::to_string(&bytes));
13653 let response = common::to_response(parts, bytes.into());
13654
13655 if let common::Retry::After(d) =
13656 dlg.http_failure(&response, error.as_ref().ok())
13657 {
13658 sleep(d).await;
13659 continue;
13660 }
13661
13662 dlg.finished(false);
13663
13664 return Err(match error {
13665 Ok(value) => common::Error::BadRequest(value),
13666 _ => common::Error::Failure(response),
13667 });
13668 }
13669 let response = {
13670 let bytes = common::to_bytes(body).await.unwrap_or_default();
13671 let encoded = common::to_string(&bytes);
13672 match serde_json::from_str(&encoded) {
13673 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13674 Err(error) => {
13675 dlg.response_json_decode_error(&encoded, &error);
13676 return Err(common::Error::JsonDecodeError(
13677 encoded.to_string(),
13678 error,
13679 ));
13680 }
13681 }
13682 };
13683
13684 dlg.finished(true);
13685 return Ok(response);
13686 }
13687 }
13688 }
13689 }
13690
13691 /// Required. Name of the policy-based route resource to delete.
13692 ///
13693 /// Sets the *name* path property to the given value.
13694 ///
13695 /// Even though the property as already been set when instantiating this call,
13696 /// we provide this method for API completeness.
13697 pub fn name(
13698 mut self,
13699 new_value: &str,
13700 ) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C> {
13701 self._name = new_value.to_string();
13702 self
13703 }
13704 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
13705 ///
13706 /// Sets the *request id* query property to the given value.
13707 pub fn request_id(
13708 mut self,
13709 new_value: &str,
13710 ) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C> {
13711 self._request_id = Some(new_value.to_string());
13712 self
13713 }
13714 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13715 /// while executing the actual API request.
13716 ///
13717 /// ````text
13718 /// It should be used to handle progress information, and to implement a certain level of resilience.
13719 /// ````
13720 ///
13721 /// Sets the *delegate* property to the given value.
13722 pub fn delegate(
13723 mut self,
13724 new_value: &'a mut dyn common::Delegate,
13725 ) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C> {
13726 self._delegate = Some(new_value);
13727 self
13728 }
13729
13730 /// Set any additional parameter of the query string used in the request.
13731 /// It should be used to set parameters which are not yet available through their own
13732 /// setters.
13733 ///
13734 /// Please note that this method must not be used to set any of the known parameters
13735 /// which have their own setter method. If done anyway, the request will fail.
13736 ///
13737 /// # Additional Parameters
13738 ///
13739 /// * *$.xgafv* (query-string) - V1 error format.
13740 /// * *access_token* (query-string) - OAuth access token.
13741 /// * *alt* (query-string) - Data format for response.
13742 /// * *callback* (query-string) - JSONP
13743 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13744 /// * *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.
13745 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13746 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13747 /// * *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.
13748 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13749 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13750 pub fn param<T>(
13751 mut self,
13752 name: T,
13753 value: T,
13754 ) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C>
13755 where
13756 T: AsRef<str>,
13757 {
13758 self._additional_params
13759 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13760 self
13761 }
13762
13763 /// Identifies the authorization scope for the method you are building.
13764 ///
13765 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13766 /// [`Scope::CloudPlatform`].
13767 ///
13768 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13769 /// tokens for more than one scope.
13770 ///
13771 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13772 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13773 /// sufficient, a read-write scope will do as well.
13774 pub fn add_scope<St>(
13775 mut self,
13776 scope: St,
13777 ) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C>
13778 where
13779 St: AsRef<str>,
13780 {
13781 self._scopes.insert(String::from(scope.as_ref()));
13782 self
13783 }
13784 /// Identifies the authorization scope(s) for the method you are building.
13785 ///
13786 /// See [`Self::add_scope()`] for details.
13787 pub fn add_scopes<I, St>(
13788 mut self,
13789 scopes: I,
13790 ) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C>
13791 where
13792 I: IntoIterator<Item = St>,
13793 St: AsRef<str>,
13794 {
13795 self._scopes
13796 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13797 self
13798 }
13799
13800 /// Removes all scopes, and no default scope will be used either.
13801 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13802 /// for details).
13803 pub fn clear_scopes(mut self) -> ProjectLocationGlobalPolicyBasedRouteDeleteCall<'a, C> {
13804 self._scopes.clear();
13805 self
13806 }
13807}
13808
13809/// Gets details of a single policy-based route.
13810///
13811/// A builder for the *locations.global.policyBasedRoutes.get* method supported by a *project* resource.
13812/// It is not used directly, but through a [`ProjectMethods`] instance.
13813///
13814/// # Example
13815///
13816/// Instantiate a resource method builder
13817///
13818/// ```test_harness,no_run
13819/// # extern crate hyper;
13820/// # extern crate hyper_rustls;
13821/// # extern crate google_networkconnectivity1 as networkconnectivity1;
13822/// # async fn dox() {
13823/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13824///
13825/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13826/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13827/// # .with_native_roots()
13828/// # .unwrap()
13829/// # .https_only()
13830/// # .enable_http2()
13831/// # .build();
13832///
13833/// # let executor = hyper_util::rt::TokioExecutor::new();
13834/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13835/// # secret,
13836/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13837/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13838/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13839/// # ),
13840/// # ).build().await.unwrap();
13841///
13842/// # let client = hyper_util::client::legacy::Client::builder(
13843/// # hyper_util::rt::TokioExecutor::new()
13844/// # )
13845/// # .build(
13846/// # hyper_rustls::HttpsConnectorBuilder::new()
13847/// # .with_native_roots()
13848/// # .unwrap()
13849/// # .https_or_http()
13850/// # .enable_http2()
13851/// # .build()
13852/// # );
13853/// # let mut hub = Networkconnectivity::new(client, auth);
13854/// // You can configure optional parameters by calling the respective setters at will, and
13855/// // execute the final call using `doit()`.
13856/// // Values shown here are possibly random and not representative !
13857/// let result = hub.projects().locations_global_policy_based_routes_get("name")
13858/// .doit().await;
13859/// # }
13860/// ```
13861pub struct ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C>
13862where
13863 C: 'a,
13864{
13865 hub: &'a Networkconnectivity<C>,
13866 _name: String,
13867 _delegate: Option<&'a mut dyn common::Delegate>,
13868 _additional_params: HashMap<String, String>,
13869 _scopes: BTreeSet<String>,
13870}
13871
13872impl<'a, C> common::CallBuilder for ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C> {}
13873
13874impl<'a, C> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C>
13875where
13876 C: common::Connector,
13877{
13878 /// Perform the operation you have build so far.
13879 pub async fn doit(mut self) -> common::Result<(common::Response, PolicyBasedRoute)> {
13880 use std::borrow::Cow;
13881 use std::io::{Read, Seek};
13882
13883 use common::{url::Params, ToParts};
13884 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13885
13886 let mut dd = common::DefaultDelegate;
13887 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13888 dlg.begin(common::MethodInfo {
13889 id: "networkconnectivity.projects.locations.global.policyBasedRoutes.get",
13890 http_method: hyper::Method::GET,
13891 });
13892
13893 for &field in ["alt", "name"].iter() {
13894 if self._additional_params.contains_key(field) {
13895 dlg.finished(false);
13896 return Err(common::Error::FieldClash(field));
13897 }
13898 }
13899
13900 let mut params = Params::with_capacity(3 + self._additional_params.len());
13901 params.push("name", self._name);
13902
13903 params.extend(self._additional_params.iter());
13904
13905 params.push("alt", "json");
13906 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13907 if self._scopes.is_empty() {
13908 self._scopes
13909 .insert(Scope::CloudPlatform.as_ref().to_string());
13910 }
13911
13912 #[allow(clippy::single_element_loop)]
13913 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13914 url = params.uri_replacement(url, param_name, find_this, true);
13915 }
13916 {
13917 let to_remove = ["name"];
13918 params.remove_params(&to_remove);
13919 }
13920
13921 let url = params.parse_with_url(&url);
13922
13923 loop {
13924 let token = match self
13925 .hub
13926 .auth
13927 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13928 .await
13929 {
13930 Ok(token) => token,
13931 Err(e) => match dlg.token(e) {
13932 Ok(token) => token,
13933 Err(e) => {
13934 dlg.finished(false);
13935 return Err(common::Error::MissingToken(e));
13936 }
13937 },
13938 };
13939 let mut req_result = {
13940 let client = &self.hub.client;
13941 dlg.pre_request();
13942 let mut req_builder = hyper::Request::builder()
13943 .method(hyper::Method::GET)
13944 .uri(url.as_str())
13945 .header(USER_AGENT, self.hub._user_agent.clone());
13946
13947 if let Some(token) = token.as_ref() {
13948 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13949 }
13950
13951 let request = req_builder
13952 .header(CONTENT_LENGTH, 0_u64)
13953 .body(common::to_body::<String>(None));
13954
13955 client.request(request.unwrap()).await
13956 };
13957
13958 match req_result {
13959 Err(err) => {
13960 if let common::Retry::After(d) = dlg.http_error(&err) {
13961 sleep(d).await;
13962 continue;
13963 }
13964 dlg.finished(false);
13965 return Err(common::Error::HttpError(err));
13966 }
13967 Ok(res) => {
13968 let (mut parts, body) = res.into_parts();
13969 let mut body = common::Body::new(body);
13970 if !parts.status.is_success() {
13971 let bytes = common::to_bytes(body).await.unwrap_or_default();
13972 let error = serde_json::from_str(&common::to_string(&bytes));
13973 let response = common::to_response(parts, bytes.into());
13974
13975 if let common::Retry::After(d) =
13976 dlg.http_failure(&response, error.as_ref().ok())
13977 {
13978 sleep(d).await;
13979 continue;
13980 }
13981
13982 dlg.finished(false);
13983
13984 return Err(match error {
13985 Ok(value) => common::Error::BadRequest(value),
13986 _ => common::Error::Failure(response),
13987 });
13988 }
13989 let response = {
13990 let bytes = common::to_bytes(body).await.unwrap_or_default();
13991 let encoded = common::to_string(&bytes);
13992 match serde_json::from_str(&encoded) {
13993 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13994 Err(error) => {
13995 dlg.response_json_decode_error(&encoded, &error);
13996 return Err(common::Error::JsonDecodeError(
13997 encoded.to_string(),
13998 error,
13999 ));
14000 }
14001 }
14002 };
14003
14004 dlg.finished(true);
14005 return Ok(response);
14006 }
14007 }
14008 }
14009 }
14010
14011 /// Required. Name of the PolicyBasedRoute resource to get.
14012 ///
14013 /// Sets the *name* path property to the given value.
14014 ///
14015 /// Even though the property as already been set when instantiating this call,
14016 /// we provide this method for API completeness.
14017 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C> {
14018 self._name = new_value.to_string();
14019 self
14020 }
14021 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14022 /// while executing the actual API request.
14023 ///
14024 /// ````text
14025 /// It should be used to handle progress information, and to implement a certain level of resilience.
14026 /// ````
14027 ///
14028 /// Sets the *delegate* property to the given value.
14029 pub fn delegate(
14030 mut self,
14031 new_value: &'a mut dyn common::Delegate,
14032 ) -> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C> {
14033 self._delegate = Some(new_value);
14034 self
14035 }
14036
14037 /// Set any additional parameter of the query string used in the request.
14038 /// It should be used to set parameters which are not yet available through their own
14039 /// setters.
14040 ///
14041 /// Please note that this method must not be used to set any of the known parameters
14042 /// which have their own setter method. If done anyway, the request will fail.
14043 ///
14044 /// # Additional Parameters
14045 ///
14046 /// * *$.xgafv* (query-string) - V1 error format.
14047 /// * *access_token* (query-string) - OAuth access token.
14048 /// * *alt* (query-string) - Data format for response.
14049 /// * *callback* (query-string) - JSONP
14050 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14051 /// * *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.
14052 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14053 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14054 /// * *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.
14055 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14056 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14057 pub fn param<T>(
14058 mut self,
14059 name: T,
14060 value: T,
14061 ) -> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C>
14062 where
14063 T: AsRef<str>,
14064 {
14065 self._additional_params
14066 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14067 self
14068 }
14069
14070 /// Identifies the authorization scope for the method you are building.
14071 ///
14072 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14073 /// [`Scope::CloudPlatform`].
14074 ///
14075 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14076 /// tokens for more than one scope.
14077 ///
14078 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14079 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14080 /// sufficient, a read-write scope will do as well.
14081 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C>
14082 where
14083 St: AsRef<str>,
14084 {
14085 self._scopes.insert(String::from(scope.as_ref()));
14086 self
14087 }
14088 /// Identifies the authorization scope(s) for the method you are building.
14089 ///
14090 /// See [`Self::add_scope()`] for details.
14091 pub fn add_scopes<I, St>(
14092 mut self,
14093 scopes: I,
14094 ) -> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C>
14095 where
14096 I: IntoIterator<Item = St>,
14097 St: AsRef<str>,
14098 {
14099 self._scopes
14100 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14101 self
14102 }
14103
14104 /// Removes all scopes, and no default scope will be used either.
14105 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14106 /// for details).
14107 pub fn clear_scopes(mut self) -> ProjectLocationGlobalPolicyBasedRouteGetCall<'a, C> {
14108 self._scopes.clear();
14109 self
14110 }
14111}
14112
14113/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
14114///
14115/// A builder for the *locations.global.policyBasedRoutes.getIamPolicy* method supported by a *project* resource.
14116/// It is not used directly, but through a [`ProjectMethods`] instance.
14117///
14118/// # Example
14119///
14120/// Instantiate a resource method builder
14121///
14122/// ```test_harness,no_run
14123/// # extern crate hyper;
14124/// # extern crate hyper_rustls;
14125/// # extern crate google_networkconnectivity1 as networkconnectivity1;
14126/// # async fn dox() {
14127/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14128///
14129/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14130/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14131/// # .with_native_roots()
14132/// # .unwrap()
14133/// # .https_only()
14134/// # .enable_http2()
14135/// # .build();
14136///
14137/// # let executor = hyper_util::rt::TokioExecutor::new();
14138/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14139/// # secret,
14140/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14141/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14142/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14143/// # ),
14144/// # ).build().await.unwrap();
14145///
14146/// # let client = hyper_util::client::legacy::Client::builder(
14147/// # hyper_util::rt::TokioExecutor::new()
14148/// # )
14149/// # .build(
14150/// # hyper_rustls::HttpsConnectorBuilder::new()
14151/// # .with_native_roots()
14152/// # .unwrap()
14153/// # .https_or_http()
14154/// # .enable_http2()
14155/// # .build()
14156/// # );
14157/// # let mut hub = Networkconnectivity::new(client, auth);
14158/// // You can configure optional parameters by calling the respective setters at will, and
14159/// // execute the final call using `doit()`.
14160/// // Values shown here are possibly random and not representative !
14161/// let result = hub.projects().locations_global_policy_based_routes_get_iam_policy("resource")
14162/// .options_requested_policy_version(-62)
14163/// .doit().await;
14164/// # }
14165/// ```
14166pub struct ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C>
14167where
14168 C: 'a,
14169{
14170 hub: &'a Networkconnectivity<C>,
14171 _resource: String,
14172 _options_requested_policy_version: Option<i32>,
14173 _delegate: Option<&'a mut dyn common::Delegate>,
14174 _additional_params: HashMap<String, String>,
14175 _scopes: BTreeSet<String>,
14176}
14177
14178impl<'a, C> common::CallBuilder for ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C> {}
14179
14180impl<'a, C> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C>
14181where
14182 C: common::Connector,
14183{
14184 /// Perform the operation you have build so far.
14185 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14186 use std::borrow::Cow;
14187 use std::io::{Read, Seek};
14188
14189 use common::{url::Params, ToParts};
14190 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14191
14192 let mut dd = common::DefaultDelegate;
14193 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14194 dlg.begin(common::MethodInfo {
14195 id: "networkconnectivity.projects.locations.global.policyBasedRoutes.getIamPolicy",
14196 http_method: hyper::Method::GET,
14197 });
14198
14199 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
14200 if self._additional_params.contains_key(field) {
14201 dlg.finished(false);
14202 return Err(common::Error::FieldClash(field));
14203 }
14204 }
14205
14206 let mut params = Params::with_capacity(4 + self._additional_params.len());
14207 params.push("resource", self._resource);
14208 if let Some(value) = self._options_requested_policy_version.as_ref() {
14209 params.push("options.requestedPolicyVersion", value.to_string());
14210 }
14211
14212 params.extend(self._additional_params.iter());
14213
14214 params.push("alt", "json");
14215 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
14216 if self._scopes.is_empty() {
14217 self._scopes
14218 .insert(Scope::CloudPlatform.as_ref().to_string());
14219 }
14220
14221 #[allow(clippy::single_element_loop)]
14222 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14223 url = params.uri_replacement(url, param_name, find_this, true);
14224 }
14225 {
14226 let to_remove = ["resource"];
14227 params.remove_params(&to_remove);
14228 }
14229
14230 let url = params.parse_with_url(&url);
14231
14232 loop {
14233 let token = match self
14234 .hub
14235 .auth
14236 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14237 .await
14238 {
14239 Ok(token) => token,
14240 Err(e) => match dlg.token(e) {
14241 Ok(token) => token,
14242 Err(e) => {
14243 dlg.finished(false);
14244 return Err(common::Error::MissingToken(e));
14245 }
14246 },
14247 };
14248 let mut req_result = {
14249 let client = &self.hub.client;
14250 dlg.pre_request();
14251 let mut req_builder = hyper::Request::builder()
14252 .method(hyper::Method::GET)
14253 .uri(url.as_str())
14254 .header(USER_AGENT, self.hub._user_agent.clone());
14255
14256 if let Some(token) = token.as_ref() {
14257 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14258 }
14259
14260 let request = req_builder
14261 .header(CONTENT_LENGTH, 0_u64)
14262 .body(common::to_body::<String>(None));
14263
14264 client.request(request.unwrap()).await
14265 };
14266
14267 match req_result {
14268 Err(err) => {
14269 if let common::Retry::After(d) = dlg.http_error(&err) {
14270 sleep(d).await;
14271 continue;
14272 }
14273 dlg.finished(false);
14274 return Err(common::Error::HttpError(err));
14275 }
14276 Ok(res) => {
14277 let (mut parts, body) = res.into_parts();
14278 let mut body = common::Body::new(body);
14279 if !parts.status.is_success() {
14280 let bytes = common::to_bytes(body).await.unwrap_or_default();
14281 let error = serde_json::from_str(&common::to_string(&bytes));
14282 let response = common::to_response(parts, bytes.into());
14283
14284 if let common::Retry::After(d) =
14285 dlg.http_failure(&response, error.as_ref().ok())
14286 {
14287 sleep(d).await;
14288 continue;
14289 }
14290
14291 dlg.finished(false);
14292
14293 return Err(match error {
14294 Ok(value) => common::Error::BadRequest(value),
14295 _ => common::Error::Failure(response),
14296 });
14297 }
14298 let response = {
14299 let bytes = common::to_bytes(body).await.unwrap_or_default();
14300 let encoded = common::to_string(&bytes);
14301 match serde_json::from_str(&encoded) {
14302 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14303 Err(error) => {
14304 dlg.response_json_decode_error(&encoded, &error);
14305 return Err(common::Error::JsonDecodeError(
14306 encoded.to_string(),
14307 error,
14308 ));
14309 }
14310 }
14311 };
14312
14313 dlg.finished(true);
14314 return Ok(response);
14315 }
14316 }
14317 }
14318 }
14319
14320 /// 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.
14321 ///
14322 /// Sets the *resource* path property to the given value.
14323 ///
14324 /// Even though the property as already been set when instantiating this call,
14325 /// we provide this method for API completeness.
14326 pub fn resource(
14327 mut self,
14328 new_value: &str,
14329 ) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C> {
14330 self._resource = new_value.to_string();
14331 self
14332 }
14333 /// 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).
14334 ///
14335 /// Sets the *options.requested policy version* query property to the given value.
14336 pub fn options_requested_policy_version(
14337 mut self,
14338 new_value: i32,
14339 ) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C> {
14340 self._options_requested_policy_version = Some(new_value);
14341 self
14342 }
14343 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14344 /// while executing the actual API request.
14345 ///
14346 /// ````text
14347 /// It should be used to handle progress information, and to implement a certain level of resilience.
14348 /// ````
14349 ///
14350 /// Sets the *delegate* property to the given value.
14351 pub fn delegate(
14352 mut self,
14353 new_value: &'a mut dyn common::Delegate,
14354 ) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C> {
14355 self._delegate = Some(new_value);
14356 self
14357 }
14358
14359 /// Set any additional parameter of the query string used in the request.
14360 /// It should be used to set parameters which are not yet available through their own
14361 /// setters.
14362 ///
14363 /// Please note that this method must not be used to set any of the known parameters
14364 /// which have their own setter method. If done anyway, the request will fail.
14365 ///
14366 /// # Additional Parameters
14367 ///
14368 /// * *$.xgafv* (query-string) - V1 error format.
14369 /// * *access_token* (query-string) - OAuth access token.
14370 /// * *alt* (query-string) - Data format for response.
14371 /// * *callback* (query-string) - JSONP
14372 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14373 /// * *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.
14374 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14375 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14376 /// * *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.
14377 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14378 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14379 pub fn param<T>(
14380 mut self,
14381 name: T,
14382 value: T,
14383 ) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C>
14384 where
14385 T: AsRef<str>,
14386 {
14387 self._additional_params
14388 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14389 self
14390 }
14391
14392 /// Identifies the authorization scope for the method you are building.
14393 ///
14394 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14395 /// [`Scope::CloudPlatform`].
14396 ///
14397 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14398 /// tokens for more than one scope.
14399 ///
14400 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14401 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14402 /// sufficient, a read-write scope will do as well.
14403 pub fn add_scope<St>(
14404 mut self,
14405 scope: St,
14406 ) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C>
14407 where
14408 St: AsRef<str>,
14409 {
14410 self._scopes.insert(String::from(scope.as_ref()));
14411 self
14412 }
14413 /// Identifies the authorization scope(s) for the method you are building.
14414 ///
14415 /// See [`Self::add_scope()`] for details.
14416 pub fn add_scopes<I, St>(
14417 mut self,
14418 scopes: I,
14419 ) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C>
14420 where
14421 I: IntoIterator<Item = St>,
14422 St: AsRef<str>,
14423 {
14424 self._scopes
14425 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14426 self
14427 }
14428
14429 /// Removes all scopes, and no default scope will be used either.
14430 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14431 /// for details).
14432 pub fn clear_scopes(mut self) -> ProjectLocationGlobalPolicyBasedRouteGetIamPolicyCall<'a, C> {
14433 self._scopes.clear();
14434 self
14435 }
14436}
14437
14438/// Lists policy-based routes in a given project and location.
14439///
14440/// A builder for the *locations.global.policyBasedRoutes.list* method supported by a *project* resource.
14441/// It is not used directly, but through a [`ProjectMethods`] instance.
14442///
14443/// # Example
14444///
14445/// Instantiate a resource method builder
14446///
14447/// ```test_harness,no_run
14448/// # extern crate hyper;
14449/// # extern crate hyper_rustls;
14450/// # extern crate google_networkconnectivity1 as networkconnectivity1;
14451/// # async fn dox() {
14452/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14453///
14454/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14455/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14456/// # .with_native_roots()
14457/// # .unwrap()
14458/// # .https_only()
14459/// # .enable_http2()
14460/// # .build();
14461///
14462/// # let executor = hyper_util::rt::TokioExecutor::new();
14463/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14464/// # secret,
14465/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14466/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14467/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14468/// # ),
14469/// # ).build().await.unwrap();
14470///
14471/// # let client = hyper_util::client::legacy::Client::builder(
14472/// # hyper_util::rt::TokioExecutor::new()
14473/// # )
14474/// # .build(
14475/// # hyper_rustls::HttpsConnectorBuilder::new()
14476/// # .with_native_roots()
14477/// # .unwrap()
14478/// # .https_or_http()
14479/// # .enable_http2()
14480/// # .build()
14481/// # );
14482/// # let mut hub = Networkconnectivity::new(client, auth);
14483/// // You can configure optional parameters by calling the respective setters at will, and
14484/// // execute the final call using `doit()`.
14485/// // Values shown here are possibly random and not representative !
14486/// let result = hub.projects().locations_global_policy_based_routes_list("parent")
14487/// .page_token("accusam")
14488/// .page_size(-78)
14489/// .order_by("dolore")
14490/// .filter("dolore")
14491/// .doit().await;
14492/// # }
14493/// ```
14494pub struct ProjectLocationGlobalPolicyBasedRouteListCall<'a, C>
14495where
14496 C: 'a,
14497{
14498 hub: &'a Networkconnectivity<C>,
14499 _parent: String,
14500 _page_token: Option<String>,
14501 _page_size: Option<i32>,
14502 _order_by: Option<String>,
14503 _filter: Option<String>,
14504 _delegate: Option<&'a mut dyn common::Delegate>,
14505 _additional_params: HashMap<String, String>,
14506 _scopes: BTreeSet<String>,
14507}
14508
14509impl<'a, C> common::CallBuilder for ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {}
14510
14511impl<'a, C> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C>
14512where
14513 C: common::Connector,
14514{
14515 /// Perform the operation you have build so far.
14516 pub async fn doit(
14517 mut self,
14518 ) -> common::Result<(common::Response, ListPolicyBasedRoutesResponse)> {
14519 use std::borrow::Cow;
14520 use std::io::{Read, Seek};
14521
14522 use common::{url::Params, ToParts};
14523 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14524
14525 let mut dd = common::DefaultDelegate;
14526 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14527 dlg.begin(common::MethodInfo {
14528 id: "networkconnectivity.projects.locations.global.policyBasedRoutes.list",
14529 http_method: hyper::Method::GET,
14530 });
14531
14532 for &field in [
14533 "alt",
14534 "parent",
14535 "pageToken",
14536 "pageSize",
14537 "orderBy",
14538 "filter",
14539 ]
14540 .iter()
14541 {
14542 if self._additional_params.contains_key(field) {
14543 dlg.finished(false);
14544 return Err(common::Error::FieldClash(field));
14545 }
14546 }
14547
14548 let mut params = Params::with_capacity(7 + self._additional_params.len());
14549 params.push("parent", self._parent);
14550 if let Some(value) = self._page_token.as_ref() {
14551 params.push("pageToken", value);
14552 }
14553 if let Some(value) = self._page_size.as_ref() {
14554 params.push("pageSize", value.to_string());
14555 }
14556 if let Some(value) = self._order_by.as_ref() {
14557 params.push("orderBy", value);
14558 }
14559 if let Some(value) = self._filter.as_ref() {
14560 params.push("filter", value);
14561 }
14562
14563 params.extend(self._additional_params.iter());
14564
14565 params.push("alt", "json");
14566 let mut url = self.hub._base_url.clone() + "v1/{+parent}/policyBasedRoutes";
14567 if self._scopes.is_empty() {
14568 self._scopes
14569 .insert(Scope::CloudPlatform.as_ref().to_string());
14570 }
14571
14572 #[allow(clippy::single_element_loop)]
14573 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14574 url = params.uri_replacement(url, param_name, find_this, true);
14575 }
14576 {
14577 let to_remove = ["parent"];
14578 params.remove_params(&to_remove);
14579 }
14580
14581 let url = params.parse_with_url(&url);
14582
14583 loop {
14584 let token = match self
14585 .hub
14586 .auth
14587 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14588 .await
14589 {
14590 Ok(token) => token,
14591 Err(e) => match dlg.token(e) {
14592 Ok(token) => token,
14593 Err(e) => {
14594 dlg.finished(false);
14595 return Err(common::Error::MissingToken(e));
14596 }
14597 },
14598 };
14599 let mut req_result = {
14600 let client = &self.hub.client;
14601 dlg.pre_request();
14602 let mut req_builder = hyper::Request::builder()
14603 .method(hyper::Method::GET)
14604 .uri(url.as_str())
14605 .header(USER_AGENT, self.hub._user_agent.clone());
14606
14607 if let Some(token) = token.as_ref() {
14608 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14609 }
14610
14611 let request = req_builder
14612 .header(CONTENT_LENGTH, 0_u64)
14613 .body(common::to_body::<String>(None));
14614
14615 client.request(request.unwrap()).await
14616 };
14617
14618 match req_result {
14619 Err(err) => {
14620 if let common::Retry::After(d) = dlg.http_error(&err) {
14621 sleep(d).await;
14622 continue;
14623 }
14624 dlg.finished(false);
14625 return Err(common::Error::HttpError(err));
14626 }
14627 Ok(res) => {
14628 let (mut parts, body) = res.into_parts();
14629 let mut body = common::Body::new(body);
14630 if !parts.status.is_success() {
14631 let bytes = common::to_bytes(body).await.unwrap_or_default();
14632 let error = serde_json::from_str(&common::to_string(&bytes));
14633 let response = common::to_response(parts, bytes.into());
14634
14635 if let common::Retry::After(d) =
14636 dlg.http_failure(&response, error.as_ref().ok())
14637 {
14638 sleep(d).await;
14639 continue;
14640 }
14641
14642 dlg.finished(false);
14643
14644 return Err(match error {
14645 Ok(value) => common::Error::BadRequest(value),
14646 _ => common::Error::Failure(response),
14647 });
14648 }
14649 let response = {
14650 let bytes = common::to_bytes(body).await.unwrap_or_default();
14651 let encoded = common::to_string(&bytes);
14652 match serde_json::from_str(&encoded) {
14653 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14654 Err(error) => {
14655 dlg.response_json_decode_error(&encoded, &error);
14656 return Err(common::Error::JsonDecodeError(
14657 encoded.to_string(),
14658 error,
14659 ));
14660 }
14661 }
14662 };
14663
14664 dlg.finished(true);
14665 return Ok(response);
14666 }
14667 }
14668 }
14669 }
14670
14671 /// Required. The parent resource's name.
14672 ///
14673 /// Sets the *parent* path property to the given value.
14674 ///
14675 /// Even though the property as already been set when instantiating this call,
14676 /// we provide this method for API completeness.
14677 pub fn parent(
14678 mut self,
14679 new_value: &str,
14680 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
14681 self._parent = new_value.to_string();
14682 self
14683 }
14684 /// The page token.
14685 ///
14686 /// Sets the *page token* query property to the given value.
14687 pub fn page_token(
14688 mut self,
14689 new_value: &str,
14690 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
14691 self._page_token = Some(new_value.to_string());
14692 self
14693 }
14694 /// The maximum number of results per page that should be returned.
14695 ///
14696 /// Sets the *page size* query property to the given value.
14697 pub fn page_size(
14698 mut self,
14699 new_value: i32,
14700 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
14701 self._page_size = Some(new_value);
14702 self
14703 }
14704 /// Sort the results by a certain order.
14705 ///
14706 /// Sets the *order by* query property to the given value.
14707 pub fn order_by(
14708 mut self,
14709 new_value: &str,
14710 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
14711 self._order_by = Some(new_value.to_string());
14712 self
14713 }
14714 /// A filter expression that filters the results listed in the response.
14715 ///
14716 /// Sets the *filter* query property to the given value.
14717 pub fn filter(
14718 mut self,
14719 new_value: &str,
14720 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
14721 self._filter = Some(new_value.to_string());
14722 self
14723 }
14724 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14725 /// while executing the actual API request.
14726 ///
14727 /// ````text
14728 /// It should be used to handle progress information, and to implement a certain level of resilience.
14729 /// ````
14730 ///
14731 /// Sets the *delegate* property to the given value.
14732 pub fn delegate(
14733 mut self,
14734 new_value: &'a mut dyn common::Delegate,
14735 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
14736 self._delegate = Some(new_value);
14737 self
14738 }
14739
14740 /// Set any additional parameter of the query string used in the request.
14741 /// It should be used to set parameters which are not yet available through their own
14742 /// setters.
14743 ///
14744 /// Please note that this method must not be used to set any of the known parameters
14745 /// which have their own setter method. If done anyway, the request will fail.
14746 ///
14747 /// # Additional Parameters
14748 ///
14749 /// * *$.xgafv* (query-string) - V1 error format.
14750 /// * *access_token* (query-string) - OAuth access token.
14751 /// * *alt* (query-string) - Data format for response.
14752 /// * *callback* (query-string) - JSONP
14753 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14754 /// * *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.
14755 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14756 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14757 /// * *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.
14758 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14759 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14760 pub fn param<T>(
14761 mut self,
14762 name: T,
14763 value: T,
14764 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C>
14765 where
14766 T: AsRef<str>,
14767 {
14768 self._additional_params
14769 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14770 self
14771 }
14772
14773 /// Identifies the authorization scope for the method you are building.
14774 ///
14775 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14776 /// [`Scope::CloudPlatform`].
14777 ///
14778 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14779 /// tokens for more than one scope.
14780 ///
14781 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14782 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14783 /// sufficient, a read-write scope will do as well.
14784 pub fn add_scope<St>(
14785 mut self,
14786 scope: St,
14787 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C>
14788 where
14789 St: AsRef<str>,
14790 {
14791 self._scopes.insert(String::from(scope.as_ref()));
14792 self
14793 }
14794 /// Identifies the authorization scope(s) for the method you are building.
14795 ///
14796 /// See [`Self::add_scope()`] for details.
14797 pub fn add_scopes<I, St>(
14798 mut self,
14799 scopes: I,
14800 ) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C>
14801 where
14802 I: IntoIterator<Item = St>,
14803 St: AsRef<str>,
14804 {
14805 self._scopes
14806 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14807 self
14808 }
14809
14810 /// Removes all scopes, and no default scope will be used either.
14811 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14812 /// for details).
14813 pub fn clear_scopes(mut self) -> ProjectLocationGlobalPolicyBasedRouteListCall<'a, C> {
14814 self._scopes.clear();
14815 self
14816 }
14817}
14818
14819/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
14820///
14821/// A builder for the *locations.global.policyBasedRoutes.setIamPolicy* method supported by a *project* resource.
14822/// It is not used directly, but through a [`ProjectMethods`] instance.
14823///
14824/// # Example
14825///
14826/// Instantiate a resource method builder
14827///
14828/// ```test_harness,no_run
14829/// # extern crate hyper;
14830/// # extern crate hyper_rustls;
14831/// # extern crate google_networkconnectivity1 as networkconnectivity1;
14832/// use networkconnectivity1::api::SetIamPolicyRequest;
14833/// # async fn dox() {
14834/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14835///
14836/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14837/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14838/// # .with_native_roots()
14839/// # .unwrap()
14840/// # .https_only()
14841/// # .enable_http2()
14842/// # .build();
14843///
14844/// # let executor = hyper_util::rt::TokioExecutor::new();
14845/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14846/// # secret,
14847/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14848/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14849/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14850/// # ),
14851/// # ).build().await.unwrap();
14852///
14853/// # let client = hyper_util::client::legacy::Client::builder(
14854/// # hyper_util::rt::TokioExecutor::new()
14855/// # )
14856/// # .build(
14857/// # hyper_rustls::HttpsConnectorBuilder::new()
14858/// # .with_native_roots()
14859/// # .unwrap()
14860/// # .https_or_http()
14861/// # .enable_http2()
14862/// # .build()
14863/// # );
14864/// # let mut hub = Networkconnectivity::new(client, auth);
14865/// // As the method needs a request, you would usually fill it with the desired information
14866/// // into the respective structure. Some of the parts shown here might not be applicable !
14867/// // Values shown here are possibly random and not representative !
14868/// let mut req = SetIamPolicyRequest::default();
14869///
14870/// // You can configure optional parameters by calling the respective setters at will, and
14871/// // execute the final call using `doit()`.
14872/// // Values shown here are possibly random and not representative !
14873/// let result = hub.projects().locations_global_policy_based_routes_set_iam_policy(req, "resource")
14874/// .doit().await;
14875/// # }
14876/// ```
14877pub struct ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C>
14878where
14879 C: 'a,
14880{
14881 hub: &'a Networkconnectivity<C>,
14882 _request: SetIamPolicyRequest,
14883 _resource: String,
14884 _delegate: Option<&'a mut dyn common::Delegate>,
14885 _additional_params: HashMap<String, String>,
14886 _scopes: BTreeSet<String>,
14887}
14888
14889impl<'a, C> common::CallBuilder for ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C> {}
14890
14891impl<'a, C> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C>
14892where
14893 C: common::Connector,
14894{
14895 /// Perform the operation you have build so far.
14896 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14897 use std::borrow::Cow;
14898 use std::io::{Read, Seek};
14899
14900 use common::{url::Params, ToParts};
14901 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14902
14903 let mut dd = common::DefaultDelegate;
14904 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14905 dlg.begin(common::MethodInfo {
14906 id: "networkconnectivity.projects.locations.global.policyBasedRoutes.setIamPolicy",
14907 http_method: hyper::Method::POST,
14908 });
14909
14910 for &field in ["alt", "resource"].iter() {
14911 if self._additional_params.contains_key(field) {
14912 dlg.finished(false);
14913 return Err(common::Error::FieldClash(field));
14914 }
14915 }
14916
14917 let mut params = Params::with_capacity(4 + self._additional_params.len());
14918 params.push("resource", self._resource);
14919
14920 params.extend(self._additional_params.iter());
14921
14922 params.push("alt", "json");
14923 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
14924 if self._scopes.is_empty() {
14925 self._scopes
14926 .insert(Scope::CloudPlatform.as_ref().to_string());
14927 }
14928
14929 #[allow(clippy::single_element_loop)]
14930 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14931 url = params.uri_replacement(url, param_name, find_this, true);
14932 }
14933 {
14934 let to_remove = ["resource"];
14935 params.remove_params(&to_remove);
14936 }
14937
14938 let url = params.parse_with_url(&url);
14939
14940 let mut json_mime_type = mime::APPLICATION_JSON;
14941 let mut request_value_reader = {
14942 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14943 common::remove_json_null_values(&mut value);
14944 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14945 serde_json::to_writer(&mut dst, &value).unwrap();
14946 dst
14947 };
14948 let request_size = request_value_reader
14949 .seek(std::io::SeekFrom::End(0))
14950 .unwrap();
14951 request_value_reader
14952 .seek(std::io::SeekFrom::Start(0))
14953 .unwrap();
14954
14955 loop {
14956 let token = match self
14957 .hub
14958 .auth
14959 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14960 .await
14961 {
14962 Ok(token) => token,
14963 Err(e) => match dlg.token(e) {
14964 Ok(token) => token,
14965 Err(e) => {
14966 dlg.finished(false);
14967 return Err(common::Error::MissingToken(e));
14968 }
14969 },
14970 };
14971 request_value_reader
14972 .seek(std::io::SeekFrom::Start(0))
14973 .unwrap();
14974 let mut req_result = {
14975 let client = &self.hub.client;
14976 dlg.pre_request();
14977 let mut req_builder = hyper::Request::builder()
14978 .method(hyper::Method::POST)
14979 .uri(url.as_str())
14980 .header(USER_AGENT, self.hub._user_agent.clone());
14981
14982 if let Some(token) = token.as_ref() {
14983 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14984 }
14985
14986 let request = req_builder
14987 .header(CONTENT_TYPE, json_mime_type.to_string())
14988 .header(CONTENT_LENGTH, request_size as u64)
14989 .body(common::to_body(
14990 request_value_reader.get_ref().clone().into(),
14991 ));
14992
14993 client.request(request.unwrap()).await
14994 };
14995
14996 match req_result {
14997 Err(err) => {
14998 if let common::Retry::After(d) = dlg.http_error(&err) {
14999 sleep(d).await;
15000 continue;
15001 }
15002 dlg.finished(false);
15003 return Err(common::Error::HttpError(err));
15004 }
15005 Ok(res) => {
15006 let (mut parts, body) = res.into_parts();
15007 let mut body = common::Body::new(body);
15008 if !parts.status.is_success() {
15009 let bytes = common::to_bytes(body).await.unwrap_or_default();
15010 let error = serde_json::from_str(&common::to_string(&bytes));
15011 let response = common::to_response(parts, bytes.into());
15012
15013 if let common::Retry::After(d) =
15014 dlg.http_failure(&response, error.as_ref().ok())
15015 {
15016 sleep(d).await;
15017 continue;
15018 }
15019
15020 dlg.finished(false);
15021
15022 return Err(match error {
15023 Ok(value) => common::Error::BadRequest(value),
15024 _ => common::Error::Failure(response),
15025 });
15026 }
15027 let response = {
15028 let bytes = common::to_bytes(body).await.unwrap_or_default();
15029 let encoded = common::to_string(&bytes);
15030 match serde_json::from_str(&encoded) {
15031 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15032 Err(error) => {
15033 dlg.response_json_decode_error(&encoded, &error);
15034 return Err(common::Error::JsonDecodeError(
15035 encoded.to_string(),
15036 error,
15037 ));
15038 }
15039 }
15040 };
15041
15042 dlg.finished(true);
15043 return Ok(response);
15044 }
15045 }
15046 }
15047 }
15048
15049 ///
15050 /// Sets the *request* property to the given value.
15051 ///
15052 /// Even though the property as already been set when instantiating this call,
15053 /// we provide this method for API completeness.
15054 pub fn request(
15055 mut self,
15056 new_value: SetIamPolicyRequest,
15057 ) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C> {
15058 self._request = new_value;
15059 self
15060 }
15061 /// 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.
15062 ///
15063 /// Sets the *resource* path property to the given value.
15064 ///
15065 /// Even though the property as already been set when instantiating this call,
15066 /// we provide this method for API completeness.
15067 pub fn resource(
15068 mut self,
15069 new_value: &str,
15070 ) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C> {
15071 self._resource = new_value.to_string();
15072 self
15073 }
15074 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15075 /// while executing the actual API request.
15076 ///
15077 /// ````text
15078 /// It should be used to handle progress information, and to implement a certain level of resilience.
15079 /// ````
15080 ///
15081 /// Sets the *delegate* property to the given value.
15082 pub fn delegate(
15083 mut self,
15084 new_value: &'a mut dyn common::Delegate,
15085 ) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C> {
15086 self._delegate = Some(new_value);
15087 self
15088 }
15089
15090 /// Set any additional parameter of the query string used in the request.
15091 /// It should be used to set parameters which are not yet available through their own
15092 /// setters.
15093 ///
15094 /// Please note that this method must not be used to set any of the known parameters
15095 /// which have their own setter method. If done anyway, the request will fail.
15096 ///
15097 /// # Additional Parameters
15098 ///
15099 /// * *$.xgafv* (query-string) - V1 error format.
15100 /// * *access_token* (query-string) - OAuth access token.
15101 /// * *alt* (query-string) - Data format for response.
15102 /// * *callback* (query-string) - JSONP
15103 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15104 /// * *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.
15105 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15106 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15107 /// * *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.
15108 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15109 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15110 pub fn param<T>(
15111 mut self,
15112 name: T,
15113 value: T,
15114 ) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C>
15115 where
15116 T: AsRef<str>,
15117 {
15118 self._additional_params
15119 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15120 self
15121 }
15122
15123 /// Identifies the authorization scope for the method you are building.
15124 ///
15125 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15126 /// [`Scope::CloudPlatform`].
15127 ///
15128 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15129 /// tokens for more than one scope.
15130 ///
15131 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15132 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15133 /// sufficient, a read-write scope will do as well.
15134 pub fn add_scope<St>(
15135 mut self,
15136 scope: St,
15137 ) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C>
15138 where
15139 St: AsRef<str>,
15140 {
15141 self._scopes.insert(String::from(scope.as_ref()));
15142 self
15143 }
15144 /// Identifies the authorization scope(s) for the method you are building.
15145 ///
15146 /// See [`Self::add_scope()`] for details.
15147 pub fn add_scopes<I, St>(
15148 mut self,
15149 scopes: I,
15150 ) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C>
15151 where
15152 I: IntoIterator<Item = St>,
15153 St: AsRef<str>,
15154 {
15155 self._scopes
15156 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15157 self
15158 }
15159
15160 /// Removes all scopes, and no default scope will be used either.
15161 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15162 /// for details).
15163 pub fn clear_scopes(mut self) -> ProjectLocationGlobalPolicyBasedRouteSetIamPolicyCall<'a, C> {
15164 self._scopes.clear();
15165 self
15166 }
15167}
15168
15169/// 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.
15170///
15171/// A builder for the *locations.global.policyBasedRoutes.testIamPermissions* method supported by a *project* resource.
15172/// It is not used directly, but through a [`ProjectMethods`] instance.
15173///
15174/// # Example
15175///
15176/// Instantiate a resource method builder
15177///
15178/// ```test_harness,no_run
15179/// # extern crate hyper;
15180/// # extern crate hyper_rustls;
15181/// # extern crate google_networkconnectivity1 as networkconnectivity1;
15182/// use networkconnectivity1::api::TestIamPermissionsRequest;
15183/// # async fn dox() {
15184/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15185///
15186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15188/// # .with_native_roots()
15189/// # .unwrap()
15190/// # .https_only()
15191/// # .enable_http2()
15192/// # .build();
15193///
15194/// # let executor = hyper_util::rt::TokioExecutor::new();
15195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15196/// # secret,
15197/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15198/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15199/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15200/// # ),
15201/// # ).build().await.unwrap();
15202///
15203/// # let client = hyper_util::client::legacy::Client::builder(
15204/// # hyper_util::rt::TokioExecutor::new()
15205/// # )
15206/// # .build(
15207/// # hyper_rustls::HttpsConnectorBuilder::new()
15208/// # .with_native_roots()
15209/// # .unwrap()
15210/// # .https_or_http()
15211/// # .enable_http2()
15212/// # .build()
15213/// # );
15214/// # let mut hub = Networkconnectivity::new(client, auth);
15215/// // As the method needs a request, you would usually fill it with the desired information
15216/// // into the respective structure. Some of the parts shown here might not be applicable !
15217/// // Values shown here are possibly random and not representative !
15218/// let mut req = TestIamPermissionsRequest::default();
15219///
15220/// // You can configure optional parameters by calling the respective setters at will, and
15221/// // execute the final call using `doit()`.
15222/// // Values shown here are possibly random and not representative !
15223/// let result = hub.projects().locations_global_policy_based_routes_test_iam_permissions(req, "resource")
15224/// .doit().await;
15225/// # }
15226/// ```
15227pub struct ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C>
15228where
15229 C: 'a,
15230{
15231 hub: &'a Networkconnectivity<C>,
15232 _request: TestIamPermissionsRequest,
15233 _resource: String,
15234 _delegate: Option<&'a mut dyn common::Delegate>,
15235 _additional_params: HashMap<String, String>,
15236 _scopes: BTreeSet<String>,
15237}
15238
15239impl<'a, C> common::CallBuilder
15240 for ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C>
15241{
15242}
15243
15244impl<'a, C> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C>
15245where
15246 C: common::Connector,
15247{
15248 /// Perform the operation you have build so far.
15249 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
15250 use std::borrow::Cow;
15251 use std::io::{Read, Seek};
15252
15253 use common::{url::Params, ToParts};
15254 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15255
15256 let mut dd = common::DefaultDelegate;
15257 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15258 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.global.policyBasedRoutes.testIamPermissions",
15259 http_method: hyper::Method::POST });
15260
15261 for &field in ["alt", "resource"].iter() {
15262 if self._additional_params.contains_key(field) {
15263 dlg.finished(false);
15264 return Err(common::Error::FieldClash(field));
15265 }
15266 }
15267
15268 let mut params = Params::with_capacity(4 + self._additional_params.len());
15269 params.push("resource", self._resource);
15270
15271 params.extend(self._additional_params.iter());
15272
15273 params.push("alt", "json");
15274 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
15275 if self._scopes.is_empty() {
15276 self._scopes
15277 .insert(Scope::CloudPlatform.as_ref().to_string());
15278 }
15279
15280 #[allow(clippy::single_element_loop)]
15281 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15282 url = params.uri_replacement(url, param_name, find_this, true);
15283 }
15284 {
15285 let to_remove = ["resource"];
15286 params.remove_params(&to_remove);
15287 }
15288
15289 let url = params.parse_with_url(&url);
15290
15291 let mut json_mime_type = mime::APPLICATION_JSON;
15292 let mut request_value_reader = {
15293 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15294 common::remove_json_null_values(&mut value);
15295 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15296 serde_json::to_writer(&mut dst, &value).unwrap();
15297 dst
15298 };
15299 let request_size = request_value_reader
15300 .seek(std::io::SeekFrom::End(0))
15301 .unwrap();
15302 request_value_reader
15303 .seek(std::io::SeekFrom::Start(0))
15304 .unwrap();
15305
15306 loop {
15307 let token = match self
15308 .hub
15309 .auth
15310 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15311 .await
15312 {
15313 Ok(token) => token,
15314 Err(e) => match dlg.token(e) {
15315 Ok(token) => token,
15316 Err(e) => {
15317 dlg.finished(false);
15318 return Err(common::Error::MissingToken(e));
15319 }
15320 },
15321 };
15322 request_value_reader
15323 .seek(std::io::SeekFrom::Start(0))
15324 .unwrap();
15325 let mut req_result = {
15326 let client = &self.hub.client;
15327 dlg.pre_request();
15328 let mut req_builder = hyper::Request::builder()
15329 .method(hyper::Method::POST)
15330 .uri(url.as_str())
15331 .header(USER_AGENT, self.hub._user_agent.clone());
15332
15333 if let Some(token) = token.as_ref() {
15334 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15335 }
15336
15337 let request = req_builder
15338 .header(CONTENT_TYPE, json_mime_type.to_string())
15339 .header(CONTENT_LENGTH, request_size as u64)
15340 .body(common::to_body(
15341 request_value_reader.get_ref().clone().into(),
15342 ));
15343
15344 client.request(request.unwrap()).await
15345 };
15346
15347 match req_result {
15348 Err(err) => {
15349 if let common::Retry::After(d) = dlg.http_error(&err) {
15350 sleep(d).await;
15351 continue;
15352 }
15353 dlg.finished(false);
15354 return Err(common::Error::HttpError(err));
15355 }
15356 Ok(res) => {
15357 let (mut parts, body) = res.into_parts();
15358 let mut body = common::Body::new(body);
15359 if !parts.status.is_success() {
15360 let bytes = common::to_bytes(body).await.unwrap_or_default();
15361 let error = serde_json::from_str(&common::to_string(&bytes));
15362 let response = common::to_response(parts, bytes.into());
15363
15364 if let common::Retry::After(d) =
15365 dlg.http_failure(&response, error.as_ref().ok())
15366 {
15367 sleep(d).await;
15368 continue;
15369 }
15370
15371 dlg.finished(false);
15372
15373 return Err(match error {
15374 Ok(value) => common::Error::BadRequest(value),
15375 _ => common::Error::Failure(response),
15376 });
15377 }
15378 let response = {
15379 let bytes = common::to_bytes(body).await.unwrap_or_default();
15380 let encoded = common::to_string(&bytes);
15381 match serde_json::from_str(&encoded) {
15382 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15383 Err(error) => {
15384 dlg.response_json_decode_error(&encoded, &error);
15385 return Err(common::Error::JsonDecodeError(
15386 encoded.to_string(),
15387 error,
15388 ));
15389 }
15390 }
15391 };
15392
15393 dlg.finished(true);
15394 return Ok(response);
15395 }
15396 }
15397 }
15398 }
15399
15400 ///
15401 /// Sets the *request* property to the given value.
15402 ///
15403 /// Even though the property as already been set when instantiating this call,
15404 /// we provide this method for API completeness.
15405 pub fn request(
15406 mut self,
15407 new_value: TestIamPermissionsRequest,
15408 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C> {
15409 self._request = new_value;
15410 self
15411 }
15412 /// 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.
15413 ///
15414 /// Sets the *resource* path property to the given value.
15415 ///
15416 /// Even though the property as already been set when instantiating this call,
15417 /// we provide this method for API completeness.
15418 pub fn resource(
15419 mut self,
15420 new_value: &str,
15421 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C> {
15422 self._resource = new_value.to_string();
15423 self
15424 }
15425 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15426 /// while executing the actual API request.
15427 ///
15428 /// ````text
15429 /// It should be used to handle progress information, and to implement a certain level of resilience.
15430 /// ````
15431 ///
15432 /// Sets the *delegate* property to the given value.
15433 pub fn delegate(
15434 mut self,
15435 new_value: &'a mut dyn common::Delegate,
15436 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C> {
15437 self._delegate = Some(new_value);
15438 self
15439 }
15440
15441 /// Set any additional parameter of the query string used in the request.
15442 /// It should be used to set parameters which are not yet available through their own
15443 /// setters.
15444 ///
15445 /// Please note that this method must not be used to set any of the known parameters
15446 /// which have their own setter method. If done anyway, the request will fail.
15447 ///
15448 /// # Additional Parameters
15449 ///
15450 /// * *$.xgafv* (query-string) - V1 error format.
15451 /// * *access_token* (query-string) - OAuth access token.
15452 /// * *alt* (query-string) - Data format for response.
15453 /// * *callback* (query-string) - JSONP
15454 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15455 /// * *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.
15456 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15457 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15458 /// * *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.
15459 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15460 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15461 pub fn param<T>(
15462 mut self,
15463 name: T,
15464 value: T,
15465 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C>
15466 where
15467 T: AsRef<str>,
15468 {
15469 self._additional_params
15470 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15471 self
15472 }
15473
15474 /// Identifies the authorization scope for the method you are building.
15475 ///
15476 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15477 /// [`Scope::CloudPlatform`].
15478 ///
15479 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15480 /// tokens for more than one scope.
15481 ///
15482 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15483 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15484 /// sufficient, a read-write scope will do as well.
15485 pub fn add_scope<St>(
15486 mut self,
15487 scope: St,
15488 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C>
15489 where
15490 St: AsRef<str>,
15491 {
15492 self._scopes.insert(String::from(scope.as_ref()));
15493 self
15494 }
15495 /// Identifies the authorization scope(s) for the method you are building.
15496 ///
15497 /// See [`Self::add_scope()`] for details.
15498 pub fn add_scopes<I, St>(
15499 mut self,
15500 scopes: I,
15501 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C>
15502 where
15503 I: IntoIterator<Item = St>,
15504 St: AsRef<str>,
15505 {
15506 self._scopes
15507 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15508 self
15509 }
15510
15511 /// Removes all scopes, and no default scope will be used either.
15512 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15513 /// for details).
15514 pub fn clear_scopes(
15515 mut self,
15516 ) -> ProjectLocationGlobalPolicyBasedRouteTestIamPermissionCall<'a, C> {
15517 self._scopes.clear();
15518 self
15519 }
15520}
15521
15522/// Creates a new internal range in a given project and location.
15523///
15524/// A builder for the *locations.internalRanges.create* method supported by a *project* resource.
15525/// It is not used directly, but through a [`ProjectMethods`] instance.
15526///
15527/// # Example
15528///
15529/// Instantiate a resource method builder
15530///
15531/// ```test_harness,no_run
15532/// # extern crate hyper;
15533/// # extern crate hyper_rustls;
15534/// # extern crate google_networkconnectivity1 as networkconnectivity1;
15535/// use networkconnectivity1::api::InternalRange;
15536/// # async fn dox() {
15537/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15538///
15539/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15540/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15541/// # .with_native_roots()
15542/// # .unwrap()
15543/// # .https_only()
15544/// # .enable_http2()
15545/// # .build();
15546///
15547/// # let executor = hyper_util::rt::TokioExecutor::new();
15548/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15549/// # secret,
15550/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15551/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15552/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15553/// # ),
15554/// # ).build().await.unwrap();
15555///
15556/// # let client = hyper_util::client::legacy::Client::builder(
15557/// # hyper_util::rt::TokioExecutor::new()
15558/// # )
15559/// # .build(
15560/// # hyper_rustls::HttpsConnectorBuilder::new()
15561/// # .with_native_roots()
15562/// # .unwrap()
15563/// # .https_or_http()
15564/// # .enable_http2()
15565/// # .build()
15566/// # );
15567/// # let mut hub = Networkconnectivity::new(client, auth);
15568/// // As the method needs a request, you would usually fill it with the desired information
15569/// // into the respective structure. Some of the parts shown here might not be applicable !
15570/// // Values shown here are possibly random and not representative !
15571/// let mut req = InternalRange::default();
15572///
15573/// // You can configure optional parameters by calling the respective setters at will, and
15574/// // execute the final call using `doit()`.
15575/// // Values shown here are possibly random and not representative !
15576/// let result = hub.projects().locations_internal_ranges_create(req, "parent")
15577/// .request_id("ea")
15578/// .internal_range_id("sadipscing")
15579/// .doit().await;
15580/// # }
15581/// ```
15582pub struct ProjectLocationInternalRangeCreateCall<'a, C>
15583where
15584 C: 'a,
15585{
15586 hub: &'a Networkconnectivity<C>,
15587 _request: InternalRange,
15588 _parent: String,
15589 _request_id: Option<String>,
15590 _internal_range_id: Option<String>,
15591 _delegate: Option<&'a mut dyn common::Delegate>,
15592 _additional_params: HashMap<String, String>,
15593 _scopes: BTreeSet<String>,
15594}
15595
15596impl<'a, C> common::CallBuilder for ProjectLocationInternalRangeCreateCall<'a, C> {}
15597
15598impl<'a, C> ProjectLocationInternalRangeCreateCall<'a, C>
15599where
15600 C: common::Connector,
15601{
15602 /// Perform the operation you have build so far.
15603 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
15604 use std::borrow::Cow;
15605 use std::io::{Read, Seek};
15606
15607 use common::{url::Params, ToParts};
15608 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15609
15610 let mut dd = common::DefaultDelegate;
15611 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15612 dlg.begin(common::MethodInfo {
15613 id: "networkconnectivity.projects.locations.internalRanges.create",
15614 http_method: hyper::Method::POST,
15615 });
15616
15617 for &field in ["alt", "parent", "requestId", "internalRangeId"].iter() {
15618 if self._additional_params.contains_key(field) {
15619 dlg.finished(false);
15620 return Err(common::Error::FieldClash(field));
15621 }
15622 }
15623
15624 let mut params = Params::with_capacity(6 + self._additional_params.len());
15625 params.push("parent", self._parent);
15626 if let Some(value) = self._request_id.as_ref() {
15627 params.push("requestId", value);
15628 }
15629 if let Some(value) = self._internal_range_id.as_ref() {
15630 params.push("internalRangeId", value);
15631 }
15632
15633 params.extend(self._additional_params.iter());
15634
15635 params.push("alt", "json");
15636 let mut url = self.hub._base_url.clone() + "v1/{+parent}/internalRanges";
15637 if self._scopes.is_empty() {
15638 self._scopes
15639 .insert(Scope::CloudPlatform.as_ref().to_string());
15640 }
15641
15642 #[allow(clippy::single_element_loop)]
15643 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15644 url = params.uri_replacement(url, param_name, find_this, true);
15645 }
15646 {
15647 let to_remove = ["parent"];
15648 params.remove_params(&to_remove);
15649 }
15650
15651 let url = params.parse_with_url(&url);
15652
15653 let mut json_mime_type = mime::APPLICATION_JSON;
15654 let mut request_value_reader = {
15655 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15656 common::remove_json_null_values(&mut value);
15657 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15658 serde_json::to_writer(&mut dst, &value).unwrap();
15659 dst
15660 };
15661 let request_size = request_value_reader
15662 .seek(std::io::SeekFrom::End(0))
15663 .unwrap();
15664 request_value_reader
15665 .seek(std::io::SeekFrom::Start(0))
15666 .unwrap();
15667
15668 loop {
15669 let token = match self
15670 .hub
15671 .auth
15672 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15673 .await
15674 {
15675 Ok(token) => token,
15676 Err(e) => match dlg.token(e) {
15677 Ok(token) => token,
15678 Err(e) => {
15679 dlg.finished(false);
15680 return Err(common::Error::MissingToken(e));
15681 }
15682 },
15683 };
15684 request_value_reader
15685 .seek(std::io::SeekFrom::Start(0))
15686 .unwrap();
15687 let mut req_result = {
15688 let client = &self.hub.client;
15689 dlg.pre_request();
15690 let mut req_builder = hyper::Request::builder()
15691 .method(hyper::Method::POST)
15692 .uri(url.as_str())
15693 .header(USER_AGENT, self.hub._user_agent.clone());
15694
15695 if let Some(token) = token.as_ref() {
15696 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15697 }
15698
15699 let request = req_builder
15700 .header(CONTENT_TYPE, json_mime_type.to_string())
15701 .header(CONTENT_LENGTH, request_size as u64)
15702 .body(common::to_body(
15703 request_value_reader.get_ref().clone().into(),
15704 ));
15705
15706 client.request(request.unwrap()).await
15707 };
15708
15709 match req_result {
15710 Err(err) => {
15711 if let common::Retry::After(d) = dlg.http_error(&err) {
15712 sleep(d).await;
15713 continue;
15714 }
15715 dlg.finished(false);
15716 return Err(common::Error::HttpError(err));
15717 }
15718 Ok(res) => {
15719 let (mut parts, body) = res.into_parts();
15720 let mut body = common::Body::new(body);
15721 if !parts.status.is_success() {
15722 let bytes = common::to_bytes(body).await.unwrap_or_default();
15723 let error = serde_json::from_str(&common::to_string(&bytes));
15724 let response = common::to_response(parts, bytes.into());
15725
15726 if let common::Retry::After(d) =
15727 dlg.http_failure(&response, error.as_ref().ok())
15728 {
15729 sleep(d).await;
15730 continue;
15731 }
15732
15733 dlg.finished(false);
15734
15735 return Err(match error {
15736 Ok(value) => common::Error::BadRequest(value),
15737 _ => common::Error::Failure(response),
15738 });
15739 }
15740 let response = {
15741 let bytes = common::to_bytes(body).await.unwrap_or_default();
15742 let encoded = common::to_string(&bytes);
15743 match serde_json::from_str(&encoded) {
15744 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15745 Err(error) => {
15746 dlg.response_json_decode_error(&encoded, &error);
15747 return Err(common::Error::JsonDecodeError(
15748 encoded.to_string(),
15749 error,
15750 ));
15751 }
15752 }
15753 };
15754
15755 dlg.finished(true);
15756 return Ok(response);
15757 }
15758 }
15759 }
15760 }
15761
15762 ///
15763 /// Sets the *request* property to the given value.
15764 ///
15765 /// Even though the property as already been set when instantiating this call,
15766 /// we provide this method for API completeness.
15767 pub fn request(
15768 mut self,
15769 new_value: InternalRange,
15770 ) -> ProjectLocationInternalRangeCreateCall<'a, C> {
15771 self._request = new_value;
15772 self
15773 }
15774 /// Required. The parent resource's name of the internal range.
15775 ///
15776 /// Sets the *parent* path property to the given value.
15777 ///
15778 /// Even though the property as already been set when instantiating this call,
15779 /// we provide this method for API completeness.
15780 pub fn parent(mut self, new_value: &str) -> ProjectLocationInternalRangeCreateCall<'a, C> {
15781 self._parent = new_value.to_string();
15782 self
15783 }
15784 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
15785 ///
15786 /// Sets the *request id* query property to the given value.
15787 pub fn request_id(mut self, new_value: &str) -> ProjectLocationInternalRangeCreateCall<'a, C> {
15788 self._request_id = Some(new_value.to_string());
15789 self
15790 }
15791 /// Optional. Resource ID (i.e. 'foo' in '[...]/projects/p/locations/l/internalRanges/foo') See https://google.aip.dev/122#resource-id-segments Unique per location.
15792 ///
15793 /// Sets the *internal range id* query property to the given value.
15794 pub fn internal_range_id(
15795 mut self,
15796 new_value: &str,
15797 ) -> ProjectLocationInternalRangeCreateCall<'a, C> {
15798 self._internal_range_id = Some(new_value.to_string());
15799 self
15800 }
15801 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15802 /// while executing the actual API request.
15803 ///
15804 /// ````text
15805 /// It should be used to handle progress information, and to implement a certain level of resilience.
15806 /// ````
15807 ///
15808 /// Sets the *delegate* property to the given value.
15809 pub fn delegate(
15810 mut self,
15811 new_value: &'a mut dyn common::Delegate,
15812 ) -> ProjectLocationInternalRangeCreateCall<'a, C> {
15813 self._delegate = Some(new_value);
15814 self
15815 }
15816
15817 /// Set any additional parameter of the query string used in the request.
15818 /// It should be used to set parameters which are not yet available through their own
15819 /// setters.
15820 ///
15821 /// Please note that this method must not be used to set any of the known parameters
15822 /// which have their own setter method. If done anyway, the request will fail.
15823 ///
15824 /// # Additional Parameters
15825 ///
15826 /// * *$.xgafv* (query-string) - V1 error format.
15827 /// * *access_token* (query-string) - OAuth access token.
15828 /// * *alt* (query-string) - Data format for response.
15829 /// * *callback* (query-string) - JSONP
15830 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15831 /// * *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.
15832 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15833 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15834 /// * *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.
15835 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15836 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15837 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInternalRangeCreateCall<'a, C>
15838 where
15839 T: AsRef<str>,
15840 {
15841 self._additional_params
15842 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15843 self
15844 }
15845
15846 /// Identifies the authorization scope for the method you are building.
15847 ///
15848 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15849 /// [`Scope::CloudPlatform`].
15850 ///
15851 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15852 /// tokens for more than one scope.
15853 ///
15854 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15855 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15856 /// sufficient, a read-write scope will do as well.
15857 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInternalRangeCreateCall<'a, C>
15858 where
15859 St: AsRef<str>,
15860 {
15861 self._scopes.insert(String::from(scope.as_ref()));
15862 self
15863 }
15864 /// Identifies the authorization scope(s) for the method you are building.
15865 ///
15866 /// See [`Self::add_scope()`] for details.
15867 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInternalRangeCreateCall<'a, C>
15868 where
15869 I: IntoIterator<Item = St>,
15870 St: AsRef<str>,
15871 {
15872 self._scopes
15873 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15874 self
15875 }
15876
15877 /// Removes all scopes, and no default scope will be used either.
15878 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15879 /// for details).
15880 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangeCreateCall<'a, C> {
15881 self._scopes.clear();
15882 self
15883 }
15884}
15885
15886/// Deletes a single internal range.
15887///
15888/// A builder for the *locations.internalRanges.delete* method supported by a *project* resource.
15889/// It is not used directly, but through a [`ProjectMethods`] instance.
15890///
15891/// # Example
15892///
15893/// Instantiate a resource method builder
15894///
15895/// ```test_harness,no_run
15896/// # extern crate hyper;
15897/// # extern crate hyper_rustls;
15898/// # extern crate google_networkconnectivity1 as networkconnectivity1;
15899/// # async fn dox() {
15900/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15901///
15902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15903/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15904/// # .with_native_roots()
15905/// # .unwrap()
15906/// # .https_only()
15907/// # .enable_http2()
15908/// # .build();
15909///
15910/// # let executor = hyper_util::rt::TokioExecutor::new();
15911/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15912/// # secret,
15913/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15914/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15915/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15916/// # ),
15917/// # ).build().await.unwrap();
15918///
15919/// # let client = hyper_util::client::legacy::Client::builder(
15920/// # hyper_util::rt::TokioExecutor::new()
15921/// # )
15922/// # .build(
15923/// # hyper_rustls::HttpsConnectorBuilder::new()
15924/// # .with_native_roots()
15925/// # .unwrap()
15926/// # .https_or_http()
15927/// # .enable_http2()
15928/// # .build()
15929/// # );
15930/// # let mut hub = Networkconnectivity::new(client, auth);
15931/// // You can configure optional parameters by calling the respective setters at will, and
15932/// // execute the final call using `doit()`.
15933/// // Values shown here are possibly random and not representative !
15934/// let result = hub.projects().locations_internal_ranges_delete("name")
15935/// .request_id("invidunt")
15936/// .doit().await;
15937/// # }
15938/// ```
15939pub struct ProjectLocationInternalRangeDeleteCall<'a, C>
15940where
15941 C: 'a,
15942{
15943 hub: &'a Networkconnectivity<C>,
15944 _name: String,
15945 _request_id: Option<String>,
15946 _delegate: Option<&'a mut dyn common::Delegate>,
15947 _additional_params: HashMap<String, String>,
15948 _scopes: BTreeSet<String>,
15949}
15950
15951impl<'a, C> common::CallBuilder for ProjectLocationInternalRangeDeleteCall<'a, C> {}
15952
15953impl<'a, C> ProjectLocationInternalRangeDeleteCall<'a, C>
15954where
15955 C: common::Connector,
15956{
15957 /// Perform the operation you have build so far.
15958 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
15959 use std::borrow::Cow;
15960 use std::io::{Read, Seek};
15961
15962 use common::{url::Params, ToParts};
15963 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15964
15965 let mut dd = common::DefaultDelegate;
15966 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15967 dlg.begin(common::MethodInfo {
15968 id: "networkconnectivity.projects.locations.internalRanges.delete",
15969 http_method: hyper::Method::DELETE,
15970 });
15971
15972 for &field in ["alt", "name", "requestId"].iter() {
15973 if self._additional_params.contains_key(field) {
15974 dlg.finished(false);
15975 return Err(common::Error::FieldClash(field));
15976 }
15977 }
15978
15979 let mut params = Params::with_capacity(4 + self._additional_params.len());
15980 params.push("name", self._name);
15981 if let Some(value) = self._request_id.as_ref() {
15982 params.push("requestId", value);
15983 }
15984
15985 params.extend(self._additional_params.iter());
15986
15987 params.push("alt", "json");
15988 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15989 if self._scopes.is_empty() {
15990 self._scopes
15991 .insert(Scope::CloudPlatform.as_ref().to_string());
15992 }
15993
15994 #[allow(clippy::single_element_loop)]
15995 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15996 url = params.uri_replacement(url, param_name, find_this, true);
15997 }
15998 {
15999 let to_remove = ["name"];
16000 params.remove_params(&to_remove);
16001 }
16002
16003 let url = params.parse_with_url(&url);
16004
16005 loop {
16006 let token = match self
16007 .hub
16008 .auth
16009 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16010 .await
16011 {
16012 Ok(token) => token,
16013 Err(e) => match dlg.token(e) {
16014 Ok(token) => token,
16015 Err(e) => {
16016 dlg.finished(false);
16017 return Err(common::Error::MissingToken(e));
16018 }
16019 },
16020 };
16021 let mut req_result = {
16022 let client = &self.hub.client;
16023 dlg.pre_request();
16024 let mut req_builder = hyper::Request::builder()
16025 .method(hyper::Method::DELETE)
16026 .uri(url.as_str())
16027 .header(USER_AGENT, self.hub._user_agent.clone());
16028
16029 if let Some(token) = token.as_ref() {
16030 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16031 }
16032
16033 let request = req_builder
16034 .header(CONTENT_LENGTH, 0_u64)
16035 .body(common::to_body::<String>(None));
16036
16037 client.request(request.unwrap()).await
16038 };
16039
16040 match req_result {
16041 Err(err) => {
16042 if let common::Retry::After(d) = dlg.http_error(&err) {
16043 sleep(d).await;
16044 continue;
16045 }
16046 dlg.finished(false);
16047 return Err(common::Error::HttpError(err));
16048 }
16049 Ok(res) => {
16050 let (mut parts, body) = res.into_parts();
16051 let mut body = common::Body::new(body);
16052 if !parts.status.is_success() {
16053 let bytes = common::to_bytes(body).await.unwrap_or_default();
16054 let error = serde_json::from_str(&common::to_string(&bytes));
16055 let response = common::to_response(parts, bytes.into());
16056
16057 if let common::Retry::After(d) =
16058 dlg.http_failure(&response, error.as_ref().ok())
16059 {
16060 sleep(d).await;
16061 continue;
16062 }
16063
16064 dlg.finished(false);
16065
16066 return Err(match error {
16067 Ok(value) => common::Error::BadRequest(value),
16068 _ => common::Error::Failure(response),
16069 });
16070 }
16071 let response = {
16072 let bytes = common::to_bytes(body).await.unwrap_or_default();
16073 let encoded = common::to_string(&bytes);
16074 match serde_json::from_str(&encoded) {
16075 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16076 Err(error) => {
16077 dlg.response_json_decode_error(&encoded, &error);
16078 return Err(common::Error::JsonDecodeError(
16079 encoded.to_string(),
16080 error,
16081 ));
16082 }
16083 }
16084 };
16085
16086 dlg.finished(true);
16087 return Ok(response);
16088 }
16089 }
16090 }
16091 }
16092
16093 /// Required. The name of the internal range to delete.
16094 ///
16095 /// Sets the *name* path property to the given value.
16096 ///
16097 /// Even though the property as already been set when instantiating this call,
16098 /// we provide this method for API completeness.
16099 pub fn name(mut self, new_value: &str) -> ProjectLocationInternalRangeDeleteCall<'a, C> {
16100 self._name = new_value.to_string();
16101 self
16102 }
16103 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
16104 ///
16105 /// Sets the *request id* query property to the given value.
16106 pub fn request_id(mut self, new_value: &str) -> ProjectLocationInternalRangeDeleteCall<'a, C> {
16107 self._request_id = Some(new_value.to_string());
16108 self
16109 }
16110 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16111 /// while executing the actual API request.
16112 ///
16113 /// ````text
16114 /// It should be used to handle progress information, and to implement a certain level of resilience.
16115 /// ````
16116 ///
16117 /// Sets the *delegate* property to the given value.
16118 pub fn delegate(
16119 mut self,
16120 new_value: &'a mut dyn common::Delegate,
16121 ) -> ProjectLocationInternalRangeDeleteCall<'a, C> {
16122 self._delegate = Some(new_value);
16123 self
16124 }
16125
16126 /// Set any additional parameter of the query string used in the request.
16127 /// It should be used to set parameters which are not yet available through their own
16128 /// setters.
16129 ///
16130 /// Please note that this method must not be used to set any of the known parameters
16131 /// which have their own setter method. If done anyway, the request will fail.
16132 ///
16133 /// # Additional Parameters
16134 ///
16135 /// * *$.xgafv* (query-string) - V1 error format.
16136 /// * *access_token* (query-string) - OAuth access token.
16137 /// * *alt* (query-string) - Data format for response.
16138 /// * *callback* (query-string) - JSONP
16139 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16140 /// * *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.
16141 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16142 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16143 /// * *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.
16144 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16145 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16146 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInternalRangeDeleteCall<'a, C>
16147 where
16148 T: AsRef<str>,
16149 {
16150 self._additional_params
16151 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16152 self
16153 }
16154
16155 /// Identifies the authorization scope for the method you are building.
16156 ///
16157 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16158 /// [`Scope::CloudPlatform`].
16159 ///
16160 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16161 /// tokens for more than one scope.
16162 ///
16163 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16164 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16165 /// sufficient, a read-write scope will do as well.
16166 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInternalRangeDeleteCall<'a, C>
16167 where
16168 St: AsRef<str>,
16169 {
16170 self._scopes.insert(String::from(scope.as_ref()));
16171 self
16172 }
16173 /// Identifies the authorization scope(s) for the method you are building.
16174 ///
16175 /// See [`Self::add_scope()`] for details.
16176 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInternalRangeDeleteCall<'a, C>
16177 where
16178 I: IntoIterator<Item = St>,
16179 St: AsRef<str>,
16180 {
16181 self._scopes
16182 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16183 self
16184 }
16185
16186 /// Removes all scopes, and no default scope will be used either.
16187 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16188 /// for details).
16189 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangeDeleteCall<'a, C> {
16190 self._scopes.clear();
16191 self
16192 }
16193}
16194
16195/// Gets details of a single internal range.
16196///
16197/// A builder for the *locations.internalRanges.get* method supported by a *project* resource.
16198/// It is not used directly, but through a [`ProjectMethods`] instance.
16199///
16200/// # Example
16201///
16202/// Instantiate a resource method builder
16203///
16204/// ```test_harness,no_run
16205/// # extern crate hyper;
16206/// # extern crate hyper_rustls;
16207/// # extern crate google_networkconnectivity1 as networkconnectivity1;
16208/// # async fn dox() {
16209/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16210///
16211/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16212/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16213/// # .with_native_roots()
16214/// # .unwrap()
16215/// # .https_only()
16216/// # .enable_http2()
16217/// # .build();
16218///
16219/// # let executor = hyper_util::rt::TokioExecutor::new();
16220/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16221/// # secret,
16222/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16223/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16224/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16225/// # ),
16226/// # ).build().await.unwrap();
16227///
16228/// # let client = hyper_util::client::legacy::Client::builder(
16229/// # hyper_util::rt::TokioExecutor::new()
16230/// # )
16231/// # .build(
16232/// # hyper_rustls::HttpsConnectorBuilder::new()
16233/// # .with_native_roots()
16234/// # .unwrap()
16235/// # .https_or_http()
16236/// # .enable_http2()
16237/// # .build()
16238/// # );
16239/// # let mut hub = Networkconnectivity::new(client, auth);
16240/// // You can configure optional parameters by calling the respective setters at will, and
16241/// // execute the final call using `doit()`.
16242/// // Values shown here are possibly random and not representative !
16243/// let result = hub.projects().locations_internal_ranges_get("name")
16244/// .doit().await;
16245/// # }
16246/// ```
16247pub struct ProjectLocationInternalRangeGetCall<'a, C>
16248where
16249 C: 'a,
16250{
16251 hub: &'a Networkconnectivity<C>,
16252 _name: String,
16253 _delegate: Option<&'a mut dyn common::Delegate>,
16254 _additional_params: HashMap<String, String>,
16255 _scopes: BTreeSet<String>,
16256}
16257
16258impl<'a, C> common::CallBuilder for ProjectLocationInternalRangeGetCall<'a, C> {}
16259
16260impl<'a, C> ProjectLocationInternalRangeGetCall<'a, C>
16261where
16262 C: common::Connector,
16263{
16264 /// Perform the operation you have build so far.
16265 pub async fn doit(mut self) -> common::Result<(common::Response, InternalRange)> {
16266 use std::borrow::Cow;
16267 use std::io::{Read, Seek};
16268
16269 use common::{url::Params, ToParts};
16270 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16271
16272 let mut dd = common::DefaultDelegate;
16273 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16274 dlg.begin(common::MethodInfo {
16275 id: "networkconnectivity.projects.locations.internalRanges.get",
16276 http_method: hyper::Method::GET,
16277 });
16278
16279 for &field in ["alt", "name"].iter() {
16280 if self._additional_params.contains_key(field) {
16281 dlg.finished(false);
16282 return Err(common::Error::FieldClash(field));
16283 }
16284 }
16285
16286 let mut params = Params::with_capacity(3 + self._additional_params.len());
16287 params.push("name", self._name);
16288
16289 params.extend(self._additional_params.iter());
16290
16291 params.push("alt", "json");
16292 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16293 if self._scopes.is_empty() {
16294 self._scopes
16295 .insert(Scope::CloudPlatform.as_ref().to_string());
16296 }
16297
16298 #[allow(clippy::single_element_loop)]
16299 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16300 url = params.uri_replacement(url, param_name, find_this, true);
16301 }
16302 {
16303 let to_remove = ["name"];
16304 params.remove_params(&to_remove);
16305 }
16306
16307 let url = params.parse_with_url(&url);
16308
16309 loop {
16310 let token = match self
16311 .hub
16312 .auth
16313 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16314 .await
16315 {
16316 Ok(token) => token,
16317 Err(e) => match dlg.token(e) {
16318 Ok(token) => token,
16319 Err(e) => {
16320 dlg.finished(false);
16321 return Err(common::Error::MissingToken(e));
16322 }
16323 },
16324 };
16325 let mut req_result = {
16326 let client = &self.hub.client;
16327 dlg.pre_request();
16328 let mut req_builder = hyper::Request::builder()
16329 .method(hyper::Method::GET)
16330 .uri(url.as_str())
16331 .header(USER_AGENT, self.hub._user_agent.clone());
16332
16333 if let Some(token) = token.as_ref() {
16334 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16335 }
16336
16337 let request = req_builder
16338 .header(CONTENT_LENGTH, 0_u64)
16339 .body(common::to_body::<String>(None));
16340
16341 client.request(request.unwrap()).await
16342 };
16343
16344 match req_result {
16345 Err(err) => {
16346 if let common::Retry::After(d) = dlg.http_error(&err) {
16347 sleep(d).await;
16348 continue;
16349 }
16350 dlg.finished(false);
16351 return Err(common::Error::HttpError(err));
16352 }
16353 Ok(res) => {
16354 let (mut parts, body) = res.into_parts();
16355 let mut body = common::Body::new(body);
16356 if !parts.status.is_success() {
16357 let bytes = common::to_bytes(body).await.unwrap_or_default();
16358 let error = serde_json::from_str(&common::to_string(&bytes));
16359 let response = common::to_response(parts, bytes.into());
16360
16361 if let common::Retry::After(d) =
16362 dlg.http_failure(&response, error.as_ref().ok())
16363 {
16364 sleep(d).await;
16365 continue;
16366 }
16367
16368 dlg.finished(false);
16369
16370 return Err(match error {
16371 Ok(value) => common::Error::BadRequest(value),
16372 _ => common::Error::Failure(response),
16373 });
16374 }
16375 let response = {
16376 let bytes = common::to_bytes(body).await.unwrap_or_default();
16377 let encoded = common::to_string(&bytes);
16378 match serde_json::from_str(&encoded) {
16379 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16380 Err(error) => {
16381 dlg.response_json_decode_error(&encoded, &error);
16382 return Err(common::Error::JsonDecodeError(
16383 encoded.to_string(),
16384 error,
16385 ));
16386 }
16387 }
16388 };
16389
16390 dlg.finished(true);
16391 return Ok(response);
16392 }
16393 }
16394 }
16395 }
16396
16397 /// Required. Name of the InternalRange to get.
16398 ///
16399 /// Sets the *name* path property to the given value.
16400 ///
16401 /// Even though the property as already been set when instantiating this call,
16402 /// we provide this method for API completeness.
16403 pub fn name(mut self, new_value: &str) -> ProjectLocationInternalRangeGetCall<'a, C> {
16404 self._name = new_value.to_string();
16405 self
16406 }
16407 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16408 /// while executing the actual API request.
16409 ///
16410 /// ````text
16411 /// It should be used to handle progress information, and to implement a certain level of resilience.
16412 /// ````
16413 ///
16414 /// Sets the *delegate* property to the given value.
16415 pub fn delegate(
16416 mut self,
16417 new_value: &'a mut dyn common::Delegate,
16418 ) -> ProjectLocationInternalRangeGetCall<'a, C> {
16419 self._delegate = Some(new_value);
16420 self
16421 }
16422
16423 /// Set any additional parameter of the query string used in the request.
16424 /// It should be used to set parameters which are not yet available through their own
16425 /// setters.
16426 ///
16427 /// Please note that this method must not be used to set any of the known parameters
16428 /// which have their own setter method. If done anyway, the request will fail.
16429 ///
16430 /// # Additional Parameters
16431 ///
16432 /// * *$.xgafv* (query-string) - V1 error format.
16433 /// * *access_token* (query-string) - OAuth access token.
16434 /// * *alt* (query-string) - Data format for response.
16435 /// * *callback* (query-string) - JSONP
16436 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16437 /// * *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.
16438 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16439 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16440 /// * *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.
16441 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16442 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16443 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInternalRangeGetCall<'a, C>
16444 where
16445 T: AsRef<str>,
16446 {
16447 self._additional_params
16448 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16449 self
16450 }
16451
16452 /// Identifies the authorization scope for the method you are building.
16453 ///
16454 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16455 /// [`Scope::CloudPlatform`].
16456 ///
16457 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16458 /// tokens for more than one scope.
16459 ///
16460 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16461 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16462 /// sufficient, a read-write scope will do as well.
16463 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInternalRangeGetCall<'a, C>
16464 where
16465 St: AsRef<str>,
16466 {
16467 self._scopes.insert(String::from(scope.as_ref()));
16468 self
16469 }
16470 /// Identifies the authorization scope(s) for the method you are building.
16471 ///
16472 /// See [`Self::add_scope()`] for details.
16473 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInternalRangeGetCall<'a, C>
16474 where
16475 I: IntoIterator<Item = St>,
16476 St: AsRef<str>,
16477 {
16478 self._scopes
16479 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16480 self
16481 }
16482
16483 /// Removes all scopes, and no default scope will be used either.
16484 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16485 /// for details).
16486 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangeGetCall<'a, C> {
16487 self._scopes.clear();
16488 self
16489 }
16490}
16491
16492/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
16493///
16494/// A builder for the *locations.internalRanges.getIamPolicy* method supported by a *project* resource.
16495/// It is not used directly, but through a [`ProjectMethods`] instance.
16496///
16497/// # Example
16498///
16499/// Instantiate a resource method builder
16500///
16501/// ```test_harness,no_run
16502/// # extern crate hyper;
16503/// # extern crate hyper_rustls;
16504/// # extern crate google_networkconnectivity1 as networkconnectivity1;
16505/// # async fn dox() {
16506/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16507///
16508/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16509/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16510/// # .with_native_roots()
16511/// # .unwrap()
16512/// # .https_only()
16513/// # .enable_http2()
16514/// # .build();
16515///
16516/// # let executor = hyper_util::rt::TokioExecutor::new();
16517/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16518/// # secret,
16519/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16520/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16521/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16522/// # ),
16523/// # ).build().await.unwrap();
16524///
16525/// # let client = hyper_util::client::legacy::Client::builder(
16526/// # hyper_util::rt::TokioExecutor::new()
16527/// # )
16528/// # .build(
16529/// # hyper_rustls::HttpsConnectorBuilder::new()
16530/// # .with_native_roots()
16531/// # .unwrap()
16532/// # .https_or_http()
16533/// # .enable_http2()
16534/// # .build()
16535/// # );
16536/// # let mut hub = Networkconnectivity::new(client, auth);
16537/// // You can configure optional parameters by calling the respective setters at will, and
16538/// // execute the final call using `doit()`.
16539/// // Values shown here are possibly random and not representative !
16540/// let result = hub.projects().locations_internal_ranges_get_iam_policy("resource")
16541/// .options_requested_policy_version(-27)
16542/// .doit().await;
16543/// # }
16544/// ```
16545pub struct ProjectLocationInternalRangeGetIamPolicyCall<'a, C>
16546where
16547 C: 'a,
16548{
16549 hub: &'a Networkconnectivity<C>,
16550 _resource: String,
16551 _options_requested_policy_version: Option<i32>,
16552 _delegate: Option<&'a mut dyn common::Delegate>,
16553 _additional_params: HashMap<String, String>,
16554 _scopes: BTreeSet<String>,
16555}
16556
16557impl<'a, C> common::CallBuilder for ProjectLocationInternalRangeGetIamPolicyCall<'a, C> {}
16558
16559impl<'a, C> ProjectLocationInternalRangeGetIamPolicyCall<'a, C>
16560where
16561 C: common::Connector,
16562{
16563 /// Perform the operation you have build so far.
16564 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16565 use std::borrow::Cow;
16566 use std::io::{Read, Seek};
16567
16568 use common::{url::Params, ToParts};
16569 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16570
16571 let mut dd = common::DefaultDelegate;
16572 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16573 dlg.begin(common::MethodInfo {
16574 id: "networkconnectivity.projects.locations.internalRanges.getIamPolicy",
16575 http_method: hyper::Method::GET,
16576 });
16577
16578 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
16579 if self._additional_params.contains_key(field) {
16580 dlg.finished(false);
16581 return Err(common::Error::FieldClash(field));
16582 }
16583 }
16584
16585 let mut params = Params::with_capacity(4 + self._additional_params.len());
16586 params.push("resource", self._resource);
16587 if let Some(value) = self._options_requested_policy_version.as_ref() {
16588 params.push("options.requestedPolicyVersion", value.to_string());
16589 }
16590
16591 params.extend(self._additional_params.iter());
16592
16593 params.push("alt", "json");
16594 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
16595 if self._scopes.is_empty() {
16596 self._scopes
16597 .insert(Scope::CloudPlatform.as_ref().to_string());
16598 }
16599
16600 #[allow(clippy::single_element_loop)]
16601 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16602 url = params.uri_replacement(url, param_name, find_this, true);
16603 }
16604 {
16605 let to_remove = ["resource"];
16606 params.remove_params(&to_remove);
16607 }
16608
16609 let url = params.parse_with_url(&url);
16610
16611 loop {
16612 let token = match self
16613 .hub
16614 .auth
16615 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16616 .await
16617 {
16618 Ok(token) => token,
16619 Err(e) => match dlg.token(e) {
16620 Ok(token) => token,
16621 Err(e) => {
16622 dlg.finished(false);
16623 return Err(common::Error::MissingToken(e));
16624 }
16625 },
16626 };
16627 let mut req_result = {
16628 let client = &self.hub.client;
16629 dlg.pre_request();
16630 let mut req_builder = hyper::Request::builder()
16631 .method(hyper::Method::GET)
16632 .uri(url.as_str())
16633 .header(USER_AGENT, self.hub._user_agent.clone());
16634
16635 if let Some(token) = token.as_ref() {
16636 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16637 }
16638
16639 let request = req_builder
16640 .header(CONTENT_LENGTH, 0_u64)
16641 .body(common::to_body::<String>(None));
16642
16643 client.request(request.unwrap()).await
16644 };
16645
16646 match req_result {
16647 Err(err) => {
16648 if let common::Retry::After(d) = dlg.http_error(&err) {
16649 sleep(d).await;
16650 continue;
16651 }
16652 dlg.finished(false);
16653 return Err(common::Error::HttpError(err));
16654 }
16655 Ok(res) => {
16656 let (mut parts, body) = res.into_parts();
16657 let mut body = common::Body::new(body);
16658 if !parts.status.is_success() {
16659 let bytes = common::to_bytes(body).await.unwrap_or_default();
16660 let error = serde_json::from_str(&common::to_string(&bytes));
16661 let response = common::to_response(parts, bytes.into());
16662
16663 if let common::Retry::After(d) =
16664 dlg.http_failure(&response, error.as_ref().ok())
16665 {
16666 sleep(d).await;
16667 continue;
16668 }
16669
16670 dlg.finished(false);
16671
16672 return Err(match error {
16673 Ok(value) => common::Error::BadRequest(value),
16674 _ => common::Error::Failure(response),
16675 });
16676 }
16677 let response = {
16678 let bytes = common::to_bytes(body).await.unwrap_or_default();
16679 let encoded = common::to_string(&bytes);
16680 match serde_json::from_str(&encoded) {
16681 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16682 Err(error) => {
16683 dlg.response_json_decode_error(&encoded, &error);
16684 return Err(common::Error::JsonDecodeError(
16685 encoded.to_string(),
16686 error,
16687 ));
16688 }
16689 }
16690 };
16691
16692 dlg.finished(true);
16693 return Ok(response);
16694 }
16695 }
16696 }
16697 }
16698
16699 /// 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.
16700 ///
16701 /// Sets the *resource* path property to the given value.
16702 ///
16703 /// Even though the property as already been set when instantiating this call,
16704 /// we provide this method for API completeness.
16705 pub fn resource(
16706 mut self,
16707 new_value: &str,
16708 ) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C> {
16709 self._resource = new_value.to_string();
16710 self
16711 }
16712 /// 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).
16713 ///
16714 /// Sets the *options.requested policy version* query property to the given value.
16715 pub fn options_requested_policy_version(
16716 mut self,
16717 new_value: i32,
16718 ) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C> {
16719 self._options_requested_policy_version = Some(new_value);
16720 self
16721 }
16722 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16723 /// while executing the actual API request.
16724 ///
16725 /// ````text
16726 /// It should be used to handle progress information, and to implement a certain level of resilience.
16727 /// ````
16728 ///
16729 /// Sets the *delegate* property to the given value.
16730 pub fn delegate(
16731 mut self,
16732 new_value: &'a mut dyn common::Delegate,
16733 ) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C> {
16734 self._delegate = Some(new_value);
16735 self
16736 }
16737
16738 /// Set any additional parameter of the query string used in the request.
16739 /// It should be used to set parameters which are not yet available through their own
16740 /// setters.
16741 ///
16742 /// Please note that this method must not be used to set any of the known parameters
16743 /// which have their own setter method. If done anyway, the request will fail.
16744 ///
16745 /// # Additional Parameters
16746 ///
16747 /// * *$.xgafv* (query-string) - V1 error format.
16748 /// * *access_token* (query-string) - OAuth access token.
16749 /// * *alt* (query-string) - Data format for response.
16750 /// * *callback* (query-string) - JSONP
16751 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16752 /// * *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.
16753 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16754 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16755 /// * *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.
16756 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16757 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16758 pub fn param<T>(
16759 mut self,
16760 name: T,
16761 value: T,
16762 ) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C>
16763 where
16764 T: AsRef<str>,
16765 {
16766 self._additional_params
16767 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16768 self
16769 }
16770
16771 /// Identifies the authorization scope for the method you are building.
16772 ///
16773 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16774 /// [`Scope::CloudPlatform`].
16775 ///
16776 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16777 /// tokens for more than one scope.
16778 ///
16779 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16780 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16781 /// sufficient, a read-write scope will do as well.
16782 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C>
16783 where
16784 St: AsRef<str>,
16785 {
16786 self._scopes.insert(String::from(scope.as_ref()));
16787 self
16788 }
16789 /// Identifies the authorization scope(s) for the method you are building.
16790 ///
16791 /// See [`Self::add_scope()`] for details.
16792 pub fn add_scopes<I, St>(
16793 mut self,
16794 scopes: I,
16795 ) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C>
16796 where
16797 I: IntoIterator<Item = St>,
16798 St: AsRef<str>,
16799 {
16800 self._scopes
16801 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16802 self
16803 }
16804
16805 /// Removes all scopes, and no default scope will be used either.
16806 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16807 /// for details).
16808 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangeGetIamPolicyCall<'a, C> {
16809 self._scopes.clear();
16810 self
16811 }
16812}
16813
16814/// Lists internal ranges in a given project and location.
16815///
16816/// A builder for the *locations.internalRanges.list* method supported by a *project* resource.
16817/// It is not used directly, but through a [`ProjectMethods`] instance.
16818///
16819/// # Example
16820///
16821/// Instantiate a resource method builder
16822///
16823/// ```test_harness,no_run
16824/// # extern crate hyper;
16825/// # extern crate hyper_rustls;
16826/// # extern crate google_networkconnectivity1 as networkconnectivity1;
16827/// # async fn dox() {
16828/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16829///
16830/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16831/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16832/// # .with_native_roots()
16833/// # .unwrap()
16834/// # .https_only()
16835/// # .enable_http2()
16836/// # .build();
16837///
16838/// # let executor = hyper_util::rt::TokioExecutor::new();
16839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16840/// # secret,
16841/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16842/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16843/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16844/// # ),
16845/// # ).build().await.unwrap();
16846///
16847/// # let client = hyper_util::client::legacy::Client::builder(
16848/// # hyper_util::rt::TokioExecutor::new()
16849/// # )
16850/// # .build(
16851/// # hyper_rustls::HttpsConnectorBuilder::new()
16852/// # .with_native_roots()
16853/// # .unwrap()
16854/// # .https_or_http()
16855/// # .enable_http2()
16856/// # .build()
16857/// # );
16858/// # let mut hub = Networkconnectivity::new(client, auth);
16859/// // You can configure optional parameters by calling the respective setters at will, and
16860/// // execute the final call using `doit()`.
16861/// // Values shown here are possibly random and not representative !
16862/// let result = hub.projects().locations_internal_ranges_list("parent")
16863/// .page_token("sit")
16864/// .page_size(-35)
16865/// .order_by("tempor")
16866/// .filter("aliquyam")
16867/// .doit().await;
16868/// # }
16869/// ```
16870pub struct ProjectLocationInternalRangeListCall<'a, C>
16871where
16872 C: 'a,
16873{
16874 hub: &'a Networkconnectivity<C>,
16875 _parent: String,
16876 _page_token: Option<String>,
16877 _page_size: Option<i32>,
16878 _order_by: Option<String>,
16879 _filter: Option<String>,
16880 _delegate: Option<&'a mut dyn common::Delegate>,
16881 _additional_params: HashMap<String, String>,
16882 _scopes: BTreeSet<String>,
16883}
16884
16885impl<'a, C> common::CallBuilder for ProjectLocationInternalRangeListCall<'a, C> {}
16886
16887impl<'a, C> ProjectLocationInternalRangeListCall<'a, C>
16888where
16889 C: common::Connector,
16890{
16891 /// Perform the operation you have build so far.
16892 pub async fn doit(mut self) -> common::Result<(common::Response, ListInternalRangesResponse)> {
16893 use std::borrow::Cow;
16894 use std::io::{Read, Seek};
16895
16896 use common::{url::Params, ToParts};
16897 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16898
16899 let mut dd = common::DefaultDelegate;
16900 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16901 dlg.begin(common::MethodInfo {
16902 id: "networkconnectivity.projects.locations.internalRanges.list",
16903 http_method: hyper::Method::GET,
16904 });
16905
16906 for &field in [
16907 "alt",
16908 "parent",
16909 "pageToken",
16910 "pageSize",
16911 "orderBy",
16912 "filter",
16913 ]
16914 .iter()
16915 {
16916 if self._additional_params.contains_key(field) {
16917 dlg.finished(false);
16918 return Err(common::Error::FieldClash(field));
16919 }
16920 }
16921
16922 let mut params = Params::with_capacity(7 + self._additional_params.len());
16923 params.push("parent", self._parent);
16924 if let Some(value) = self._page_token.as_ref() {
16925 params.push("pageToken", value);
16926 }
16927 if let Some(value) = self._page_size.as_ref() {
16928 params.push("pageSize", value.to_string());
16929 }
16930 if let Some(value) = self._order_by.as_ref() {
16931 params.push("orderBy", value);
16932 }
16933 if let Some(value) = self._filter.as_ref() {
16934 params.push("filter", value);
16935 }
16936
16937 params.extend(self._additional_params.iter());
16938
16939 params.push("alt", "json");
16940 let mut url = self.hub._base_url.clone() + "v1/{+parent}/internalRanges";
16941 if self._scopes.is_empty() {
16942 self._scopes
16943 .insert(Scope::CloudPlatform.as_ref().to_string());
16944 }
16945
16946 #[allow(clippy::single_element_loop)]
16947 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16948 url = params.uri_replacement(url, param_name, find_this, true);
16949 }
16950 {
16951 let to_remove = ["parent"];
16952 params.remove_params(&to_remove);
16953 }
16954
16955 let url = params.parse_with_url(&url);
16956
16957 loop {
16958 let token = match self
16959 .hub
16960 .auth
16961 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16962 .await
16963 {
16964 Ok(token) => token,
16965 Err(e) => match dlg.token(e) {
16966 Ok(token) => token,
16967 Err(e) => {
16968 dlg.finished(false);
16969 return Err(common::Error::MissingToken(e));
16970 }
16971 },
16972 };
16973 let mut req_result = {
16974 let client = &self.hub.client;
16975 dlg.pre_request();
16976 let mut req_builder = hyper::Request::builder()
16977 .method(hyper::Method::GET)
16978 .uri(url.as_str())
16979 .header(USER_AGENT, self.hub._user_agent.clone());
16980
16981 if let Some(token) = token.as_ref() {
16982 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16983 }
16984
16985 let request = req_builder
16986 .header(CONTENT_LENGTH, 0_u64)
16987 .body(common::to_body::<String>(None));
16988
16989 client.request(request.unwrap()).await
16990 };
16991
16992 match req_result {
16993 Err(err) => {
16994 if let common::Retry::After(d) = dlg.http_error(&err) {
16995 sleep(d).await;
16996 continue;
16997 }
16998 dlg.finished(false);
16999 return Err(common::Error::HttpError(err));
17000 }
17001 Ok(res) => {
17002 let (mut parts, body) = res.into_parts();
17003 let mut body = common::Body::new(body);
17004 if !parts.status.is_success() {
17005 let bytes = common::to_bytes(body).await.unwrap_or_default();
17006 let error = serde_json::from_str(&common::to_string(&bytes));
17007 let response = common::to_response(parts, bytes.into());
17008
17009 if let common::Retry::After(d) =
17010 dlg.http_failure(&response, error.as_ref().ok())
17011 {
17012 sleep(d).await;
17013 continue;
17014 }
17015
17016 dlg.finished(false);
17017
17018 return Err(match error {
17019 Ok(value) => common::Error::BadRequest(value),
17020 _ => common::Error::Failure(response),
17021 });
17022 }
17023 let response = {
17024 let bytes = common::to_bytes(body).await.unwrap_or_default();
17025 let encoded = common::to_string(&bytes);
17026 match serde_json::from_str(&encoded) {
17027 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17028 Err(error) => {
17029 dlg.response_json_decode_error(&encoded, &error);
17030 return Err(common::Error::JsonDecodeError(
17031 encoded.to_string(),
17032 error,
17033 ));
17034 }
17035 }
17036 };
17037
17038 dlg.finished(true);
17039 return Ok(response);
17040 }
17041 }
17042 }
17043 }
17044
17045 /// Required. The parent resource's name.
17046 ///
17047 /// Sets the *parent* path property to the given value.
17048 ///
17049 /// Even though the property as already been set when instantiating this call,
17050 /// we provide this method for API completeness.
17051 pub fn parent(mut self, new_value: &str) -> ProjectLocationInternalRangeListCall<'a, C> {
17052 self._parent = new_value.to_string();
17053 self
17054 }
17055 /// The page token.
17056 ///
17057 /// Sets the *page token* query property to the given value.
17058 pub fn page_token(mut self, new_value: &str) -> ProjectLocationInternalRangeListCall<'a, C> {
17059 self._page_token = Some(new_value.to_string());
17060 self
17061 }
17062 /// The maximum number of results per page that should be returned.
17063 ///
17064 /// Sets the *page size* query property to the given value.
17065 pub fn page_size(mut self, new_value: i32) -> ProjectLocationInternalRangeListCall<'a, C> {
17066 self._page_size = Some(new_value);
17067 self
17068 }
17069 /// Sort the results by a certain order.
17070 ///
17071 /// Sets the *order by* query property to the given value.
17072 pub fn order_by(mut self, new_value: &str) -> ProjectLocationInternalRangeListCall<'a, C> {
17073 self._order_by = Some(new_value.to_string());
17074 self
17075 }
17076 /// A filter expression that filters the results listed in the response.
17077 ///
17078 /// Sets the *filter* query property to the given value.
17079 pub fn filter(mut self, new_value: &str) -> ProjectLocationInternalRangeListCall<'a, C> {
17080 self._filter = Some(new_value.to_string());
17081 self
17082 }
17083 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17084 /// while executing the actual API request.
17085 ///
17086 /// ````text
17087 /// It should be used to handle progress information, and to implement a certain level of resilience.
17088 /// ````
17089 ///
17090 /// Sets the *delegate* property to the given value.
17091 pub fn delegate(
17092 mut self,
17093 new_value: &'a mut dyn common::Delegate,
17094 ) -> ProjectLocationInternalRangeListCall<'a, C> {
17095 self._delegate = Some(new_value);
17096 self
17097 }
17098
17099 /// Set any additional parameter of the query string used in the request.
17100 /// It should be used to set parameters which are not yet available through their own
17101 /// setters.
17102 ///
17103 /// Please note that this method must not be used to set any of the known parameters
17104 /// which have their own setter method. If done anyway, the request will fail.
17105 ///
17106 /// # Additional Parameters
17107 ///
17108 /// * *$.xgafv* (query-string) - V1 error format.
17109 /// * *access_token* (query-string) - OAuth access token.
17110 /// * *alt* (query-string) - Data format for response.
17111 /// * *callback* (query-string) - JSONP
17112 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17113 /// * *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.
17114 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17115 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17116 /// * *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.
17117 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17118 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17119 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInternalRangeListCall<'a, C>
17120 where
17121 T: AsRef<str>,
17122 {
17123 self._additional_params
17124 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17125 self
17126 }
17127
17128 /// Identifies the authorization scope for the method you are building.
17129 ///
17130 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17131 /// [`Scope::CloudPlatform`].
17132 ///
17133 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17134 /// tokens for more than one scope.
17135 ///
17136 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17137 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17138 /// sufficient, a read-write scope will do as well.
17139 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInternalRangeListCall<'a, C>
17140 where
17141 St: AsRef<str>,
17142 {
17143 self._scopes.insert(String::from(scope.as_ref()));
17144 self
17145 }
17146 /// Identifies the authorization scope(s) for the method you are building.
17147 ///
17148 /// See [`Self::add_scope()`] for details.
17149 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInternalRangeListCall<'a, C>
17150 where
17151 I: IntoIterator<Item = St>,
17152 St: AsRef<str>,
17153 {
17154 self._scopes
17155 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17156 self
17157 }
17158
17159 /// Removes all scopes, and no default scope will be used either.
17160 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17161 /// for details).
17162 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangeListCall<'a, C> {
17163 self._scopes.clear();
17164 self
17165 }
17166}
17167
17168/// Updates the parameters of a single internal range.
17169///
17170/// A builder for the *locations.internalRanges.patch* method supported by a *project* resource.
17171/// It is not used directly, but through a [`ProjectMethods`] instance.
17172///
17173/// # Example
17174///
17175/// Instantiate a resource method builder
17176///
17177/// ```test_harness,no_run
17178/// # extern crate hyper;
17179/// # extern crate hyper_rustls;
17180/// # extern crate google_networkconnectivity1 as networkconnectivity1;
17181/// use networkconnectivity1::api::InternalRange;
17182/// # async fn dox() {
17183/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17184///
17185/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17186/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17187/// # .with_native_roots()
17188/// # .unwrap()
17189/// # .https_only()
17190/// # .enable_http2()
17191/// # .build();
17192///
17193/// # let executor = hyper_util::rt::TokioExecutor::new();
17194/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17195/// # secret,
17196/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17197/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17198/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17199/// # ),
17200/// # ).build().await.unwrap();
17201///
17202/// # let client = hyper_util::client::legacy::Client::builder(
17203/// # hyper_util::rt::TokioExecutor::new()
17204/// # )
17205/// # .build(
17206/// # hyper_rustls::HttpsConnectorBuilder::new()
17207/// # .with_native_roots()
17208/// # .unwrap()
17209/// # .https_or_http()
17210/// # .enable_http2()
17211/// # .build()
17212/// # );
17213/// # let mut hub = Networkconnectivity::new(client, auth);
17214/// // As the method needs a request, you would usually fill it with the desired information
17215/// // into the respective structure. Some of the parts shown here might not be applicable !
17216/// // Values shown here are possibly random and not representative !
17217/// let mut req = InternalRange::default();
17218///
17219/// // You can configure optional parameters by calling the respective setters at will, and
17220/// // execute the final call using `doit()`.
17221/// // Values shown here are possibly random and not representative !
17222/// let result = hub.projects().locations_internal_ranges_patch(req, "name")
17223/// .update_mask(FieldMask::new::<&str>(&[]))
17224/// .request_id("et")
17225/// .doit().await;
17226/// # }
17227/// ```
17228pub struct ProjectLocationInternalRangePatchCall<'a, C>
17229where
17230 C: 'a,
17231{
17232 hub: &'a Networkconnectivity<C>,
17233 _request: InternalRange,
17234 _name: String,
17235 _update_mask: Option<common::FieldMask>,
17236 _request_id: Option<String>,
17237 _delegate: Option<&'a mut dyn common::Delegate>,
17238 _additional_params: HashMap<String, String>,
17239 _scopes: BTreeSet<String>,
17240}
17241
17242impl<'a, C> common::CallBuilder for ProjectLocationInternalRangePatchCall<'a, C> {}
17243
17244impl<'a, C> ProjectLocationInternalRangePatchCall<'a, C>
17245where
17246 C: common::Connector,
17247{
17248 /// Perform the operation you have build so far.
17249 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
17250 use std::borrow::Cow;
17251 use std::io::{Read, Seek};
17252
17253 use common::{url::Params, ToParts};
17254 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17255
17256 let mut dd = common::DefaultDelegate;
17257 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17258 dlg.begin(common::MethodInfo {
17259 id: "networkconnectivity.projects.locations.internalRanges.patch",
17260 http_method: hyper::Method::PATCH,
17261 });
17262
17263 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
17264 if self._additional_params.contains_key(field) {
17265 dlg.finished(false);
17266 return Err(common::Error::FieldClash(field));
17267 }
17268 }
17269
17270 let mut params = Params::with_capacity(6 + self._additional_params.len());
17271 params.push("name", self._name);
17272 if let Some(value) = self._update_mask.as_ref() {
17273 params.push("updateMask", value.to_string());
17274 }
17275 if let Some(value) = self._request_id.as_ref() {
17276 params.push("requestId", value);
17277 }
17278
17279 params.extend(self._additional_params.iter());
17280
17281 params.push("alt", "json");
17282 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17283 if self._scopes.is_empty() {
17284 self._scopes
17285 .insert(Scope::CloudPlatform.as_ref().to_string());
17286 }
17287
17288 #[allow(clippy::single_element_loop)]
17289 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17290 url = params.uri_replacement(url, param_name, find_this, true);
17291 }
17292 {
17293 let to_remove = ["name"];
17294 params.remove_params(&to_remove);
17295 }
17296
17297 let url = params.parse_with_url(&url);
17298
17299 let mut json_mime_type = mime::APPLICATION_JSON;
17300 let mut request_value_reader = {
17301 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17302 common::remove_json_null_values(&mut value);
17303 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17304 serde_json::to_writer(&mut dst, &value).unwrap();
17305 dst
17306 };
17307 let request_size = request_value_reader
17308 .seek(std::io::SeekFrom::End(0))
17309 .unwrap();
17310 request_value_reader
17311 .seek(std::io::SeekFrom::Start(0))
17312 .unwrap();
17313
17314 loop {
17315 let token = match self
17316 .hub
17317 .auth
17318 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17319 .await
17320 {
17321 Ok(token) => token,
17322 Err(e) => match dlg.token(e) {
17323 Ok(token) => token,
17324 Err(e) => {
17325 dlg.finished(false);
17326 return Err(common::Error::MissingToken(e));
17327 }
17328 },
17329 };
17330 request_value_reader
17331 .seek(std::io::SeekFrom::Start(0))
17332 .unwrap();
17333 let mut req_result = {
17334 let client = &self.hub.client;
17335 dlg.pre_request();
17336 let mut req_builder = hyper::Request::builder()
17337 .method(hyper::Method::PATCH)
17338 .uri(url.as_str())
17339 .header(USER_AGENT, self.hub._user_agent.clone());
17340
17341 if let Some(token) = token.as_ref() {
17342 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17343 }
17344
17345 let request = req_builder
17346 .header(CONTENT_TYPE, json_mime_type.to_string())
17347 .header(CONTENT_LENGTH, request_size as u64)
17348 .body(common::to_body(
17349 request_value_reader.get_ref().clone().into(),
17350 ));
17351
17352 client.request(request.unwrap()).await
17353 };
17354
17355 match req_result {
17356 Err(err) => {
17357 if let common::Retry::After(d) = dlg.http_error(&err) {
17358 sleep(d).await;
17359 continue;
17360 }
17361 dlg.finished(false);
17362 return Err(common::Error::HttpError(err));
17363 }
17364 Ok(res) => {
17365 let (mut parts, body) = res.into_parts();
17366 let mut body = common::Body::new(body);
17367 if !parts.status.is_success() {
17368 let bytes = common::to_bytes(body).await.unwrap_or_default();
17369 let error = serde_json::from_str(&common::to_string(&bytes));
17370 let response = common::to_response(parts, bytes.into());
17371
17372 if let common::Retry::After(d) =
17373 dlg.http_failure(&response, error.as_ref().ok())
17374 {
17375 sleep(d).await;
17376 continue;
17377 }
17378
17379 dlg.finished(false);
17380
17381 return Err(match error {
17382 Ok(value) => common::Error::BadRequest(value),
17383 _ => common::Error::Failure(response),
17384 });
17385 }
17386 let response = {
17387 let bytes = common::to_bytes(body).await.unwrap_or_default();
17388 let encoded = common::to_string(&bytes);
17389 match serde_json::from_str(&encoded) {
17390 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17391 Err(error) => {
17392 dlg.response_json_decode_error(&encoded, &error);
17393 return Err(common::Error::JsonDecodeError(
17394 encoded.to_string(),
17395 error,
17396 ));
17397 }
17398 }
17399 };
17400
17401 dlg.finished(true);
17402 return Ok(response);
17403 }
17404 }
17405 }
17406 }
17407
17408 ///
17409 /// Sets the *request* property to the given value.
17410 ///
17411 /// Even though the property as already been set when instantiating this call,
17412 /// we provide this method for API completeness.
17413 pub fn request(
17414 mut self,
17415 new_value: InternalRange,
17416 ) -> ProjectLocationInternalRangePatchCall<'a, C> {
17417 self._request = new_value;
17418 self
17419 }
17420 /// Identifier. The name of an internal range. Format: projects/{project}/locations/{location}/internalRanges/{internal_range} See: https://google.aip.dev/122#fields-representing-resource-names
17421 ///
17422 /// Sets the *name* path property to the given value.
17423 ///
17424 /// Even though the property as already been set when instantiating this call,
17425 /// we provide this method for API completeness.
17426 pub fn name(mut self, new_value: &str) -> ProjectLocationInternalRangePatchCall<'a, C> {
17427 self._name = new_value.to_string();
17428 self
17429 }
17430 /// Optional. Field mask is used to specify the fields to be overwritten in the InternalRange resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
17431 ///
17432 /// Sets the *update mask* query property to the given value.
17433 pub fn update_mask(
17434 mut self,
17435 new_value: common::FieldMask,
17436 ) -> ProjectLocationInternalRangePatchCall<'a, C> {
17437 self._update_mask = Some(new_value);
17438 self
17439 }
17440 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
17441 ///
17442 /// Sets the *request id* query property to the given value.
17443 pub fn request_id(mut self, new_value: &str) -> ProjectLocationInternalRangePatchCall<'a, C> {
17444 self._request_id = Some(new_value.to_string());
17445 self
17446 }
17447 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17448 /// while executing the actual API request.
17449 ///
17450 /// ````text
17451 /// It should be used to handle progress information, and to implement a certain level of resilience.
17452 /// ````
17453 ///
17454 /// Sets the *delegate* property to the given value.
17455 pub fn delegate(
17456 mut self,
17457 new_value: &'a mut dyn common::Delegate,
17458 ) -> ProjectLocationInternalRangePatchCall<'a, C> {
17459 self._delegate = Some(new_value);
17460 self
17461 }
17462
17463 /// Set any additional parameter of the query string used in the request.
17464 /// It should be used to set parameters which are not yet available through their own
17465 /// setters.
17466 ///
17467 /// Please note that this method must not be used to set any of the known parameters
17468 /// which have their own setter method. If done anyway, the request will fail.
17469 ///
17470 /// # Additional Parameters
17471 ///
17472 /// * *$.xgafv* (query-string) - V1 error format.
17473 /// * *access_token* (query-string) - OAuth access token.
17474 /// * *alt* (query-string) - Data format for response.
17475 /// * *callback* (query-string) - JSONP
17476 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17477 /// * *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.
17478 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17479 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17480 /// * *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.
17481 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17482 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17483 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInternalRangePatchCall<'a, C>
17484 where
17485 T: AsRef<str>,
17486 {
17487 self._additional_params
17488 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17489 self
17490 }
17491
17492 /// Identifies the authorization scope for the method you are building.
17493 ///
17494 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17495 /// [`Scope::CloudPlatform`].
17496 ///
17497 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17498 /// tokens for more than one scope.
17499 ///
17500 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17501 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17502 /// sufficient, a read-write scope will do as well.
17503 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInternalRangePatchCall<'a, C>
17504 where
17505 St: AsRef<str>,
17506 {
17507 self._scopes.insert(String::from(scope.as_ref()));
17508 self
17509 }
17510 /// Identifies the authorization scope(s) for the method you are building.
17511 ///
17512 /// See [`Self::add_scope()`] for details.
17513 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInternalRangePatchCall<'a, C>
17514 where
17515 I: IntoIterator<Item = St>,
17516 St: AsRef<str>,
17517 {
17518 self._scopes
17519 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17520 self
17521 }
17522
17523 /// Removes all scopes, and no default scope will be used either.
17524 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17525 /// for details).
17526 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangePatchCall<'a, C> {
17527 self._scopes.clear();
17528 self
17529 }
17530}
17531
17532/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
17533///
17534/// A builder for the *locations.internalRanges.setIamPolicy* method supported by a *project* resource.
17535/// It is not used directly, but through a [`ProjectMethods`] instance.
17536///
17537/// # Example
17538///
17539/// Instantiate a resource method builder
17540///
17541/// ```test_harness,no_run
17542/// # extern crate hyper;
17543/// # extern crate hyper_rustls;
17544/// # extern crate google_networkconnectivity1 as networkconnectivity1;
17545/// use networkconnectivity1::api::SetIamPolicyRequest;
17546/// # async fn dox() {
17547/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17548///
17549/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17550/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17551/// # .with_native_roots()
17552/// # .unwrap()
17553/// # .https_only()
17554/// # .enable_http2()
17555/// # .build();
17556///
17557/// # let executor = hyper_util::rt::TokioExecutor::new();
17558/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17559/// # secret,
17560/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17561/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17562/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17563/// # ),
17564/// # ).build().await.unwrap();
17565///
17566/// # let client = hyper_util::client::legacy::Client::builder(
17567/// # hyper_util::rt::TokioExecutor::new()
17568/// # )
17569/// # .build(
17570/// # hyper_rustls::HttpsConnectorBuilder::new()
17571/// # .with_native_roots()
17572/// # .unwrap()
17573/// # .https_or_http()
17574/// # .enable_http2()
17575/// # .build()
17576/// # );
17577/// # let mut hub = Networkconnectivity::new(client, auth);
17578/// // As the method needs a request, you would usually fill it with the desired information
17579/// // into the respective structure. Some of the parts shown here might not be applicable !
17580/// // Values shown here are possibly random and not representative !
17581/// let mut req = SetIamPolicyRequest::default();
17582///
17583/// // You can configure optional parameters by calling the respective setters at will, and
17584/// // execute the final call using `doit()`.
17585/// // Values shown here are possibly random and not representative !
17586/// let result = hub.projects().locations_internal_ranges_set_iam_policy(req, "resource")
17587/// .doit().await;
17588/// # }
17589/// ```
17590pub struct ProjectLocationInternalRangeSetIamPolicyCall<'a, C>
17591where
17592 C: 'a,
17593{
17594 hub: &'a Networkconnectivity<C>,
17595 _request: SetIamPolicyRequest,
17596 _resource: String,
17597 _delegate: Option<&'a mut dyn common::Delegate>,
17598 _additional_params: HashMap<String, String>,
17599 _scopes: BTreeSet<String>,
17600}
17601
17602impl<'a, C> common::CallBuilder for ProjectLocationInternalRangeSetIamPolicyCall<'a, C> {}
17603
17604impl<'a, C> ProjectLocationInternalRangeSetIamPolicyCall<'a, C>
17605where
17606 C: common::Connector,
17607{
17608 /// Perform the operation you have build so far.
17609 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
17610 use std::borrow::Cow;
17611 use std::io::{Read, Seek};
17612
17613 use common::{url::Params, ToParts};
17614 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17615
17616 let mut dd = common::DefaultDelegate;
17617 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17618 dlg.begin(common::MethodInfo {
17619 id: "networkconnectivity.projects.locations.internalRanges.setIamPolicy",
17620 http_method: hyper::Method::POST,
17621 });
17622
17623 for &field in ["alt", "resource"].iter() {
17624 if self._additional_params.contains_key(field) {
17625 dlg.finished(false);
17626 return Err(common::Error::FieldClash(field));
17627 }
17628 }
17629
17630 let mut params = Params::with_capacity(4 + self._additional_params.len());
17631 params.push("resource", self._resource);
17632
17633 params.extend(self._additional_params.iter());
17634
17635 params.push("alt", "json");
17636 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
17637 if self._scopes.is_empty() {
17638 self._scopes
17639 .insert(Scope::CloudPlatform.as_ref().to_string());
17640 }
17641
17642 #[allow(clippy::single_element_loop)]
17643 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17644 url = params.uri_replacement(url, param_name, find_this, true);
17645 }
17646 {
17647 let to_remove = ["resource"];
17648 params.remove_params(&to_remove);
17649 }
17650
17651 let url = params.parse_with_url(&url);
17652
17653 let mut json_mime_type = mime::APPLICATION_JSON;
17654 let mut request_value_reader = {
17655 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17656 common::remove_json_null_values(&mut value);
17657 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17658 serde_json::to_writer(&mut dst, &value).unwrap();
17659 dst
17660 };
17661 let request_size = request_value_reader
17662 .seek(std::io::SeekFrom::End(0))
17663 .unwrap();
17664 request_value_reader
17665 .seek(std::io::SeekFrom::Start(0))
17666 .unwrap();
17667
17668 loop {
17669 let token = match self
17670 .hub
17671 .auth
17672 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17673 .await
17674 {
17675 Ok(token) => token,
17676 Err(e) => match dlg.token(e) {
17677 Ok(token) => token,
17678 Err(e) => {
17679 dlg.finished(false);
17680 return Err(common::Error::MissingToken(e));
17681 }
17682 },
17683 };
17684 request_value_reader
17685 .seek(std::io::SeekFrom::Start(0))
17686 .unwrap();
17687 let mut req_result = {
17688 let client = &self.hub.client;
17689 dlg.pre_request();
17690 let mut req_builder = hyper::Request::builder()
17691 .method(hyper::Method::POST)
17692 .uri(url.as_str())
17693 .header(USER_AGENT, self.hub._user_agent.clone());
17694
17695 if let Some(token) = token.as_ref() {
17696 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17697 }
17698
17699 let request = req_builder
17700 .header(CONTENT_TYPE, json_mime_type.to_string())
17701 .header(CONTENT_LENGTH, request_size as u64)
17702 .body(common::to_body(
17703 request_value_reader.get_ref().clone().into(),
17704 ));
17705
17706 client.request(request.unwrap()).await
17707 };
17708
17709 match req_result {
17710 Err(err) => {
17711 if let common::Retry::After(d) = dlg.http_error(&err) {
17712 sleep(d).await;
17713 continue;
17714 }
17715 dlg.finished(false);
17716 return Err(common::Error::HttpError(err));
17717 }
17718 Ok(res) => {
17719 let (mut parts, body) = res.into_parts();
17720 let mut body = common::Body::new(body);
17721 if !parts.status.is_success() {
17722 let bytes = common::to_bytes(body).await.unwrap_or_default();
17723 let error = serde_json::from_str(&common::to_string(&bytes));
17724 let response = common::to_response(parts, bytes.into());
17725
17726 if let common::Retry::After(d) =
17727 dlg.http_failure(&response, error.as_ref().ok())
17728 {
17729 sleep(d).await;
17730 continue;
17731 }
17732
17733 dlg.finished(false);
17734
17735 return Err(match error {
17736 Ok(value) => common::Error::BadRequest(value),
17737 _ => common::Error::Failure(response),
17738 });
17739 }
17740 let response = {
17741 let bytes = common::to_bytes(body).await.unwrap_or_default();
17742 let encoded = common::to_string(&bytes);
17743 match serde_json::from_str(&encoded) {
17744 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17745 Err(error) => {
17746 dlg.response_json_decode_error(&encoded, &error);
17747 return Err(common::Error::JsonDecodeError(
17748 encoded.to_string(),
17749 error,
17750 ));
17751 }
17752 }
17753 };
17754
17755 dlg.finished(true);
17756 return Ok(response);
17757 }
17758 }
17759 }
17760 }
17761
17762 ///
17763 /// Sets the *request* property to the given value.
17764 ///
17765 /// Even though the property as already been set when instantiating this call,
17766 /// we provide this method for API completeness.
17767 pub fn request(
17768 mut self,
17769 new_value: SetIamPolicyRequest,
17770 ) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C> {
17771 self._request = new_value;
17772 self
17773 }
17774 /// 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.
17775 ///
17776 /// Sets the *resource* path property to the given value.
17777 ///
17778 /// Even though the property as already been set when instantiating this call,
17779 /// we provide this method for API completeness.
17780 pub fn resource(
17781 mut self,
17782 new_value: &str,
17783 ) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C> {
17784 self._resource = new_value.to_string();
17785 self
17786 }
17787 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17788 /// while executing the actual API request.
17789 ///
17790 /// ````text
17791 /// It should be used to handle progress information, and to implement a certain level of resilience.
17792 /// ````
17793 ///
17794 /// Sets the *delegate* property to the given value.
17795 pub fn delegate(
17796 mut self,
17797 new_value: &'a mut dyn common::Delegate,
17798 ) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C> {
17799 self._delegate = Some(new_value);
17800 self
17801 }
17802
17803 /// Set any additional parameter of the query string used in the request.
17804 /// It should be used to set parameters which are not yet available through their own
17805 /// setters.
17806 ///
17807 /// Please note that this method must not be used to set any of the known parameters
17808 /// which have their own setter method. If done anyway, the request will fail.
17809 ///
17810 /// # Additional Parameters
17811 ///
17812 /// * *$.xgafv* (query-string) - V1 error format.
17813 /// * *access_token* (query-string) - OAuth access token.
17814 /// * *alt* (query-string) - Data format for response.
17815 /// * *callback* (query-string) - JSONP
17816 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17817 /// * *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.
17818 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17819 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17820 /// * *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.
17821 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17822 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17823 pub fn param<T>(
17824 mut self,
17825 name: T,
17826 value: T,
17827 ) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C>
17828 where
17829 T: AsRef<str>,
17830 {
17831 self._additional_params
17832 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17833 self
17834 }
17835
17836 /// Identifies the authorization scope for the method you are building.
17837 ///
17838 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17839 /// [`Scope::CloudPlatform`].
17840 ///
17841 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17842 /// tokens for more than one scope.
17843 ///
17844 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17845 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17846 /// sufficient, a read-write scope will do as well.
17847 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C>
17848 where
17849 St: AsRef<str>,
17850 {
17851 self._scopes.insert(String::from(scope.as_ref()));
17852 self
17853 }
17854 /// Identifies the authorization scope(s) for the method you are building.
17855 ///
17856 /// See [`Self::add_scope()`] for details.
17857 pub fn add_scopes<I, St>(
17858 mut self,
17859 scopes: I,
17860 ) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C>
17861 where
17862 I: IntoIterator<Item = St>,
17863 St: AsRef<str>,
17864 {
17865 self._scopes
17866 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17867 self
17868 }
17869
17870 /// Removes all scopes, and no default scope will be used either.
17871 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17872 /// for details).
17873 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangeSetIamPolicyCall<'a, C> {
17874 self._scopes.clear();
17875 self
17876 }
17877}
17878
17879/// 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.
17880///
17881/// A builder for the *locations.internalRanges.testIamPermissions* method supported by a *project* resource.
17882/// It is not used directly, but through a [`ProjectMethods`] instance.
17883///
17884/// # Example
17885///
17886/// Instantiate a resource method builder
17887///
17888/// ```test_harness,no_run
17889/// # extern crate hyper;
17890/// # extern crate hyper_rustls;
17891/// # extern crate google_networkconnectivity1 as networkconnectivity1;
17892/// use networkconnectivity1::api::TestIamPermissionsRequest;
17893/// # async fn dox() {
17894/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17895///
17896/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17897/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17898/// # .with_native_roots()
17899/// # .unwrap()
17900/// # .https_only()
17901/// # .enable_http2()
17902/// # .build();
17903///
17904/// # let executor = hyper_util::rt::TokioExecutor::new();
17905/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17906/// # secret,
17907/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17908/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17909/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17910/// # ),
17911/// # ).build().await.unwrap();
17912///
17913/// # let client = hyper_util::client::legacy::Client::builder(
17914/// # hyper_util::rt::TokioExecutor::new()
17915/// # )
17916/// # .build(
17917/// # hyper_rustls::HttpsConnectorBuilder::new()
17918/// # .with_native_roots()
17919/// # .unwrap()
17920/// # .https_or_http()
17921/// # .enable_http2()
17922/// # .build()
17923/// # );
17924/// # let mut hub = Networkconnectivity::new(client, auth);
17925/// // As the method needs a request, you would usually fill it with the desired information
17926/// // into the respective structure. Some of the parts shown here might not be applicable !
17927/// // Values shown here are possibly random and not representative !
17928/// let mut req = TestIamPermissionsRequest::default();
17929///
17930/// // You can configure optional parameters by calling the respective setters at will, and
17931/// // execute the final call using `doit()`.
17932/// // Values shown here are possibly random and not representative !
17933/// let result = hub.projects().locations_internal_ranges_test_iam_permissions(req, "resource")
17934/// .doit().await;
17935/// # }
17936/// ```
17937pub struct ProjectLocationInternalRangeTestIamPermissionCall<'a, C>
17938where
17939 C: 'a,
17940{
17941 hub: &'a Networkconnectivity<C>,
17942 _request: TestIamPermissionsRequest,
17943 _resource: String,
17944 _delegate: Option<&'a mut dyn common::Delegate>,
17945 _additional_params: HashMap<String, String>,
17946 _scopes: BTreeSet<String>,
17947}
17948
17949impl<'a, C> common::CallBuilder for ProjectLocationInternalRangeTestIamPermissionCall<'a, C> {}
17950
17951impl<'a, C> ProjectLocationInternalRangeTestIamPermissionCall<'a, C>
17952where
17953 C: common::Connector,
17954{
17955 /// Perform the operation you have build so far.
17956 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
17957 use std::borrow::Cow;
17958 use std::io::{Read, Seek};
17959
17960 use common::{url::Params, ToParts};
17961 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17962
17963 let mut dd = common::DefaultDelegate;
17964 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17965 dlg.begin(common::MethodInfo {
17966 id: "networkconnectivity.projects.locations.internalRanges.testIamPermissions",
17967 http_method: hyper::Method::POST,
17968 });
17969
17970 for &field in ["alt", "resource"].iter() {
17971 if self._additional_params.contains_key(field) {
17972 dlg.finished(false);
17973 return Err(common::Error::FieldClash(field));
17974 }
17975 }
17976
17977 let mut params = Params::with_capacity(4 + self._additional_params.len());
17978 params.push("resource", self._resource);
17979
17980 params.extend(self._additional_params.iter());
17981
17982 params.push("alt", "json");
17983 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
17984 if self._scopes.is_empty() {
17985 self._scopes
17986 .insert(Scope::CloudPlatform.as_ref().to_string());
17987 }
17988
17989 #[allow(clippy::single_element_loop)]
17990 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17991 url = params.uri_replacement(url, param_name, find_this, true);
17992 }
17993 {
17994 let to_remove = ["resource"];
17995 params.remove_params(&to_remove);
17996 }
17997
17998 let url = params.parse_with_url(&url);
17999
18000 let mut json_mime_type = mime::APPLICATION_JSON;
18001 let mut request_value_reader = {
18002 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18003 common::remove_json_null_values(&mut value);
18004 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18005 serde_json::to_writer(&mut dst, &value).unwrap();
18006 dst
18007 };
18008 let request_size = request_value_reader
18009 .seek(std::io::SeekFrom::End(0))
18010 .unwrap();
18011 request_value_reader
18012 .seek(std::io::SeekFrom::Start(0))
18013 .unwrap();
18014
18015 loop {
18016 let token = match self
18017 .hub
18018 .auth
18019 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18020 .await
18021 {
18022 Ok(token) => token,
18023 Err(e) => match dlg.token(e) {
18024 Ok(token) => token,
18025 Err(e) => {
18026 dlg.finished(false);
18027 return Err(common::Error::MissingToken(e));
18028 }
18029 },
18030 };
18031 request_value_reader
18032 .seek(std::io::SeekFrom::Start(0))
18033 .unwrap();
18034 let mut req_result = {
18035 let client = &self.hub.client;
18036 dlg.pre_request();
18037 let mut req_builder = hyper::Request::builder()
18038 .method(hyper::Method::POST)
18039 .uri(url.as_str())
18040 .header(USER_AGENT, self.hub._user_agent.clone());
18041
18042 if let Some(token) = token.as_ref() {
18043 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18044 }
18045
18046 let request = req_builder
18047 .header(CONTENT_TYPE, json_mime_type.to_string())
18048 .header(CONTENT_LENGTH, request_size as u64)
18049 .body(common::to_body(
18050 request_value_reader.get_ref().clone().into(),
18051 ));
18052
18053 client.request(request.unwrap()).await
18054 };
18055
18056 match req_result {
18057 Err(err) => {
18058 if let common::Retry::After(d) = dlg.http_error(&err) {
18059 sleep(d).await;
18060 continue;
18061 }
18062 dlg.finished(false);
18063 return Err(common::Error::HttpError(err));
18064 }
18065 Ok(res) => {
18066 let (mut parts, body) = res.into_parts();
18067 let mut body = common::Body::new(body);
18068 if !parts.status.is_success() {
18069 let bytes = common::to_bytes(body).await.unwrap_or_default();
18070 let error = serde_json::from_str(&common::to_string(&bytes));
18071 let response = common::to_response(parts, bytes.into());
18072
18073 if let common::Retry::After(d) =
18074 dlg.http_failure(&response, error.as_ref().ok())
18075 {
18076 sleep(d).await;
18077 continue;
18078 }
18079
18080 dlg.finished(false);
18081
18082 return Err(match error {
18083 Ok(value) => common::Error::BadRequest(value),
18084 _ => common::Error::Failure(response),
18085 });
18086 }
18087 let response = {
18088 let bytes = common::to_bytes(body).await.unwrap_or_default();
18089 let encoded = common::to_string(&bytes);
18090 match serde_json::from_str(&encoded) {
18091 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18092 Err(error) => {
18093 dlg.response_json_decode_error(&encoded, &error);
18094 return Err(common::Error::JsonDecodeError(
18095 encoded.to_string(),
18096 error,
18097 ));
18098 }
18099 }
18100 };
18101
18102 dlg.finished(true);
18103 return Ok(response);
18104 }
18105 }
18106 }
18107 }
18108
18109 ///
18110 /// Sets the *request* property to the given value.
18111 ///
18112 /// Even though the property as already been set when instantiating this call,
18113 /// we provide this method for API completeness.
18114 pub fn request(
18115 mut self,
18116 new_value: TestIamPermissionsRequest,
18117 ) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C> {
18118 self._request = new_value;
18119 self
18120 }
18121 /// 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.
18122 ///
18123 /// Sets the *resource* path property to the given value.
18124 ///
18125 /// Even though the property as already been set when instantiating this call,
18126 /// we provide this method for API completeness.
18127 pub fn resource(
18128 mut self,
18129 new_value: &str,
18130 ) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C> {
18131 self._resource = new_value.to_string();
18132 self
18133 }
18134 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18135 /// while executing the actual API request.
18136 ///
18137 /// ````text
18138 /// It should be used to handle progress information, and to implement a certain level of resilience.
18139 /// ````
18140 ///
18141 /// Sets the *delegate* property to the given value.
18142 pub fn delegate(
18143 mut self,
18144 new_value: &'a mut dyn common::Delegate,
18145 ) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C> {
18146 self._delegate = Some(new_value);
18147 self
18148 }
18149
18150 /// Set any additional parameter of the query string used in the request.
18151 /// It should be used to set parameters which are not yet available through their own
18152 /// setters.
18153 ///
18154 /// Please note that this method must not be used to set any of the known parameters
18155 /// which have their own setter method. If done anyway, the request will fail.
18156 ///
18157 /// # Additional Parameters
18158 ///
18159 /// * *$.xgafv* (query-string) - V1 error format.
18160 /// * *access_token* (query-string) - OAuth access token.
18161 /// * *alt* (query-string) - Data format for response.
18162 /// * *callback* (query-string) - JSONP
18163 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18164 /// * *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.
18165 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18166 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18167 /// * *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.
18168 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18169 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18170 pub fn param<T>(
18171 mut self,
18172 name: T,
18173 value: T,
18174 ) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C>
18175 where
18176 T: AsRef<str>,
18177 {
18178 self._additional_params
18179 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18180 self
18181 }
18182
18183 /// Identifies the authorization scope for the method you are building.
18184 ///
18185 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18186 /// [`Scope::CloudPlatform`].
18187 ///
18188 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18189 /// tokens for more than one scope.
18190 ///
18191 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18192 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18193 /// sufficient, a read-write scope will do as well.
18194 pub fn add_scope<St>(
18195 mut self,
18196 scope: St,
18197 ) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C>
18198 where
18199 St: AsRef<str>,
18200 {
18201 self._scopes.insert(String::from(scope.as_ref()));
18202 self
18203 }
18204 /// Identifies the authorization scope(s) for the method you are building.
18205 ///
18206 /// See [`Self::add_scope()`] for details.
18207 pub fn add_scopes<I, St>(
18208 mut self,
18209 scopes: I,
18210 ) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C>
18211 where
18212 I: IntoIterator<Item = St>,
18213 St: AsRef<str>,
18214 {
18215 self._scopes
18216 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18217 self
18218 }
18219
18220 /// Removes all scopes, and no default scope will be used either.
18221 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18222 /// for details).
18223 pub fn clear_scopes(mut self) -> ProjectLocationInternalRangeTestIamPermissionCall<'a, C> {
18224 self._scopes.clear();
18225 self
18226 }
18227}
18228
18229/// Creates a `Destination` resource in a specified project and location.
18230///
18231/// A builder for the *locations.multicloudDataTransferConfigs.destinations.create* method supported by a *project* resource.
18232/// It is not used directly, but through a [`ProjectMethods`] instance.
18233///
18234/// # Example
18235///
18236/// Instantiate a resource method builder
18237///
18238/// ```test_harness,no_run
18239/// # extern crate hyper;
18240/// # extern crate hyper_rustls;
18241/// # extern crate google_networkconnectivity1 as networkconnectivity1;
18242/// use networkconnectivity1::api::Destination;
18243/// # async fn dox() {
18244/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18245///
18246/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18247/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18248/// # .with_native_roots()
18249/// # .unwrap()
18250/// # .https_only()
18251/// # .enable_http2()
18252/// # .build();
18253///
18254/// # let executor = hyper_util::rt::TokioExecutor::new();
18255/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18256/// # secret,
18257/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18258/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18259/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18260/// # ),
18261/// # ).build().await.unwrap();
18262///
18263/// # let client = hyper_util::client::legacy::Client::builder(
18264/// # hyper_util::rt::TokioExecutor::new()
18265/// # )
18266/// # .build(
18267/// # hyper_rustls::HttpsConnectorBuilder::new()
18268/// # .with_native_roots()
18269/// # .unwrap()
18270/// # .https_or_http()
18271/// # .enable_http2()
18272/// # .build()
18273/// # );
18274/// # let mut hub = Networkconnectivity::new(client, auth);
18275/// // As the method needs a request, you would usually fill it with the desired information
18276/// // into the respective structure. Some of the parts shown here might not be applicable !
18277/// // Values shown here are possibly random and not representative !
18278/// let mut req = Destination::default();
18279///
18280/// // You can configure optional parameters by calling the respective setters at will, and
18281/// // execute the final call using `doit()`.
18282/// // Values shown here are possibly random and not representative !
18283/// let result = hub.projects().locations_multicloud_data_transfer_configs_destinations_create(req, "parent")
18284/// .request_id("sed")
18285/// .destination_id("diam")
18286/// .doit().await;
18287/// # }
18288/// ```
18289pub struct ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C>
18290where
18291 C: 'a,
18292{
18293 hub: &'a Networkconnectivity<C>,
18294 _request: Destination,
18295 _parent: String,
18296 _request_id: Option<String>,
18297 _destination_id: Option<String>,
18298 _delegate: Option<&'a mut dyn common::Delegate>,
18299 _additional_params: HashMap<String, String>,
18300 _scopes: BTreeSet<String>,
18301}
18302
18303impl<'a, C> common::CallBuilder
18304 for ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C>
18305{
18306}
18307
18308impl<'a, C> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C>
18309where
18310 C: common::Connector,
18311{
18312 /// Perform the operation you have build so far.
18313 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
18314 use std::borrow::Cow;
18315 use std::io::{Read, Seek};
18316
18317 use common::{url::Params, ToParts};
18318 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18319
18320 let mut dd = common::DefaultDelegate;
18321 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18322 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.destinations.create",
18323 http_method: hyper::Method::POST });
18324
18325 for &field in ["alt", "parent", "requestId", "destinationId"].iter() {
18326 if self._additional_params.contains_key(field) {
18327 dlg.finished(false);
18328 return Err(common::Error::FieldClash(field));
18329 }
18330 }
18331
18332 let mut params = Params::with_capacity(6 + self._additional_params.len());
18333 params.push("parent", self._parent);
18334 if let Some(value) = self._request_id.as_ref() {
18335 params.push("requestId", value);
18336 }
18337 if let Some(value) = self._destination_id.as_ref() {
18338 params.push("destinationId", value);
18339 }
18340
18341 params.extend(self._additional_params.iter());
18342
18343 params.push("alt", "json");
18344 let mut url = self.hub._base_url.clone() + "v1/{+parent}/destinations";
18345 if self._scopes.is_empty() {
18346 self._scopes
18347 .insert(Scope::CloudPlatform.as_ref().to_string());
18348 }
18349
18350 #[allow(clippy::single_element_loop)]
18351 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18352 url = params.uri_replacement(url, param_name, find_this, true);
18353 }
18354 {
18355 let to_remove = ["parent"];
18356 params.remove_params(&to_remove);
18357 }
18358
18359 let url = params.parse_with_url(&url);
18360
18361 let mut json_mime_type = mime::APPLICATION_JSON;
18362 let mut request_value_reader = {
18363 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18364 common::remove_json_null_values(&mut value);
18365 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18366 serde_json::to_writer(&mut dst, &value).unwrap();
18367 dst
18368 };
18369 let request_size = request_value_reader
18370 .seek(std::io::SeekFrom::End(0))
18371 .unwrap();
18372 request_value_reader
18373 .seek(std::io::SeekFrom::Start(0))
18374 .unwrap();
18375
18376 loop {
18377 let token = match self
18378 .hub
18379 .auth
18380 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18381 .await
18382 {
18383 Ok(token) => token,
18384 Err(e) => match dlg.token(e) {
18385 Ok(token) => token,
18386 Err(e) => {
18387 dlg.finished(false);
18388 return Err(common::Error::MissingToken(e));
18389 }
18390 },
18391 };
18392 request_value_reader
18393 .seek(std::io::SeekFrom::Start(0))
18394 .unwrap();
18395 let mut req_result = {
18396 let client = &self.hub.client;
18397 dlg.pre_request();
18398 let mut req_builder = hyper::Request::builder()
18399 .method(hyper::Method::POST)
18400 .uri(url.as_str())
18401 .header(USER_AGENT, self.hub._user_agent.clone());
18402
18403 if let Some(token) = token.as_ref() {
18404 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18405 }
18406
18407 let request = req_builder
18408 .header(CONTENT_TYPE, json_mime_type.to_string())
18409 .header(CONTENT_LENGTH, request_size as u64)
18410 .body(common::to_body(
18411 request_value_reader.get_ref().clone().into(),
18412 ));
18413
18414 client.request(request.unwrap()).await
18415 };
18416
18417 match req_result {
18418 Err(err) => {
18419 if let common::Retry::After(d) = dlg.http_error(&err) {
18420 sleep(d).await;
18421 continue;
18422 }
18423 dlg.finished(false);
18424 return Err(common::Error::HttpError(err));
18425 }
18426 Ok(res) => {
18427 let (mut parts, body) = res.into_parts();
18428 let mut body = common::Body::new(body);
18429 if !parts.status.is_success() {
18430 let bytes = common::to_bytes(body).await.unwrap_or_default();
18431 let error = serde_json::from_str(&common::to_string(&bytes));
18432 let response = common::to_response(parts, bytes.into());
18433
18434 if let common::Retry::After(d) =
18435 dlg.http_failure(&response, error.as_ref().ok())
18436 {
18437 sleep(d).await;
18438 continue;
18439 }
18440
18441 dlg.finished(false);
18442
18443 return Err(match error {
18444 Ok(value) => common::Error::BadRequest(value),
18445 _ => common::Error::Failure(response),
18446 });
18447 }
18448 let response = {
18449 let bytes = common::to_bytes(body).await.unwrap_or_default();
18450 let encoded = common::to_string(&bytes);
18451 match serde_json::from_str(&encoded) {
18452 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18453 Err(error) => {
18454 dlg.response_json_decode_error(&encoded, &error);
18455 return Err(common::Error::JsonDecodeError(
18456 encoded.to_string(),
18457 error,
18458 ));
18459 }
18460 }
18461 };
18462
18463 dlg.finished(true);
18464 return Ok(response);
18465 }
18466 }
18467 }
18468 }
18469
18470 ///
18471 /// Sets the *request* property to the given value.
18472 ///
18473 /// Even though the property as already been set when instantiating this call,
18474 /// we provide this method for API completeness.
18475 pub fn request(
18476 mut self,
18477 new_value: Destination,
18478 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C> {
18479 self._request = new_value;
18480 self
18481 }
18482 /// Required. The name of the parent resource.
18483 ///
18484 /// Sets the *parent* path property to the given value.
18485 ///
18486 /// Even though the property as already been set when instantiating this call,
18487 /// we provide this method for API completeness.
18488 pub fn parent(
18489 mut self,
18490 new_value: &str,
18491 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C> {
18492 self._parent = new_value.to_string();
18493 self
18494 }
18495 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server can ignore the request if it has already been completed. The server waits for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, can ignore the second request. This prevents clients from accidentally creating duplicate `Destination` resources. The request ID must be a valid UUID with the exception that zero UUID (00000000-0000-0000-0000-000000000000) isn't supported.
18496 ///
18497 /// Sets the *request id* query property to the given value.
18498 pub fn request_id(
18499 mut self,
18500 new_value: &str,
18501 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C> {
18502 self._request_id = Some(new_value.to_string());
18503 self
18504 }
18505 /// Required. The ID to use for the `Destination` resource, which becomes the final component of the `Destination` resource name.
18506 ///
18507 /// Sets the *destination id* query property to the given value.
18508 pub fn destination_id(
18509 mut self,
18510 new_value: &str,
18511 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C> {
18512 self._destination_id = Some(new_value.to_string());
18513 self
18514 }
18515 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18516 /// while executing the actual API request.
18517 ///
18518 /// ````text
18519 /// It should be used to handle progress information, and to implement a certain level of resilience.
18520 /// ````
18521 ///
18522 /// Sets the *delegate* property to the given value.
18523 pub fn delegate(
18524 mut self,
18525 new_value: &'a mut dyn common::Delegate,
18526 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C> {
18527 self._delegate = Some(new_value);
18528 self
18529 }
18530
18531 /// Set any additional parameter of the query string used in the request.
18532 /// It should be used to set parameters which are not yet available through their own
18533 /// setters.
18534 ///
18535 /// Please note that this method must not be used to set any of the known parameters
18536 /// which have their own setter method. If done anyway, the request will fail.
18537 ///
18538 /// # Additional Parameters
18539 ///
18540 /// * *$.xgafv* (query-string) - V1 error format.
18541 /// * *access_token* (query-string) - OAuth access token.
18542 /// * *alt* (query-string) - Data format for response.
18543 /// * *callback* (query-string) - JSONP
18544 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18545 /// * *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.
18546 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18547 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18548 /// * *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.
18549 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18550 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18551 pub fn param<T>(
18552 mut self,
18553 name: T,
18554 value: T,
18555 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C>
18556 where
18557 T: AsRef<str>,
18558 {
18559 self._additional_params
18560 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18561 self
18562 }
18563
18564 /// Identifies the authorization scope for the method you are building.
18565 ///
18566 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18567 /// [`Scope::CloudPlatform`].
18568 ///
18569 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18570 /// tokens for more than one scope.
18571 ///
18572 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18573 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18574 /// sufficient, a read-write scope will do as well.
18575 pub fn add_scope<St>(
18576 mut self,
18577 scope: St,
18578 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C>
18579 where
18580 St: AsRef<str>,
18581 {
18582 self._scopes.insert(String::from(scope.as_ref()));
18583 self
18584 }
18585 /// Identifies the authorization scope(s) for the method you are building.
18586 ///
18587 /// See [`Self::add_scope()`] for details.
18588 pub fn add_scopes<I, St>(
18589 mut self,
18590 scopes: I,
18591 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C>
18592 where
18593 I: IntoIterator<Item = St>,
18594 St: AsRef<str>,
18595 {
18596 self._scopes
18597 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18598 self
18599 }
18600
18601 /// Removes all scopes, and no default scope will be used either.
18602 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18603 /// for details).
18604 pub fn clear_scopes(
18605 mut self,
18606 ) -> ProjectLocationMulticloudDataTransferConfigDestinationCreateCall<'a, C> {
18607 self._scopes.clear();
18608 self
18609 }
18610}
18611
18612/// Deletes a `Destination` resource.
18613///
18614/// A builder for the *locations.multicloudDataTransferConfigs.destinations.delete* method supported by a *project* resource.
18615/// It is not used directly, but through a [`ProjectMethods`] instance.
18616///
18617/// # Example
18618///
18619/// Instantiate a resource method builder
18620///
18621/// ```test_harness,no_run
18622/// # extern crate hyper;
18623/// # extern crate hyper_rustls;
18624/// # extern crate google_networkconnectivity1 as networkconnectivity1;
18625/// # async fn dox() {
18626/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18627///
18628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18629/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18630/// # .with_native_roots()
18631/// # .unwrap()
18632/// # .https_only()
18633/// # .enable_http2()
18634/// # .build();
18635///
18636/// # let executor = hyper_util::rt::TokioExecutor::new();
18637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18638/// # secret,
18639/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18640/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18641/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18642/// # ),
18643/// # ).build().await.unwrap();
18644///
18645/// # let client = hyper_util::client::legacy::Client::builder(
18646/// # hyper_util::rt::TokioExecutor::new()
18647/// # )
18648/// # .build(
18649/// # hyper_rustls::HttpsConnectorBuilder::new()
18650/// # .with_native_roots()
18651/// # .unwrap()
18652/// # .https_or_http()
18653/// # .enable_http2()
18654/// # .build()
18655/// # );
18656/// # let mut hub = Networkconnectivity::new(client, auth);
18657/// // You can configure optional parameters by calling the respective setters at will, and
18658/// // execute the final call using `doit()`.
18659/// // Values shown here are possibly random and not representative !
18660/// let result = hub.projects().locations_multicloud_data_transfer_configs_destinations_delete("name")
18661/// .request_id("dolores")
18662/// .etag("et")
18663/// .doit().await;
18664/// # }
18665/// ```
18666pub struct ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C>
18667where
18668 C: 'a,
18669{
18670 hub: &'a Networkconnectivity<C>,
18671 _name: String,
18672 _request_id: Option<String>,
18673 _etag: Option<String>,
18674 _delegate: Option<&'a mut dyn common::Delegate>,
18675 _additional_params: HashMap<String, String>,
18676 _scopes: BTreeSet<String>,
18677}
18678
18679impl<'a, C> common::CallBuilder
18680 for ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C>
18681{
18682}
18683
18684impl<'a, C> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C>
18685where
18686 C: common::Connector,
18687{
18688 /// Perform the operation you have build so far.
18689 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
18690 use std::borrow::Cow;
18691 use std::io::{Read, Seek};
18692
18693 use common::{url::Params, ToParts};
18694 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18695
18696 let mut dd = common::DefaultDelegate;
18697 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18698 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.destinations.delete",
18699 http_method: hyper::Method::DELETE });
18700
18701 for &field in ["alt", "name", "requestId", "etag"].iter() {
18702 if self._additional_params.contains_key(field) {
18703 dlg.finished(false);
18704 return Err(common::Error::FieldClash(field));
18705 }
18706 }
18707
18708 let mut params = Params::with_capacity(5 + self._additional_params.len());
18709 params.push("name", self._name);
18710 if let Some(value) = self._request_id.as_ref() {
18711 params.push("requestId", value);
18712 }
18713 if let Some(value) = self._etag.as_ref() {
18714 params.push("etag", value);
18715 }
18716
18717 params.extend(self._additional_params.iter());
18718
18719 params.push("alt", "json");
18720 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18721 if self._scopes.is_empty() {
18722 self._scopes
18723 .insert(Scope::CloudPlatform.as_ref().to_string());
18724 }
18725
18726 #[allow(clippy::single_element_loop)]
18727 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18728 url = params.uri_replacement(url, param_name, find_this, true);
18729 }
18730 {
18731 let to_remove = ["name"];
18732 params.remove_params(&to_remove);
18733 }
18734
18735 let url = params.parse_with_url(&url);
18736
18737 loop {
18738 let token = match self
18739 .hub
18740 .auth
18741 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18742 .await
18743 {
18744 Ok(token) => token,
18745 Err(e) => match dlg.token(e) {
18746 Ok(token) => token,
18747 Err(e) => {
18748 dlg.finished(false);
18749 return Err(common::Error::MissingToken(e));
18750 }
18751 },
18752 };
18753 let mut req_result = {
18754 let client = &self.hub.client;
18755 dlg.pre_request();
18756 let mut req_builder = hyper::Request::builder()
18757 .method(hyper::Method::DELETE)
18758 .uri(url.as_str())
18759 .header(USER_AGENT, self.hub._user_agent.clone());
18760
18761 if let Some(token) = token.as_ref() {
18762 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18763 }
18764
18765 let request = req_builder
18766 .header(CONTENT_LENGTH, 0_u64)
18767 .body(common::to_body::<String>(None));
18768
18769 client.request(request.unwrap()).await
18770 };
18771
18772 match req_result {
18773 Err(err) => {
18774 if let common::Retry::After(d) = dlg.http_error(&err) {
18775 sleep(d).await;
18776 continue;
18777 }
18778 dlg.finished(false);
18779 return Err(common::Error::HttpError(err));
18780 }
18781 Ok(res) => {
18782 let (mut parts, body) = res.into_parts();
18783 let mut body = common::Body::new(body);
18784 if !parts.status.is_success() {
18785 let bytes = common::to_bytes(body).await.unwrap_or_default();
18786 let error = serde_json::from_str(&common::to_string(&bytes));
18787 let response = common::to_response(parts, bytes.into());
18788
18789 if let common::Retry::After(d) =
18790 dlg.http_failure(&response, error.as_ref().ok())
18791 {
18792 sleep(d).await;
18793 continue;
18794 }
18795
18796 dlg.finished(false);
18797
18798 return Err(match error {
18799 Ok(value) => common::Error::BadRequest(value),
18800 _ => common::Error::Failure(response),
18801 });
18802 }
18803 let response = {
18804 let bytes = common::to_bytes(body).await.unwrap_or_default();
18805 let encoded = common::to_string(&bytes);
18806 match serde_json::from_str(&encoded) {
18807 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18808 Err(error) => {
18809 dlg.response_json_decode_error(&encoded, &error);
18810 return Err(common::Error::JsonDecodeError(
18811 encoded.to_string(),
18812 error,
18813 ));
18814 }
18815 }
18816 };
18817
18818 dlg.finished(true);
18819 return Ok(response);
18820 }
18821 }
18822 }
18823 }
18824
18825 /// Required. The name of the `Destination` resource to delete.
18826 ///
18827 /// Sets the *name* path property to the given value.
18828 ///
18829 /// Even though the property as already been set when instantiating this call,
18830 /// we provide this method for API completeness.
18831 pub fn name(
18832 mut self,
18833 new_value: &str,
18834 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C> {
18835 self._name = new_value.to_string();
18836 self
18837 }
18838 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server can ignore the request if it has already been completed. The server waits for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, can ignore the second request. The request ID must be a valid UUID with the exception that zero UUID (00000000-0000-0000-0000-000000000000) isn't supported.
18839 ///
18840 /// Sets the *request id* query property to the given value.
18841 pub fn request_id(
18842 mut self,
18843 new_value: &str,
18844 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C> {
18845 self._request_id = Some(new_value.to_string());
18846 self
18847 }
18848 /// Optional. The etag is computed by the server, and might be sent with update and delete requests so that the client has an up-to-date value before proceeding.
18849 ///
18850 /// Sets the *etag* query property to the given value.
18851 pub fn etag(
18852 mut self,
18853 new_value: &str,
18854 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C> {
18855 self._etag = Some(new_value.to_string());
18856 self
18857 }
18858 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18859 /// while executing the actual API request.
18860 ///
18861 /// ````text
18862 /// It should be used to handle progress information, and to implement a certain level of resilience.
18863 /// ````
18864 ///
18865 /// Sets the *delegate* property to the given value.
18866 pub fn delegate(
18867 mut self,
18868 new_value: &'a mut dyn common::Delegate,
18869 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C> {
18870 self._delegate = Some(new_value);
18871 self
18872 }
18873
18874 /// Set any additional parameter of the query string used in the request.
18875 /// It should be used to set parameters which are not yet available through their own
18876 /// setters.
18877 ///
18878 /// Please note that this method must not be used to set any of the known parameters
18879 /// which have their own setter method. If done anyway, the request will fail.
18880 ///
18881 /// # Additional Parameters
18882 ///
18883 /// * *$.xgafv* (query-string) - V1 error format.
18884 /// * *access_token* (query-string) - OAuth access token.
18885 /// * *alt* (query-string) - Data format for response.
18886 /// * *callback* (query-string) - JSONP
18887 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18888 /// * *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.
18889 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18890 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18891 /// * *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.
18892 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18893 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18894 pub fn param<T>(
18895 mut self,
18896 name: T,
18897 value: T,
18898 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C>
18899 where
18900 T: AsRef<str>,
18901 {
18902 self._additional_params
18903 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18904 self
18905 }
18906
18907 /// Identifies the authorization scope for the method you are building.
18908 ///
18909 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18910 /// [`Scope::CloudPlatform`].
18911 ///
18912 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18913 /// tokens for more than one scope.
18914 ///
18915 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18916 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18917 /// sufficient, a read-write scope will do as well.
18918 pub fn add_scope<St>(
18919 mut self,
18920 scope: St,
18921 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C>
18922 where
18923 St: AsRef<str>,
18924 {
18925 self._scopes.insert(String::from(scope.as_ref()));
18926 self
18927 }
18928 /// Identifies the authorization scope(s) for the method you are building.
18929 ///
18930 /// See [`Self::add_scope()`] for details.
18931 pub fn add_scopes<I, St>(
18932 mut self,
18933 scopes: I,
18934 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C>
18935 where
18936 I: IntoIterator<Item = St>,
18937 St: AsRef<str>,
18938 {
18939 self._scopes
18940 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18941 self
18942 }
18943
18944 /// Removes all scopes, and no default scope will be used either.
18945 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18946 /// for details).
18947 pub fn clear_scopes(
18948 mut self,
18949 ) -> ProjectLocationMulticloudDataTransferConfigDestinationDeleteCall<'a, C> {
18950 self._scopes.clear();
18951 self
18952 }
18953}
18954
18955/// Gets the details of a `Destination` resource.
18956///
18957/// A builder for the *locations.multicloudDataTransferConfigs.destinations.get* method supported by a *project* resource.
18958/// It is not used directly, but through a [`ProjectMethods`] instance.
18959///
18960/// # Example
18961///
18962/// Instantiate a resource method builder
18963///
18964/// ```test_harness,no_run
18965/// # extern crate hyper;
18966/// # extern crate hyper_rustls;
18967/// # extern crate google_networkconnectivity1 as networkconnectivity1;
18968/// # async fn dox() {
18969/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18970///
18971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18972/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18973/// # .with_native_roots()
18974/// # .unwrap()
18975/// # .https_only()
18976/// # .enable_http2()
18977/// # .build();
18978///
18979/// # let executor = hyper_util::rt::TokioExecutor::new();
18980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18981/// # secret,
18982/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18983/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18984/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18985/// # ),
18986/// # ).build().await.unwrap();
18987///
18988/// # let client = hyper_util::client::legacy::Client::builder(
18989/// # hyper_util::rt::TokioExecutor::new()
18990/// # )
18991/// # .build(
18992/// # hyper_rustls::HttpsConnectorBuilder::new()
18993/// # .with_native_roots()
18994/// # .unwrap()
18995/// # .https_or_http()
18996/// # .enable_http2()
18997/// # .build()
18998/// # );
18999/// # let mut hub = Networkconnectivity::new(client, auth);
19000/// // You can configure optional parameters by calling the respective setters at will, and
19001/// // execute the final call using `doit()`.
19002/// // Values shown here are possibly random and not representative !
19003/// let result = hub.projects().locations_multicloud_data_transfer_configs_destinations_get("name")
19004/// .doit().await;
19005/// # }
19006/// ```
19007pub struct ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C>
19008where
19009 C: 'a,
19010{
19011 hub: &'a Networkconnectivity<C>,
19012 _name: String,
19013 _delegate: Option<&'a mut dyn common::Delegate>,
19014 _additional_params: HashMap<String, String>,
19015 _scopes: BTreeSet<String>,
19016}
19017
19018impl<'a, C> common::CallBuilder
19019 for ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C>
19020{
19021}
19022
19023impl<'a, C> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C>
19024where
19025 C: common::Connector,
19026{
19027 /// Perform the operation you have build so far.
19028 pub async fn doit(mut self) -> common::Result<(common::Response, Destination)> {
19029 use std::borrow::Cow;
19030 use std::io::{Read, Seek};
19031
19032 use common::{url::Params, ToParts};
19033 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19034
19035 let mut dd = common::DefaultDelegate;
19036 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19037 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.destinations.get",
19038 http_method: hyper::Method::GET });
19039
19040 for &field in ["alt", "name"].iter() {
19041 if self._additional_params.contains_key(field) {
19042 dlg.finished(false);
19043 return Err(common::Error::FieldClash(field));
19044 }
19045 }
19046
19047 let mut params = Params::with_capacity(3 + self._additional_params.len());
19048 params.push("name", self._name);
19049
19050 params.extend(self._additional_params.iter());
19051
19052 params.push("alt", "json");
19053 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19054 if self._scopes.is_empty() {
19055 self._scopes
19056 .insert(Scope::CloudPlatform.as_ref().to_string());
19057 }
19058
19059 #[allow(clippy::single_element_loop)]
19060 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19061 url = params.uri_replacement(url, param_name, find_this, true);
19062 }
19063 {
19064 let to_remove = ["name"];
19065 params.remove_params(&to_remove);
19066 }
19067
19068 let url = params.parse_with_url(&url);
19069
19070 loop {
19071 let token = match self
19072 .hub
19073 .auth
19074 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19075 .await
19076 {
19077 Ok(token) => token,
19078 Err(e) => match dlg.token(e) {
19079 Ok(token) => token,
19080 Err(e) => {
19081 dlg.finished(false);
19082 return Err(common::Error::MissingToken(e));
19083 }
19084 },
19085 };
19086 let mut req_result = {
19087 let client = &self.hub.client;
19088 dlg.pre_request();
19089 let mut req_builder = hyper::Request::builder()
19090 .method(hyper::Method::GET)
19091 .uri(url.as_str())
19092 .header(USER_AGENT, self.hub._user_agent.clone());
19093
19094 if let Some(token) = token.as_ref() {
19095 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19096 }
19097
19098 let request = req_builder
19099 .header(CONTENT_LENGTH, 0_u64)
19100 .body(common::to_body::<String>(None));
19101
19102 client.request(request.unwrap()).await
19103 };
19104
19105 match req_result {
19106 Err(err) => {
19107 if let common::Retry::After(d) = dlg.http_error(&err) {
19108 sleep(d).await;
19109 continue;
19110 }
19111 dlg.finished(false);
19112 return Err(common::Error::HttpError(err));
19113 }
19114 Ok(res) => {
19115 let (mut parts, body) = res.into_parts();
19116 let mut body = common::Body::new(body);
19117 if !parts.status.is_success() {
19118 let bytes = common::to_bytes(body).await.unwrap_or_default();
19119 let error = serde_json::from_str(&common::to_string(&bytes));
19120 let response = common::to_response(parts, bytes.into());
19121
19122 if let common::Retry::After(d) =
19123 dlg.http_failure(&response, error.as_ref().ok())
19124 {
19125 sleep(d).await;
19126 continue;
19127 }
19128
19129 dlg.finished(false);
19130
19131 return Err(match error {
19132 Ok(value) => common::Error::BadRequest(value),
19133 _ => common::Error::Failure(response),
19134 });
19135 }
19136 let response = {
19137 let bytes = common::to_bytes(body).await.unwrap_or_default();
19138 let encoded = common::to_string(&bytes);
19139 match serde_json::from_str(&encoded) {
19140 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19141 Err(error) => {
19142 dlg.response_json_decode_error(&encoded, &error);
19143 return Err(common::Error::JsonDecodeError(
19144 encoded.to_string(),
19145 error,
19146 ));
19147 }
19148 }
19149 };
19150
19151 dlg.finished(true);
19152 return Ok(response);
19153 }
19154 }
19155 }
19156 }
19157
19158 /// Required. The name of the `Destination` resource to get.
19159 ///
19160 /// Sets the *name* path property to the given value.
19161 ///
19162 /// Even though the property as already been set when instantiating this call,
19163 /// we provide this method for API completeness.
19164 pub fn name(
19165 mut self,
19166 new_value: &str,
19167 ) -> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C> {
19168 self._name = new_value.to_string();
19169 self
19170 }
19171 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19172 /// while executing the actual API request.
19173 ///
19174 /// ````text
19175 /// It should be used to handle progress information, and to implement a certain level of resilience.
19176 /// ````
19177 ///
19178 /// Sets the *delegate* property to the given value.
19179 pub fn delegate(
19180 mut self,
19181 new_value: &'a mut dyn common::Delegate,
19182 ) -> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C> {
19183 self._delegate = Some(new_value);
19184 self
19185 }
19186
19187 /// Set any additional parameter of the query string used in the request.
19188 /// It should be used to set parameters which are not yet available through their own
19189 /// setters.
19190 ///
19191 /// Please note that this method must not be used to set any of the known parameters
19192 /// which have their own setter method. If done anyway, the request will fail.
19193 ///
19194 /// # Additional Parameters
19195 ///
19196 /// * *$.xgafv* (query-string) - V1 error format.
19197 /// * *access_token* (query-string) - OAuth access token.
19198 /// * *alt* (query-string) - Data format for response.
19199 /// * *callback* (query-string) - JSONP
19200 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19201 /// * *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.
19202 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19203 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19204 /// * *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.
19205 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19206 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19207 pub fn param<T>(
19208 mut self,
19209 name: T,
19210 value: T,
19211 ) -> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C>
19212 where
19213 T: AsRef<str>,
19214 {
19215 self._additional_params
19216 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19217 self
19218 }
19219
19220 /// Identifies the authorization scope for the method you are building.
19221 ///
19222 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19223 /// [`Scope::CloudPlatform`].
19224 ///
19225 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19226 /// tokens for more than one scope.
19227 ///
19228 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19229 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19230 /// sufficient, a read-write scope will do as well.
19231 pub fn add_scope<St>(
19232 mut self,
19233 scope: St,
19234 ) -> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C>
19235 where
19236 St: AsRef<str>,
19237 {
19238 self._scopes.insert(String::from(scope.as_ref()));
19239 self
19240 }
19241 /// Identifies the authorization scope(s) for the method you are building.
19242 ///
19243 /// See [`Self::add_scope()`] for details.
19244 pub fn add_scopes<I, St>(
19245 mut self,
19246 scopes: I,
19247 ) -> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C>
19248 where
19249 I: IntoIterator<Item = St>,
19250 St: AsRef<str>,
19251 {
19252 self._scopes
19253 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19254 self
19255 }
19256
19257 /// Removes all scopes, and no default scope will be used either.
19258 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19259 /// for details).
19260 pub fn clear_scopes(
19261 mut self,
19262 ) -> ProjectLocationMulticloudDataTransferConfigDestinationGetCall<'a, C> {
19263 self._scopes.clear();
19264 self
19265 }
19266}
19267
19268/// Lists the `Destination` resources in a specified project and location.
19269///
19270/// A builder for the *locations.multicloudDataTransferConfigs.destinations.list* method supported by a *project* resource.
19271/// It is not used directly, but through a [`ProjectMethods`] instance.
19272///
19273/// # Example
19274///
19275/// Instantiate a resource method builder
19276///
19277/// ```test_harness,no_run
19278/// # extern crate hyper;
19279/// # extern crate hyper_rustls;
19280/// # extern crate google_networkconnectivity1 as networkconnectivity1;
19281/// # async fn dox() {
19282/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19283///
19284/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19285/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19286/// # .with_native_roots()
19287/// # .unwrap()
19288/// # .https_only()
19289/// # .enable_http2()
19290/// # .build();
19291///
19292/// # let executor = hyper_util::rt::TokioExecutor::new();
19293/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19294/// # secret,
19295/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19296/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19297/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19298/// # ),
19299/// # ).build().await.unwrap();
19300///
19301/// # let client = hyper_util::client::legacy::Client::builder(
19302/// # hyper_util::rt::TokioExecutor::new()
19303/// # )
19304/// # .build(
19305/// # hyper_rustls::HttpsConnectorBuilder::new()
19306/// # .with_native_roots()
19307/// # .unwrap()
19308/// # .https_or_http()
19309/// # .enable_http2()
19310/// # .build()
19311/// # );
19312/// # let mut hub = Networkconnectivity::new(client, auth);
19313/// // You can configure optional parameters by calling the respective setters at will, and
19314/// // execute the final call using `doit()`.
19315/// // Values shown here are possibly random and not representative !
19316/// let result = hub.projects().locations_multicloud_data_transfer_configs_destinations_list("parent")
19317/// .return_partial_success(false)
19318/// .page_token("elitr")
19319/// .page_size(-80)
19320/// .order_by("no")
19321/// .filter("nonumy")
19322/// .doit().await;
19323/// # }
19324/// ```
19325pub struct ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C>
19326where
19327 C: 'a,
19328{
19329 hub: &'a Networkconnectivity<C>,
19330 _parent: String,
19331 _return_partial_success: Option<bool>,
19332 _page_token: Option<String>,
19333 _page_size: Option<i32>,
19334 _order_by: Option<String>,
19335 _filter: Option<String>,
19336 _delegate: Option<&'a mut dyn common::Delegate>,
19337 _additional_params: HashMap<String, String>,
19338 _scopes: BTreeSet<String>,
19339}
19340
19341impl<'a, C> common::CallBuilder
19342 for ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C>
19343{
19344}
19345
19346impl<'a, C> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C>
19347where
19348 C: common::Connector,
19349{
19350 /// Perform the operation you have build so far.
19351 pub async fn doit(mut self) -> common::Result<(common::Response, ListDestinationsResponse)> {
19352 use std::borrow::Cow;
19353 use std::io::{Read, Seek};
19354
19355 use common::{url::Params, ToParts};
19356 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19357
19358 let mut dd = common::DefaultDelegate;
19359 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19360 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.destinations.list",
19361 http_method: hyper::Method::GET });
19362
19363 for &field in [
19364 "alt",
19365 "parent",
19366 "returnPartialSuccess",
19367 "pageToken",
19368 "pageSize",
19369 "orderBy",
19370 "filter",
19371 ]
19372 .iter()
19373 {
19374 if self._additional_params.contains_key(field) {
19375 dlg.finished(false);
19376 return Err(common::Error::FieldClash(field));
19377 }
19378 }
19379
19380 let mut params = Params::with_capacity(8 + self._additional_params.len());
19381 params.push("parent", self._parent);
19382 if let Some(value) = self._return_partial_success.as_ref() {
19383 params.push("returnPartialSuccess", value.to_string());
19384 }
19385 if let Some(value) = self._page_token.as_ref() {
19386 params.push("pageToken", value);
19387 }
19388 if let Some(value) = self._page_size.as_ref() {
19389 params.push("pageSize", value.to_string());
19390 }
19391 if let Some(value) = self._order_by.as_ref() {
19392 params.push("orderBy", value);
19393 }
19394 if let Some(value) = self._filter.as_ref() {
19395 params.push("filter", value);
19396 }
19397
19398 params.extend(self._additional_params.iter());
19399
19400 params.push("alt", "json");
19401 let mut url = self.hub._base_url.clone() + "v1/{+parent}/destinations";
19402 if self._scopes.is_empty() {
19403 self._scopes
19404 .insert(Scope::CloudPlatform.as_ref().to_string());
19405 }
19406
19407 #[allow(clippy::single_element_loop)]
19408 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19409 url = params.uri_replacement(url, param_name, find_this, true);
19410 }
19411 {
19412 let to_remove = ["parent"];
19413 params.remove_params(&to_remove);
19414 }
19415
19416 let url = params.parse_with_url(&url);
19417
19418 loop {
19419 let token = match self
19420 .hub
19421 .auth
19422 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19423 .await
19424 {
19425 Ok(token) => token,
19426 Err(e) => match dlg.token(e) {
19427 Ok(token) => token,
19428 Err(e) => {
19429 dlg.finished(false);
19430 return Err(common::Error::MissingToken(e));
19431 }
19432 },
19433 };
19434 let mut req_result = {
19435 let client = &self.hub.client;
19436 dlg.pre_request();
19437 let mut req_builder = hyper::Request::builder()
19438 .method(hyper::Method::GET)
19439 .uri(url.as_str())
19440 .header(USER_AGENT, self.hub._user_agent.clone());
19441
19442 if let Some(token) = token.as_ref() {
19443 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19444 }
19445
19446 let request = req_builder
19447 .header(CONTENT_LENGTH, 0_u64)
19448 .body(common::to_body::<String>(None));
19449
19450 client.request(request.unwrap()).await
19451 };
19452
19453 match req_result {
19454 Err(err) => {
19455 if let common::Retry::After(d) = dlg.http_error(&err) {
19456 sleep(d).await;
19457 continue;
19458 }
19459 dlg.finished(false);
19460 return Err(common::Error::HttpError(err));
19461 }
19462 Ok(res) => {
19463 let (mut parts, body) = res.into_parts();
19464 let mut body = common::Body::new(body);
19465 if !parts.status.is_success() {
19466 let bytes = common::to_bytes(body).await.unwrap_or_default();
19467 let error = serde_json::from_str(&common::to_string(&bytes));
19468 let response = common::to_response(parts, bytes.into());
19469
19470 if let common::Retry::After(d) =
19471 dlg.http_failure(&response, error.as_ref().ok())
19472 {
19473 sleep(d).await;
19474 continue;
19475 }
19476
19477 dlg.finished(false);
19478
19479 return Err(match error {
19480 Ok(value) => common::Error::BadRequest(value),
19481 _ => common::Error::Failure(response),
19482 });
19483 }
19484 let response = {
19485 let bytes = common::to_bytes(body).await.unwrap_or_default();
19486 let encoded = common::to_string(&bytes);
19487 match serde_json::from_str(&encoded) {
19488 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19489 Err(error) => {
19490 dlg.response_json_decode_error(&encoded, &error);
19491 return Err(common::Error::JsonDecodeError(
19492 encoded.to_string(),
19493 error,
19494 ));
19495 }
19496 }
19497 };
19498
19499 dlg.finished(true);
19500 return Ok(response);
19501 }
19502 }
19503 }
19504 }
19505
19506 /// Required. The name of the parent resource.
19507 ///
19508 /// Sets the *parent* path property to the given value.
19509 ///
19510 /// Even though the property as already been set when instantiating this call,
19511 /// we provide this method for API completeness.
19512 pub fn parent(
19513 mut self,
19514 new_value: &str,
19515 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19516 self._parent = new_value.to_string();
19517 self
19518 }
19519 /// Optional. If `true`, allow partial responses for multi-regional aggregated list requests.
19520 ///
19521 /// Sets the *return partial success* query property to the given value.
19522 pub fn return_partial_success(
19523 mut self,
19524 new_value: bool,
19525 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19526 self._return_partial_success = Some(new_value);
19527 self
19528 }
19529 /// Optional. The page token.
19530 ///
19531 /// Sets the *page token* query property to the given value.
19532 pub fn page_token(
19533 mut self,
19534 new_value: &str,
19535 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19536 self._page_token = Some(new_value.to_string());
19537 self
19538 }
19539 /// Optional. The maximum number of results listed per page.
19540 ///
19541 /// Sets the *page size* query property to the given value.
19542 pub fn page_size(
19543 mut self,
19544 new_value: i32,
19545 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19546 self._page_size = Some(new_value);
19547 self
19548 }
19549 /// Optional. The sort order of the results.
19550 ///
19551 /// Sets the *order by* query property to the given value.
19552 pub fn order_by(
19553 mut self,
19554 new_value: &str,
19555 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19556 self._order_by = Some(new_value.to_string());
19557 self
19558 }
19559 /// Optional. An expression that filters the results listed in the response.
19560 ///
19561 /// Sets the *filter* query property to the given value.
19562 pub fn filter(
19563 mut self,
19564 new_value: &str,
19565 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19566 self._filter = Some(new_value.to_string());
19567 self
19568 }
19569 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19570 /// while executing the actual API request.
19571 ///
19572 /// ````text
19573 /// It should be used to handle progress information, and to implement a certain level of resilience.
19574 /// ````
19575 ///
19576 /// Sets the *delegate* property to the given value.
19577 pub fn delegate(
19578 mut self,
19579 new_value: &'a mut dyn common::Delegate,
19580 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19581 self._delegate = Some(new_value);
19582 self
19583 }
19584
19585 /// Set any additional parameter of the query string used in the request.
19586 /// It should be used to set parameters which are not yet available through their own
19587 /// setters.
19588 ///
19589 /// Please note that this method must not be used to set any of the known parameters
19590 /// which have their own setter method. If done anyway, the request will fail.
19591 ///
19592 /// # Additional Parameters
19593 ///
19594 /// * *$.xgafv* (query-string) - V1 error format.
19595 /// * *access_token* (query-string) - OAuth access token.
19596 /// * *alt* (query-string) - Data format for response.
19597 /// * *callback* (query-string) - JSONP
19598 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19599 /// * *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.
19600 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19601 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19602 /// * *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.
19603 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19604 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19605 pub fn param<T>(
19606 mut self,
19607 name: T,
19608 value: T,
19609 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C>
19610 where
19611 T: AsRef<str>,
19612 {
19613 self._additional_params
19614 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19615 self
19616 }
19617
19618 /// Identifies the authorization scope for the method you are building.
19619 ///
19620 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19621 /// [`Scope::CloudPlatform`].
19622 ///
19623 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19624 /// tokens for more than one scope.
19625 ///
19626 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19627 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19628 /// sufficient, a read-write scope will do as well.
19629 pub fn add_scope<St>(
19630 mut self,
19631 scope: St,
19632 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C>
19633 where
19634 St: AsRef<str>,
19635 {
19636 self._scopes.insert(String::from(scope.as_ref()));
19637 self
19638 }
19639 /// Identifies the authorization scope(s) for the method you are building.
19640 ///
19641 /// See [`Self::add_scope()`] for details.
19642 pub fn add_scopes<I, St>(
19643 mut self,
19644 scopes: I,
19645 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C>
19646 where
19647 I: IntoIterator<Item = St>,
19648 St: AsRef<str>,
19649 {
19650 self._scopes
19651 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19652 self
19653 }
19654
19655 /// Removes all scopes, and no default scope will be used either.
19656 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19657 /// for details).
19658 pub fn clear_scopes(
19659 mut self,
19660 ) -> ProjectLocationMulticloudDataTransferConfigDestinationListCall<'a, C> {
19661 self._scopes.clear();
19662 self
19663 }
19664}
19665
19666/// Updates a `Destination` resource in a specified project and location.
19667///
19668/// A builder for the *locations.multicloudDataTransferConfigs.destinations.patch* method supported by a *project* resource.
19669/// It is not used directly, but through a [`ProjectMethods`] instance.
19670///
19671/// # Example
19672///
19673/// Instantiate a resource method builder
19674///
19675/// ```test_harness,no_run
19676/// # extern crate hyper;
19677/// # extern crate hyper_rustls;
19678/// # extern crate google_networkconnectivity1 as networkconnectivity1;
19679/// use networkconnectivity1::api::Destination;
19680/// # async fn dox() {
19681/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19682///
19683/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19684/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19685/// # .with_native_roots()
19686/// # .unwrap()
19687/// # .https_only()
19688/// # .enable_http2()
19689/// # .build();
19690///
19691/// # let executor = hyper_util::rt::TokioExecutor::new();
19692/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19693/// # secret,
19694/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19695/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19696/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19697/// # ),
19698/// # ).build().await.unwrap();
19699///
19700/// # let client = hyper_util::client::legacy::Client::builder(
19701/// # hyper_util::rt::TokioExecutor::new()
19702/// # )
19703/// # .build(
19704/// # hyper_rustls::HttpsConnectorBuilder::new()
19705/// # .with_native_roots()
19706/// # .unwrap()
19707/// # .https_or_http()
19708/// # .enable_http2()
19709/// # .build()
19710/// # );
19711/// # let mut hub = Networkconnectivity::new(client, auth);
19712/// // As the method needs a request, you would usually fill it with the desired information
19713/// // into the respective structure. Some of the parts shown here might not be applicable !
19714/// // Values shown here are possibly random and not representative !
19715/// let mut req = Destination::default();
19716///
19717/// // You can configure optional parameters by calling the respective setters at will, and
19718/// // execute the final call using `doit()`.
19719/// // Values shown here are possibly random and not representative !
19720/// let result = hub.projects().locations_multicloud_data_transfer_configs_destinations_patch(req, "name")
19721/// .update_mask(FieldMask::new::<&str>(&[]))
19722/// .request_id("sadipscing")
19723/// .doit().await;
19724/// # }
19725/// ```
19726pub struct ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C>
19727where
19728 C: 'a,
19729{
19730 hub: &'a Networkconnectivity<C>,
19731 _request: Destination,
19732 _name: String,
19733 _update_mask: Option<common::FieldMask>,
19734 _request_id: Option<String>,
19735 _delegate: Option<&'a mut dyn common::Delegate>,
19736 _additional_params: HashMap<String, String>,
19737 _scopes: BTreeSet<String>,
19738}
19739
19740impl<'a, C> common::CallBuilder
19741 for ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C>
19742{
19743}
19744
19745impl<'a, C> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C>
19746where
19747 C: common::Connector,
19748{
19749 /// Perform the operation you have build so far.
19750 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
19751 use std::borrow::Cow;
19752 use std::io::{Read, Seek};
19753
19754 use common::{url::Params, ToParts};
19755 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19756
19757 let mut dd = common::DefaultDelegate;
19758 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19759 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.destinations.patch",
19760 http_method: hyper::Method::PATCH });
19761
19762 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
19763 if self._additional_params.contains_key(field) {
19764 dlg.finished(false);
19765 return Err(common::Error::FieldClash(field));
19766 }
19767 }
19768
19769 let mut params = Params::with_capacity(6 + self._additional_params.len());
19770 params.push("name", self._name);
19771 if let Some(value) = self._update_mask.as_ref() {
19772 params.push("updateMask", value.to_string());
19773 }
19774 if let Some(value) = self._request_id.as_ref() {
19775 params.push("requestId", value);
19776 }
19777
19778 params.extend(self._additional_params.iter());
19779
19780 params.push("alt", "json");
19781 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19782 if self._scopes.is_empty() {
19783 self._scopes
19784 .insert(Scope::CloudPlatform.as_ref().to_string());
19785 }
19786
19787 #[allow(clippy::single_element_loop)]
19788 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19789 url = params.uri_replacement(url, param_name, find_this, true);
19790 }
19791 {
19792 let to_remove = ["name"];
19793 params.remove_params(&to_remove);
19794 }
19795
19796 let url = params.parse_with_url(&url);
19797
19798 let mut json_mime_type = mime::APPLICATION_JSON;
19799 let mut request_value_reader = {
19800 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19801 common::remove_json_null_values(&mut value);
19802 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19803 serde_json::to_writer(&mut dst, &value).unwrap();
19804 dst
19805 };
19806 let request_size = request_value_reader
19807 .seek(std::io::SeekFrom::End(0))
19808 .unwrap();
19809 request_value_reader
19810 .seek(std::io::SeekFrom::Start(0))
19811 .unwrap();
19812
19813 loop {
19814 let token = match self
19815 .hub
19816 .auth
19817 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19818 .await
19819 {
19820 Ok(token) => token,
19821 Err(e) => match dlg.token(e) {
19822 Ok(token) => token,
19823 Err(e) => {
19824 dlg.finished(false);
19825 return Err(common::Error::MissingToken(e));
19826 }
19827 },
19828 };
19829 request_value_reader
19830 .seek(std::io::SeekFrom::Start(0))
19831 .unwrap();
19832 let mut req_result = {
19833 let client = &self.hub.client;
19834 dlg.pre_request();
19835 let mut req_builder = hyper::Request::builder()
19836 .method(hyper::Method::PATCH)
19837 .uri(url.as_str())
19838 .header(USER_AGENT, self.hub._user_agent.clone());
19839
19840 if let Some(token) = token.as_ref() {
19841 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19842 }
19843
19844 let request = req_builder
19845 .header(CONTENT_TYPE, json_mime_type.to_string())
19846 .header(CONTENT_LENGTH, request_size as u64)
19847 .body(common::to_body(
19848 request_value_reader.get_ref().clone().into(),
19849 ));
19850
19851 client.request(request.unwrap()).await
19852 };
19853
19854 match req_result {
19855 Err(err) => {
19856 if let common::Retry::After(d) = dlg.http_error(&err) {
19857 sleep(d).await;
19858 continue;
19859 }
19860 dlg.finished(false);
19861 return Err(common::Error::HttpError(err));
19862 }
19863 Ok(res) => {
19864 let (mut parts, body) = res.into_parts();
19865 let mut body = common::Body::new(body);
19866 if !parts.status.is_success() {
19867 let bytes = common::to_bytes(body).await.unwrap_or_default();
19868 let error = serde_json::from_str(&common::to_string(&bytes));
19869 let response = common::to_response(parts, bytes.into());
19870
19871 if let common::Retry::After(d) =
19872 dlg.http_failure(&response, error.as_ref().ok())
19873 {
19874 sleep(d).await;
19875 continue;
19876 }
19877
19878 dlg.finished(false);
19879
19880 return Err(match error {
19881 Ok(value) => common::Error::BadRequest(value),
19882 _ => common::Error::Failure(response),
19883 });
19884 }
19885 let response = {
19886 let bytes = common::to_bytes(body).await.unwrap_or_default();
19887 let encoded = common::to_string(&bytes);
19888 match serde_json::from_str(&encoded) {
19889 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19890 Err(error) => {
19891 dlg.response_json_decode_error(&encoded, &error);
19892 return Err(common::Error::JsonDecodeError(
19893 encoded.to_string(),
19894 error,
19895 ));
19896 }
19897 }
19898 };
19899
19900 dlg.finished(true);
19901 return Ok(response);
19902 }
19903 }
19904 }
19905 }
19906
19907 ///
19908 /// Sets the *request* property to the given value.
19909 ///
19910 /// Even though the property as already been set when instantiating this call,
19911 /// we provide this method for API completeness.
19912 pub fn request(
19913 mut self,
19914 new_value: Destination,
19915 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C> {
19916 self._request = new_value;
19917 self
19918 }
19919 /// Identifier. The name of the `Destination` resource. Format: `projects/{project}/locations/{location}/multicloudDataTransferConfigs/{multicloud_data_transfer_config}/destinations/{destination}`.
19920 ///
19921 /// Sets the *name* path property to the given value.
19922 ///
19923 /// Even though the property as already been set when instantiating this call,
19924 /// we provide this method for API completeness.
19925 pub fn name(
19926 mut self,
19927 new_value: &str,
19928 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C> {
19929 self._name = new_value.to_string();
19930 self
19931 }
19932 /// Optional. `FieldMask is used to specify the fields to be overwritten in the `Destination` resource by the update. The fields specified in `update_mask` are relative to the resource, not the full request. A field is overwritten if it is in the mask. If you don't specify a mask, all fields are overwritten.
19933 ///
19934 /// Sets the *update mask* query property to the given value.
19935 pub fn update_mask(
19936 mut self,
19937 new_value: common::FieldMask,
19938 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C> {
19939 self._update_mask = Some(new_value);
19940 self
19941 }
19942 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server can ignore the request if it has already been completed. The server waits for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, can ignore the second request. The request ID must be a valid UUID with the exception that zero UUID (00000000-0000-0000-0000-000000000000) isn't supported.
19943 ///
19944 /// Sets the *request id* query property to the given value.
19945 pub fn request_id(
19946 mut self,
19947 new_value: &str,
19948 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C> {
19949 self._request_id = Some(new_value.to_string());
19950 self
19951 }
19952 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19953 /// while executing the actual API request.
19954 ///
19955 /// ````text
19956 /// It should be used to handle progress information, and to implement a certain level of resilience.
19957 /// ````
19958 ///
19959 /// Sets the *delegate* property to the given value.
19960 pub fn delegate(
19961 mut self,
19962 new_value: &'a mut dyn common::Delegate,
19963 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C> {
19964 self._delegate = Some(new_value);
19965 self
19966 }
19967
19968 /// Set any additional parameter of the query string used in the request.
19969 /// It should be used to set parameters which are not yet available through their own
19970 /// setters.
19971 ///
19972 /// Please note that this method must not be used to set any of the known parameters
19973 /// which have their own setter method. If done anyway, the request will fail.
19974 ///
19975 /// # Additional Parameters
19976 ///
19977 /// * *$.xgafv* (query-string) - V1 error format.
19978 /// * *access_token* (query-string) - OAuth access token.
19979 /// * *alt* (query-string) - Data format for response.
19980 /// * *callback* (query-string) - JSONP
19981 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19982 /// * *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.
19983 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19984 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19985 /// * *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.
19986 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19987 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19988 pub fn param<T>(
19989 mut self,
19990 name: T,
19991 value: T,
19992 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C>
19993 where
19994 T: AsRef<str>,
19995 {
19996 self._additional_params
19997 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19998 self
19999 }
20000
20001 /// Identifies the authorization scope for the method you are building.
20002 ///
20003 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20004 /// [`Scope::CloudPlatform`].
20005 ///
20006 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20007 /// tokens for more than one scope.
20008 ///
20009 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20010 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20011 /// sufficient, a read-write scope will do as well.
20012 pub fn add_scope<St>(
20013 mut self,
20014 scope: St,
20015 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C>
20016 where
20017 St: AsRef<str>,
20018 {
20019 self._scopes.insert(String::from(scope.as_ref()));
20020 self
20021 }
20022 /// Identifies the authorization scope(s) for the method you are building.
20023 ///
20024 /// See [`Self::add_scope()`] for details.
20025 pub fn add_scopes<I, St>(
20026 mut self,
20027 scopes: I,
20028 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C>
20029 where
20030 I: IntoIterator<Item = St>,
20031 St: AsRef<str>,
20032 {
20033 self._scopes
20034 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20035 self
20036 }
20037
20038 /// Removes all scopes, and no default scope will be used either.
20039 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20040 /// for details).
20041 pub fn clear_scopes(
20042 mut self,
20043 ) -> ProjectLocationMulticloudDataTransferConfigDestinationPatchCall<'a, C> {
20044 self._scopes.clear();
20045 self
20046 }
20047}
20048
20049/// Creates a `MulticloudDataTransferConfig` resource in a specified project and location.
20050///
20051/// A builder for the *locations.multicloudDataTransferConfigs.create* method supported by a *project* resource.
20052/// It is not used directly, but through a [`ProjectMethods`] instance.
20053///
20054/// # Example
20055///
20056/// Instantiate a resource method builder
20057///
20058/// ```test_harness,no_run
20059/// # extern crate hyper;
20060/// # extern crate hyper_rustls;
20061/// # extern crate google_networkconnectivity1 as networkconnectivity1;
20062/// use networkconnectivity1::api::MulticloudDataTransferConfig;
20063/// # async fn dox() {
20064/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20065///
20066/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20067/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20068/// # .with_native_roots()
20069/// # .unwrap()
20070/// # .https_only()
20071/// # .enable_http2()
20072/// # .build();
20073///
20074/// # let executor = hyper_util::rt::TokioExecutor::new();
20075/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20076/// # secret,
20077/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20078/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20079/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20080/// # ),
20081/// # ).build().await.unwrap();
20082///
20083/// # let client = hyper_util::client::legacy::Client::builder(
20084/// # hyper_util::rt::TokioExecutor::new()
20085/// # )
20086/// # .build(
20087/// # hyper_rustls::HttpsConnectorBuilder::new()
20088/// # .with_native_roots()
20089/// # .unwrap()
20090/// # .https_or_http()
20091/// # .enable_http2()
20092/// # .build()
20093/// # );
20094/// # let mut hub = Networkconnectivity::new(client, auth);
20095/// // As the method needs a request, you would usually fill it with the desired information
20096/// // into the respective structure. Some of the parts shown here might not be applicable !
20097/// // Values shown here are possibly random and not representative !
20098/// let mut req = MulticloudDataTransferConfig::default();
20099///
20100/// // You can configure optional parameters by calling the respective setters at will, and
20101/// // execute the final call using `doit()`.
20102/// // Values shown here are possibly random and not representative !
20103/// let result = hub.projects().locations_multicloud_data_transfer_configs_create(req, "parent")
20104/// .request_id("dolores")
20105/// .multicloud_data_transfer_config_id("sadipscing")
20106/// .doit().await;
20107/// # }
20108/// ```
20109pub struct ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C>
20110where
20111 C: 'a,
20112{
20113 hub: &'a Networkconnectivity<C>,
20114 _request: MulticloudDataTransferConfig,
20115 _parent: String,
20116 _request_id: Option<String>,
20117 _multicloud_data_transfer_config_id: Option<String>,
20118 _delegate: Option<&'a mut dyn common::Delegate>,
20119 _additional_params: HashMap<String, String>,
20120 _scopes: BTreeSet<String>,
20121}
20122
20123impl<'a, C> common::CallBuilder for ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {}
20124
20125impl<'a, C> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C>
20126where
20127 C: common::Connector,
20128{
20129 /// Perform the operation you have build so far.
20130 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
20131 use std::borrow::Cow;
20132 use std::io::{Read, Seek};
20133
20134 use common::{url::Params, ToParts};
20135 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20136
20137 let mut dd = common::DefaultDelegate;
20138 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20139 dlg.begin(common::MethodInfo {
20140 id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.create",
20141 http_method: hyper::Method::POST,
20142 });
20143
20144 for &field in [
20145 "alt",
20146 "parent",
20147 "requestId",
20148 "multicloudDataTransferConfigId",
20149 ]
20150 .iter()
20151 {
20152 if self._additional_params.contains_key(field) {
20153 dlg.finished(false);
20154 return Err(common::Error::FieldClash(field));
20155 }
20156 }
20157
20158 let mut params = Params::with_capacity(6 + self._additional_params.len());
20159 params.push("parent", self._parent);
20160 if let Some(value) = self._request_id.as_ref() {
20161 params.push("requestId", value);
20162 }
20163 if let Some(value) = self._multicloud_data_transfer_config_id.as_ref() {
20164 params.push("multicloudDataTransferConfigId", value);
20165 }
20166
20167 params.extend(self._additional_params.iter());
20168
20169 params.push("alt", "json");
20170 let mut url = self.hub._base_url.clone() + "v1/{+parent}/multicloudDataTransferConfigs";
20171 if self._scopes.is_empty() {
20172 self._scopes
20173 .insert(Scope::CloudPlatform.as_ref().to_string());
20174 }
20175
20176 #[allow(clippy::single_element_loop)]
20177 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20178 url = params.uri_replacement(url, param_name, find_this, true);
20179 }
20180 {
20181 let to_remove = ["parent"];
20182 params.remove_params(&to_remove);
20183 }
20184
20185 let url = params.parse_with_url(&url);
20186
20187 let mut json_mime_type = mime::APPLICATION_JSON;
20188 let mut request_value_reader = {
20189 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20190 common::remove_json_null_values(&mut value);
20191 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20192 serde_json::to_writer(&mut dst, &value).unwrap();
20193 dst
20194 };
20195 let request_size = request_value_reader
20196 .seek(std::io::SeekFrom::End(0))
20197 .unwrap();
20198 request_value_reader
20199 .seek(std::io::SeekFrom::Start(0))
20200 .unwrap();
20201
20202 loop {
20203 let token = match self
20204 .hub
20205 .auth
20206 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20207 .await
20208 {
20209 Ok(token) => token,
20210 Err(e) => match dlg.token(e) {
20211 Ok(token) => token,
20212 Err(e) => {
20213 dlg.finished(false);
20214 return Err(common::Error::MissingToken(e));
20215 }
20216 },
20217 };
20218 request_value_reader
20219 .seek(std::io::SeekFrom::Start(0))
20220 .unwrap();
20221 let mut req_result = {
20222 let client = &self.hub.client;
20223 dlg.pre_request();
20224 let mut req_builder = hyper::Request::builder()
20225 .method(hyper::Method::POST)
20226 .uri(url.as_str())
20227 .header(USER_AGENT, self.hub._user_agent.clone());
20228
20229 if let Some(token) = token.as_ref() {
20230 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20231 }
20232
20233 let request = req_builder
20234 .header(CONTENT_TYPE, json_mime_type.to_string())
20235 .header(CONTENT_LENGTH, request_size as u64)
20236 .body(common::to_body(
20237 request_value_reader.get_ref().clone().into(),
20238 ));
20239
20240 client.request(request.unwrap()).await
20241 };
20242
20243 match req_result {
20244 Err(err) => {
20245 if let common::Retry::After(d) = dlg.http_error(&err) {
20246 sleep(d).await;
20247 continue;
20248 }
20249 dlg.finished(false);
20250 return Err(common::Error::HttpError(err));
20251 }
20252 Ok(res) => {
20253 let (mut parts, body) = res.into_parts();
20254 let mut body = common::Body::new(body);
20255 if !parts.status.is_success() {
20256 let bytes = common::to_bytes(body).await.unwrap_or_default();
20257 let error = serde_json::from_str(&common::to_string(&bytes));
20258 let response = common::to_response(parts, bytes.into());
20259
20260 if let common::Retry::After(d) =
20261 dlg.http_failure(&response, error.as_ref().ok())
20262 {
20263 sleep(d).await;
20264 continue;
20265 }
20266
20267 dlg.finished(false);
20268
20269 return Err(match error {
20270 Ok(value) => common::Error::BadRequest(value),
20271 _ => common::Error::Failure(response),
20272 });
20273 }
20274 let response = {
20275 let bytes = common::to_bytes(body).await.unwrap_or_default();
20276 let encoded = common::to_string(&bytes);
20277 match serde_json::from_str(&encoded) {
20278 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20279 Err(error) => {
20280 dlg.response_json_decode_error(&encoded, &error);
20281 return Err(common::Error::JsonDecodeError(
20282 encoded.to_string(),
20283 error,
20284 ));
20285 }
20286 }
20287 };
20288
20289 dlg.finished(true);
20290 return Ok(response);
20291 }
20292 }
20293 }
20294 }
20295
20296 ///
20297 /// Sets the *request* property to the given value.
20298 ///
20299 /// Even though the property as already been set when instantiating this call,
20300 /// we provide this method for API completeness.
20301 pub fn request(
20302 mut self,
20303 new_value: MulticloudDataTransferConfig,
20304 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {
20305 self._request = new_value;
20306 self
20307 }
20308 /// Required. The name of the parent resource.
20309 ///
20310 /// Sets the *parent* path property to the given value.
20311 ///
20312 /// Even though the property as already been set when instantiating this call,
20313 /// we provide this method for API completeness.
20314 pub fn parent(
20315 mut self,
20316 new_value: &str,
20317 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {
20318 self._parent = new_value.to_string();
20319 self
20320 }
20321 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server can ignore the request if it has already been completed. The server waits for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, can ignore the second request. This prevents clients from accidentally creating duplicate `MulticloudDataTransferConfig` resources. The request ID must be a valid UUID with the exception that zero UUID (00000000-0000-0000-0000-000000000000) isn't supported.
20322 ///
20323 /// Sets the *request id* query property to the given value.
20324 pub fn request_id(
20325 mut self,
20326 new_value: &str,
20327 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {
20328 self._request_id = Some(new_value.to_string());
20329 self
20330 }
20331 /// Required. The ID to use for the `MulticloudDataTransferConfig` resource, which becomes the final component of the `MulticloudDataTransferConfig` resource name.
20332 ///
20333 /// Sets the *multicloud data transfer config id* query property to the given value.
20334 pub fn multicloud_data_transfer_config_id(
20335 mut self,
20336 new_value: &str,
20337 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {
20338 self._multicloud_data_transfer_config_id = Some(new_value.to_string());
20339 self
20340 }
20341 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20342 /// while executing the actual API request.
20343 ///
20344 /// ````text
20345 /// It should be used to handle progress information, and to implement a certain level of resilience.
20346 /// ````
20347 ///
20348 /// Sets the *delegate* property to the given value.
20349 pub fn delegate(
20350 mut self,
20351 new_value: &'a mut dyn common::Delegate,
20352 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {
20353 self._delegate = Some(new_value);
20354 self
20355 }
20356
20357 /// Set any additional parameter of the query string used in the request.
20358 /// It should be used to set parameters which are not yet available through their own
20359 /// setters.
20360 ///
20361 /// Please note that this method must not be used to set any of the known parameters
20362 /// which have their own setter method. If done anyway, the request will fail.
20363 ///
20364 /// # Additional Parameters
20365 ///
20366 /// * *$.xgafv* (query-string) - V1 error format.
20367 /// * *access_token* (query-string) - OAuth access token.
20368 /// * *alt* (query-string) - Data format for response.
20369 /// * *callback* (query-string) - JSONP
20370 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20371 /// * *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.
20372 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20373 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20374 /// * *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.
20375 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20376 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20377 pub fn param<T>(
20378 mut self,
20379 name: T,
20380 value: T,
20381 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C>
20382 where
20383 T: AsRef<str>,
20384 {
20385 self._additional_params
20386 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20387 self
20388 }
20389
20390 /// Identifies the authorization scope for the method you are building.
20391 ///
20392 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20393 /// [`Scope::CloudPlatform`].
20394 ///
20395 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20396 /// tokens for more than one scope.
20397 ///
20398 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20399 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20400 /// sufficient, a read-write scope will do as well.
20401 pub fn add_scope<St>(
20402 mut self,
20403 scope: St,
20404 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C>
20405 where
20406 St: AsRef<str>,
20407 {
20408 self._scopes.insert(String::from(scope.as_ref()));
20409 self
20410 }
20411 /// Identifies the authorization scope(s) for the method you are building.
20412 ///
20413 /// See [`Self::add_scope()`] for details.
20414 pub fn add_scopes<I, St>(
20415 mut self,
20416 scopes: I,
20417 ) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C>
20418 where
20419 I: IntoIterator<Item = St>,
20420 St: AsRef<str>,
20421 {
20422 self._scopes
20423 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20424 self
20425 }
20426
20427 /// Removes all scopes, and no default scope will be used either.
20428 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20429 /// for details).
20430 pub fn clear_scopes(mut self) -> ProjectLocationMulticloudDataTransferConfigCreateCall<'a, C> {
20431 self._scopes.clear();
20432 self
20433 }
20434}
20435
20436/// Deletes a `MulticloudDataTransferConfig` resource.
20437///
20438/// A builder for the *locations.multicloudDataTransferConfigs.delete* method supported by a *project* resource.
20439/// It is not used directly, but through a [`ProjectMethods`] instance.
20440///
20441/// # Example
20442///
20443/// Instantiate a resource method builder
20444///
20445/// ```test_harness,no_run
20446/// # extern crate hyper;
20447/// # extern crate hyper_rustls;
20448/// # extern crate google_networkconnectivity1 as networkconnectivity1;
20449/// # async fn dox() {
20450/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20451///
20452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20453/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20454/// # .with_native_roots()
20455/// # .unwrap()
20456/// # .https_only()
20457/// # .enable_http2()
20458/// # .build();
20459///
20460/// # let executor = hyper_util::rt::TokioExecutor::new();
20461/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20462/// # secret,
20463/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20464/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20465/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20466/// # ),
20467/// # ).build().await.unwrap();
20468///
20469/// # let client = hyper_util::client::legacy::Client::builder(
20470/// # hyper_util::rt::TokioExecutor::new()
20471/// # )
20472/// # .build(
20473/// # hyper_rustls::HttpsConnectorBuilder::new()
20474/// # .with_native_roots()
20475/// # .unwrap()
20476/// # .https_or_http()
20477/// # .enable_http2()
20478/// # .build()
20479/// # );
20480/// # let mut hub = Networkconnectivity::new(client, auth);
20481/// // You can configure optional parameters by calling the respective setters at will, and
20482/// // execute the final call using `doit()`.
20483/// // Values shown here are possibly random and not representative !
20484/// let result = hub.projects().locations_multicloud_data_transfer_configs_delete("name")
20485/// .request_id("aliquyam")
20486/// .etag("amet")
20487/// .doit().await;
20488/// # }
20489/// ```
20490pub struct ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C>
20491where
20492 C: 'a,
20493{
20494 hub: &'a Networkconnectivity<C>,
20495 _name: String,
20496 _request_id: Option<String>,
20497 _etag: Option<String>,
20498 _delegate: Option<&'a mut dyn common::Delegate>,
20499 _additional_params: HashMap<String, String>,
20500 _scopes: BTreeSet<String>,
20501}
20502
20503impl<'a, C> common::CallBuilder for ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C> {}
20504
20505impl<'a, C> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C>
20506where
20507 C: common::Connector,
20508{
20509 /// Perform the operation you have build so far.
20510 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
20511 use std::borrow::Cow;
20512 use std::io::{Read, Seek};
20513
20514 use common::{url::Params, ToParts};
20515 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20516
20517 let mut dd = common::DefaultDelegate;
20518 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20519 dlg.begin(common::MethodInfo {
20520 id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.delete",
20521 http_method: hyper::Method::DELETE,
20522 });
20523
20524 for &field in ["alt", "name", "requestId", "etag"].iter() {
20525 if self._additional_params.contains_key(field) {
20526 dlg.finished(false);
20527 return Err(common::Error::FieldClash(field));
20528 }
20529 }
20530
20531 let mut params = Params::with_capacity(5 + self._additional_params.len());
20532 params.push("name", self._name);
20533 if let Some(value) = self._request_id.as_ref() {
20534 params.push("requestId", value);
20535 }
20536 if let Some(value) = self._etag.as_ref() {
20537 params.push("etag", value);
20538 }
20539
20540 params.extend(self._additional_params.iter());
20541
20542 params.push("alt", "json");
20543 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20544 if self._scopes.is_empty() {
20545 self._scopes
20546 .insert(Scope::CloudPlatform.as_ref().to_string());
20547 }
20548
20549 #[allow(clippy::single_element_loop)]
20550 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20551 url = params.uri_replacement(url, param_name, find_this, true);
20552 }
20553 {
20554 let to_remove = ["name"];
20555 params.remove_params(&to_remove);
20556 }
20557
20558 let url = params.parse_with_url(&url);
20559
20560 loop {
20561 let token = match self
20562 .hub
20563 .auth
20564 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20565 .await
20566 {
20567 Ok(token) => token,
20568 Err(e) => match dlg.token(e) {
20569 Ok(token) => token,
20570 Err(e) => {
20571 dlg.finished(false);
20572 return Err(common::Error::MissingToken(e));
20573 }
20574 },
20575 };
20576 let mut req_result = {
20577 let client = &self.hub.client;
20578 dlg.pre_request();
20579 let mut req_builder = hyper::Request::builder()
20580 .method(hyper::Method::DELETE)
20581 .uri(url.as_str())
20582 .header(USER_AGENT, self.hub._user_agent.clone());
20583
20584 if let Some(token) = token.as_ref() {
20585 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20586 }
20587
20588 let request = req_builder
20589 .header(CONTENT_LENGTH, 0_u64)
20590 .body(common::to_body::<String>(None));
20591
20592 client.request(request.unwrap()).await
20593 };
20594
20595 match req_result {
20596 Err(err) => {
20597 if let common::Retry::After(d) = dlg.http_error(&err) {
20598 sleep(d).await;
20599 continue;
20600 }
20601 dlg.finished(false);
20602 return Err(common::Error::HttpError(err));
20603 }
20604 Ok(res) => {
20605 let (mut parts, body) = res.into_parts();
20606 let mut body = common::Body::new(body);
20607 if !parts.status.is_success() {
20608 let bytes = common::to_bytes(body).await.unwrap_or_default();
20609 let error = serde_json::from_str(&common::to_string(&bytes));
20610 let response = common::to_response(parts, bytes.into());
20611
20612 if let common::Retry::After(d) =
20613 dlg.http_failure(&response, error.as_ref().ok())
20614 {
20615 sleep(d).await;
20616 continue;
20617 }
20618
20619 dlg.finished(false);
20620
20621 return Err(match error {
20622 Ok(value) => common::Error::BadRequest(value),
20623 _ => common::Error::Failure(response),
20624 });
20625 }
20626 let response = {
20627 let bytes = common::to_bytes(body).await.unwrap_or_default();
20628 let encoded = common::to_string(&bytes);
20629 match serde_json::from_str(&encoded) {
20630 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20631 Err(error) => {
20632 dlg.response_json_decode_error(&encoded, &error);
20633 return Err(common::Error::JsonDecodeError(
20634 encoded.to_string(),
20635 error,
20636 ));
20637 }
20638 }
20639 };
20640
20641 dlg.finished(true);
20642 return Ok(response);
20643 }
20644 }
20645 }
20646 }
20647
20648 /// Required. The name of the `MulticloudDataTransferConfig` resource to delete.
20649 ///
20650 /// Sets the *name* path property to the given value.
20651 ///
20652 /// Even though the property as already been set when instantiating this call,
20653 /// we provide this method for API completeness.
20654 pub fn name(
20655 mut self,
20656 new_value: &str,
20657 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C> {
20658 self._name = new_value.to_string();
20659 self
20660 }
20661 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server can ignore the request if it has already been completed. The server waits for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, can ignore the second request. This prevents clients from accidentally creating duplicate `MulticloudDataTransferConfig` resources. The request ID must be a valid UUID with the exception that zero UUID (00000000-0000-0000-0000-000000000000) isn't supported.
20662 ///
20663 /// Sets the *request id* query property to the given value.
20664 pub fn request_id(
20665 mut self,
20666 new_value: &str,
20667 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C> {
20668 self._request_id = Some(new_value.to_string());
20669 self
20670 }
20671 /// Optional. The etag is computed by the server, and might be sent with update and delete requests so that the client has an up-to-date value before proceeding.
20672 ///
20673 /// Sets the *etag* query property to the given value.
20674 pub fn etag(
20675 mut self,
20676 new_value: &str,
20677 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C> {
20678 self._etag = Some(new_value.to_string());
20679 self
20680 }
20681 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20682 /// while executing the actual API request.
20683 ///
20684 /// ````text
20685 /// It should be used to handle progress information, and to implement a certain level of resilience.
20686 /// ````
20687 ///
20688 /// Sets the *delegate* property to the given value.
20689 pub fn delegate(
20690 mut self,
20691 new_value: &'a mut dyn common::Delegate,
20692 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C> {
20693 self._delegate = Some(new_value);
20694 self
20695 }
20696
20697 /// Set any additional parameter of the query string used in the request.
20698 /// It should be used to set parameters which are not yet available through their own
20699 /// setters.
20700 ///
20701 /// Please note that this method must not be used to set any of the known parameters
20702 /// which have their own setter method. If done anyway, the request will fail.
20703 ///
20704 /// # Additional Parameters
20705 ///
20706 /// * *$.xgafv* (query-string) - V1 error format.
20707 /// * *access_token* (query-string) - OAuth access token.
20708 /// * *alt* (query-string) - Data format for response.
20709 /// * *callback* (query-string) - JSONP
20710 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20711 /// * *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.
20712 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20713 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20714 /// * *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.
20715 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20716 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20717 pub fn param<T>(
20718 mut self,
20719 name: T,
20720 value: T,
20721 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C>
20722 where
20723 T: AsRef<str>,
20724 {
20725 self._additional_params
20726 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20727 self
20728 }
20729
20730 /// Identifies the authorization scope for the method you are building.
20731 ///
20732 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20733 /// [`Scope::CloudPlatform`].
20734 ///
20735 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20736 /// tokens for more than one scope.
20737 ///
20738 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20739 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20740 /// sufficient, a read-write scope will do as well.
20741 pub fn add_scope<St>(
20742 mut self,
20743 scope: St,
20744 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C>
20745 where
20746 St: AsRef<str>,
20747 {
20748 self._scopes.insert(String::from(scope.as_ref()));
20749 self
20750 }
20751 /// Identifies the authorization scope(s) for the method you are building.
20752 ///
20753 /// See [`Self::add_scope()`] for details.
20754 pub fn add_scopes<I, St>(
20755 mut self,
20756 scopes: I,
20757 ) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C>
20758 where
20759 I: IntoIterator<Item = St>,
20760 St: AsRef<str>,
20761 {
20762 self._scopes
20763 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20764 self
20765 }
20766
20767 /// Removes all scopes, and no default scope will be used either.
20768 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20769 /// for details).
20770 pub fn clear_scopes(mut self) -> ProjectLocationMulticloudDataTransferConfigDeleteCall<'a, C> {
20771 self._scopes.clear();
20772 self
20773 }
20774}
20775
20776/// Gets the details of a `MulticloudDataTransferConfig` resource.
20777///
20778/// A builder for the *locations.multicloudDataTransferConfigs.get* method supported by a *project* resource.
20779/// It is not used directly, but through a [`ProjectMethods`] instance.
20780///
20781/// # Example
20782///
20783/// Instantiate a resource method builder
20784///
20785/// ```test_harness,no_run
20786/// # extern crate hyper;
20787/// # extern crate hyper_rustls;
20788/// # extern crate google_networkconnectivity1 as networkconnectivity1;
20789/// # async fn dox() {
20790/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20791///
20792/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20793/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20794/// # .with_native_roots()
20795/// # .unwrap()
20796/// # .https_only()
20797/// # .enable_http2()
20798/// # .build();
20799///
20800/// # let executor = hyper_util::rt::TokioExecutor::new();
20801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20802/// # secret,
20803/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20804/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20805/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20806/// # ),
20807/// # ).build().await.unwrap();
20808///
20809/// # let client = hyper_util::client::legacy::Client::builder(
20810/// # hyper_util::rt::TokioExecutor::new()
20811/// # )
20812/// # .build(
20813/// # hyper_rustls::HttpsConnectorBuilder::new()
20814/// # .with_native_roots()
20815/// # .unwrap()
20816/// # .https_or_http()
20817/// # .enable_http2()
20818/// # .build()
20819/// # );
20820/// # let mut hub = Networkconnectivity::new(client, auth);
20821/// // You can configure optional parameters by calling the respective setters at will, and
20822/// // execute the final call using `doit()`.
20823/// // Values shown here are possibly random and not representative !
20824/// let result = hub.projects().locations_multicloud_data_transfer_configs_get("name")
20825/// .doit().await;
20826/// # }
20827/// ```
20828pub struct ProjectLocationMulticloudDataTransferConfigGetCall<'a, C>
20829where
20830 C: 'a,
20831{
20832 hub: &'a Networkconnectivity<C>,
20833 _name: String,
20834 _delegate: Option<&'a mut dyn common::Delegate>,
20835 _additional_params: HashMap<String, String>,
20836 _scopes: BTreeSet<String>,
20837}
20838
20839impl<'a, C> common::CallBuilder for ProjectLocationMulticloudDataTransferConfigGetCall<'a, C> {}
20840
20841impl<'a, C> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C>
20842where
20843 C: common::Connector,
20844{
20845 /// Perform the operation you have build so far.
20846 pub async fn doit(
20847 mut self,
20848 ) -> common::Result<(common::Response, MulticloudDataTransferConfig)> {
20849 use std::borrow::Cow;
20850 use std::io::{Read, Seek};
20851
20852 use common::{url::Params, ToParts};
20853 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20854
20855 let mut dd = common::DefaultDelegate;
20856 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20857 dlg.begin(common::MethodInfo {
20858 id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.get",
20859 http_method: hyper::Method::GET,
20860 });
20861
20862 for &field in ["alt", "name"].iter() {
20863 if self._additional_params.contains_key(field) {
20864 dlg.finished(false);
20865 return Err(common::Error::FieldClash(field));
20866 }
20867 }
20868
20869 let mut params = Params::with_capacity(3 + self._additional_params.len());
20870 params.push("name", self._name);
20871
20872 params.extend(self._additional_params.iter());
20873
20874 params.push("alt", "json");
20875 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20876 if self._scopes.is_empty() {
20877 self._scopes
20878 .insert(Scope::CloudPlatform.as_ref().to_string());
20879 }
20880
20881 #[allow(clippy::single_element_loop)]
20882 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20883 url = params.uri_replacement(url, param_name, find_this, true);
20884 }
20885 {
20886 let to_remove = ["name"];
20887 params.remove_params(&to_remove);
20888 }
20889
20890 let url = params.parse_with_url(&url);
20891
20892 loop {
20893 let token = match self
20894 .hub
20895 .auth
20896 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20897 .await
20898 {
20899 Ok(token) => token,
20900 Err(e) => match dlg.token(e) {
20901 Ok(token) => token,
20902 Err(e) => {
20903 dlg.finished(false);
20904 return Err(common::Error::MissingToken(e));
20905 }
20906 },
20907 };
20908 let mut req_result = {
20909 let client = &self.hub.client;
20910 dlg.pre_request();
20911 let mut req_builder = hyper::Request::builder()
20912 .method(hyper::Method::GET)
20913 .uri(url.as_str())
20914 .header(USER_AGENT, self.hub._user_agent.clone());
20915
20916 if let Some(token) = token.as_ref() {
20917 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20918 }
20919
20920 let request = req_builder
20921 .header(CONTENT_LENGTH, 0_u64)
20922 .body(common::to_body::<String>(None));
20923
20924 client.request(request.unwrap()).await
20925 };
20926
20927 match req_result {
20928 Err(err) => {
20929 if let common::Retry::After(d) = dlg.http_error(&err) {
20930 sleep(d).await;
20931 continue;
20932 }
20933 dlg.finished(false);
20934 return Err(common::Error::HttpError(err));
20935 }
20936 Ok(res) => {
20937 let (mut parts, body) = res.into_parts();
20938 let mut body = common::Body::new(body);
20939 if !parts.status.is_success() {
20940 let bytes = common::to_bytes(body).await.unwrap_or_default();
20941 let error = serde_json::from_str(&common::to_string(&bytes));
20942 let response = common::to_response(parts, bytes.into());
20943
20944 if let common::Retry::After(d) =
20945 dlg.http_failure(&response, error.as_ref().ok())
20946 {
20947 sleep(d).await;
20948 continue;
20949 }
20950
20951 dlg.finished(false);
20952
20953 return Err(match error {
20954 Ok(value) => common::Error::BadRequest(value),
20955 _ => common::Error::Failure(response),
20956 });
20957 }
20958 let response = {
20959 let bytes = common::to_bytes(body).await.unwrap_or_default();
20960 let encoded = common::to_string(&bytes);
20961 match serde_json::from_str(&encoded) {
20962 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20963 Err(error) => {
20964 dlg.response_json_decode_error(&encoded, &error);
20965 return Err(common::Error::JsonDecodeError(
20966 encoded.to_string(),
20967 error,
20968 ));
20969 }
20970 }
20971 };
20972
20973 dlg.finished(true);
20974 return Ok(response);
20975 }
20976 }
20977 }
20978 }
20979
20980 /// Required. The name of the `MulticloudDataTransferConfig` resource to get.
20981 ///
20982 /// Sets the *name* path property to the given value.
20983 ///
20984 /// Even though the property as already been set when instantiating this call,
20985 /// we provide this method for API completeness.
20986 pub fn name(
20987 mut self,
20988 new_value: &str,
20989 ) -> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C> {
20990 self._name = new_value.to_string();
20991 self
20992 }
20993 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20994 /// while executing the actual API request.
20995 ///
20996 /// ````text
20997 /// It should be used to handle progress information, and to implement a certain level of resilience.
20998 /// ````
20999 ///
21000 /// Sets the *delegate* property to the given value.
21001 pub fn delegate(
21002 mut self,
21003 new_value: &'a mut dyn common::Delegate,
21004 ) -> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C> {
21005 self._delegate = Some(new_value);
21006 self
21007 }
21008
21009 /// Set any additional parameter of the query string used in the request.
21010 /// It should be used to set parameters which are not yet available through their own
21011 /// setters.
21012 ///
21013 /// Please note that this method must not be used to set any of the known parameters
21014 /// which have their own setter method. If done anyway, the request will fail.
21015 ///
21016 /// # Additional Parameters
21017 ///
21018 /// * *$.xgafv* (query-string) - V1 error format.
21019 /// * *access_token* (query-string) - OAuth access token.
21020 /// * *alt* (query-string) - Data format for response.
21021 /// * *callback* (query-string) - JSONP
21022 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21023 /// * *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.
21024 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21025 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21026 /// * *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.
21027 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21028 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21029 pub fn param<T>(
21030 mut self,
21031 name: T,
21032 value: T,
21033 ) -> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C>
21034 where
21035 T: AsRef<str>,
21036 {
21037 self._additional_params
21038 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21039 self
21040 }
21041
21042 /// Identifies the authorization scope for the method you are building.
21043 ///
21044 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21045 /// [`Scope::CloudPlatform`].
21046 ///
21047 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21048 /// tokens for more than one scope.
21049 ///
21050 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21051 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21052 /// sufficient, a read-write scope will do as well.
21053 pub fn add_scope<St>(
21054 mut self,
21055 scope: St,
21056 ) -> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C>
21057 where
21058 St: AsRef<str>,
21059 {
21060 self._scopes.insert(String::from(scope.as_ref()));
21061 self
21062 }
21063 /// Identifies the authorization scope(s) for the method you are building.
21064 ///
21065 /// See [`Self::add_scope()`] for details.
21066 pub fn add_scopes<I, St>(
21067 mut self,
21068 scopes: I,
21069 ) -> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C>
21070 where
21071 I: IntoIterator<Item = St>,
21072 St: AsRef<str>,
21073 {
21074 self._scopes
21075 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21076 self
21077 }
21078
21079 /// Removes all scopes, and no default scope will be used either.
21080 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21081 /// for details).
21082 pub fn clear_scopes(mut self) -> ProjectLocationMulticloudDataTransferConfigGetCall<'a, C> {
21083 self._scopes.clear();
21084 self
21085 }
21086}
21087
21088/// Lists the `MulticloudDataTransferConfig` resources in a specified project and location.
21089///
21090/// A builder for the *locations.multicloudDataTransferConfigs.list* method supported by a *project* resource.
21091/// It is not used directly, but through a [`ProjectMethods`] instance.
21092///
21093/// # Example
21094///
21095/// Instantiate a resource method builder
21096///
21097/// ```test_harness,no_run
21098/// # extern crate hyper;
21099/// # extern crate hyper_rustls;
21100/// # extern crate google_networkconnectivity1 as networkconnectivity1;
21101/// # async fn dox() {
21102/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21103///
21104/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21105/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21106/// # .with_native_roots()
21107/// # .unwrap()
21108/// # .https_only()
21109/// # .enable_http2()
21110/// # .build();
21111///
21112/// # let executor = hyper_util::rt::TokioExecutor::new();
21113/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21114/// # secret,
21115/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21116/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21117/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21118/// # ),
21119/// # ).build().await.unwrap();
21120///
21121/// # let client = hyper_util::client::legacy::Client::builder(
21122/// # hyper_util::rt::TokioExecutor::new()
21123/// # )
21124/// # .build(
21125/// # hyper_rustls::HttpsConnectorBuilder::new()
21126/// # .with_native_roots()
21127/// # .unwrap()
21128/// # .https_or_http()
21129/// # .enable_http2()
21130/// # .build()
21131/// # );
21132/// # let mut hub = Networkconnectivity::new(client, auth);
21133/// // You can configure optional parameters by calling the respective setters at will, and
21134/// // execute the final call using `doit()`.
21135/// // Values shown here are possibly random and not representative !
21136/// let result = hub.projects().locations_multicloud_data_transfer_configs_list("parent")
21137/// .return_partial_success(false)
21138/// .page_token("consetetur")
21139/// .page_size(-65)
21140/// .order_by("est")
21141/// .filter("aliquyam")
21142/// .doit().await;
21143/// # }
21144/// ```
21145pub struct ProjectLocationMulticloudDataTransferConfigListCall<'a, C>
21146where
21147 C: 'a,
21148{
21149 hub: &'a Networkconnectivity<C>,
21150 _parent: String,
21151 _return_partial_success: Option<bool>,
21152 _page_token: Option<String>,
21153 _page_size: Option<i32>,
21154 _order_by: Option<String>,
21155 _filter: Option<String>,
21156 _delegate: Option<&'a mut dyn common::Delegate>,
21157 _additional_params: HashMap<String, String>,
21158 _scopes: BTreeSet<String>,
21159}
21160
21161impl<'a, C> common::CallBuilder for ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {}
21162
21163impl<'a, C> ProjectLocationMulticloudDataTransferConfigListCall<'a, C>
21164where
21165 C: common::Connector,
21166{
21167 /// Perform the operation you have build so far.
21168 pub async fn doit(
21169 mut self,
21170 ) -> common::Result<(common::Response, ListMulticloudDataTransferConfigsResponse)> {
21171 use std::borrow::Cow;
21172 use std::io::{Read, Seek};
21173
21174 use common::{url::Params, ToParts};
21175 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21176
21177 let mut dd = common::DefaultDelegate;
21178 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21179 dlg.begin(common::MethodInfo {
21180 id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.list",
21181 http_method: hyper::Method::GET,
21182 });
21183
21184 for &field in [
21185 "alt",
21186 "parent",
21187 "returnPartialSuccess",
21188 "pageToken",
21189 "pageSize",
21190 "orderBy",
21191 "filter",
21192 ]
21193 .iter()
21194 {
21195 if self._additional_params.contains_key(field) {
21196 dlg.finished(false);
21197 return Err(common::Error::FieldClash(field));
21198 }
21199 }
21200
21201 let mut params = Params::with_capacity(8 + self._additional_params.len());
21202 params.push("parent", self._parent);
21203 if let Some(value) = self._return_partial_success.as_ref() {
21204 params.push("returnPartialSuccess", value.to_string());
21205 }
21206 if let Some(value) = self._page_token.as_ref() {
21207 params.push("pageToken", value);
21208 }
21209 if let Some(value) = self._page_size.as_ref() {
21210 params.push("pageSize", value.to_string());
21211 }
21212 if let Some(value) = self._order_by.as_ref() {
21213 params.push("orderBy", value);
21214 }
21215 if let Some(value) = self._filter.as_ref() {
21216 params.push("filter", value);
21217 }
21218
21219 params.extend(self._additional_params.iter());
21220
21221 params.push("alt", "json");
21222 let mut url = self.hub._base_url.clone() + "v1/{+parent}/multicloudDataTransferConfigs";
21223 if self._scopes.is_empty() {
21224 self._scopes
21225 .insert(Scope::CloudPlatform.as_ref().to_string());
21226 }
21227
21228 #[allow(clippy::single_element_loop)]
21229 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21230 url = params.uri_replacement(url, param_name, find_this, true);
21231 }
21232 {
21233 let to_remove = ["parent"];
21234 params.remove_params(&to_remove);
21235 }
21236
21237 let url = params.parse_with_url(&url);
21238
21239 loop {
21240 let token = match self
21241 .hub
21242 .auth
21243 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21244 .await
21245 {
21246 Ok(token) => token,
21247 Err(e) => match dlg.token(e) {
21248 Ok(token) => token,
21249 Err(e) => {
21250 dlg.finished(false);
21251 return Err(common::Error::MissingToken(e));
21252 }
21253 },
21254 };
21255 let mut req_result = {
21256 let client = &self.hub.client;
21257 dlg.pre_request();
21258 let mut req_builder = hyper::Request::builder()
21259 .method(hyper::Method::GET)
21260 .uri(url.as_str())
21261 .header(USER_AGENT, self.hub._user_agent.clone());
21262
21263 if let Some(token) = token.as_ref() {
21264 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21265 }
21266
21267 let request = req_builder
21268 .header(CONTENT_LENGTH, 0_u64)
21269 .body(common::to_body::<String>(None));
21270
21271 client.request(request.unwrap()).await
21272 };
21273
21274 match req_result {
21275 Err(err) => {
21276 if let common::Retry::After(d) = dlg.http_error(&err) {
21277 sleep(d).await;
21278 continue;
21279 }
21280 dlg.finished(false);
21281 return Err(common::Error::HttpError(err));
21282 }
21283 Ok(res) => {
21284 let (mut parts, body) = res.into_parts();
21285 let mut body = common::Body::new(body);
21286 if !parts.status.is_success() {
21287 let bytes = common::to_bytes(body).await.unwrap_or_default();
21288 let error = serde_json::from_str(&common::to_string(&bytes));
21289 let response = common::to_response(parts, bytes.into());
21290
21291 if let common::Retry::After(d) =
21292 dlg.http_failure(&response, error.as_ref().ok())
21293 {
21294 sleep(d).await;
21295 continue;
21296 }
21297
21298 dlg.finished(false);
21299
21300 return Err(match error {
21301 Ok(value) => common::Error::BadRequest(value),
21302 _ => common::Error::Failure(response),
21303 });
21304 }
21305 let response = {
21306 let bytes = common::to_bytes(body).await.unwrap_or_default();
21307 let encoded = common::to_string(&bytes);
21308 match serde_json::from_str(&encoded) {
21309 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21310 Err(error) => {
21311 dlg.response_json_decode_error(&encoded, &error);
21312 return Err(common::Error::JsonDecodeError(
21313 encoded.to_string(),
21314 error,
21315 ));
21316 }
21317 }
21318 };
21319
21320 dlg.finished(true);
21321 return Ok(response);
21322 }
21323 }
21324 }
21325 }
21326
21327 /// Required. The name of the parent resource.
21328 ///
21329 /// Sets the *parent* path property to the given value.
21330 ///
21331 /// Even though the property as already been set when instantiating this call,
21332 /// we provide this method for API completeness.
21333 pub fn parent(
21334 mut self,
21335 new_value: &str,
21336 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21337 self._parent = new_value.to_string();
21338 self
21339 }
21340 /// Optional. If `true`, allows partial responses for multi-regional aggregated list requests.
21341 ///
21342 /// Sets the *return partial success* query property to the given value.
21343 pub fn return_partial_success(
21344 mut self,
21345 new_value: bool,
21346 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21347 self._return_partial_success = Some(new_value);
21348 self
21349 }
21350 /// Optional. The page token.
21351 ///
21352 /// Sets the *page token* query property to the given value.
21353 pub fn page_token(
21354 mut self,
21355 new_value: &str,
21356 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21357 self._page_token = Some(new_value.to_string());
21358 self
21359 }
21360 /// Optional. The maximum number of results listed per page.
21361 ///
21362 /// Sets the *page size* query property to the given value.
21363 pub fn page_size(
21364 mut self,
21365 new_value: i32,
21366 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21367 self._page_size = Some(new_value);
21368 self
21369 }
21370 /// Optional. The sort order of the results.
21371 ///
21372 /// Sets the *order by* query property to the given value.
21373 pub fn order_by(
21374 mut self,
21375 new_value: &str,
21376 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21377 self._order_by = Some(new_value.to_string());
21378 self
21379 }
21380 /// Optional. An expression that filters the results listed in the response.
21381 ///
21382 /// Sets the *filter* query property to the given value.
21383 pub fn filter(
21384 mut self,
21385 new_value: &str,
21386 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21387 self._filter = Some(new_value.to_string());
21388 self
21389 }
21390 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21391 /// while executing the actual API request.
21392 ///
21393 /// ````text
21394 /// It should be used to handle progress information, and to implement a certain level of resilience.
21395 /// ````
21396 ///
21397 /// Sets the *delegate* property to the given value.
21398 pub fn delegate(
21399 mut self,
21400 new_value: &'a mut dyn common::Delegate,
21401 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21402 self._delegate = Some(new_value);
21403 self
21404 }
21405
21406 /// Set any additional parameter of the query string used in the request.
21407 /// It should be used to set parameters which are not yet available through their own
21408 /// setters.
21409 ///
21410 /// Please note that this method must not be used to set any of the known parameters
21411 /// which have their own setter method. If done anyway, the request will fail.
21412 ///
21413 /// # Additional Parameters
21414 ///
21415 /// * *$.xgafv* (query-string) - V1 error format.
21416 /// * *access_token* (query-string) - OAuth access token.
21417 /// * *alt* (query-string) - Data format for response.
21418 /// * *callback* (query-string) - JSONP
21419 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21420 /// * *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.
21421 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21422 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21423 /// * *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.
21424 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21425 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21426 pub fn param<T>(
21427 mut self,
21428 name: T,
21429 value: T,
21430 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C>
21431 where
21432 T: AsRef<str>,
21433 {
21434 self._additional_params
21435 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21436 self
21437 }
21438
21439 /// Identifies the authorization scope for the method you are building.
21440 ///
21441 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21442 /// [`Scope::CloudPlatform`].
21443 ///
21444 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21445 /// tokens for more than one scope.
21446 ///
21447 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21448 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21449 /// sufficient, a read-write scope will do as well.
21450 pub fn add_scope<St>(
21451 mut self,
21452 scope: St,
21453 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C>
21454 where
21455 St: AsRef<str>,
21456 {
21457 self._scopes.insert(String::from(scope.as_ref()));
21458 self
21459 }
21460 /// Identifies the authorization scope(s) for the method you are building.
21461 ///
21462 /// See [`Self::add_scope()`] for details.
21463 pub fn add_scopes<I, St>(
21464 mut self,
21465 scopes: I,
21466 ) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C>
21467 where
21468 I: IntoIterator<Item = St>,
21469 St: AsRef<str>,
21470 {
21471 self._scopes
21472 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21473 self
21474 }
21475
21476 /// Removes all scopes, and no default scope will be used either.
21477 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21478 /// for details).
21479 pub fn clear_scopes(mut self) -> ProjectLocationMulticloudDataTransferConfigListCall<'a, C> {
21480 self._scopes.clear();
21481 self
21482 }
21483}
21484
21485/// Updates a `MulticloudDataTransferConfig` resource in a specified project and location.
21486///
21487/// A builder for the *locations.multicloudDataTransferConfigs.patch* method supported by a *project* resource.
21488/// It is not used directly, but through a [`ProjectMethods`] instance.
21489///
21490/// # Example
21491///
21492/// Instantiate a resource method builder
21493///
21494/// ```test_harness,no_run
21495/// # extern crate hyper;
21496/// # extern crate hyper_rustls;
21497/// # extern crate google_networkconnectivity1 as networkconnectivity1;
21498/// use networkconnectivity1::api::MulticloudDataTransferConfig;
21499/// # async fn dox() {
21500/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21501///
21502/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21503/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21504/// # .with_native_roots()
21505/// # .unwrap()
21506/// # .https_only()
21507/// # .enable_http2()
21508/// # .build();
21509///
21510/// # let executor = hyper_util::rt::TokioExecutor::new();
21511/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21512/// # secret,
21513/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21514/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21515/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21516/// # ),
21517/// # ).build().await.unwrap();
21518///
21519/// # let client = hyper_util::client::legacy::Client::builder(
21520/// # hyper_util::rt::TokioExecutor::new()
21521/// # )
21522/// # .build(
21523/// # hyper_rustls::HttpsConnectorBuilder::new()
21524/// # .with_native_roots()
21525/// # .unwrap()
21526/// # .https_or_http()
21527/// # .enable_http2()
21528/// # .build()
21529/// # );
21530/// # let mut hub = Networkconnectivity::new(client, auth);
21531/// // As the method needs a request, you would usually fill it with the desired information
21532/// // into the respective structure. Some of the parts shown here might not be applicable !
21533/// // Values shown here are possibly random and not representative !
21534/// let mut req = MulticloudDataTransferConfig::default();
21535///
21536/// // You can configure optional parameters by calling the respective setters at will, and
21537/// // execute the final call using `doit()`.
21538/// // Values shown here are possibly random and not representative !
21539/// let result = hub.projects().locations_multicloud_data_transfer_configs_patch(req, "name")
21540/// .update_mask(FieldMask::new::<&str>(&[]))
21541/// .request_id("duo")
21542/// .doit().await;
21543/// # }
21544/// ```
21545pub struct ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C>
21546where
21547 C: 'a,
21548{
21549 hub: &'a Networkconnectivity<C>,
21550 _request: MulticloudDataTransferConfig,
21551 _name: String,
21552 _update_mask: Option<common::FieldMask>,
21553 _request_id: Option<String>,
21554 _delegate: Option<&'a mut dyn common::Delegate>,
21555 _additional_params: HashMap<String, String>,
21556 _scopes: BTreeSet<String>,
21557}
21558
21559impl<'a, C> common::CallBuilder for ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {}
21560
21561impl<'a, C> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C>
21562where
21563 C: common::Connector,
21564{
21565 /// Perform the operation you have build so far.
21566 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
21567 use std::borrow::Cow;
21568 use std::io::{Read, Seek};
21569
21570 use common::{url::Params, ToParts};
21571 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21572
21573 let mut dd = common::DefaultDelegate;
21574 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21575 dlg.begin(common::MethodInfo {
21576 id: "networkconnectivity.projects.locations.multicloudDataTransferConfigs.patch",
21577 http_method: hyper::Method::PATCH,
21578 });
21579
21580 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
21581 if self._additional_params.contains_key(field) {
21582 dlg.finished(false);
21583 return Err(common::Error::FieldClash(field));
21584 }
21585 }
21586
21587 let mut params = Params::with_capacity(6 + self._additional_params.len());
21588 params.push("name", self._name);
21589 if let Some(value) = self._update_mask.as_ref() {
21590 params.push("updateMask", value.to_string());
21591 }
21592 if let Some(value) = self._request_id.as_ref() {
21593 params.push("requestId", value);
21594 }
21595
21596 params.extend(self._additional_params.iter());
21597
21598 params.push("alt", "json");
21599 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21600 if self._scopes.is_empty() {
21601 self._scopes
21602 .insert(Scope::CloudPlatform.as_ref().to_string());
21603 }
21604
21605 #[allow(clippy::single_element_loop)]
21606 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21607 url = params.uri_replacement(url, param_name, find_this, true);
21608 }
21609 {
21610 let to_remove = ["name"];
21611 params.remove_params(&to_remove);
21612 }
21613
21614 let url = params.parse_with_url(&url);
21615
21616 let mut json_mime_type = mime::APPLICATION_JSON;
21617 let mut request_value_reader = {
21618 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21619 common::remove_json_null_values(&mut value);
21620 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21621 serde_json::to_writer(&mut dst, &value).unwrap();
21622 dst
21623 };
21624 let request_size = request_value_reader
21625 .seek(std::io::SeekFrom::End(0))
21626 .unwrap();
21627 request_value_reader
21628 .seek(std::io::SeekFrom::Start(0))
21629 .unwrap();
21630
21631 loop {
21632 let token = match self
21633 .hub
21634 .auth
21635 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21636 .await
21637 {
21638 Ok(token) => token,
21639 Err(e) => match dlg.token(e) {
21640 Ok(token) => token,
21641 Err(e) => {
21642 dlg.finished(false);
21643 return Err(common::Error::MissingToken(e));
21644 }
21645 },
21646 };
21647 request_value_reader
21648 .seek(std::io::SeekFrom::Start(0))
21649 .unwrap();
21650 let mut req_result = {
21651 let client = &self.hub.client;
21652 dlg.pre_request();
21653 let mut req_builder = hyper::Request::builder()
21654 .method(hyper::Method::PATCH)
21655 .uri(url.as_str())
21656 .header(USER_AGENT, self.hub._user_agent.clone());
21657
21658 if let Some(token) = token.as_ref() {
21659 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21660 }
21661
21662 let request = req_builder
21663 .header(CONTENT_TYPE, json_mime_type.to_string())
21664 .header(CONTENT_LENGTH, request_size as u64)
21665 .body(common::to_body(
21666 request_value_reader.get_ref().clone().into(),
21667 ));
21668
21669 client.request(request.unwrap()).await
21670 };
21671
21672 match req_result {
21673 Err(err) => {
21674 if let common::Retry::After(d) = dlg.http_error(&err) {
21675 sleep(d).await;
21676 continue;
21677 }
21678 dlg.finished(false);
21679 return Err(common::Error::HttpError(err));
21680 }
21681 Ok(res) => {
21682 let (mut parts, body) = res.into_parts();
21683 let mut body = common::Body::new(body);
21684 if !parts.status.is_success() {
21685 let bytes = common::to_bytes(body).await.unwrap_or_default();
21686 let error = serde_json::from_str(&common::to_string(&bytes));
21687 let response = common::to_response(parts, bytes.into());
21688
21689 if let common::Retry::After(d) =
21690 dlg.http_failure(&response, error.as_ref().ok())
21691 {
21692 sleep(d).await;
21693 continue;
21694 }
21695
21696 dlg.finished(false);
21697
21698 return Err(match error {
21699 Ok(value) => common::Error::BadRequest(value),
21700 _ => common::Error::Failure(response),
21701 });
21702 }
21703 let response = {
21704 let bytes = common::to_bytes(body).await.unwrap_or_default();
21705 let encoded = common::to_string(&bytes);
21706 match serde_json::from_str(&encoded) {
21707 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21708 Err(error) => {
21709 dlg.response_json_decode_error(&encoded, &error);
21710 return Err(common::Error::JsonDecodeError(
21711 encoded.to_string(),
21712 error,
21713 ));
21714 }
21715 }
21716 };
21717
21718 dlg.finished(true);
21719 return Ok(response);
21720 }
21721 }
21722 }
21723 }
21724
21725 ///
21726 /// Sets the *request* property to the given value.
21727 ///
21728 /// Even though the property as already been set when instantiating this call,
21729 /// we provide this method for API completeness.
21730 pub fn request(
21731 mut self,
21732 new_value: MulticloudDataTransferConfig,
21733 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {
21734 self._request = new_value;
21735 self
21736 }
21737 /// Identifier. The name of the `MulticloudDataTransferConfig` resource. Format: `projects/{project}/locations/{location}/multicloudDataTransferConfigs/{multicloud_data_transfer_config}`.
21738 ///
21739 /// Sets the *name* path property to the given value.
21740 ///
21741 /// Even though the property as already been set when instantiating this call,
21742 /// we provide this method for API completeness.
21743 pub fn name(
21744 mut self,
21745 new_value: &str,
21746 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {
21747 self._name = new_value.to_string();
21748 self
21749 }
21750 /// Optional. `FieldMask` is used to specify the fields in the `MulticloudDataTransferConfig` resource to be overwritten by the update. The fields specified in `update_mask` are relative to the resource, not the full request. A field is overwritten if it is in the mask. If you don't specify a mask, all fields are overwritten.
21751 ///
21752 /// Sets the *update mask* query property to the given value.
21753 pub fn update_mask(
21754 mut self,
21755 new_value: common::FieldMask,
21756 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {
21757 self._update_mask = Some(new_value);
21758 self
21759 }
21760 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server can ignore the request if it has already been completed. The server waits for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, can ignore the second request. This prevents clients from accidentally creating duplicate `MulticloudDataTransferConfig` resources. The request ID must be a valid UUID with the exception that zero UUID (00000000-0000-0000-0000-000000000000) isn't supported.
21761 ///
21762 /// Sets the *request id* query property to the given value.
21763 pub fn request_id(
21764 mut self,
21765 new_value: &str,
21766 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {
21767 self._request_id = Some(new_value.to_string());
21768 self
21769 }
21770 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21771 /// while executing the actual API request.
21772 ///
21773 /// ````text
21774 /// It should be used to handle progress information, and to implement a certain level of resilience.
21775 /// ````
21776 ///
21777 /// Sets the *delegate* property to the given value.
21778 pub fn delegate(
21779 mut self,
21780 new_value: &'a mut dyn common::Delegate,
21781 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {
21782 self._delegate = Some(new_value);
21783 self
21784 }
21785
21786 /// Set any additional parameter of the query string used in the request.
21787 /// It should be used to set parameters which are not yet available through their own
21788 /// setters.
21789 ///
21790 /// Please note that this method must not be used to set any of the known parameters
21791 /// which have their own setter method. If done anyway, the request will fail.
21792 ///
21793 /// # Additional Parameters
21794 ///
21795 /// * *$.xgafv* (query-string) - V1 error format.
21796 /// * *access_token* (query-string) - OAuth access token.
21797 /// * *alt* (query-string) - Data format for response.
21798 /// * *callback* (query-string) - JSONP
21799 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21800 /// * *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.
21801 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21802 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21803 /// * *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.
21804 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21805 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21806 pub fn param<T>(
21807 mut self,
21808 name: T,
21809 value: T,
21810 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C>
21811 where
21812 T: AsRef<str>,
21813 {
21814 self._additional_params
21815 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21816 self
21817 }
21818
21819 /// Identifies the authorization scope for the method you are building.
21820 ///
21821 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21822 /// [`Scope::CloudPlatform`].
21823 ///
21824 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21825 /// tokens for more than one scope.
21826 ///
21827 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21828 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21829 /// sufficient, a read-write scope will do as well.
21830 pub fn add_scope<St>(
21831 mut self,
21832 scope: St,
21833 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C>
21834 where
21835 St: AsRef<str>,
21836 {
21837 self._scopes.insert(String::from(scope.as_ref()));
21838 self
21839 }
21840 /// Identifies the authorization scope(s) for the method you are building.
21841 ///
21842 /// See [`Self::add_scope()`] for details.
21843 pub fn add_scopes<I, St>(
21844 mut self,
21845 scopes: I,
21846 ) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C>
21847 where
21848 I: IntoIterator<Item = St>,
21849 St: AsRef<str>,
21850 {
21851 self._scopes
21852 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21853 self
21854 }
21855
21856 /// Removes all scopes, and no default scope will be used either.
21857 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21858 /// for details).
21859 pub fn clear_scopes(mut self) -> ProjectLocationMulticloudDataTransferConfigPatchCall<'a, C> {
21860 self._scopes.clear();
21861 self
21862 }
21863}
21864
21865/// Gets the details of a service that is supported for Data Transfer Essentials.
21866///
21867/// A builder for the *locations.multicloudDataTransferSupportedServices.get* method supported by a *project* resource.
21868/// It is not used directly, but through a [`ProjectMethods`] instance.
21869///
21870/// # Example
21871///
21872/// Instantiate a resource method builder
21873///
21874/// ```test_harness,no_run
21875/// # extern crate hyper;
21876/// # extern crate hyper_rustls;
21877/// # extern crate google_networkconnectivity1 as networkconnectivity1;
21878/// # async fn dox() {
21879/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21880///
21881/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21882/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21883/// # .with_native_roots()
21884/// # .unwrap()
21885/// # .https_only()
21886/// # .enable_http2()
21887/// # .build();
21888///
21889/// # let executor = hyper_util::rt::TokioExecutor::new();
21890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21891/// # secret,
21892/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21893/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21894/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21895/// # ),
21896/// # ).build().await.unwrap();
21897///
21898/// # let client = hyper_util::client::legacy::Client::builder(
21899/// # hyper_util::rt::TokioExecutor::new()
21900/// # )
21901/// # .build(
21902/// # hyper_rustls::HttpsConnectorBuilder::new()
21903/// # .with_native_roots()
21904/// # .unwrap()
21905/// # .https_or_http()
21906/// # .enable_http2()
21907/// # .build()
21908/// # );
21909/// # let mut hub = Networkconnectivity::new(client, auth);
21910/// // You can configure optional parameters by calling the respective setters at will, and
21911/// // execute the final call using `doit()`.
21912/// // Values shown here are possibly random and not representative !
21913/// let result = hub.projects().locations_multicloud_data_transfer_supported_services_get("name")
21914/// .doit().await;
21915/// # }
21916/// ```
21917pub struct ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C>
21918where
21919 C: 'a,
21920{
21921 hub: &'a Networkconnectivity<C>,
21922 _name: String,
21923 _delegate: Option<&'a mut dyn common::Delegate>,
21924 _additional_params: HashMap<String, String>,
21925 _scopes: BTreeSet<String>,
21926}
21927
21928impl<'a, C> common::CallBuilder
21929 for ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C>
21930{
21931}
21932
21933impl<'a, C> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C>
21934where
21935 C: common::Connector,
21936{
21937 /// Perform the operation you have build so far.
21938 pub async fn doit(
21939 mut self,
21940 ) -> common::Result<(common::Response, MulticloudDataTransferSupportedService)> {
21941 use std::borrow::Cow;
21942 use std::io::{Read, Seek};
21943
21944 use common::{url::Params, ToParts};
21945 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21946
21947 let mut dd = common::DefaultDelegate;
21948 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21949 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.multicloudDataTransferSupportedServices.get",
21950 http_method: hyper::Method::GET });
21951
21952 for &field in ["alt", "name"].iter() {
21953 if self._additional_params.contains_key(field) {
21954 dlg.finished(false);
21955 return Err(common::Error::FieldClash(field));
21956 }
21957 }
21958
21959 let mut params = Params::with_capacity(3 + self._additional_params.len());
21960 params.push("name", self._name);
21961
21962 params.extend(self._additional_params.iter());
21963
21964 params.push("alt", "json");
21965 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21966 if self._scopes.is_empty() {
21967 self._scopes
21968 .insert(Scope::CloudPlatform.as_ref().to_string());
21969 }
21970
21971 #[allow(clippy::single_element_loop)]
21972 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21973 url = params.uri_replacement(url, param_name, find_this, true);
21974 }
21975 {
21976 let to_remove = ["name"];
21977 params.remove_params(&to_remove);
21978 }
21979
21980 let url = params.parse_with_url(&url);
21981
21982 loop {
21983 let token = match self
21984 .hub
21985 .auth
21986 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21987 .await
21988 {
21989 Ok(token) => token,
21990 Err(e) => match dlg.token(e) {
21991 Ok(token) => token,
21992 Err(e) => {
21993 dlg.finished(false);
21994 return Err(common::Error::MissingToken(e));
21995 }
21996 },
21997 };
21998 let mut req_result = {
21999 let client = &self.hub.client;
22000 dlg.pre_request();
22001 let mut req_builder = hyper::Request::builder()
22002 .method(hyper::Method::GET)
22003 .uri(url.as_str())
22004 .header(USER_AGENT, self.hub._user_agent.clone());
22005
22006 if let Some(token) = token.as_ref() {
22007 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22008 }
22009
22010 let request = req_builder
22011 .header(CONTENT_LENGTH, 0_u64)
22012 .body(common::to_body::<String>(None));
22013
22014 client.request(request.unwrap()).await
22015 };
22016
22017 match req_result {
22018 Err(err) => {
22019 if let common::Retry::After(d) = dlg.http_error(&err) {
22020 sleep(d).await;
22021 continue;
22022 }
22023 dlg.finished(false);
22024 return Err(common::Error::HttpError(err));
22025 }
22026 Ok(res) => {
22027 let (mut parts, body) = res.into_parts();
22028 let mut body = common::Body::new(body);
22029 if !parts.status.is_success() {
22030 let bytes = common::to_bytes(body).await.unwrap_or_default();
22031 let error = serde_json::from_str(&common::to_string(&bytes));
22032 let response = common::to_response(parts, bytes.into());
22033
22034 if let common::Retry::After(d) =
22035 dlg.http_failure(&response, error.as_ref().ok())
22036 {
22037 sleep(d).await;
22038 continue;
22039 }
22040
22041 dlg.finished(false);
22042
22043 return Err(match error {
22044 Ok(value) => common::Error::BadRequest(value),
22045 _ => common::Error::Failure(response),
22046 });
22047 }
22048 let response = {
22049 let bytes = common::to_bytes(body).await.unwrap_or_default();
22050 let encoded = common::to_string(&bytes);
22051 match serde_json::from_str(&encoded) {
22052 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22053 Err(error) => {
22054 dlg.response_json_decode_error(&encoded, &error);
22055 return Err(common::Error::JsonDecodeError(
22056 encoded.to_string(),
22057 error,
22058 ));
22059 }
22060 }
22061 };
22062
22063 dlg.finished(true);
22064 return Ok(response);
22065 }
22066 }
22067 }
22068 }
22069
22070 /// Required. The name of the service.
22071 ///
22072 /// Sets the *name* path property to the given value.
22073 ///
22074 /// Even though the property as already been set when instantiating this call,
22075 /// we provide this method for API completeness.
22076 pub fn name(
22077 mut self,
22078 new_value: &str,
22079 ) -> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C> {
22080 self._name = new_value.to_string();
22081 self
22082 }
22083 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22084 /// while executing the actual API request.
22085 ///
22086 /// ````text
22087 /// It should be used to handle progress information, and to implement a certain level of resilience.
22088 /// ````
22089 ///
22090 /// Sets the *delegate* property to the given value.
22091 pub fn delegate(
22092 mut self,
22093 new_value: &'a mut dyn common::Delegate,
22094 ) -> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C> {
22095 self._delegate = Some(new_value);
22096 self
22097 }
22098
22099 /// Set any additional parameter of the query string used in the request.
22100 /// It should be used to set parameters which are not yet available through their own
22101 /// setters.
22102 ///
22103 /// Please note that this method must not be used to set any of the known parameters
22104 /// which have their own setter method. If done anyway, the request will fail.
22105 ///
22106 /// # Additional Parameters
22107 ///
22108 /// * *$.xgafv* (query-string) - V1 error format.
22109 /// * *access_token* (query-string) - OAuth access token.
22110 /// * *alt* (query-string) - Data format for response.
22111 /// * *callback* (query-string) - JSONP
22112 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22113 /// * *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.
22114 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22115 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22116 /// * *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.
22117 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22118 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22119 pub fn param<T>(
22120 mut self,
22121 name: T,
22122 value: T,
22123 ) -> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C>
22124 where
22125 T: AsRef<str>,
22126 {
22127 self._additional_params
22128 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22129 self
22130 }
22131
22132 /// Identifies the authorization scope for the method you are building.
22133 ///
22134 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22135 /// [`Scope::CloudPlatform`].
22136 ///
22137 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22138 /// tokens for more than one scope.
22139 ///
22140 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22141 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22142 /// sufficient, a read-write scope will do as well.
22143 pub fn add_scope<St>(
22144 mut self,
22145 scope: St,
22146 ) -> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C>
22147 where
22148 St: AsRef<str>,
22149 {
22150 self._scopes.insert(String::from(scope.as_ref()));
22151 self
22152 }
22153 /// Identifies the authorization scope(s) for the method you are building.
22154 ///
22155 /// See [`Self::add_scope()`] for details.
22156 pub fn add_scopes<I, St>(
22157 mut self,
22158 scopes: I,
22159 ) -> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C>
22160 where
22161 I: IntoIterator<Item = St>,
22162 St: AsRef<str>,
22163 {
22164 self._scopes
22165 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22166 self
22167 }
22168
22169 /// Removes all scopes, and no default scope will be used either.
22170 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22171 /// for details).
22172 pub fn clear_scopes(
22173 mut self,
22174 ) -> ProjectLocationMulticloudDataTransferSupportedServiceGetCall<'a, C> {
22175 self._scopes.clear();
22176 self
22177 }
22178}
22179
22180/// Lists the services in the project for a region that are supported for Data Transfer Essentials.
22181///
22182/// A builder for the *locations.multicloudDataTransferSupportedServices.list* method supported by a *project* resource.
22183/// It is not used directly, but through a [`ProjectMethods`] instance.
22184///
22185/// # Example
22186///
22187/// Instantiate a resource method builder
22188///
22189/// ```test_harness,no_run
22190/// # extern crate hyper;
22191/// # extern crate hyper_rustls;
22192/// # extern crate google_networkconnectivity1 as networkconnectivity1;
22193/// # async fn dox() {
22194/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22195///
22196/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22197/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22198/// # .with_native_roots()
22199/// # .unwrap()
22200/// # .https_only()
22201/// # .enable_http2()
22202/// # .build();
22203///
22204/// # let executor = hyper_util::rt::TokioExecutor::new();
22205/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22206/// # secret,
22207/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22208/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22209/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22210/// # ),
22211/// # ).build().await.unwrap();
22212///
22213/// # let client = hyper_util::client::legacy::Client::builder(
22214/// # hyper_util::rt::TokioExecutor::new()
22215/// # )
22216/// # .build(
22217/// # hyper_rustls::HttpsConnectorBuilder::new()
22218/// # .with_native_roots()
22219/// # .unwrap()
22220/// # .https_or_http()
22221/// # .enable_http2()
22222/// # .build()
22223/// # );
22224/// # let mut hub = Networkconnectivity::new(client, auth);
22225/// // You can configure optional parameters by calling the respective setters at will, and
22226/// // execute the final call using `doit()`.
22227/// // Values shown here are possibly random and not representative !
22228/// let result = hub.projects().locations_multicloud_data_transfer_supported_services_list("parent")
22229/// .page_token("sit")
22230/// .page_size(-93)
22231/// .doit().await;
22232/// # }
22233/// ```
22234pub struct ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C>
22235where
22236 C: 'a,
22237{
22238 hub: &'a Networkconnectivity<C>,
22239 _parent: String,
22240 _page_token: Option<String>,
22241 _page_size: Option<i32>,
22242 _delegate: Option<&'a mut dyn common::Delegate>,
22243 _additional_params: HashMap<String, String>,
22244 _scopes: BTreeSet<String>,
22245}
22246
22247impl<'a, C> common::CallBuilder
22248 for ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C>
22249{
22250}
22251
22252impl<'a, C> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C>
22253where
22254 C: common::Connector,
22255{
22256 /// Perform the operation you have build so far.
22257 pub async fn doit(
22258 mut self,
22259 ) -> common::Result<(
22260 common::Response,
22261 ListMulticloudDataTransferSupportedServicesResponse,
22262 )> {
22263 use std::borrow::Cow;
22264 use std::io::{Read, Seek};
22265
22266 use common::{url::Params, ToParts};
22267 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22268
22269 let mut dd = common::DefaultDelegate;
22270 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22271 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.multicloudDataTransferSupportedServices.list",
22272 http_method: hyper::Method::GET });
22273
22274 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
22275 if self._additional_params.contains_key(field) {
22276 dlg.finished(false);
22277 return Err(common::Error::FieldClash(field));
22278 }
22279 }
22280
22281 let mut params = Params::with_capacity(5 + self._additional_params.len());
22282 params.push("parent", self._parent);
22283 if let Some(value) = self._page_token.as_ref() {
22284 params.push("pageToken", value);
22285 }
22286 if let Some(value) = self._page_size.as_ref() {
22287 params.push("pageSize", value.to_string());
22288 }
22289
22290 params.extend(self._additional_params.iter());
22291
22292 params.push("alt", "json");
22293 let mut url =
22294 self.hub._base_url.clone() + "v1/{+parent}/multicloudDataTransferSupportedServices";
22295 if self._scopes.is_empty() {
22296 self._scopes
22297 .insert(Scope::CloudPlatform.as_ref().to_string());
22298 }
22299
22300 #[allow(clippy::single_element_loop)]
22301 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22302 url = params.uri_replacement(url, param_name, find_this, true);
22303 }
22304 {
22305 let to_remove = ["parent"];
22306 params.remove_params(&to_remove);
22307 }
22308
22309 let url = params.parse_with_url(&url);
22310
22311 loop {
22312 let token = match self
22313 .hub
22314 .auth
22315 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22316 .await
22317 {
22318 Ok(token) => token,
22319 Err(e) => match dlg.token(e) {
22320 Ok(token) => token,
22321 Err(e) => {
22322 dlg.finished(false);
22323 return Err(common::Error::MissingToken(e));
22324 }
22325 },
22326 };
22327 let mut req_result = {
22328 let client = &self.hub.client;
22329 dlg.pre_request();
22330 let mut req_builder = hyper::Request::builder()
22331 .method(hyper::Method::GET)
22332 .uri(url.as_str())
22333 .header(USER_AGENT, self.hub._user_agent.clone());
22334
22335 if let Some(token) = token.as_ref() {
22336 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22337 }
22338
22339 let request = req_builder
22340 .header(CONTENT_LENGTH, 0_u64)
22341 .body(common::to_body::<String>(None));
22342
22343 client.request(request.unwrap()).await
22344 };
22345
22346 match req_result {
22347 Err(err) => {
22348 if let common::Retry::After(d) = dlg.http_error(&err) {
22349 sleep(d).await;
22350 continue;
22351 }
22352 dlg.finished(false);
22353 return Err(common::Error::HttpError(err));
22354 }
22355 Ok(res) => {
22356 let (mut parts, body) = res.into_parts();
22357 let mut body = common::Body::new(body);
22358 if !parts.status.is_success() {
22359 let bytes = common::to_bytes(body).await.unwrap_or_default();
22360 let error = serde_json::from_str(&common::to_string(&bytes));
22361 let response = common::to_response(parts, bytes.into());
22362
22363 if let common::Retry::After(d) =
22364 dlg.http_failure(&response, error.as_ref().ok())
22365 {
22366 sleep(d).await;
22367 continue;
22368 }
22369
22370 dlg.finished(false);
22371
22372 return Err(match error {
22373 Ok(value) => common::Error::BadRequest(value),
22374 _ => common::Error::Failure(response),
22375 });
22376 }
22377 let response = {
22378 let bytes = common::to_bytes(body).await.unwrap_or_default();
22379 let encoded = common::to_string(&bytes);
22380 match serde_json::from_str(&encoded) {
22381 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22382 Err(error) => {
22383 dlg.response_json_decode_error(&encoded, &error);
22384 return Err(common::Error::JsonDecodeError(
22385 encoded.to_string(),
22386 error,
22387 ));
22388 }
22389 }
22390 };
22391
22392 dlg.finished(true);
22393 return Ok(response);
22394 }
22395 }
22396 }
22397 }
22398
22399 /// Required. The name of the parent resource.
22400 ///
22401 /// Sets the *parent* path property to the given value.
22402 ///
22403 /// Even though the property as already been set when instantiating this call,
22404 /// we provide this method for API completeness.
22405 pub fn parent(
22406 mut self,
22407 new_value: &str,
22408 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C> {
22409 self._parent = new_value.to_string();
22410 self
22411 }
22412 /// Optional. The page token.
22413 ///
22414 /// Sets the *page token* query property to the given value.
22415 pub fn page_token(
22416 mut self,
22417 new_value: &str,
22418 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C> {
22419 self._page_token = Some(new_value.to_string());
22420 self
22421 }
22422 /// Optional. The maximum number of results listed per page.
22423 ///
22424 /// Sets the *page size* query property to the given value.
22425 pub fn page_size(
22426 mut self,
22427 new_value: i32,
22428 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C> {
22429 self._page_size = Some(new_value);
22430 self
22431 }
22432 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22433 /// while executing the actual API request.
22434 ///
22435 /// ````text
22436 /// It should be used to handle progress information, and to implement a certain level of resilience.
22437 /// ````
22438 ///
22439 /// Sets the *delegate* property to the given value.
22440 pub fn delegate(
22441 mut self,
22442 new_value: &'a mut dyn common::Delegate,
22443 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C> {
22444 self._delegate = Some(new_value);
22445 self
22446 }
22447
22448 /// Set any additional parameter of the query string used in the request.
22449 /// It should be used to set parameters which are not yet available through their own
22450 /// setters.
22451 ///
22452 /// Please note that this method must not be used to set any of the known parameters
22453 /// which have their own setter method. If done anyway, the request will fail.
22454 ///
22455 /// # Additional Parameters
22456 ///
22457 /// * *$.xgafv* (query-string) - V1 error format.
22458 /// * *access_token* (query-string) - OAuth access token.
22459 /// * *alt* (query-string) - Data format for response.
22460 /// * *callback* (query-string) - JSONP
22461 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22462 /// * *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.
22463 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22464 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22465 /// * *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.
22466 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22467 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22468 pub fn param<T>(
22469 mut self,
22470 name: T,
22471 value: T,
22472 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C>
22473 where
22474 T: AsRef<str>,
22475 {
22476 self._additional_params
22477 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22478 self
22479 }
22480
22481 /// Identifies the authorization scope for the method you are building.
22482 ///
22483 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22484 /// [`Scope::CloudPlatform`].
22485 ///
22486 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22487 /// tokens for more than one scope.
22488 ///
22489 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22490 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22491 /// sufficient, a read-write scope will do as well.
22492 pub fn add_scope<St>(
22493 mut self,
22494 scope: St,
22495 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C>
22496 where
22497 St: AsRef<str>,
22498 {
22499 self._scopes.insert(String::from(scope.as_ref()));
22500 self
22501 }
22502 /// Identifies the authorization scope(s) for the method you are building.
22503 ///
22504 /// See [`Self::add_scope()`] for details.
22505 pub fn add_scopes<I, St>(
22506 mut self,
22507 scopes: I,
22508 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C>
22509 where
22510 I: IntoIterator<Item = St>,
22511 St: AsRef<str>,
22512 {
22513 self._scopes
22514 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22515 self
22516 }
22517
22518 /// Removes all scopes, and no default scope will be used either.
22519 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22520 /// for details).
22521 pub fn clear_scopes(
22522 mut self,
22523 ) -> ProjectLocationMulticloudDataTransferSupportedServiceListCall<'a, C> {
22524 self._scopes.clear();
22525 self
22526 }
22527}
22528
22529/// 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`.
22530///
22531/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
22532/// It is not used directly, but through a [`ProjectMethods`] instance.
22533///
22534/// # Example
22535///
22536/// Instantiate a resource method builder
22537///
22538/// ```test_harness,no_run
22539/// # extern crate hyper;
22540/// # extern crate hyper_rustls;
22541/// # extern crate google_networkconnectivity1 as networkconnectivity1;
22542/// use networkconnectivity1::api::GoogleLongrunningCancelOperationRequest;
22543/// # async fn dox() {
22544/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22545///
22546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22547/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22548/// # .with_native_roots()
22549/// # .unwrap()
22550/// # .https_only()
22551/// # .enable_http2()
22552/// # .build();
22553///
22554/// # let executor = hyper_util::rt::TokioExecutor::new();
22555/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22556/// # secret,
22557/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22558/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22559/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22560/// # ),
22561/// # ).build().await.unwrap();
22562///
22563/// # let client = hyper_util::client::legacy::Client::builder(
22564/// # hyper_util::rt::TokioExecutor::new()
22565/// # )
22566/// # .build(
22567/// # hyper_rustls::HttpsConnectorBuilder::new()
22568/// # .with_native_roots()
22569/// # .unwrap()
22570/// # .https_or_http()
22571/// # .enable_http2()
22572/// # .build()
22573/// # );
22574/// # let mut hub = Networkconnectivity::new(client, auth);
22575/// // As the method needs a request, you would usually fill it with the desired information
22576/// // into the respective structure. Some of the parts shown here might not be applicable !
22577/// // Values shown here are possibly random and not representative !
22578/// let mut req = GoogleLongrunningCancelOperationRequest::default();
22579///
22580/// // You can configure optional parameters by calling the respective setters at will, and
22581/// // execute the final call using `doit()`.
22582/// // Values shown here are possibly random and not representative !
22583/// let result = hub.projects().locations_operations_cancel(req, "name")
22584/// .doit().await;
22585/// # }
22586/// ```
22587pub struct ProjectLocationOperationCancelCall<'a, C>
22588where
22589 C: 'a,
22590{
22591 hub: &'a Networkconnectivity<C>,
22592 _request: GoogleLongrunningCancelOperationRequest,
22593 _name: String,
22594 _delegate: Option<&'a mut dyn common::Delegate>,
22595 _additional_params: HashMap<String, String>,
22596 _scopes: BTreeSet<String>,
22597}
22598
22599impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
22600
22601impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
22602where
22603 C: common::Connector,
22604{
22605 /// Perform the operation you have build so far.
22606 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
22607 use std::borrow::Cow;
22608 use std::io::{Read, Seek};
22609
22610 use common::{url::Params, ToParts};
22611 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22612
22613 let mut dd = common::DefaultDelegate;
22614 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22615 dlg.begin(common::MethodInfo {
22616 id: "networkconnectivity.projects.locations.operations.cancel",
22617 http_method: hyper::Method::POST,
22618 });
22619
22620 for &field in ["alt", "name"].iter() {
22621 if self._additional_params.contains_key(field) {
22622 dlg.finished(false);
22623 return Err(common::Error::FieldClash(field));
22624 }
22625 }
22626
22627 let mut params = Params::with_capacity(4 + self._additional_params.len());
22628 params.push("name", self._name);
22629
22630 params.extend(self._additional_params.iter());
22631
22632 params.push("alt", "json");
22633 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
22634 if self._scopes.is_empty() {
22635 self._scopes
22636 .insert(Scope::CloudPlatform.as_ref().to_string());
22637 }
22638
22639 #[allow(clippy::single_element_loop)]
22640 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22641 url = params.uri_replacement(url, param_name, find_this, true);
22642 }
22643 {
22644 let to_remove = ["name"];
22645 params.remove_params(&to_remove);
22646 }
22647
22648 let url = params.parse_with_url(&url);
22649
22650 let mut json_mime_type = mime::APPLICATION_JSON;
22651 let mut request_value_reader = {
22652 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22653 common::remove_json_null_values(&mut value);
22654 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22655 serde_json::to_writer(&mut dst, &value).unwrap();
22656 dst
22657 };
22658 let request_size = request_value_reader
22659 .seek(std::io::SeekFrom::End(0))
22660 .unwrap();
22661 request_value_reader
22662 .seek(std::io::SeekFrom::Start(0))
22663 .unwrap();
22664
22665 loop {
22666 let token = match self
22667 .hub
22668 .auth
22669 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22670 .await
22671 {
22672 Ok(token) => token,
22673 Err(e) => match dlg.token(e) {
22674 Ok(token) => token,
22675 Err(e) => {
22676 dlg.finished(false);
22677 return Err(common::Error::MissingToken(e));
22678 }
22679 },
22680 };
22681 request_value_reader
22682 .seek(std::io::SeekFrom::Start(0))
22683 .unwrap();
22684 let mut req_result = {
22685 let client = &self.hub.client;
22686 dlg.pre_request();
22687 let mut req_builder = hyper::Request::builder()
22688 .method(hyper::Method::POST)
22689 .uri(url.as_str())
22690 .header(USER_AGENT, self.hub._user_agent.clone());
22691
22692 if let Some(token) = token.as_ref() {
22693 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22694 }
22695
22696 let request = req_builder
22697 .header(CONTENT_TYPE, json_mime_type.to_string())
22698 .header(CONTENT_LENGTH, request_size as u64)
22699 .body(common::to_body(
22700 request_value_reader.get_ref().clone().into(),
22701 ));
22702
22703 client.request(request.unwrap()).await
22704 };
22705
22706 match req_result {
22707 Err(err) => {
22708 if let common::Retry::After(d) = dlg.http_error(&err) {
22709 sleep(d).await;
22710 continue;
22711 }
22712 dlg.finished(false);
22713 return Err(common::Error::HttpError(err));
22714 }
22715 Ok(res) => {
22716 let (mut parts, body) = res.into_parts();
22717 let mut body = common::Body::new(body);
22718 if !parts.status.is_success() {
22719 let bytes = common::to_bytes(body).await.unwrap_or_default();
22720 let error = serde_json::from_str(&common::to_string(&bytes));
22721 let response = common::to_response(parts, bytes.into());
22722
22723 if let common::Retry::After(d) =
22724 dlg.http_failure(&response, error.as_ref().ok())
22725 {
22726 sleep(d).await;
22727 continue;
22728 }
22729
22730 dlg.finished(false);
22731
22732 return Err(match error {
22733 Ok(value) => common::Error::BadRequest(value),
22734 _ => common::Error::Failure(response),
22735 });
22736 }
22737 let response = {
22738 let bytes = common::to_bytes(body).await.unwrap_or_default();
22739 let encoded = common::to_string(&bytes);
22740 match serde_json::from_str(&encoded) {
22741 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22742 Err(error) => {
22743 dlg.response_json_decode_error(&encoded, &error);
22744 return Err(common::Error::JsonDecodeError(
22745 encoded.to_string(),
22746 error,
22747 ));
22748 }
22749 }
22750 };
22751
22752 dlg.finished(true);
22753 return Ok(response);
22754 }
22755 }
22756 }
22757 }
22758
22759 ///
22760 /// Sets the *request* property to the given value.
22761 ///
22762 /// Even though the property as already been set when instantiating this call,
22763 /// we provide this method for API completeness.
22764 pub fn request(
22765 mut self,
22766 new_value: GoogleLongrunningCancelOperationRequest,
22767 ) -> ProjectLocationOperationCancelCall<'a, C> {
22768 self._request = new_value;
22769 self
22770 }
22771 /// The name of the operation resource to be cancelled.
22772 ///
22773 /// Sets the *name* path property to the given value.
22774 ///
22775 /// Even though the property as already been set when instantiating this call,
22776 /// we provide this method for API completeness.
22777 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
22778 self._name = new_value.to_string();
22779 self
22780 }
22781 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22782 /// while executing the actual API request.
22783 ///
22784 /// ````text
22785 /// It should be used to handle progress information, and to implement a certain level of resilience.
22786 /// ````
22787 ///
22788 /// Sets the *delegate* property to the given value.
22789 pub fn delegate(
22790 mut self,
22791 new_value: &'a mut dyn common::Delegate,
22792 ) -> ProjectLocationOperationCancelCall<'a, C> {
22793 self._delegate = Some(new_value);
22794 self
22795 }
22796
22797 /// Set any additional parameter of the query string used in the request.
22798 /// It should be used to set parameters which are not yet available through their own
22799 /// setters.
22800 ///
22801 /// Please note that this method must not be used to set any of the known parameters
22802 /// which have their own setter method. If done anyway, the request will fail.
22803 ///
22804 /// # Additional Parameters
22805 ///
22806 /// * *$.xgafv* (query-string) - V1 error format.
22807 /// * *access_token* (query-string) - OAuth access token.
22808 /// * *alt* (query-string) - Data format for response.
22809 /// * *callback* (query-string) - JSONP
22810 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22811 /// * *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.
22812 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22813 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22814 /// * *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.
22815 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22816 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22817 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
22818 where
22819 T: AsRef<str>,
22820 {
22821 self._additional_params
22822 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22823 self
22824 }
22825
22826 /// Identifies the authorization scope for the method you are building.
22827 ///
22828 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22829 /// [`Scope::CloudPlatform`].
22830 ///
22831 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22832 /// tokens for more than one scope.
22833 ///
22834 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22835 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22836 /// sufficient, a read-write scope will do as well.
22837 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
22838 where
22839 St: AsRef<str>,
22840 {
22841 self._scopes.insert(String::from(scope.as_ref()));
22842 self
22843 }
22844 /// Identifies the authorization scope(s) for the method you are building.
22845 ///
22846 /// See [`Self::add_scope()`] for details.
22847 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
22848 where
22849 I: IntoIterator<Item = St>,
22850 St: AsRef<str>,
22851 {
22852 self._scopes
22853 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22854 self
22855 }
22856
22857 /// Removes all scopes, and no default scope will be used either.
22858 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22859 /// for details).
22860 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
22861 self._scopes.clear();
22862 self
22863 }
22864}
22865
22866/// 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`.
22867///
22868/// A builder for the *locations.operations.delete* method supported by a *project* resource.
22869/// It is not used directly, but through a [`ProjectMethods`] instance.
22870///
22871/// # Example
22872///
22873/// Instantiate a resource method builder
22874///
22875/// ```test_harness,no_run
22876/// # extern crate hyper;
22877/// # extern crate hyper_rustls;
22878/// # extern crate google_networkconnectivity1 as networkconnectivity1;
22879/// # async fn dox() {
22880/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22881///
22882/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22883/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22884/// # .with_native_roots()
22885/// # .unwrap()
22886/// # .https_only()
22887/// # .enable_http2()
22888/// # .build();
22889///
22890/// # let executor = hyper_util::rt::TokioExecutor::new();
22891/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22892/// # secret,
22893/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22894/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22895/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22896/// # ),
22897/// # ).build().await.unwrap();
22898///
22899/// # let client = hyper_util::client::legacy::Client::builder(
22900/// # hyper_util::rt::TokioExecutor::new()
22901/// # )
22902/// # .build(
22903/// # hyper_rustls::HttpsConnectorBuilder::new()
22904/// # .with_native_roots()
22905/// # .unwrap()
22906/// # .https_or_http()
22907/// # .enable_http2()
22908/// # .build()
22909/// # );
22910/// # let mut hub = Networkconnectivity::new(client, auth);
22911/// // You can configure optional parameters by calling the respective setters at will, and
22912/// // execute the final call using `doit()`.
22913/// // Values shown here are possibly random and not representative !
22914/// let result = hub.projects().locations_operations_delete("name")
22915/// .doit().await;
22916/// # }
22917/// ```
22918pub struct ProjectLocationOperationDeleteCall<'a, C>
22919where
22920 C: 'a,
22921{
22922 hub: &'a Networkconnectivity<C>,
22923 _name: String,
22924 _delegate: Option<&'a mut dyn common::Delegate>,
22925 _additional_params: HashMap<String, String>,
22926 _scopes: BTreeSet<String>,
22927}
22928
22929impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
22930
22931impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
22932where
22933 C: common::Connector,
22934{
22935 /// Perform the operation you have build so far.
22936 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
22937 use std::borrow::Cow;
22938 use std::io::{Read, Seek};
22939
22940 use common::{url::Params, ToParts};
22941 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22942
22943 let mut dd = common::DefaultDelegate;
22944 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22945 dlg.begin(common::MethodInfo {
22946 id: "networkconnectivity.projects.locations.operations.delete",
22947 http_method: hyper::Method::DELETE,
22948 });
22949
22950 for &field in ["alt", "name"].iter() {
22951 if self._additional_params.contains_key(field) {
22952 dlg.finished(false);
22953 return Err(common::Error::FieldClash(field));
22954 }
22955 }
22956
22957 let mut params = Params::with_capacity(3 + self._additional_params.len());
22958 params.push("name", self._name);
22959
22960 params.extend(self._additional_params.iter());
22961
22962 params.push("alt", "json");
22963 let mut url = self.hub._base_url.clone() + "v1/{+name}";
22964 if self._scopes.is_empty() {
22965 self._scopes
22966 .insert(Scope::CloudPlatform.as_ref().to_string());
22967 }
22968
22969 #[allow(clippy::single_element_loop)]
22970 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22971 url = params.uri_replacement(url, param_name, find_this, true);
22972 }
22973 {
22974 let to_remove = ["name"];
22975 params.remove_params(&to_remove);
22976 }
22977
22978 let url = params.parse_with_url(&url);
22979
22980 loop {
22981 let token = match self
22982 .hub
22983 .auth
22984 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22985 .await
22986 {
22987 Ok(token) => token,
22988 Err(e) => match dlg.token(e) {
22989 Ok(token) => token,
22990 Err(e) => {
22991 dlg.finished(false);
22992 return Err(common::Error::MissingToken(e));
22993 }
22994 },
22995 };
22996 let mut req_result = {
22997 let client = &self.hub.client;
22998 dlg.pre_request();
22999 let mut req_builder = hyper::Request::builder()
23000 .method(hyper::Method::DELETE)
23001 .uri(url.as_str())
23002 .header(USER_AGENT, self.hub._user_agent.clone());
23003
23004 if let Some(token) = token.as_ref() {
23005 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23006 }
23007
23008 let request = req_builder
23009 .header(CONTENT_LENGTH, 0_u64)
23010 .body(common::to_body::<String>(None));
23011
23012 client.request(request.unwrap()).await
23013 };
23014
23015 match req_result {
23016 Err(err) => {
23017 if let common::Retry::After(d) = dlg.http_error(&err) {
23018 sleep(d).await;
23019 continue;
23020 }
23021 dlg.finished(false);
23022 return Err(common::Error::HttpError(err));
23023 }
23024 Ok(res) => {
23025 let (mut parts, body) = res.into_parts();
23026 let mut body = common::Body::new(body);
23027 if !parts.status.is_success() {
23028 let bytes = common::to_bytes(body).await.unwrap_or_default();
23029 let error = serde_json::from_str(&common::to_string(&bytes));
23030 let response = common::to_response(parts, bytes.into());
23031
23032 if let common::Retry::After(d) =
23033 dlg.http_failure(&response, error.as_ref().ok())
23034 {
23035 sleep(d).await;
23036 continue;
23037 }
23038
23039 dlg.finished(false);
23040
23041 return Err(match error {
23042 Ok(value) => common::Error::BadRequest(value),
23043 _ => common::Error::Failure(response),
23044 });
23045 }
23046 let response = {
23047 let bytes = common::to_bytes(body).await.unwrap_or_default();
23048 let encoded = common::to_string(&bytes);
23049 match serde_json::from_str(&encoded) {
23050 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23051 Err(error) => {
23052 dlg.response_json_decode_error(&encoded, &error);
23053 return Err(common::Error::JsonDecodeError(
23054 encoded.to_string(),
23055 error,
23056 ));
23057 }
23058 }
23059 };
23060
23061 dlg.finished(true);
23062 return Ok(response);
23063 }
23064 }
23065 }
23066 }
23067
23068 /// The name of the operation resource to be deleted.
23069 ///
23070 /// Sets the *name* path property to the given value.
23071 ///
23072 /// Even though the property as already been set when instantiating this call,
23073 /// we provide this method for API completeness.
23074 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
23075 self._name = new_value.to_string();
23076 self
23077 }
23078 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23079 /// while executing the actual API request.
23080 ///
23081 /// ````text
23082 /// It should be used to handle progress information, and to implement a certain level of resilience.
23083 /// ````
23084 ///
23085 /// Sets the *delegate* property to the given value.
23086 pub fn delegate(
23087 mut self,
23088 new_value: &'a mut dyn common::Delegate,
23089 ) -> ProjectLocationOperationDeleteCall<'a, C> {
23090 self._delegate = Some(new_value);
23091 self
23092 }
23093
23094 /// Set any additional parameter of the query string used in the request.
23095 /// It should be used to set parameters which are not yet available through their own
23096 /// setters.
23097 ///
23098 /// Please note that this method must not be used to set any of the known parameters
23099 /// which have their own setter method. If done anyway, the request will fail.
23100 ///
23101 /// # Additional Parameters
23102 ///
23103 /// * *$.xgafv* (query-string) - V1 error format.
23104 /// * *access_token* (query-string) - OAuth access token.
23105 /// * *alt* (query-string) - Data format for response.
23106 /// * *callback* (query-string) - JSONP
23107 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23108 /// * *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.
23109 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23110 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23111 /// * *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.
23112 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23113 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23114 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
23115 where
23116 T: AsRef<str>,
23117 {
23118 self._additional_params
23119 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23120 self
23121 }
23122
23123 /// Identifies the authorization scope for the method you are building.
23124 ///
23125 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23126 /// [`Scope::CloudPlatform`].
23127 ///
23128 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23129 /// tokens for more than one scope.
23130 ///
23131 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23132 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23133 /// sufficient, a read-write scope will do as well.
23134 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
23135 where
23136 St: AsRef<str>,
23137 {
23138 self._scopes.insert(String::from(scope.as_ref()));
23139 self
23140 }
23141 /// Identifies the authorization scope(s) for the method you are building.
23142 ///
23143 /// See [`Self::add_scope()`] for details.
23144 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
23145 where
23146 I: IntoIterator<Item = St>,
23147 St: AsRef<str>,
23148 {
23149 self._scopes
23150 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23151 self
23152 }
23153
23154 /// Removes all scopes, and no default scope will be used either.
23155 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23156 /// for details).
23157 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
23158 self._scopes.clear();
23159 self
23160 }
23161}
23162
23163/// 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.
23164///
23165/// A builder for the *locations.operations.get* method supported by a *project* resource.
23166/// It is not used directly, but through a [`ProjectMethods`] instance.
23167///
23168/// # Example
23169///
23170/// Instantiate a resource method builder
23171///
23172/// ```test_harness,no_run
23173/// # extern crate hyper;
23174/// # extern crate hyper_rustls;
23175/// # extern crate google_networkconnectivity1 as networkconnectivity1;
23176/// # async fn dox() {
23177/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23178///
23179/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23180/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23181/// # .with_native_roots()
23182/// # .unwrap()
23183/// # .https_only()
23184/// # .enable_http2()
23185/// # .build();
23186///
23187/// # let executor = hyper_util::rt::TokioExecutor::new();
23188/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23189/// # secret,
23190/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23191/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23192/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23193/// # ),
23194/// # ).build().await.unwrap();
23195///
23196/// # let client = hyper_util::client::legacy::Client::builder(
23197/// # hyper_util::rt::TokioExecutor::new()
23198/// # )
23199/// # .build(
23200/// # hyper_rustls::HttpsConnectorBuilder::new()
23201/// # .with_native_roots()
23202/// # .unwrap()
23203/// # .https_or_http()
23204/// # .enable_http2()
23205/// # .build()
23206/// # );
23207/// # let mut hub = Networkconnectivity::new(client, auth);
23208/// // You can configure optional parameters by calling the respective setters at will, and
23209/// // execute the final call using `doit()`.
23210/// // Values shown here are possibly random and not representative !
23211/// let result = hub.projects().locations_operations_get("name")
23212/// .doit().await;
23213/// # }
23214/// ```
23215pub struct ProjectLocationOperationGetCall<'a, C>
23216where
23217 C: 'a,
23218{
23219 hub: &'a Networkconnectivity<C>,
23220 _name: String,
23221 _delegate: Option<&'a mut dyn common::Delegate>,
23222 _additional_params: HashMap<String, String>,
23223 _scopes: BTreeSet<String>,
23224}
23225
23226impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
23227
23228impl<'a, C> ProjectLocationOperationGetCall<'a, C>
23229where
23230 C: common::Connector,
23231{
23232 /// Perform the operation you have build so far.
23233 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
23234 use std::borrow::Cow;
23235 use std::io::{Read, Seek};
23236
23237 use common::{url::Params, ToParts};
23238 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23239
23240 let mut dd = common::DefaultDelegate;
23241 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23242 dlg.begin(common::MethodInfo {
23243 id: "networkconnectivity.projects.locations.operations.get",
23244 http_method: hyper::Method::GET,
23245 });
23246
23247 for &field in ["alt", "name"].iter() {
23248 if self._additional_params.contains_key(field) {
23249 dlg.finished(false);
23250 return Err(common::Error::FieldClash(field));
23251 }
23252 }
23253
23254 let mut params = Params::with_capacity(3 + self._additional_params.len());
23255 params.push("name", self._name);
23256
23257 params.extend(self._additional_params.iter());
23258
23259 params.push("alt", "json");
23260 let mut url = self.hub._base_url.clone() + "v1/{+name}";
23261 if self._scopes.is_empty() {
23262 self._scopes
23263 .insert(Scope::CloudPlatform.as_ref().to_string());
23264 }
23265
23266 #[allow(clippy::single_element_loop)]
23267 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23268 url = params.uri_replacement(url, param_name, find_this, true);
23269 }
23270 {
23271 let to_remove = ["name"];
23272 params.remove_params(&to_remove);
23273 }
23274
23275 let url = params.parse_with_url(&url);
23276
23277 loop {
23278 let token = match self
23279 .hub
23280 .auth
23281 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23282 .await
23283 {
23284 Ok(token) => token,
23285 Err(e) => match dlg.token(e) {
23286 Ok(token) => token,
23287 Err(e) => {
23288 dlg.finished(false);
23289 return Err(common::Error::MissingToken(e));
23290 }
23291 },
23292 };
23293 let mut req_result = {
23294 let client = &self.hub.client;
23295 dlg.pre_request();
23296 let mut req_builder = hyper::Request::builder()
23297 .method(hyper::Method::GET)
23298 .uri(url.as_str())
23299 .header(USER_AGENT, self.hub._user_agent.clone());
23300
23301 if let Some(token) = token.as_ref() {
23302 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23303 }
23304
23305 let request = req_builder
23306 .header(CONTENT_LENGTH, 0_u64)
23307 .body(common::to_body::<String>(None));
23308
23309 client.request(request.unwrap()).await
23310 };
23311
23312 match req_result {
23313 Err(err) => {
23314 if let common::Retry::After(d) = dlg.http_error(&err) {
23315 sleep(d).await;
23316 continue;
23317 }
23318 dlg.finished(false);
23319 return Err(common::Error::HttpError(err));
23320 }
23321 Ok(res) => {
23322 let (mut parts, body) = res.into_parts();
23323 let mut body = common::Body::new(body);
23324 if !parts.status.is_success() {
23325 let bytes = common::to_bytes(body).await.unwrap_or_default();
23326 let error = serde_json::from_str(&common::to_string(&bytes));
23327 let response = common::to_response(parts, bytes.into());
23328
23329 if let common::Retry::After(d) =
23330 dlg.http_failure(&response, error.as_ref().ok())
23331 {
23332 sleep(d).await;
23333 continue;
23334 }
23335
23336 dlg.finished(false);
23337
23338 return Err(match error {
23339 Ok(value) => common::Error::BadRequest(value),
23340 _ => common::Error::Failure(response),
23341 });
23342 }
23343 let response = {
23344 let bytes = common::to_bytes(body).await.unwrap_or_default();
23345 let encoded = common::to_string(&bytes);
23346 match serde_json::from_str(&encoded) {
23347 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23348 Err(error) => {
23349 dlg.response_json_decode_error(&encoded, &error);
23350 return Err(common::Error::JsonDecodeError(
23351 encoded.to_string(),
23352 error,
23353 ));
23354 }
23355 }
23356 };
23357
23358 dlg.finished(true);
23359 return Ok(response);
23360 }
23361 }
23362 }
23363 }
23364
23365 /// The name of the operation resource.
23366 ///
23367 /// Sets the *name* path property to the given value.
23368 ///
23369 /// Even though the property as already been set when instantiating this call,
23370 /// we provide this method for API completeness.
23371 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
23372 self._name = new_value.to_string();
23373 self
23374 }
23375 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23376 /// while executing the actual API request.
23377 ///
23378 /// ````text
23379 /// It should be used to handle progress information, and to implement a certain level of resilience.
23380 /// ````
23381 ///
23382 /// Sets the *delegate* property to the given value.
23383 pub fn delegate(
23384 mut self,
23385 new_value: &'a mut dyn common::Delegate,
23386 ) -> ProjectLocationOperationGetCall<'a, C> {
23387 self._delegate = Some(new_value);
23388 self
23389 }
23390
23391 /// Set any additional parameter of the query string used in the request.
23392 /// It should be used to set parameters which are not yet available through their own
23393 /// setters.
23394 ///
23395 /// Please note that this method must not be used to set any of the known parameters
23396 /// which have their own setter method. If done anyway, the request will fail.
23397 ///
23398 /// # Additional Parameters
23399 ///
23400 /// * *$.xgafv* (query-string) - V1 error format.
23401 /// * *access_token* (query-string) - OAuth access token.
23402 /// * *alt* (query-string) - Data format for response.
23403 /// * *callback* (query-string) - JSONP
23404 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23405 /// * *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.
23406 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23407 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23408 /// * *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.
23409 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23410 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23411 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
23412 where
23413 T: AsRef<str>,
23414 {
23415 self._additional_params
23416 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23417 self
23418 }
23419
23420 /// Identifies the authorization scope for the method you are building.
23421 ///
23422 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23423 /// [`Scope::CloudPlatform`].
23424 ///
23425 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23426 /// tokens for more than one scope.
23427 ///
23428 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23429 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23430 /// sufficient, a read-write scope will do as well.
23431 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
23432 where
23433 St: AsRef<str>,
23434 {
23435 self._scopes.insert(String::from(scope.as_ref()));
23436 self
23437 }
23438 /// Identifies the authorization scope(s) for the method you are building.
23439 ///
23440 /// See [`Self::add_scope()`] for details.
23441 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
23442 where
23443 I: IntoIterator<Item = St>,
23444 St: AsRef<str>,
23445 {
23446 self._scopes
23447 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23448 self
23449 }
23450
23451 /// Removes all scopes, and no default scope will be used either.
23452 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23453 /// for details).
23454 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
23455 self._scopes.clear();
23456 self
23457 }
23458}
23459
23460/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
23461///
23462/// A builder for the *locations.operations.list* method supported by a *project* resource.
23463/// It is not used directly, but through a [`ProjectMethods`] instance.
23464///
23465/// # Example
23466///
23467/// Instantiate a resource method builder
23468///
23469/// ```test_harness,no_run
23470/// # extern crate hyper;
23471/// # extern crate hyper_rustls;
23472/// # extern crate google_networkconnectivity1 as networkconnectivity1;
23473/// # async fn dox() {
23474/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23475///
23476/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23477/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23478/// # .with_native_roots()
23479/// # .unwrap()
23480/// # .https_only()
23481/// # .enable_http2()
23482/// # .build();
23483///
23484/// # let executor = hyper_util::rt::TokioExecutor::new();
23485/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23486/// # secret,
23487/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23488/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23489/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23490/// # ),
23491/// # ).build().await.unwrap();
23492///
23493/// # let client = hyper_util::client::legacy::Client::builder(
23494/// # hyper_util::rt::TokioExecutor::new()
23495/// # )
23496/// # .build(
23497/// # hyper_rustls::HttpsConnectorBuilder::new()
23498/// # .with_native_roots()
23499/// # .unwrap()
23500/// # .https_or_http()
23501/// # .enable_http2()
23502/// # .build()
23503/// # );
23504/// # let mut hub = Networkconnectivity::new(client, auth);
23505/// // You can configure optional parameters by calling the respective setters at will, and
23506/// // execute the final call using `doit()`.
23507/// // Values shown here are possibly random and not representative !
23508/// let result = hub.projects().locations_operations_list("name")
23509/// .return_partial_success(true)
23510/// .page_token("sea")
23511/// .page_size(-74)
23512/// .filter("At")
23513/// .doit().await;
23514/// # }
23515/// ```
23516pub struct ProjectLocationOperationListCall<'a, C>
23517where
23518 C: 'a,
23519{
23520 hub: &'a Networkconnectivity<C>,
23521 _name: String,
23522 _return_partial_success: Option<bool>,
23523 _page_token: Option<String>,
23524 _page_size: Option<i32>,
23525 _filter: Option<String>,
23526 _delegate: Option<&'a mut dyn common::Delegate>,
23527 _additional_params: HashMap<String, String>,
23528 _scopes: BTreeSet<String>,
23529}
23530
23531impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
23532
23533impl<'a, C> ProjectLocationOperationListCall<'a, C>
23534where
23535 C: common::Connector,
23536{
23537 /// Perform the operation you have build so far.
23538 pub async fn doit(
23539 mut self,
23540 ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
23541 use std::borrow::Cow;
23542 use std::io::{Read, Seek};
23543
23544 use common::{url::Params, ToParts};
23545 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23546
23547 let mut dd = common::DefaultDelegate;
23548 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23549 dlg.begin(common::MethodInfo {
23550 id: "networkconnectivity.projects.locations.operations.list",
23551 http_method: hyper::Method::GET,
23552 });
23553
23554 for &field in [
23555 "alt",
23556 "name",
23557 "returnPartialSuccess",
23558 "pageToken",
23559 "pageSize",
23560 "filter",
23561 ]
23562 .iter()
23563 {
23564 if self._additional_params.contains_key(field) {
23565 dlg.finished(false);
23566 return Err(common::Error::FieldClash(field));
23567 }
23568 }
23569
23570 let mut params = Params::with_capacity(7 + self._additional_params.len());
23571 params.push("name", self._name);
23572 if let Some(value) = self._return_partial_success.as_ref() {
23573 params.push("returnPartialSuccess", value.to_string());
23574 }
23575 if let Some(value) = self._page_token.as_ref() {
23576 params.push("pageToken", value);
23577 }
23578 if let Some(value) = self._page_size.as_ref() {
23579 params.push("pageSize", value.to_string());
23580 }
23581 if let Some(value) = self._filter.as_ref() {
23582 params.push("filter", value);
23583 }
23584
23585 params.extend(self._additional_params.iter());
23586
23587 params.push("alt", "json");
23588 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
23589 if self._scopes.is_empty() {
23590 self._scopes
23591 .insert(Scope::CloudPlatform.as_ref().to_string());
23592 }
23593
23594 #[allow(clippy::single_element_loop)]
23595 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23596 url = params.uri_replacement(url, param_name, find_this, true);
23597 }
23598 {
23599 let to_remove = ["name"];
23600 params.remove_params(&to_remove);
23601 }
23602
23603 let url = params.parse_with_url(&url);
23604
23605 loop {
23606 let token = match self
23607 .hub
23608 .auth
23609 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23610 .await
23611 {
23612 Ok(token) => token,
23613 Err(e) => match dlg.token(e) {
23614 Ok(token) => token,
23615 Err(e) => {
23616 dlg.finished(false);
23617 return Err(common::Error::MissingToken(e));
23618 }
23619 },
23620 };
23621 let mut req_result = {
23622 let client = &self.hub.client;
23623 dlg.pre_request();
23624 let mut req_builder = hyper::Request::builder()
23625 .method(hyper::Method::GET)
23626 .uri(url.as_str())
23627 .header(USER_AGENT, self.hub._user_agent.clone());
23628
23629 if let Some(token) = token.as_ref() {
23630 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23631 }
23632
23633 let request = req_builder
23634 .header(CONTENT_LENGTH, 0_u64)
23635 .body(common::to_body::<String>(None));
23636
23637 client.request(request.unwrap()).await
23638 };
23639
23640 match req_result {
23641 Err(err) => {
23642 if let common::Retry::After(d) = dlg.http_error(&err) {
23643 sleep(d).await;
23644 continue;
23645 }
23646 dlg.finished(false);
23647 return Err(common::Error::HttpError(err));
23648 }
23649 Ok(res) => {
23650 let (mut parts, body) = res.into_parts();
23651 let mut body = common::Body::new(body);
23652 if !parts.status.is_success() {
23653 let bytes = common::to_bytes(body).await.unwrap_or_default();
23654 let error = serde_json::from_str(&common::to_string(&bytes));
23655 let response = common::to_response(parts, bytes.into());
23656
23657 if let common::Retry::After(d) =
23658 dlg.http_failure(&response, error.as_ref().ok())
23659 {
23660 sleep(d).await;
23661 continue;
23662 }
23663
23664 dlg.finished(false);
23665
23666 return Err(match error {
23667 Ok(value) => common::Error::BadRequest(value),
23668 _ => common::Error::Failure(response),
23669 });
23670 }
23671 let response = {
23672 let bytes = common::to_bytes(body).await.unwrap_or_default();
23673 let encoded = common::to_string(&bytes);
23674 match serde_json::from_str(&encoded) {
23675 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23676 Err(error) => {
23677 dlg.response_json_decode_error(&encoded, &error);
23678 return Err(common::Error::JsonDecodeError(
23679 encoded.to_string(),
23680 error,
23681 ));
23682 }
23683 }
23684 };
23685
23686 dlg.finished(true);
23687 return Ok(response);
23688 }
23689 }
23690 }
23691 }
23692
23693 /// The name of the operation's parent resource.
23694 ///
23695 /// Sets the *name* path property to the given value.
23696 ///
23697 /// Even though the property as already been set when instantiating this call,
23698 /// we provide this method for API completeness.
23699 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
23700 self._name = new_value.to_string();
23701 self
23702 }
23703 /// 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.
23704 ///
23705 /// Sets the *return partial success* query property to the given value.
23706 pub fn return_partial_success(
23707 mut self,
23708 new_value: bool,
23709 ) -> ProjectLocationOperationListCall<'a, C> {
23710 self._return_partial_success = Some(new_value);
23711 self
23712 }
23713 /// The standard list page token.
23714 ///
23715 /// Sets the *page token* query property to the given value.
23716 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
23717 self._page_token = Some(new_value.to_string());
23718 self
23719 }
23720 /// The standard list page size.
23721 ///
23722 /// Sets the *page size* query property to the given value.
23723 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
23724 self._page_size = Some(new_value);
23725 self
23726 }
23727 /// The standard list filter.
23728 ///
23729 /// Sets the *filter* query property to the given value.
23730 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
23731 self._filter = Some(new_value.to_string());
23732 self
23733 }
23734 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23735 /// while executing the actual API request.
23736 ///
23737 /// ````text
23738 /// It should be used to handle progress information, and to implement a certain level of resilience.
23739 /// ````
23740 ///
23741 /// Sets the *delegate* property to the given value.
23742 pub fn delegate(
23743 mut self,
23744 new_value: &'a mut dyn common::Delegate,
23745 ) -> ProjectLocationOperationListCall<'a, C> {
23746 self._delegate = Some(new_value);
23747 self
23748 }
23749
23750 /// Set any additional parameter of the query string used in the request.
23751 /// It should be used to set parameters which are not yet available through their own
23752 /// setters.
23753 ///
23754 /// Please note that this method must not be used to set any of the known parameters
23755 /// which have their own setter method. If done anyway, the request will fail.
23756 ///
23757 /// # Additional Parameters
23758 ///
23759 /// * *$.xgafv* (query-string) - V1 error format.
23760 /// * *access_token* (query-string) - OAuth access token.
23761 /// * *alt* (query-string) - Data format for response.
23762 /// * *callback* (query-string) - JSONP
23763 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23764 /// * *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.
23765 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23766 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23767 /// * *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.
23768 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23769 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23770 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
23771 where
23772 T: AsRef<str>,
23773 {
23774 self._additional_params
23775 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23776 self
23777 }
23778
23779 /// Identifies the authorization scope for the method you are building.
23780 ///
23781 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23782 /// [`Scope::CloudPlatform`].
23783 ///
23784 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23785 /// tokens for more than one scope.
23786 ///
23787 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23788 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23789 /// sufficient, a read-write scope will do as well.
23790 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
23791 where
23792 St: AsRef<str>,
23793 {
23794 self._scopes.insert(String::from(scope.as_ref()));
23795 self
23796 }
23797 /// Identifies the authorization scope(s) for the method you are building.
23798 ///
23799 /// See [`Self::add_scope()`] for details.
23800 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
23801 where
23802 I: IntoIterator<Item = St>,
23803 St: AsRef<str>,
23804 {
23805 self._scopes
23806 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23807 self
23808 }
23809
23810 /// Removes all scopes, and no default scope will be used either.
23811 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23812 /// for details).
23813 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
23814 self._scopes.clear();
23815 self
23816 }
23817}
23818
23819/// Creates a new RegionalEndpoint in a given project and location.
23820///
23821/// A builder for the *locations.regionalEndpoints.create* method supported by a *project* resource.
23822/// It is not used directly, but through a [`ProjectMethods`] instance.
23823///
23824/// # Example
23825///
23826/// Instantiate a resource method builder
23827///
23828/// ```test_harness,no_run
23829/// # extern crate hyper;
23830/// # extern crate hyper_rustls;
23831/// # extern crate google_networkconnectivity1 as networkconnectivity1;
23832/// use networkconnectivity1::api::RegionalEndpoint;
23833/// # async fn dox() {
23834/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23835///
23836/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23837/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23838/// # .with_native_roots()
23839/// # .unwrap()
23840/// # .https_only()
23841/// # .enable_http2()
23842/// # .build();
23843///
23844/// # let executor = hyper_util::rt::TokioExecutor::new();
23845/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23846/// # secret,
23847/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23848/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23849/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23850/// # ),
23851/// # ).build().await.unwrap();
23852///
23853/// # let client = hyper_util::client::legacy::Client::builder(
23854/// # hyper_util::rt::TokioExecutor::new()
23855/// # )
23856/// # .build(
23857/// # hyper_rustls::HttpsConnectorBuilder::new()
23858/// # .with_native_roots()
23859/// # .unwrap()
23860/// # .https_or_http()
23861/// # .enable_http2()
23862/// # .build()
23863/// # );
23864/// # let mut hub = Networkconnectivity::new(client, auth);
23865/// // As the method needs a request, you would usually fill it with the desired information
23866/// // into the respective structure. Some of the parts shown here might not be applicable !
23867/// // Values shown here are possibly random and not representative !
23868/// let mut req = RegionalEndpoint::default();
23869///
23870/// // You can configure optional parameters by calling the respective setters at will, and
23871/// // execute the final call using `doit()`.
23872/// // Values shown here are possibly random and not representative !
23873/// let result = hub.projects().locations_regional_endpoints_create(req, "parent")
23874/// .request_id("eirmod")
23875/// .regional_endpoint_id("Lorem")
23876/// .doit().await;
23877/// # }
23878/// ```
23879pub struct ProjectLocationRegionalEndpointCreateCall<'a, C>
23880where
23881 C: 'a,
23882{
23883 hub: &'a Networkconnectivity<C>,
23884 _request: RegionalEndpoint,
23885 _parent: String,
23886 _request_id: Option<String>,
23887 _regional_endpoint_id: Option<String>,
23888 _delegate: Option<&'a mut dyn common::Delegate>,
23889 _additional_params: HashMap<String, String>,
23890 _scopes: BTreeSet<String>,
23891}
23892
23893impl<'a, C> common::CallBuilder for ProjectLocationRegionalEndpointCreateCall<'a, C> {}
23894
23895impl<'a, C> ProjectLocationRegionalEndpointCreateCall<'a, C>
23896where
23897 C: common::Connector,
23898{
23899 /// Perform the operation you have build so far.
23900 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
23901 use std::borrow::Cow;
23902 use std::io::{Read, Seek};
23903
23904 use common::{url::Params, ToParts};
23905 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23906
23907 let mut dd = common::DefaultDelegate;
23908 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23909 dlg.begin(common::MethodInfo {
23910 id: "networkconnectivity.projects.locations.regionalEndpoints.create",
23911 http_method: hyper::Method::POST,
23912 });
23913
23914 for &field in ["alt", "parent", "requestId", "regionalEndpointId"].iter() {
23915 if self._additional_params.contains_key(field) {
23916 dlg.finished(false);
23917 return Err(common::Error::FieldClash(field));
23918 }
23919 }
23920
23921 let mut params = Params::with_capacity(6 + self._additional_params.len());
23922 params.push("parent", self._parent);
23923 if let Some(value) = self._request_id.as_ref() {
23924 params.push("requestId", value);
23925 }
23926 if let Some(value) = self._regional_endpoint_id.as_ref() {
23927 params.push("regionalEndpointId", value);
23928 }
23929
23930 params.extend(self._additional_params.iter());
23931
23932 params.push("alt", "json");
23933 let mut url = self.hub._base_url.clone() + "v1/{+parent}/regionalEndpoints";
23934 if self._scopes.is_empty() {
23935 self._scopes
23936 .insert(Scope::CloudPlatform.as_ref().to_string());
23937 }
23938
23939 #[allow(clippy::single_element_loop)]
23940 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23941 url = params.uri_replacement(url, param_name, find_this, true);
23942 }
23943 {
23944 let to_remove = ["parent"];
23945 params.remove_params(&to_remove);
23946 }
23947
23948 let url = params.parse_with_url(&url);
23949
23950 let mut json_mime_type = mime::APPLICATION_JSON;
23951 let mut request_value_reader = {
23952 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23953 common::remove_json_null_values(&mut value);
23954 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23955 serde_json::to_writer(&mut dst, &value).unwrap();
23956 dst
23957 };
23958 let request_size = request_value_reader
23959 .seek(std::io::SeekFrom::End(0))
23960 .unwrap();
23961 request_value_reader
23962 .seek(std::io::SeekFrom::Start(0))
23963 .unwrap();
23964
23965 loop {
23966 let token = match self
23967 .hub
23968 .auth
23969 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23970 .await
23971 {
23972 Ok(token) => token,
23973 Err(e) => match dlg.token(e) {
23974 Ok(token) => token,
23975 Err(e) => {
23976 dlg.finished(false);
23977 return Err(common::Error::MissingToken(e));
23978 }
23979 },
23980 };
23981 request_value_reader
23982 .seek(std::io::SeekFrom::Start(0))
23983 .unwrap();
23984 let mut req_result = {
23985 let client = &self.hub.client;
23986 dlg.pre_request();
23987 let mut req_builder = hyper::Request::builder()
23988 .method(hyper::Method::POST)
23989 .uri(url.as_str())
23990 .header(USER_AGENT, self.hub._user_agent.clone());
23991
23992 if let Some(token) = token.as_ref() {
23993 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23994 }
23995
23996 let request = req_builder
23997 .header(CONTENT_TYPE, json_mime_type.to_string())
23998 .header(CONTENT_LENGTH, request_size as u64)
23999 .body(common::to_body(
24000 request_value_reader.get_ref().clone().into(),
24001 ));
24002
24003 client.request(request.unwrap()).await
24004 };
24005
24006 match req_result {
24007 Err(err) => {
24008 if let common::Retry::After(d) = dlg.http_error(&err) {
24009 sleep(d).await;
24010 continue;
24011 }
24012 dlg.finished(false);
24013 return Err(common::Error::HttpError(err));
24014 }
24015 Ok(res) => {
24016 let (mut parts, body) = res.into_parts();
24017 let mut body = common::Body::new(body);
24018 if !parts.status.is_success() {
24019 let bytes = common::to_bytes(body).await.unwrap_or_default();
24020 let error = serde_json::from_str(&common::to_string(&bytes));
24021 let response = common::to_response(parts, bytes.into());
24022
24023 if let common::Retry::After(d) =
24024 dlg.http_failure(&response, error.as_ref().ok())
24025 {
24026 sleep(d).await;
24027 continue;
24028 }
24029
24030 dlg.finished(false);
24031
24032 return Err(match error {
24033 Ok(value) => common::Error::BadRequest(value),
24034 _ => common::Error::Failure(response),
24035 });
24036 }
24037 let response = {
24038 let bytes = common::to_bytes(body).await.unwrap_or_default();
24039 let encoded = common::to_string(&bytes);
24040 match serde_json::from_str(&encoded) {
24041 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24042 Err(error) => {
24043 dlg.response_json_decode_error(&encoded, &error);
24044 return Err(common::Error::JsonDecodeError(
24045 encoded.to_string(),
24046 error,
24047 ));
24048 }
24049 }
24050 };
24051
24052 dlg.finished(true);
24053 return Ok(response);
24054 }
24055 }
24056 }
24057 }
24058
24059 ///
24060 /// Sets the *request* property to the given value.
24061 ///
24062 /// Even though the property as already been set when instantiating this call,
24063 /// we provide this method for API completeness.
24064 pub fn request(
24065 mut self,
24066 new_value: RegionalEndpoint,
24067 ) -> ProjectLocationRegionalEndpointCreateCall<'a, C> {
24068 self._request = new_value;
24069 self
24070 }
24071 /// Required. The parent resource's name of the RegionalEndpoint.
24072 ///
24073 /// Sets the *parent* path property to the given value.
24074 ///
24075 /// Even though the property as already been set when instantiating this call,
24076 /// we provide this method for API completeness.
24077 pub fn parent(mut self, new_value: &str) -> ProjectLocationRegionalEndpointCreateCall<'a, C> {
24078 self._parent = new_value.to_string();
24079 self
24080 }
24081 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if the original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
24082 ///
24083 /// Sets the *request id* query property to the given value.
24084 pub fn request_id(
24085 mut self,
24086 new_value: &str,
24087 ) -> ProjectLocationRegionalEndpointCreateCall<'a, C> {
24088 self._request_id = Some(new_value.to_string());
24089 self
24090 }
24091 /// Required. Unique id of the Regional Endpoint to be created. @pattern: ^[-a-z0-9](?:[-a-z0-9]{0,44})\[a-z0-9\]$
24092 ///
24093 /// Sets the *regional endpoint id* query property to the given value.
24094 pub fn regional_endpoint_id(
24095 mut self,
24096 new_value: &str,
24097 ) -> ProjectLocationRegionalEndpointCreateCall<'a, C> {
24098 self._regional_endpoint_id = Some(new_value.to_string());
24099 self
24100 }
24101 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24102 /// while executing the actual API request.
24103 ///
24104 /// ````text
24105 /// It should be used to handle progress information, and to implement a certain level of resilience.
24106 /// ````
24107 ///
24108 /// Sets the *delegate* property to the given value.
24109 pub fn delegate(
24110 mut self,
24111 new_value: &'a mut dyn common::Delegate,
24112 ) -> ProjectLocationRegionalEndpointCreateCall<'a, C> {
24113 self._delegate = Some(new_value);
24114 self
24115 }
24116
24117 /// Set any additional parameter of the query string used in the request.
24118 /// It should be used to set parameters which are not yet available through their own
24119 /// setters.
24120 ///
24121 /// Please note that this method must not be used to set any of the known parameters
24122 /// which have their own setter method. If done anyway, the request will fail.
24123 ///
24124 /// # Additional Parameters
24125 ///
24126 /// * *$.xgafv* (query-string) - V1 error format.
24127 /// * *access_token* (query-string) - OAuth access token.
24128 /// * *alt* (query-string) - Data format for response.
24129 /// * *callback* (query-string) - JSONP
24130 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24131 /// * *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.
24132 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24133 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24134 /// * *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.
24135 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24136 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24137 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegionalEndpointCreateCall<'a, C>
24138 where
24139 T: AsRef<str>,
24140 {
24141 self._additional_params
24142 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24143 self
24144 }
24145
24146 /// Identifies the authorization scope for the method you are building.
24147 ///
24148 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24149 /// [`Scope::CloudPlatform`].
24150 ///
24151 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24152 /// tokens for more than one scope.
24153 ///
24154 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24155 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24156 /// sufficient, a read-write scope will do as well.
24157 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegionalEndpointCreateCall<'a, C>
24158 where
24159 St: AsRef<str>,
24160 {
24161 self._scopes.insert(String::from(scope.as_ref()));
24162 self
24163 }
24164 /// Identifies the authorization scope(s) for the method you are building.
24165 ///
24166 /// See [`Self::add_scope()`] for details.
24167 pub fn add_scopes<I, St>(
24168 mut self,
24169 scopes: I,
24170 ) -> ProjectLocationRegionalEndpointCreateCall<'a, C>
24171 where
24172 I: IntoIterator<Item = St>,
24173 St: AsRef<str>,
24174 {
24175 self._scopes
24176 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24177 self
24178 }
24179
24180 /// Removes all scopes, and no default scope will be used either.
24181 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24182 /// for details).
24183 pub fn clear_scopes(mut self) -> ProjectLocationRegionalEndpointCreateCall<'a, C> {
24184 self._scopes.clear();
24185 self
24186 }
24187}
24188
24189/// Deletes a single RegionalEndpoint.
24190///
24191/// A builder for the *locations.regionalEndpoints.delete* method supported by a *project* resource.
24192/// It is not used directly, but through a [`ProjectMethods`] instance.
24193///
24194/// # Example
24195///
24196/// Instantiate a resource method builder
24197///
24198/// ```test_harness,no_run
24199/// # extern crate hyper;
24200/// # extern crate hyper_rustls;
24201/// # extern crate google_networkconnectivity1 as networkconnectivity1;
24202/// # async fn dox() {
24203/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24204///
24205/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24206/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24207/// # .with_native_roots()
24208/// # .unwrap()
24209/// # .https_only()
24210/// # .enable_http2()
24211/// # .build();
24212///
24213/// # let executor = hyper_util::rt::TokioExecutor::new();
24214/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24215/// # secret,
24216/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24217/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24218/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24219/// # ),
24220/// # ).build().await.unwrap();
24221///
24222/// # let client = hyper_util::client::legacy::Client::builder(
24223/// # hyper_util::rt::TokioExecutor::new()
24224/// # )
24225/// # .build(
24226/// # hyper_rustls::HttpsConnectorBuilder::new()
24227/// # .with_native_roots()
24228/// # .unwrap()
24229/// # .https_or_http()
24230/// # .enable_http2()
24231/// # .build()
24232/// # );
24233/// # let mut hub = Networkconnectivity::new(client, auth);
24234/// // You can configure optional parameters by calling the respective setters at will, and
24235/// // execute the final call using `doit()`.
24236/// // Values shown here are possibly random and not representative !
24237/// let result = hub.projects().locations_regional_endpoints_delete("name")
24238/// .request_id("amet")
24239/// .doit().await;
24240/// # }
24241/// ```
24242pub struct ProjectLocationRegionalEndpointDeleteCall<'a, C>
24243where
24244 C: 'a,
24245{
24246 hub: &'a Networkconnectivity<C>,
24247 _name: String,
24248 _request_id: Option<String>,
24249 _delegate: Option<&'a mut dyn common::Delegate>,
24250 _additional_params: HashMap<String, String>,
24251 _scopes: BTreeSet<String>,
24252}
24253
24254impl<'a, C> common::CallBuilder for ProjectLocationRegionalEndpointDeleteCall<'a, C> {}
24255
24256impl<'a, C> ProjectLocationRegionalEndpointDeleteCall<'a, C>
24257where
24258 C: common::Connector,
24259{
24260 /// Perform the operation you have build so far.
24261 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
24262 use std::borrow::Cow;
24263 use std::io::{Read, Seek};
24264
24265 use common::{url::Params, ToParts};
24266 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24267
24268 let mut dd = common::DefaultDelegate;
24269 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24270 dlg.begin(common::MethodInfo {
24271 id: "networkconnectivity.projects.locations.regionalEndpoints.delete",
24272 http_method: hyper::Method::DELETE,
24273 });
24274
24275 for &field in ["alt", "name", "requestId"].iter() {
24276 if self._additional_params.contains_key(field) {
24277 dlg.finished(false);
24278 return Err(common::Error::FieldClash(field));
24279 }
24280 }
24281
24282 let mut params = Params::with_capacity(4 + self._additional_params.len());
24283 params.push("name", self._name);
24284 if let Some(value) = self._request_id.as_ref() {
24285 params.push("requestId", value);
24286 }
24287
24288 params.extend(self._additional_params.iter());
24289
24290 params.push("alt", "json");
24291 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24292 if self._scopes.is_empty() {
24293 self._scopes
24294 .insert(Scope::CloudPlatform.as_ref().to_string());
24295 }
24296
24297 #[allow(clippy::single_element_loop)]
24298 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24299 url = params.uri_replacement(url, param_name, find_this, true);
24300 }
24301 {
24302 let to_remove = ["name"];
24303 params.remove_params(&to_remove);
24304 }
24305
24306 let url = params.parse_with_url(&url);
24307
24308 loop {
24309 let token = match self
24310 .hub
24311 .auth
24312 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24313 .await
24314 {
24315 Ok(token) => token,
24316 Err(e) => match dlg.token(e) {
24317 Ok(token) => token,
24318 Err(e) => {
24319 dlg.finished(false);
24320 return Err(common::Error::MissingToken(e));
24321 }
24322 },
24323 };
24324 let mut req_result = {
24325 let client = &self.hub.client;
24326 dlg.pre_request();
24327 let mut req_builder = hyper::Request::builder()
24328 .method(hyper::Method::DELETE)
24329 .uri(url.as_str())
24330 .header(USER_AGENT, self.hub._user_agent.clone());
24331
24332 if let Some(token) = token.as_ref() {
24333 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24334 }
24335
24336 let request = req_builder
24337 .header(CONTENT_LENGTH, 0_u64)
24338 .body(common::to_body::<String>(None));
24339
24340 client.request(request.unwrap()).await
24341 };
24342
24343 match req_result {
24344 Err(err) => {
24345 if let common::Retry::After(d) = dlg.http_error(&err) {
24346 sleep(d).await;
24347 continue;
24348 }
24349 dlg.finished(false);
24350 return Err(common::Error::HttpError(err));
24351 }
24352 Ok(res) => {
24353 let (mut parts, body) = res.into_parts();
24354 let mut body = common::Body::new(body);
24355 if !parts.status.is_success() {
24356 let bytes = common::to_bytes(body).await.unwrap_or_default();
24357 let error = serde_json::from_str(&common::to_string(&bytes));
24358 let response = common::to_response(parts, bytes.into());
24359
24360 if let common::Retry::After(d) =
24361 dlg.http_failure(&response, error.as_ref().ok())
24362 {
24363 sleep(d).await;
24364 continue;
24365 }
24366
24367 dlg.finished(false);
24368
24369 return Err(match error {
24370 Ok(value) => common::Error::BadRequest(value),
24371 _ => common::Error::Failure(response),
24372 });
24373 }
24374 let response = {
24375 let bytes = common::to_bytes(body).await.unwrap_or_default();
24376 let encoded = common::to_string(&bytes);
24377 match serde_json::from_str(&encoded) {
24378 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24379 Err(error) => {
24380 dlg.response_json_decode_error(&encoded, &error);
24381 return Err(common::Error::JsonDecodeError(
24382 encoded.to_string(),
24383 error,
24384 ));
24385 }
24386 }
24387 };
24388
24389 dlg.finished(true);
24390 return Ok(response);
24391 }
24392 }
24393 }
24394 }
24395
24396 /// Required. The name of the RegionalEndpoint to delete.
24397 ///
24398 /// Sets the *name* path property to the given value.
24399 ///
24400 /// Even though the property as already been set when instantiating this call,
24401 /// we provide this method for API completeness.
24402 pub fn name(mut self, new_value: &str) -> ProjectLocationRegionalEndpointDeleteCall<'a, C> {
24403 self._name = new_value.to_string();
24404 self
24405 }
24406 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if the original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
24407 ///
24408 /// Sets the *request id* query property to the given value.
24409 pub fn request_id(
24410 mut self,
24411 new_value: &str,
24412 ) -> ProjectLocationRegionalEndpointDeleteCall<'a, C> {
24413 self._request_id = Some(new_value.to_string());
24414 self
24415 }
24416 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24417 /// while executing the actual API request.
24418 ///
24419 /// ````text
24420 /// It should be used to handle progress information, and to implement a certain level of resilience.
24421 /// ````
24422 ///
24423 /// Sets the *delegate* property to the given value.
24424 pub fn delegate(
24425 mut self,
24426 new_value: &'a mut dyn common::Delegate,
24427 ) -> ProjectLocationRegionalEndpointDeleteCall<'a, C> {
24428 self._delegate = Some(new_value);
24429 self
24430 }
24431
24432 /// Set any additional parameter of the query string used in the request.
24433 /// It should be used to set parameters which are not yet available through their own
24434 /// setters.
24435 ///
24436 /// Please note that this method must not be used to set any of the known parameters
24437 /// which have their own setter method. If done anyway, the request will fail.
24438 ///
24439 /// # Additional Parameters
24440 ///
24441 /// * *$.xgafv* (query-string) - V1 error format.
24442 /// * *access_token* (query-string) - OAuth access token.
24443 /// * *alt* (query-string) - Data format for response.
24444 /// * *callback* (query-string) - JSONP
24445 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24446 /// * *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.
24447 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24448 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24449 /// * *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.
24450 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24451 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24452 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegionalEndpointDeleteCall<'a, C>
24453 where
24454 T: AsRef<str>,
24455 {
24456 self._additional_params
24457 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24458 self
24459 }
24460
24461 /// Identifies the authorization scope for the method you are building.
24462 ///
24463 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24464 /// [`Scope::CloudPlatform`].
24465 ///
24466 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24467 /// tokens for more than one scope.
24468 ///
24469 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24470 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24471 /// sufficient, a read-write scope will do as well.
24472 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegionalEndpointDeleteCall<'a, C>
24473 where
24474 St: AsRef<str>,
24475 {
24476 self._scopes.insert(String::from(scope.as_ref()));
24477 self
24478 }
24479 /// Identifies the authorization scope(s) for the method you are building.
24480 ///
24481 /// See [`Self::add_scope()`] for details.
24482 pub fn add_scopes<I, St>(
24483 mut self,
24484 scopes: I,
24485 ) -> ProjectLocationRegionalEndpointDeleteCall<'a, C>
24486 where
24487 I: IntoIterator<Item = St>,
24488 St: AsRef<str>,
24489 {
24490 self._scopes
24491 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24492 self
24493 }
24494
24495 /// Removes all scopes, and no default scope will be used either.
24496 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24497 /// for details).
24498 pub fn clear_scopes(mut self) -> ProjectLocationRegionalEndpointDeleteCall<'a, C> {
24499 self._scopes.clear();
24500 self
24501 }
24502}
24503
24504/// Gets details of a single RegionalEndpoint.
24505///
24506/// A builder for the *locations.regionalEndpoints.get* method supported by a *project* resource.
24507/// It is not used directly, but through a [`ProjectMethods`] instance.
24508///
24509/// # Example
24510///
24511/// Instantiate a resource method builder
24512///
24513/// ```test_harness,no_run
24514/// # extern crate hyper;
24515/// # extern crate hyper_rustls;
24516/// # extern crate google_networkconnectivity1 as networkconnectivity1;
24517/// # async fn dox() {
24518/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24519///
24520/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24521/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24522/// # .with_native_roots()
24523/// # .unwrap()
24524/// # .https_only()
24525/// # .enable_http2()
24526/// # .build();
24527///
24528/// # let executor = hyper_util::rt::TokioExecutor::new();
24529/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24530/// # secret,
24531/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24532/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24533/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24534/// # ),
24535/// # ).build().await.unwrap();
24536///
24537/// # let client = hyper_util::client::legacy::Client::builder(
24538/// # hyper_util::rt::TokioExecutor::new()
24539/// # )
24540/// # .build(
24541/// # hyper_rustls::HttpsConnectorBuilder::new()
24542/// # .with_native_roots()
24543/// # .unwrap()
24544/// # .https_or_http()
24545/// # .enable_http2()
24546/// # .build()
24547/// # );
24548/// # let mut hub = Networkconnectivity::new(client, auth);
24549/// // You can configure optional parameters by calling the respective setters at will, and
24550/// // execute the final call using `doit()`.
24551/// // Values shown here are possibly random and not representative !
24552/// let result = hub.projects().locations_regional_endpoints_get("name")
24553/// .doit().await;
24554/// # }
24555/// ```
24556pub struct ProjectLocationRegionalEndpointGetCall<'a, C>
24557where
24558 C: 'a,
24559{
24560 hub: &'a Networkconnectivity<C>,
24561 _name: String,
24562 _delegate: Option<&'a mut dyn common::Delegate>,
24563 _additional_params: HashMap<String, String>,
24564 _scopes: BTreeSet<String>,
24565}
24566
24567impl<'a, C> common::CallBuilder for ProjectLocationRegionalEndpointGetCall<'a, C> {}
24568
24569impl<'a, C> ProjectLocationRegionalEndpointGetCall<'a, C>
24570where
24571 C: common::Connector,
24572{
24573 /// Perform the operation you have build so far.
24574 pub async fn doit(mut self) -> common::Result<(common::Response, RegionalEndpoint)> {
24575 use std::borrow::Cow;
24576 use std::io::{Read, Seek};
24577
24578 use common::{url::Params, ToParts};
24579 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24580
24581 let mut dd = common::DefaultDelegate;
24582 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24583 dlg.begin(common::MethodInfo {
24584 id: "networkconnectivity.projects.locations.regionalEndpoints.get",
24585 http_method: hyper::Method::GET,
24586 });
24587
24588 for &field in ["alt", "name"].iter() {
24589 if self._additional_params.contains_key(field) {
24590 dlg.finished(false);
24591 return Err(common::Error::FieldClash(field));
24592 }
24593 }
24594
24595 let mut params = Params::with_capacity(3 + self._additional_params.len());
24596 params.push("name", self._name);
24597
24598 params.extend(self._additional_params.iter());
24599
24600 params.push("alt", "json");
24601 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24602 if self._scopes.is_empty() {
24603 self._scopes
24604 .insert(Scope::CloudPlatform.as_ref().to_string());
24605 }
24606
24607 #[allow(clippy::single_element_loop)]
24608 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24609 url = params.uri_replacement(url, param_name, find_this, true);
24610 }
24611 {
24612 let to_remove = ["name"];
24613 params.remove_params(&to_remove);
24614 }
24615
24616 let url = params.parse_with_url(&url);
24617
24618 loop {
24619 let token = match self
24620 .hub
24621 .auth
24622 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24623 .await
24624 {
24625 Ok(token) => token,
24626 Err(e) => match dlg.token(e) {
24627 Ok(token) => token,
24628 Err(e) => {
24629 dlg.finished(false);
24630 return Err(common::Error::MissingToken(e));
24631 }
24632 },
24633 };
24634 let mut req_result = {
24635 let client = &self.hub.client;
24636 dlg.pre_request();
24637 let mut req_builder = hyper::Request::builder()
24638 .method(hyper::Method::GET)
24639 .uri(url.as_str())
24640 .header(USER_AGENT, self.hub._user_agent.clone());
24641
24642 if let Some(token) = token.as_ref() {
24643 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24644 }
24645
24646 let request = req_builder
24647 .header(CONTENT_LENGTH, 0_u64)
24648 .body(common::to_body::<String>(None));
24649
24650 client.request(request.unwrap()).await
24651 };
24652
24653 match req_result {
24654 Err(err) => {
24655 if let common::Retry::After(d) = dlg.http_error(&err) {
24656 sleep(d).await;
24657 continue;
24658 }
24659 dlg.finished(false);
24660 return Err(common::Error::HttpError(err));
24661 }
24662 Ok(res) => {
24663 let (mut parts, body) = res.into_parts();
24664 let mut body = common::Body::new(body);
24665 if !parts.status.is_success() {
24666 let bytes = common::to_bytes(body).await.unwrap_or_default();
24667 let error = serde_json::from_str(&common::to_string(&bytes));
24668 let response = common::to_response(parts, bytes.into());
24669
24670 if let common::Retry::After(d) =
24671 dlg.http_failure(&response, error.as_ref().ok())
24672 {
24673 sleep(d).await;
24674 continue;
24675 }
24676
24677 dlg.finished(false);
24678
24679 return Err(match error {
24680 Ok(value) => common::Error::BadRequest(value),
24681 _ => common::Error::Failure(response),
24682 });
24683 }
24684 let response = {
24685 let bytes = common::to_bytes(body).await.unwrap_or_default();
24686 let encoded = common::to_string(&bytes);
24687 match serde_json::from_str(&encoded) {
24688 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24689 Err(error) => {
24690 dlg.response_json_decode_error(&encoded, &error);
24691 return Err(common::Error::JsonDecodeError(
24692 encoded.to_string(),
24693 error,
24694 ));
24695 }
24696 }
24697 };
24698
24699 dlg.finished(true);
24700 return Ok(response);
24701 }
24702 }
24703 }
24704 }
24705
24706 /// Required. Name of the RegionalEndpoint resource to get. Format: `projects/{project}/locations/{location}/regionalEndpoints/{regional_endpoint}`
24707 ///
24708 /// Sets the *name* path property to the given value.
24709 ///
24710 /// Even though the property as already been set when instantiating this call,
24711 /// we provide this method for API completeness.
24712 pub fn name(mut self, new_value: &str) -> ProjectLocationRegionalEndpointGetCall<'a, C> {
24713 self._name = new_value.to_string();
24714 self
24715 }
24716 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24717 /// while executing the actual API request.
24718 ///
24719 /// ````text
24720 /// It should be used to handle progress information, and to implement a certain level of resilience.
24721 /// ````
24722 ///
24723 /// Sets the *delegate* property to the given value.
24724 pub fn delegate(
24725 mut self,
24726 new_value: &'a mut dyn common::Delegate,
24727 ) -> ProjectLocationRegionalEndpointGetCall<'a, C> {
24728 self._delegate = Some(new_value);
24729 self
24730 }
24731
24732 /// Set any additional parameter of the query string used in the request.
24733 /// It should be used to set parameters which are not yet available through their own
24734 /// setters.
24735 ///
24736 /// Please note that this method must not be used to set any of the known parameters
24737 /// which have their own setter method. If done anyway, the request will fail.
24738 ///
24739 /// # Additional Parameters
24740 ///
24741 /// * *$.xgafv* (query-string) - V1 error format.
24742 /// * *access_token* (query-string) - OAuth access token.
24743 /// * *alt* (query-string) - Data format for response.
24744 /// * *callback* (query-string) - JSONP
24745 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24746 /// * *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.
24747 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24748 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24749 /// * *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.
24750 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24751 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24752 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegionalEndpointGetCall<'a, C>
24753 where
24754 T: AsRef<str>,
24755 {
24756 self._additional_params
24757 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24758 self
24759 }
24760
24761 /// Identifies the authorization scope for the method you are building.
24762 ///
24763 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24764 /// [`Scope::CloudPlatform`].
24765 ///
24766 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24767 /// tokens for more than one scope.
24768 ///
24769 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24770 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24771 /// sufficient, a read-write scope will do as well.
24772 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegionalEndpointGetCall<'a, C>
24773 where
24774 St: AsRef<str>,
24775 {
24776 self._scopes.insert(String::from(scope.as_ref()));
24777 self
24778 }
24779 /// Identifies the authorization scope(s) for the method you are building.
24780 ///
24781 /// See [`Self::add_scope()`] for details.
24782 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegionalEndpointGetCall<'a, C>
24783 where
24784 I: IntoIterator<Item = St>,
24785 St: AsRef<str>,
24786 {
24787 self._scopes
24788 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24789 self
24790 }
24791
24792 /// Removes all scopes, and no default scope will be used either.
24793 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24794 /// for details).
24795 pub fn clear_scopes(mut self) -> ProjectLocationRegionalEndpointGetCall<'a, C> {
24796 self._scopes.clear();
24797 self
24798 }
24799}
24800
24801/// Lists RegionalEndpoints in a given project and location.
24802///
24803/// A builder for the *locations.regionalEndpoints.list* method supported by a *project* resource.
24804/// It is not used directly, but through a [`ProjectMethods`] instance.
24805///
24806/// # Example
24807///
24808/// Instantiate a resource method builder
24809///
24810/// ```test_harness,no_run
24811/// # extern crate hyper;
24812/// # extern crate hyper_rustls;
24813/// # extern crate google_networkconnectivity1 as networkconnectivity1;
24814/// # async fn dox() {
24815/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24816///
24817/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24818/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24819/// # .with_native_roots()
24820/// # .unwrap()
24821/// # .https_only()
24822/// # .enable_http2()
24823/// # .build();
24824///
24825/// # let executor = hyper_util::rt::TokioExecutor::new();
24826/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24827/// # secret,
24828/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24829/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24830/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24831/// # ),
24832/// # ).build().await.unwrap();
24833///
24834/// # let client = hyper_util::client::legacy::Client::builder(
24835/// # hyper_util::rt::TokioExecutor::new()
24836/// # )
24837/// # .build(
24838/// # hyper_rustls::HttpsConnectorBuilder::new()
24839/// # .with_native_roots()
24840/// # .unwrap()
24841/// # .https_or_http()
24842/// # .enable_http2()
24843/// # .build()
24844/// # );
24845/// # let mut hub = Networkconnectivity::new(client, auth);
24846/// // You can configure optional parameters by calling the respective setters at will, and
24847/// // execute the final call using `doit()`.
24848/// // Values shown here are possibly random and not representative !
24849/// let result = hub.projects().locations_regional_endpoints_list("parent")
24850/// .page_token("erat")
24851/// .page_size(-73)
24852/// .order_by("sea")
24853/// .filter("takimata")
24854/// .doit().await;
24855/// # }
24856/// ```
24857pub struct ProjectLocationRegionalEndpointListCall<'a, C>
24858where
24859 C: 'a,
24860{
24861 hub: &'a Networkconnectivity<C>,
24862 _parent: String,
24863 _page_token: Option<String>,
24864 _page_size: Option<i32>,
24865 _order_by: Option<String>,
24866 _filter: Option<String>,
24867 _delegate: Option<&'a mut dyn common::Delegate>,
24868 _additional_params: HashMap<String, String>,
24869 _scopes: BTreeSet<String>,
24870}
24871
24872impl<'a, C> common::CallBuilder for ProjectLocationRegionalEndpointListCall<'a, C> {}
24873
24874impl<'a, C> ProjectLocationRegionalEndpointListCall<'a, C>
24875where
24876 C: common::Connector,
24877{
24878 /// Perform the operation you have build so far.
24879 pub async fn doit(
24880 mut self,
24881 ) -> common::Result<(common::Response, ListRegionalEndpointsResponse)> {
24882 use std::borrow::Cow;
24883 use std::io::{Read, Seek};
24884
24885 use common::{url::Params, ToParts};
24886 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24887
24888 let mut dd = common::DefaultDelegate;
24889 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24890 dlg.begin(common::MethodInfo {
24891 id: "networkconnectivity.projects.locations.regionalEndpoints.list",
24892 http_method: hyper::Method::GET,
24893 });
24894
24895 for &field in [
24896 "alt",
24897 "parent",
24898 "pageToken",
24899 "pageSize",
24900 "orderBy",
24901 "filter",
24902 ]
24903 .iter()
24904 {
24905 if self._additional_params.contains_key(field) {
24906 dlg.finished(false);
24907 return Err(common::Error::FieldClash(field));
24908 }
24909 }
24910
24911 let mut params = Params::with_capacity(7 + self._additional_params.len());
24912 params.push("parent", self._parent);
24913 if let Some(value) = self._page_token.as_ref() {
24914 params.push("pageToken", value);
24915 }
24916 if let Some(value) = self._page_size.as_ref() {
24917 params.push("pageSize", value.to_string());
24918 }
24919 if let Some(value) = self._order_by.as_ref() {
24920 params.push("orderBy", value);
24921 }
24922 if let Some(value) = self._filter.as_ref() {
24923 params.push("filter", value);
24924 }
24925
24926 params.extend(self._additional_params.iter());
24927
24928 params.push("alt", "json");
24929 let mut url = self.hub._base_url.clone() + "v1/{+parent}/regionalEndpoints";
24930 if self._scopes.is_empty() {
24931 self._scopes
24932 .insert(Scope::CloudPlatform.as_ref().to_string());
24933 }
24934
24935 #[allow(clippy::single_element_loop)]
24936 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24937 url = params.uri_replacement(url, param_name, find_this, true);
24938 }
24939 {
24940 let to_remove = ["parent"];
24941 params.remove_params(&to_remove);
24942 }
24943
24944 let url = params.parse_with_url(&url);
24945
24946 loop {
24947 let token = match self
24948 .hub
24949 .auth
24950 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24951 .await
24952 {
24953 Ok(token) => token,
24954 Err(e) => match dlg.token(e) {
24955 Ok(token) => token,
24956 Err(e) => {
24957 dlg.finished(false);
24958 return Err(common::Error::MissingToken(e));
24959 }
24960 },
24961 };
24962 let mut req_result = {
24963 let client = &self.hub.client;
24964 dlg.pre_request();
24965 let mut req_builder = hyper::Request::builder()
24966 .method(hyper::Method::GET)
24967 .uri(url.as_str())
24968 .header(USER_AGENT, self.hub._user_agent.clone());
24969
24970 if let Some(token) = token.as_ref() {
24971 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24972 }
24973
24974 let request = req_builder
24975 .header(CONTENT_LENGTH, 0_u64)
24976 .body(common::to_body::<String>(None));
24977
24978 client.request(request.unwrap()).await
24979 };
24980
24981 match req_result {
24982 Err(err) => {
24983 if let common::Retry::After(d) = dlg.http_error(&err) {
24984 sleep(d).await;
24985 continue;
24986 }
24987 dlg.finished(false);
24988 return Err(common::Error::HttpError(err));
24989 }
24990 Ok(res) => {
24991 let (mut parts, body) = res.into_parts();
24992 let mut body = common::Body::new(body);
24993 if !parts.status.is_success() {
24994 let bytes = common::to_bytes(body).await.unwrap_or_default();
24995 let error = serde_json::from_str(&common::to_string(&bytes));
24996 let response = common::to_response(parts, bytes.into());
24997
24998 if let common::Retry::After(d) =
24999 dlg.http_failure(&response, error.as_ref().ok())
25000 {
25001 sleep(d).await;
25002 continue;
25003 }
25004
25005 dlg.finished(false);
25006
25007 return Err(match error {
25008 Ok(value) => common::Error::BadRequest(value),
25009 _ => common::Error::Failure(response),
25010 });
25011 }
25012 let response = {
25013 let bytes = common::to_bytes(body).await.unwrap_or_default();
25014 let encoded = common::to_string(&bytes);
25015 match serde_json::from_str(&encoded) {
25016 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25017 Err(error) => {
25018 dlg.response_json_decode_error(&encoded, &error);
25019 return Err(common::Error::JsonDecodeError(
25020 encoded.to_string(),
25021 error,
25022 ));
25023 }
25024 }
25025 };
25026
25027 dlg.finished(true);
25028 return Ok(response);
25029 }
25030 }
25031 }
25032 }
25033
25034 /// Required. The parent resource's name of the RegionalEndpoint.
25035 ///
25036 /// Sets the *parent* path property to the given value.
25037 ///
25038 /// Even though the property as already been set when instantiating this call,
25039 /// we provide this method for API completeness.
25040 pub fn parent(mut self, new_value: &str) -> ProjectLocationRegionalEndpointListCall<'a, C> {
25041 self._parent = new_value.to_string();
25042 self
25043 }
25044 /// A page token.
25045 ///
25046 /// Sets the *page token* query property to the given value.
25047 pub fn page_token(mut self, new_value: &str) -> ProjectLocationRegionalEndpointListCall<'a, C> {
25048 self._page_token = Some(new_value.to_string());
25049 self
25050 }
25051 /// Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.
25052 ///
25053 /// Sets the *page size* query property to the given value.
25054 pub fn page_size(mut self, new_value: i32) -> ProjectLocationRegionalEndpointListCall<'a, C> {
25055 self._page_size = Some(new_value);
25056 self
25057 }
25058 /// Sort the results by a certain order.
25059 ///
25060 /// Sets the *order by* query property to the given value.
25061 pub fn order_by(mut self, new_value: &str) -> ProjectLocationRegionalEndpointListCall<'a, C> {
25062 self._order_by = Some(new_value.to_string());
25063 self
25064 }
25065 /// A filter expression that filters the results listed in the response.
25066 ///
25067 /// Sets the *filter* query property to the given value.
25068 pub fn filter(mut self, new_value: &str) -> ProjectLocationRegionalEndpointListCall<'a, C> {
25069 self._filter = Some(new_value.to_string());
25070 self
25071 }
25072 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25073 /// while executing the actual API request.
25074 ///
25075 /// ````text
25076 /// It should be used to handle progress information, and to implement a certain level of resilience.
25077 /// ````
25078 ///
25079 /// Sets the *delegate* property to the given value.
25080 pub fn delegate(
25081 mut self,
25082 new_value: &'a mut dyn common::Delegate,
25083 ) -> ProjectLocationRegionalEndpointListCall<'a, C> {
25084 self._delegate = Some(new_value);
25085 self
25086 }
25087
25088 /// Set any additional parameter of the query string used in the request.
25089 /// It should be used to set parameters which are not yet available through their own
25090 /// setters.
25091 ///
25092 /// Please note that this method must not be used to set any of the known parameters
25093 /// which have their own setter method. If done anyway, the request will fail.
25094 ///
25095 /// # Additional Parameters
25096 ///
25097 /// * *$.xgafv* (query-string) - V1 error format.
25098 /// * *access_token* (query-string) - OAuth access token.
25099 /// * *alt* (query-string) - Data format for response.
25100 /// * *callback* (query-string) - JSONP
25101 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25102 /// * *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.
25103 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25104 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25105 /// * *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.
25106 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25107 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25108 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegionalEndpointListCall<'a, C>
25109 where
25110 T: AsRef<str>,
25111 {
25112 self._additional_params
25113 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25114 self
25115 }
25116
25117 /// Identifies the authorization scope for the method you are building.
25118 ///
25119 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25120 /// [`Scope::CloudPlatform`].
25121 ///
25122 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25123 /// tokens for more than one scope.
25124 ///
25125 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25126 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25127 /// sufficient, a read-write scope will do as well.
25128 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegionalEndpointListCall<'a, C>
25129 where
25130 St: AsRef<str>,
25131 {
25132 self._scopes.insert(String::from(scope.as_ref()));
25133 self
25134 }
25135 /// Identifies the authorization scope(s) for the method you are building.
25136 ///
25137 /// See [`Self::add_scope()`] for details.
25138 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegionalEndpointListCall<'a, C>
25139 where
25140 I: IntoIterator<Item = St>,
25141 St: AsRef<str>,
25142 {
25143 self._scopes
25144 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25145 self
25146 }
25147
25148 /// Removes all scopes, and no default scope will be used either.
25149 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25150 /// for details).
25151 pub fn clear_scopes(mut self) -> ProjectLocationRegionalEndpointListCall<'a, C> {
25152 self._scopes.clear();
25153 self
25154 }
25155}
25156
25157/// Deletes a single ServiceClass.
25158///
25159/// A builder for the *locations.serviceClasses.delete* method supported by a *project* resource.
25160/// It is not used directly, but through a [`ProjectMethods`] instance.
25161///
25162/// # Example
25163///
25164/// Instantiate a resource method builder
25165///
25166/// ```test_harness,no_run
25167/// # extern crate hyper;
25168/// # extern crate hyper_rustls;
25169/// # extern crate google_networkconnectivity1 as networkconnectivity1;
25170/// # async fn dox() {
25171/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25172///
25173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25174/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25175/// # .with_native_roots()
25176/// # .unwrap()
25177/// # .https_only()
25178/// # .enable_http2()
25179/// # .build();
25180///
25181/// # let executor = hyper_util::rt::TokioExecutor::new();
25182/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25183/// # secret,
25184/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25185/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25186/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25187/// # ),
25188/// # ).build().await.unwrap();
25189///
25190/// # let client = hyper_util::client::legacy::Client::builder(
25191/// # hyper_util::rt::TokioExecutor::new()
25192/// # )
25193/// # .build(
25194/// # hyper_rustls::HttpsConnectorBuilder::new()
25195/// # .with_native_roots()
25196/// # .unwrap()
25197/// # .https_or_http()
25198/// # .enable_http2()
25199/// # .build()
25200/// # );
25201/// # let mut hub = Networkconnectivity::new(client, auth);
25202/// // You can configure optional parameters by calling the respective setters at will, and
25203/// // execute the final call using `doit()`.
25204/// // Values shown here are possibly random and not representative !
25205/// let result = hub.projects().locations_service_classes_delete("name")
25206/// .request_id("et")
25207/// .etag("At")
25208/// .doit().await;
25209/// # }
25210/// ```
25211pub struct ProjectLocationServiceClassDeleteCall<'a, C>
25212where
25213 C: 'a,
25214{
25215 hub: &'a Networkconnectivity<C>,
25216 _name: String,
25217 _request_id: Option<String>,
25218 _etag: Option<String>,
25219 _delegate: Option<&'a mut dyn common::Delegate>,
25220 _additional_params: HashMap<String, String>,
25221 _scopes: BTreeSet<String>,
25222}
25223
25224impl<'a, C> common::CallBuilder for ProjectLocationServiceClassDeleteCall<'a, C> {}
25225
25226impl<'a, C> ProjectLocationServiceClassDeleteCall<'a, C>
25227where
25228 C: common::Connector,
25229{
25230 /// Perform the operation you have build so far.
25231 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
25232 use std::borrow::Cow;
25233 use std::io::{Read, Seek};
25234
25235 use common::{url::Params, ToParts};
25236 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25237
25238 let mut dd = common::DefaultDelegate;
25239 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25240 dlg.begin(common::MethodInfo {
25241 id: "networkconnectivity.projects.locations.serviceClasses.delete",
25242 http_method: hyper::Method::DELETE,
25243 });
25244
25245 for &field in ["alt", "name", "requestId", "etag"].iter() {
25246 if self._additional_params.contains_key(field) {
25247 dlg.finished(false);
25248 return Err(common::Error::FieldClash(field));
25249 }
25250 }
25251
25252 let mut params = Params::with_capacity(5 + self._additional_params.len());
25253 params.push("name", self._name);
25254 if let Some(value) = self._request_id.as_ref() {
25255 params.push("requestId", value);
25256 }
25257 if let Some(value) = self._etag.as_ref() {
25258 params.push("etag", value);
25259 }
25260
25261 params.extend(self._additional_params.iter());
25262
25263 params.push("alt", "json");
25264 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25265 if self._scopes.is_empty() {
25266 self._scopes
25267 .insert(Scope::CloudPlatform.as_ref().to_string());
25268 }
25269
25270 #[allow(clippy::single_element_loop)]
25271 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25272 url = params.uri_replacement(url, param_name, find_this, true);
25273 }
25274 {
25275 let to_remove = ["name"];
25276 params.remove_params(&to_remove);
25277 }
25278
25279 let url = params.parse_with_url(&url);
25280
25281 loop {
25282 let token = match self
25283 .hub
25284 .auth
25285 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25286 .await
25287 {
25288 Ok(token) => token,
25289 Err(e) => match dlg.token(e) {
25290 Ok(token) => token,
25291 Err(e) => {
25292 dlg.finished(false);
25293 return Err(common::Error::MissingToken(e));
25294 }
25295 },
25296 };
25297 let mut req_result = {
25298 let client = &self.hub.client;
25299 dlg.pre_request();
25300 let mut req_builder = hyper::Request::builder()
25301 .method(hyper::Method::DELETE)
25302 .uri(url.as_str())
25303 .header(USER_AGENT, self.hub._user_agent.clone());
25304
25305 if let Some(token) = token.as_ref() {
25306 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25307 }
25308
25309 let request = req_builder
25310 .header(CONTENT_LENGTH, 0_u64)
25311 .body(common::to_body::<String>(None));
25312
25313 client.request(request.unwrap()).await
25314 };
25315
25316 match req_result {
25317 Err(err) => {
25318 if let common::Retry::After(d) = dlg.http_error(&err) {
25319 sleep(d).await;
25320 continue;
25321 }
25322 dlg.finished(false);
25323 return Err(common::Error::HttpError(err));
25324 }
25325 Ok(res) => {
25326 let (mut parts, body) = res.into_parts();
25327 let mut body = common::Body::new(body);
25328 if !parts.status.is_success() {
25329 let bytes = common::to_bytes(body).await.unwrap_or_default();
25330 let error = serde_json::from_str(&common::to_string(&bytes));
25331 let response = common::to_response(parts, bytes.into());
25332
25333 if let common::Retry::After(d) =
25334 dlg.http_failure(&response, error.as_ref().ok())
25335 {
25336 sleep(d).await;
25337 continue;
25338 }
25339
25340 dlg.finished(false);
25341
25342 return Err(match error {
25343 Ok(value) => common::Error::BadRequest(value),
25344 _ => common::Error::Failure(response),
25345 });
25346 }
25347 let response = {
25348 let bytes = common::to_bytes(body).await.unwrap_or_default();
25349 let encoded = common::to_string(&bytes);
25350 match serde_json::from_str(&encoded) {
25351 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25352 Err(error) => {
25353 dlg.response_json_decode_error(&encoded, &error);
25354 return Err(common::Error::JsonDecodeError(
25355 encoded.to_string(),
25356 error,
25357 ));
25358 }
25359 }
25360 };
25361
25362 dlg.finished(true);
25363 return Ok(response);
25364 }
25365 }
25366 }
25367 }
25368
25369 /// Required. The name of the ServiceClass to delete.
25370 ///
25371 /// Sets the *name* path property to the given value.
25372 ///
25373 /// Even though the property as already been set when instantiating this call,
25374 /// we provide this method for API completeness.
25375 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceClassDeleteCall<'a, C> {
25376 self._name = new_value.to_string();
25377 self
25378 }
25379 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
25380 ///
25381 /// Sets the *request id* query property to the given value.
25382 pub fn request_id(mut self, new_value: &str) -> ProjectLocationServiceClassDeleteCall<'a, C> {
25383 self._request_id = Some(new_value.to_string());
25384 self
25385 }
25386 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
25387 ///
25388 /// Sets the *etag* query property to the given value.
25389 pub fn etag(mut self, new_value: &str) -> ProjectLocationServiceClassDeleteCall<'a, C> {
25390 self._etag = Some(new_value.to_string());
25391 self
25392 }
25393 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25394 /// while executing the actual API request.
25395 ///
25396 /// ````text
25397 /// It should be used to handle progress information, and to implement a certain level of resilience.
25398 /// ````
25399 ///
25400 /// Sets the *delegate* property to the given value.
25401 pub fn delegate(
25402 mut self,
25403 new_value: &'a mut dyn common::Delegate,
25404 ) -> ProjectLocationServiceClassDeleteCall<'a, C> {
25405 self._delegate = Some(new_value);
25406 self
25407 }
25408
25409 /// Set any additional parameter of the query string used in the request.
25410 /// It should be used to set parameters which are not yet available through their own
25411 /// setters.
25412 ///
25413 /// Please note that this method must not be used to set any of the known parameters
25414 /// which have their own setter method. If done anyway, the request will fail.
25415 ///
25416 /// # Additional Parameters
25417 ///
25418 /// * *$.xgafv* (query-string) - V1 error format.
25419 /// * *access_token* (query-string) - OAuth access token.
25420 /// * *alt* (query-string) - Data format for response.
25421 /// * *callback* (query-string) - JSONP
25422 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25423 /// * *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.
25424 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25425 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25426 /// * *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.
25427 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25428 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25429 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceClassDeleteCall<'a, C>
25430 where
25431 T: AsRef<str>,
25432 {
25433 self._additional_params
25434 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25435 self
25436 }
25437
25438 /// Identifies the authorization scope for the method you are building.
25439 ///
25440 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25441 /// [`Scope::CloudPlatform`].
25442 ///
25443 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25444 /// tokens for more than one scope.
25445 ///
25446 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25447 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25448 /// sufficient, a read-write scope will do as well.
25449 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceClassDeleteCall<'a, C>
25450 where
25451 St: AsRef<str>,
25452 {
25453 self._scopes.insert(String::from(scope.as_ref()));
25454 self
25455 }
25456 /// Identifies the authorization scope(s) for the method you are building.
25457 ///
25458 /// See [`Self::add_scope()`] for details.
25459 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceClassDeleteCall<'a, C>
25460 where
25461 I: IntoIterator<Item = St>,
25462 St: AsRef<str>,
25463 {
25464 self._scopes
25465 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25466 self
25467 }
25468
25469 /// Removes all scopes, and no default scope will be used either.
25470 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25471 /// for details).
25472 pub fn clear_scopes(mut self) -> ProjectLocationServiceClassDeleteCall<'a, C> {
25473 self._scopes.clear();
25474 self
25475 }
25476}
25477
25478/// Gets details of a single ServiceClass.
25479///
25480/// A builder for the *locations.serviceClasses.get* method supported by a *project* resource.
25481/// It is not used directly, but through a [`ProjectMethods`] instance.
25482///
25483/// # Example
25484///
25485/// Instantiate a resource method builder
25486///
25487/// ```test_harness,no_run
25488/// # extern crate hyper;
25489/// # extern crate hyper_rustls;
25490/// # extern crate google_networkconnectivity1 as networkconnectivity1;
25491/// # async fn dox() {
25492/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25493///
25494/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25495/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25496/// # .with_native_roots()
25497/// # .unwrap()
25498/// # .https_only()
25499/// # .enable_http2()
25500/// # .build();
25501///
25502/// # let executor = hyper_util::rt::TokioExecutor::new();
25503/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25504/// # secret,
25505/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25506/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25507/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25508/// # ),
25509/// # ).build().await.unwrap();
25510///
25511/// # let client = hyper_util::client::legacy::Client::builder(
25512/// # hyper_util::rt::TokioExecutor::new()
25513/// # )
25514/// # .build(
25515/// # hyper_rustls::HttpsConnectorBuilder::new()
25516/// # .with_native_roots()
25517/// # .unwrap()
25518/// # .https_or_http()
25519/// # .enable_http2()
25520/// # .build()
25521/// # );
25522/// # let mut hub = Networkconnectivity::new(client, auth);
25523/// // You can configure optional parameters by calling the respective setters at will, and
25524/// // execute the final call using `doit()`.
25525/// // Values shown here are possibly random and not representative !
25526/// let result = hub.projects().locations_service_classes_get("name")
25527/// .doit().await;
25528/// # }
25529/// ```
25530pub struct ProjectLocationServiceClassGetCall<'a, C>
25531where
25532 C: 'a,
25533{
25534 hub: &'a Networkconnectivity<C>,
25535 _name: String,
25536 _delegate: Option<&'a mut dyn common::Delegate>,
25537 _additional_params: HashMap<String, String>,
25538 _scopes: BTreeSet<String>,
25539}
25540
25541impl<'a, C> common::CallBuilder for ProjectLocationServiceClassGetCall<'a, C> {}
25542
25543impl<'a, C> ProjectLocationServiceClassGetCall<'a, C>
25544where
25545 C: common::Connector,
25546{
25547 /// Perform the operation you have build so far.
25548 pub async fn doit(mut self) -> common::Result<(common::Response, ServiceClass)> {
25549 use std::borrow::Cow;
25550 use std::io::{Read, Seek};
25551
25552 use common::{url::Params, ToParts};
25553 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25554
25555 let mut dd = common::DefaultDelegate;
25556 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25557 dlg.begin(common::MethodInfo {
25558 id: "networkconnectivity.projects.locations.serviceClasses.get",
25559 http_method: hyper::Method::GET,
25560 });
25561
25562 for &field in ["alt", "name"].iter() {
25563 if self._additional_params.contains_key(field) {
25564 dlg.finished(false);
25565 return Err(common::Error::FieldClash(field));
25566 }
25567 }
25568
25569 let mut params = Params::with_capacity(3 + self._additional_params.len());
25570 params.push("name", self._name);
25571
25572 params.extend(self._additional_params.iter());
25573
25574 params.push("alt", "json");
25575 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25576 if self._scopes.is_empty() {
25577 self._scopes
25578 .insert(Scope::CloudPlatform.as_ref().to_string());
25579 }
25580
25581 #[allow(clippy::single_element_loop)]
25582 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25583 url = params.uri_replacement(url, param_name, find_this, true);
25584 }
25585 {
25586 let to_remove = ["name"];
25587 params.remove_params(&to_remove);
25588 }
25589
25590 let url = params.parse_with_url(&url);
25591
25592 loop {
25593 let token = match self
25594 .hub
25595 .auth
25596 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25597 .await
25598 {
25599 Ok(token) => token,
25600 Err(e) => match dlg.token(e) {
25601 Ok(token) => token,
25602 Err(e) => {
25603 dlg.finished(false);
25604 return Err(common::Error::MissingToken(e));
25605 }
25606 },
25607 };
25608 let mut req_result = {
25609 let client = &self.hub.client;
25610 dlg.pre_request();
25611 let mut req_builder = hyper::Request::builder()
25612 .method(hyper::Method::GET)
25613 .uri(url.as_str())
25614 .header(USER_AGENT, self.hub._user_agent.clone());
25615
25616 if let Some(token) = token.as_ref() {
25617 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25618 }
25619
25620 let request = req_builder
25621 .header(CONTENT_LENGTH, 0_u64)
25622 .body(common::to_body::<String>(None));
25623
25624 client.request(request.unwrap()).await
25625 };
25626
25627 match req_result {
25628 Err(err) => {
25629 if let common::Retry::After(d) = dlg.http_error(&err) {
25630 sleep(d).await;
25631 continue;
25632 }
25633 dlg.finished(false);
25634 return Err(common::Error::HttpError(err));
25635 }
25636 Ok(res) => {
25637 let (mut parts, body) = res.into_parts();
25638 let mut body = common::Body::new(body);
25639 if !parts.status.is_success() {
25640 let bytes = common::to_bytes(body).await.unwrap_or_default();
25641 let error = serde_json::from_str(&common::to_string(&bytes));
25642 let response = common::to_response(parts, bytes.into());
25643
25644 if let common::Retry::After(d) =
25645 dlg.http_failure(&response, error.as_ref().ok())
25646 {
25647 sleep(d).await;
25648 continue;
25649 }
25650
25651 dlg.finished(false);
25652
25653 return Err(match error {
25654 Ok(value) => common::Error::BadRequest(value),
25655 _ => common::Error::Failure(response),
25656 });
25657 }
25658 let response = {
25659 let bytes = common::to_bytes(body).await.unwrap_or_default();
25660 let encoded = common::to_string(&bytes);
25661 match serde_json::from_str(&encoded) {
25662 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25663 Err(error) => {
25664 dlg.response_json_decode_error(&encoded, &error);
25665 return Err(common::Error::JsonDecodeError(
25666 encoded.to_string(),
25667 error,
25668 ));
25669 }
25670 }
25671 };
25672
25673 dlg.finished(true);
25674 return Ok(response);
25675 }
25676 }
25677 }
25678 }
25679
25680 /// Required. Name of the ServiceClass to get.
25681 ///
25682 /// Sets the *name* path property to the given value.
25683 ///
25684 /// Even though the property as already been set when instantiating this call,
25685 /// we provide this method for API completeness.
25686 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceClassGetCall<'a, C> {
25687 self._name = new_value.to_string();
25688 self
25689 }
25690 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25691 /// while executing the actual API request.
25692 ///
25693 /// ````text
25694 /// It should be used to handle progress information, and to implement a certain level of resilience.
25695 /// ````
25696 ///
25697 /// Sets the *delegate* property to the given value.
25698 pub fn delegate(
25699 mut self,
25700 new_value: &'a mut dyn common::Delegate,
25701 ) -> ProjectLocationServiceClassGetCall<'a, C> {
25702 self._delegate = Some(new_value);
25703 self
25704 }
25705
25706 /// Set any additional parameter of the query string used in the request.
25707 /// It should be used to set parameters which are not yet available through their own
25708 /// setters.
25709 ///
25710 /// Please note that this method must not be used to set any of the known parameters
25711 /// which have their own setter method. If done anyway, the request will fail.
25712 ///
25713 /// # Additional Parameters
25714 ///
25715 /// * *$.xgafv* (query-string) - V1 error format.
25716 /// * *access_token* (query-string) - OAuth access token.
25717 /// * *alt* (query-string) - Data format for response.
25718 /// * *callback* (query-string) - JSONP
25719 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25720 /// * *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.
25721 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25722 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25723 /// * *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.
25724 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25725 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25726 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceClassGetCall<'a, C>
25727 where
25728 T: AsRef<str>,
25729 {
25730 self._additional_params
25731 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25732 self
25733 }
25734
25735 /// Identifies the authorization scope for the method you are building.
25736 ///
25737 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25738 /// [`Scope::CloudPlatform`].
25739 ///
25740 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25741 /// tokens for more than one scope.
25742 ///
25743 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25744 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25745 /// sufficient, a read-write scope will do as well.
25746 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceClassGetCall<'a, C>
25747 where
25748 St: AsRef<str>,
25749 {
25750 self._scopes.insert(String::from(scope.as_ref()));
25751 self
25752 }
25753 /// Identifies the authorization scope(s) for the method you are building.
25754 ///
25755 /// See [`Self::add_scope()`] for details.
25756 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceClassGetCall<'a, C>
25757 where
25758 I: IntoIterator<Item = St>,
25759 St: AsRef<str>,
25760 {
25761 self._scopes
25762 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25763 self
25764 }
25765
25766 /// Removes all scopes, and no default scope will be used either.
25767 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25768 /// for details).
25769 pub fn clear_scopes(mut self) -> ProjectLocationServiceClassGetCall<'a, C> {
25770 self._scopes.clear();
25771 self
25772 }
25773}
25774
25775/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
25776///
25777/// A builder for the *locations.serviceClasses.getIamPolicy* method supported by a *project* resource.
25778/// It is not used directly, but through a [`ProjectMethods`] instance.
25779///
25780/// # Example
25781///
25782/// Instantiate a resource method builder
25783///
25784/// ```test_harness,no_run
25785/// # extern crate hyper;
25786/// # extern crate hyper_rustls;
25787/// # extern crate google_networkconnectivity1 as networkconnectivity1;
25788/// # async fn dox() {
25789/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25790///
25791/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25792/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25793/// # .with_native_roots()
25794/// # .unwrap()
25795/// # .https_only()
25796/// # .enable_http2()
25797/// # .build();
25798///
25799/// # let executor = hyper_util::rt::TokioExecutor::new();
25800/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25801/// # secret,
25802/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25803/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25804/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25805/// # ),
25806/// # ).build().await.unwrap();
25807///
25808/// # let client = hyper_util::client::legacy::Client::builder(
25809/// # hyper_util::rt::TokioExecutor::new()
25810/// # )
25811/// # .build(
25812/// # hyper_rustls::HttpsConnectorBuilder::new()
25813/// # .with_native_roots()
25814/// # .unwrap()
25815/// # .https_or_http()
25816/// # .enable_http2()
25817/// # .build()
25818/// # );
25819/// # let mut hub = Networkconnectivity::new(client, auth);
25820/// // You can configure optional parameters by calling the respective setters at will, and
25821/// // execute the final call using `doit()`.
25822/// // Values shown here are possibly random and not representative !
25823/// let result = hub.projects().locations_service_classes_get_iam_policy("resource")
25824/// .options_requested_policy_version(-48)
25825/// .doit().await;
25826/// # }
25827/// ```
25828pub struct ProjectLocationServiceClassGetIamPolicyCall<'a, C>
25829where
25830 C: 'a,
25831{
25832 hub: &'a Networkconnectivity<C>,
25833 _resource: String,
25834 _options_requested_policy_version: Option<i32>,
25835 _delegate: Option<&'a mut dyn common::Delegate>,
25836 _additional_params: HashMap<String, String>,
25837 _scopes: BTreeSet<String>,
25838}
25839
25840impl<'a, C> common::CallBuilder for ProjectLocationServiceClassGetIamPolicyCall<'a, C> {}
25841
25842impl<'a, C> ProjectLocationServiceClassGetIamPolicyCall<'a, C>
25843where
25844 C: common::Connector,
25845{
25846 /// Perform the operation you have build so far.
25847 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
25848 use std::borrow::Cow;
25849 use std::io::{Read, Seek};
25850
25851 use common::{url::Params, ToParts};
25852 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25853
25854 let mut dd = common::DefaultDelegate;
25855 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25856 dlg.begin(common::MethodInfo {
25857 id: "networkconnectivity.projects.locations.serviceClasses.getIamPolicy",
25858 http_method: hyper::Method::GET,
25859 });
25860
25861 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
25862 if self._additional_params.contains_key(field) {
25863 dlg.finished(false);
25864 return Err(common::Error::FieldClash(field));
25865 }
25866 }
25867
25868 let mut params = Params::with_capacity(4 + self._additional_params.len());
25869 params.push("resource", self._resource);
25870 if let Some(value) = self._options_requested_policy_version.as_ref() {
25871 params.push("options.requestedPolicyVersion", value.to_string());
25872 }
25873
25874 params.extend(self._additional_params.iter());
25875
25876 params.push("alt", "json");
25877 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
25878 if self._scopes.is_empty() {
25879 self._scopes
25880 .insert(Scope::CloudPlatform.as_ref().to_string());
25881 }
25882
25883 #[allow(clippy::single_element_loop)]
25884 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25885 url = params.uri_replacement(url, param_name, find_this, true);
25886 }
25887 {
25888 let to_remove = ["resource"];
25889 params.remove_params(&to_remove);
25890 }
25891
25892 let url = params.parse_with_url(&url);
25893
25894 loop {
25895 let token = match self
25896 .hub
25897 .auth
25898 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25899 .await
25900 {
25901 Ok(token) => token,
25902 Err(e) => match dlg.token(e) {
25903 Ok(token) => token,
25904 Err(e) => {
25905 dlg.finished(false);
25906 return Err(common::Error::MissingToken(e));
25907 }
25908 },
25909 };
25910 let mut req_result = {
25911 let client = &self.hub.client;
25912 dlg.pre_request();
25913 let mut req_builder = hyper::Request::builder()
25914 .method(hyper::Method::GET)
25915 .uri(url.as_str())
25916 .header(USER_AGENT, self.hub._user_agent.clone());
25917
25918 if let Some(token) = token.as_ref() {
25919 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25920 }
25921
25922 let request = req_builder
25923 .header(CONTENT_LENGTH, 0_u64)
25924 .body(common::to_body::<String>(None));
25925
25926 client.request(request.unwrap()).await
25927 };
25928
25929 match req_result {
25930 Err(err) => {
25931 if let common::Retry::After(d) = dlg.http_error(&err) {
25932 sleep(d).await;
25933 continue;
25934 }
25935 dlg.finished(false);
25936 return Err(common::Error::HttpError(err));
25937 }
25938 Ok(res) => {
25939 let (mut parts, body) = res.into_parts();
25940 let mut body = common::Body::new(body);
25941 if !parts.status.is_success() {
25942 let bytes = common::to_bytes(body).await.unwrap_or_default();
25943 let error = serde_json::from_str(&common::to_string(&bytes));
25944 let response = common::to_response(parts, bytes.into());
25945
25946 if let common::Retry::After(d) =
25947 dlg.http_failure(&response, error.as_ref().ok())
25948 {
25949 sleep(d).await;
25950 continue;
25951 }
25952
25953 dlg.finished(false);
25954
25955 return Err(match error {
25956 Ok(value) => common::Error::BadRequest(value),
25957 _ => common::Error::Failure(response),
25958 });
25959 }
25960 let response = {
25961 let bytes = common::to_bytes(body).await.unwrap_or_default();
25962 let encoded = common::to_string(&bytes);
25963 match serde_json::from_str(&encoded) {
25964 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25965 Err(error) => {
25966 dlg.response_json_decode_error(&encoded, &error);
25967 return Err(common::Error::JsonDecodeError(
25968 encoded.to_string(),
25969 error,
25970 ));
25971 }
25972 }
25973 };
25974
25975 dlg.finished(true);
25976 return Ok(response);
25977 }
25978 }
25979 }
25980 }
25981
25982 /// 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.
25983 ///
25984 /// Sets the *resource* path property to the given value.
25985 ///
25986 /// Even though the property as already been set when instantiating this call,
25987 /// we provide this method for API completeness.
25988 pub fn resource(
25989 mut self,
25990 new_value: &str,
25991 ) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C> {
25992 self._resource = new_value.to_string();
25993 self
25994 }
25995 /// 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).
25996 ///
25997 /// Sets the *options.requested policy version* query property to the given value.
25998 pub fn options_requested_policy_version(
25999 mut self,
26000 new_value: i32,
26001 ) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C> {
26002 self._options_requested_policy_version = Some(new_value);
26003 self
26004 }
26005 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26006 /// while executing the actual API request.
26007 ///
26008 /// ````text
26009 /// It should be used to handle progress information, and to implement a certain level of resilience.
26010 /// ````
26011 ///
26012 /// Sets the *delegate* property to the given value.
26013 pub fn delegate(
26014 mut self,
26015 new_value: &'a mut dyn common::Delegate,
26016 ) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C> {
26017 self._delegate = Some(new_value);
26018 self
26019 }
26020
26021 /// Set any additional parameter of the query string used in the request.
26022 /// It should be used to set parameters which are not yet available through their own
26023 /// setters.
26024 ///
26025 /// Please note that this method must not be used to set any of the known parameters
26026 /// which have their own setter method. If done anyway, the request will fail.
26027 ///
26028 /// # Additional Parameters
26029 ///
26030 /// * *$.xgafv* (query-string) - V1 error format.
26031 /// * *access_token* (query-string) - OAuth access token.
26032 /// * *alt* (query-string) - Data format for response.
26033 /// * *callback* (query-string) - JSONP
26034 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26035 /// * *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.
26036 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26037 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26038 /// * *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.
26039 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26040 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26041 pub fn param<T>(
26042 mut self,
26043 name: T,
26044 value: T,
26045 ) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C>
26046 where
26047 T: AsRef<str>,
26048 {
26049 self._additional_params
26050 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26051 self
26052 }
26053
26054 /// Identifies the authorization scope for the method you are building.
26055 ///
26056 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26057 /// [`Scope::CloudPlatform`].
26058 ///
26059 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26060 /// tokens for more than one scope.
26061 ///
26062 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26063 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26064 /// sufficient, a read-write scope will do as well.
26065 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C>
26066 where
26067 St: AsRef<str>,
26068 {
26069 self._scopes.insert(String::from(scope.as_ref()));
26070 self
26071 }
26072 /// Identifies the authorization scope(s) for the method you are building.
26073 ///
26074 /// See [`Self::add_scope()`] for details.
26075 pub fn add_scopes<I, St>(
26076 mut self,
26077 scopes: I,
26078 ) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C>
26079 where
26080 I: IntoIterator<Item = St>,
26081 St: AsRef<str>,
26082 {
26083 self._scopes
26084 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26085 self
26086 }
26087
26088 /// Removes all scopes, and no default scope will be used either.
26089 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26090 /// for details).
26091 pub fn clear_scopes(mut self) -> ProjectLocationServiceClassGetIamPolicyCall<'a, C> {
26092 self._scopes.clear();
26093 self
26094 }
26095}
26096
26097/// Lists ServiceClasses in a given project and location.
26098///
26099/// A builder for the *locations.serviceClasses.list* method supported by a *project* resource.
26100/// It is not used directly, but through a [`ProjectMethods`] instance.
26101///
26102/// # Example
26103///
26104/// Instantiate a resource method builder
26105///
26106/// ```test_harness,no_run
26107/// # extern crate hyper;
26108/// # extern crate hyper_rustls;
26109/// # extern crate google_networkconnectivity1 as networkconnectivity1;
26110/// # async fn dox() {
26111/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26112///
26113/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26114/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26115/// # .with_native_roots()
26116/// # .unwrap()
26117/// # .https_only()
26118/// # .enable_http2()
26119/// # .build();
26120///
26121/// # let executor = hyper_util::rt::TokioExecutor::new();
26122/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26123/// # secret,
26124/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26125/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26126/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26127/// # ),
26128/// # ).build().await.unwrap();
26129///
26130/// # let client = hyper_util::client::legacy::Client::builder(
26131/// # hyper_util::rt::TokioExecutor::new()
26132/// # )
26133/// # .build(
26134/// # hyper_rustls::HttpsConnectorBuilder::new()
26135/// # .with_native_roots()
26136/// # .unwrap()
26137/// # .https_or_http()
26138/// # .enable_http2()
26139/// # .build()
26140/// # );
26141/// # let mut hub = Networkconnectivity::new(client, auth);
26142/// // You can configure optional parameters by calling the respective setters at will, and
26143/// // execute the final call using `doit()`.
26144/// // Values shown here are possibly random and not representative !
26145/// let result = hub.projects().locations_service_classes_list("parent")
26146/// .page_token("sea")
26147/// .page_size(-41)
26148/// .order_by("et")
26149/// .filter("gubergren")
26150/// .doit().await;
26151/// # }
26152/// ```
26153pub struct ProjectLocationServiceClassListCall<'a, C>
26154where
26155 C: 'a,
26156{
26157 hub: &'a Networkconnectivity<C>,
26158 _parent: String,
26159 _page_token: Option<String>,
26160 _page_size: Option<i32>,
26161 _order_by: Option<String>,
26162 _filter: Option<String>,
26163 _delegate: Option<&'a mut dyn common::Delegate>,
26164 _additional_params: HashMap<String, String>,
26165 _scopes: BTreeSet<String>,
26166}
26167
26168impl<'a, C> common::CallBuilder for ProjectLocationServiceClassListCall<'a, C> {}
26169
26170impl<'a, C> ProjectLocationServiceClassListCall<'a, C>
26171where
26172 C: common::Connector,
26173{
26174 /// Perform the operation you have build so far.
26175 pub async fn doit(mut self) -> common::Result<(common::Response, ListServiceClassesResponse)> {
26176 use std::borrow::Cow;
26177 use std::io::{Read, Seek};
26178
26179 use common::{url::Params, ToParts};
26180 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26181
26182 let mut dd = common::DefaultDelegate;
26183 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26184 dlg.begin(common::MethodInfo {
26185 id: "networkconnectivity.projects.locations.serviceClasses.list",
26186 http_method: hyper::Method::GET,
26187 });
26188
26189 for &field in [
26190 "alt",
26191 "parent",
26192 "pageToken",
26193 "pageSize",
26194 "orderBy",
26195 "filter",
26196 ]
26197 .iter()
26198 {
26199 if self._additional_params.contains_key(field) {
26200 dlg.finished(false);
26201 return Err(common::Error::FieldClash(field));
26202 }
26203 }
26204
26205 let mut params = Params::with_capacity(7 + self._additional_params.len());
26206 params.push("parent", self._parent);
26207 if let Some(value) = self._page_token.as_ref() {
26208 params.push("pageToken", value);
26209 }
26210 if let Some(value) = self._page_size.as_ref() {
26211 params.push("pageSize", value.to_string());
26212 }
26213 if let Some(value) = self._order_by.as_ref() {
26214 params.push("orderBy", value);
26215 }
26216 if let Some(value) = self._filter.as_ref() {
26217 params.push("filter", value);
26218 }
26219
26220 params.extend(self._additional_params.iter());
26221
26222 params.push("alt", "json");
26223 let mut url = self.hub._base_url.clone() + "v1/{+parent}/serviceClasses";
26224 if self._scopes.is_empty() {
26225 self._scopes
26226 .insert(Scope::CloudPlatform.as_ref().to_string());
26227 }
26228
26229 #[allow(clippy::single_element_loop)]
26230 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
26231 url = params.uri_replacement(url, param_name, find_this, true);
26232 }
26233 {
26234 let to_remove = ["parent"];
26235 params.remove_params(&to_remove);
26236 }
26237
26238 let url = params.parse_with_url(&url);
26239
26240 loop {
26241 let token = match self
26242 .hub
26243 .auth
26244 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26245 .await
26246 {
26247 Ok(token) => token,
26248 Err(e) => match dlg.token(e) {
26249 Ok(token) => token,
26250 Err(e) => {
26251 dlg.finished(false);
26252 return Err(common::Error::MissingToken(e));
26253 }
26254 },
26255 };
26256 let mut req_result = {
26257 let client = &self.hub.client;
26258 dlg.pre_request();
26259 let mut req_builder = hyper::Request::builder()
26260 .method(hyper::Method::GET)
26261 .uri(url.as_str())
26262 .header(USER_AGENT, self.hub._user_agent.clone());
26263
26264 if let Some(token) = token.as_ref() {
26265 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26266 }
26267
26268 let request = req_builder
26269 .header(CONTENT_LENGTH, 0_u64)
26270 .body(common::to_body::<String>(None));
26271
26272 client.request(request.unwrap()).await
26273 };
26274
26275 match req_result {
26276 Err(err) => {
26277 if let common::Retry::After(d) = dlg.http_error(&err) {
26278 sleep(d).await;
26279 continue;
26280 }
26281 dlg.finished(false);
26282 return Err(common::Error::HttpError(err));
26283 }
26284 Ok(res) => {
26285 let (mut parts, body) = res.into_parts();
26286 let mut body = common::Body::new(body);
26287 if !parts.status.is_success() {
26288 let bytes = common::to_bytes(body).await.unwrap_or_default();
26289 let error = serde_json::from_str(&common::to_string(&bytes));
26290 let response = common::to_response(parts, bytes.into());
26291
26292 if let common::Retry::After(d) =
26293 dlg.http_failure(&response, error.as_ref().ok())
26294 {
26295 sleep(d).await;
26296 continue;
26297 }
26298
26299 dlg.finished(false);
26300
26301 return Err(match error {
26302 Ok(value) => common::Error::BadRequest(value),
26303 _ => common::Error::Failure(response),
26304 });
26305 }
26306 let response = {
26307 let bytes = common::to_bytes(body).await.unwrap_or_default();
26308 let encoded = common::to_string(&bytes);
26309 match serde_json::from_str(&encoded) {
26310 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26311 Err(error) => {
26312 dlg.response_json_decode_error(&encoded, &error);
26313 return Err(common::Error::JsonDecodeError(
26314 encoded.to_string(),
26315 error,
26316 ));
26317 }
26318 }
26319 };
26320
26321 dlg.finished(true);
26322 return Ok(response);
26323 }
26324 }
26325 }
26326 }
26327
26328 /// Required. The parent resource's name. ex. projects/123/locations/us-east1
26329 ///
26330 /// Sets the *parent* path property to the given value.
26331 ///
26332 /// Even though the property as already been set when instantiating this call,
26333 /// we provide this method for API completeness.
26334 pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceClassListCall<'a, C> {
26335 self._parent = new_value.to_string();
26336 self
26337 }
26338 /// The page token.
26339 ///
26340 /// Sets the *page token* query property to the given value.
26341 pub fn page_token(mut self, new_value: &str) -> ProjectLocationServiceClassListCall<'a, C> {
26342 self._page_token = Some(new_value.to_string());
26343 self
26344 }
26345 /// The maximum number of results per page that should be returned.
26346 ///
26347 /// Sets the *page size* query property to the given value.
26348 pub fn page_size(mut self, new_value: i32) -> ProjectLocationServiceClassListCall<'a, C> {
26349 self._page_size = Some(new_value);
26350 self
26351 }
26352 /// Sort the results by a certain order.
26353 ///
26354 /// Sets the *order by* query property to the given value.
26355 pub fn order_by(mut self, new_value: &str) -> ProjectLocationServiceClassListCall<'a, C> {
26356 self._order_by = Some(new_value.to_string());
26357 self
26358 }
26359 /// A filter expression that filters the results listed in the response.
26360 ///
26361 /// Sets the *filter* query property to the given value.
26362 pub fn filter(mut self, new_value: &str) -> ProjectLocationServiceClassListCall<'a, C> {
26363 self._filter = Some(new_value.to_string());
26364 self
26365 }
26366 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26367 /// while executing the actual API request.
26368 ///
26369 /// ````text
26370 /// It should be used to handle progress information, and to implement a certain level of resilience.
26371 /// ````
26372 ///
26373 /// Sets the *delegate* property to the given value.
26374 pub fn delegate(
26375 mut self,
26376 new_value: &'a mut dyn common::Delegate,
26377 ) -> ProjectLocationServiceClassListCall<'a, C> {
26378 self._delegate = Some(new_value);
26379 self
26380 }
26381
26382 /// Set any additional parameter of the query string used in the request.
26383 /// It should be used to set parameters which are not yet available through their own
26384 /// setters.
26385 ///
26386 /// Please note that this method must not be used to set any of the known parameters
26387 /// which have their own setter method. If done anyway, the request will fail.
26388 ///
26389 /// # Additional Parameters
26390 ///
26391 /// * *$.xgafv* (query-string) - V1 error format.
26392 /// * *access_token* (query-string) - OAuth access token.
26393 /// * *alt* (query-string) - Data format for response.
26394 /// * *callback* (query-string) - JSONP
26395 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26396 /// * *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.
26397 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26398 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26399 /// * *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.
26400 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26401 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26402 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceClassListCall<'a, C>
26403 where
26404 T: AsRef<str>,
26405 {
26406 self._additional_params
26407 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26408 self
26409 }
26410
26411 /// Identifies the authorization scope for the method you are building.
26412 ///
26413 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26414 /// [`Scope::CloudPlatform`].
26415 ///
26416 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26417 /// tokens for more than one scope.
26418 ///
26419 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26420 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26421 /// sufficient, a read-write scope will do as well.
26422 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceClassListCall<'a, C>
26423 where
26424 St: AsRef<str>,
26425 {
26426 self._scopes.insert(String::from(scope.as_ref()));
26427 self
26428 }
26429 /// Identifies the authorization scope(s) for the method you are building.
26430 ///
26431 /// See [`Self::add_scope()`] for details.
26432 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceClassListCall<'a, C>
26433 where
26434 I: IntoIterator<Item = St>,
26435 St: AsRef<str>,
26436 {
26437 self._scopes
26438 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26439 self
26440 }
26441
26442 /// Removes all scopes, and no default scope will be used either.
26443 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26444 /// for details).
26445 pub fn clear_scopes(mut self) -> ProjectLocationServiceClassListCall<'a, C> {
26446 self._scopes.clear();
26447 self
26448 }
26449}
26450
26451/// Updates the parameters of a single ServiceClass.
26452///
26453/// A builder for the *locations.serviceClasses.patch* method supported by a *project* resource.
26454/// It is not used directly, but through a [`ProjectMethods`] instance.
26455///
26456/// # Example
26457///
26458/// Instantiate a resource method builder
26459///
26460/// ```test_harness,no_run
26461/// # extern crate hyper;
26462/// # extern crate hyper_rustls;
26463/// # extern crate google_networkconnectivity1 as networkconnectivity1;
26464/// use networkconnectivity1::api::ServiceClass;
26465/// # async fn dox() {
26466/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26467///
26468/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26469/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26470/// # .with_native_roots()
26471/// # .unwrap()
26472/// # .https_only()
26473/// # .enable_http2()
26474/// # .build();
26475///
26476/// # let executor = hyper_util::rt::TokioExecutor::new();
26477/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26478/// # secret,
26479/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26480/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26481/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26482/// # ),
26483/// # ).build().await.unwrap();
26484///
26485/// # let client = hyper_util::client::legacy::Client::builder(
26486/// # hyper_util::rt::TokioExecutor::new()
26487/// # )
26488/// # .build(
26489/// # hyper_rustls::HttpsConnectorBuilder::new()
26490/// # .with_native_roots()
26491/// # .unwrap()
26492/// # .https_or_http()
26493/// # .enable_http2()
26494/// # .build()
26495/// # );
26496/// # let mut hub = Networkconnectivity::new(client, auth);
26497/// // As the method needs a request, you would usually fill it with the desired information
26498/// // into the respective structure. Some of the parts shown here might not be applicable !
26499/// // Values shown here are possibly random and not representative !
26500/// let mut req = ServiceClass::default();
26501///
26502/// // You can configure optional parameters by calling the respective setters at will, and
26503/// // execute the final call using `doit()`.
26504/// // Values shown here are possibly random and not representative !
26505/// let result = hub.projects().locations_service_classes_patch(req, "name")
26506/// .update_mask(FieldMask::new::<&str>(&[]))
26507/// .request_id("sea")
26508/// .doit().await;
26509/// # }
26510/// ```
26511pub struct ProjectLocationServiceClassPatchCall<'a, C>
26512where
26513 C: 'a,
26514{
26515 hub: &'a Networkconnectivity<C>,
26516 _request: ServiceClass,
26517 _name: String,
26518 _update_mask: Option<common::FieldMask>,
26519 _request_id: Option<String>,
26520 _delegate: Option<&'a mut dyn common::Delegate>,
26521 _additional_params: HashMap<String, String>,
26522 _scopes: BTreeSet<String>,
26523}
26524
26525impl<'a, C> common::CallBuilder for ProjectLocationServiceClassPatchCall<'a, C> {}
26526
26527impl<'a, C> ProjectLocationServiceClassPatchCall<'a, C>
26528where
26529 C: common::Connector,
26530{
26531 /// Perform the operation you have build so far.
26532 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
26533 use std::borrow::Cow;
26534 use std::io::{Read, Seek};
26535
26536 use common::{url::Params, ToParts};
26537 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26538
26539 let mut dd = common::DefaultDelegate;
26540 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26541 dlg.begin(common::MethodInfo {
26542 id: "networkconnectivity.projects.locations.serviceClasses.patch",
26543 http_method: hyper::Method::PATCH,
26544 });
26545
26546 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
26547 if self._additional_params.contains_key(field) {
26548 dlg.finished(false);
26549 return Err(common::Error::FieldClash(field));
26550 }
26551 }
26552
26553 let mut params = Params::with_capacity(6 + self._additional_params.len());
26554 params.push("name", self._name);
26555 if let Some(value) = self._update_mask.as_ref() {
26556 params.push("updateMask", value.to_string());
26557 }
26558 if let Some(value) = self._request_id.as_ref() {
26559 params.push("requestId", value);
26560 }
26561
26562 params.extend(self._additional_params.iter());
26563
26564 params.push("alt", "json");
26565 let mut url = self.hub._base_url.clone() + "v1/{+name}";
26566 if self._scopes.is_empty() {
26567 self._scopes
26568 .insert(Scope::CloudPlatform.as_ref().to_string());
26569 }
26570
26571 #[allow(clippy::single_element_loop)]
26572 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26573 url = params.uri_replacement(url, param_name, find_this, true);
26574 }
26575 {
26576 let to_remove = ["name"];
26577 params.remove_params(&to_remove);
26578 }
26579
26580 let url = params.parse_with_url(&url);
26581
26582 let mut json_mime_type = mime::APPLICATION_JSON;
26583 let mut request_value_reader = {
26584 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26585 common::remove_json_null_values(&mut value);
26586 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26587 serde_json::to_writer(&mut dst, &value).unwrap();
26588 dst
26589 };
26590 let request_size = request_value_reader
26591 .seek(std::io::SeekFrom::End(0))
26592 .unwrap();
26593 request_value_reader
26594 .seek(std::io::SeekFrom::Start(0))
26595 .unwrap();
26596
26597 loop {
26598 let token = match self
26599 .hub
26600 .auth
26601 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26602 .await
26603 {
26604 Ok(token) => token,
26605 Err(e) => match dlg.token(e) {
26606 Ok(token) => token,
26607 Err(e) => {
26608 dlg.finished(false);
26609 return Err(common::Error::MissingToken(e));
26610 }
26611 },
26612 };
26613 request_value_reader
26614 .seek(std::io::SeekFrom::Start(0))
26615 .unwrap();
26616 let mut req_result = {
26617 let client = &self.hub.client;
26618 dlg.pre_request();
26619 let mut req_builder = hyper::Request::builder()
26620 .method(hyper::Method::PATCH)
26621 .uri(url.as_str())
26622 .header(USER_AGENT, self.hub._user_agent.clone());
26623
26624 if let Some(token) = token.as_ref() {
26625 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26626 }
26627
26628 let request = req_builder
26629 .header(CONTENT_TYPE, json_mime_type.to_string())
26630 .header(CONTENT_LENGTH, request_size as u64)
26631 .body(common::to_body(
26632 request_value_reader.get_ref().clone().into(),
26633 ));
26634
26635 client.request(request.unwrap()).await
26636 };
26637
26638 match req_result {
26639 Err(err) => {
26640 if let common::Retry::After(d) = dlg.http_error(&err) {
26641 sleep(d).await;
26642 continue;
26643 }
26644 dlg.finished(false);
26645 return Err(common::Error::HttpError(err));
26646 }
26647 Ok(res) => {
26648 let (mut parts, body) = res.into_parts();
26649 let mut body = common::Body::new(body);
26650 if !parts.status.is_success() {
26651 let bytes = common::to_bytes(body).await.unwrap_or_default();
26652 let error = serde_json::from_str(&common::to_string(&bytes));
26653 let response = common::to_response(parts, bytes.into());
26654
26655 if let common::Retry::After(d) =
26656 dlg.http_failure(&response, error.as_ref().ok())
26657 {
26658 sleep(d).await;
26659 continue;
26660 }
26661
26662 dlg.finished(false);
26663
26664 return Err(match error {
26665 Ok(value) => common::Error::BadRequest(value),
26666 _ => common::Error::Failure(response),
26667 });
26668 }
26669 let response = {
26670 let bytes = common::to_bytes(body).await.unwrap_or_default();
26671 let encoded = common::to_string(&bytes);
26672 match serde_json::from_str(&encoded) {
26673 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26674 Err(error) => {
26675 dlg.response_json_decode_error(&encoded, &error);
26676 return Err(common::Error::JsonDecodeError(
26677 encoded.to_string(),
26678 error,
26679 ));
26680 }
26681 }
26682 };
26683
26684 dlg.finished(true);
26685 return Ok(response);
26686 }
26687 }
26688 }
26689 }
26690
26691 ///
26692 /// Sets the *request* property to the given value.
26693 ///
26694 /// Even though the property as already been set when instantiating this call,
26695 /// we provide this method for API completeness.
26696 pub fn request(
26697 mut self,
26698 new_value: ServiceClass,
26699 ) -> ProjectLocationServiceClassPatchCall<'a, C> {
26700 self._request = new_value;
26701 self
26702 }
26703 /// Immutable. The name of a ServiceClass resource. Format: projects/{project}/locations/{location}/serviceClasses/{service_class} See: https://google.aip.dev/122#fields-representing-resource-names
26704 ///
26705 /// Sets the *name* path property to the given value.
26706 ///
26707 /// Even though the property as already been set when instantiating this call,
26708 /// we provide this method for API completeness.
26709 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceClassPatchCall<'a, C> {
26710 self._name = new_value.to_string();
26711 self
26712 }
26713 /// Optional. Field mask is used to specify the fields to be overwritten in the ServiceClass resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
26714 ///
26715 /// Sets the *update mask* query property to the given value.
26716 pub fn update_mask(
26717 mut self,
26718 new_value: common::FieldMask,
26719 ) -> ProjectLocationServiceClassPatchCall<'a, C> {
26720 self._update_mask = Some(new_value);
26721 self
26722 }
26723 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
26724 ///
26725 /// Sets the *request id* query property to the given value.
26726 pub fn request_id(mut self, new_value: &str) -> ProjectLocationServiceClassPatchCall<'a, C> {
26727 self._request_id = Some(new_value.to_string());
26728 self
26729 }
26730 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26731 /// while executing the actual API request.
26732 ///
26733 /// ````text
26734 /// It should be used to handle progress information, and to implement a certain level of resilience.
26735 /// ````
26736 ///
26737 /// Sets the *delegate* property to the given value.
26738 pub fn delegate(
26739 mut self,
26740 new_value: &'a mut dyn common::Delegate,
26741 ) -> ProjectLocationServiceClassPatchCall<'a, C> {
26742 self._delegate = Some(new_value);
26743 self
26744 }
26745
26746 /// Set any additional parameter of the query string used in the request.
26747 /// It should be used to set parameters which are not yet available through their own
26748 /// setters.
26749 ///
26750 /// Please note that this method must not be used to set any of the known parameters
26751 /// which have their own setter method. If done anyway, the request will fail.
26752 ///
26753 /// # Additional Parameters
26754 ///
26755 /// * *$.xgafv* (query-string) - V1 error format.
26756 /// * *access_token* (query-string) - OAuth access token.
26757 /// * *alt* (query-string) - Data format for response.
26758 /// * *callback* (query-string) - JSONP
26759 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26760 /// * *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.
26761 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26762 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26763 /// * *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.
26764 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26765 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26766 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceClassPatchCall<'a, C>
26767 where
26768 T: AsRef<str>,
26769 {
26770 self._additional_params
26771 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26772 self
26773 }
26774
26775 /// Identifies the authorization scope for the method you are building.
26776 ///
26777 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26778 /// [`Scope::CloudPlatform`].
26779 ///
26780 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26781 /// tokens for more than one scope.
26782 ///
26783 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26784 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26785 /// sufficient, a read-write scope will do as well.
26786 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceClassPatchCall<'a, C>
26787 where
26788 St: AsRef<str>,
26789 {
26790 self._scopes.insert(String::from(scope.as_ref()));
26791 self
26792 }
26793 /// Identifies the authorization scope(s) for the method you are building.
26794 ///
26795 /// See [`Self::add_scope()`] for details.
26796 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceClassPatchCall<'a, C>
26797 where
26798 I: IntoIterator<Item = St>,
26799 St: AsRef<str>,
26800 {
26801 self._scopes
26802 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26803 self
26804 }
26805
26806 /// Removes all scopes, and no default scope will be used either.
26807 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26808 /// for details).
26809 pub fn clear_scopes(mut self) -> ProjectLocationServiceClassPatchCall<'a, C> {
26810 self._scopes.clear();
26811 self
26812 }
26813}
26814
26815/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
26816///
26817/// A builder for the *locations.serviceClasses.setIamPolicy* method supported by a *project* resource.
26818/// It is not used directly, but through a [`ProjectMethods`] instance.
26819///
26820/// # Example
26821///
26822/// Instantiate a resource method builder
26823///
26824/// ```test_harness,no_run
26825/// # extern crate hyper;
26826/// # extern crate hyper_rustls;
26827/// # extern crate google_networkconnectivity1 as networkconnectivity1;
26828/// use networkconnectivity1::api::SetIamPolicyRequest;
26829/// # async fn dox() {
26830/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26831///
26832/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26833/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26834/// # .with_native_roots()
26835/// # .unwrap()
26836/// # .https_only()
26837/// # .enable_http2()
26838/// # .build();
26839///
26840/// # let executor = hyper_util::rt::TokioExecutor::new();
26841/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26842/// # secret,
26843/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26844/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26845/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26846/// # ),
26847/// # ).build().await.unwrap();
26848///
26849/// # let client = hyper_util::client::legacy::Client::builder(
26850/// # hyper_util::rt::TokioExecutor::new()
26851/// # )
26852/// # .build(
26853/// # hyper_rustls::HttpsConnectorBuilder::new()
26854/// # .with_native_roots()
26855/// # .unwrap()
26856/// # .https_or_http()
26857/// # .enable_http2()
26858/// # .build()
26859/// # );
26860/// # let mut hub = Networkconnectivity::new(client, auth);
26861/// // As the method needs a request, you would usually fill it with the desired information
26862/// // into the respective structure. Some of the parts shown here might not be applicable !
26863/// // Values shown here are possibly random and not representative !
26864/// let mut req = SetIamPolicyRequest::default();
26865///
26866/// // You can configure optional parameters by calling the respective setters at will, and
26867/// // execute the final call using `doit()`.
26868/// // Values shown here are possibly random and not representative !
26869/// let result = hub.projects().locations_service_classes_set_iam_policy(req, "resource")
26870/// .doit().await;
26871/// # }
26872/// ```
26873pub struct ProjectLocationServiceClassSetIamPolicyCall<'a, C>
26874where
26875 C: 'a,
26876{
26877 hub: &'a Networkconnectivity<C>,
26878 _request: SetIamPolicyRequest,
26879 _resource: String,
26880 _delegate: Option<&'a mut dyn common::Delegate>,
26881 _additional_params: HashMap<String, String>,
26882 _scopes: BTreeSet<String>,
26883}
26884
26885impl<'a, C> common::CallBuilder for ProjectLocationServiceClassSetIamPolicyCall<'a, C> {}
26886
26887impl<'a, C> ProjectLocationServiceClassSetIamPolicyCall<'a, C>
26888where
26889 C: common::Connector,
26890{
26891 /// Perform the operation you have build so far.
26892 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
26893 use std::borrow::Cow;
26894 use std::io::{Read, Seek};
26895
26896 use common::{url::Params, ToParts};
26897 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26898
26899 let mut dd = common::DefaultDelegate;
26900 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26901 dlg.begin(common::MethodInfo {
26902 id: "networkconnectivity.projects.locations.serviceClasses.setIamPolicy",
26903 http_method: hyper::Method::POST,
26904 });
26905
26906 for &field in ["alt", "resource"].iter() {
26907 if self._additional_params.contains_key(field) {
26908 dlg.finished(false);
26909 return Err(common::Error::FieldClash(field));
26910 }
26911 }
26912
26913 let mut params = Params::with_capacity(4 + self._additional_params.len());
26914 params.push("resource", self._resource);
26915
26916 params.extend(self._additional_params.iter());
26917
26918 params.push("alt", "json");
26919 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
26920 if self._scopes.is_empty() {
26921 self._scopes
26922 .insert(Scope::CloudPlatform.as_ref().to_string());
26923 }
26924
26925 #[allow(clippy::single_element_loop)]
26926 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
26927 url = params.uri_replacement(url, param_name, find_this, true);
26928 }
26929 {
26930 let to_remove = ["resource"];
26931 params.remove_params(&to_remove);
26932 }
26933
26934 let url = params.parse_with_url(&url);
26935
26936 let mut json_mime_type = mime::APPLICATION_JSON;
26937 let mut request_value_reader = {
26938 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26939 common::remove_json_null_values(&mut value);
26940 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26941 serde_json::to_writer(&mut dst, &value).unwrap();
26942 dst
26943 };
26944 let request_size = request_value_reader
26945 .seek(std::io::SeekFrom::End(0))
26946 .unwrap();
26947 request_value_reader
26948 .seek(std::io::SeekFrom::Start(0))
26949 .unwrap();
26950
26951 loop {
26952 let token = match self
26953 .hub
26954 .auth
26955 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26956 .await
26957 {
26958 Ok(token) => token,
26959 Err(e) => match dlg.token(e) {
26960 Ok(token) => token,
26961 Err(e) => {
26962 dlg.finished(false);
26963 return Err(common::Error::MissingToken(e));
26964 }
26965 },
26966 };
26967 request_value_reader
26968 .seek(std::io::SeekFrom::Start(0))
26969 .unwrap();
26970 let mut req_result = {
26971 let client = &self.hub.client;
26972 dlg.pre_request();
26973 let mut req_builder = hyper::Request::builder()
26974 .method(hyper::Method::POST)
26975 .uri(url.as_str())
26976 .header(USER_AGENT, self.hub._user_agent.clone());
26977
26978 if let Some(token) = token.as_ref() {
26979 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26980 }
26981
26982 let request = req_builder
26983 .header(CONTENT_TYPE, json_mime_type.to_string())
26984 .header(CONTENT_LENGTH, request_size as u64)
26985 .body(common::to_body(
26986 request_value_reader.get_ref().clone().into(),
26987 ));
26988
26989 client.request(request.unwrap()).await
26990 };
26991
26992 match req_result {
26993 Err(err) => {
26994 if let common::Retry::After(d) = dlg.http_error(&err) {
26995 sleep(d).await;
26996 continue;
26997 }
26998 dlg.finished(false);
26999 return Err(common::Error::HttpError(err));
27000 }
27001 Ok(res) => {
27002 let (mut parts, body) = res.into_parts();
27003 let mut body = common::Body::new(body);
27004 if !parts.status.is_success() {
27005 let bytes = common::to_bytes(body).await.unwrap_or_default();
27006 let error = serde_json::from_str(&common::to_string(&bytes));
27007 let response = common::to_response(parts, bytes.into());
27008
27009 if let common::Retry::After(d) =
27010 dlg.http_failure(&response, error.as_ref().ok())
27011 {
27012 sleep(d).await;
27013 continue;
27014 }
27015
27016 dlg.finished(false);
27017
27018 return Err(match error {
27019 Ok(value) => common::Error::BadRequest(value),
27020 _ => common::Error::Failure(response),
27021 });
27022 }
27023 let response = {
27024 let bytes = common::to_bytes(body).await.unwrap_or_default();
27025 let encoded = common::to_string(&bytes);
27026 match serde_json::from_str(&encoded) {
27027 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27028 Err(error) => {
27029 dlg.response_json_decode_error(&encoded, &error);
27030 return Err(common::Error::JsonDecodeError(
27031 encoded.to_string(),
27032 error,
27033 ));
27034 }
27035 }
27036 };
27037
27038 dlg.finished(true);
27039 return Ok(response);
27040 }
27041 }
27042 }
27043 }
27044
27045 ///
27046 /// Sets the *request* property to the given value.
27047 ///
27048 /// Even though the property as already been set when instantiating this call,
27049 /// we provide this method for API completeness.
27050 pub fn request(
27051 mut self,
27052 new_value: SetIamPolicyRequest,
27053 ) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C> {
27054 self._request = new_value;
27055 self
27056 }
27057 /// 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.
27058 ///
27059 /// Sets the *resource* path property to the given value.
27060 ///
27061 /// Even though the property as already been set when instantiating this call,
27062 /// we provide this method for API completeness.
27063 pub fn resource(
27064 mut self,
27065 new_value: &str,
27066 ) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C> {
27067 self._resource = new_value.to_string();
27068 self
27069 }
27070 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27071 /// while executing the actual API request.
27072 ///
27073 /// ````text
27074 /// It should be used to handle progress information, and to implement a certain level of resilience.
27075 /// ````
27076 ///
27077 /// Sets the *delegate* property to the given value.
27078 pub fn delegate(
27079 mut self,
27080 new_value: &'a mut dyn common::Delegate,
27081 ) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C> {
27082 self._delegate = Some(new_value);
27083 self
27084 }
27085
27086 /// Set any additional parameter of the query string used in the request.
27087 /// It should be used to set parameters which are not yet available through their own
27088 /// setters.
27089 ///
27090 /// Please note that this method must not be used to set any of the known parameters
27091 /// which have their own setter method. If done anyway, the request will fail.
27092 ///
27093 /// # Additional Parameters
27094 ///
27095 /// * *$.xgafv* (query-string) - V1 error format.
27096 /// * *access_token* (query-string) - OAuth access token.
27097 /// * *alt* (query-string) - Data format for response.
27098 /// * *callback* (query-string) - JSONP
27099 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27100 /// * *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.
27101 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27102 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27103 /// * *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.
27104 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27105 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27106 pub fn param<T>(
27107 mut self,
27108 name: T,
27109 value: T,
27110 ) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C>
27111 where
27112 T: AsRef<str>,
27113 {
27114 self._additional_params
27115 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27116 self
27117 }
27118
27119 /// Identifies the authorization scope for the method you are building.
27120 ///
27121 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27122 /// [`Scope::CloudPlatform`].
27123 ///
27124 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27125 /// tokens for more than one scope.
27126 ///
27127 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27128 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27129 /// sufficient, a read-write scope will do as well.
27130 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C>
27131 where
27132 St: AsRef<str>,
27133 {
27134 self._scopes.insert(String::from(scope.as_ref()));
27135 self
27136 }
27137 /// Identifies the authorization scope(s) for the method you are building.
27138 ///
27139 /// See [`Self::add_scope()`] for details.
27140 pub fn add_scopes<I, St>(
27141 mut self,
27142 scopes: I,
27143 ) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C>
27144 where
27145 I: IntoIterator<Item = St>,
27146 St: AsRef<str>,
27147 {
27148 self._scopes
27149 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27150 self
27151 }
27152
27153 /// Removes all scopes, and no default scope will be used either.
27154 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27155 /// for details).
27156 pub fn clear_scopes(mut self) -> ProjectLocationServiceClassSetIamPolicyCall<'a, C> {
27157 self._scopes.clear();
27158 self
27159 }
27160}
27161
27162/// 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.
27163///
27164/// A builder for the *locations.serviceClasses.testIamPermissions* method supported by a *project* resource.
27165/// It is not used directly, but through a [`ProjectMethods`] instance.
27166///
27167/// # Example
27168///
27169/// Instantiate a resource method builder
27170///
27171/// ```test_harness,no_run
27172/// # extern crate hyper;
27173/// # extern crate hyper_rustls;
27174/// # extern crate google_networkconnectivity1 as networkconnectivity1;
27175/// use networkconnectivity1::api::TestIamPermissionsRequest;
27176/// # async fn dox() {
27177/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27178///
27179/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27180/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27181/// # .with_native_roots()
27182/// # .unwrap()
27183/// # .https_only()
27184/// # .enable_http2()
27185/// # .build();
27186///
27187/// # let executor = hyper_util::rt::TokioExecutor::new();
27188/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27189/// # secret,
27190/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27191/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27192/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27193/// # ),
27194/// # ).build().await.unwrap();
27195///
27196/// # let client = hyper_util::client::legacy::Client::builder(
27197/// # hyper_util::rt::TokioExecutor::new()
27198/// # )
27199/// # .build(
27200/// # hyper_rustls::HttpsConnectorBuilder::new()
27201/// # .with_native_roots()
27202/// # .unwrap()
27203/// # .https_or_http()
27204/// # .enable_http2()
27205/// # .build()
27206/// # );
27207/// # let mut hub = Networkconnectivity::new(client, auth);
27208/// // As the method needs a request, you would usually fill it with the desired information
27209/// // into the respective structure. Some of the parts shown here might not be applicable !
27210/// // Values shown here are possibly random and not representative !
27211/// let mut req = TestIamPermissionsRequest::default();
27212///
27213/// // You can configure optional parameters by calling the respective setters at will, and
27214/// // execute the final call using `doit()`.
27215/// // Values shown here are possibly random and not representative !
27216/// let result = hub.projects().locations_service_classes_test_iam_permissions(req, "resource")
27217/// .doit().await;
27218/// # }
27219/// ```
27220pub struct ProjectLocationServiceClassTestIamPermissionCall<'a, C>
27221where
27222 C: 'a,
27223{
27224 hub: &'a Networkconnectivity<C>,
27225 _request: TestIamPermissionsRequest,
27226 _resource: String,
27227 _delegate: Option<&'a mut dyn common::Delegate>,
27228 _additional_params: HashMap<String, String>,
27229 _scopes: BTreeSet<String>,
27230}
27231
27232impl<'a, C> common::CallBuilder for ProjectLocationServiceClassTestIamPermissionCall<'a, C> {}
27233
27234impl<'a, C> ProjectLocationServiceClassTestIamPermissionCall<'a, C>
27235where
27236 C: common::Connector,
27237{
27238 /// Perform the operation you have build so far.
27239 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
27240 use std::borrow::Cow;
27241 use std::io::{Read, Seek};
27242
27243 use common::{url::Params, ToParts};
27244 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27245
27246 let mut dd = common::DefaultDelegate;
27247 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27248 dlg.begin(common::MethodInfo {
27249 id: "networkconnectivity.projects.locations.serviceClasses.testIamPermissions",
27250 http_method: hyper::Method::POST,
27251 });
27252
27253 for &field in ["alt", "resource"].iter() {
27254 if self._additional_params.contains_key(field) {
27255 dlg.finished(false);
27256 return Err(common::Error::FieldClash(field));
27257 }
27258 }
27259
27260 let mut params = Params::with_capacity(4 + self._additional_params.len());
27261 params.push("resource", self._resource);
27262
27263 params.extend(self._additional_params.iter());
27264
27265 params.push("alt", "json");
27266 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
27267 if self._scopes.is_empty() {
27268 self._scopes
27269 .insert(Scope::CloudPlatform.as_ref().to_string());
27270 }
27271
27272 #[allow(clippy::single_element_loop)]
27273 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
27274 url = params.uri_replacement(url, param_name, find_this, true);
27275 }
27276 {
27277 let to_remove = ["resource"];
27278 params.remove_params(&to_remove);
27279 }
27280
27281 let url = params.parse_with_url(&url);
27282
27283 let mut json_mime_type = mime::APPLICATION_JSON;
27284 let mut request_value_reader = {
27285 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27286 common::remove_json_null_values(&mut value);
27287 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27288 serde_json::to_writer(&mut dst, &value).unwrap();
27289 dst
27290 };
27291 let request_size = request_value_reader
27292 .seek(std::io::SeekFrom::End(0))
27293 .unwrap();
27294 request_value_reader
27295 .seek(std::io::SeekFrom::Start(0))
27296 .unwrap();
27297
27298 loop {
27299 let token = match self
27300 .hub
27301 .auth
27302 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27303 .await
27304 {
27305 Ok(token) => token,
27306 Err(e) => match dlg.token(e) {
27307 Ok(token) => token,
27308 Err(e) => {
27309 dlg.finished(false);
27310 return Err(common::Error::MissingToken(e));
27311 }
27312 },
27313 };
27314 request_value_reader
27315 .seek(std::io::SeekFrom::Start(0))
27316 .unwrap();
27317 let mut req_result = {
27318 let client = &self.hub.client;
27319 dlg.pre_request();
27320 let mut req_builder = hyper::Request::builder()
27321 .method(hyper::Method::POST)
27322 .uri(url.as_str())
27323 .header(USER_AGENT, self.hub._user_agent.clone());
27324
27325 if let Some(token) = token.as_ref() {
27326 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27327 }
27328
27329 let request = req_builder
27330 .header(CONTENT_TYPE, json_mime_type.to_string())
27331 .header(CONTENT_LENGTH, request_size as u64)
27332 .body(common::to_body(
27333 request_value_reader.get_ref().clone().into(),
27334 ));
27335
27336 client.request(request.unwrap()).await
27337 };
27338
27339 match req_result {
27340 Err(err) => {
27341 if let common::Retry::After(d) = dlg.http_error(&err) {
27342 sleep(d).await;
27343 continue;
27344 }
27345 dlg.finished(false);
27346 return Err(common::Error::HttpError(err));
27347 }
27348 Ok(res) => {
27349 let (mut parts, body) = res.into_parts();
27350 let mut body = common::Body::new(body);
27351 if !parts.status.is_success() {
27352 let bytes = common::to_bytes(body).await.unwrap_or_default();
27353 let error = serde_json::from_str(&common::to_string(&bytes));
27354 let response = common::to_response(parts, bytes.into());
27355
27356 if let common::Retry::After(d) =
27357 dlg.http_failure(&response, error.as_ref().ok())
27358 {
27359 sleep(d).await;
27360 continue;
27361 }
27362
27363 dlg.finished(false);
27364
27365 return Err(match error {
27366 Ok(value) => common::Error::BadRequest(value),
27367 _ => common::Error::Failure(response),
27368 });
27369 }
27370 let response = {
27371 let bytes = common::to_bytes(body).await.unwrap_or_default();
27372 let encoded = common::to_string(&bytes);
27373 match serde_json::from_str(&encoded) {
27374 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27375 Err(error) => {
27376 dlg.response_json_decode_error(&encoded, &error);
27377 return Err(common::Error::JsonDecodeError(
27378 encoded.to_string(),
27379 error,
27380 ));
27381 }
27382 }
27383 };
27384
27385 dlg.finished(true);
27386 return Ok(response);
27387 }
27388 }
27389 }
27390 }
27391
27392 ///
27393 /// Sets the *request* property to the given value.
27394 ///
27395 /// Even though the property as already been set when instantiating this call,
27396 /// we provide this method for API completeness.
27397 pub fn request(
27398 mut self,
27399 new_value: TestIamPermissionsRequest,
27400 ) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C> {
27401 self._request = new_value;
27402 self
27403 }
27404 /// 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.
27405 ///
27406 /// Sets the *resource* path property to the given value.
27407 ///
27408 /// Even though the property as already been set when instantiating this call,
27409 /// we provide this method for API completeness.
27410 pub fn resource(
27411 mut self,
27412 new_value: &str,
27413 ) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C> {
27414 self._resource = new_value.to_string();
27415 self
27416 }
27417 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27418 /// while executing the actual API request.
27419 ///
27420 /// ````text
27421 /// It should be used to handle progress information, and to implement a certain level of resilience.
27422 /// ````
27423 ///
27424 /// Sets the *delegate* property to the given value.
27425 pub fn delegate(
27426 mut self,
27427 new_value: &'a mut dyn common::Delegate,
27428 ) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C> {
27429 self._delegate = Some(new_value);
27430 self
27431 }
27432
27433 /// Set any additional parameter of the query string used in the request.
27434 /// It should be used to set parameters which are not yet available through their own
27435 /// setters.
27436 ///
27437 /// Please note that this method must not be used to set any of the known parameters
27438 /// which have their own setter method. If done anyway, the request will fail.
27439 ///
27440 /// # Additional Parameters
27441 ///
27442 /// * *$.xgafv* (query-string) - V1 error format.
27443 /// * *access_token* (query-string) - OAuth access token.
27444 /// * *alt* (query-string) - Data format for response.
27445 /// * *callback* (query-string) - JSONP
27446 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27447 /// * *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.
27448 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27449 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27450 /// * *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.
27451 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27452 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27453 pub fn param<T>(
27454 mut self,
27455 name: T,
27456 value: T,
27457 ) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C>
27458 where
27459 T: AsRef<str>,
27460 {
27461 self._additional_params
27462 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27463 self
27464 }
27465
27466 /// Identifies the authorization scope for the method you are building.
27467 ///
27468 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27469 /// [`Scope::CloudPlatform`].
27470 ///
27471 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27472 /// tokens for more than one scope.
27473 ///
27474 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27475 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27476 /// sufficient, a read-write scope will do as well.
27477 pub fn add_scope<St>(
27478 mut self,
27479 scope: St,
27480 ) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C>
27481 where
27482 St: AsRef<str>,
27483 {
27484 self._scopes.insert(String::from(scope.as_ref()));
27485 self
27486 }
27487 /// Identifies the authorization scope(s) for the method you are building.
27488 ///
27489 /// See [`Self::add_scope()`] for details.
27490 pub fn add_scopes<I, St>(
27491 mut self,
27492 scopes: I,
27493 ) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C>
27494 where
27495 I: IntoIterator<Item = St>,
27496 St: AsRef<str>,
27497 {
27498 self._scopes
27499 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27500 self
27501 }
27502
27503 /// Removes all scopes, and no default scope will be used either.
27504 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27505 /// for details).
27506 pub fn clear_scopes(mut self) -> ProjectLocationServiceClassTestIamPermissionCall<'a, C> {
27507 self._scopes.clear();
27508 self
27509 }
27510}
27511
27512/// Creates a new ServiceConnectionMap in a given project and location.
27513///
27514/// A builder for the *locations.serviceConnectionMaps.create* method supported by a *project* resource.
27515/// It is not used directly, but through a [`ProjectMethods`] instance.
27516///
27517/// # Example
27518///
27519/// Instantiate a resource method builder
27520///
27521/// ```test_harness,no_run
27522/// # extern crate hyper;
27523/// # extern crate hyper_rustls;
27524/// # extern crate google_networkconnectivity1 as networkconnectivity1;
27525/// use networkconnectivity1::api::ServiceConnectionMap;
27526/// # async fn dox() {
27527/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27528///
27529/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27530/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27531/// # .with_native_roots()
27532/// # .unwrap()
27533/// # .https_only()
27534/// # .enable_http2()
27535/// # .build();
27536///
27537/// # let executor = hyper_util::rt::TokioExecutor::new();
27538/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27539/// # secret,
27540/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27541/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27542/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27543/// # ),
27544/// # ).build().await.unwrap();
27545///
27546/// # let client = hyper_util::client::legacy::Client::builder(
27547/// # hyper_util::rt::TokioExecutor::new()
27548/// # )
27549/// # .build(
27550/// # hyper_rustls::HttpsConnectorBuilder::new()
27551/// # .with_native_roots()
27552/// # .unwrap()
27553/// # .https_or_http()
27554/// # .enable_http2()
27555/// # .build()
27556/// # );
27557/// # let mut hub = Networkconnectivity::new(client, auth);
27558/// // As the method needs a request, you would usually fill it with the desired information
27559/// // into the respective structure. Some of the parts shown here might not be applicable !
27560/// // Values shown here are possibly random and not representative !
27561/// let mut req = ServiceConnectionMap::default();
27562///
27563/// // You can configure optional parameters by calling the respective setters at will, and
27564/// // execute the final call using `doit()`.
27565/// // Values shown here are possibly random and not representative !
27566/// let result = hub.projects().locations_service_connection_maps_create(req, "parent")
27567/// .service_connection_map_id("eos")
27568/// .request_id("At")
27569/// .doit().await;
27570/// # }
27571/// ```
27572pub struct ProjectLocationServiceConnectionMapCreateCall<'a, C>
27573where
27574 C: 'a,
27575{
27576 hub: &'a Networkconnectivity<C>,
27577 _request: ServiceConnectionMap,
27578 _parent: String,
27579 _service_connection_map_id: Option<String>,
27580 _request_id: Option<String>,
27581 _delegate: Option<&'a mut dyn common::Delegate>,
27582 _additional_params: HashMap<String, String>,
27583 _scopes: BTreeSet<String>,
27584}
27585
27586impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionMapCreateCall<'a, C> {}
27587
27588impl<'a, C> ProjectLocationServiceConnectionMapCreateCall<'a, C>
27589where
27590 C: common::Connector,
27591{
27592 /// Perform the operation you have build so far.
27593 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
27594 use std::borrow::Cow;
27595 use std::io::{Read, Seek};
27596
27597 use common::{url::Params, ToParts};
27598 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27599
27600 let mut dd = common::DefaultDelegate;
27601 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27602 dlg.begin(common::MethodInfo {
27603 id: "networkconnectivity.projects.locations.serviceConnectionMaps.create",
27604 http_method: hyper::Method::POST,
27605 });
27606
27607 for &field in ["alt", "parent", "serviceConnectionMapId", "requestId"].iter() {
27608 if self._additional_params.contains_key(field) {
27609 dlg.finished(false);
27610 return Err(common::Error::FieldClash(field));
27611 }
27612 }
27613
27614 let mut params = Params::with_capacity(6 + self._additional_params.len());
27615 params.push("parent", self._parent);
27616 if let Some(value) = self._service_connection_map_id.as_ref() {
27617 params.push("serviceConnectionMapId", value);
27618 }
27619 if let Some(value) = self._request_id.as_ref() {
27620 params.push("requestId", value);
27621 }
27622
27623 params.extend(self._additional_params.iter());
27624
27625 params.push("alt", "json");
27626 let mut url = self.hub._base_url.clone() + "v1/{+parent}/serviceConnectionMaps";
27627 if self._scopes.is_empty() {
27628 self._scopes
27629 .insert(Scope::CloudPlatform.as_ref().to_string());
27630 }
27631
27632 #[allow(clippy::single_element_loop)]
27633 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
27634 url = params.uri_replacement(url, param_name, find_this, true);
27635 }
27636 {
27637 let to_remove = ["parent"];
27638 params.remove_params(&to_remove);
27639 }
27640
27641 let url = params.parse_with_url(&url);
27642
27643 let mut json_mime_type = mime::APPLICATION_JSON;
27644 let mut request_value_reader = {
27645 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27646 common::remove_json_null_values(&mut value);
27647 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27648 serde_json::to_writer(&mut dst, &value).unwrap();
27649 dst
27650 };
27651 let request_size = request_value_reader
27652 .seek(std::io::SeekFrom::End(0))
27653 .unwrap();
27654 request_value_reader
27655 .seek(std::io::SeekFrom::Start(0))
27656 .unwrap();
27657
27658 loop {
27659 let token = match self
27660 .hub
27661 .auth
27662 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27663 .await
27664 {
27665 Ok(token) => token,
27666 Err(e) => match dlg.token(e) {
27667 Ok(token) => token,
27668 Err(e) => {
27669 dlg.finished(false);
27670 return Err(common::Error::MissingToken(e));
27671 }
27672 },
27673 };
27674 request_value_reader
27675 .seek(std::io::SeekFrom::Start(0))
27676 .unwrap();
27677 let mut req_result = {
27678 let client = &self.hub.client;
27679 dlg.pre_request();
27680 let mut req_builder = hyper::Request::builder()
27681 .method(hyper::Method::POST)
27682 .uri(url.as_str())
27683 .header(USER_AGENT, self.hub._user_agent.clone());
27684
27685 if let Some(token) = token.as_ref() {
27686 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27687 }
27688
27689 let request = req_builder
27690 .header(CONTENT_TYPE, json_mime_type.to_string())
27691 .header(CONTENT_LENGTH, request_size as u64)
27692 .body(common::to_body(
27693 request_value_reader.get_ref().clone().into(),
27694 ));
27695
27696 client.request(request.unwrap()).await
27697 };
27698
27699 match req_result {
27700 Err(err) => {
27701 if let common::Retry::After(d) = dlg.http_error(&err) {
27702 sleep(d).await;
27703 continue;
27704 }
27705 dlg.finished(false);
27706 return Err(common::Error::HttpError(err));
27707 }
27708 Ok(res) => {
27709 let (mut parts, body) = res.into_parts();
27710 let mut body = common::Body::new(body);
27711 if !parts.status.is_success() {
27712 let bytes = common::to_bytes(body).await.unwrap_or_default();
27713 let error = serde_json::from_str(&common::to_string(&bytes));
27714 let response = common::to_response(parts, bytes.into());
27715
27716 if let common::Retry::After(d) =
27717 dlg.http_failure(&response, error.as_ref().ok())
27718 {
27719 sleep(d).await;
27720 continue;
27721 }
27722
27723 dlg.finished(false);
27724
27725 return Err(match error {
27726 Ok(value) => common::Error::BadRequest(value),
27727 _ => common::Error::Failure(response),
27728 });
27729 }
27730 let response = {
27731 let bytes = common::to_bytes(body).await.unwrap_or_default();
27732 let encoded = common::to_string(&bytes);
27733 match serde_json::from_str(&encoded) {
27734 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27735 Err(error) => {
27736 dlg.response_json_decode_error(&encoded, &error);
27737 return Err(common::Error::JsonDecodeError(
27738 encoded.to_string(),
27739 error,
27740 ));
27741 }
27742 }
27743 };
27744
27745 dlg.finished(true);
27746 return Ok(response);
27747 }
27748 }
27749 }
27750 }
27751
27752 ///
27753 /// Sets the *request* property to the given value.
27754 ///
27755 /// Even though the property as already been set when instantiating this call,
27756 /// we provide this method for API completeness.
27757 pub fn request(
27758 mut self,
27759 new_value: ServiceConnectionMap,
27760 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C> {
27761 self._request = new_value;
27762 self
27763 }
27764 /// Required. The parent resource's name of the ServiceConnectionMap. ex. projects/123/locations/us-east1
27765 ///
27766 /// Sets the *parent* path property to the given value.
27767 ///
27768 /// Even though the property as already been set when instantiating this call,
27769 /// we provide this method for API completeness.
27770 pub fn parent(
27771 mut self,
27772 new_value: &str,
27773 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C> {
27774 self._parent = new_value.to_string();
27775 self
27776 }
27777 /// Optional. Resource ID (i.e. 'foo' in '[...]/projects/p/locations/l/serviceConnectionMaps/foo') See https://google.aip.dev/122#resource-id-segments Unique per location. If one is not provided, one will be generated.
27778 ///
27779 /// Sets the *service connection map id* query property to the given value.
27780 pub fn service_connection_map_id(
27781 mut self,
27782 new_value: &str,
27783 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C> {
27784 self._service_connection_map_id = Some(new_value.to_string());
27785 self
27786 }
27787 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
27788 ///
27789 /// Sets the *request id* query property to the given value.
27790 pub fn request_id(
27791 mut self,
27792 new_value: &str,
27793 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C> {
27794 self._request_id = Some(new_value.to_string());
27795 self
27796 }
27797 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27798 /// while executing the actual API request.
27799 ///
27800 /// ````text
27801 /// It should be used to handle progress information, and to implement a certain level of resilience.
27802 /// ````
27803 ///
27804 /// Sets the *delegate* property to the given value.
27805 pub fn delegate(
27806 mut self,
27807 new_value: &'a mut dyn common::Delegate,
27808 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C> {
27809 self._delegate = Some(new_value);
27810 self
27811 }
27812
27813 /// Set any additional parameter of the query string used in the request.
27814 /// It should be used to set parameters which are not yet available through their own
27815 /// setters.
27816 ///
27817 /// Please note that this method must not be used to set any of the known parameters
27818 /// which have their own setter method. If done anyway, the request will fail.
27819 ///
27820 /// # Additional Parameters
27821 ///
27822 /// * *$.xgafv* (query-string) - V1 error format.
27823 /// * *access_token* (query-string) - OAuth access token.
27824 /// * *alt* (query-string) - Data format for response.
27825 /// * *callback* (query-string) - JSONP
27826 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27827 /// * *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.
27828 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27829 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27830 /// * *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.
27831 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27832 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27833 pub fn param<T>(
27834 mut self,
27835 name: T,
27836 value: T,
27837 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C>
27838 where
27839 T: AsRef<str>,
27840 {
27841 self._additional_params
27842 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27843 self
27844 }
27845
27846 /// Identifies the authorization scope for the method you are building.
27847 ///
27848 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27849 /// [`Scope::CloudPlatform`].
27850 ///
27851 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27852 /// tokens for more than one scope.
27853 ///
27854 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27855 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27856 /// sufficient, a read-write scope will do as well.
27857 pub fn add_scope<St>(
27858 mut self,
27859 scope: St,
27860 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C>
27861 where
27862 St: AsRef<str>,
27863 {
27864 self._scopes.insert(String::from(scope.as_ref()));
27865 self
27866 }
27867 /// Identifies the authorization scope(s) for the method you are building.
27868 ///
27869 /// See [`Self::add_scope()`] for details.
27870 pub fn add_scopes<I, St>(
27871 mut self,
27872 scopes: I,
27873 ) -> ProjectLocationServiceConnectionMapCreateCall<'a, C>
27874 where
27875 I: IntoIterator<Item = St>,
27876 St: AsRef<str>,
27877 {
27878 self._scopes
27879 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27880 self
27881 }
27882
27883 /// Removes all scopes, and no default scope will be used either.
27884 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27885 /// for details).
27886 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionMapCreateCall<'a, C> {
27887 self._scopes.clear();
27888 self
27889 }
27890}
27891
27892/// Deletes a single ServiceConnectionMap.
27893///
27894/// A builder for the *locations.serviceConnectionMaps.delete* method supported by a *project* resource.
27895/// It is not used directly, but through a [`ProjectMethods`] instance.
27896///
27897/// # Example
27898///
27899/// Instantiate a resource method builder
27900///
27901/// ```test_harness,no_run
27902/// # extern crate hyper;
27903/// # extern crate hyper_rustls;
27904/// # extern crate google_networkconnectivity1 as networkconnectivity1;
27905/// # async fn dox() {
27906/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27907///
27908/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27909/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27910/// # .with_native_roots()
27911/// # .unwrap()
27912/// # .https_only()
27913/// # .enable_http2()
27914/// # .build();
27915///
27916/// # let executor = hyper_util::rt::TokioExecutor::new();
27917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27918/// # secret,
27919/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27920/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27921/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27922/// # ),
27923/// # ).build().await.unwrap();
27924///
27925/// # let client = hyper_util::client::legacy::Client::builder(
27926/// # hyper_util::rt::TokioExecutor::new()
27927/// # )
27928/// # .build(
27929/// # hyper_rustls::HttpsConnectorBuilder::new()
27930/// # .with_native_roots()
27931/// # .unwrap()
27932/// # .https_or_http()
27933/// # .enable_http2()
27934/// # .build()
27935/// # );
27936/// # let mut hub = Networkconnectivity::new(client, auth);
27937/// // You can configure optional parameters by calling the respective setters at will, and
27938/// // execute the final call using `doit()`.
27939/// // Values shown here are possibly random and not representative !
27940/// let result = hub.projects().locations_service_connection_maps_delete("name")
27941/// .request_id("consetetur")
27942/// .etag("gubergren")
27943/// .doit().await;
27944/// # }
27945/// ```
27946pub struct ProjectLocationServiceConnectionMapDeleteCall<'a, C>
27947where
27948 C: 'a,
27949{
27950 hub: &'a Networkconnectivity<C>,
27951 _name: String,
27952 _request_id: Option<String>,
27953 _etag: Option<String>,
27954 _delegate: Option<&'a mut dyn common::Delegate>,
27955 _additional_params: HashMap<String, String>,
27956 _scopes: BTreeSet<String>,
27957}
27958
27959impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionMapDeleteCall<'a, C> {}
27960
27961impl<'a, C> ProjectLocationServiceConnectionMapDeleteCall<'a, C>
27962where
27963 C: common::Connector,
27964{
27965 /// Perform the operation you have build so far.
27966 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
27967 use std::borrow::Cow;
27968 use std::io::{Read, Seek};
27969
27970 use common::{url::Params, ToParts};
27971 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27972
27973 let mut dd = common::DefaultDelegate;
27974 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27975 dlg.begin(common::MethodInfo {
27976 id: "networkconnectivity.projects.locations.serviceConnectionMaps.delete",
27977 http_method: hyper::Method::DELETE,
27978 });
27979
27980 for &field in ["alt", "name", "requestId", "etag"].iter() {
27981 if self._additional_params.contains_key(field) {
27982 dlg.finished(false);
27983 return Err(common::Error::FieldClash(field));
27984 }
27985 }
27986
27987 let mut params = Params::with_capacity(5 + self._additional_params.len());
27988 params.push("name", self._name);
27989 if let Some(value) = self._request_id.as_ref() {
27990 params.push("requestId", value);
27991 }
27992 if let Some(value) = self._etag.as_ref() {
27993 params.push("etag", value);
27994 }
27995
27996 params.extend(self._additional_params.iter());
27997
27998 params.push("alt", "json");
27999 let mut url = self.hub._base_url.clone() + "v1/{+name}";
28000 if self._scopes.is_empty() {
28001 self._scopes
28002 .insert(Scope::CloudPlatform.as_ref().to_string());
28003 }
28004
28005 #[allow(clippy::single_element_loop)]
28006 for &(find_this, param_name) in [("{+name}", "name")].iter() {
28007 url = params.uri_replacement(url, param_name, find_this, true);
28008 }
28009 {
28010 let to_remove = ["name"];
28011 params.remove_params(&to_remove);
28012 }
28013
28014 let url = params.parse_with_url(&url);
28015
28016 loop {
28017 let token = match self
28018 .hub
28019 .auth
28020 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28021 .await
28022 {
28023 Ok(token) => token,
28024 Err(e) => match dlg.token(e) {
28025 Ok(token) => token,
28026 Err(e) => {
28027 dlg.finished(false);
28028 return Err(common::Error::MissingToken(e));
28029 }
28030 },
28031 };
28032 let mut req_result = {
28033 let client = &self.hub.client;
28034 dlg.pre_request();
28035 let mut req_builder = hyper::Request::builder()
28036 .method(hyper::Method::DELETE)
28037 .uri(url.as_str())
28038 .header(USER_AGENT, self.hub._user_agent.clone());
28039
28040 if let Some(token) = token.as_ref() {
28041 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28042 }
28043
28044 let request = req_builder
28045 .header(CONTENT_LENGTH, 0_u64)
28046 .body(common::to_body::<String>(None));
28047
28048 client.request(request.unwrap()).await
28049 };
28050
28051 match req_result {
28052 Err(err) => {
28053 if let common::Retry::After(d) = dlg.http_error(&err) {
28054 sleep(d).await;
28055 continue;
28056 }
28057 dlg.finished(false);
28058 return Err(common::Error::HttpError(err));
28059 }
28060 Ok(res) => {
28061 let (mut parts, body) = res.into_parts();
28062 let mut body = common::Body::new(body);
28063 if !parts.status.is_success() {
28064 let bytes = common::to_bytes(body).await.unwrap_or_default();
28065 let error = serde_json::from_str(&common::to_string(&bytes));
28066 let response = common::to_response(parts, bytes.into());
28067
28068 if let common::Retry::After(d) =
28069 dlg.http_failure(&response, error.as_ref().ok())
28070 {
28071 sleep(d).await;
28072 continue;
28073 }
28074
28075 dlg.finished(false);
28076
28077 return Err(match error {
28078 Ok(value) => common::Error::BadRequest(value),
28079 _ => common::Error::Failure(response),
28080 });
28081 }
28082 let response = {
28083 let bytes = common::to_bytes(body).await.unwrap_or_default();
28084 let encoded = common::to_string(&bytes);
28085 match serde_json::from_str(&encoded) {
28086 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28087 Err(error) => {
28088 dlg.response_json_decode_error(&encoded, &error);
28089 return Err(common::Error::JsonDecodeError(
28090 encoded.to_string(),
28091 error,
28092 ));
28093 }
28094 }
28095 };
28096
28097 dlg.finished(true);
28098 return Ok(response);
28099 }
28100 }
28101 }
28102 }
28103
28104 /// Required. The name of the ServiceConnectionMap to delete.
28105 ///
28106 /// Sets the *name* path property to the given value.
28107 ///
28108 /// Even though the property as already been set when instantiating this call,
28109 /// we provide this method for API completeness.
28110 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C> {
28111 self._name = new_value.to_string();
28112 self
28113 }
28114 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
28115 ///
28116 /// Sets the *request id* query property to the given value.
28117 pub fn request_id(
28118 mut self,
28119 new_value: &str,
28120 ) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C> {
28121 self._request_id = Some(new_value.to_string());
28122 self
28123 }
28124 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
28125 ///
28126 /// Sets the *etag* query property to the given value.
28127 pub fn etag(mut self, new_value: &str) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C> {
28128 self._etag = Some(new_value.to_string());
28129 self
28130 }
28131 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28132 /// while executing the actual API request.
28133 ///
28134 /// ````text
28135 /// It should be used to handle progress information, and to implement a certain level of resilience.
28136 /// ````
28137 ///
28138 /// Sets the *delegate* property to the given value.
28139 pub fn delegate(
28140 mut self,
28141 new_value: &'a mut dyn common::Delegate,
28142 ) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C> {
28143 self._delegate = Some(new_value);
28144 self
28145 }
28146
28147 /// Set any additional parameter of the query string used in the request.
28148 /// It should be used to set parameters which are not yet available through their own
28149 /// setters.
28150 ///
28151 /// Please note that this method must not be used to set any of the known parameters
28152 /// which have their own setter method. If done anyway, the request will fail.
28153 ///
28154 /// # Additional Parameters
28155 ///
28156 /// * *$.xgafv* (query-string) - V1 error format.
28157 /// * *access_token* (query-string) - OAuth access token.
28158 /// * *alt* (query-string) - Data format for response.
28159 /// * *callback* (query-string) - JSONP
28160 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28161 /// * *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.
28162 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28163 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28164 /// * *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.
28165 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28166 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28167 pub fn param<T>(
28168 mut self,
28169 name: T,
28170 value: T,
28171 ) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C>
28172 where
28173 T: AsRef<str>,
28174 {
28175 self._additional_params
28176 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28177 self
28178 }
28179
28180 /// Identifies the authorization scope for the method you are building.
28181 ///
28182 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28183 /// [`Scope::CloudPlatform`].
28184 ///
28185 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28186 /// tokens for more than one scope.
28187 ///
28188 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28189 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28190 /// sufficient, a read-write scope will do as well.
28191 pub fn add_scope<St>(
28192 mut self,
28193 scope: St,
28194 ) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C>
28195 where
28196 St: AsRef<str>,
28197 {
28198 self._scopes.insert(String::from(scope.as_ref()));
28199 self
28200 }
28201 /// Identifies the authorization scope(s) for the method you are building.
28202 ///
28203 /// See [`Self::add_scope()`] for details.
28204 pub fn add_scopes<I, St>(
28205 mut self,
28206 scopes: I,
28207 ) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C>
28208 where
28209 I: IntoIterator<Item = St>,
28210 St: AsRef<str>,
28211 {
28212 self._scopes
28213 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28214 self
28215 }
28216
28217 /// Removes all scopes, and no default scope will be used either.
28218 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28219 /// for details).
28220 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionMapDeleteCall<'a, C> {
28221 self._scopes.clear();
28222 self
28223 }
28224}
28225
28226/// Gets details of a single ServiceConnectionMap.
28227///
28228/// A builder for the *locations.serviceConnectionMaps.get* method supported by a *project* resource.
28229/// It is not used directly, but through a [`ProjectMethods`] instance.
28230///
28231/// # Example
28232///
28233/// Instantiate a resource method builder
28234///
28235/// ```test_harness,no_run
28236/// # extern crate hyper;
28237/// # extern crate hyper_rustls;
28238/// # extern crate google_networkconnectivity1 as networkconnectivity1;
28239/// # async fn dox() {
28240/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28241///
28242/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28243/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28244/// # .with_native_roots()
28245/// # .unwrap()
28246/// # .https_only()
28247/// # .enable_http2()
28248/// # .build();
28249///
28250/// # let executor = hyper_util::rt::TokioExecutor::new();
28251/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28252/// # secret,
28253/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28254/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28255/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28256/// # ),
28257/// # ).build().await.unwrap();
28258///
28259/// # let client = hyper_util::client::legacy::Client::builder(
28260/// # hyper_util::rt::TokioExecutor::new()
28261/// # )
28262/// # .build(
28263/// # hyper_rustls::HttpsConnectorBuilder::new()
28264/// # .with_native_roots()
28265/// # .unwrap()
28266/// # .https_or_http()
28267/// # .enable_http2()
28268/// # .build()
28269/// # );
28270/// # let mut hub = Networkconnectivity::new(client, auth);
28271/// // You can configure optional parameters by calling the respective setters at will, and
28272/// // execute the final call using `doit()`.
28273/// // Values shown here are possibly random and not representative !
28274/// let result = hub.projects().locations_service_connection_maps_get("name")
28275/// .doit().await;
28276/// # }
28277/// ```
28278pub struct ProjectLocationServiceConnectionMapGetCall<'a, C>
28279where
28280 C: 'a,
28281{
28282 hub: &'a Networkconnectivity<C>,
28283 _name: String,
28284 _delegate: Option<&'a mut dyn common::Delegate>,
28285 _additional_params: HashMap<String, String>,
28286 _scopes: BTreeSet<String>,
28287}
28288
28289impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionMapGetCall<'a, C> {}
28290
28291impl<'a, C> ProjectLocationServiceConnectionMapGetCall<'a, C>
28292where
28293 C: common::Connector,
28294{
28295 /// Perform the operation you have build so far.
28296 pub async fn doit(mut self) -> common::Result<(common::Response, ServiceConnectionMap)> {
28297 use std::borrow::Cow;
28298 use std::io::{Read, Seek};
28299
28300 use common::{url::Params, ToParts};
28301 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28302
28303 let mut dd = common::DefaultDelegate;
28304 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28305 dlg.begin(common::MethodInfo {
28306 id: "networkconnectivity.projects.locations.serviceConnectionMaps.get",
28307 http_method: hyper::Method::GET,
28308 });
28309
28310 for &field in ["alt", "name"].iter() {
28311 if self._additional_params.contains_key(field) {
28312 dlg.finished(false);
28313 return Err(common::Error::FieldClash(field));
28314 }
28315 }
28316
28317 let mut params = Params::with_capacity(3 + self._additional_params.len());
28318 params.push("name", self._name);
28319
28320 params.extend(self._additional_params.iter());
28321
28322 params.push("alt", "json");
28323 let mut url = self.hub._base_url.clone() + "v1/{+name}";
28324 if self._scopes.is_empty() {
28325 self._scopes
28326 .insert(Scope::CloudPlatform.as_ref().to_string());
28327 }
28328
28329 #[allow(clippy::single_element_loop)]
28330 for &(find_this, param_name) in [("{+name}", "name")].iter() {
28331 url = params.uri_replacement(url, param_name, find_this, true);
28332 }
28333 {
28334 let to_remove = ["name"];
28335 params.remove_params(&to_remove);
28336 }
28337
28338 let url = params.parse_with_url(&url);
28339
28340 loop {
28341 let token = match self
28342 .hub
28343 .auth
28344 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28345 .await
28346 {
28347 Ok(token) => token,
28348 Err(e) => match dlg.token(e) {
28349 Ok(token) => token,
28350 Err(e) => {
28351 dlg.finished(false);
28352 return Err(common::Error::MissingToken(e));
28353 }
28354 },
28355 };
28356 let mut req_result = {
28357 let client = &self.hub.client;
28358 dlg.pre_request();
28359 let mut req_builder = hyper::Request::builder()
28360 .method(hyper::Method::GET)
28361 .uri(url.as_str())
28362 .header(USER_AGENT, self.hub._user_agent.clone());
28363
28364 if let Some(token) = token.as_ref() {
28365 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28366 }
28367
28368 let request = req_builder
28369 .header(CONTENT_LENGTH, 0_u64)
28370 .body(common::to_body::<String>(None));
28371
28372 client.request(request.unwrap()).await
28373 };
28374
28375 match req_result {
28376 Err(err) => {
28377 if let common::Retry::After(d) = dlg.http_error(&err) {
28378 sleep(d).await;
28379 continue;
28380 }
28381 dlg.finished(false);
28382 return Err(common::Error::HttpError(err));
28383 }
28384 Ok(res) => {
28385 let (mut parts, body) = res.into_parts();
28386 let mut body = common::Body::new(body);
28387 if !parts.status.is_success() {
28388 let bytes = common::to_bytes(body).await.unwrap_or_default();
28389 let error = serde_json::from_str(&common::to_string(&bytes));
28390 let response = common::to_response(parts, bytes.into());
28391
28392 if let common::Retry::After(d) =
28393 dlg.http_failure(&response, error.as_ref().ok())
28394 {
28395 sleep(d).await;
28396 continue;
28397 }
28398
28399 dlg.finished(false);
28400
28401 return Err(match error {
28402 Ok(value) => common::Error::BadRequest(value),
28403 _ => common::Error::Failure(response),
28404 });
28405 }
28406 let response = {
28407 let bytes = common::to_bytes(body).await.unwrap_or_default();
28408 let encoded = common::to_string(&bytes);
28409 match serde_json::from_str(&encoded) {
28410 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28411 Err(error) => {
28412 dlg.response_json_decode_error(&encoded, &error);
28413 return Err(common::Error::JsonDecodeError(
28414 encoded.to_string(),
28415 error,
28416 ));
28417 }
28418 }
28419 };
28420
28421 dlg.finished(true);
28422 return Ok(response);
28423 }
28424 }
28425 }
28426 }
28427
28428 /// Required. Name of the ServiceConnectionMap to get.
28429 ///
28430 /// Sets the *name* path property to the given value.
28431 ///
28432 /// Even though the property as already been set when instantiating this call,
28433 /// we provide this method for API completeness.
28434 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceConnectionMapGetCall<'a, C> {
28435 self._name = new_value.to_string();
28436 self
28437 }
28438 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28439 /// while executing the actual API request.
28440 ///
28441 /// ````text
28442 /// It should be used to handle progress information, and to implement a certain level of resilience.
28443 /// ````
28444 ///
28445 /// Sets the *delegate* property to the given value.
28446 pub fn delegate(
28447 mut self,
28448 new_value: &'a mut dyn common::Delegate,
28449 ) -> ProjectLocationServiceConnectionMapGetCall<'a, C> {
28450 self._delegate = Some(new_value);
28451 self
28452 }
28453
28454 /// Set any additional parameter of the query string used in the request.
28455 /// It should be used to set parameters which are not yet available through their own
28456 /// setters.
28457 ///
28458 /// Please note that this method must not be used to set any of the known parameters
28459 /// which have their own setter method. If done anyway, the request will fail.
28460 ///
28461 /// # Additional Parameters
28462 ///
28463 /// * *$.xgafv* (query-string) - V1 error format.
28464 /// * *access_token* (query-string) - OAuth access token.
28465 /// * *alt* (query-string) - Data format for response.
28466 /// * *callback* (query-string) - JSONP
28467 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28468 /// * *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.
28469 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28470 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28471 /// * *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.
28472 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28473 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28474 pub fn param<T>(
28475 mut self,
28476 name: T,
28477 value: T,
28478 ) -> ProjectLocationServiceConnectionMapGetCall<'a, C>
28479 where
28480 T: AsRef<str>,
28481 {
28482 self._additional_params
28483 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28484 self
28485 }
28486
28487 /// Identifies the authorization scope for the method you are building.
28488 ///
28489 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28490 /// [`Scope::CloudPlatform`].
28491 ///
28492 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28493 /// tokens for more than one scope.
28494 ///
28495 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28496 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28497 /// sufficient, a read-write scope will do as well.
28498 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceConnectionMapGetCall<'a, C>
28499 where
28500 St: AsRef<str>,
28501 {
28502 self._scopes.insert(String::from(scope.as_ref()));
28503 self
28504 }
28505 /// Identifies the authorization scope(s) for the method you are building.
28506 ///
28507 /// See [`Self::add_scope()`] for details.
28508 pub fn add_scopes<I, St>(
28509 mut self,
28510 scopes: I,
28511 ) -> ProjectLocationServiceConnectionMapGetCall<'a, C>
28512 where
28513 I: IntoIterator<Item = St>,
28514 St: AsRef<str>,
28515 {
28516 self._scopes
28517 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28518 self
28519 }
28520
28521 /// Removes all scopes, and no default scope will be used either.
28522 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28523 /// for details).
28524 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionMapGetCall<'a, C> {
28525 self._scopes.clear();
28526 self
28527 }
28528}
28529
28530/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
28531///
28532/// A builder for the *locations.serviceConnectionMaps.getIamPolicy* method supported by a *project* resource.
28533/// It is not used directly, but through a [`ProjectMethods`] instance.
28534///
28535/// # Example
28536///
28537/// Instantiate a resource method builder
28538///
28539/// ```test_harness,no_run
28540/// # extern crate hyper;
28541/// # extern crate hyper_rustls;
28542/// # extern crate google_networkconnectivity1 as networkconnectivity1;
28543/// # async fn dox() {
28544/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28545///
28546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28547/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28548/// # .with_native_roots()
28549/// # .unwrap()
28550/// # .https_only()
28551/// # .enable_http2()
28552/// # .build();
28553///
28554/// # let executor = hyper_util::rt::TokioExecutor::new();
28555/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28556/// # secret,
28557/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28558/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28559/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28560/// # ),
28561/// # ).build().await.unwrap();
28562///
28563/// # let client = hyper_util::client::legacy::Client::builder(
28564/// # hyper_util::rt::TokioExecutor::new()
28565/// # )
28566/// # .build(
28567/// # hyper_rustls::HttpsConnectorBuilder::new()
28568/// # .with_native_roots()
28569/// # .unwrap()
28570/// # .https_or_http()
28571/// # .enable_http2()
28572/// # .build()
28573/// # );
28574/// # let mut hub = Networkconnectivity::new(client, auth);
28575/// // You can configure optional parameters by calling the respective setters at will, and
28576/// // execute the final call using `doit()`.
28577/// // Values shown here are possibly random and not representative !
28578/// let result = hub.projects().locations_service_connection_maps_get_iam_policy("resource")
28579/// .options_requested_policy_version(-61)
28580/// .doit().await;
28581/// # }
28582/// ```
28583pub struct ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C>
28584where
28585 C: 'a,
28586{
28587 hub: &'a Networkconnectivity<C>,
28588 _resource: String,
28589 _options_requested_policy_version: Option<i32>,
28590 _delegate: Option<&'a mut dyn common::Delegate>,
28591 _additional_params: HashMap<String, String>,
28592 _scopes: BTreeSet<String>,
28593}
28594
28595impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C> {}
28596
28597impl<'a, C> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C>
28598where
28599 C: common::Connector,
28600{
28601 /// Perform the operation you have build so far.
28602 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
28603 use std::borrow::Cow;
28604 use std::io::{Read, Seek};
28605
28606 use common::{url::Params, ToParts};
28607 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28608
28609 let mut dd = common::DefaultDelegate;
28610 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28611 dlg.begin(common::MethodInfo {
28612 id: "networkconnectivity.projects.locations.serviceConnectionMaps.getIamPolicy",
28613 http_method: hyper::Method::GET,
28614 });
28615
28616 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
28617 if self._additional_params.contains_key(field) {
28618 dlg.finished(false);
28619 return Err(common::Error::FieldClash(field));
28620 }
28621 }
28622
28623 let mut params = Params::with_capacity(4 + self._additional_params.len());
28624 params.push("resource", self._resource);
28625 if let Some(value) = self._options_requested_policy_version.as_ref() {
28626 params.push("options.requestedPolicyVersion", value.to_string());
28627 }
28628
28629 params.extend(self._additional_params.iter());
28630
28631 params.push("alt", "json");
28632 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
28633 if self._scopes.is_empty() {
28634 self._scopes
28635 .insert(Scope::CloudPlatform.as_ref().to_string());
28636 }
28637
28638 #[allow(clippy::single_element_loop)]
28639 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
28640 url = params.uri_replacement(url, param_name, find_this, true);
28641 }
28642 {
28643 let to_remove = ["resource"];
28644 params.remove_params(&to_remove);
28645 }
28646
28647 let url = params.parse_with_url(&url);
28648
28649 loop {
28650 let token = match self
28651 .hub
28652 .auth
28653 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28654 .await
28655 {
28656 Ok(token) => token,
28657 Err(e) => match dlg.token(e) {
28658 Ok(token) => token,
28659 Err(e) => {
28660 dlg.finished(false);
28661 return Err(common::Error::MissingToken(e));
28662 }
28663 },
28664 };
28665 let mut req_result = {
28666 let client = &self.hub.client;
28667 dlg.pre_request();
28668 let mut req_builder = hyper::Request::builder()
28669 .method(hyper::Method::GET)
28670 .uri(url.as_str())
28671 .header(USER_AGENT, self.hub._user_agent.clone());
28672
28673 if let Some(token) = token.as_ref() {
28674 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28675 }
28676
28677 let request = req_builder
28678 .header(CONTENT_LENGTH, 0_u64)
28679 .body(common::to_body::<String>(None));
28680
28681 client.request(request.unwrap()).await
28682 };
28683
28684 match req_result {
28685 Err(err) => {
28686 if let common::Retry::After(d) = dlg.http_error(&err) {
28687 sleep(d).await;
28688 continue;
28689 }
28690 dlg.finished(false);
28691 return Err(common::Error::HttpError(err));
28692 }
28693 Ok(res) => {
28694 let (mut parts, body) = res.into_parts();
28695 let mut body = common::Body::new(body);
28696 if !parts.status.is_success() {
28697 let bytes = common::to_bytes(body).await.unwrap_or_default();
28698 let error = serde_json::from_str(&common::to_string(&bytes));
28699 let response = common::to_response(parts, bytes.into());
28700
28701 if let common::Retry::After(d) =
28702 dlg.http_failure(&response, error.as_ref().ok())
28703 {
28704 sleep(d).await;
28705 continue;
28706 }
28707
28708 dlg.finished(false);
28709
28710 return Err(match error {
28711 Ok(value) => common::Error::BadRequest(value),
28712 _ => common::Error::Failure(response),
28713 });
28714 }
28715 let response = {
28716 let bytes = common::to_bytes(body).await.unwrap_or_default();
28717 let encoded = common::to_string(&bytes);
28718 match serde_json::from_str(&encoded) {
28719 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28720 Err(error) => {
28721 dlg.response_json_decode_error(&encoded, &error);
28722 return Err(common::Error::JsonDecodeError(
28723 encoded.to_string(),
28724 error,
28725 ));
28726 }
28727 }
28728 };
28729
28730 dlg.finished(true);
28731 return Ok(response);
28732 }
28733 }
28734 }
28735 }
28736
28737 /// 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.
28738 ///
28739 /// Sets the *resource* path property to the given value.
28740 ///
28741 /// Even though the property as already been set when instantiating this call,
28742 /// we provide this method for API completeness.
28743 pub fn resource(
28744 mut self,
28745 new_value: &str,
28746 ) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C> {
28747 self._resource = new_value.to_string();
28748 self
28749 }
28750 /// 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).
28751 ///
28752 /// Sets the *options.requested policy version* query property to the given value.
28753 pub fn options_requested_policy_version(
28754 mut self,
28755 new_value: i32,
28756 ) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C> {
28757 self._options_requested_policy_version = Some(new_value);
28758 self
28759 }
28760 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28761 /// while executing the actual API request.
28762 ///
28763 /// ````text
28764 /// It should be used to handle progress information, and to implement a certain level of resilience.
28765 /// ````
28766 ///
28767 /// Sets the *delegate* property to the given value.
28768 pub fn delegate(
28769 mut self,
28770 new_value: &'a mut dyn common::Delegate,
28771 ) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C> {
28772 self._delegate = Some(new_value);
28773 self
28774 }
28775
28776 /// Set any additional parameter of the query string used in the request.
28777 /// It should be used to set parameters which are not yet available through their own
28778 /// setters.
28779 ///
28780 /// Please note that this method must not be used to set any of the known parameters
28781 /// which have their own setter method. If done anyway, the request will fail.
28782 ///
28783 /// # Additional Parameters
28784 ///
28785 /// * *$.xgafv* (query-string) - V1 error format.
28786 /// * *access_token* (query-string) - OAuth access token.
28787 /// * *alt* (query-string) - Data format for response.
28788 /// * *callback* (query-string) - JSONP
28789 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28790 /// * *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.
28791 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28792 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28793 /// * *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.
28794 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28795 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28796 pub fn param<T>(
28797 mut self,
28798 name: T,
28799 value: T,
28800 ) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C>
28801 where
28802 T: AsRef<str>,
28803 {
28804 self._additional_params
28805 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28806 self
28807 }
28808
28809 /// Identifies the authorization scope for the method you are building.
28810 ///
28811 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28812 /// [`Scope::CloudPlatform`].
28813 ///
28814 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28815 /// tokens for more than one scope.
28816 ///
28817 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28818 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28819 /// sufficient, a read-write scope will do as well.
28820 pub fn add_scope<St>(
28821 mut self,
28822 scope: St,
28823 ) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C>
28824 where
28825 St: AsRef<str>,
28826 {
28827 self._scopes.insert(String::from(scope.as_ref()));
28828 self
28829 }
28830 /// Identifies the authorization scope(s) for the method you are building.
28831 ///
28832 /// See [`Self::add_scope()`] for details.
28833 pub fn add_scopes<I, St>(
28834 mut self,
28835 scopes: I,
28836 ) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C>
28837 where
28838 I: IntoIterator<Item = St>,
28839 St: AsRef<str>,
28840 {
28841 self._scopes
28842 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28843 self
28844 }
28845
28846 /// Removes all scopes, and no default scope will be used either.
28847 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28848 /// for details).
28849 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionMapGetIamPolicyCall<'a, C> {
28850 self._scopes.clear();
28851 self
28852 }
28853}
28854
28855/// Lists ServiceConnectionMaps in a given project and location.
28856///
28857/// A builder for the *locations.serviceConnectionMaps.list* method supported by a *project* resource.
28858/// It is not used directly, but through a [`ProjectMethods`] instance.
28859///
28860/// # Example
28861///
28862/// Instantiate a resource method builder
28863///
28864/// ```test_harness,no_run
28865/// # extern crate hyper;
28866/// # extern crate hyper_rustls;
28867/// # extern crate google_networkconnectivity1 as networkconnectivity1;
28868/// # async fn dox() {
28869/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28870///
28871/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28872/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28873/// # .with_native_roots()
28874/// # .unwrap()
28875/// # .https_only()
28876/// # .enable_http2()
28877/// # .build();
28878///
28879/// # let executor = hyper_util::rt::TokioExecutor::new();
28880/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28881/// # secret,
28882/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28883/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28884/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28885/// # ),
28886/// # ).build().await.unwrap();
28887///
28888/// # let client = hyper_util::client::legacy::Client::builder(
28889/// # hyper_util::rt::TokioExecutor::new()
28890/// # )
28891/// # .build(
28892/// # hyper_rustls::HttpsConnectorBuilder::new()
28893/// # .with_native_roots()
28894/// # .unwrap()
28895/// # .https_or_http()
28896/// # .enable_http2()
28897/// # .build()
28898/// # );
28899/// # let mut hub = Networkconnectivity::new(client, auth);
28900/// // You can configure optional parameters by calling the respective setters at will, and
28901/// // execute the final call using `doit()`.
28902/// // Values shown here are possibly random and not representative !
28903/// let result = hub.projects().locations_service_connection_maps_list("parent")
28904/// .page_token("ipsum")
28905/// .page_size(-56)
28906/// .order_by("accusam")
28907/// .filter("gubergren")
28908/// .doit().await;
28909/// # }
28910/// ```
28911pub struct ProjectLocationServiceConnectionMapListCall<'a, C>
28912where
28913 C: 'a,
28914{
28915 hub: &'a Networkconnectivity<C>,
28916 _parent: String,
28917 _page_token: Option<String>,
28918 _page_size: Option<i32>,
28919 _order_by: Option<String>,
28920 _filter: Option<String>,
28921 _delegate: Option<&'a mut dyn common::Delegate>,
28922 _additional_params: HashMap<String, String>,
28923 _scopes: BTreeSet<String>,
28924}
28925
28926impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionMapListCall<'a, C> {}
28927
28928impl<'a, C> ProjectLocationServiceConnectionMapListCall<'a, C>
28929where
28930 C: common::Connector,
28931{
28932 /// Perform the operation you have build so far.
28933 pub async fn doit(
28934 mut self,
28935 ) -> common::Result<(common::Response, ListServiceConnectionMapsResponse)> {
28936 use std::borrow::Cow;
28937 use std::io::{Read, Seek};
28938
28939 use common::{url::Params, ToParts};
28940 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28941
28942 let mut dd = common::DefaultDelegate;
28943 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28944 dlg.begin(common::MethodInfo {
28945 id: "networkconnectivity.projects.locations.serviceConnectionMaps.list",
28946 http_method: hyper::Method::GET,
28947 });
28948
28949 for &field in [
28950 "alt",
28951 "parent",
28952 "pageToken",
28953 "pageSize",
28954 "orderBy",
28955 "filter",
28956 ]
28957 .iter()
28958 {
28959 if self._additional_params.contains_key(field) {
28960 dlg.finished(false);
28961 return Err(common::Error::FieldClash(field));
28962 }
28963 }
28964
28965 let mut params = Params::with_capacity(7 + self._additional_params.len());
28966 params.push("parent", self._parent);
28967 if let Some(value) = self._page_token.as_ref() {
28968 params.push("pageToken", value);
28969 }
28970 if let Some(value) = self._page_size.as_ref() {
28971 params.push("pageSize", value.to_string());
28972 }
28973 if let Some(value) = self._order_by.as_ref() {
28974 params.push("orderBy", value);
28975 }
28976 if let Some(value) = self._filter.as_ref() {
28977 params.push("filter", value);
28978 }
28979
28980 params.extend(self._additional_params.iter());
28981
28982 params.push("alt", "json");
28983 let mut url = self.hub._base_url.clone() + "v1/{+parent}/serviceConnectionMaps";
28984 if self._scopes.is_empty() {
28985 self._scopes
28986 .insert(Scope::CloudPlatform.as_ref().to_string());
28987 }
28988
28989 #[allow(clippy::single_element_loop)]
28990 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
28991 url = params.uri_replacement(url, param_name, find_this, true);
28992 }
28993 {
28994 let to_remove = ["parent"];
28995 params.remove_params(&to_remove);
28996 }
28997
28998 let url = params.parse_with_url(&url);
28999
29000 loop {
29001 let token = match self
29002 .hub
29003 .auth
29004 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29005 .await
29006 {
29007 Ok(token) => token,
29008 Err(e) => match dlg.token(e) {
29009 Ok(token) => token,
29010 Err(e) => {
29011 dlg.finished(false);
29012 return Err(common::Error::MissingToken(e));
29013 }
29014 },
29015 };
29016 let mut req_result = {
29017 let client = &self.hub.client;
29018 dlg.pre_request();
29019 let mut req_builder = hyper::Request::builder()
29020 .method(hyper::Method::GET)
29021 .uri(url.as_str())
29022 .header(USER_AGENT, self.hub._user_agent.clone());
29023
29024 if let Some(token) = token.as_ref() {
29025 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29026 }
29027
29028 let request = req_builder
29029 .header(CONTENT_LENGTH, 0_u64)
29030 .body(common::to_body::<String>(None));
29031
29032 client.request(request.unwrap()).await
29033 };
29034
29035 match req_result {
29036 Err(err) => {
29037 if let common::Retry::After(d) = dlg.http_error(&err) {
29038 sleep(d).await;
29039 continue;
29040 }
29041 dlg.finished(false);
29042 return Err(common::Error::HttpError(err));
29043 }
29044 Ok(res) => {
29045 let (mut parts, body) = res.into_parts();
29046 let mut body = common::Body::new(body);
29047 if !parts.status.is_success() {
29048 let bytes = common::to_bytes(body).await.unwrap_or_default();
29049 let error = serde_json::from_str(&common::to_string(&bytes));
29050 let response = common::to_response(parts, bytes.into());
29051
29052 if let common::Retry::After(d) =
29053 dlg.http_failure(&response, error.as_ref().ok())
29054 {
29055 sleep(d).await;
29056 continue;
29057 }
29058
29059 dlg.finished(false);
29060
29061 return Err(match error {
29062 Ok(value) => common::Error::BadRequest(value),
29063 _ => common::Error::Failure(response),
29064 });
29065 }
29066 let response = {
29067 let bytes = common::to_bytes(body).await.unwrap_or_default();
29068 let encoded = common::to_string(&bytes);
29069 match serde_json::from_str(&encoded) {
29070 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29071 Err(error) => {
29072 dlg.response_json_decode_error(&encoded, &error);
29073 return Err(common::Error::JsonDecodeError(
29074 encoded.to_string(),
29075 error,
29076 ));
29077 }
29078 }
29079 };
29080
29081 dlg.finished(true);
29082 return Ok(response);
29083 }
29084 }
29085 }
29086 }
29087
29088 /// Required. The parent resource's name. ex. projects/123/locations/us-east1
29089 ///
29090 /// Sets the *parent* path property to the given value.
29091 ///
29092 /// Even though the property as already been set when instantiating this call,
29093 /// we provide this method for API completeness.
29094 pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
29095 self._parent = new_value.to_string();
29096 self
29097 }
29098 /// The page token.
29099 ///
29100 /// Sets the *page token* query property to the given value.
29101 pub fn page_token(
29102 mut self,
29103 new_value: &str,
29104 ) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
29105 self._page_token = Some(new_value.to_string());
29106 self
29107 }
29108 /// The maximum number of results per page that should be returned.
29109 ///
29110 /// Sets the *page size* query property to the given value.
29111 pub fn page_size(
29112 mut self,
29113 new_value: i32,
29114 ) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
29115 self._page_size = Some(new_value);
29116 self
29117 }
29118 /// Sort the results by a certain order.
29119 ///
29120 /// Sets the *order by* query property to the given value.
29121 pub fn order_by(
29122 mut self,
29123 new_value: &str,
29124 ) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
29125 self._order_by = Some(new_value.to_string());
29126 self
29127 }
29128 /// A filter expression that filters the results listed in the response.
29129 ///
29130 /// Sets the *filter* query property to the given value.
29131 pub fn filter(mut self, new_value: &str) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
29132 self._filter = Some(new_value.to_string());
29133 self
29134 }
29135 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29136 /// while executing the actual API request.
29137 ///
29138 /// ````text
29139 /// It should be used to handle progress information, and to implement a certain level of resilience.
29140 /// ````
29141 ///
29142 /// Sets the *delegate* property to the given value.
29143 pub fn delegate(
29144 mut self,
29145 new_value: &'a mut dyn common::Delegate,
29146 ) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
29147 self._delegate = Some(new_value);
29148 self
29149 }
29150
29151 /// Set any additional parameter of the query string used in the request.
29152 /// It should be used to set parameters which are not yet available through their own
29153 /// setters.
29154 ///
29155 /// Please note that this method must not be used to set any of the known parameters
29156 /// which have their own setter method. If done anyway, the request will fail.
29157 ///
29158 /// # Additional Parameters
29159 ///
29160 /// * *$.xgafv* (query-string) - V1 error format.
29161 /// * *access_token* (query-string) - OAuth access token.
29162 /// * *alt* (query-string) - Data format for response.
29163 /// * *callback* (query-string) - JSONP
29164 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29165 /// * *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.
29166 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29167 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29168 /// * *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.
29169 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29170 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29171 pub fn param<T>(
29172 mut self,
29173 name: T,
29174 value: T,
29175 ) -> ProjectLocationServiceConnectionMapListCall<'a, C>
29176 where
29177 T: AsRef<str>,
29178 {
29179 self._additional_params
29180 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29181 self
29182 }
29183
29184 /// Identifies the authorization scope for the method you are building.
29185 ///
29186 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29187 /// [`Scope::CloudPlatform`].
29188 ///
29189 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29190 /// tokens for more than one scope.
29191 ///
29192 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29193 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29194 /// sufficient, a read-write scope will do as well.
29195 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceConnectionMapListCall<'a, C>
29196 where
29197 St: AsRef<str>,
29198 {
29199 self._scopes.insert(String::from(scope.as_ref()));
29200 self
29201 }
29202 /// Identifies the authorization scope(s) for the method you are building.
29203 ///
29204 /// See [`Self::add_scope()`] for details.
29205 pub fn add_scopes<I, St>(
29206 mut self,
29207 scopes: I,
29208 ) -> ProjectLocationServiceConnectionMapListCall<'a, C>
29209 where
29210 I: IntoIterator<Item = St>,
29211 St: AsRef<str>,
29212 {
29213 self._scopes
29214 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29215 self
29216 }
29217
29218 /// Removes all scopes, and no default scope will be used either.
29219 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29220 /// for details).
29221 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionMapListCall<'a, C> {
29222 self._scopes.clear();
29223 self
29224 }
29225}
29226
29227/// Updates the parameters of a single ServiceConnectionMap.
29228///
29229/// A builder for the *locations.serviceConnectionMaps.patch* method supported by a *project* resource.
29230/// It is not used directly, but through a [`ProjectMethods`] instance.
29231///
29232/// # Example
29233///
29234/// Instantiate a resource method builder
29235///
29236/// ```test_harness,no_run
29237/// # extern crate hyper;
29238/// # extern crate hyper_rustls;
29239/// # extern crate google_networkconnectivity1 as networkconnectivity1;
29240/// use networkconnectivity1::api::ServiceConnectionMap;
29241/// # async fn dox() {
29242/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29243///
29244/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29245/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29246/// # .with_native_roots()
29247/// # .unwrap()
29248/// # .https_only()
29249/// # .enable_http2()
29250/// # .build();
29251///
29252/// # let executor = hyper_util::rt::TokioExecutor::new();
29253/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29254/// # secret,
29255/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29256/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29257/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29258/// # ),
29259/// # ).build().await.unwrap();
29260///
29261/// # let client = hyper_util::client::legacy::Client::builder(
29262/// # hyper_util::rt::TokioExecutor::new()
29263/// # )
29264/// # .build(
29265/// # hyper_rustls::HttpsConnectorBuilder::new()
29266/// # .with_native_roots()
29267/// # .unwrap()
29268/// # .https_or_http()
29269/// # .enable_http2()
29270/// # .build()
29271/// # );
29272/// # let mut hub = Networkconnectivity::new(client, auth);
29273/// // As the method needs a request, you would usually fill it with the desired information
29274/// // into the respective structure. Some of the parts shown here might not be applicable !
29275/// // Values shown here are possibly random and not representative !
29276/// let mut req = ServiceConnectionMap::default();
29277///
29278/// // You can configure optional parameters by calling the respective setters at will, and
29279/// // execute the final call using `doit()`.
29280/// // Values shown here are possibly random and not representative !
29281/// let result = hub.projects().locations_service_connection_maps_patch(req, "name")
29282/// .update_mask(FieldMask::new::<&str>(&[]))
29283/// .request_id("At")
29284/// .doit().await;
29285/// # }
29286/// ```
29287pub struct ProjectLocationServiceConnectionMapPatchCall<'a, C>
29288where
29289 C: 'a,
29290{
29291 hub: &'a Networkconnectivity<C>,
29292 _request: ServiceConnectionMap,
29293 _name: String,
29294 _update_mask: Option<common::FieldMask>,
29295 _request_id: Option<String>,
29296 _delegate: Option<&'a mut dyn common::Delegate>,
29297 _additional_params: HashMap<String, String>,
29298 _scopes: BTreeSet<String>,
29299}
29300
29301impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionMapPatchCall<'a, C> {}
29302
29303impl<'a, C> ProjectLocationServiceConnectionMapPatchCall<'a, C>
29304where
29305 C: common::Connector,
29306{
29307 /// Perform the operation you have build so far.
29308 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
29309 use std::borrow::Cow;
29310 use std::io::{Read, Seek};
29311
29312 use common::{url::Params, ToParts};
29313 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29314
29315 let mut dd = common::DefaultDelegate;
29316 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29317 dlg.begin(common::MethodInfo {
29318 id: "networkconnectivity.projects.locations.serviceConnectionMaps.patch",
29319 http_method: hyper::Method::PATCH,
29320 });
29321
29322 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
29323 if self._additional_params.contains_key(field) {
29324 dlg.finished(false);
29325 return Err(common::Error::FieldClash(field));
29326 }
29327 }
29328
29329 let mut params = Params::with_capacity(6 + self._additional_params.len());
29330 params.push("name", self._name);
29331 if let Some(value) = self._update_mask.as_ref() {
29332 params.push("updateMask", value.to_string());
29333 }
29334 if let Some(value) = self._request_id.as_ref() {
29335 params.push("requestId", value);
29336 }
29337
29338 params.extend(self._additional_params.iter());
29339
29340 params.push("alt", "json");
29341 let mut url = self.hub._base_url.clone() + "v1/{+name}";
29342 if self._scopes.is_empty() {
29343 self._scopes
29344 .insert(Scope::CloudPlatform.as_ref().to_string());
29345 }
29346
29347 #[allow(clippy::single_element_loop)]
29348 for &(find_this, param_name) in [("{+name}", "name")].iter() {
29349 url = params.uri_replacement(url, param_name, find_this, true);
29350 }
29351 {
29352 let to_remove = ["name"];
29353 params.remove_params(&to_remove);
29354 }
29355
29356 let url = params.parse_with_url(&url);
29357
29358 let mut json_mime_type = mime::APPLICATION_JSON;
29359 let mut request_value_reader = {
29360 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29361 common::remove_json_null_values(&mut value);
29362 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29363 serde_json::to_writer(&mut dst, &value).unwrap();
29364 dst
29365 };
29366 let request_size = request_value_reader
29367 .seek(std::io::SeekFrom::End(0))
29368 .unwrap();
29369 request_value_reader
29370 .seek(std::io::SeekFrom::Start(0))
29371 .unwrap();
29372
29373 loop {
29374 let token = match self
29375 .hub
29376 .auth
29377 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29378 .await
29379 {
29380 Ok(token) => token,
29381 Err(e) => match dlg.token(e) {
29382 Ok(token) => token,
29383 Err(e) => {
29384 dlg.finished(false);
29385 return Err(common::Error::MissingToken(e));
29386 }
29387 },
29388 };
29389 request_value_reader
29390 .seek(std::io::SeekFrom::Start(0))
29391 .unwrap();
29392 let mut req_result = {
29393 let client = &self.hub.client;
29394 dlg.pre_request();
29395 let mut req_builder = hyper::Request::builder()
29396 .method(hyper::Method::PATCH)
29397 .uri(url.as_str())
29398 .header(USER_AGENT, self.hub._user_agent.clone());
29399
29400 if let Some(token) = token.as_ref() {
29401 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29402 }
29403
29404 let request = req_builder
29405 .header(CONTENT_TYPE, json_mime_type.to_string())
29406 .header(CONTENT_LENGTH, request_size as u64)
29407 .body(common::to_body(
29408 request_value_reader.get_ref().clone().into(),
29409 ));
29410
29411 client.request(request.unwrap()).await
29412 };
29413
29414 match req_result {
29415 Err(err) => {
29416 if let common::Retry::After(d) = dlg.http_error(&err) {
29417 sleep(d).await;
29418 continue;
29419 }
29420 dlg.finished(false);
29421 return Err(common::Error::HttpError(err));
29422 }
29423 Ok(res) => {
29424 let (mut parts, body) = res.into_parts();
29425 let mut body = common::Body::new(body);
29426 if !parts.status.is_success() {
29427 let bytes = common::to_bytes(body).await.unwrap_or_default();
29428 let error = serde_json::from_str(&common::to_string(&bytes));
29429 let response = common::to_response(parts, bytes.into());
29430
29431 if let common::Retry::After(d) =
29432 dlg.http_failure(&response, error.as_ref().ok())
29433 {
29434 sleep(d).await;
29435 continue;
29436 }
29437
29438 dlg.finished(false);
29439
29440 return Err(match error {
29441 Ok(value) => common::Error::BadRequest(value),
29442 _ => common::Error::Failure(response),
29443 });
29444 }
29445 let response = {
29446 let bytes = common::to_bytes(body).await.unwrap_or_default();
29447 let encoded = common::to_string(&bytes);
29448 match serde_json::from_str(&encoded) {
29449 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29450 Err(error) => {
29451 dlg.response_json_decode_error(&encoded, &error);
29452 return Err(common::Error::JsonDecodeError(
29453 encoded.to_string(),
29454 error,
29455 ));
29456 }
29457 }
29458 };
29459
29460 dlg.finished(true);
29461 return Ok(response);
29462 }
29463 }
29464 }
29465 }
29466
29467 ///
29468 /// Sets the *request* property to the given value.
29469 ///
29470 /// Even though the property as already been set when instantiating this call,
29471 /// we provide this method for API completeness.
29472 pub fn request(
29473 mut self,
29474 new_value: ServiceConnectionMap,
29475 ) -> ProjectLocationServiceConnectionMapPatchCall<'a, C> {
29476 self._request = new_value;
29477 self
29478 }
29479 /// Immutable. The name of a ServiceConnectionMap. Format: projects/{project}/locations/{location}/serviceConnectionMaps/{service_connection_map} See: https://google.aip.dev/122#fields-representing-resource-names
29480 ///
29481 /// Sets the *name* path property to the given value.
29482 ///
29483 /// Even though the property as already been set when instantiating this call,
29484 /// we provide this method for API completeness.
29485 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceConnectionMapPatchCall<'a, C> {
29486 self._name = new_value.to_string();
29487 self
29488 }
29489 /// Optional. Field mask is used to specify the fields to be overwritten in the ServiceConnectionMap resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
29490 ///
29491 /// Sets the *update mask* query property to the given value.
29492 pub fn update_mask(
29493 mut self,
29494 new_value: common::FieldMask,
29495 ) -> ProjectLocationServiceConnectionMapPatchCall<'a, C> {
29496 self._update_mask = Some(new_value);
29497 self
29498 }
29499 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
29500 ///
29501 /// Sets the *request id* query property to the given value.
29502 pub fn request_id(
29503 mut self,
29504 new_value: &str,
29505 ) -> ProjectLocationServiceConnectionMapPatchCall<'a, C> {
29506 self._request_id = Some(new_value.to_string());
29507 self
29508 }
29509 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29510 /// while executing the actual API request.
29511 ///
29512 /// ````text
29513 /// It should be used to handle progress information, and to implement a certain level of resilience.
29514 /// ````
29515 ///
29516 /// Sets the *delegate* property to the given value.
29517 pub fn delegate(
29518 mut self,
29519 new_value: &'a mut dyn common::Delegate,
29520 ) -> ProjectLocationServiceConnectionMapPatchCall<'a, C> {
29521 self._delegate = Some(new_value);
29522 self
29523 }
29524
29525 /// Set any additional parameter of the query string used in the request.
29526 /// It should be used to set parameters which are not yet available through their own
29527 /// setters.
29528 ///
29529 /// Please note that this method must not be used to set any of the known parameters
29530 /// which have their own setter method. If done anyway, the request will fail.
29531 ///
29532 /// # Additional Parameters
29533 ///
29534 /// * *$.xgafv* (query-string) - V1 error format.
29535 /// * *access_token* (query-string) - OAuth access token.
29536 /// * *alt* (query-string) - Data format for response.
29537 /// * *callback* (query-string) - JSONP
29538 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29539 /// * *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.
29540 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29541 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29542 /// * *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.
29543 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29544 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29545 pub fn param<T>(
29546 mut self,
29547 name: T,
29548 value: T,
29549 ) -> ProjectLocationServiceConnectionMapPatchCall<'a, C>
29550 where
29551 T: AsRef<str>,
29552 {
29553 self._additional_params
29554 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29555 self
29556 }
29557
29558 /// Identifies the authorization scope for the method you are building.
29559 ///
29560 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29561 /// [`Scope::CloudPlatform`].
29562 ///
29563 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29564 /// tokens for more than one scope.
29565 ///
29566 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29567 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29568 /// sufficient, a read-write scope will do as well.
29569 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceConnectionMapPatchCall<'a, C>
29570 where
29571 St: AsRef<str>,
29572 {
29573 self._scopes.insert(String::from(scope.as_ref()));
29574 self
29575 }
29576 /// Identifies the authorization scope(s) for the method you are building.
29577 ///
29578 /// See [`Self::add_scope()`] for details.
29579 pub fn add_scopes<I, St>(
29580 mut self,
29581 scopes: I,
29582 ) -> ProjectLocationServiceConnectionMapPatchCall<'a, C>
29583 where
29584 I: IntoIterator<Item = St>,
29585 St: AsRef<str>,
29586 {
29587 self._scopes
29588 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29589 self
29590 }
29591
29592 /// Removes all scopes, and no default scope will be used either.
29593 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29594 /// for details).
29595 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionMapPatchCall<'a, C> {
29596 self._scopes.clear();
29597 self
29598 }
29599}
29600
29601/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
29602///
29603/// A builder for the *locations.serviceConnectionMaps.setIamPolicy* method supported by a *project* resource.
29604/// It is not used directly, but through a [`ProjectMethods`] instance.
29605///
29606/// # Example
29607///
29608/// Instantiate a resource method builder
29609///
29610/// ```test_harness,no_run
29611/// # extern crate hyper;
29612/// # extern crate hyper_rustls;
29613/// # extern crate google_networkconnectivity1 as networkconnectivity1;
29614/// use networkconnectivity1::api::SetIamPolicyRequest;
29615/// # async fn dox() {
29616/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29617///
29618/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29619/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29620/// # .with_native_roots()
29621/// # .unwrap()
29622/// # .https_only()
29623/// # .enable_http2()
29624/// # .build();
29625///
29626/// # let executor = hyper_util::rt::TokioExecutor::new();
29627/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29628/// # secret,
29629/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29630/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29631/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29632/// # ),
29633/// # ).build().await.unwrap();
29634///
29635/// # let client = hyper_util::client::legacy::Client::builder(
29636/// # hyper_util::rt::TokioExecutor::new()
29637/// # )
29638/// # .build(
29639/// # hyper_rustls::HttpsConnectorBuilder::new()
29640/// # .with_native_roots()
29641/// # .unwrap()
29642/// # .https_or_http()
29643/// # .enable_http2()
29644/// # .build()
29645/// # );
29646/// # let mut hub = Networkconnectivity::new(client, auth);
29647/// // As the method needs a request, you would usually fill it with the desired information
29648/// // into the respective structure. Some of the parts shown here might not be applicable !
29649/// // Values shown here are possibly random and not representative !
29650/// let mut req = SetIamPolicyRequest::default();
29651///
29652/// // You can configure optional parameters by calling the respective setters at will, and
29653/// // execute the final call using `doit()`.
29654/// // Values shown here are possibly random and not representative !
29655/// let result = hub.projects().locations_service_connection_maps_set_iam_policy(req, "resource")
29656/// .doit().await;
29657/// # }
29658/// ```
29659pub struct ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C>
29660where
29661 C: 'a,
29662{
29663 hub: &'a Networkconnectivity<C>,
29664 _request: SetIamPolicyRequest,
29665 _resource: String,
29666 _delegate: Option<&'a mut dyn common::Delegate>,
29667 _additional_params: HashMap<String, String>,
29668 _scopes: BTreeSet<String>,
29669}
29670
29671impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C> {}
29672
29673impl<'a, C> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C>
29674where
29675 C: common::Connector,
29676{
29677 /// Perform the operation you have build so far.
29678 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
29679 use std::borrow::Cow;
29680 use std::io::{Read, Seek};
29681
29682 use common::{url::Params, ToParts};
29683 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29684
29685 let mut dd = common::DefaultDelegate;
29686 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29687 dlg.begin(common::MethodInfo {
29688 id: "networkconnectivity.projects.locations.serviceConnectionMaps.setIamPolicy",
29689 http_method: hyper::Method::POST,
29690 });
29691
29692 for &field in ["alt", "resource"].iter() {
29693 if self._additional_params.contains_key(field) {
29694 dlg.finished(false);
29695 return Err(common::Error::FieldClash(field));
29696 }
29697 }
29698
29699 let mut params = Params::with_capacity(4 + self._additional_params.len());
29700 params.push("resource", self._resource);
29701
29702 params.extend(self._additional_params.iter());
29703
29704 params.push("alt", "json");
29705 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
29706 if self._scopes.is_empty() {
29707 self._scopes
29708 .insert(Scope::CloudPlatform.as_ref().to_string());
29709 }
29710
29711 #[allow(clippy::single_element_loop)]
29712 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
29713 url = params.uri_replacement(url, param_name, find_this, true);
29714 }
29715 {
29716 let to_remove = ["resource"];
29717 params.remove_params(&to_remove);
29718 }
29719
29720 let url = params.parse_with_url(&url);
29721
29722 let mut json_mime_type = mime::APPLICATION_JSON;
29723 let mut request_value_reader = {
29724 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29725 common::remove_json_null_values(&mut value);
29726 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29727 serde_json::to_writer(&mut dst, &value).unwrap();
29728 dst
29729 };
29730 let request_size = request_value_reader
29731 .seek(std::io::SeekFrom::End(0))
29732 .unwrap();
29733 request_value_reader
29734 .seek(std::io::SeekFrom::Start(0))
29735 .unwrap();
29736
29737 loop {
29738 let token = match self
29739 .hub
29740 .auth
29741 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29742 .await
29743 {
29744 Ok(token) => token,
29745 Err(e) => match dlg.token(e) {
29746 Ok(token) => token,
29747 Err(e) => {
29748 dlg.finished(false);
29749 return Err(common::Error::MissingToken(e));
29750 }
29751 },
29752 };
29753 request_value_reader
29754 .seek(std::io::SeekFrom::Start(0))
29755 .unwrap();
29756 let mut req_result = {
29757 let client = &self.hub.client;
29758 dlg.pre_request();
29759 let mut req_builder = hyper::Request::builder()
29760 .method(hyper::Method::POST)
29761 .uri(url.as_str())
29762 .header(USER_AGENT, self.hub._user_agent.clone());
29763
29764 if let Some(token) = token.as_ref() {
29765 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29766 }
29767
29768 let request = req_builder
29769 .header(CONTENT_TYPE, json_mime_type.to_string())
29770 .header(CONTENT_LENGTH, request_size as u64)
29771 .body(common::to_body(
29772 request_value_reader.get_ref().clone().into(),
29773 ));
29774
29775 client.request(request.unwrap()).await
29776 };
29777
29778 match req_result {
29779 Err(err) => {
29780 if let common::Retry::After(d) = dlg.http_error(&err) {
29781 sleep(d).await;
29782 continue;
29783 }
29784 dlg.finished(false);
29785 return Err(common::Error::HttpError(err));
29786 }
29787 Ok(res) => {
29788 let (mut parts, body) = res.into_parts();
29789 let mut body = common::Body::new(body);
29790 if !parts.status.is_success() {
29791 let bytes = common::to_bytes(body).await.unwrap_or_default();
29792 let error = serde_json::from_str(&common::to_string(&bytes));
29793 let response = common::to_response(parts, bytes.into());
29794
29795 if let common::Retry::After(d) =
29796 dlg.http_failure(&response, error.as_ref().ok())
29797 {
29798 sleep(d).await;
29799 continue;
29800 }
29801
29802 dlg.finished(false);
29803
29804 return Err(match error {
29805 Ok(value) => common::Error::BadRequest(value),
29806 _ => common::Error::Failure(response),
29807 });
29808 }
29809 let response = {
29810 let bytes = common::to_bytes(body).await.unwrap_or_default();
29811 let encoded = common::to_string(&bytes);
29812 match serde_json::from_str(&encoded) {
29813 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29814 Err(error) => {
29815 dlg.response_json_decode_error(&encoded, &error);
29816 return Err(common::Error::JsonDecodeError(
29817 encoded.to_string(),
29818 error,
29819 ));
29820 }
29821 }
29822 };
29823
29824 dlg.finished(true);
29825 return Ok(response);
29826 }
29827 }
29828 }
29829 }
29830
29831 ///
29832 /// Sets the *request* property to the given value.
29833 ///
29834 /// Even though the property as already been set when instantiating this call,
29835 /// we provide this method for API completeness.
29836 pub fn request(
29837 mut self,
29838 new_value: SetIamPolicyRequest,
29839 ) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C> {
29840 self._request = new_value;
29841 self
29842 }
29843 /// 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.
29844 ///
29845 /// Sets the *resource* path property to the given value.
29846 ///
29847 /// Even though the property as already been set when instantiating this call,
29848 /// we provide this method for API completeness.
29849 pub fn resource(
29850 mut self,
29851 new_value: &str,
29852 ) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C> {
29853 self._resource = new_value.to_string();
29854 self
29855 }
29856 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29857 /// while executing the actual API request.
29858 ///
29859 /// ````text
29860 /// It should be used to handle progress information, and to implement a certain level of resilience.
29861 /// ````
29862 ///
29863 /// Sets the *delegate* property to the given value.
29864 pub fn delegate(
29865 mut self,
29866 new_value: &'a mut dyn common::Delegate,
29867 ) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C> {
29868 self._delegate = Some(new_value);
29869 self
29870 }
29871
29872 /// Set any additional parameter of the query string used in the request.
29873 /// It should be used to set parameters which are not yet available through their own
29874 /// setters.
29875 ///
29876 /// Please note that this method must not be used to set any of the known parameters
29877 /// which have their own setter method. If done anyway, the request will fail.
29878 ///
29879 /// # Additional Parameters
29880 ///
29881 /// * *$.xgafv* (query-string) - V1 error format.
29882 /// * *access_token* (query-string) - OAuth access token.
29883 /// * *alt* (query-string) - Data format for response.
29884 /// * *callback* (query-string) - JSONP
29885 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29886 /// * *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.
29887 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29888 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29889 /// * *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.
29890 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29891 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29892 pub fn param<T>(
29893 mut self,
29894 name: T,
29895 value: T,
29896 ) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C>
29897 where
29898 T: AsRef<str>,
29899 {
29900 self._additional_params
29901 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29902 self
29903 }
29904
29905 /// Identifies the authorization scope for the method you are building.
29906 ///
29907 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29908 /// [`Scope::CloudPlatform`].
29909 ///
29910 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29911 /// tokens for more than one scope.
29912 ///
29913 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29914 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29915 /// sufficient, a read-write scope will do as well.
29916 pub fn add_scope<St>(
29917 mut self,
29918 scope: St,
29919 ) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C>
29920 where
29921 St: AsRef<str>,
29922 {
29923 self._scopes.insert(String::from(scope.as_ref()));
29924 self
29925 }
29926 /// Identifies the authorization scope(s) for the method you are building.
29927 ///
29928 /// See [`Self::add_scope()`] for details.
29929 pub fn add_scopes<I, St>(
29930 mut self,
29931 scopes: I,
29932 ) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C>
29933 where
29934 I: IntoIterator<Item = St>,
29935 St: AsRef<str>,
29936 {
29937 self._scopes
29938 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29939 self
29940 }
29941
29942 /// Removes all scopes, and no default scope will be used either.
29943 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29944 /// for details).
29945 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionMapSetIamPolicyCall<'a, C> {
29946 self._scopes.clear();
29947 self
29948 }
29949}
29950
29951/// 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.
29952///
29953/// A builder for the *locations.serviceConnectionMaps.testIamPermissions* method supported by a *project* resource.
29954/// It is not used directly, but through a [`ProjectMethods`] instance.
29955///
29956/// # Example
29957///
29958/// Instantiate a resource method builder
29959///
29960/// ```test_harness,no_run
29961/// # extern crate hyper;
29962/// # extern crate hyper_rustls;
29963/// # extern crate google_networkconnectivity1 as networkconnectivity1;
29964/// use networkconnectivity1::api::TestIamPermissionsRequest;
29965/// # async fn dox() {
29966/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29967///
29968/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29969/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29970/// # .with_native_roots()
29971/// # .unwrap()
29972/// # .https_only()
29973/// # .enable_http2()
29974/// # .build();
29975///
29976/// # let executor = hyper_util::rt::TokioExecutor::new();
29977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29978/// # secret,
29979/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29980/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29981/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29982/// # ),
29983/// # ).build().await.unwrap();
29984///
29985/// # let client = hyper_util::client::legacy::Client::builder(
29986/// # hyper_util::rt::TokioExecutor::new()
29987/// # )
29988/// # .build(
29989/// # hyper_rustls::HttpsConnectorBuilder::new()
29990/// # .with_native_roots()
29991/// # .unwrap()
29992/// # .https_or_http()
29993/// # .enable_http2()
29994/// # .build()
29995/// # );
29996/// # let mut hub = Networkconnectivity::new(client, auth);
29997/// // As the method needs a request, you would usually fill it with the desired information
29998/// // into the respective structure. Some of the parts shown here might not be applicable !
29999/// // Values shown here are possibly random and not representative !
30000/// let mut req = TestIamPermissionsRequest::default();
30001///
30002/// // You can configure optional parameters by calling the respective setters at will, and
30003/// // execute the final call using `doit()`.
30004/// // Values shown here are possibly random and not representative !
30005/// let result = hub.projects().locations_service_connection_maps_test_iam_permissions(req, "resource")
30006/// .doit().await;
30007/// # }
30008/// ```
30009pub struct ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C>
30010where
30011 C: 'a,
30012{
30013 hub: &'a Networkconnectivity<C>,
30014 _request: TestIamPermissionsRequest,
30015 _resource: String,
30016 _delegate: Option<&'a mut dyn common::Delegate>,
30017 _additional_params: HashMap<String, String>,
30018 _scopes: BTreeSet<String>,
30019}
30020
30021impl<'a, C> common::CallBuilder
30022 for ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C>
30023{
30024}
30025
30026impl<'a, C> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C>
30027where
30028 C: common::Connector,
30029{
30030 /// Perform the operation you have build so far.
30031 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
30032 use std::borrow::Cow;
30033 use std::io::{Read, Seek};
30034
30035 use common::{url::Params, ToParts};
30036 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30037
30038 let mut dd = common::DefaultDelegate;
30039 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30040 dlg.begin(common::MethodInfo {
30041 id: "networkconnectivity.projects.locations.serviceConnectionMaps.testIamPermissions",
30042 http_method: hyper::Method::POST,
30043 });
30044
30045 for &field in ["alt", "resource"].iter() {
30046 if self._additional_params.contains_key(field) {
30047 dlg.finished(false);
30048 return Err(common::Error::FieldClash(field));
30049 }
30050 }
30051
30052 let mut params = Params::with_capacity(4 + self._additional_params.len());
30053 params.push("resource", self._resource);
30054
30055 params.extend(self._additional_params.iter());
30056
30057 params.push("alt", "json");
30058 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
30059 if self._scopes.is_empty() {
30060 self._scopes
30061 .insert(Scope::CloudPlatform.as_ref().to_string());
30062 }
30063
30064 #[allow(clippy::single_element_loop)]
30065 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
30066 url = params.uri_replacement(url, param_name, find_this, true);
30067 }
30068 {
30069 let to_remove = ["resource"];
30070 params.remove_params(&to_remove);
30071 }
30072
30073 let url = params.parse_with_url(&url);
30074
30075 let mut json_mime_type = mime::APPLICATION_JSON;
30076 let mut request_value_reader = {
30077 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30078 common::remove_json_null_values(&mut value);
30079 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30080 serde_json::to_writer(&mut dst, &value).unwrap();
30081 dst
30082 };
30083 let request_size = request_value_reader
30084 .seek(std::io::SeekFrom::End(0))
30085 .unwrap();
30086 request_value_reader
30087 .seek(std::io::SeekFrom::Start(0))
30088 .unwrap();
30089
30090 loop {
30091 let token = match self
30092 .hub
30093 .auth
30094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30095 .await
30096 {
30097 Ok(token) => token,
30098 Err(e) => match dlg.token(e) {
30099 Ok(token) => token,
30100 Err(e) => {
30101 dlg.finished(false);
30102 return Err(common::Error::MissingToken(e));
30103 }
30104 },
30105 };
30106 request_value_reader
30107 .seek(std::io::SeekFrom::Start(0))
30108 .unwrap();
30109 let mut req_result = {
30110 let client = &self.hub.client;
30111 dlg.pre_request();
30112 let mut req_builder = hyper::Request::builder()
30113 .method(hyper::Method::POST)
30114 .uri(url.as_str())
30115 .header(USER_AGENT, self.hub._user_agent.clone());
30116
30117 if let Some(token) = token.as_ref() {
30118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30119 }
30120
30121 let request = req_builder
30122 .header(CONTENT_TYPE, json_mime_type.to_string())
30123 .header(CONTENT_LENGTH, request_size as u64)
30124 .body(common::to_body(
30125 request_value_reader.get_ref().clone().into(),
30126 ));
30127
30128 client.request(request.unwrap()).await
30129 };
30130
30131 match req_result {
30132 Err(err) => {
30133 if let common::Retry::After(d) = dlg.http_error(&err) {
30134 sleep(d).await;
30135 continue;
30136 }
30137 dlg.finished(false);
30138 return Err(common::Error::HttpError(err));
30139 }
30140 Ok(res) => {
30141 let (mut parts, body) = res.into_parts();
30142 let mut body = common::Body::new(body);
30143 if !parts.status.is_success() {
30144 let bytes = common::to_bytes(body).await.unwrap_or_default();
30145 let error = serde_json::from_str(&common::to_string(&bytes));
30146 let response = common::to_response(parts, bytes.into());
30147
30148 if let common::Retry::After(d) =
30149 dlg.http_failure(&response, error.as_ref().ok())
30150 {
30151 sleep(d).await;
30152 continue;
30153 }
30154
30155 dlg.finished(false);
30156
30157 return Err(match error {
30158 Ok(value) => common::Error::BadRequest(value),
30159 _ => common::Error::Failure(response),
30160 });
30161 }
30162 let response = {
30163 let bytes = common::to_bytes(body).await.unwrap_or_default();
30164 let encoded = common::to_string(&bytes);
30165 match serde_json::from_str(&encoded) {
30166 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30167 Err(error) => {
30168 dlg.response_json_decode_error(&encoded, &error);
30169 return Err(common::Error::JsonDecodeError(
30170 encoded.to_string(),
30171 error,
30172 ));
30173 }
30174 }
30175 };
30176
30177 dlg.finished(true);
30178 return Ok(response);
30179 }
30180 }
30181 }
30182 }
30183
30184 ///
30185 /// Sets the *request* property to the given value.
30186 ///
30187 /// Even though the property as already been set when instantiating this call,
30188 /// we provide this method for API completeness.
30189 pub fn request(
30190 mut self,
30191 new_value: TestIamPermissionsRequest,
30192 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C> {
30193 self._request = new_value;
30194 self
30195 }
30196 /// 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.
30197 ///
30198 /// Sets the *resource* path property to the given value.
30199 ///
30200 /// Even though the property as already been set when instantiating this call,
30201 /// we provide this method for API completeness.
30202 pub fn resource(
30203 mut self,
30204 new_value: &str,
30205 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C> {
30206 self._resource = new_value.to_string();
30207 self
30208 }
30209 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30210 /// while executing the actual API request.
30211 ///
30212 /// ````text
30213 /// It should be used to handle progress information, and to implement a certain level of resilience.
30214 /// ````
30215 ///
30216 /// Sets the *delegate* property to the given value.
30217 pub fn delegate(
30218 mut self,
30219 new_value: &'a mut dyn common::Delegate,
30220 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C> {
30221 self._delegate = Some(new_value);
30222 self
30223 }
30224
30225 /// Set any additional parameter of the query string used in the request.
30226 /// It should be used to set parameters which are not yet available through their own
30227 /// setters.
30228 ///
30229 /// Please note that this method must not be used to set any of the known parameters
30230 /// which have their own setter method. If done anyway, the request will fail.
30231 ///
30232 /// # Additional Parameters
30233 ///
30234 /// * *$.xgafv* (query-string) - V1 error format.
30235 /// * *access_token* (query-string) - OAuth access token.
30236 /// * *alt* (query-string) - Data format for response.
30237 /// * *callback* (query-string) - JSONP
30238 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30239 /// * *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.
30240 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30241 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30242 /// * *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.
30243 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30244 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30245 pub fn param<T>(
30246 mut self,
30247 name: T,
30248 value: T,
30249 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C>
30250 where
30251 T: AsRef<str>,
30252 {
30253 self._additional_params
30254 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30255 self
30256 }
30257
30258 /// Identifies the authorization scope for the method you are building.
30259 ///
30260 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30261 /// [`Scope::CloudPlatform`].
30262 ///
30263 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30264 /// tokens for more than one scope.
30265 ///
30266 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30267 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30268 /// sufficient, a read-write scope will do as well.
30269 pub fn add_scope<St>(
30270 mut self,
30271 scope: St,
30272 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C>
30273 where
30274 St: AsRef<str>,
30275 {
30276 self._scopes.insert(String::from(scope.as_ref()));
30277 self
30278 }
30279 /// Identifies the authorization scope(s) for the method you are building.
30280 ///
30281 /// See [`Self::add_scope()`] for details.
30282 pub fn add_scopes<I, St>(
30283 mut self,
30284 scopes: I,
30285 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C>
30286 where
30287 I: IntoIterator<Item = St>,
30288 St: AsRef<str>,
30289 {
30290 self._scopes
30291 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30292 self
30293 }
30294
30295 /// Removes all scopes, and no default scope will be used either.
30296 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30297 /// for details).
30298 pub fn clear_scopes(
30299 mut self,
30300 ) -> ProjectLocationServiceConnectionMapTestIamPermissionCall<'a, C> {
30301 self._scopes.clear();
30302 self
30303 }
30304}
30305
30306/// Creates a new ServiceConnectionPolicy in a given project and location.
30307///
30308/// A builder for the *locations.serviceConnectionPolicies.create* method supported by a *project* resource.
30309/// It is not used directly, but through a [`ProjectMethods`] instance.
30310///
30311/// # Example
30312///
30313/// Instantiate a resource method builder
30314///
30315/// ```test_harness,no_run
30316/// # extern crate hyper;
30317/// # extern crate hyper_rustls;
30318/// # extern crate google_networkconnectivity1 as networkconnectivity1;
30319/// use networkconnectivity1::api::ServiceConnectionPolicy;
30320/// # async fn dox() {
30321/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30322///
30323/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30324/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30325/// # .with_native_roots()
30326/// # .unwrap()
30327/// # .https_only()
30328/// # .enable_http2()
30329/// # .build();
30330///
30331/// # let executor = hyper_util::rt::TokioExecutor::new();
30332/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30333/// # secret,
30334/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30335/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30336/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30337/// # ),
30338/// # ).build().await.unwrap();
30339///
30340/// # let client = hyper_util::client::legacy::Client::builder(
30341/// # hyper_util::rt::TokioExecutor::new()
30342/// # )
30343/// # .build(
30344/// # hyper_rustls::HttpsConnectorBuilder::new()
30345/// # .with_native_roots()
30346/// # .unwrap()
30347/// # .https_or_http()
30348/// # .enable_http2()
30349/// # .build()
30350/// # );
30351/// # let mut hub = Networkconnectivity::new(client, auth);
30352/// // As the method needs a request, you would usually fill it with the desired information
30353/// // into the respective structure. Some of the parts shown here might not be applicable !
30354/// // Values shown here are possibly random and not representative !
30355/// let mut req = ServiceConnectionPolicy::default();
30356///
30357/// // You can configure optional parameters by calling the respective setters at will, and
30358/// // execute the final call using `doit()`.
30359/// // Values shown here are possibly random and not representative !
30360/// let result = hub.projects().locations_service_connection_policies_create(req, "parent")
30361/// .subnetwork_mode("magna")
30362/// .service_connection_policy_id("et")
30363/// .request_id("rebum.")
30364/// .auto_subnetwork_config_prefix_length(-4)
30365/// .auto_subnetwork_config_ip_stack("Lorem")
30366/// .add_auto_subnetwork_config_alloc_range_space("justo")
30367/// .doit().await;
30368/// # }
30369/// ```
30370pub struct ProjectLocationServiceConnectionPolicyCreateCall<'a, C>
30371where
30372 C: 'a,
30373{
30374 hub: &'a Networkconnectivity<C>,
30375 _request: ServiceConnectionPolicy,
30376 _parent: String,
30377 _subnetwork_mode: Option<String>,
30378 _service_connection_policy_id: Option<String>,
30379 _request_id: Option<String>,
30380 _auto_subnetwork_config_prefix_length: Option<i32>,
30381 _auto_subnetwork_config_ip_stack: Option<String>,
30382 _auto_subnetwork_config_alloc_range_space: Vec<String>,
30383 _delegate: Option<&'a mut dyn common::Delegate>,
30384 _additional_params: HashMap<String, String>,
30385 _scopes: BTreeSet<String>,
30386}
30387
30388impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {}
30389
30390impl<'a, C> ProjectLocationServiceConnectionPolicyCreateCall<'a, C>
30391where
30392 C: common::Connector,
30393{
30394 /// Perform the operation you have build so far.
30395 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
30396 use std::borrow::Cow;
30397 use std::io::{Read, Seek};
30398
30399 use common::{url::Params, ToParts};
30400 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30401
30402 let mut dd = common::DefaultDelegate;
30403 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30404 dlg.begin(common::MethodInfo {
30405 id: "networkconnectivity.projects.locations.serviceConnectionPolicies.create",
30406 http_method: hyper::Method::POST,
30407 });
30408
30409 for &field in [
30410 "alt",
30411 "parent",
30412 "subnetworkMode",
30413 "serviceConnectionPolicyId",
30414 "requestId",
30415 "autoSubnetworkConfig.prefixLength",
30416 "autoSubnetworkConfig.ipStack",
30417 "autoSubnetworkConfig.allocRangeSpace",
30418 ]
30419 .iter()
30420 {
30421 if self._additional_params.contains_key(field) {
30422 dlg.finished(false);
30423 return Err(common::Error::FieldClash(field));
30424 }
30425 }
30426
30427 let mut params = Params::with_capacity(10 + self._additional_params.len());
30428 params.push("parent", self._parent);
30429 if let Some(value) = self._subnetwork_mode.as_ref() {
30430 params.push("subnetworkMode", value);
30431 }
30432 if let Some(value) = self._service_connection_policy_id.as_ref() {
30433 params.push("serviceConnectionPolicyId", value);
30434 }
30435 if let Some(value) = self._request_id.as_ref() {
30436 params.push("requestId", value);
30437 }
30438 if let Some(value) = self._auto_subnetwork_config_prefix_length.as_ref() {
30439 params.push("autoSubnetworkConfig.prefixLength", value.to_string());
30440 }
30441 if let Some(value) = self._auto_subnetwork_config_ip_stack.as_ref() {
30442 params.push("autoSubnetworkConfig.ipStack", value);
30443 }
30444 if !self._auto_subnetwork_config_alloc_range_space.is_empty() {
30445 for f in self._auto_subnetwork_config_alloc_range_space.iter() {
30446 params.push("autoSubnetworkConfig.allocRangeSpace", f);
30447 }
30448 }
30449
30450 params.extend(self._additional_params.iter());
30451
30452 params.push("alt", "json");
30453 let mut url = self.hub._base_url.clone() + "v1/{+parent}/serviceConnectionPolicies";
30454 if self._scopes.is_empty() {
30455 self._scopes
30456 .insert(Scope::CloudPlatform.as_ref().to_string());
30457 }
30458
30459 #[allow(clippy::single_element_loop)]
30460 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
30461 url = params.uri_replacement(url, param_name, find_this, true);
30462 }
30463 {
30464 let to_remove = ["parent"];
30465 params.remove_params(&to_remove);
30466 }
30467
30468 let url = params.parse_with_url(&url);
30469
30470 let mut json_mime_type = mime::APPLICATION_JSON;
30471 let mut request_value_reader = {
30472 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30473 common::remove_json_null_values(&mut value);
30474 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30475 serde_json::to_writer(&mut dst, &value).unwrap();
30476 dst
30477 };
30478 let request_size = request_value_reader
30479 .seek(std::io::SeekFrom::End(0))
30480 .unwrap();
30481 request_value_reader
30482 .seek(std::io::SeekFrom::Start(0))
30483 .unwrap();
30484
30485 loop {
30486 let token = match self
30487 .hub
30488 .auth
30489 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30490 .await
30491 {
30492 Ok(token) => token,
30493 Err(e) => match dlg.token(e) {
30494 Ok(token) => token,
30495 Err(e) => {
30496 dlg.finished(false);
30497 return Err(common::Error::MissingToken(e));
30498 }
30499 },
30500 };
30501 request_value_reader
30502 .seek(std::io::SeekFrom::Start(0))
30503 .unwrap();
30504 let mut req_result = {
30505 let client = &self.hub.client;
30506 dlg.pre_request();
30507 let mut req_builder = hyper::Request::builder()
30508 .method(hyper::Method::POST)
30509 .uri(url.as_str())
30510 .header(USER_AGENT, self.hub._user_agent.clone());
30511
30512 if let Some(token) = token.as_ref() {
30513 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30514 }
30515
30516 let request = req_builder
30517 .header(CONTENT_TYPE, json_mime_type.to_string())
30518 .header(CONTENT_LENGTH, request_size as u64)
30519 .body(common::to_body(
30520 request_value_reader.get_ref().clone().into(),
30521 ));
30522
30523 client.request(request.unwrap()).await
30524 };
30525
30526 match req_result {
30527 Err(err) => {
30528 if let common::Retry::After(d) = dlg.http_error(&err) {
30529 sleep(d).await;
30530 continue;
30531 }
30532 dlg.finished(false);
30533 return Err(common::Error::HttpError(err));
30534 }
30535 Ok(res) => {
30536 let (mut parts, body) = res.into_parts();
30537 let mut body = common::Body::new(body);
30538 if !parts.status.is_success() {
30539 let bytes = common::to_bytes(body).await.unwrap_or_default();
30540 let error = serde_json::from_str(&common::to_string(&bytes));
30541 let response = common::to_response(parts, bytes.into());
30542
30543 if let common::Retry::After(d) =
30544 dlg.http_failure(&response, error.as_ref().ok())
30545 {
30546 sleep(d).await;
30547 continue;
30548 }
30549
30550 dlg.finished(false);
30551
30552 return Err(match error {
30553 Ok(value) => common::Error::BadRequest(value),
30554 _ => common::Error::Failure(response),
30555 });
30556 }
30557 let response = {
30558 let bytes = common::to_bytes(body).await.unwrap_or_default();
30559 let encoded = common::to_string(&bytes);
30560 match serde_json::from_str(&encoded) {
30561 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30562 Err(error) => {
30563 dlg.response_json_decode_error(&encoded, &error);
30564 return Err(common::Error::JsonDecodeError(
30565 encoded.to_string(),
30566 error,
30567 ));
30568 }
30569 }
30570 };
30571
30572 dlg.finished(true);
30573 return Ok(response);
30574 }
30575 }
30576 }
30577 }
30578
30579 ///
30580 /// Sets the *request* property to the given value.
30581 ///
30582 /// Even though the property as already been set when instantiating this call,
30583 /// we provide this method for API completeness.
30584 pub fn request(
30585 mut self,
30586 new_value: ServiceConnectionPolicy,
30587 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30588 self._request = new_value;
30589 self
30590 }
30591 /// Required. The parent resource's name of the ServiceConnectionPolicy. ex. projects/123/locations/us-east1
30592 ///
30593 /// Sets the *parent* path property to the given value.
30594 ///
30595 /// Even though the property as already been set when instantiating this call,
30596 /// we provide this method for API completeness.
30597 pub fn parent(
30598 mut self,
30599 new_value: &str,
30600 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30601 self._parent = new_value.to_string();
30602 self
30603 }
30604 /// Optional. If this field is not set, USER_PROVIDED is the inferred value to use.
30605 ///
30606 /// Sets the *subnetwork mode* query property to the given value.
30607 pub fn subnetwork_mode(
30608 mut self,
30609 new_value: &str,
30610 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30611 self._subnetwork_mode = Some(new_value.to_string());
30612 self
30613 }
30614 /// Optional. Resource ID (i.e. 'foo' in '[...]/projects/p/locations/l/serviceConnectionPolicies/foo') See https://google.aip.dev/122#resource-id-segments Unique per location.
30615 ///
30616 /// Sets the *service connection policy id* query property to the given value.
30617 pub fn service_connection_policy_id(
30618 mut self,
30619 new_value: &str,
30620 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30621 self._service_connection_policy_id = Some(new_value.to_string());
30622 self
30623 }
30624 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
30625 ///
30626 /// Sets the *request id* query property to the given value.
30627 pub fn request_id(
30628 mut self,
30629 new_value: &str,
30630 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30631 self._request_id = Some(new_value.to_string());
30632 self
30633 }
30634 /// Optional. The desired prefix length for the subnet's IP address range. E.g., 24 for a /24. The actual range is allocated from available space. If not specified, 24 is used. Only eligible for IPV4_ONLY and IPV4_IPV6 subnetwork.
30635 ///
30636 /// Sets the *auto subnetwork config.prefix length* query property to the given value.
30637 pub fn auto_subnetwork_config_prefix_length(
30638 mut self,
30639 new_value: i32,
30640 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30641 self._auto_subnetwork_config_prefix_length = Some(new_value);
30642 self
30643 }
30644 /// Optional. The requested IP stack for the subnetwork. If not specified, IPv4 is used.
30645 ///
30646 /// Sets the *auto subnetwork config.ip stack* query property to the given value.
30647 pub fn auto_subnetwork_config_ip_stack(
30648 mut self,
30649 new_value: &str,
30650 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30651 self._auto_subnetwork_config_ip_stack = Some(new_value.to_string());
30652 self
30653 }
30654 /// Optional. The space where we search for a free range to create a subnetwork. It can be narrow down or pick a different space. This is in standard CIDR format. If not specified, “10.0.0.0/8” is used. Only eligible for IPV4_ONLY and IPV4_IPV6 subnetwork.
30655 ///
30656 /// Append the given value to the *auto subnetwork config.alloc range space* query property.
30657 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30658 pub fn add_auto_subnetwork_config_alloc_range_space(
30659 mut self,
30660 new_value: &str,
30661 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30662 self._auto_subnetwork_config_alloc_range_space
30663 .push(new_value.to_string());
30664 self
30665 }
30666 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30667 /// while executing the actual API request.
30668 ///
30669 /// ````text
30670 /// It should be used to handle progress information, and to implement a certain level of resilience.
30671 /// ````
30672 ///
30673 /// Sets the *delegate* property to the given value.
30674 pub fn delegate(
30675 mut self,
30676 new_value: &'a mut dyn common::Delegate,
30677 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30678 self._delegate = Some(new_value);
30679 self
30680 }
30681
30682 /// Set any additional parameter of the query string used in the request.
30683 /// It should be used to set parameters which are not yet available through their own
30684 /// setters.
30685 ///
30686 /// Please note that this method must not be used to set any of the known parameters
30687 /// which have their own setter method. If done anyway, the request will fail.
30688 ///
30689 /// # Additional Parameters
30690 ///
30691 /// * *$.xgafv* (query-string) - V1 error format.
30692 /// * *access_token* (query-string) - OAuth access token.
30693 /// * *alt* (query-string) - Data format for response.
30694 /// * *callback* (query-string) - JSONP
30695 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30696 /// * *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.
30697 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30698 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30699 /// * *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.
30700 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30701 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30702 pub fn param<T>(
30703 mut self,
30704 name: T,
30705 value: T,
30706 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C>
30707 where
30708 T: AsRef<str>,
30709 {
30710 self._additional_params
30711 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30712 self
30713 }
30714
30715 /// Identifies the authorization scope for the method you are building.
30716 ///
30717 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30718 /// [`Scope::CloudPlatform`].
30719 ///
30720 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30721 /// tokens for more than one scope.
30722 ///
30723 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30724 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30725 /// sufficient, a read-write scope will do as well.
30726 pub fn add_scope<St>(
30727 mut self,
30728 scope: St,
30729 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C>
30730 where
30731 St: AsRef<str>,
30732 {
30733 self._scopes.insert(String::from(scope.as_ref()));
30734 self
30735 }
30736 /// Identifies the authorization scope(s) for the method you are building.
30737 ///
30738 /// See [`Self::add_scope()`] for details.
30739 pub fn add_scopes<I, St>(
30740 mut self,
30741 scopes: I,
30742 ) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C>
30743 where
30744 I: IntoIterator<Item = St>,
30745 St: AsRef<str>,
30746 {
30747 self._scopes
30748 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30749 self
30750 }
30751
30752 /// Removes all scopes, and no default scope will be used either.
30753 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30754 /// for details).
30755 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionPolicyCreateCall<'a, C> {
30756 self._scopes.clear();
30757 self
30758 }
30759}
30760
30761/// Deletes a single ServiceConnectionPolicy.
30762///
30763/// A builder for the *locations.serviceConnectionPolicies.delete* method supported by a *project* resource.
30764/// It is not used directly, but through a [`ProjectMethods`] instance.
30765///
30766/// # Example
30767///
30768/// Instantiate a resource method builder
30769///
30770/// ```test_harness,no_run
30771/// # extern crate hyper;
30772/// # extern crate hyper_rustls;
30773/// # extern crate google_networkconnectivity1 as networkconnectivity1;
30774/// # async fn dox() {
30775/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30776///
30777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30778/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30779/// # .with_native_roots()
30780/// # .unwrap()
30781/// # .https_only()
30782/// # .enable_http2()
30783/// # .build();
30784///
30785/// # let executor = hyper_util::rt::TokioExecutor::new();
30786/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30787/// # secret,
30788/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30789/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30790/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30791/// # ),
30792/// # ).build().await.unwrap();
30793///
30794/// # let client = hyper_util::client::legacy::Client::builder(
30795/// # hyper_util::rt::TokioExecutor::new()
30796/// # )
30797/// # .build(
30798/// # hyper_rustls::HttpsConnectorBuilder::new()
30799/// # .with_native_roots()
30800/// # .unwrap()
30801/// # .https_or_http()
30802/// # .enable_http2()
30803/// # .build()
30804/// # );
30805/// # let mut hub = Networkconnectivity::new(client, auth);
30806/// // You can configure optional parameters by calling the respective setters at will, and
30807/// // execute the final call using `doit()`.
30808/// // Values shown here are possibly random and not representative !
30809/// let result = hub.projects().locations_service_connection_policies_delete("name")
30810/// .request_id("no")
30811/// .etag("nonumy")
30812/// .doit().await;
30813/// # }
30814/// ```
30815pub struct ProjectLocationServiceConnectionPolicyDeleteCall<'a, C>
30816where
30817 C: 'a,
30818{
30819 hub: &'a Networkconnectivity<C>,
30820 _name: String,
30821 _request_id: Option<String>,
30822 _etag: Option<String>,
30823 _delegate: Option<&'a mut dyn common::Delegate>,
30824 _additional_params: HashMap<String, String>,
30825 _scopes: BTreeSet<String>,
30826}
30827
30828impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionPolicyDeleteCall<'a, C> {}
30829
30830impl<'a, C> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C>
30831where
30832 C: common::Connector,
30833{
30834 /// Perform the operation you have build so far.
30835 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
30836 use std::borrow::Cow;
30837 use std::io::{Read, Seek};
30838
30839 use common::{url::Params, ToParts};
30840 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30841
30842 let mut dd = common::DefaultDelegate;
30843 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30844 dlg.begin(common::MethodInfo {
30845 id: "networkconnectivity.projects.locations.serviceConnectionPolicies.delete",
30846 http_method: hyper::Method::DELETE,
30847 });
30848
30849 for &field in ["alt", "name", "requestId", "etag"].iter() {
30850 if self._additional_params.contains_key(field) {
30851 dlg.finished(false);
30852 return Err(common::Error::FieldClash(field));
30853 }
30854 }
30855
30856 let mut params = Params::with_capacity(5 + self._additional_params.len());
30857 params.push("name", self._name);
30858 if let Some(value) = self._request_id.as_ref() {
30859 params.push("requestId", value);
30860 }
30861 if let Some(value) = self._etag.as_ref() {
30862 params.push("etag", value);
30863 }
30864
30865 params.extend(self._additional_params.iter());
30866
30867 params.push("alt", "json");
30868 let mut url = self.hub._base_url.clone() + "v1/{+name}";
30869 if self._scopes.is_empty() {
30870 self._scopes
30871 .insert(Scope::CloudPlatform.as_ref().to_string());
30872 }
30873
30874 #[allow(clippy::single_element_loop)]
30875 for &(find_this, param_name) in [("{+name}", "name")].iter() {
30876 url = params.uri_replacement(url, param_name, find_this, true);
30877 }
30878 {
30879 let to_remove = ["name"];
30880 params.remove_params(&to_remove);
30881 }
30882
30883 let url = params.parse_with_url(&url);
30884
30885 loop {
30886 let token = match self
30887 .hub
30888 .auth
30889 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30890 .await
30891 {
30892 Ok(token) => token,
30893 Err(e) => match dlg.token(e) {
30894 Ok(token) => token,
30895 Err(e) => {
30896 dlg.finished(false);
30897 return Err(common::Error::MissingToken(e));
30898 }
30899 },
30900 };
30901 let mut req_result = {
30902 let client = &self.hub.client;
30903 dlg.pre_request();
30904 let mut req_builder = hyper::Request::builder()
30905 .method(hyper::Method::DELETE)
30906 .uri(url.as_str())
30907 .header(USER_AGENT, self.hub._user_agent.clone());
30908
30909 if let Some(token) = token.as_ref() {
30910 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30911 }
30912
30913 let request = req_builder
30914 .header(CONTENT_LENGTH, 0_u64)
30915 .body(common::to_body::<String>(None));
30916
30917 client.request(request.unwrap()).await
30918 };
30919
30920 match req_result {
30921 Err(err) => {
30922 if let common::Retry::After(d) = dlg.http_error(&err) {
30923 sleep(d).await;
30924 continue;
30925 }
30926 dlg.finished(false);
30927 return Err(common::Error::HttpError(err));
30928 }
30929 Ok(res) => {
30930 let (mut parts, body) = res.into_parts();
30931 let mut body = common::Body::new(body);
30932 if !parts.status.is_success() {
30933 let bytes = common::to_bytes(body).await.unwrap_or_default();
30934 let error = serde_json::from_str(&common::to_string(&bytes));
30935 let response = common::to_response(parts, bytes.into());
30936
30937 if let common::Retry::After(d) =
30938 dlg.http_failure(&response, error.as_ref().ok())
30939 {
30940 sleep(d).await;
30941 continue;
30942 }
30943
30944 dlg.finished(false);
30945
30946 return Err(match error {
30947 Ok(value) => common::Error::BadRequest(value),
30948 _ => common::Error::Failure(response),
30949 });
30950 }
30951 let response = {
30952 let bytes = common::to_bytes(body).await.unwrap_or_default();
30953 let encoded = common::to_string(&bytes);
30954 match serde_json::from_str(&encoded) {
30955 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30956 Err(error) => {
30957 dlg.response_json_decode_error(&encoded, &error);
30958 return Err(common::Error::JsonDecodeError(
30959 encoded.to_string(),
30960 error,
30961 ));
30962 }
30963 }
30964 };
30965
30966 dlg.finished(true);
30967 return Ok(response);
30968 }
30969 }
30970 }
30971 }
30972
30973 /// Required. The name of the ServiceConnectionPolicy to delete.
30974 ///
30975 /// Sets the *name* path property to the given value.
30976 ///
30977 /// Even though the property as already been set when instantiating this call,
30978 /// we provide this method for API completeness.
30979 pub fn name(
30980 mut self,
30981 new_value: &str,
30982 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C> {
30983 self._name = new_value.to_string();
30984 self
30985 }
30986 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
30987 ///
30988 /// Sets the *request id* query property to the given value.
30989 pub fn request_id(
30990 mut self,
30991 new_value: &str,
30992 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C> {
30993 self._request_id = Some(new_value.to_string());
30994 self
30995 }
30996 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
30997 ///
30998 /// Sets the *etag* query property to the given value.
30999 pub fn etag(
31000 mut self,
31001 new_value: &str,
31002 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C> {
31003 self._etag = Some(new_value.to_string());
31004 self
31005 }
31006 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31007 /// while executing the actual API request.
31008 ///
31009 /// ````text
31010 /// It should be used to handle progress information, and to implement a certain level of resilience.
31011 /// ````
31012 ///
31013 /// Sets the *delegate* property to the given value.
31014 pub fn delegate(
31015 mut self,
31016 new_value: &'a mut dyn common::Delegate,
31017 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C> {
31018 self._delegate = Some(new_value);
31019 self
31020 }
31021
31022 /// Set any additional parameter of the query string used in the request.
31023 /// It should be used to set parameters which are not yet available through their own
31024 /// setters.
31025 ///
31026 /// Please note that this method must not be used to set any of the known parameters
31027 /// which have their own setter method. If done anyway, the request will fail.
31028 ///
31029 /// # Additional Parameters
31030 ///
31031 /// * *$.xgafv* (query-string) - V1 error format.
31032 /// * *access_token* (query-string) - OAuth access token.
31033 /// * *alt* (query-string) - Data format for response.
31034 /// * *callback* (query-string) - JSONP
31035 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31036 /// * *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.
31037 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31038 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31039 /// * *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.
31040 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31041 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31042 pub fn param<T>(
31043 mut self,
31044 name: T,
31045 value: T,
31046 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C>
31047 where
31048 T: AsRef<str>,
31049 {
31050 self._additional_params
31051 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31052 self
31053 }
31054
31055 /// Identifies the authorization scope for the method you are building.
31056 ///
31057 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31058 /// [`Scope::CloudPlatform`].
31059 ///
31060 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31061 /// tokens for more than one scope.
31062 ///
31063 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31064 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31065 /// sufficient, a read-write scope will do as well.
31066 pub fn add_scope<St>(
31067 mut self,
31068 scope: St,
31069 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C>
31070 where
31071 St: AsRef<str>,
31072 {
31073 self._scopes.insert(String::from(scope.as_ref()));
31074 self
31075 }
31076 /// Identifies the authorization scope(s) for the method you are building.
31077 ///
31078 /// See [`Self::add_scope()`] for details.
31079 pub fn add_scopes<I, St>(
31080 mut self,
31081 scopes: I,
31082 ) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C>
31083 where
31084 I: IntoIterator<Item = St>,
31085 St: AsRef<str>,
31086 {
31087 self._scopes
31088 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31089 self
31090 }
31091
31092 /// Removes all scopes, and no default scope will be used either.
31093 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31094 /// for details).
31095 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionPolicyDeleteCall<'a, C> {
31096 self._scopes.clear();
31097 self
31098 }
31099}
31100
31101/// Gets details of a single ServiceConnectionPolicy.
31102///
31103/// A builder for the *locations.serviceConnectionPolicies.get* method supported by a *project* resource.
31104/// It is not used directly, but through a [`ProjectMethods`] instance.
31105///
31106/// # Example
31107///
31108/// Instantiate a resource method builder
31109///
31110/// ```test_harness,no_run
31111/// # extern crate hyper;
31112/// # extern crate hyper_rustls;
31113/// # extern crate google_networkconnectivity1 as networkconnectivity1;
31114/// # async fn dox() {
31115/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31116///
31117/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31118/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31119/// # .with_native_roots()
31120/// # .unwrap()
31121/// # .https_only()
31122/// # .enable_http2()
31123/// # .build();
31124///
31125/// # let executor = hyper_util::rt::TokioExecutor::new();
31126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31127/// # secret,
31128/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31129/// # yup_oauth2::client::CustomHyperClientBuilder::from(
31130/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
31131/// # ),
31132/// # ).build().await.unwrap();
31133///
31134/// # let client = hyper_util::client::legacy::Client::builder(
31135/// # hyper_util::rt::TokioExecutor::new()
31136/// # )
31137/// # .build(
31138/// # hyper_rustls::HttpsConnectorBuilder::new()
31139/// # .with_native_roots()
31140/// # .unwrap()
31141/// # .https_or_http()
31142/// # .enable_http2()
31143/// # .build()
31144/// # );
31145/// # let mut hub = Networkconnectivity::new(client, auth);
31146/// // You can configure optional parameters by calling the respective setters at will, and
31147/// // execute the final call using `doit()`.
31148/// // Values shown here are possibly random and not representative !
31149/// let result = hub.projects().locations_service_connection_policies_get("name")
31150/// .doit().await;
31151/// # }
31152/// ```
31153pub struct ProjectLocationServiceConnectionPolicyGetCall<'a, C>
31154where
31155 C: 'a,
31156{
31157 hub: &'a Networkconnectivity<C>,
31158 _name: String,
31159 _delegate: Option<&'a mut dyn common::Delegate>,
31160 _additional_params: HashMap<String, String>,
31161 _scopes: BTreeSet<String>,
31162}
31163
31164impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionPolicyGetCall<'a, C> {}
31165
31166impl<'a, C> ProjectLocationServiceConnectionPolicyGetCall<'a, C>
31167where
31168 C: common::Connector,
31169{
31170 /// Perform the operation you have build so far.
31171 pub async fn doit(mut self) -> common::Result<(common::Response, ServiceConnectionPolicy)> {
31172 use std::borrow::Cow;
31173 use std::io::{Read, Seek};
31174
31175 use common::{url::Params, ToParts};
31176 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31177
31178 let mut dd = common::DefaultDelegate;
31179 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31180 dlg.begin(common::MethodInfo {
31181 id: "networkconnectivity.projects.locations.serviceConnectionPolicies.get",
31182 http_method: hyper::Method::GET,
31183 });
31184
31185 for &field in ["alt", "name"].iter() {
31186 if self._additional_params.contains_key(field) {
31187 dlg.finished(false);
31188 return Err(common::Error::FieldClash(field));
31189 }
31190 }
31191
31192 let mut params = Params::with_capacity(3 + self._additional_params.len());
31193 params.push("name", self._name);
31194
31195 params.extend(self._additional_params.iter());
31196
31197 params.push("alt", "json");
31198 let mut url = self.hub._base_url.clone() + "v1/{+name}";
31199 if self._scopes.is_empty() {
31200 self._scopes
31201 .insert(Scope::CloudPlatform.as_ref().to_string());
31202 }
31203
31204 #[allow(clippy::single_element_loop)]
31205 for &(find_this, param_name) in [("{+name}", "name")].iter() {
31206 url = params.uri_replacement(url, param_name, find_this, true);
31207 }
31208 {
31209 let to_remove = ["name"];
31210 params.remove_params(&to_remove);
31211 }
31212
31213 let url = params.parse_with_url(&url);
31214
31215 loop {
31216 let token = match self
31217 .hub
31218 .auth
31219 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31220 .await
31221 {
31222 Ok(token) => token,
31223 Err(e) => match dlg.token(e) {
31224 Ok(token) => token,
31225 Err(e) => {
31226 dlg.finished(false);
31227 return Err(common::Error::MissingToken(e));
31228 }
31229 },
31230 };
31231 let mut req_result = {
31232 let client = &self.hub.client;
31233 dlg.pre_request();
31234 let mut req_builder = hyper::Request::builder()
31235 .method(hyper::Method::GET)
31236 .uri(url.as_str())
31237 .header(USER_AGENT, self.hub._user_agent.clone());
31238
31239 if let Some(token) = token.as_ref() {
31240 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31241 }
31242
31243 let request = req_builder
31244 .header(CONTENT_LENGTH, 0_u64)
31245 .body(common::to_body::<String>(None));
31246
31247 client.request(request.unwrap()).await
31248 };
31249
31250 match req_result {
31251 Err(err) => {
31252 if let common::Retry::After(d) = dlg.http_error(&err) {
31253 sleep(d).await;
31254 continue;
31255 }
31256 dlg.finished(false);
31257 return Err(common::Error::HttpError(err));
31258 }
31259 Ok(res) => {
31260 let (mut parts, body) = res.into_parts();
31261 let mut body = common::Body::new(body);
31262 if !parts.status.is_success() {
31263 let bytes = common::to_bytes(body).await.unwrap_or_default();
31264 let error = serde_json::from_str(&common::to_string(&bytes));
31265 let response = common::to_response(parts, bytes.into());
31266
31267 if let common::Retry::After(d) =
31268 dlg.http_failure(&response, error.as_ref().ok())
31269 {
31270 sleep(d).await;
31271 continue;
31272 }
31273
31274 dlg.finished(false);
31275
31276 return Err(match error {
31277 Ok(value) => common::Error::BadRequest(value),
31278 _ => common::Error::Failure(response),
31279 });
31280 }
31281 let response = {
31282 let bytes = common::to_bytes(body).await.unwrap_or_default();
31283 let encoded = common::to_string(&bytes);
31284 match serde_json::from_str(&encoded) {
31285 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31286 Err(error) => {
31287 dlg.response_json_decode_error(&encoded, &error);
31288 return Err(common::Error::JsonDecodeError(
31289 encoded.to_string(),
31290 error,
31291 ));
31292 }
31293 }
31294 };
31295
31296 dlg.finished(true);
31297 return Ok(response);
31298 }
31299 }
31300 }
31301 }
31302
31303 /// Required. Name of the ServiceConnectionPolicy to get.
31304 ///
31305 /// Sets the *name* path property to the given value.
31306 ///
31307 /// Even though the property as already been set when instantiating this call,
31308 /// we provide this method for API completeness.
31309 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceConnectionPolicyGetCall<'a, C> {
31310 self._name = new_value.to_string();
31311 self
31312 }
31313 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31314 /// while executing the actual API request.
31315 ///
31316 /// ````text
31317 /// It should be used to handle progress information, and to implement a certain level of resilience.
31318 /// ````
31319 ///
31320 /// Sets the *delegate* property to the given value.
31321 pub fn delegate(
31322 mut self,
31323 new_value: &'a mut dyn common::Delegate,
31324 ) -> ProjectLocationServiceConnectionPolicyGetCall<'a, C> {
31325 self._delegate = Some(new_value);
31326 self
31327 }
31328
31329 /// Set any additional parameter of the query string used in the request.
31330 /// It should be used to set parameters which are not yet available through their own
31331 /// setters.
31332 ///
31333 /// Please note that this method must not be used to set any of the known parameters
31334 /// which have their own setter method. If done anyway, the request will fail.
31335 ///
31336 /// # Additional Parameters
31337 ///
31338 /// * *$.xgafv* (query-string) - V1 error format.
31339 /// * *access_token* (query-string) - OAuth access token.
31340 /// * *alt* (query-string) - Data format for response.
31341 /// * *callback* (query-string) - JSONP
31342 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31343 /// * *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.
31344 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31345 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31346 /// * *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.
31347 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31348 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31349 pub fn param<T>(
31350 mut self,
31351 name: T,
31352 value: T,
31353 ) -> ProjectLocationServiceConnectionPolicyGetCall<'a, C>
31354 where
31355 T: AsRef<str>,
31356 {
31357 self._additional_params
31358 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31359 self
31360 }
31361
31362 /// Identifies the authorization scope for the method you are building.
31363 ///
31364 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31365 /// [`Scope::CloudPlatform`].
31366 ///
31367 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31368 /// tokens for more than one scope.
31369 ///
31370 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31371 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31372 /// sufficient, a read-write scope will do as well.
31373 pub fn add_scope<St>(
31374 mut self,
31375 scope: St,
31376 ) -> ProjectLocationServiceConnectionPolicyGetCall<'a, C>
31377 where
31378 St: AsRef<str>,
31379 {
31380 self._scopes.insert(String::from(scope.as_ref()));
31381 self
31382 }
31383 /// Identifies the authorization scope(s) for the method you are building.
31384 ///
31385 /// See [`Self::add_scope()`] for details.
31386 pub fn add_scopes<I, St>(
31387 mut self,
31388 scopes: I,
31389 ) -> ProjectLocationServiceConnectionPolicyGetCall<'a, C>
31390 where
31391 I: IntoIterator<Item = St>,
31392 St: AsRef<str>,
31393 {
31394 self._scopes
31395 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31396 self
31397 }
31398
31399 /// Removes all scopes, and no default scope will be used either.
31400 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31401 /// for details).
31402 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionPolicyGetCall<'a, C> {
31403 self._scopes.clear();
31404 self
31405 }
31406}
31407
31408/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
31409///
31410/// A builder for the *locations.serviceConnectionPolicies.getIamPolicy* method supported by a *project* resource.
31411/// It is not used directly, but through a [`ProjectMethods`] instance.
31412///
31413/// # Example
31414///
31415/// Instantiate a resource method builder
31416///
31417/// ```test_harness,no_run
31418/// # extern crate hyper;
31419/// # extern crate hyper_rustls;
31420/// # extern crate google_networkconnectivity1 as networkconnectivity1;
31421/// # async fn dox() {
31422/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31423///
31424/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31425/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31426/// # .with_native_roots()
31427/// # .unwrap()
31428/// # .https_only()
31429/// # .enable_http2()
31430/// # .build();
31431///
31432/// # let executor = hyper_util::rt::TokioExecutor::new();
31433/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31434/// # secret,
31435/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31436/// # yup_oauth2::client::CustomHyperClientBuilder::from(
31437/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
31438/// # ),
31439/// # ).build().await.unwrap();
31440///
31441/// # let client = hyper_util::client::legacy::Client::builder(
31442/// # hyper_util::rt::TokioExecutor::new()
31443/// # )
31444/// # .build(
31445/// # hyper_rustls::HttpsConnectorBuilder::new()
31446/// # .with_native_roots()
31447/// # .unwrap()
31448/// # .https_or_http()
31449/// # .enable_http2()
31450/// # .build()
31451/// # );
31452/// # let mut hub = Networkconnectivity::new(client, auth);
31453/// // You can configure optional parameters by calling the respective setters at will, and
31454/// // execute the final call using `doit()`.
31455/// // Values shown here are possibly random and not representative !
31456/// let result = hub.projects().locations_service_connection_policies_get_iam_policy("resource")
31457/// .options_requested_policy_version(-101)
31458/// .doit().await;
31459/// # }
31460/// ```
31461pub struct ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C>
31462where
31463 C: 'a,
31464{
31465 hub: &'a Networkconnectivity<C>,
31466 _resource: String,
31467 _options_requested_policy_version: Option<i32>,
31468 _delegate: Option<&'a mut dyn common::Delegate>,
31469 _additional_params: HashMap<String, String>,
31470 _scopes: BTreeSet<String>,
31471}
31472
31473impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C> {}
31474
31475impl<'a, C> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C>
31476where
31477 C: common::Connector,
31478{
31479 /// Perform the operation you have build so far.
31480 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
31481 use std::borrow::Cow;
31482 use std::io::{Read, Seek};
31483
31484 use common::{url::Params, ToParts};
31485 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31486
31487 let mut dd = common::DefaultDelegate;
31488 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31489 dlg.begin(common::MethodInfo {
31490 id: "networkconnectivity.projects.locations.serviceConnectionPolicies.getIamPolicy",
31491 http_method: hyper::Method::GET,
31492 });
31493
31494 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
31495 if self._additional_params.contains_key(field) {
31496 dlg.finished(false);
31497 return Err(common::Error::FieldClash(field));
31498 }
31499 }
31500
31501 let mut params = Params::with_capacity(4 + self._additional_params.len());
31502 params.push("resource", self._resource);
31503 if let Some(value) = self._options_requested_policy_version.as_ref() {
31504 params.push("options.requestedPolicyVersion", value.to_string());
31505 }
31506
31507 params.extend(self._additional_params.iter());
31508
31509 params.push("alt", "json");
31510 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
31511 if self._scopes.is_empty() {
31512 self._scopes
31513 .insert(Scope::CloudPlatform.as_ref().to_string());
31514 }
31515
31516 #[allow(clippy::single_element_loop)]
31517 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
31518 url = params.uri_replacement(url, param_name, find_this, true);
31519 }
31520 {
31521 let to_remove = ["resource"];
31522 params.remove_params(&to_remove);
31523 }
31524
31525 let url = params.parse_with_url(&url);
31526
31527 loop {
31528 let token = match self
31529 .hub
31530 .auth
31531 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31532 .await
31533 {
31534 Ok(token) => token,
31535 Err(e) => match dlg.token(e) {
31536 Ok(token) => token,
31537 Err(e) => {
31538 dlg.finished(false);
31539 return Err(common::Error::MissingToken(e));
31540 }
31541 },
31542 };
31543 let mut req_result = {
31544 let client = &self.hub.client;
31545 dlg.pre_request();
31546 let mut req_builder = hyper::Request::builder()
31547 .method(hyper::Method::GET)
31548 .uri(url.as_str())
31549 .header(USER_AGENT, self.hub._user_agent.clone());
31550
31551 if let Some(token) = token.as_ref() {
31552 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31553 }
31554
31555 let request = req_builder
31556 .header(CONTENT_LENGTH, 0_u64)
31557 .body(common::to_body::<String>(None));
31558
31559 client.request(request.unwrap()).await
31560 };
31561
31562 match req_result {
31563 Err(err) => {
31564 if let common::Retry::After(d) = dlg.http_error(&err) {
31565 sleep(d).await;
31566 continue;
31567 }
31568 dlg.finished(false);
31569 return Err(common::Error::HttpError(err));
31570 }
31571 Ok(res) => {
31572 let (mut parts, body) = res.into_parts();
31573 let mut body = common::Body::new(body);
31574 if !parts.status.is_success() {
31575 let bytes = common::to_bytes(body).await.unwrap_or_default();
31576 let error = serde_json::from_str(&common::to_string(&bytes));
31577 let response = common::to_response(parts, bytes.into());
31578
31579 if let common::Retry::After(d) =
31580 dlg.http_failure(&response, error.as_ref().ok())
31581 {
31582 sleep(d).await;
31583 continue;
31584 }
31585
31586 dlg.finished(false);
31587
31588 return Err(match error {
31589 Ok(value) => common::Error::BadRequest(value),
31590 _ => common::Error::Failure(response),
31591 });
31592 }
31593 let response = {
31594 let bytes = common::to_bytes(body).await.unwrap_or_default();
31595 let encoded = common::to_string(&bytes);
31596 match serde_json::from_str(&encoded) {
31597 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31598 Err(error) => {
31599 dlg.response_json_decode_error(&encoded, &error);
31600 return Err(common::Error::JsonDecodeError(
31601 encoded.to_string(),
31602 error,
31603 ));
31604 }
31605 }
31606 };
31607
31608 dlg.finished(true);
31609 return Ok(response);
31610 }
31611 }
31612 }
31613 }
31614
31615 /// 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.
31616 ///
31617 /// Sets the *resource* path property to the given value.
31618 ///
31619 /// Even though the property as already been set when instantiating this call,
31620 /// we provide this method for API completeness.
31621 pub fn resource(
31622 mut self,
31623 new_value: &str,
31624 ) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C> {
31625 self._resource = new_value.to_string();
31626 self
31627 }
31628 /// 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).
31629 ///
31630 /// Sets the *options.requested policy version* query property to the given value.
31631 pub fn options_requested_policy_version(
31632 mut self,
31633 new_value: i32,
31634 ) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C> {
31635 self._options_requested_policy_version = Some(new_value);
31636 self
31637 }
31638 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31639 /// while executing the actual API request.
31640 ///
31641 /// ````text
31642 /// It should be used to handle progress information, and to implement a certain level of resilience.
31643 /// ````
31644 ///
31645 /// Sets the *delegate* property to the given value.
31646 pub fn delegate(
31647 mut self,
31648 new_value: &'a mut dyn common::Delegate,
31649 ) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C> {
31650 self._delegate = Some(new_value);
31651 self
31652 }
31653
31654 /// Set any additional parameter of the query string used in the request.
31655 /// It should be used to set parameters which are not yet available through their own
31656 /// setters.
31657 ///
31658 /// Please note that this method must not be used to set any of the known parameters
31659 /// which have their own setter method. If done anyway, the request will fail.
31660 ///
31661 /// # Additional Parameters
31662 ///
31663 /// * *$.xgafv* (query-string) - V1 error format.
31664 /// * *access_token* (query-string) - OAuth access token.
31665 /// * *alt* (query-string) - Data format for response.
31666 /// * *callback* (query-string) - JSONP
31667 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31668 /// * *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.
31669 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31670 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31671 /// * *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.
31672 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31673 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31674 pub fn param<T>(
31675 mut self,
31676 name: T,
31677 value: T,
31678 ) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C>
31679 where
31680 T: AsRef<str>,
31681 {
31682 self._additional_params
31683 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31684 self
31685 }
31686
31687 /// Identifies the authorization scope for the method you are building.
31688 ///
31689 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31690 /// [`Scope::CloudPlatform`].
31691 ///
31692 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31693 /// tokens for more than one scope.
31694 ///
31695 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31696 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31697 /// sufficient, a read-write scope will do as well.
31698 pub fn add_scope<St>(
31699 mut self,
31700 scope: St,
31701 ) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C>
31702 where
31703 St: AsRef<str>,
31704 {
31705 self._scopes.insert(String::from(scope.as_ref()));
31706 self
31707 }
31708 /// Identifies the authorization scope(s) for the method you are building.
31709 ///
31710 /// See [`Self::add_scope()`] for details.
31711 pub fn add_scopes<I, St>(
31712 mut self,
31713 scopes: I,
31714 ) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C>
31715 where
31716 I: IntoIterator<Item = St>,
31717 St: AsRef<str>,
31718 {
31719 self._scopes
31720 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31721 self
31722 }
31723
31724 /// Removes all scopes, and no default scope will be used either.
31725 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31726 /// for details).
31727 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionPolicyGetIamPolicyCall<'a, C> {
31728 self._scopes.clear();
31729 self
31730 }
31731}
31732
31733/// Lists ServiceConnectionPolicies in a given project and location.
31734///
31735/// A builder for the *locations.serviceConnectionPolicies.list* method supported by a *project* resource.
31736/// It is not used directly, but through a [`ProjectMethods`] instance.
31737///
31738/// # Example
31739///
31740/// Instantiate a resource method builder
31741///
31742/// ```test_harness,no_run
31743/// # extern crate hyper;
31744/// # extern crate hyper_rustls;
31745/// # extern crate google_networkconnectivity1 as networkconnectivity1;
31746/// # async fn dox() {
31747/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31748///
31749/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31750/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31751/// # .with_native_roots()
31752/// # .unwrap()
31753/// # .https_only()
31754/// # .enable_http2()
31755/// # .build();
31756///
31757/// # let executor = hyper_util::rt::TokioExecutor::new();
31758/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31759/// # secret,
31760/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31761/// # yup_oauth2::client::CustomHyperClientBuilder::from(
31762/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
31763/// # ),
31764/// # ).build().await.unwrap();
31765///
31766/// # let client = hyper_util::client::legacy::Client::builder(
31767/// # hyper_util::rt::TokioExecutor::new()
31768/// # )
31769/// # .build(
31770/// # hyper_rustls::HttpsConnectorBuilder::new()
31771/// # .with_native_roots()
31772/// # .unwrap()
31773/// # .https_or_http()
31774/// # .enable_http2()
31775/// # .build()
31776/// # );
31777/// # let mut hub = Networkconnectivity::new(client, auth);
31778/// // You can configure optional parameters by calling the respective setters at will, and
31779/// // execute the final call using `doit()`.
31780/// // Values shown here are possibly random and not representative !
31781/// let result = hub.projects().locations_service_connection_policies_list("parent")
31782/// .page_token("nonumy")
31783/// .page_size(-66)
31784/// .order_by("tempor")
31785/// .filter("dolore")
31786/// .doit().await;
31787/// # }
31788/// ```
31789pub struct ProjectLocationServiceConnectionPolicyListCall<'a, C>
31790where
31791 C: 'a,
31792{
31793 hub: &'a Networkconnectivity<C>,
31794 _parent: String,
31795 _page_token: Option<String>,
31796 _page_size: Option<i32>,
31797 _order_by: Option<String>,
31798 _filter: Option<String>,
31799 _delegate: Option<&'a mut dyn common::Delegate>,
31800 _additional_params: HashMap<String, String>,
31801 _scopes: BTreeSet<String>,
31802}
31803
31804impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionPolicyListCall<'a, C> {}
31805
31806impl<'a, C> ProjectLocationServiceConnectionPolicyListCall<'a, C>
31807where
31808 C: common::Connector,
31809{
31810 /// Perform the operation you have build so far.
31811 pub async fn doit(
31812 mut self,
31813 ) -> common::Result<(common::Response, ListServiceConnectionPoliciesResponse)> {
31814 use std::borrow::Cow;
31815 use std::io::{Read, Seek};
31816
31817 use common::{url::Params, ToParts};
31818 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31819
31820 let mut dd = common::DefaultDelegate;
31821 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31822 dlg.begin(common::MethodInfo {
31823 id: "networkconnectivity.projects.locations.serviceConnectionPolicies.list",
31824 http_method: hyper::Method::GET,
31825 });
31826
31827 for &field in [
31828 "alt",
31829 "parent",
31830 "pageToken",
31831 "pageSize",
31832 "orderBy",
31833 "filter",
31834 ]
31835 .iter()
31836 {
31837 if self._additional_params.contains_key(field) {
31838 dlg.finished(false);
31839 return Err(common::Error::FieldClash(field));
31840 }
31841 }
31842
31843 let mut params = Params::with_capacity(7 + self._additional_params.len());
31844 params.push("parent", self._parent);
31845 if let Some(value) = self._page_token.as_ref() {
31846 params.push("pageToken", value);
31847 }
31848 if let Some(value) = self._page_size.as_ref() {
31849 params.push("pageSize", value.to_string());
31850 }
31851 if let Some(value) = self._order_by.as_ref() {
31852 params.push("orderBy", value);
31853 }
31854 if let Some(value) = self._filter.as_ref() {
31855 params.push("filter", value);
31856 }
31857
31858 params.extend(self._additional_params.iter());
31859
31860 params.push("alt", "json");
31861 let mut url = self.hub._base_url.clone() + "v1/{+parent}/serviceConnectionPolicies";
31862 if self._scopes.is_empty() {
31863 self._scopes
31864 .insert(Scope::CloudPlatform.as_ref().to_string());
31865 }
31866
31867 #[allow(clippy::single_element_loop)]
31868 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
31869 url = params.uri_replacement(url, param_name, find_this, true);
31870 }
31871 {
31872 let to_remove = ["parent"];
31873 params.remove_params(&to_remove);
31874 }
31875
31876 let url = params.parse_with_url(&url);
31877
31878 loop {
31879 let token = match self
31880 .hub
31881 .auth
31882 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31883 .await
31884 {
31885 Ok(token) => token,
31886 Err(e) => match dlg.token(e) {
31887 Ok(token) => token,
31888 Err(e) => {
31889 dlg.finished(false);
31890 return Err(common::Error::MissingToken(e));
31891 }
31892 },
31893 };
31894 let mut req_result = {
31895 let client = &self.hub.client;
31896 dlg.pre_request();
31897 let mut req_builder = hyper::Request::builder()
31898 .method(hyper::Method::GET)
31899 .uri(url.as_str())
31900 .header(USER_AGENT, self.hub._user_agent.clone());
31901
31902 if let Some(token) = token.as_ref() {
31903 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31904 }
31905
31906 let request = req_builder
31907 .header(CONTENT_LENGTH, 0_u64)
31908 .body(common::to_body::<String>(None));
31909
31910 client.request(request.unwrap()).await
31911 };
31912
31913 match req_result {
31914 Err(err) => {
31915 if let common::Retry::After(d) = dlg.http_error(&err) {
31916 sleep(d).await;
31917 continue;
31918 }
31919 dlg.finished(false);
31920 return Err(common::Error::HttpError(err));
31921 }
31922 Ok(res) => {
31923 let (mut parts, body) = res.into_parts();
31924 let mut body = common::Body::new(body);
31925 if !parts.status.is_success() {
31926 let bytes = common::to_bytes(body).await.unwrap_or_default();
31927 let error = serde_json::from_str(&common::to_string(&bytes));
31928 let response = common::to_response(parts, bytes.into());
31929
31930 if let common::Retry::After(d) =
31931 dlg.http_failure(&response, error.as_ref().ok())
31932 {
31933 sleep(d).await;
31934 continue;
31935 }
31936
31937 dlg.finished(false);
31938
31939 return Err(match error {
31940 Ok(value) => common::Error::BadRequest(value),
31941 _ => common::Error::Failure(response),
31942 });
31943 }
31944 let response = {
31945 let bytes = common::to_bytes(body).await.unwrap_or_default();
31946 let encoded = common::to_string(&bytes);
31947 match serde_json::from_str(&encoded) {
31948 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31949 Err(error) => {
31950 dlg.response_json_decode_error(&encoded, &error);
31951 return Err(common::Error::JsonDecodeError(
31952 encoded.to_string(),
31953 error,
31954 ));
31955 }
31956 }
31957 };
31958
31959 dlg.finished(true);
31960 return Ok(response);
31961 }
31962 }
31963 }
31964 }
31965
31966 /// Required. The parent resource's name. ex. projects/123/locations/us-east1
31967 ///
31968 /// Sets the *parent* path property to the given value.
31969 ///
31970 /// Even though the property as already been set when instantiating this call,
31971 /// we provide this method for API completeness.
31972 pub fn parent(
31973 mut self,
31974 new_value: &str,
31975 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
31976 self._parent = new_value.to_string();
31977 self
31978 }
31979 /// The page token.
31980 ///
31981 /// Sets the *page token* query property to the given value.
31982 pub fn page_token(
31983 mut self,
31984 new_value: &str,
31985 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
31986 self._page_token = Some(new_value.to_string());
31987 self
31988 }
31989 /// The maximum number of results per page that should be returned.
31990 ///
31991 /// Sets the *page size* query property to the given value.
31992 pub fn page_size(
31993 mut self,
31994 new_value: i32,
31995 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
31996 self._page_size = Some(new_value);
31997 self
31998 }
31999 /// Sort the results by a certain order.
32000 ///
32001 /// Sets the *order by* query property to the given value.
32002 pub fn order_by(
32003 mut self,
32004 new_value: &str,
32005 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
32006 self._order_by = Some(new_value.to_string());
32007 self
32008 }
32009 /// A filter expression that filters the results listed in the response.
32010 ///
32011 /// Sets the *filter* query property to the given value.
32012 pub fn filter(
32013 mut self,
32014 new_value: &str,
32015 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
32016 self._filter = Some(new_value.to_string());
32017 self
32018 }
32019 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32020 /// while executing the actual API request.
32021 ///
32022 /// ````text
32023 /// It should be used to handle progress information, and to implement a certain level of resilience.
32024 /// ````
32025 ///
32026 /// Sets the *delegate* property to the given value.
32027 pub fn delegate(
32028 mut self,
32029 new_value: &'a mut dyn common::Delegate,
32030 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
32031 self._delegate = Some(new_value);
32032 self
32033 }
32034
32035 /// Set any additional parameter of the query string used in the request.
32036 /// It should be used to set parameters which are not yet available through their own
32037 /// setters.
32038 ///
32039 /// Please note that this method must not be used to set any of the known parameters
32040 /// which have their own setter method. If done anyway, the request will fail.
32041 ///
32042 /// # Additional Parameters
32043 ///
32044 /// * *$.xgafv* (query-string) - V1 error format.
32045 /// * *access_token* (query-string) - OAuth access token.
32046 /// * *alt* (query-string) - Data format for response.
32047 /// * *callback* (query-string) - JSONP
32048 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32049 /// * *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.
32050 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32051 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32052 /// * *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.
32053 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32054 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32055 pub fn param<T>(
32056 mut self,
32057 name: T,
32058 value: T,
32059 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C>
32060 where
32061 T: AsRef<str>,
32062 {
32063 self._additional_params
32064 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32065 self
32066 }
32067
32068 /// Identifies the authorization scope for the method you are building.
32069 ///
32070 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32071 /// [`Scope::CloudPlatform`].
32072 ///
32073 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32074 /// tokens for more than one scope.
32075 ///
32076 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32077 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32078 /// sufficient, a read-write scope will do as well.
32079 pub fn add_scope<St>(
32080 mut self,
32081 scope: St,
32082 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C>
32083 where
32084 St: AsRef<str>,
32085 {
32086 self._scopes.insert(String::from(scope.as_ref()));
32087 self
32088 }
32089 /// Identifies the authorization scope(s) for the method you are building.
32090 ///
32091 /// See [`Self::add_scope()`] for details.
32092 pub fn add_scopes<I, St>(
32093 mut self,
32094 scopes: I,
32095 ) -> ProjectLocationServiceConnectionPolicyListCall<'a, C>
32096 where
32097 I: IntoIterator<Item = St>,
32098 St: AsRef<str>,
32099 {
32100 self._scopes
32101 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32102 self
32103 }
32104
32105 /// Removes all scopes, and no default scope will be used either.
32106 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32107 /// for details).
32108 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionPolicyListCall<'a, C> {
32109 self._scopes.clear();
32110 self
32111 }
32112}
32113
32114/// Updates the parameters of a single ServiceConnectionPolicy.
32115///
32116/// A builder for the *locations.serviceConnectionPolicies.patch* method supported by a *project* resource.
32117/// It is not used directly, but through a [`ProjectMethods`] instance.
32118///
32119/// # Example
32120///
32121/// Instantiate a resource method builder
32122///
32123/// ```test_harness,no_run
32124/// # extern crate hyper;
32125/// # extern crate hyper_rustls;
32126/// # extern crate google_networkconnectivity1 as networkconnectivity1;
32127/// use networkconnectivity1::api::ServiceConnectionPolicy;
32128/// # async fn dox() {
32129/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32130///
32131/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32132/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32133/// # .with_native_roots()
32134/// # .unwrap()
32135/// # .https_only()
32136/// # .enable_http2()
32137/// # .build();
32138///
32139/// # let executor = hyper_util::rt::TokioExecutor::new();
32140/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32141/// # secret,
32142/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32143/// # yup_oauth2::client::CustomHyperClientBuilder::from(
32144/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
32145/// # ),
32146/// # ).build().await.unwrap();
32147///
32148/// # let client = hyper_util::client::legacy::Client::builder(
32149/// # hyper_util::rt::TokioExecutor::new()
32150/// # )
32151/// # .build(
32152/// # hyper_rustls::HttpsConnectorBuilder::new()
32153/// # .with_native_roots()
32154/// # .unwrap()
32155/// # .https_or_http()
32156/// # .enable_http2()
32157/// # .build()
32158/// # );
32159/// # let mut hub = Networkconnectivity::new(client, auth);
32160/// // As the method needs a request, you would usually fill it with the desired information
32161/// // into the respective structure. Some of the parts shown here might not be applicable !
32162/// // Values shown here are possibly random and not representative !
32163/// let mut req = ServiceConnectionPolicy::default();
32164///
32165/// // You can configure optional parameters by calling the respective setters at will, and
32166/// // execute the final call using `doit()`.
32167/// // Values shown here are possibly random and not representative !
32168/// let result = hub.projects().locations_service_connection_policies_patch(req, "name")
32169/// .update_mask(FieldMask::new::<&str>(&[]))
32170/// .request_id("amet.")
32171/// .doit().await;
32172/// # }
32173/// ```
32174pub struct ProjectLocationServiceConnectionPolicyPatchCall<'a, C>
32175where
32176 C: 'a,
32177{
32178 hub: &'a Networkconnectivity<C>,
32179 _request: ServiceConnectionPolicy,
32180 _name: String,
32181 _update_mask: Option<common::FieldMask>,
32182 _request_id: Option<String>,
32183 _delegate: Option<&'a mut dyn common::Delegate>,
32184 _additional_params: HashMap<String, String>,
32185 _scopes: BTreeSet<String>,
32186}
32187
32188impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {}
32189
32190impl<'a, C> ProjectLocationServiceConnectionPolicyPatchCall<'a, C>
32191where
32192 C: common::Connector,
32193{
32194 /// Perform the operation you have build so far.
32195 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
32196 use std::borrow::Cow;
32197 use std::io::{Read, Seek};
32198
32199 use common::{url::Params, ToParts};
32200 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32201
32202 let mut dd = common::DefaultDelegate;
32203 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32204 dlg.begin(common::MethodInfo {
32205 id: "networkconnectivity.projects.locations.serviceConnectionPolicies.patch",
32206 http_method: hyper::Method::PATCH,
32207 });
32208
32209 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
32210 if self._additional_params.contains_key(field) {
32211 dlg.finished(false);
32212 return Err(common::Error::FieldClash(field));
32213 }
32214 }
32215
32216 let mut params = Params::with_capacity(6 + self._additional_params.len());
32217 params.push("name", self._name);
32218 if let Some(value) = self._update_mask.as_ref() {
32219 params.push("updateMask", value.to_string());
32220 }
32221 if let Some(value) = self._request_id.as_ref() {
32222 params.push("requestId", value);
32223 }
32224
32225 params.extend(self._additional_params.iter());
32226
32227 params.push("alt", "json");
32228 let mut url = self.hub._base_url.clone() + "v1/{+name}";
32229 if self._scopes.is_empty() {
32230 self._scopes
32231 .insert(Scope::CloudPlatform.as_ref().to_string());
32232 }
32233
32234 #[allow(clippy::single_element_loop)]
32235 for &(find_this, param_name) in [("{+name}", "name")].iter() {
32236 url = params.uri_replacement(url, param_name, find_this, true);
32237 }
32238 {
32239 let to_remove = ["name"];
32240 params.remove_params(&to_remove);
32241 }
32242
32243 let url = params.parse_with_url(&url);
32244
32245 let mut json_mime_type = mime::APPLICATION_JSON;
32246 let mut request_value_reader = {
32247 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32248 common::remove_json_null_values(&mut value);
32249 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32250 serde_json::to_writer(&mut dst, &value).unwrap();
32251 dst
32252 };
32253 let request_size = request_value_reader
32254 .seek(std::io::SeekFrom::End(0))
32255 .unwrap();
32256 request_value_reader
32257 .seek(std::io::SeekFrom::Start(0))
32258 .unwrap();
32259
32260 loop {
32261 let token = match self
32262 .hub
32263 .auth
32264 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32265 .await
32266 {
32267 Ok(token) => token,
32268 Err(e) => match dlg.token(e) {
32269 Ok(token) => token,
32270 Err(e) => {
32271 dlg.finished(false);
32272 return Err(common::Error::MissingToken(e));
32273 }
32274 },
32275 };
32276 request_value_reader
32277 .seek(std::io::SeekFrom::Start(0))
32278 .unwrap();
32279 let mut req_result = {
32280 let client = &self.hub.client;
32281 dlg.pre_request();
32282 let mut req_builder = hyper::Request::builder()
32283 .method(hyper::Method::PATCH)
32284 .uri(url.as_str())
32285 .header(USER_AGENT, self.hub._user_agent.clone());
32286
32287 if let Some(token) = token.as_ref() {
32288 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32289 }
32290
32291 let request = req_builder
32292 .header(CONTENT_TYPE, json_mime_type.to_string())
32293 .header(CONTENT_LENGTH, request_size as u64)
32294 .body(common::to_body(
32295 request_value_reader.get_ref().clone().into(),
32296 ));
32297
32298 client.request(request.unwrap()).await
32299 };
32300
32301 match req_result {
32302 Err(err) => {
32303 if let common::Retry::After(d) = dlg.http_error(&err) {
32304 sleep(d).await;
32305 continue;
32306 }
32307 dlg.finished(false);
32308 return Err(common::Error::HttpError(err));
32309 }
32310 Ok(res) => {
32311 let (mut parts, body) = res.into_parts();
32312 let mut body = common::Body::new(body);
32313 if !parts.status.is_success() {
32314 let bytes = common::to_bytes(body).await.unwrap_or_default();
32315 let error = serde_json::from_str(&common::to_string(&bytes));
32316 let response = common::to_response(parts, bytes.into());
32317
32318 if let common::Retry::After(d) =
32319 dlg.http_failure(&response, error.as_ref().ok())
32320 {
32321 sleep(d).await;
32322 continue;
32323 }
32324
32325 dlg.finished(false);
32326
32327 return Err(match error {
32328 Ok(value) => common::Error::BadRequest(value),
32329 _ => common::Error::Failure(response),
32330 });
32331 }
32332 let response = {
32333 let bytes = common::to_bytes(body).await.unwrap_or_default();
32334 let encoded = common::to_string(&bytes);
32335 match serde_json::from_str(&encoded) {
32336 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32337 Err(error) => {
32338 dlg.response_json_decode_error(&encoded, &error);
32339 return Err(common::Error::JsonDecodeError(
32340 encoded.to_string(),
32341 error,
32342 ));
32343 }
32344 }
32345 };
32346
32347 dlg.finished(true);
32348 return Ok(response);
32349 }
32350 }
32351 }
32352 }
32353
32354 ///
32355 /// Sets the *request* property to the given value.
32356 ///
32357 /// Even though the property as already been set when instantiating this call,
32358 /// we provide this method for API completeness.
32359 pub fn request(
32360 mut self,
32361 new_value: ServiceConnectionPolicy,
32362 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {
32363 self._request = new_value;
32364 self
32365 }
32366 /// Immutable. The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
32367 ///
32368 /// Sets the *name* path property to the given value.
32369 ///
32370 /// Even though the property as already been set when instantiating this call,
32371 /// we provide this method for API completeness.
32372 pub fn name(
32373 mut self,
32374 new_value: &str,
32375 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {
32376 self._name = new_value.to_string();
32377 self
32378 }
32379 /// Optional. Field mask is used to specify the fields to be overwritten in the ServiceConnectionPolicy resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
32380 ///
32381 /// Sets the *update mask* query property to the given value.
32382 pub fn update_mask(
32383 mut self,
32384 new_value: common::FieldMask,
32385 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {
32386 self._update_mask = Some(new_value);
32387 self
32388 }
32389 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
32390 ///
32391 /// Sets the *request id* query property to the given value.
32392 pub fn request_id(
32393 mut self,
32394 new_value: &str,
32395 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {
32396 self._request_id = Some(new_value.to_string());
32397 self
32398 }
32399 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32400 /// while executing the actual API request.
32401 ///
32402 /// ````text
32403 /// It should be used to handle progress information, and to implement a certain level of resilience.
32404 /// ````
32405 ///
32406 /// Sets the *delegate* property to the given value.
32407 pub fn delegate(
32408 mut self,
32409 new_value: &'a mut dyn common::Delegate,
32410 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {
32411 self._delegate = Some(new_value);
32412 self
32413 }
32414
32415 /// Set any additional parameter of the query string used in the request.
32416 /// It should be used to set parameters which are not yet available through their own
32417 /// setters.
32418 ///
32419 /// Please note that this method must not be used to set any of the known parameters
32420 /// which have their own setter method. If done anyway, the request will fail.
32421 ///
32422 /// # Additional Parameters
32423 ///
32424 /// * *$.xgafv* (query-string) - V1 error format.
32425 /// * *access_token* (query-string) - OAuth access token.
32426 /// * *alt* (query-string) - Data format for response.
32427 /// * *callback* (query-string) - JSONP
32428 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32429 /// * *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.
32430 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32431 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32432 /// * *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.
32433 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32434 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32435 pub fn param<T>(
32436 mut self,
32437 name: T,
32438 value: T,
32439 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C>
32440 where
32441 T: AsRef<str>,
32442 {
32443 self._additional_params
32444 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32445 self
32446 }
32447
32448 /// Identifies the authorization scope for the method you are building.
32449 ///
32450 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32451 /// [`Scope::CloudPlatform`].
32452 ///
32453 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32454 /// tokens for more than one scope.
32455 ///
32456 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32457 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32458 /// sufficient, a read-write scope will do as well.
32459 pub fn add_scope<St>(
32460 mut self,
32461 scope: St,
32462 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C>
32463 where
32464 St: AsRef<str>,
32465 {
32466 self._scopes.insert(String::from(scope.as_ref()));
32467 self
32468 }
32469 /// Identifies the authorization scope(s) for the method you are building.
32470 ///
32471 /// See [`Self::add_scope()`] for details.
32472 pub fn add_scopes<I, St>(
32473 mut self,
32474 scopes: I,
32475 ) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C>
32476 where
32477 I: IntoIterator<Item = St>,
32478 St: AsRef<str>,
32479 {
32480 self._scopes
32481 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32482 self
32483 }
32484
32485 /// Removes all scopes, and no default scope will be used either.
32486 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32487 /// for details).
32488 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionPolicyPatchCall<'a, C> {
32489 self._scopes.clear();
32490 self
32491 }
32492}
32493
32494/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
32495///
32496/// A builder for the *locations.serviceConnectionPolicies.setIamPolicy* method supported by a *project* resource.
32497/// It is not used directly, but through a [`ProjectMethods`] instance.
32498///
32499/// # Example
32500///
32501/// Instantiate a resource method builder
32502///
32503/// ```test_harness,no_run
32504/// # extern crate hyper;
32505/// # extern crate hyper_rustls;
32506/// # extern crate google_networkconnectivity1 as networkconnectivity1;
32507/// use networkconnectivity1::api::SetIamPolicyRequest;
32508/// # async fn dox() {
32509/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32510///
32511/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32512/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32513/// # .with_native_roots()
32514/// # .unwrap()
32515/// # .https_only()
32516/// # .enable_http2()
32517/// # .build();
32518///
32519/// # let executor = hyper_util::rt::TokioExecutor::new();
32520/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32521/// # secret,
32522/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32523/// # yup_oauth2::client::CustomHyperClientBuilder::from(
32524/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
32525/// # ),
32526/// # ).build().await.unwrap();
32527///
32528/// # let client = hyper_util::client::legacy::Client::builder(
32529/// # hyper_util::rt::TokioExecutor::new()
32530/// # )
32531/// # .build(
32532/// # hyper_rustls::HttpsConnectorBuilder::new()
32533/// # .with_native_roots()
32534/// # .unwrap()
32535/// # .https_or_http()
32536/// # .enable_http2()
32537/// # .build()
32538/// # );
32539/// # let mut hub = Networkconnectivity::new(client, auth);
32540/// // As the method needs a request, you would usually fill it with the desired information
32541/// // into the respective structure. Some of the parts shown here might not be applicable !
32542/// // Values shown here are possibly random and not representative !
32543/// let mut req = SetIamPolicyRequest::default();
32544///
32545/// // You can configure optional parameters by calling the respective setters at will, and
32546/// // execute the final call using `doit()`.
32547/// // Values shown here are possibly random and not representative !
32548/// let result = hub.projects().locations_service_connection_policies_set_iam_policy(req, "resource")
32549/// .doit().await;
32550/// # }
32551/// ```
32552pub struct ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C>
32553where
32554 C: 'a,
32555{
32556 hub: &'a Networkconnectivity<C>,
32557 _request: SetIamPolicyRequest,
32558 _resource: String,
32559 _delegate: Option<&'a mut dyn common::Delegate>,
32560 _additional_params: HashMap<String, String>,
32561 _scopes: BTreeSet<String>,
32562}
32563
32564impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C> {}
32565
32566impl<'a, C> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C>
32567where
32568 C: common::Connector,
32569{
32570 /// Perform the operation you have build so far.
32571 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
32572 use std::borrow::Cow;
32573 use std::io::{Read, Seek};
32574
32575 use common::{url::Params, ToParts};
32576 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32577
32578 let mut dd = common::DefaultDelegate;
32579 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32580 dlg.begin(common::MethodInfo {
32581 id: "networkconnectivity.projects.locations.serviceConnectionPolicies.setIamPolicy",
32582 http_method: hyper::Method::POST,
32583 });
32584
32585 for &field in ["alt", "resource"].iter() {
32586 if self._additional_params.contains_key(field) {
32587 dlg.finished(false);
32588 return Err(common::Error::FieldClash(field));
32589 }
32590 }
32591
32592 let mut params = Params::with_capacity(4 + self._additional_params.len());
32593 params.push("resource", self._resource);
32594
32595 params.extend(self._additional_params.iter());
32596
32597 params.push("alt", "json");
32598 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
32599 if self._scopes.is_empty() {
32600 self._scopes
32601 .insert(Scope::CloudPlatform.as_ref().to_string());
32602 }
32603
32604 #[allow(clippy::single_element_loop)]
32605 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
32606 url = params.uri_replacement(url, param_name, find_this, true);
32607 }
32608 {
32609 let to_remove = ["resource"];
32610 params.remove_params(&to_remove);
32611 }
32612
32613 let url = params.parse_with_url(&url);
32614
32615 let mut json_mime_type = mime::APPLICATION_JSON;
32616 let mut request_value_reader = {
32617 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32618 common::remove_json_null_values(&mut value);
32619 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32620 serde_json::to_writer(&mut dst, &value).unwrap();
32621 dst
32622 };
32623 let request_size = request_value_reader
32624 .seek(std::io::SeekFrom::End(0))
32625 .unwrap();
32626 request_value_reader
32627 .seek(std::io::SeekFrom::Start(0))
32628 .unwrap();
32629
32630 loop {
32631 let token = match self
32632 .hub
32633 .auth
32634 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32635 .await
32636 {
32637 Ok(token) => token,
32638 Err(e) => match dlg.token(e) {
32639 Ok(token) => token,
32640 Err(e) => {
32641 dlg.finished(false);
32642 return Err(common::Error::MissingToken(e));
32643 }
32644 },
32645 };
32646 request_value_reader
32647 .seek(std::io::SeekFrom::Start(0))
32648 .unwrap();
32649 let mut req_result = {
32650 let client = &self.hub.client;
32651 dlg.pre_request();
32652 let mut req_builder = hyper::Request::builder()
32653 .method(hyper::Method::POST)
32654 .uri(url.as_str())
32655 .header(USER_AGENT, self.hub._user_agent.clone());
32656
32657 if let Some(token) = token.as_ref() {
32658 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32659 }
32660
32661 let request = req_builder
32662 .header(CONTENT_TYPE, json_mime_type.to_string())
32663 .header(CONTENT_LENGTH, request_size as u64)
32664 .body(common::to_body(
32665 request_value_reader.get_ref().clone().into(),
32666 ));
32667
32668 client.request(request.unwrap()).await
32669 };
32670
32671 match req_result {
32672 Err(err) => {
32673 if let common::Retry::After(d) = dlg.http_error(&err) {
32674 sleep(d).await;
32675 continue;
32676 }
32677 dlg.finished(false);
32678 return Err(common::Error::HttpError(err));
32679 }
32680 Ok(res) => {
32681 let (mut parts, body) = res.into_parts();
32682 let mut body = common::Body::new(body);
32683 if !parts.status.is_success() {
32684 let bytes = common::to_bytes(body).await.unwrap_or_default();
32685 let error = serde_json::from_str(&common::to_string(&bytes));
32686 let response = common::to_response(parts, bytes.into());
32687
32688 if let common::Retry::After(d) =
32689 dlg.http_failure(&response, error.as_ref().ok())
32690 {
32691 sleep(d).await;
32692 continue;
32693 }
32694
32695 dlg.finished(false);
32696
32697 return Err(match error {
32698 Ok(value) => common::Error::BadRequest(value),
32699 _ => common::Error::Failure(response),
32700 });
32701 }
32702 let response = {
32703 let bytes = common::to_bytes(body).await.unwrap_or_default();
32704 let encoded = common::to_string(&bytes);
32705 match serde_json::from_str(&encoded) {
32706 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32707 Err(error) => {
32708 dlg.response_json_decode_error(&encoded, &error);
32709 return Err(common::Error::JsonDecodeError(
32710 encoded.to_string(),
32711 error,
32712 ));
32713 }
32714 }
32715 };
32716
32717 dlg.finished(true);
32718 return Ok(response);
32719 }
32720 }
32721 }
32722 }
32723
32724 ///
32725 /// Sets the *request* property to the given value.
32726 ///
32727 /// Even though the property as already been set when instantiating this call,
32728 /// we provide this method for API completeness.
32729 pub fn request(
32730 mut self,
32731 new_value: SetIamPolicyRequest,
32732 ) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C> {
32733 self._request = new_value;
32734 self
32735 }
32736 /// 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.
32737 ///
32738 /// Sets the *resource* path property to the given value.
32739 ///
32740 /// Even though the property as already been set when instantiating this call,
32741 /// we provide this method for API completeness.
32742 pub fn resource(
32743 mut self,
32744 new_value: &str,
32745 ) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C> {
32746 self._resource = new_value.to_string();
32747 self
32748 }
32749 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32750 /// while executing the actual API request.
32751 ///
32752 /// ````text
32753 /// It should be used to handle progress information, and to implement a certain level of resilience.
32754 /// ````
32755 ///
32756 /// Sets the *delegate* property to the given value.
32757 pub fn delegate(
32758 mut self,
32759 new_value: &'a mut dyn common::Delegate,
32760 ) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C> {
32761 self._delegate = Some(new_value);
32762 self
32763 }
32764
32765 /// Set any additional parameter of the query string used in the request.
32766 /// It should be used to set parameters which are not yet available through their own
32767 /// setters.
32768 ///
32769 /// Please note that this method must not be used to set any of the known parameters
32770 /// which have their own setter method. If done anyway, the request will fail.
32771 ///
32772 /// # Additional Parameters
32773 ///
32774 /// * *$.xgafv* (query-string) - V1 error format.
32775 /// * *access_token* (query-string) - OAuth access token.
32776 /// * *alt* (query-string) - Data format for response.
32777 /// * *callback* (query-string) - JSONP
32778 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32779 /// * *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.
32780 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32781 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32782 /// * *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.
32783 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32784 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32785 pub fn param<T>(
32786 mut self,
32787 name: T,
32788 value: T,
32789 ) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C>
32790 where
32791 T: AsRef<str>,
32792 {
32793 self._additional_params
32794 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32795 self
32796 }
32797
32798 /// Identifies the authorization scope for the method you are building.
32799 ///
32800 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32801 /// [`Scope::CloudPlatform`].
32802 ///
32803 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32804 /// tokens for more than one scope.
32805 ///
32806 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32807 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32808 /// sufficient, a read-write scope will do as well.
32809 pub fn add_scope<St>(
32810 mut self,
32811 scope: St,
32812 ) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C>
32813 where
32814 St: AsRef<str>,
32815 {
32816 self._scopes.insert(String::from(scope.as_ref()));
32817 self
32818 }
32819 /// Identifies the authorization scope(s) for the method you are building.
32820 ///
32821 /// See [`Self::add_scope()`] for details.
32822 pub fn add_scopes<I, St>(
32823 mut self,
32824 scopes: I,
32825 ) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C>
32826 where
32827 I: IntoIterator<Item = St>,
32828 St: AsRef<str>,
32829 {
32830 self._scopes
32831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32832 self
32833 }
32834
32835 /// Removes all scopes, and no default scope will be used either.
32836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32837 /// for details).
32838 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionPolicySetIamPolicyCall<'a, C> {
32839 self._scopes.clear();
32840 self
32841 }
32842}
32843
32844/// 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.
32845///
32846/// A builder for the *locations.serviceConnectionPolicies.testIamPermissions* method supported by a *project* resource.
32847/// It is not used directly, but through a [`ProjectMethods`] instance.
32848///
32849/// # Example
32850///
32851/// Instantiate a resource method builder
32852///
32853/// ```test_harness,no_run
32854/// # extern crate hyper;
32855/// # extern crate hyper_rustls;
32856/// # extern crate google_networkconnectivity1 as networkconnectivity1;
32857/// use networkconnectivity1::api::TestIamPermissionsRequest;
32858/// # async fn dox() {
32859/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32860///
32861/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32862/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
32863/// # .with_native_roots()
32864/// # .unwrap()
32865/// # .https_only()
32866/// # .enable_http2()
32867/// # .build();
32868///
32869/// # let executor = hyper_util::rt::TokioExecutor::new();
32870/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
32871/// # secret,
32872/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32873/// # yup_oauth2::client::CustomHyperClientBuilder::from(
32874/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
32875/// # ),
32876/// # ).build().await.unwrap();
32877///
32878/// # let client = hyper_util::client::legacy::Client::builder(
32879/// # hyper_util::rt::TokioExecutor::new()
32880/// # )
32881/// # .build(
32882/// # hyper_rustls::HttpsConnectorBuilder::new()
32883/// # .with_native_roots()
32884/// # .unwrap()
32885/// # .https_or_http()
32886/// # .enable_http2()
32887/// # .build()
32888/// # );
32889/// # let mut hub = Networkconnectivity::new(client, auth);
32890/// // As the method needs a request, you would usually fill it with the desired information
32891/// // into the respective structure. Some of the parts shown here might not be applicable !
32892/// // Values shown here are possibly random and not representative !
32893/// let mut req = TestIamPermissionsRequest::default();
32894///
32895/// // You can configure optional parameters by calling the respective setters at will, and
32896/// // execute the final call using `doit()`.
32897/// // Values shown here are possibly random and not representative !
32898/// let result = hub.projects().locations_service_connection_policies_test_iam_permissions(req, "resource")
32899/// .doit().await;
32900/// # }
32901/// ```
32902pub struct ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C>
32903where
32904 C: 'a,
32905{
32906 hub: &'a Networkconnectivity<C>,
32907 _request: TestIamPermissionsRequest,
32908 _resource: String,
32909 _delegate: Option<&'a mut dyn common::Delegate>,
32910 _additional_params: HashMap<String, String>,
32911 _scopes: BTreeSet<String>,
32912}
32913
32914impl<'a, C> common::CallBuilder
32915 for ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C>
32916{
32917}
32918
32919impl<'a, C> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C>
32920where
32921 C: common::Connector,
32922{
32923 /// Perform the operation you have build so far.
32924 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
32925 use std::borrow::Cow;
32926 use std::io::{Read, Seek};
32927
32928 use common::{url::Params, ToParts};
32929 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32930
32931 let mut dd = common::DefaultDelegate;
32932 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32933 dlg.begin(common::MethodInfo { id: "networkconnectivity.projects.locations.serviceConnectionPolicies.testIamPermissions",
32934 http_method: hyper::Method::POST });
32935
32936 for &field in ["alt", "resource"].iter() {
32937 if self._additional_params.contains_key(field) {
32938 dlg.finished(false);
32939 return Err(common::Error::FieldClash(field));
32940 }
32941 }
32942
32943 let mut params = Params::with_capacity(4 + self._additional_params.len());
32944 params.push("resource", self._resource);
32945
32946 params.extend(self._additional_params.iter());
32947
32948 params.push("alt", "json");
32949 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
32950 if self._scopes.is_empty() {
32951 self._scopes
32952 .insert(Scope::CloudPlatform.as_ref().to_string());
32953 }
32954
32955 #[allow(clippy::single_element_loop)]
32956 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
32957 url = params.uri_replacement(url, param_name, find_this, true);
32958 }
32959 {
32960 let to_remove = ["resource"];
32961 params.remove_params(&to_remove);
32962 }
32963
32964 let url = params.parse_with_url(&url);
32965
32966 let mut json_mime_type = mime::APPLICATION_JSON;
32967 let mut request_value_reader = {
32968 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32969 common::remove_json_null_values(&mut value);
32970 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32971 serde_json::to_writer(&mut dst, &value).unwrap();
32972 dst
32973 };
32974 let request_size = request_value_reader
32975 .seek(std::io::SeekFrom::End(0))
32976 .unwrap();
32977 request_value_reader
32978 .seek(std::io::SeekFrom::Start(0))
32979 .unwrap();
32980
32981 loop {
32982 let token = match self
32983 .hub
32984 .auth
32985 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32986 .await
32987 {
32988 Ok(token) => token,
32989 Err(e) => match dlg.token(e) {
32990 Ok(token) => token,
32991 Err(e) => {
32992 dlg.finished(false);
32993 return Err(common::Error::MissingToken(e));
32994 }
32995 },
32996 };
32997 request_value_reader
32998 .seek(std::io::SeekFrom::Start(0))
32999 .unwrap();
33000 let mut req_result = {
33001 let client = &self.hub.client;
33002 dlg.pre_request();
33003 let mut req_builder = hyper::Request::builder()
33004 .method(hyper::Method::POST)
33005 .uri(url.as_str())
33006 .header(USER_AGENT, self.hub._user_agent.clone());
33007
33008 if let Some(token) = token.as_ref() {
33009 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33010 }
33011
33012 let request = req_builder
33013 .header(CONTENT_TYPE, json_mime_type.to_string())
33014 .header(CONTENT_LENGTH, request_size as u64)
33015 .body(common::to_body(
33016 request_value_reader.get_ref().clone().into(),
33017 ));
33018
33019 client.request(request.unwrap()).await
33020 };
33021
33022 match req_result {
33023 Err(err) => {
33024 if let common::Retry::After(d) = dlg.http_error(&err) {
33025 sleep(d).await;
33026 continue;
33027 }
33028 dlg.finished(false);
33029 return Err(common::Error::HttpError(err));
33030 }
33031 Ok(res) => {
33032 let (mut parts, body) = res.into_parts();
33033 let mut body = common::Body::new(body);
33034 if !parts.status.is_success() {
33035 let bytes = common::to_bytes(body).await.unwrap_or_default();
33036 let error = serde_json::from_str(&common::to_string(&bytes));
33037 let response = common::to_response(parts, bytes.into());
33038
33039 if let common::Retry::After(d) =
33040 dlg.http_failure(&response, error.as_ref().ok())
33041 {
33042 sleep(d).await;
33043 continue;
33044 }
33045
33046 dlg.finished(false);
33047
33048 return Err(match error {
33049 Ok(value) => common::Error::BadRequest(value),
33050 _ => common::Error::Failure(response),
33051 });
33052 }
33053 let response = {
33054 let bytes = common::to_bytes(body).await.unwrap_or_default();
33055 let encoded = common::to_string(&bytes);
33056 match serde_json::from_str(&encoded) {
33057 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33058 Err(error) => {
33059 dlg.response_json_decode_error(&encoded, &error);
33060 return Err(common::Error::JsonDecodeError(
33061 encoded.to_string(),
33062 error,
33063 ));
33064 }
33065 }
33066 };
33067
33068 dlg.finished(true);
33069 return Ok(response);
33070 }
33071 }
33072 }
33073 }
33074
33075 ///
33076 /// Sets the *request* property to the given value.
33077 ///
33078 /// Even though the property as already been set when instantiating this call,
33079 /// we provide this method for API completeness.
33080 pub fn request(
33081 mut self,
33082 new_value: TestIamPermissionsRequest,
33083 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C> {
33084 self._request = new_value;
33085 self
33086 }
33087 /// 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.
33088 ///
33089 /// Sets the *resource* path property to the given value.
33090 ///
33091 /// Even though the property as already been set when instantiating this call,
33092 /// we provide this method for API completeness.
33093 pub fn resource(
33094 mut self,
33095 new_value: &str,
33096 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C> {
33097 self._resource = new_value.to_string();
33098 self
33099 }
33100 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33101 /// while executing the actual API request.
33102 ///
33103 /// ````text
33104 /// It should be used to handle progress information, and to implement a certain level of resilience.
33105 /// ````
33106 ///
33107 /// Sets the *delegate* property to the given value.
33108 pub fn delegate(
33109 mut self,
33110 new_value: &'a mut dyn common::Delegate,
33111 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C> {
33112 self._delegate = Some(new_value);
33113 self
33114 }
33115
33116 /// Set any additional parameter of the query string used in the request.
33117 /// It should be used to set parameters which are not yet available through their own
33118 /// setters.
33119 ///
33120 /// Please note that this method must not be used to set any of the known parameters
33121 /// which have their own setter method. If done anyway, the request will fail.
33122 ///
33123 /// # Additional Parameters
33124 ///
33125 /// * *$.xgafv* (query-string) - V1 error format.
33126 /// * *access_token* (query-string) - OAuth access token.
33127 /// * *alt* (query-string) - Data format for response.
33128 /// * *callback* (query-string) - JSONP
33129 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33130 /// * *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.
33131 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33132 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33133 /// * *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.
33134 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33135 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33136 pub fn param<T>(
33137 mut self,
33138 name: T,
33139 value: T,
33140 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C>
33141 where
33142 T: AsRef<str>,
33143 {
33144 self._additional_params
33145 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33146 self
33147 }
33148
33149 /// Identifies the authorization scope for the method you are building.
33150 ///
33151 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33152 /// [`Scope::CloudPlatform`].
33153 ///
33154 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33155 /// tokens for more than one scope.
33156 ///
33157 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33158 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33159 /// sufficient, a read-write scope will do as well.
33160 pub fn add_scope<St>(
33161 mut self,
33162 scope: St,
33163 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C>
33164 where
33165 St: AsRef<str>,
33166 {
33167 self._scopes.insert(String::from(scope.as_ref()));
33168 self
33169 }
33170 /// Identifies the authorization scope(s) for the method you are building.
33171 ///
33172 /// See [`Self::add_scope()`] for details.
33173 pub fn add_scopes<I, St>(
33174 mut self,
33175 scopes: I,
33176 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C>
33177 where
33178 I: IntoIterator<Item = St>,
33179 St: AsRef<str>,
33180 {
33181 self._scopes
33182 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33183 self
33184 }
33185
33186 /// Removes all scopes, and no default scope will be used either.
33187 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33188 /// for details).
33189 pub fn clear_scopes(
33190 mut self,
33191 ) -> ProjectLocationServiceConnectionPolicyTestIamPermissionCall<'a, C> {
33192 self._scopes.clear();
33193 self
33194 }
33195}
33196
33197/// Creates a new ServiceConnectionToken in a given project and location.
33198///
33199/// A builder for the *locations.serviceConnectionTokens.create* method supported by a *project* resource.
33200/// It is not used directly, but through a [`ProjectMethods`] instance.
33201///
33202/// # Example
33203///
33204/// Instantiate a resource method builder
33205///
33206/// ```test_harness,no_run
33207/// # extern crate hyper;
33208/// # extern crate hyper_rustls;
33209/// # extern crate google_networkconnectivity1 as networkconnectivity1;
33210/// use networkconnectivity1::api::ServiceConnectionToken;
33211/// # async fn dox() {
33212/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33213///
33214/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33215/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33216/// # .with_native_roots()
33217/// # .unwrap()
33218/// # .https_only()
33219/// # .enable_http2()
33220/// # .build();
33221///
33222/// # let executor = hyper_util::rt::TokioExecutor::new();
33223/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33224/// # secret,
33225/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33226/// # yup_oauth2::client::CustomHyperClientBuilder::from(
33227/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
33228/// # ),
33229/// # ).build().await.unwrap();
33230///
33231/// # let client = hyper_util::client::legacy::Client::builder(
33232/// # hyper_util::rt::TokioExecutor::new()
33233/// # )
33234/// # .build(
33235/// # hyper_rustls::HttpsConnectorBuilder::new()
33236/// # .with_native_roots()
33237/// # .unwrap()
33238/// # .https_or_http()
33239/// # .enable_http2()
33240/// # .build()
33241/// # );
33242/// # let mut hub = Networkconnectivity::new(client, auth);
33243/// // As the method needs a request, you would usually fill it with the desired information
33244/// // into the respective structure. Some of the parts shown here might not be applicable !
33245/// // Values shown here are possibly random and not representative !
33246/// let mut req = ServiceConnectionToken::default();
33247///
33248/// // You can configure optional parameters by calling the respective setters at will, and
33249/// // execute the final call using `doit()`.
33250/// // Values shown here are possibly random and not representative !
33251/// let result = hub.projects().locations_service_connection_tokens_create(req, "parent")
33252/// .service_connection_token_id("At")
33253/// .request_id("sit")
33254/// .doit().await;
33255/// # }
33256/// ```
33257pub struct ProjectLocationServiceConnectionTokenCreateCall<'a, C>
33258where
33259 C: 'a,
33260{
33261 hub: &'a Networkconnectivity<C>,
33262 _request: ServiceConnectionToken,
33263 _parent: String,
33264 _service_connection_token_id: Option<String>,
33265 _request_id: Option<String>,
33266 _delegate: Option<&'a mut dyn common::Delegate>,
33267 _additional_params: HashMap<String, String>,
33268 _scopes: BTreeSet<String>,
33269}
33270
33271impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionTokenCreateCall<'a, C> {}
33272
33273impl<'a, C> ProjectLocationServiceConnectionTokenCreateCall<'a, C>
33274where
33275 C: common::Connector,
33276{
33277 /// Perform the operation you have build so far.
33278 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
33279 use std::borrow::Cow;
33280 use std::io::{Read, Seek};
33281
33282 use common::{url::Params, ToParts};
33283 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33284
33285 let mut dd = common::DefaultDelegate;
33286 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33287 dlg.begin(common::MethodInfo {
33288 id: "networkconnectivity.projects.locations.serviceConnectionTokens.create",
33289 http_method: hyper::Method::POST,
33290 });
33291
33292 for &field in ["alt", "parent", "serviceConnectionTokenId", "requestId"].iter() {
33293 if self._additional_params.contains_key(field) {
33294 dlg.finished(false);
33295 return Err(common::Error::FieldClash(field));
33296 }
33297 }
33298
33299 let mut params = Params::with_capacity(6 + self._additional_params.len());
33300 params.push("parent", self._parent);
33301 if let Some(value) = self._service_connection_token_id.as_ref() {
33302 params.push("serviceConnectionTokenId", value);
33303 }
33304 if let Some(value) = self._request_id.as_ref() {
33305 params.push("requestId", value);
33306 }
33307
33308 params.extend(self._additional_params.iter());
33309
33310 params.push("alt", "json");
33311 let mut url = self.hub._base_url.clone() + "v1/{+parent}/serviceConnectionTokens";
33312 if self._scopes.is_empty() {
33313 self._scopes
33314 .insert(Scope::CloudPlatform.as_ref().to_string());
33315 }
33316
33317 #[allow(clippy::single_element_loop)]
33318 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
33319 url = params.uri_replacement(url, param_name, find_this, true);
33320 }
33321 {
33322 let to_remove = ["parent"];
33323 params.remove_params(&to_remove);
33324 }
33325
33326 let url = params.parse_with_url(&url);
33327
33328 let mut json_mime_type = mime::APPLICATION_JSON;
33329 let mut request_value_reader = {
33330 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33331 common::remove_json_null_values(&mut value);
33332 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33333 serde_json::to_writer(&mut dst, &value).unwrap();
33334 dst
33335 };
33336 let request_size = request_value_reader
33337 .seek(std::io::SeekFrom::End(0))
33338 .unwrap();
33339 request_value_reader
33340 .seek(std::io::SeekFrom::Start(0))
33341 .unwrap();
33342
33343 loop {
33344 let token = match self
33345 .hub
33346 .auth
33347 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33348 .await
33349 {
33350 Ok(token) => token,
33351 Err(e) => match dlg.token(e) {
33352 Ok(token) => token,
33353 Err(e) => {
33354 dlg.finished(false);
33355 return Err(common::Error::MissingToken(e));
33356 }
33357 },
33358 };
33359 request_value_reader
33360 .seek(std::io::SeekFrom::Start(0))
33361 .unwrap();
33362 let mut req_result = {
33363 let client = &self.hub.client;
33364 dlg.pre_request();
33365 let mut req_builder = hyper::Request::builder()
33366 .method(hyper::Method::POST)
33367 .uri(url.as_str())
33368 .header(USER_AGENT, self.hub._user_agent.clone());
33369
33370 if let Some(token) = token.as_ref() {
33371 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33372 }
33373
33374 let request = req_builder
33375 .header(CONTENT_TYPE, json_mime_type.to_string())
33376 .header(CONTENT_LENGTH, request_size as u64)
33377 .body(common::to_body(
33378 request_value_reader.get_ref().clone().into(),
33379 ));
33380
33381 client.request(request.unwrap()).await
33382 };
33383
33384 match req_result {
33385 Err(err) => {
33386 if let common::Retry::After(d) = dlg.http_error(&err) {
33387 sleep(d).await;
33388 continue;
33389 }
33390 dlg.finished(false);
33391 return Err(common::Error::HttpError(err));
33392 }
33393 Ok(res) => {
33394 let (mut parts, body) = res.into_parts();
33395 let mut body = common::Body::new(body);
33396 if !parts.status.is_success() {
33397 let bytes = common::to_bytes(body).await.unwrap_or_default();
33398 let error = serde_json::from_str(&common::to_string(&bytes));
33399 let response = common::to_response(parts, bytes.into());
33400
33401 if let common::Retry::After(d) =
33402 dlg.http_failure(&response, error.as_ref().ok())
33403 {
33404 sleep(d).await;
33405 continue;
33406 }
33407
33408 dlg.finished(false);
33409
33410 return Err(match error {
33411 Ok(value) => common::Error::BadRequest(value),
33412 _ => common::Error::Failure(response),
33413 });
33414 }
33415 let response = {
33416 let bytes = common::to_bytes(body).await.unwrap_or_default();
33417 let encoded = common::to_string(&bytes);
33418 match serde_json::from_str(&encoded) {
33419 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33420 Err(error) => {
33421 dlg.response_json_decode_error(&encoded, &error);
33422 return Err(common::Error::JsonDecodeError(
33423 encoded.to_string(),
33424 error,
33425 ));
33426 }
33427 }
33428 };
33429
33430 dlg.finished(true);
33431 return Ok(response);
33432 }
33433 }
33434 }
33435 }
33436
33437 ///
33438 /// Sets the *request* property to the given value.
33439 ///
33440 /// Even though the property as already been set when instantiating this call,
33441 /// we provide this method for API completeness.
33442 pub fn request(
33443 mut self,
33444 new_value: ServiceConnectionToken,
33445 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C> {
33446 self._request = new_value;
33447 self
33448 }
33449 /// Required. The parent resource's name of the ServiceConnectionToken. ex. projects/123/locations/us-east1
33450 ///
33451 /// Sets the *parent* path property to the given value.
33452 ///
33453 /// Even though the property as already been set when instantiating this call,
33454 /// we provide this method for API completeness.
33455 pub fn parent(
33456 mut self,
33457 new_value: &str,
33458 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C> {
33459 self._parent = new_value.to_string();
33460 self
33461 }
33462 /// Optional. Resource ID (i.e. 'foo' in '[...]/projects/p/locations/l/ServiceConnectionTokens/foo') See https://google.aip.dev/122#resource-id-segments Unique per location. If one is not provided, one will be generated.
33463 ///
33464 /// Sets the *service connection token id* query property to the given value.
33465 pub fn service_connection_token_id(
33466 mut self,
33467 new_value: &str,
33468 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C> {
33469 self._service_connection_token_id = Some(new_value.to_string());
33470 self
33471 }
33472 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
33473 ///
33474 /// Sets the *request id* query property to the given value.
33475 pub fn request_id(
33476 mut self,
33477 new_value: &str,
33478 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C> {
33479 self._request_id = Some(new_value.to_string());
33480 self
33481 }
33482 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33483 /// while executing the actual API request.
33484 ///
33485 /// ````text
33486 /// It should be used to handle progress information, and to implement a certain level of resilience.
33487 /// ````
33488 ///
33489 /// Sets the *delegate* property to the given value.
33490 pub fn delegate(
33491 mut self,
33492 new_value: &'a mut dyn common::Delegate,
33493 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C> {
33494 self._delegate = Some(new_value);
33495 self
33496 }
33497
33498 /// Set any additional parameter of the query string used in the request.
33499 /// It should be used to set parameters which are not yet available through their own
33500 /// setters.
33501 ///
33502 /// Please note that this method must not be used to set any of the known parameters
33503 /// which have their own setter method. If done anyway, the request will fail.
33504 ///
33505 /// # Additional Parameters
33506 ///
33507 /// * *$.xgafv* (query-string) - V1 error format.
33508 /// * *access_token* (query-string) - OAuth access token.
33509 /// * *alt* (query-string) - Data format for response.
33510 /// * *callback* (query-string) - JSONP
33511 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33512 /// * *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.
33513 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33514 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33515 /// * *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.
33516 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33517 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33518 pub fn param<T>(
33519 mut self,
33520 name: T,
33521 value: T,
33522 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C>
33523 where
33524 T: AsRef<str>,
33525 {
33526 self._additional_params
33527 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33528 self
33529 }
33530
33531 /// Identifies the authorization scope for the method you are building.
33532 ///
33533 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33534 /// [`Scope::CloudPlatform`].
33535 ///
33536 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33537 /// tokens for more than one scope.
33538 ///
33539 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33540 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33541 /// sufficient, a read-write scope will do as well.
33542 pub fn add_scope<St>(
33543 mut self,
33544 scope: St,
33545 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C>
33546 where
33547 St: AsRef<str>,
33548 {
33549 self._scopes.insert(String::from(scope.as_ref()));
33550 self
33551 }
33552 /// Identifies the authorization scope(s) for the method you are building.
33553 ///
33554 /// See [`Self::add_scope()`] for details.
33555 pub fn add_scopes<I, St>(
33556 mut self,
33557 scopes: I,
33558 ) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C>
33559 where
33560 I: IntoIterator<Item = St>,
33561 St: AsRef<str>,
33562 {
33563 self._scopes
33564 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33565 self
33566 }
33567
33568 /// Removes all scopes, and no default scope will be used either.
33569 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33570 /// for details).
33571 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionTokenCreateCall<'a, C> {
33572 self._scopes.clear();
33573 self
33574 }
33575}
33576
33577/// Deletes a single ServiceConnectionToken.
33578///
33579/// A builder for the *locations.serviceConnectionTokens.delete* method supported by a *project* resource.
33580/// It is not used directly, but through a [`ProjectMethods`] instance.
33581///
33582/// # Example
33583///
33584/// Instantiate a resource method builder
33585///
33586/// ```test_harness,no_run
33587/// # extern crate hyper;
33588/// # extern crate hyper_rustls;
33589/// # extern crate google_networkconnectivity1 as networkconnectivity1;
33590/// # async fn dox() {
33591/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33592///
33593/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33594/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33595/// # .with_native_roots()
33596/// # .unwrap()
33597/// # .https_only()
33598/// # .enable_http2()
33599/// # .build();
33600///
33601/// # let executor = hyper_util::rt::TokioExecutor::new();
33602/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33603/// # secret,
33604/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33605/// # yup_oauth2::client::CustomHyperClientBuilder::from(
33606/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
33607/// # ),
33608/// # ).build().await.unwrap();
33609///
33610/// # let client = hyper_util::client::legacy::Client::builder(
33611/// # hyper_util::rt::TokioExecutor::new()
33612/// # )
33613/// # .build(
33614/// # hyper_rustls::HttpsConnectorBuilder::new()
33615/// # .with_native_roots()
33616/// # .unwrap()
33617/// # .https_or_http()
33618/// # .enable_http2()
33619/// # .build()
33620/// # );
33621/// # let mut hub = Networkconnectivity::new(client, auth);
33622/// // You can configure optional parameters by calling the respective setters at will, and
33623/// // execute the final call using `doit()`.
33624/// // Values shown here are possibly random and not representative !
33625/// let result = hub.projects().locations_service_connection_tokens_delete("name")
33626/// .request_id("duo")
33627/// .etag("sadipscing")
33628/// .doit().await;
33629/// # }
33630/// ```
33631pub struct ProjectLocationServiceConnectionTokenDeleteCall<'a, C>
33632where
33633 C: 'a,
33634{
33635 hub: &'a Networkconnectivity<C>,
33636 _name: String,
33637 _request_id: Option<String>,
33638 _etag: Option<String>,
33639 _delegate: Option<&'a mut dyn common::Delegate>,
33640 _additional_params: HashMap<String, String>,
33641 _scopes: BTreeSet<String>,
33642}
33643
33644impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionTokenDeleteCall<'a, C> {}
33645
33646impl<'a, C> ProjectLocationServiceConnectionTokenDeleteCall<'a, C>
33647where
33648 C: common::Connector,
33649{
33650 /// Perform the operation you have build so far.
33651 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
33652 use std::borrow::Cow;
33653 use std::io::{Read, Seek};
33654
33655 use common::{url::Params, ToParts};
33656 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33657
33658 let mut dd = common::DefaultDelegate;
33659 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33660 dlg.begin(common::MethodInfo {
33661 id: "networkconnectivity.projects.locations.serviceConnectionTokens.delete",
33662 http_method: hyper::Method::DELETE,
33663 });
33664
33665 for &field in ["alt", "name", "requestId", "etag"].iter() {
33666 if self._additional_params.contains_key(field) {
33667 dlg.finished(false);
33668 return Err(common::Error::FieldClash(field));
33669 }
33670 }
33671
33672 let mut params = Params::with_capacity(5 + self._additional_params.len());
33673 params.push("name", self._name);
33674 if let Some(value) = self._request_id.as_ref() {
33675 params.push("requestId", value);
33676 }
33677 if let Some(value) = self._etag.as_ref() {
33678 params.push("etag", value);
33679 }
33680
33681 params.extend(self._additional_params.iter());
33682
33683 params.push("alt", "json");
33684 let mut url = self.hub._base_url.clone() + "v1/{+name}";
33685 if self._scopes.is_empty() {
33686 self._scopes
33687 .insert(Scope::CloudPlatform.as_ref().to_string());
33688 }
33689
33690 #[allow(clippy::single_element_loop)]
33691 for &(find_this, param_name) in [("{+name}", "name")].iter() {
33692 url = params.uri_replacement(url, param_name, find_this, true);
33693 }
33694 {
33695 let to_remove = ["name"];
33696 params.remove_params(&to_remove);
33697 }
33698
33699 let url = params.parse_with_url(&url);
33700
33701 loop {
33702 let token = match self
33703 .hub
33704 .auth
33705 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33706 .await
33707 {
33708 Ok(token) => token,
33709 Err(e) => match dlg.token(e) {
33710 Ok(token) => token,
33711 Err(e) => {
33712 dlg.finished(false);
33713 return Err(common::Error::MissingToken(e));
33714 }
33715 },
33716 };
33717 let mut req_result = {
33718 let client = &self.hub.client;
33719 dlg.pre_request();
33720 let mut req_builder = hyper::Request::builder()
33721 .method(hyper::Method::DELETE)
33722 .uri(url.as_str())
33723 .header(USER_AGENT, self.hub._user_agent.clone());
33724
33725 if let Some(token) = token.as_ref() {
33726 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33727 }
33728
33729 let request = req_builder
33730 .header(CONTENT_LENGTH, 0_u64)
33731 .body(common::to_body::<String>(None));
33732
33733 client.request(request.unwrap()).await
33734 };
33735
33736 match req_result {
33737 Err(err) => {
33738 if let common::Retry::After(d) = dlg.http_error(&err) {
33739 sleep(d).await;
33740 continue;
33741 }
33742 dlg.finished(false);
33743 return Err(common::Error::HttpError(err));
33744 }
33745 Ok(res) => {
33746 let (mut parts, body) = res.into_parts();
33747 let mut body = common::Body::new(body);
33748 if !parts.status.is_success() {
33749 let bytes = common::to_bytes(body).await.unwrap_or_default();
33750 let error = serde_json::from_str(&common::to_string(&bytes));
33751 let response = common::to_response(parts, bytes.into());
33752
33753 if let common::Retry::After(d) =
33754 dlg.http_failure(&response, error.as_ref().ok())
33755 {
33756 sleep(d).await;
33757 continue;
33758 }
33759
33760 dlg.finished(false);
33761
33762 return Err(match error {
33763 Ok(value) => common::Error::BadRequest(value),
33764 _ => common::Error::Failure(response),
33765 });
33766 }
33767 let response = {
33768 let bytes = common::to_bytes(body).await.unwrap_or_default();
33769 let encoded = common::to_string(&bytes);
33770 match serde_json::from_str(&encoded) {
33771 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33772 Err(error) => {
33773 dlg.response_json_decode_error(&encoded, &error);
33774 return Err(common::Error::JsonDecodeError(
33775 encoded.to_string(),
33776 error,
33777 ));
33778 }
33779 }
33780 };
33781
33782 dlg.finished(true);
33783 return Ok(response);
33784 }
33785 }
33786 }
33787 }
33788
33789 /// Required. The name of the ServiceConnectionToken to delete.
33790 ///
33791 /// Sets the *name* path property to the given value.
33792 ///
33793 /// Even though the property as already been set when instantiating this call,
33794 /// we provide this method for API completeness.
33795 pub fn name(
33796 mut self,
33797 new_value: &str,
33798 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C> {
33799 self._name = new_value.to_string();
33800 self
33801 }
33802 /// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
33803 ///
33804 /// Sets the *request id* query property to the given value.
33805 pub fn request_id(
33806 mut self,
33807 new_value: &str,
33808 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C> {
33809 self._request_id = Some(new_value.to_string());
33810 self
33811 }
33812 /// Optional. The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
33813 ///
33814 /// Sets the *etag* query property to the given value.
33815 pub fn etag(
33816 mut self,
33817 new_value: &str,
33818 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C> {
33819 self._etag = Some(new_value.to_string());
33820 self
33821 }
33822 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33823 /// while executing the actual API request.
33824 ///
33825 /// ````text
33826 /// It should be used to handle progress information, and to implement a certain level of resilience.
33827 /// ````
33828 ///
33829 /// Sets the *delegate* property to the given value.
33830 pub fn delegate(
33831 mut self,
33832 new_value: &'a mut dyn common::Delegate,
33833 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C> {
33834 self._delegate = Some(new_value);
33835 self
33836 }
33837
33838 /// Set any additional parameter of the query string used in the request.
33839 /// It should be used to set parameters which are not yet available through their own
33840 /// setters.
33841 ///
33842 /// Please note that this method must not be used to set any of the known parameters
33843 /// which have their own setter method. If done anyway, the request will fail.
33844 ///
33845 /// # Additional Parameters
33846 ///
33847 /// * *$.xgafv* (query-string) - V1 error format.
33848 /// * *access_token* (query-string) - OAuth access token.
33849 /// * *alt* (query-string) - Data format for response.
33850 /// * *callback* (query-string) - JSONP
33851 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33852 /// * *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.
33853 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33854 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33855 /// * *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.
33856 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33857 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33858 pub fn param<T>(
33859 mut self,
33860 name: T,
33861 value: T,
33862 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C>
33863 where
33864 T: AsRef<str>,
33865 {
33866 self._additional_params
33867 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33868 self
33869 }
33870
33871 /// Identifies the authorization scope for the method you are building.
33872 ///
33873 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33874 /// [`Scope::CloudPlatform`].
33875 ///
33876 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33877 /// tokens for more than one scope.
33878 ///
33879 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33880 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33881 /// sufficient, a read-write scope will do as well.
33882 pub fn add_scope<St>(
33883 mut self,
33884 scope: St,
33885 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C>
33886 where
33887 St: AsRef<str>,
33888 {
33889 self._scopes.insert(String::from(scope.as_ref()));
33890 self
33891 }
33892 /// Identifies the authorization scope(s) for the method you are building.
33893 ///
33894 /// See [`Self::add_scope()`] for details.
33895 pub fn add_scopes<I, St>(
33896 mut self,
33897 scopes: I,
33898 ) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C>
33899 where
33900 I: IntoIterator<Item = St>,
33901 St: AsRef<str>,
33902 {
33903 self._scopes
33904 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33905 self
33906 }
33907
33908 /// Removes all scopes, and no default scope will be used either.
33909 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33910 /// for details).
33911 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionTokenDeleteCall<'a, C> {
33912 self._scopes.clear();
33913 self
33914 }
33915}
33916
33917/// Gets details of a single ServiceConnectionToken.
33918///
33919/// A builder for the *locations.serviceConnectionTokens.get* method supported by a *project* resource.
33920/// It is not used directly, but through a [`ProjectMethods`] instance.
33921///
33922/// # Example
33923///
33924/// Instantiate a resource method builder
33925///
33926/// ```test_harness,no_run
33927/// # extern crate hyper;
33928/// # extern crate hyper_rustls;
33929/// # extern crate google_networkconnectivity1 as networkconnectivity1;
33930/// # async fn dox() {
33931/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33932///
33933/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33934/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
33935/// # .with_native_roots()
33936/// # .unwrap()
33937/// # .https_only()
33938/// # .enable_http2()
33939/// # .build();
33940///
33941/// # let executor = hyper_util::rt::TokioExecutor::new();
33942/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
33943/// # secret,
33944/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33945/// # yup_oauth2::client::CustomHyperClientBuilder::from(
33946/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
33947/// # ),
33948/// # ).build().await.unwrap();
33949///
33950/// # let client = hyper_util::client::legacy::Client::builder(
33951/// # hyper_util::rt::TokioExecutor::new()
33952/// # )
33953/// # .build(
33954/// # hyper_rustls::HttpsConnectorBuilder::new()
33955/// # .with_native_roots()
33956/// # .unwrap()
33957/// # .https_or_http()
33958/// # .enable_http2()
33959/// # .build()
33960/// # );
33961/// # let mut hub = Networkconnectivity::new(client, auth);
33962/// // You can configure optional parameters by calling the respective setters at will, and
33963/// // execute the final call using `doit()`.
33964/// // Values shown here are possibly random and not representative !
33965/// let result = hub.projects().locations_service_connection_tokens_get("name")
33966/// .doit().await;
33967/// # }
33968/// ```
33969pub struct ProjectLocationServiceConnectionTokenGetCall<'a, C>
33970where
33971 C: 'a,
33972{
33973 hub: &'a Networkconnectivity<C>,
33974 _name: String,
33975 _delegate: Option<&'a mut dyn common::Delegate>,
33976 _additional_params: HashMap<String, String>,
33977 _scopes: BTreeSet<String>,
33978}
33979
33980impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionTokenGetCall<'a, C> {}
33981
33982impl<'a, C> ProjectLocationServiceConnectionTokenGetCall<'a, C>
33983where
33984 C: common::Connector,
33985{
33986 /// Perform the operation you have build so far.
33987 pub async fn doit(mut self) -> common::Result<(common::Response, ServiceConnectionToken)> {
33988 use std::borrow::Cow;
33989 use std::io::{Read, Seek};
33990
33991 use common::{url::Params, ToParts};
33992 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33993
33994 let mut dd = common::DefaultDelegate;
33995 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33996 dlg.begin(common::MethodInfo {
33997 id: "networkconnectivity.projects.locations.serviceConnectionTokens.get",
33998 http_method: hyper::Method::GET,
33999 });
34000
34001 for &field in ["alt", "name"].iter() {
34002 if self._additional_params.contains_key(field) {
34003 dlg.finished(false);
34004 return Err(common::Error::FieldClash(field));
34005 }
34006 }
34007
34008 let mut params = Params::with_capacity(3 + self._additional_params.len());
34009 params.push("name", self._name);
34010
34011 params.extend(self._additional_params.iter());
34012
34013 params.push("alt", "json");
34014 let mut url = self.hub._base_url.clone() + "v1/{+name}";
34015 if self._scopes.is_empty() {
34016 self._scopes
34017 .insert(Scope::CloudPlatform.as_ref().to_string());
34018 }
34019
34020 #[allow(clippy::single_element_loop)]
34021 for &(find_this, param_name) in [("{+name}", "name")].iter() {
34022 url = params.uri_replacement(url, param_name, find_this, true);
34023 }
34024 {
34025 let to_remove = ["name"];
34026 params.remove_params(&to_remove);
34027 }
34028
34029 let url = params.parse_with_url(&url);
34030
34031 loop {
34032 let token = match self
34033 .hub
34034 .auth
34035 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34036 .await
34037 {
34038 Ok(token) => token,
34039 Err(e) => match dlg.token(e) {
34040 Ok(token) => token,
34041 Err(e) => {
34042 dlg.finished(false);
34043 return Err(common::Error::MissingToken(e));
34044 }
34045 },
34046 };
34047 let mut req_result = {
34048 let client = &self.hub.client;
34049 dlg.pre_request();
34050 let mut req_builder = hyper::Request::builder()
34051 .method(hyper::Method::GET)
34052 .uri(url.as_str())
34053 .header(USER_AGENT, self.hub._user_agent.clone());
34054
34055 if let Some(token) = token.as_ref() {
34056 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34057 }
34058
34059 let request = req_builder
34060 .header(CONTENT_LENGTH, 0_u64)
34061 .body(common::to_body::<String>(None));
34062
34063 client.request(request.unwrap()).await
34064 };
34065
34066 match req_result {
34067 Err(err) => {
34068 if let common::Retry::After(d) = dlg.http_error(&err) {
34069 sleep(d).await;
34070 continue;
34071 }
34072 dlg.finished(false);
34073 return Err(common::Error::HttpError(err));
34074 }
34075 Ok(res) => {
34076 let (mut parts, body) = res.into_parts();
34077 let mut body = common::Body::new(body);
34078 if !parts.status.is_success() {
34079 let bytes = common::to_bytes(body).await.unwrap_or_default();
34080 let error = serde_json::from_str(&common::to_string(&bytes));
34081 let response = common::to_response(parts, bytes.into());
34082
34083 if let common::Retry::After(d) =
34084 dlg.http_failure(&response, error.as_ref().ok())
34085 {
34086 sleep(d).await;
34087 continue;
34088 }
34089
34090 dlg.finished(false);
34091
34092 return Err(match error {
34093 Ok(value) => common::Error::BadRequest(value),
34094 _ => common::Error::Failure(response),
34095 });
34096 }
34097 let response = {
34098 let bytes = common::to_bytes(body).await.unwrap_or_default();
34099 let encoded = common::to_string(&bytes);
34100 match serde_json::from_str(&encoded) {
34101 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34102 Err(error) => {
34103 dlg.response_json_decode_error(&encoded, &error);
34104 return Err(common::Error::JsonDecodeError(
34105 encoded.to_string(),
34106 error,
34107 ));
34108 }
34109 }
34110 };
34111
34112 dlg.finished(true);
34113 return Ok(response);
34114 }
34115 }
34116 }
34117 }
34118
34119 /// Required. Name of the ServiceConnectionToken to get.
34120 ///
34121 /// Sets the *name* path property to the given value.
34122 ///
34123 /// Even though the property as already been set when instantiating this call,
34124 /// we provide this method for API completeness.
34125 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceConnectionTokenGetCall<'a, C> {
34126 self._name = new_value.to_string();
34127 self
34128 }
34129 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34130 /// while executing the actual API request.
34131 ///
34132 /// ````text
34133 /// It should be used to handle progress information, and to implement a certain level of resilience.
34134 /// ````
34135 ///
34136 /// Sets the *delegate* property to the given value.
34137 pub fn delegate(
34138 mut self,
34139 new_value: &'a mut dyn common::Delegate,
34140 ) -> ProjectLocationServiceConnectionTokenGetCall<'a, C> {
34141 self._delegate = Some(new_value);
34142 self
34143 }
34144
34145 /// Set any additional parameter of the query string used in the request.
34146 /// It should be used to set parameters which are not yet available through their own
34147 /// setters.
34148 ///
34149 /// Please note that this method must not be used to set any of the known parameters
34150 /// which have their own setter method. If done anyway, the request will fail.
34151 ///
34152 /// # Additional Parameters
34153 ///
34154 /// * *$.xgafv* (query-string) - V1 error format.
34155 /// * *access_token* (query-string) - OAuth access token.
34156 /// * *alt* (query-string) - Data format for response.
34157 /// * *callback* (query-string) - JSONP
34158 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34159 /// * *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.
34160 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34161 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34162 /// * *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.
34163 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34164 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34165 pub fn param<T>(
34166 mut self,
34167 name: T,
34168 value: T,
34169 ) -> ProjectLocationServiceConnectionTokenGetCall<'a, C>
34170 where
34171 T: AsRef<str>,
34172 {
34173 self._additional_params
34174 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34175 self
34176 }
34177
34178 /// Identifies the authorization scope for the method you are building.
34179 ///
34180 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34181 /// [`Scope::CloudPlatform`].
34182 ///
34183 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34184 /// tokens for more than one scope.
34185 ///
34186 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34187 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34188 /// sufficient, a read-write scope will do as well.
34189 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceConnectionTokenGetCall<'a, C>
34190 where
34191 St: AsRef<str>,
34192 {
34193 self._scopes.insert(String::from(scope.as_ref()));
34194 self
34195 }
34196 /// Identifies the authorization scope(s) for the method you are building.
34197 ///
34198 /// See [`Self::add_scope()`] for details.
34199 pub fn add_scopes<I, St>(
34200 mut self,
34201 scopes: I,
34202 ) -> ProjectLocationServiceConnectionTokenGetCall<'a, C>
34203 where
34204 I: IntoIterator<Item = St>,
34205 St: AsRef<str>,
34206 {
34207 self._scopes
34208 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34209 self
34210 }
34211
34212 /// Removes all scopes, and no default scope will be used either.
34213 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34214 /// for details).
34215 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionTokenGetCall<'a, C> {
34216 self._scopes.clear();
34217 self
34218 }
34219}
34220
34221/// Lists ServiceConnectionTokens in a given project and location.
34222///
34223/// A builder for the *locations.serviceConnectionTokens.list* method supported by a *project* resource.
34224/// It is not used directly, but through a [`ProjectMethods`] instance.
34225///
34226/// # Example
34227///
34228/// Instantiate a resource method builder
34229///
34230/// ```test_harness,no_run
34231/// # extern crate hyper;
34232/// # extern crate hyper_rustls;
34233/// # extern crate google_networkconnectivity1 as networkconnectivity1;
34234/// # async fn dox() {
34235/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34236///
34237/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34238/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34239/// # .with_native_roots()
34240/// # .unwrap()
34241/// # .https_only()
34242/// # .enable_http2()
34243/// # .build();
34244///
34245/// # let executor = hyper_util::rt::TokioExecutor::new();
34246/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34247/// # secret,
34248/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34249/// # yup_oauth2::client::CustomHyperClientBuilder::from(
34250/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
34251/// # ),
34252/// # ).build().await.unwrap();
34253///
34254/// # let client = hyper_util::client::legacy::Client::builder(
34255/// # hyper_util::rt::TokioExecutor::new()
34256/// # )
34257/// # .build(
34258/// # hyper_rustls::HttpsConnectorBuilder::new()
34259/// # .with_native_roots()
34260/// # .unwrap()
34261/// # .https_or_http()
34262/// # .enable_http2()
34263/// # .build()
34264/// # );
34265/// # let mut hub = Networkconnectivity::new(client, auth);
34266/// // You can configure optional parameters by calling the respective setters at will, and
34267/// // execute the final call using `doit()`.
34268/// // Values shown here are possibly random and not representative !
34269/// let result = hub.projects().locations_service_connection_tokens_list("parent")
34270/// .page_token("duo")
34271/// .page_size(-63)
34272/// .order_by("sadipscing")
34273/// .filter("tempor")
34274/// .doit().await;
34275/// # }
34276/// ```
34277pub struct ProjectLocationServiceConnectionTokenListCall<'a, C>
34278where
34279 C: 'a,
34280{
34281 hub: &'a Networkconnectivity<C>,
34282 _parent: String,
34283 _page_token: Option<String>,
34284 _page_size: Option<i32>,
34285 _order_by: Option<String>,
34286 _filter: Option<String>,
34287 _delegate: Option<&'a mut dyn common::Delegate>,
34288 _additional_params: HashMap<String, String>,
34289 _scopes: BTreeSet<String>,
34290}
34291
34292impl<'a, C> common::CallBuilder for ProjectLocationServiceConnectionTokenListCall<'a, C> {}
34293
34294impl<'a, C> ProjectLocationServiceConnectionTokenListCall<'a, C>
34295where
34296 C: common::Connector,
34297{
34298 /// Perform the operation you have build so far.
34299 pub async fn doit(
34300 mut self,
34301 ) -> common::Result<(common::Response, ListServiceConnectionTokensResponse)> {
34302 use std::borrow::Cow;
34303 use std::io::{Read, Seek};
34304
34305 use common::{url::Params, ToParts};
34306 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34307
34308 let mut dd = common::DefaultDelegate;
34309 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34310 dlg.begin(common::MethodInfo {
34311 id: "networkconnectivity.projects.locations.serviceConnectionTokens.list",
34312 http_method: hyper::Method::GET,
34313 });
34314
34315 for &field in [
34316 "alt",
34317 "parent",
34318 "pageToken",
34319 "pageSize",
34320 "orderBy",
34321 "filter",
34322 ]
34323 .iter()
34324 {
34325 if self._additional_params.contains_key(field) {
34326 dlg.finished(false);
34327 return Err(common::Error::FieldClash(field));
34328 }
34329 }
34330
34331 let mut params = Params::with_capacity(7 + self._additional_params.len());
34332 params.push("parent", self._parent);
34333 if let Some(value) = self._page_token.as_ref() {
34334 params.push("pageToken", value);
34335 }
34336 if let Some(value) = self._page_size.as_ref() {
34337 params.push("pageSize", value.to_string());
34338 }
34339 if let Some(value) = self._order_by.as_ref() {
34340 params.push("orderBy", value);
34341 }
34342 if let Some(value) = self._filter.as_ref() {
34343 params.push("filter", value);
34344 }
34345
34346 params.extend(self._additional_params.iter());
34347
34348 params.push("alt", "json");
34349 let mut url = self.hub._base_url.clone() + "v1/{+parent}/serviceConnectionTokens";
34350 if self._scopes.is_empty() {
34351 self._scopes
34352 .insert(Scope::CloudPlatform.as_ref().to_string());
34353 }
34354
34355 #[allow(clippy::single_element_loop)]
34356 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
34357 url = params.uri_replacement(url, param_name, find_this, true);
34358 }
34359 {
34360 let to_remove = ["parent"];
34361 params.remove_params(&to_remove);
34362 }
34363
34364 let url = params.parse_with_url(&url);
34365
34366 loop {
34367 let token = match self
34368 .hub
34369 .auth
34370 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34371 .await
34372 {
34373 Ok(token) => token,
34374 Err(e) => match dlg.token(e) {
34375 Ok(token) => token,
34376 Err(e) => {
34377 dlg.finished(false);
34378 return Err(common::Error::MissingToken(e));
34379 }
34380 },
34381 };
34382 let mut req_result = {
34383 let client = &self.hub.client;
34384 dlg.pre_request();
34385 let mut req_builder = hyper::Request::builder()
34386 .method(hyper::Method::GET)
34387 .uri(url.as_str())
34388 .header(USER_AGENT, self.hub._user_agent.clone());
34389
34390 if let Some(token) = token.as_ref() {
34391 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34392 }
34393
34394 let request = req_builder
34395 .header(CONTENT_LENGTH, 0_u64)
34396 .body(common::to_body::<String>(None));
34397
34398 client.request(request.unwrap()).await
34399 };
34400
34401 match req_result {
34402 Err(err) => {
34403 if let common::Retry::After(d) = dlg.http_error(&err) {
34404 sleep(d).await;
34405 continue;
34406 }
34407 dlg.finished(false);
34408 return Err(common::Error::HttpError(err));
34409 }
34410 Ok(res) => {
34411 let (mut parts, body) = res.into_parts();
34412 let mut body = common::Body::new(body);
34413 if !parts.status.is_success() {
34414 let bytes = common::to_bytes(body).await.unwrap_or_default();
34415 let error = serde_json::from_str(&common::to_string(&bytes));
34416 let response = common::to_response(parts, bytes.into());
34417
34418 if let common::Retry::After(d) =
34419 dlg.http_failure(&response, error.as_ref().ok())
34420 {
34421 sleep(d).await;
34422 continue;
34423 }
34424
34425 dlg.finished(false);
34426
34427 return Err(match error {
34428 Ok(value) => common::Error::BadRequest(value),
34429 _ => common::Error::Failure(response),
34430 });
34431 }
34432 let response = {
34433 let bytes = common::to_bytes(body).await.unwrap_or_default();
34434 let encoded = common::to_string(&bytes);
34435 match serde_json::from_str(&encoded) {
34436 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34437 Err(error) => {
34438 dlg.response_json_decode_error(&encoded, &error);
34439 return Err(common::Error::JsonDecodeError(
34440 encoded.to_string(),
34441 error,
34442 ));
34443 }
34444 }
34445 };
34446
34447 dlg.finished(true);
34448 return Ok(response);
34449 }
34450 }
34451 }
34452 }
34453
34454 /// Required. The parent resource's name. ex. projects/123/locations/us-east1
34455 ///
34456 /// Sets the *parent* path property to the given value.
34457 ///
34458 /// Even though the property as already been set when instantiating this call,
34459 /// we provide this method for API completeness.
34460 pub fn parent(
34461 mut self,
34462 new_value: &str,
34463 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
34464 self._parent = new_value.to_string();
34465 self
34466 }
34467 /// The page token.
34468 ///
34469 /// Sets the *page token* query property to the given value.
34470 pub fn page_token(
34471 mut self,
34472 new_value: &str,
34473 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
34474 self._page_token = Some(new_value.to_string());
34475 self
34476 }
34477 /// The maximum number of results per page that should be returned.
34478 ///
34479 /// Sets the *page size* query property to the given value.
34480 pub fn page_size(
34481 mut self,
34482 new_value: i32,
34483 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
34484 self._page_size = Some(new_value);
34485 self
34486 }
34487 /// Sort the results by a certain order.
34488 ///
34489 /// Sets the *order by* query property to the given value.
34490 pub fn order_by(
34491 mut self,
34492 new_value: &str,
34493 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
34494 self._order_by = Some(new_value.to_string());
34495 self
34496 }
34497 /// A filter expression that filters the results listed in the response.
34498 ///
34499 /// Sets the *filter* query property to the given value.
34500 pub fn filter(
34501 mut self,
34502 new_value: &str,
34503 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
34504 self._filter = Some(new_value.to_string());
34505 self
34506 }
34507 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34508 /// while executing the actual API request.
34509 ///
34510 /// ````text
34511 /// It should be used to handle progress information, and to implement a certain level of resilience.
34512 /// ````
34513 ///
34514 /// Sets the *delegate* property to the given value.
34515 pub fn delegate(
34516 mut self,
34517 new_value: &'a mut dyn common::Delegate,
34518 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
34519 self._delegate = Some(new_value);
34520 self
34521 }
34522
34523 /// Set any additional parameter of the query string used in the request.
34524 /// It should be used to set parameters which are not yet available through their own
34525 /// setters.
34526 ///
34527 /// Please note that this method must not be used to set any of the known parameters
34528 /// which have their own setter method. If done anyway, the request will fail.
34529 ///
34530 /// # Additional Parameters
34531 ///
34532 /// * *$.xgafv* (query-string) - V1 error format.
34533 /// * *access_token* (query-string) - OAuth access token.
34534 /// * *alt* (query-string) - Data format for response.
34535 /// * *callback* (query-string) - JSONP
34536 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34537 /// * *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.
34538 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34539 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34540 /// * *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.
34541 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34542 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34543 pub fn param<T>(
34544 mut self,
34545 name: T,
34546 value: T,
34547 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C>
34548 where
34549 T: AsRef<str>,
34550 {
34551 self._additional_params
34552 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34553 self
34554 }
34555
34556 /// Identifies the authorization scope for the method you are building.
34557 ///
34558 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34559 /// [`Scope::CloudPlatform`].
34560 ///
34561 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34562 /// tokens for more than one scope.
34563 ///
34564 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34565 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34566 /// sufficient, a read-write scope will do as well.
34567 pub fn add_scope<St>(
34568 mut self,
34569 scope: St,
34570 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C>
34571 where
34572 St: AsRef<str>,
34573 {
34574 self._scopes.insert(String::from(scope.as_ref()));
34575 self
34576 }
34577 /// Identifies the authorization scope(s) for the method you are building.
34578 ///
34579 /// See [`Self::add_scope()`] for details.
34580 pub fn add_scopes<I, St>(
34581 mut self,
34582 scopes: I,
34583 ) -> ProjectLocationServiceConnectionTokenListCall<'a, C>
34584 where
34585 I: IntoIterator<Item = St>,
34586 St: AsRef<str>,
34587 {
34588 self._scopes
34589 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34590 self
34591 }
34592
34593 /// Removes all scopes, and no default scope will be used either.
34594 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34595 /// for details).
34596 pub fn clear_scopes(mut self) -> ProjectLocationServiceConnectionTokenListCall<'a, C> {
34597 self._scopes.clear();
34598 self
34599 }
34600}
34601
34602/// Creates a Network Connectivity Center spoke.
34603///
34604/// A builder for the *locations.spokes.create* method supported by a *project* resource.
34605/// It is not used directly, but through a [`ProjectMethods`] instance.
34606///
34607/// # Example
34608///
34609/// Instantiate a resource method builder
34610///
34611/// ```test_harness,no_run
34612/// # extern crate hyper;
34613/// # extern crate hyper_rustls;
34614/// # extern crate google_networkconnectivity1 as networkconnectivity1;
34615/// use networkconnectivity1::api::Spoke;
34616/// # async fn dox() {
34617/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34618///
34619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34620/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34621/// # .with_native_roots()
34622/// # .unwrap()
34623/// # .https_only()
34624/// # .enable_http2()
34625/// # .build();
34626///
34627/// # let executor = hyper_util::rt::TokioExecutor::new();
34628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34629/// # secret,
34630/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34631/// # yup_oauth2::client::CustomHyperClientBuilder::from(
34632/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
34633/// # ),
34634/// # ).build().await.unwrap();
34635///
34636/// # let client = hyper_util::client::legacy::Client::builder(
34637/// # hyper_util::rt::TokioExecutor::new()
34638/// # )
34639/// # .build(
34640/// # hyper_rustls::HttpsConnectorBuilder::new()
34641/// # .with_native_roots()
34642/// # .unwrap()
34643/// # .https_or_http()
34644/// # .enable_http2()
34645/// # .build()
34646/// # );
34647/// # let mut hub = Networkconnectivity::new(client, auth);
34648/// // As the method needs a request, you would usually fill it with the desired information
34649/// // into the respective structure. Some of the parts shown here might not be applicable !
34650/// // Values shown here are possibly random and not representative !
34651/// let mut req = Spoke::default();
34652///
34653/// // You can configure optional parameters by calling the respective setters at will, and
34654/// // execute the final call using `doit()`.
34655/// // Values shown here are possibly random and not representative !
34656/// let result = hub.projects().locations_spokes_create(req, "parent")
34657/// .spoke_id("et")
34658/// .request_id("Lorem")
34659/// .doit().await;
34660/// # }
34661/// ```
34662pub struct ProjectLocationSpokeCreateCall<'a, C>
34663where
34664 C: 'a,
34665{
34666 hub: &'a Networkconnectivity<C>,
34667 _request: Spoke,
34668 _parent: String,
34669 _spoke_id: Option<String>,
34670 _request_id: Option<String>,
34671 _delegate: Option<&'a mut dyn common::Delegate>,
34672 _additional_params: HashMap<String, String>,
34673 _scopes: BTreeSet<String>,
34674}
34675
34676impl<'a, C> common::CallBuilder for ProjectLocationSpokeCreateCall<'a, C> {}
34677
34678impl<'a, C> ProjectLocationSpokeCreateCall<'a, C>
34679where
34680 C: common::Connector,
34681{
34682 /// Perform the operation you have build so far.
34683 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
34684 use std::borrow::Cow;
34685 use std::io::{Read, Seek};
34686
34687 use common::{url::Params, ToParts};
34688 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34689
34690 let mut dd = common::DefaultDelegate;
34691 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34692 dlg.begin(common::MethodInfo {
34693 id: "networkconnectivity.projects.locations.spokes.create",
34694 http_method: hyper::Method::POST,
34695 });
34696
34697 for &field in ["alt", "parent", "spokeId", "requestId"].iter() {
34698 if self._additional_params.contains_key(field) {
34699 dlg.finished(false);
34700 return Err(common::Error::FieldClash(field));
34701 }
34702 }
34703
34704 let mut params = Params::with_capacity(6 + self._additional_params.len());
34705 params.push("parent", self._parent);
34706 if let Some(value) = self._spoke_id.as_ref() {
34707 params.push("spokeId", value);
34708 }
34709 if let Some(value) = self._request_id.as_ref() {
34710 params.push("requestId", value);
34711 }
34712
34713 params.extend(self._additional_params.iter());
34714
34715 params.push("alt", "json");
34716 let mut url = self.hub._base_url.clone() + "v1/{+parent}/spokes";
34717 if self._scopes.is_empty() {
34718 self._scopes
34719 .insert(Scope::CloudPlatform.as_ref().to_string());
34720 }
34721
34722 #[allow(clippy::single_element_loop)]
34723 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
34724 url = params.uri_replacement(url, param_name, find_this, true);
34725 }
34726 {
34727 let to_remove = ["parent"];
34728 params.remove_params(&to_remove);
34729 }
34730
34731 let url = params.parse_with_url(&url);
34732
34733 let mut json_mime_type = mime::APPLICATION_JSON;
34734 let mut request_value_reader = {
34735 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34736 common::remove_json_null_values(&mut value);
34737 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34738 serde_json::to_writer(&mut dst, &value).unwrap();
34739 dst
34740 };
34741 let request_size = request_value_reader
34742 .seek(std::io::SeekFrom::End(0))
34743 .unwrap();
34744 request_value_reader
34745 .seek(std::io::SeekFrom::Start(0))
34746 .unwrap();
34747
34748 loop {
34749 let token = match self
34750 .hub
34751 .auth
34752 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34753 .await
34754 {
34755 Ok(token) => token,
34756 Err(e) => match dlg.token(e) {
34757 Ok(token) => token,
34758 Err(e) => {
34759 dlg.finished(false);
34760 return Err(common::Error::MissingToken(e));
34761 }
34762 },
34763 };
34764 request_value_reader
34765 .seek(std::io::SeekFrom::Start(0))
34766 .unwrap();
34767 let mut req_result = {
34768 let client = &self.hub.client;
34769 dlg.pre_request();
34770 let mut req_builder = hyper::Request::builder()
34771 .method(hyper::Method::POST)
34772 .uri(url.as_str())
34773 .header(USER_AGENT, self.hub._user_agent.clone());
34774
34775 if let Some(token) = token.as_ref() {
34776 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34777 }
34778
34779 let request = req_builder
34780 .header(CONTENT_TYPE, json_mime_type.to_string())
34781 .header(CONTENT_LENGTH, request_size as u64)
34782 .body(common::to_body(
34783 request_value_reader.get_ref().clone().into(),
34784 ));
34785
34786 client.request(request.unwrap()).await
34787 };
34788
34789 match req_result {
34790 Err(err) => {
34791 if let common::Retry::After(d) = dlg.http_error(&err) {
34792 sleep(d).await;
34793 continue;
34794 }
34795 dlg.finished(false);
34796 return Err(common::Error::HttpError(err));
34797 }
34798 Ok(res) => {
34799 let (mut parts, body) = res.into_parts();
34800 let mut body = common::Body::new(body);
34801 if !parts.status.is_success() {
34802 let bytes = common::to_bytes(body).await.unwrap_or_default();
34803 let error = serde_json::from_str(&common::to_string(&bytes));
34804 let response = common::to_response(parts, bytes.into());
34805
34806 if let common::Retry::After(d) =
34807 dlg.http_failure(&response, error.as_ref().ok())
34808 {
34809 sleep(d).await;
34810 continue;
34811 }
34812
34813 dlg.finished(false);
34814
34815 return Err(match error {
34816 Ok(value) => common::Error::BadRequest(value),
34817 _ => common::Error::Failure(response),
34818 });
34819 }
34820 let response = {
34821 let bytes = common::to_bytes(body).await.unwrap_or_default();
34822 let encoded = common::to_string(&bytes);
34823 match serde_json::from_str(&encoded) {
34824 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34825 Err(error) => {
34826 dlg.response_json_decode_error(&encoded, &error);
34827 return Err(common::Error::JsonDecodeError(
34828 encoded.to_string(),
34829 error,
34830 ));
34831 }
34832 }
34833 };
34834
34835 dlg.finished(true);
34836 return Ok(response);
34837 }
34838 }
34839 }
34840 }
34841
34842 ///
34843 /// Sets the *request* property to the given value.
34844 ///
34845 /// Even though the property as already been set when instantiating this call,
34846 /// we provide this method for API completeness.
34847 pub fn request(mut self, new_value: Spoke) -> ProjectLocationSpokeCreateCall<'a, C> {
34848 self._request = new_value;
34849 self
34850 }
34851 /// Required. The parent resource.
34852 ///
34853 /// Sets the *parent* path property to the given value.
34854 ///
34855 /// Even though the property as already been set when instantiating this call,
34856 /// we provide this method for API completeness.
34857 pub fn parent(mut self, new_value: &str) -> ProjectLocationSpokeCreateCall<'a, C> {
34858 self._parent = new_value.to_string();
34859 self
34860 }
34861 /// Required. Unique id for the spoke to create.
34862 ///
34863 /// Sets the *spoke id* query property to the given value.
34864 pub fn spoke_id(mut self, new_value: &str) -> ProjectLocationSpokeCreateCall<'a, C> {
34865 self._spoke_id = Some(new_value.to_string());
34866 self
34867 }
34868 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
34869 ///
34870 /// Sets the *request id* query property to the given value.
34871 pub fn request_id(mut self, new_value: &str) -> ProjectLocationSpokeCreateCall<'a, C> {
34872 self._request_id = Some(new_value.to_string());
34873 self
34874 }
34875 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34876 /// while executing the actual API request.
34877 ///
34878 /// ````text
34879 /// It should be used to handle progress information, and to implement a certain level of resilience.
34880 /// ````
34881 ///
34882 /// Sets the *delegate* property to the given value.
34883 pub fn delegate(
34884 mut self,
34885 new_value: &'a mut dyn common::Delegate,
34886 ) -> ProjectLocationSpokeCreateCall<'a, C> {
34887 self._delegate = Some(new_value);
34888 self
34889 }
34890
34891 /// Set any additional parameter of the query string used in the request.
34892 /// It should be used to set parameters which are not yet available through their own
34893 /// setters.
34894 ///
34895 /// Please note that this method must not be used to set any of the known parameters
34896 /// which have their own setter method. If done anyway, the request will fail.
34897 ///
34898 /// # Additional Parameters
34899 ///
34900 /// * *$.xgafv* (query-string) - V1 error format.
34901 /// * *access_token* (query-string) - OAuth access token.
34902 /// * *alt* (query-string) - Data format for response.
34903 /// * *callback* (query-string) - JSONP
34904 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34905 /// * *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.
34906 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34907 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34908 /// * *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.
34909 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34910 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34911 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokeCreateCall<'a, C>
34912 where
34913 T: AsRef<str>,
34914 {
34915 self._additional_params
34916 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34917 self
34918 }
34919
34920 /// Identifies the authorization scope for the method you are building.
34921 ///
34922 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34923 /// [`Scope::CloudPlatform`].
34924 ///
34925 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34926 /// tokens for more than one scope.
34927 ///
34928 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34929 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34930 /// sufficient, a read-write scope will do as well.
34931 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokeCreateCall<'a, C>
34932 where
34933 St: AsRef<str>,
34934 {
34935 self._scopes.insert(String::from(scope.as_ref()));
34936 self
34937 }
34938 /// Identifies the authorization scope(s) for the method you are building.
34939 ///
34940 /// See [`Self::add_scope()`] for details.
34941 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSpokeCreateCall<'a, C>
34942 where
34943 I: IntoIterator<Item = St>,
34944 St: AsRef<str>,
34945 {
34946 self._scopes
34947 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34948 self
34949 }
34950
34951 /// Removes all scopes, and no default scope will be used either.
34952 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34953 /// for details).
34954 pub fn clear_scopes(mut self) -> ProjectLocationSpokeCreateCall<'a, C> {
34955 self._scopes.clear();
34956 self
34957 }
34958}
34959
34960/// Deletes a Network Connectivity Center spoke.
34961///
34962/// A builder for the *locations.spokes.delete* method supported by a *project* resource.
34963/// It is not used directly, but through a [`ProjectMethods`] instance.
34964///
34965/// # Example
34966///
34967/// Instantiate a resource method builder
34968///
34969/// ```test_harness,no_run
34970/// # extern crate hyper;
34971/// # extern crate hyper_rustls;
34972/// # extern crate google_networkconnectivity1 as networkconnectivity1;
34973/// # async fn dox() {
34974/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34975///
34976/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34977/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
34978/// # .with_native_roots()
34979/// # .unwrap()
34980/// # .https_only()
34981/// # .enable_http2()
34982/// # .build();
34983///
34984/// # let executor = hyper_util::rt::TokioExecutor::new();
34985/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
34986/// # secret,
34987/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34988/// # yup_oauth2::client::CustomHyperClientBuilder::from(
34989/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
34990/// # ),
34991/// # ).build().await.unwrap();
34992///
34993/// # let client = hyper_util::client::legacy::Client::builder(
34994/// # hyper_util::rt::TokioExecutor::new()
34995/// # )
34996/// # .build(
34997/// # hyper_rustls::HttpsConnectorBuilder::new()
34998/// # .with_native_roots()
34999/// # .unwrap()
35000/// # .https_or_http()
35001/// # .enable_http2()
35002/// # .build()
35003/// # );
35004/// # let mut hub = Networkconnectivity::new(client, auth);
35005/// // You can configure optional parameters by calling the respective setters at will, and
35006/// // execute the final call using `doit()`.
35007/// // Values shown here are possibly random and not representative !
35008/// let result = hub.projects().locations_spokes_delete("name")
35009/// .request_id("takimata")
35010/// .doit().await;
35011/// # }
35012/// ```
35013pub struct ProjectLocationSpokeDeleteCall<'a, C>
35014where
35015 C: 'a,
35016{
35017 hub: &'a Networkconnectivity<C>,
35018 _name: String,
35019 _request_id: Option<String>,
35020 _delegate: Option<&'a mut dyn common::Delegate>,
35021 _additional_params: HashMap<String, String>,
35022 _scopes: BTreeSet<String>,
35023}
35024
35025impl<'a, C> common::CallBuilder for ProjectLocationSpokeDeleteCall<'a, C> {}
35026
35027impl<'a, C> ProjectLocationSpokeDeleteCall<'a, C>
35028where
35029 C: common::Connector,
35030{
35031 /// Perform the operation you have build so far.
35032 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
35033 use std::borrow::Cow;
35034 use std::io::{Read, Seek};
35035
35036 use common::{url::Params, ToParts};
35037 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35038
35039 let mut dd = common::DefaultDelegate;
35040 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35041 dlg.begin(common::MethodInfo {
35042 id: "networkconnectivity.projects.locations.spokes.delete",
35043 http_method: hyper::Method::DELETE,
35044 });
35045
35046 for &field in ["alt", "name", "requestId"].iter() {
35047 if self._additional_params.contains_key(field) {
35048 dlg.finished(false);
35049 return Err(common::Error::FieldClash(field));
35050 }
35051 }
35052
35053 let mut params = Params::with_capacity(4 + self._additional_params.len());
35054 params.push("name", self._name);
35055 if let Some(value) = self._request_id.as_ref() {
35056 params.push("requestId", value);
35057 }
35058
35059 params.extend(self._additional_params.iter());
35060
35061 params.push("alt", "json");
35062 let mut url = self.hub._base_url.clone() + "v1/{+name}";
35063 if self._scopes.is_empty() {
35064 self._scopes
35065 .insert(Scope::CloudPlatform.as_ref().to_string());
35066 }
35067
35068 #[allow(clippy::single_element_loop)]
35069 for &(find_this, param_name) in [("{+name}", "name")].iter() {
35070 url = params.uri_replacement(url, param_name, find_this, true);
35071 }
35072 {
35073 let to_remove = ["name"];
35074 params.remove_params(&to_remove);
35075 }
35076
35077 let url = params.parse_with_url(&url);
35078
35079 loop {
35080 let token = match self
35081 .hub
35082 .auth
35083 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35084 .await
35085 {
35086 Ok(token) => token,
35087 Err(e) => match dlg.token(e) {
35088 Ok(token) => token,
35089 Err(e) => {
35090 dlg.finished(false);
35091 return Err(common::Error::MissingToken(e));
35092 }
35093 },
35094 };
35095 let mut req_result = {
35096 let client = &self.hub.client;
35097 dlg.pre_request();
35098 let mut req_builder = hyper::Request::builder()
35099 .method(hyper::Method::DELETE)
35100 .uri(url.as_str())
35101 .header(USER_AGENT, self.hub._user_agent.clone());
35102
35103 if let Some(token) = token.as_ref() {
35104 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35105 }
35106
35107 let request = req_builder
35108 .header(CONTENT_LENGTH, 0_u64)
35109 .body(common::to_body::<String>(None));
35110
35111 client.request(request.unwrap()).await
35112 };
35113
35114 match req_result {
35115 Err(err) => {
35116 if let common::Retry::After(d) = dlg.http_error(&err) {
35117 sleep(d).await;
35118 continue;
35119 }
35120 dlg.finished(false);
35121 return Err(common::Error::HttpError(err));
35122 }
35123 Ok(res) => {
35124 let (mut parts, body) = res.into_parts();
35125 let mut body = common::Body::new(body);
35126 if !parts.status.is_success() {
35127 let bytes = common::to_bytes(body).await.unwrap_or_default();
35128 let error = serde_json::from_str(&common::to_string(&bytes));
35129 let response = common::to_response(parts, bytes.into());
35130
35131 if let common::Retry::After(d) =
35132 dlg.http_failure(&response, error.as_ref().ok())
35133 {
35134 sleep(d).await;
35135 continue;
35136 }
35137
35138 dlg.finished(false);
35139
35140 return Err(match error {
35141 Ok(value) => common::Error::BadRequest(value),
35142 _ => common::Error::Failure(response),
35143 });
35144 }
35145 let response = {
35146 let bytes = common::to_bytes(body).await.unwrap_or_default();
35147 let encoded = common::to_string(&bytes);
35148 match serde_json::from_str(&encoded) {
35149 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35150 Err(error) => {
35151 dlg.response_json_decode_error(&encoded, &error);
35152 return Err(common::Error::JsonDecodeError(
35153 encoded.to_string(),
35154 error,
35155 ));
35156 }
35157 }
35158 };
35159
35160 dlg.finished(true);
35161 return Ok(response);
35162 }
35163 }
35164 }
35165 }
35166
35167 /// Required. The name of the spoke to delete.
35168 ///
35169 /// Sets the *name* path property to the given value.
35170 ///
35171 /// Even though the property as already been set when instantiating this call,
35172 /// we provide this method for API completeness.
35173 pub fn name(mut self, new_value: &str) -> ProjectLocationSpokeDeleteCall<'a, C> {
35174 self._name = new_value.to_string();
35175 self
35176 }
35177 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
35178 ///
35179 /// Sets the *request id* query property to the given value.
35180 pub fn request_id(mut self, new_value: &str) -> ProjectLocationSpokeDeleteCall<'a, C> {
35181 self._request_id = Some(new_value.to_string());
35182 self
35183 }
35184 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35185 /// while executing the actual API request.
35186 ///
35187 /// ````text
35188 /// It should be used to handle progress information, and to implement a certain level of resilience.
35189 /// ````
35190 ///
35191 /// Sets the *delegate* property to the given value.
35192 pub fn delegate(
35193 mut self,
35194 new_value: &'a mut dyn common::Delegate,
35195 ) -> ProjectLocationSpokeDeleteCall<'a, C> {
35196 self._delegate = Some(new_value);
35197 self
35198 }
35199
35200 /// Set any additional parameter of the query string used in the request.
35201 /// It should be used to set parameters which are not yet available through their own
35202 /// setters.
35203 ///
35204 /// Please note that this method must not be used to set any of the known parameters
35205 /// which have their own setter method. If done anyway, the request will fail.
35206 ///
35207 /// # Additional Parameters
35208 ///
35209 /// * *$.xgafv* (query-string) - V1 error format.
35210 /// * *access_token* (query-string) - OAuth access token.
35211 /// * *alt* (query-string) - Data format for response.
35212 /// * *callback* (query-string) - JSONP
35213 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35214 /// * *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.
35215 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35216 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35217 /// * *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.
35218 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35219 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35220 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokeDeleteCall<'a, C>
35221 where
35222 T: AsRef<str>,
35223 {
35224 self._additional_params
35225 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35226 self
35227 }
35228
35229 /// Identifies the authorization scope for the method you are building.
35230 ///
35231 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35232 /// [`Scope::CloudPlatform`].
35233 ///
35234 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35235 /// tokens for more than one scope.
35236 ///
35237 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35238 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35239 /// sufficient, a read-write scope will do as well.
35240 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokeDeleteCall<'a, C>
35241 where
35242 St: AsRef<str>,
35243 {
35244 self._scopes.insert(String::from(scope.as_ref()));
35245 self
35246 }
35247 /// Identifies the authorization scope(s) for the method you are building.
35248 ///
35249 /// See [`Self::add_scope()`] for details.
35250 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSpokeDeleteCall<'a, C>
35251 where
35252 I: IntoIterator<Item = St>,
35253 St: AsRef<str>,
35254 {
35255 self._scopes
35256 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35257 self
35258 }
35259
35260 /// Removes all scopes, and no default scope will be used either.
35261 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35262 /// for details).
35263 pub fn clear_scopes(mut self) -> ProjectLocationSpokeDeleteCall<'a, C> {
35264 self._scopes.clear();
35265 self
35266 }
35267}
35268
35269/// Gets details about a Network Connectivity Center spoke.
35270///
35271/// A builder for the *locations.spokes.get* method supported by a *project* resource.
35272/// It is not used directly, but through a [`ProjectMethods`] instance.
35273///
35274/// # Example
35275///
35276/// Instantiate a resource method builder
35277///
35278/// ```test_harness,no_run
35279/// # extern crate hyper;
35280/// # extern crate hyper_rustls;
35281/// # extern crate google_networkconnectivity1 as networkconnectivity1;
35282/// # async fn dox() {
35283/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35284///
35285/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35286/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35287/// # .with_native_roots()
35288/// # .unwrap()
35289/// # .https_only()
35290/// # .enable_http2()
35291/// # .build();
35292///
35293/// # let executor = hyper_util::rt::TokioExecutor::new();
35294/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35295/// # secret,
35296/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35297/// # yup_oauth2::client::CustomHyperClientBuilder::from(
35298/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
35299/// # ),
35300/// # ).build().await.unwrap();
35301///
35302/// # let client = hyper_util::client::legacy::Client::builder(
35303/// # hyper_util::rt::TokioExecutor::new()
35304/// # )
35305/// # .build(
35306/// # hyper_rustls::HttpsConnectorBuilder::new()
35307/// # .with_native_roots()
35308/// # .unwrap()
35309/// # .https_or_http()
35310/// # .enable_http2()
35311/// # .build()
35312/// # );
35313/// # let mut hub = Networkconnectivity::new(client, auth);
35314/// // You can configure optional parameters by calling the respective setters at will, and
35315/// // execute the final call using `doit()`.
35316/// // Values shown here are possibly random and not representative !
35317/// let result = hub.projects().locations_spokes_get("name")
35318/// .doit().await;
35319/// # }
35320/// ```
35321pub struct ProjectLocationSpokeGetCall<'a, C>
35322where
35323 C: 'a,
35324{
35325 hub: &'a Networkconnectivity<C>,
35326 _name: String,
35327 _delegate: Option<&'a mut dyn common::Delegate>,
35328 _additional_params: HashMap<String, String>,
35329 _scopes: BTreeSet<String>,
35330}
35331
35332impl<'a, C> common::CallBuilder for ProjectLocationSpokeGetCall<'a, C> {}
35333
35334impl<'a, C> ProjectLocationSpokeGetCall<'a, C>
35335where
35336 C: common::Connector,
35337{
35338 /// Perform the operation you have build so far.
35339 pub async fn doit(mut self) -> common::Result<(common::Response, Spoke)> {
35340 use std::borrow::Cow;
35341 use std::io::{Read, Seek};
35342
35343 use common::{url::Params, ToParts};
35344 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35345
35346 let mut dd = common::DefaultDelegate;
35347 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35348 dlg.begin(common::MethodInfo {
35349 id: "networkconnectivity.projects.locations.spokes.get",
35350 http_method: hyper::Method::GET,
35351 });
35352
35353 for &field in ["alt", "name"].iter() {
35354 if self._additional_params.contains_key(field) {
35355 dlg.finished(false);
35356 return Err(common::Error::FieldClash(field));
35357 }
35358 }
35359
35360 let mut params = Params::with_capacity(3 + self._additional_params.len());
35361 params.push("name", self._name);
35362
35363 params.extend(self._additional_params.iter());
35364
35365 params.push("alt", "json");
35366 let mut url = self.hub._base_url.clone() + "v1/{+name}";
35367 if self._scopes.is_empty() {
35368 self._scopes
35369 .insert(Scope::CloudPlatform.as_ref().to_string());
35370 }
35371
35372 #[allow(clippy::single_element_loop)]
35373 for &(find_this, param_name) in [("{+name}", "name")].iter() {
35374 url = params.uri_replacement(url, param_name, find_this, true);
35375 }
35376 {
35377 let to_remove = ["name"];
35378 params.remove_params(&to_remove);
35379 }
35380
35381 let url = params.parse_with_url(&url);
35382
35383 loop {
35384 let token = match self
35385 .hub
35386 .auth
35387 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35388 .await
35389 {
35390 Ok(token) => token,
35391 Err(e) => match dlg.token(e) {
35392 Ok(token) => token,
35393 Err(e) => {
35394 dlg.finished(false);
35395 return Err(common::Error::MissingToken(e));
35396 }
35397 },
35398 };
35399 let mut req_result = {
35400 let client = &self.hub.client;
35401 dlg.pre_request();
35402 let mut req_builder = hyper::Request::builder()
35403 .method(hyper::Method::GET)
35404 .uri(url.as_str())
35405 .header(USER_AGENT, self.hub._user_agent.clone());
35406
35407 if let Some(token) = token.as_ref() {
35408 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35409 }
35410
35411 let request = req_builder
35412 .header(CONTENT_LENGTH, 0_u64)
35413 .body(common::to_body::<String>(None));
35414
35415 client.request(request.unwrap()).await
35416 };
35417
35418 match req_result {
35419 Err(err) => {
35420 if let common::Retry::After(d) = dlg.http_error(&err) {
35421 sleep(d).await;
35422 continue;
35423 }
35424 dlg.finished(false);
35425 return Err(common::Error::HttpError(err));
35426 }
35427 Ok(res) => {
35428 let (mut parts, body) = res.into_parts();
35429 let mut body = common::Body::new(body);
35430 if !parts.status.is_success() {
35431 let bytes = common::to_bytes(body).await.unwrap_or_default();
35432 let error = serde_json::from_str(&common::to_string(&bytes));
35433 let response = common::to_response(parts, bytes.into());
35434
35435 if let common::Retry::After(d) =
35436 dlg.http_failure(&response, error.as_ref().ok())
35437 {
35438 sleep(d).await;
35439 continue;
35440 }
35441
35442 dlg.finished(false);
35443
35444 return Err(match error {
35445 Ok(value) => common::Error::BadRequest(value),
35446 _ => common::Error::Failure(response),
35447 });
35448 }
35449 let response = {
35450 let bytes = common::to_bytes(body).await.unwrap_or_default();
35451 let encoded = common::to_string(&bytes);
35452 match serde_json::from_str(&encoded) {
35453 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35454 Err(error) => {
35455 dlg.response_json_decode_error(&encoded, &error);
35456 return Err(common::Error::JsonDecodeError(
35457 encoded.to_string(),
35458 error,
35459 ));
35460 }
35461 }
35462 };
35463
35464 dlg.finished(true);
35465 return Ok(response);
35466 }
35467 }
35468 }
35469 }
35470
35471 /// Required. The name of the spoke resource.
35472 ///
35473 /// Sets the *name* path property to the given value.
35474 ///
35475 /// Even though the property as already been set when instantiating this call,
35476 /// we provide this method for API completeness.
35477 pub fn name(mut self, new_value: &str) -> ProjectLocationSpokeGetCall<'a, C> {
35478 self._name = new_value.to_string();
35479 self
35480 }
35481 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35482 /// while executing the actual API request.
35483 ///
35484 /// ````text
35485 /// It should be used to handle progress information, and to implement a certain level of resilience.
35486 /// ````
35487 ///
35488 /// Sets the *delegate* property to the given value.
35489 pub fn delegate(
35490 mut self,
35491 new_value: &'a mut dyn common::Delegate,
35492 ) -> ProjectLocationSpokeGetCall<'a, C> {
35493 self._delegate = Some(new_value);
35494 self
35495 }
35496
35497 /// Set any additional parameter of the query string used in the request.
35498 /// It should be used to set parameters which are not yet available through their own
35499 /// setters.
35500 ///
35501 /// Please note that this method must not be used to set any of the known parameters
35502 /// which have their own setter method. If done anyway, the request will fail.
35503 ///
35504 /// # Additional Parameters
35505 ///
35506 /// * *$.xgafv* (query-string) - V1 error format.
35507 /// * *access_token* (query-string) - OAuth access token.
35508 /// * *alt* (query-string) - Data format for response.
35509 /// * *callback* (query-string) - JSONP
35510 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35511 /// * *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.
35512 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35513 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35514 /// * *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.
35515 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35516 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35517 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokeGetCall<'a, C>
35518 where
35519 T: AsRef<str>,
35520 {
35521 self._additional_params
35522 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35523 self
35524 }
35525
35526 /// Identifies the authorization scope for the method you are building.
35527 ///
35528 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35529 /// [`Scope::CloudPlatform`].
35530 ///
35531 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35532 /// tokens for more than one scope.
35533 ///
35534 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35535 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35536 /// sufficient, a read-write scope will do as well.
35537 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokeGetCall<'a, C>
35538 where
35539 St: AsRef<str>,
35540 {
35541 self._scopes.insert(String::from(scope.as_ref()));
35542 self
35543 }
35544 /// Identifies the authorization scope(s) for the method you are building.
35545 ///
35546 /// See [`Self::add_scope()`] for details.
35547 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSpokeGetCall<'a, C>
35548 where
35549 I: IntoIterator<Item = St>,
35550 St: AsRef<str>,
35551 {
35552 self._scopes
35553 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35554 self
35555 }
35556
35557 /// Removes all scopes, and no default scope will be used either.
35558 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35559 /// for details).
35560 pub fn clear_scopes(mut self) -> ProjectLocationSpokeGetCall<'a, C> {
35561 self._scopes.clear();
35562 self
35563 }
35564}
35565
35566/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
35567///
35568/// A builder for the *locations.spokes.getIamPolicy* method supported by a *project* resource.
35569/// It is not used directly, but through a [`ProjectMethods`] instance.
35570///
35571/// # Example
35572///
35573/// Instantiate a resource method builder
35574///
35575/// ```test_harness,no_run
35576/// # extern crate hyper;
35577/// # extern crate hyper_rustls;
35578/// # extern crate google_networkconnectivity1 as networkconnectivity1;
35579/// # async fn dox() {
35580/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35581///
35582/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35583/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35584/// # .with_native_roots()
35585/// # .unwrap()
35586/// # .https_only()
35587/// # .enable_http2()
35588/// # .build();
35589///
35590/// # let executor = hyper_util::rt::TokioExecutor::new();
35591/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35592/// # secret,
35593/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35594/// # yup_oauth2::client::CustomHyperClientBuilder::from(
35595/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
35596/// # ),
35597/// # ).build().await.unwrap();
35598///
35599/// # let client = hyper_util::client::legacy::Client::builder(
35600/// # hyper_util::rt::TokioExecutor::new()
35601/// # )
35602/// # .build(
35603/// # hyper_rustls::HttpsConnectorBuilder::new()
35604/// # .with_native_roots()
35605/// # .unwrap()
35606/// # .https_or_http()
35607/// # .enable_http2()
35608/// # .build()
35609/// # );
35610/// # let mut hub = Networkconnectivity::new(client, auth);
35611/// // You can configure optional parameters by calling the respective setters at will, and
35612/// // execute the final call using `doit()`.
35613/// // Values shown here are possibly random and not representative !
35614/// let result = hub.projects().locations_spokes_get_iam_policy("resource")
35615/// .options_requested_policy_version(-88)
35616/// .doit().await;
35617/// # }
35618/// ```
35619pub struct ProjectLocationSpokeGetIamPolicyCall<'a, C>
35620where
35621 C: 'a,
35622{
35623 hub: &'a Networkconnectivity<C>,
35624 _resource: String,
35625 _options_requested_policy_version: Option<i32>,
35626 _delegate: Option<&'a mut dyn common::Delegate>,
35627 _additional_params: HashMap<String, String>,
35628 _scopes: BTreeSet<String>,
35629}
35630
35631impl<'a, C> common::CallBuilder for ProjectLocationSpokeGetIamPolicyCall<'a, C> {}
35632
35633impl<'a, C> ProjectLocationSpokeGetIamPolicyCall<'a, C>
35634where
35635 C: common::Connector,
35636{
35637 /// Perform the operation you have build so far.
35638 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
35639 use std::borrow::Cow;
35640 use std::io::{Read, Seek};
35641
35642 use common::{url::Params, ToParts};
35643 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35644
35645 let mut dd = common::DefaultDelegate;
35646 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35647 dlg.begin(common::MethodInfo {
35648 id: "networkconnectivity.projects.locations.spokes.getIamPolicy",
35649 http_method: hyper::Method::GET,
35650 });
35651
35652 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
35653 if self._additional_params.contains_key(field) {
35654 dlg.finished(false);
35655 return Err(common::Error::FieldClash(field));
35656 }
35657 }
35658
35659 let mut params = Params::with_capacity(4 + self._additional_params.len());
35660 params.push("resource", self._resource);
35661 if let Some(value) = self._options_requested_policy_version.as_ref() {
35662 params.push("options.requestedPolicyVersion", value.to_string());
35663 }
35664
35665 params.extend(self._additional_params.iter());
35666
35667 params.push("alt", "json");
35668 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
35669 if self._scopes.is_empty() {
35670 self._scopes
35671 .insert(Scope::CloudPlatform.as_ref().to_string());
35672 }
35673
35674 #[allow(clippy::single_element_loop)]
35675 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
35676 url = params.uri_replacement(url, param_name, find_this, true);
35677 }
35678 {
35679 let to_remove = ["resource"];
35680 params.remove_params(&to_remove);
35681 }
35682
35683 let url = params.parse_with_url(&url);
35684
35685 loop {
35686 let token = match self
35687 .hub
35688 .auth
35689 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35690 .await
35691 {
35692 Ok(token) => token,
35693 Err(e) => match dlg.token(e) {
35694 Ok(token) => token,
35695 Err(e) => {
35696 dlg.finished(false);
35697 return Err(common::Error::MissingToken(e));
35698 }
35699 },
35700 };
35701 let mut req_result = {
35702 let client = &self.hub.client;
35703 dlg.pre_request();
35704 let mut req_builder = hyper::Request::builder()
35705 .method(hyper::Method::GET)
35706 .uri(url.as_str())
35707 .header(USER_AGENT, self.hub._user_agent.clone());
35708
35709 if let Some(token) = token.as_ref() {
35710 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35711 }
35712
35713 let request = req_builder
35714 .header(CONTENT_LENGTH, 0_u64)
35715 .body(common::to_body::<String>(None));
35716
35717 client.request(request.unwrap()).await
35718 };
35719
35720 match req_result {
35721 Err(err) => {
35722 if let common::Retry::After(d) = dlg.http_error(&err) {
35723 sleep(d).await;
35724 continue;
35725 }
35726 dlg.finished(false);
35727 return Err(common::Error::HttpError(err));
35728 }
35729 Ok(res) => {
35730 let (mut parts, body) = res.into_parts();
35731 let mut body = common::Body::new(body);
35732 if !parts.status.is_success() {
35733 let bytes = common::to_bytes(body).await.unwrap_or_default();
35734 let error = serde_json::from_str(&common::to_string(&bytes));
35735 let response = common::to_response(parts, bytes.into());
35736
35737 if let common::Retry::After(d) =
35738 dlg.http_failure(&response, error.as_ref().ok())
35739 {
35740 sleep(d).await;
35741 continue;
35742 }
35743
35744 dlg.finished(false);
35745
35746 return Err(match error {
35747 Ok(value) => common::Error::BadRequest(value),
35748 _ => common::Error::Failure(response),
35749 });
35750 }
35751 let response = {
35752 let bytes = common::to_bytes(body).await.unwrap_or_default();
35753 let encoded = common::to_string(&bytes);
35754 match serde_json::from_str(&encoded) {
35755 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35756 Err(error) => {
35757 dlg.response_json_decode_error(&encoded, &error);
35758 return Err(common::Error::JsonDecodeError(
35759 encoded.to_string(),
35760 error,
35761 ));
35762 }
35763 }
35764 };
35765
35766 dlg.finished(true);
35767 return Ok(response);
35768 }
35769 }
35770 }
35771 }
35772
35773 /// 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.
35774 ///
35775 /// Sets the *resource* path property to the given value.
35776 ///
35777 /// Even though the property as already been set when instantiating this call,
35778 /// we provide this method for API completeness.
35779 pub fn resource(mut self, new_value: &str) -> ProjectLocationSpokeGetIamPolicyCall<'a, C> {
35780 self._resource = new_value.to_string();
35781 self
35782 }
35783 /// 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).
35784 ///
35785 /// Sets the *options.requested policy version* query property to the given value.
35786 pub fn options_requested_policy_version(
35787 mut self,
35788 new_value: i32,
35789 ) -> ProjectLocationSpokeGetIamPolicyCall<'a, C> {
35790 self._options_requested_policy_version = Some(new_value);
35791 self
35792 }
35793 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35794 /// while executing the actual API request.
35795 ///
35796 /// ````text
35797 /// It should be used to handle progress information, and to implement a certain level of resilience.
35798 /// ````
35799 ///
35800 /// Sets the *delegate* property to the given value.
35801 pub fn delegate(
35802 mut self,
35803 new_value: &'a mut dyn common::Delegate,
35804 ) -> ProjectLocationSpokeGetIamPolicyCall<'a, C> {
35805 self._delegate = Some(new_value);
35806 self
35807 }
35808
35809 /// Set any additional parameter of the query string used in the request.
35810 /// It should be used to set parameters which are not yet available through their own
35811 /// setters.
35812 ///
35813 /// Please note that this method must not be used to set any of the known parameters
35814 /// which have their own setter method. If done anyway, the request will fail.
35815 ///
35816 /// # Additional Parameters
35817 ///
35818 /// * *$.xgafv* (query-string) - V1 error format.
35819 /// * *access_token* (query-string) - OAuth access token.
35820 /// * *alt* (query-string) - Data format for response.
35821 /// * *callback* (query-string) - JSONP
35822 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35823 /// * *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.
35824 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35825 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35826 /// * *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.
35827 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35828 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35829 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokeGetIamPolicyCall<'a, C>
35830 where
35831 T: AsRef<str>,
35832 {
35833 self._additional_params
35834 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35835 self
35836 }
35837
35838 /// Identifies the authorization scope for the method you are building.
35839 ///
35840 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35841 /// [`Scope::CloudPlatform`].
35842 ///
35843 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35844 /// tokens for more than one scope.
35845 ///
35846 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35847 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35848 /// sufficient, a read-write scope will do as well.
35849 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokeGetIamPolicyCall<'a, C>
35850 where
35851 St: AsRef<str>,
35852 {
35853 self._scopes.insert(String::from(scope.as_ref()));
35854 self
35855 }
35856 /// Identifies the authorization scope(s) for the method you are building.
35857 ///
35858 /// See [`Self::add_scope()`] for details.
35859 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSpokeGetIamPolicyCall<'a, C>
35860 where
35861 I: IntoIterator<Item = St>,
35862 St: AsRef<str>,
35863 {
35864 self._scopes
35865 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35866 self
35867 }
35868
35869 /// Removes all scopes, and no default scope will be used either.
35870 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35871 /// for details).
35872 pub fn clear_scopes(mut self) -> ProjectLocationSpokeGetIamPolicyCall<'a, C> {
35873 self._scopes.clear();
35874 self
35875 }
35876}
35877
35878/// Lists the Network Connectivity Center spokes in a specified project and location.
35879///
35880/// A builder for the *locations.spokes.list* method supported by a *project* resource.
35881/// It is not used directly, but through a [`ProjectMethods`] instance.
35882///
35883/// # Example
35884///
35885/// Instantiate a resource method builder
35886///
35887/// ```test_harness,no_run
35888/// # extern crate hyper;
35889/// # extern crate hyper_rustls;
35890/// # extern crate google_networkconnectivity1 as networkconnectivity1;
35891/// # async fn dox() {
35892/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35893///
35894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35895/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
35896/// # .with_native_roots()
35897/// # .unwrap()
35898/// # .https_only()
35899/// # .enable_http2()
35900/// # .build();
35901///
35902/// # let executor = hyper_util::rt::TokioExecutor::new();
35903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
35904/// # secret,
35905/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35906/// # yup_oauth2::client::CustomHyperClientBuilder::from(
35907/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
35908/// # ),
35909/// # ).build().await.unwrap();
35910///
35911/// # let client = hyper_util::client::legacy::Client::builder(
35912/// # hyper_util::rt::TokioExecutor::new()
35913/// # )
35914/// # .build(
35915/// # hyper_rustls::HttpsConnectorBuilder::new()
35916/// # .with_native_roots()
35917/// # .unwrap()
35918/// # .https_or_http()
35919/// # .enable_http2()
35920/// # .build()
35921/// # );
35922/// # let mut hub = Networkconnectivity::new(client, auth);
35923/// // You can configure optional parameters by calling the respective setters at will, and
35924/// // execute the final call using `doit()`.
35925/// // Values shown here are possibly random and not representative !
35926/// let result = hub.projects().locations_spokes_list("parent")
35927/// .page_token("Stet")
35928/// .page_size(-82)
35929/// .order_by("ut")
35930/// .filter("sit")
35931/// .doit().await;
35932/// # }
35933/// ```
35934pub struct ProjectLocationSpokeListCall<'a, C>
35935where
35936 C: 'a,
35937{
35938 hub: &'a Networkconnectivity<C>,
35939 _parent: String,
35940 _page_token: Option<String>,
35941 _page_size: Option<i32>,
35942 _order_by: Option<String>,
35943 _filter: Option<String>,
35944 _delegate: Option<&'a mut dyn common::Delegate>,
35945 _additional_params: HashMap<String, String>,
35946 _scopes: BTreeSet<String>,
35947}
35948
35949impl<'a, C> common::CallBuilder for ProjectLocationSpokeListCall<'a, C> {}
35950
35951impl<'a, C> ProjectLocationSpokeListCall<'a, C>
35952where
35953 C: common::Connector,
35954{
35955 /// Perform the operation you have build so far.
35956 pub async fn doit(mut self) -> common::Result<(common::Response, ListSpokesResponse)> {
35957 use std::borrow::Cow;
35958 use std::io::{Read, Seek};
35959
35960 use common::{url::Params, ToParts};
35961 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35962
35963 let mut dd = common::DefaultDelegate;
35964 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35965 dlg.begin(common::MethodInfo {
35966 id: "networkconnectivity.projects.locations.spokes.list",
35967 http_method: hyper::Method::GET,
35968 });
35969
35970 for &field in [
35971 "alt",
35972 "parent",
35973 "pageToken",
35974 "pageSize",
35975 "orderBy",
35976 "filter",
35977 ]
35978 .iter()
35979 {
35980 if self._additional_params.contains_key(field) {
35981 dlg.finished(false);
35982 return Err(common::Error::FieldClash(field));
35983 }
35984 }
35985
35986 let mut params = Params::with_capacity(7 + self._additional_params.len());
35987 params.push("parent", self._parent);
35988 if let Some(value) = self._page_token.as_ref() {
35989 params.push("pageToken", value);
35990 }
35991 if let Some(value) = self._page_size.as_ref() {
35992 params.push("pageSize", value.to_string());
35993 }
35994 if let Some(value) = self._order_by.as_ref() {
35995 params.push("orderBy", value);
35996 }
35997 if let Some(value) = self._filter.as_ref() {
35998 params.push("filter", value);
35999 }
36000
36001 params.extend(self._additional_params.iter());
36002
36003 params.push("alt", "json");
36004 let mut url = self.hub._base_url.clone() + "v1/{+parent}/spokes";
36005 if self._scopes.is_empty() {
36006 self._scopes
36007 .insert(Scope::CloudPlatform.as_ref().to_string());
36008 }
36009
36010 #[allow(clippy::single_element_loop)]
36011 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
36012 url = params.uri_replacement(url, param_name, find_this, true);
36013 }
36014 {
36015 let to_remove = ["parent"];
36016 params.remove_params(&to_remove);
36017 }
36018
36019 let url = params.parse_with_url(&url);
36020
36021 loop {
36022 let token = match self
36023 .hub
36024 .auth
36025 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36026 .await
36027 {
36028 Ok(token) => token,
36029 Err(e) => match dlg.token(e) {
36030 Ok(token) => token,
36031 Err(e) => {
36032 dlg.finished(false);
36033 return Err(common::Error::MissingToken(e));
36034 }
36035 },
36036 };
36037 let mut req_result = {
36038 let client = &self.hub.client;
36039 dlg.pre_request();
36040 let mut req_builder = hyper::Request::builder()
36041 .method(hyper::Method::GET)
36042 .uri(url.as_str())
36043 .header(USER_AGENT, self.hub._user_agent.clone());
36044
36045 if let Some(token) = token.as_ref() {
36046 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36047 }
36048
36049 let request = req_builder
36050 .header(CONTENT_LENGTH, 0_u64)
36051 .body(common::to_body::<String>(None));
36052
36053 client.request(request.unwrap()).await
36054 };
36055
36056 match req_result {
36057 Err(err) => {
36058 if let common::Retry::After(d) = dlg.http_error(&err) {
36059 sleep(d).await;
36060 continue;
36061 }
36062 dlg.finished(false);
36063 return Err(common::Error::HttpError(err));
36064 }
36065 Ok(res) => {
36066 let (mut parts, body) = res.into_parts();
36067 let mut body = common::Body::new(body);
36068 if !parts.status.is_success() {
36069 let bytes = common::to_bytes(body).await.unwrap_or_default();
36070 let error = serde_json::from_str(&common::to_string(&bytes));
36071 let response = common::to_response(parts, bytes.into());
36072
36073 if let common::Retry::After(d) =
36074 dlg.http_failure(&response, error.as_ref().ok())
36075 {
36076 sleep(d).await;
36077 continue;
36078 }
36079
36080 dlg.finished(false);
36081
36082 return Err(match error {
36083 Ok(value) => common::Error::BadRequest(value),
36084 _ => common::Error::Failure(response),
36085 });
36086 }
36087 let response = {
36088 let bytes = common::to_bytes(body).await.unwrap_or_default();
36089 let encoded = common::to_string(&bytes);
36090 match serde_json::from_str(&encoded) {
36091 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36092 Err(error) => {
36093 dlg.response_json_decode_error(&encoded, &error);
36094 return Err(common::Error::JsonDecodeError(
36095 encoded.to_string(),
36096 error,
36097 ));
36098 }
36099 }
36100 };
36101
36102 dlg.finished(true);
36103 return Ok(response);
36104 }
36105 }
36106 }
36107 }
36108
36109 /// Required. The parent resource.
36110 ///
36111 /// Sets the *parent* path property to the given value.
36112 ///
36113 /// Even though the property as already been set when instantiating this call,
36114 /// we provide this method for API completeness.
36115 pub fn parent(mut self, new_value: &str) -> ProjectLocationSpokeListCall<'a, C> {
36116 self._parent = new_value.to_string();
36117 self
36118 }
36119 /// The page token.
36120 ///
36121 /// Sets the *page token* query property to the given value.
36122 pub fn page_token(mut self, new_value: &str) -> ProjectLocationSpokeListCall<'a, C> {
36123 self._page_token = Some(new_value.to_string());
36124 self
36125 }
36126 /// The maximum number of results to return per page.
36127 ///
36128 /// Sets the *page size* query property to the given value.
36129 pub fn page_size(mut self, new_value: i32) -> ProjectLocationSpokeListCall<'a, C> {
36130 self._page_size = Some(new_value);
36131 self
36132 }
36133 /// Sort the results by a certain order.
36134 ///
36135 /// Sets the *order by* query property to the given value.
36136 pub fn order_by(mut self, new_value: &str) -> ProjectLocationSpokeListCall<'a, C> {
36137 self._order_by = Some(new_value.to_string());
36138 self
36139 }
36140 /// An expression that filters the list of results.
36141 ///
36142 /// Sets the *filter* query property to the given value.
36143 pub fn filter(mut self, new_value: &str) -> ProjectLocationSpokeListCall<'a, C> {
36144 self._filter = Some(new_value.to_string());
36145 self
36146 }
36147 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36148 /// while executing the actual API request.
36149 ///
36150 /// ````text
36151 /// It should be used to handle progress information, and to implement a certain level of resilience.
36152 /// ````
36153 ///
36154 /// Sets the *delegate* property to the given value.
36155 pub fn delegate(
36156 mut self,
36157 new_value: &'a mut dyn common::Delegate,
36158 ) -> ProjectLocationSpokeListCall<'a, C> {
36159 self._delegate = Some(new_value);
36160 self
36161 }
36162
36163 /// Set any additional parameter of the query string used in the request.
36164 /// It should be used to set parameters which are not yet available through their own
36165 /// setters.
36166 ///
36167 /// Please note that this method must not be used to set any of the known parameters
36168 /// which have their own setter method. If done anyway, the request will fail.
36169 ///
36170 /// # Additional Parameters
36171 ///
36172 /// * *$.xgafv* (query-string) - V1 error format.
36173 /// * *access_token* (query-string) - OAuth access token.
36174 /// * *alt* (query-string) - Data format for response.
36175 /// * *callback* (query-string) - JSONP
36176 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36177 /// * *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.
36178 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36179 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36180 /// * *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.
36181 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36182 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36183 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokeListCall<'a, C>
36184 where
36185 T: AsRef<str>,
36186 {
36187 self._additional_params
36188 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36189 self
36190 }
36191
36192 /// Identifies the authorization scope for the method you are building.
36193 ///
36194 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36195 /// [`Scope::CloudPlatform`].
36196 ///
36197 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36198 /// tokens for more than one scope.
36199 ///
36200 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36201 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36202 /// sufficient, a read-write scope will do as well.
36203 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokeListCall<'a, C>
36204 where
36205 St: AsRef<str>,
36206 {
36207 self._scopes.insert(String::from(scope.as_ref()));
36208 self
36209 }
36210 /// Identifies the authorization scope(s) for the method you are building.
36211 ///
36212 /// See [`Self::add_scope()`] for details.
36213 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSpokeListCall<'a, C>
36214 where
36215 I: IntoIterator<Item = St>,
36216 St: AsRef<str>,
36217 {
36218 self._scopes
36219 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36220 self
36221 }
36222
36223 /// Removes all scopes, and no default scope will be used either.
36224 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36225 /// for details).
36226 pub fn clear_scopes(mut self) -> ProjectLocationSpokeListCall<'a, C> {
36227 self._scopes.clear();
36228 self
36229 }
36230}
36231
36232/// Updates the parameters of a Network Connectivity Center spoke.
36233///
36234/// A builder for the *locations.spokes.patch* method supported by a *project* resource.
36235/// It is not used directly, but through a [`ProjectMethods`] instance.
36236///
36237/// # Example
36238///
36239/// Instantiate a resource method builder
36240///
36241/// ```test_harness,no_run
36242/// # extern crate hyper;
36243/// # extern crate hyper_rustls;
36244/// # extern crate google_networkconnectivity1 as networkconnectivity1;
36245/// use networkconnectivity1::api::Spoke;
36246/// # async fn dox() {
36247/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36248///
36249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36250/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36251/// # .with_native_roots()
36252/// # .unwrap()
36253/// # .https_only()
36254/// # .enable_http2()
36255/// # .build();
36256///
36257/// # let executor = hyper_util::rt::TokioExecutor::new();
36258/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36259/// # secret,
36260/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36261/// # yup_oauth2::client::CustomHyperClientBuilder::from(
36262/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
36263/// # ),
36264/// # ).build().await.unwrap();
36265///
36266/// # let client = hyper_util::client::legacy::Client::builder(
36267/// # hyper_util::rt::TokioExecutor::new()
36268/// # )
36269/// # .build(
36270/// # hyper_rustls::HttpsConnectorBuilder::new()
36271/// # .with_native_roots()
36272/// # .unwrap()
36273/// # .https_or_http()
36274/// # .enable_http2()
36275/// # .build()
36276/// # );
36277/// # let mut hub = Networkconnectivity::new(client, auth);
36278/// // As the method needs a request, you would usually fill it with the desired information
36279/// // into the respective structure. Some of the parts shown here might not be applicable !
36280/// // Values shown here are possibly random and not representative !
36281/// let mut req = Spoke::default();
36282///
36283/// // You can configure optional parameters by calling the respective setters at will, and
36284/// // execute the final call using `doit()`.
36285/// // Values shown here are possibly random and not representative !
36286/// let result = hub.projects().locations_spokes_patch(req, "name")
36287/// .update_mask(FieldMask::new::<&str>(&[]))
36288/// .request_id("rebum.")
36289/// .doit().await;
36290/// # }
36291/// ```
36292pub struct ProjectLocationSpokePatchCall<'a, C>
36293where
36294 C: 'a,
36295{
36296 hub: &'a Networkconnectivity<C>,
36297 _request: Spoke,
36298 _name: String,
36299 _update_mask: Option<common::FieldMask>,
36300 _request_id: Option<String>,
36301 _delegate: Option<&'a mut dyn common::Delegate>,
36302 _additional_params: HashMap<String, String>,
36303 _scopes: BTreeSet<String>,
36304}
36305
36306impl<'a, C> common::CallBuilder for ProjectLocationSpokePatchCall<'a, C> {}
36307
36308impl<'a, C> ProjectLocationSpokePatchCall<'a, C>
36309where
36310 C: common::Connector,
36311{
36312 /// Perform the operation you have build so far.
36313 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
36314 use std::borrow::Cow;
36315 use std::io::{Read, Seek};
36316
36317 use common::{url::Params, ToParts};
36318 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36319
36320 let mut dd = common::DefaultDelegate;
36321 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36322 dlg.begin(common::MethodInfo {
36323 id: "networkconnectivity.projects.locations.spokes.patch",
36324 http_method: hyper::Method::PATCH,
36325 });
36326
36327 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
36328 if self._additional_params.contains_key(field) {
36329 dlg.finished(false);
36330 return Err(common::Error::FieldClash(field));
36331 }
36332 }
36333
36334 let mut params = Params::with_capacity(6 + self._additional_params.len());
36335 params.push("name", self._name);
36336 if let Some(value) = self._update_mask.as_ref() {
36337 params.push("updateMask", value.to_string());
36338 }
36339 if let Some(value) = self._request_id.as_ref() {
36340 params.push("requestId", value);
36341 }
36342
36343 params.extend(self._additional_params.iter());
36344
36345 params.push("alt", "json");
36346 let mut url = self.hub._base_url.clone() + "v1/{+name}";
36347 if self._scopes.is_empty() {
36348 self._scopes
36349 .insert(Scope::CloudPlatform.as_ref().to_string());
36350 }
36351
36352 #[allow(clippy::single_element_loop)]
36353 for &(find_this, param_name) in [("{+name}", "name")].iter() {
36354 url = params.uri_replacement(url, param_name, find_this, true);
36355 }
36356 {
36357 let to_remove = ["name"];
36358 params.remove_params(&to_remove);
36359 }
36360
36361 let url = params.parse_with_url(&url);
36362
36363 let mut json_mime_type = mime::APPLICATION_JSON;
36364 let mut request_value_reader = {
36365 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36366 common::remove_json_null_values(&mut value);
36367 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36368 serde_json::to_writer(&mut dst, &value).unwrap();
36369 dst
36370 };
36371 let request_size = request_value_reader
36372 .seek(std::io::SeekFrom::End(0))
36373 .unwrap();
36374 request_value_reader
36375 .seek(std::io::SeekFrom::Start(0))
36376 .unwrap();
36377
36378 loop {
36379 let token = match self
36380 .hub
36381 .auth
36382 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36383 .await
36384 {
36385 Ok(token) => token,
36386 Err(e) => match dlg.token(e) {
36387 Ok(token) => token,
36388 Err(e) => {
36389 dlg.finished(false);
36390 return Err(common::Error::MissingToken(e));
36391 }
36392 },
36393 };
36394 request_value_reader
36395 .seek(std::io::SeekFrom::Start(0))
36396 .unwrap();
36397 let mut req_result = {
36398 let client = &self.hub.client;
36399 dlg.pre_request();
36400 let mut req_builder = hyper::Request::builder()
36401 .method(hyper::Method::PATCH)
36402 .uri(url.as_str())
36403 .header(USER_AGENT, self.hub._user_agent.clone());
36404
36405 if let Some(token) = token.as_ref() {
36406 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36407 }
36408
36409 let request = req_builder
36410 .header(CONTENT_TYPE, json_mime_type.to_string())
36411 .header(CONTENT_LENGTH, request_size as u64)
36412 .body(common::to_body(
36413 request_value_reader.get_ref().clone().into(),
36414 ));
36415
36416 client.request(request.unwrap()).await
36417 };
36418
36419 match req_result {
36420 Err(err) => {
36421 if let common::Retry::After(d) = dlg.http_error(&err) {
36422 sleep(d).await;
36423 continue;
36424 }
36425 dlg.finished(false);
36426 return Err(common::Error::HttpError(err));
36427 }
36428 Ok(res) => {
36429 let (mut parts, body) = res.into_parts();
36430 let mut body = common::Body::new(body);
36431 if !parts.status.is_success() {
36432 let bytes = common::to_bytes(body).await.unwrap_or_default();
36433 let error = serde_json::from_str(&common::to_string(&bytes));
36434 let response = common::to_response(parts, bytes.into());
36435
36436 if let common::Retry::After(d) =
36437 dlg.http_failure(&response, error.as_ref().ok())
36438 {
36439 sleep(d).await;
36440 continue;
36441 }
36442
36443 dlg.finished(false);
36444
36445 return Err(match error {
36446 Ok(value) => common::Error::BadRequest(value),
36447 _ => common::Error::Failure(response),
36448 });
36449 }
36450 let response = {
36451 let bytes = common::to_bytes(body).await.unwrap_or_default();
36452 let encoded = common::to_string(&bytes);
36453 match serde_json::from_str(&encoded) {
36454 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36455 Err(error) => {
36456 dlg.response_json_decode_error(&encoded, &error);
36457 return Err(common::Error::JsonDecodeError(
36458 encoded.to_string(),
36459 error,
36460 ));
36461 }
36462 }
36463 };
36464
36465 dlg.finished(true);
36466 return Ok(response);
36467 }
36468 }
36469 }
36470 }
36471
36472 ///
36473 /// Sets the *request* property to the given value.
36474 ///
36475 /// Even though the property as already been set when instantiating this call,
36476 /// we provide this method for API completeness.
36477 pub fn request(mut self, new_value: Spoke) -> ProjectLocationSpokePatchCall<'a, C> {
36478 self._request = new_value;
36479 self
36480 }
36481 /// Immutable. The name of the spoke. Spoke names must be unique. They use the following form: `projects/{project_number}/locations/{region}/spokes/{spoke_id}`
36482 ///
36483 /// Sets the *name* path property to the given value.
36484 ///
36485 /// Even though the property as already been set when instantiating this call,
36486 /// we provide this method for API completeness.
36487 pub fn name(mut self, new_value: &str) -> ProjectLocationSpokePatchCall<'a, C> {
36488 self._name = new_value.to_string();
36489 self
36490 }
36491 /// Optional. In the case of an update to an existing spoke, field mask is used to specify the fields to be overwritten. The fields specified in the update_mask are relative to the resource, not the full request. A field is overwritten if it is in the mask. If the user does not provide a mask, then all fields are overwritten.
36492 ///
36493 /// Sets the *update mask* query property to the given value.
36494 pub fn update_mask(
36495 mut self,
36496 new_value: common::FieldMask,
36497 ) -> ProjectLocationSpokePatchCall<'a, C> {
36498 self._update_mask = Some(new_value);
36499 self
36500 }
36501 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that a request doesn't result in creation of duplicate commitments for at least 60 minutes. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check to see whether the original operation was received. If it was, the server ignores the second request. This behavior prevents clients from mistakenly creating duplicate commitments. The request ID must be a valid UUID, with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
36502 ///
36503 /// Sets the *request id* query property to the given value.
36504 pub fn request_id(mut self, new_value: &str) -> ProjectLocationSpokePatchCall<'a, C> {
36505 self._request_id = Some(new_value.to_string());
36506 self
36507 }
36508 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36509 /// while executing the actual API request.
36510 ///
36511 /// ````text
36512 /// It should be used to handle progress information, and to implement a certain level of resilience.
36513 /// ````
36514 ///
36515 /// Sets the *delegate* property to the given value.
36516 pub fn delegate(
36517 mut self,
36518 new_value: &'a mut dyn common::Delegate,
36519 ) -> ProjectLocationSpokePatchCall<'a, C> {
36520 self._delegate = Some(new_value);
36521 self
36522 }
36523
36524 /// Set any additional parameter of the query string used in the request.
36525 /// It should be used to set parameters which are not yet available through their own
36526 /// setters.
36527 ///
36528 /// Please note that this method must not be used to set any of the known parameters
36529 /// which have their own setter method. If done anyway, the request will fail.
36530 ///
36531 /// # Additional Parameters
36532 ///
36533 /// * *$.xgafv* (query-string) - V1 error format.
36534 /// * *access_token* (query-string) - OAuth access token.
36535 /// * *alt* (query-string) - Data format for response.
36536 /// * *callback* (query-string) - JSONP
36537 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36538 /// * *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.
36539 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36540 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36541 /// * *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.
36542 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36543 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36544 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokePatchCall<'a, C>
36545 where
36546 T: AsRef<str>,
36547 {
36548 self._additional_params
36549 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36550 self
36551 }
36552
36553 /// Identifies the authorization scope for the method you are building.
36554 ///
36555 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36556 /// [`Scope::CloudPlatform`].
36557 ///
36558 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36559 /// tokens for more than one scope.
36560 ///
36561 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36562 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36563 /// sufficient, a read-write scope will do as well.
36564 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokePatchCall<'a, C>
36565 where
36566 St: AsRef<str>,
36567 {
36568 self._scopes.insert(String::from(scope.as_ref()));
36569 self
36570 }
36571 /// Identifies the authorization scope(s) for the method you are building.
36572 ///
36573 /// See [`Self::add_scope()`] for details.
36574 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSpokePatchCall<'a, C>
36575 where
36576 I: IntoIterator<Item = St>,
36577 St: AsRef<str>,
36578 {
36579 self._scopes
36580 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36581 self
36582 }
36583
36584 /// Removes all scopes, and no default scope will be used either.
36585 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36586 /// for details).
36587 pub fn clear_scopes(mut self) -> ProjectLocationSpokePatchCall<'a, C> {
36588 self._scopes.clear();
36589 self
36590 }
36591}
36592
36593/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
36594///
36595/// A builder for the *locations.spokes.setIamPolicy* method supported by a *project* resource.
36596/// It is not used directly, but through a [`ProjectMethods`] instance.
36597///
36598/// # Example
36599///
36600/// Instantiate a resource method builder
36601///
36602/// ```test_harness,no_run
36603/// # extern crate hyper;
36604/// # extern crate hyper_rustls;
36605/// # extern crate google_networkconnectivity1 as networkconnectivity1;
36606/// use networkconnectivity1::api::SetIamPolicyRequest;
36607/// # async fn dox() {
36608/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36609///
36610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36611/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36612/// # .with_native_roots()
36613/// # .unwrap()
36614/// # .https_only()
36615/// # .enable_http2()
36616/// # .build();
36617///
36618/// # let executor = hyper_util::rt::TokioExecutor::new();
36619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36620/// # secret,
36621/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36622/// # yup_oauth2::client::CustomHyperClientBuilder::from(
36623/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
36624/// # ),
36625/// # ).build().await.unwrap();
36626///
36627/// # let client = hyper_util::client::legacy::Client::builder(
36628/// # hyper_util::rt::TokioExecutor::new()
36629/// # )
36630/// # .build(
36631/// # hyper_rustls::HttpsConnectorBuilder::new()
36632/// # .with_native_roots()
36633/// # .unwrap()
36634/// # .https_or_http()
36635/// # .enable_http2()
36636/// # .build()
36637/// # );
36638/// # let mut hub = Networkconnectivity::new(client, auth);
36639/// // As the method needs a request, you would usually fill it with the desired information
36640/// // into the respective structure. Some of the parts shown here might not be applicable !
36641/// // Values shown here are possibly random and not representative !
36642/// let mut req = SetIamPolicyRequest::default();
36643///
36644/// // You can configure optional parameters by calling the respective setters at will, and
36645/// // execute the final call using `doit()`.
36646/// // Values shown here are possibly random and not representative !
36647/// let result = hub.projects().locations_spokes_set_iam_policy(req, "resource")
36648/// .doit().await;
36649/// # }
36650/// ```
36651pub struct ProjectLocationSpokeSetIamPolicyCall<'a, C>
36652where
36653 C: 'a,
36654{
36655 hub: &'a Networkconnectivity<C>,
36656 _request: SetIamPolicyRequest,
36657 _resource: String,
36658 _delegate: Option<&'a mut dyn common::Delegate>,
36659 _additional_params: HashMap<String, String>,
36660 _scopes: BTreeSet<String>,
36661}
36662
36663impl<'a, C> common::CallBuilder for ProjectLocationSpokeSetIamPolicyCall<'a, C> {}
36664
36665impl<'a, C> ProjectLocationSpokeSetIamPolicyCall<'a, C>
36666where
36667 C: common::Connector,
36668{
36669 /// Perform the operation you have build so far.
36670 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
36671 use std::borrow::Cow;
36672 use std::io::{Read, Seek};
36673
36674 use common::{url::Params, ToParts};
36675 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36676
36677 let mut dd = common::DefaultDelegate;
36678 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36679 dlg.begin(common::MethodInfo {
36680 id: "networkconnectivity.projects.locations.spokes.setIamPolicy",
36681 http_method: hyper::Method::POST,
36682 });
36683
36684 for &field in ["alt", "resource"].iter() {
36685 if self._additional_params.contains_key(field) {
36686 dlg.finished(false);
36687 return Err(common::Error::FieldClash(field));
36688 }
36689 }
36690
36691 let mut params = Params::with_capacity(4 + self._additional_params.len());
36692 params.push("resource", self._resource);
36693
36694 params.extend(self._additional_params.iter());
36695
36696 params.push("alt", "json");
36697 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
36698 if self._scopes.is_empty() {
36699 self._scopes
36700 .insert(Scope::CloudPlatform.as_ref().to_string());
36701 }
36702
36703 #[allow(clippy::single_element_loop)]
36704 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
36705 url = params.uri_replacement(url, param_name, find_this, true);
36706 }
36707 {
36708 let to_remove = ["resource"];
36709 params.remove_params(&to_remove);
36710 }
36711
36712 let url = params.parse_with_url(&url);
36713
36714 let mut json_mime_type = mime::APPLICATION_JSON;
36715 let mut request_value_reader = {
36716 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36717 common::remove_json_null_values(&mut value);
36718 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36719 serde_json::to_writer(&mut dst, &value).unwrap();
36720 dst
36721 };
36722 let request_size = request_value_reader
36723 .seek(std::io::SeekFrom::End(0))
36724 .unwrap();
36725 request_value_reader
36726 .seek(std::io::SeekFrom::Start(0))
36727 .unwrap();
36728
36729 loop {
36730 let token = match self
36731 .hub
36732 .auth
36733 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36734 .await
36735 {
36736 Ok(token) => token,
36737 Err(e) => match dlg.token(e) {
36738 Ok(token) => token,
36739 Err(e) => {
36740 dlg.finished(false);
36741 return Err(common::Error::MissingToken(e));
36742 }
36743 },
36744 };
36745 request_value_reader
36746 .seek(std::io::SeekFrom::Start(0))
36747 .unwrap();
36748 let mut req_result = {
36749 let client = &self.hub.client;
36750 dlg.pre_request();
36751 let mut req_builder = hyper::Request::builder()
36752 .method(hyper::Method::POST)
36753 .uri(url.as_str())
36754 .header(USER_AGENT, self.hub._user_agent.clone());
36755
36756 if let Some(token) = token.as_ref() {
36757 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36758 }
36759
36760 let request = req_builder
36761 .header(CONTENT_TYPE, json_mime_type.to_string())
36762 .header(CONTENT_LENGTH, request_size as u64)
36763 .body(common::to_body(
36764 request_value_reader.get_ref().clone().into(),
36765 ));
36766
36767 client.request(request.unwrap()).await
36768 };
36769
36770 match req_result {
36771 Err(err) => {
36772 if let common::Retry::After(d) = dlg.http_error(&err) {
36773 sleep(d).await;
36774 continue;
36775 }
36776 dlg.finished(false);
36777 return Err(common::Error::HttpError(err));
36778 }
36779 Ok(res) => {
36780 let (mut parts, body) = res.into_parts();
36781 let mut body = common::Body::new(body);
36782 if !parts.status.is_success() {
36783 let bytes = common::to_bytes(body).await.unwrap_or_default();
36784 let error = serde_json::from_str(&common::to_string(&bytes));
36785 let response = common::to_response(parts, bytes.into());
36786
36787 if let common::Retry::After(d) =
36788 dlg.http_failure(&response, error.as_ref().ok())
36789 {
36790 sleep(d).await;
36791 continue;
36792 }
36793
36794 dlg.finished(false);
36795
36796 return Err(match error {
36797 Ok(value) => common::Error::BadRequest(value),
36798 _ => common::Error::Failure(response),
36799 });
36800 }
36801 let response = {
36802 let bytes = common::to_bytes(body).await.unwrap_or_default();
36803 let encoded = common::to_string(&bytes);
36804 match serde_json::from_str(&encoded) {
36805 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36806 Err(error) => {
36807 dlg.response_json_decode_error(&encoded, &error);
36808 return Err(common::Error::JsonDecodeError(
36809 encoded.to_string(),
36810 error,
36811 ));
36812 }
36813 }
36814 };
36815
36816 dlg.finished(true);
36817 return Ok(response);
36818 }
36819 }
36820 }
36821 }
36822
36823 ///
36824 /// Sets the *request* property to the given value.
36825 ///
36826 /// Even though the property as already been set when instantiating this call,
36827 /// we provide this method for API completeness.
36828 pub fn request(
36829 mut self,
36830 new_value: SetIamPolicyRequest,
36831 ) -> ProjectLocationSpokeSetIamPolicyCall<'a, C> {
36832 self._request = new_value;
36833 self
36834 }
36835 /// 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.
36836 ///
36837 /// Sets the *resource* path property to the given value.
36838 ///
36839 /// Even though the property as already been set when instantiating this call,
36840 /// we provide this method for API completeness.
36841 pub fn resource(mut self, new_value: &str) -> ProjectLocationSpokeSetIamPolicyCall<'a, C> {
36842 self._resource = new_value.to_string();
36843 self
36844 }
36845 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36846 /// while executing the actual API request.
36847 ///
36848 /// ````text
36849 /// It should be used to handle progress information, and to implement a certain level of resilience.
36850 /// ````
36851 ///
36852 /// Sets the *delegate* property to the given value.
36853 pub fn delegate(
36854 mut self,
36855 new_value: &'a mut dyn common::Delegate,
36856 ) -> ProjectLocationSpokeSetIamPolicyCall<'a, C> {
36857 self._delegate = Some(new_value);
36858 self
36859 }
36860
36861 /// Set any additional parameter of the query string used in the request.
36862 /// It should be used to set parameters which are not yet available through their own
36863 /// setters.
36864 ///
36865 /// Please note that this method must not be used to set any of the known parameters
36866 /// which have their own setter method. If done anyway, the request will fail.
36867 ///
36868 /// # Additional Parameters
36869 ///
36870 /// * *$.xgafv* (query-string) - V1 error format.
36871 /// * *access_token* (query-string) - OAuth access token.
36872 /// * *alt* (query-string) - Data format for response.
36873 /// * *callback* (query-string) - JSONP
36874 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36875 /// * *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.
36876 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36877 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36878 /// * *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.
36879 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36880 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36881 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokeSetIamPolicyCall<'a, C>
36882 where
36883 T: AsRef<str>,
36884 {
36885 self._additional_params
36886 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36887 self
36888 }
36889
36890 /// Identifies the authorization scope for the method you are building.
36891 ///
36892 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36893 /// [`Scope::CloudPlatform`].
36894 ///
36895 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36896 /// tokens for more than one scope.
36897 ///
36898 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36899 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36900 /// sufficient, a read-write scope will do as well.
36901 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokeSetIamPolicyCall<'a, C>
36902 where
36903 St: AsRef<str>,
36904 {
36905 self._scopes.insert(String::from(scope.as_ref()));
36906 self
36907 }
36908 /// Identifies the authorization scope(s) for the method you are building.
36909 ///
36910 /// See [`Self::add_scope()`] for details.
36911 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSpokeSetIamPolicyCall<'a, C>
36912 where
36913 I: IntoIterator<Item = St>,
36914 St: AsRef<str>,
36915 {
36916 self._scopes
36917 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36918 self
36919 }
36920
36921 /// Removes all scopes, and no default scope will be used either.
36922 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36923 /// for details).
36924 pub fn clear_scopes(mut self) -> ProjectLocationSpokeSetIamPolicyCall<'a, C> {
36925 self._scopes.clear();
36926 self
36927 }
36928}
36929
36930/// 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.
36931///
36932/// A builder for the *locations.spokes.testIamPermissions* method supported by a *project* resource.
36933/// It is not used directly, but through a [`ProjectMethods`] instance.
36934///
36935/// # Example
36936///
36937/// Instantiate a resource method builder
36938///
36939/// ```test_harness,no_run
36940/// # extern crate hyper;
36941/// # extern crate hyper_rustls;
36942/// # extern crate google_networkconnectivity1 as networkconnectivity1;
36943/// use networkconnectivity1::api::TestIamPermissionsRequest;
36944/// # async fn dox() {
36945/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36946///
36947/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36948/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
36949/// # .with_native_roots()
36950/// # .unwrap()
36951/// # .https_only()
36952/// # .enable_http2()
36953/// # .build();
36954///
36955/// # let executor = hyper_util::rt::TokioExecutor::new();
36956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
36957/// # secret,
36958/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36959/// # yup_oauth2::client::CustomHyperClientBuilder::from(
36960/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
36961/// # ),
36962/// # ).build().await.unwrap();
36963///
36964/// # let client = hyper_util::client::legacy::Client::builder(
36965/// # hyper_util::rt::TokioExecutor::new()
36966/// # )
36967/// # .build(
36968/// # hyper_rustls::HttpsConnectorBuilder::new()
36969/// # .with_native_roots()
36970/// # .unwrap()
36971/// # .https_or_http()
36972/// # .enable_http2()
36973/// # .build()
36974/// # );
36975/// # let mut hub = Networkconnectivity::new(client, auth);
36976/// // As the method needs a request, you would usually fill it with the desired information
36977/// // into the respective structure. Some of the parts shown here might not be applicable !
36978/// // Values shown here are possibly random and not representative !
36979/// let mut req = TestIamPermissionsRequest::default();
36980///
36981/// // You can configure optional parameters by calling the respective setters at will, and
36982/// // execute the final call using `doit()`.
36983/// // Values shown here are possibly random and not representative !
36984/// let result = hub.projects().locations_spokes_test_iam_permissions(req, "resource")
36985/// .doit().await;
36986/// # }
36987/// ```
36988pub struct ProjectLocationSpokeTestIamPermissionCall<'a, C>
36989where
36990 C: 'a,
36991{
36992 hub: &'a Networkconnectivity<C>,
36993 _request: TestIamPermissionsRequest,
36994 _resource: String,
36995 _delegate: Option<&'a mut dyn common::Delegate>,
36996 _additional_params: HashMap<String, String>,
36997 _scopes: BTreeSet<String>,
36998}
36999
37000impl<'a, C> common::CallBuilder for ProjectLocationSpokeTestIamPermissionCall<'a, C> {}
37001
37002impl<'a, C> ProjectLocationSpokeTestIamPermissionCall<'a, C>
37003where
37004 C: common::Connector,
37005{
37006 /// Perform the operation you have build so far.
37007 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
37008 use std::borrow::Cow;
37009 use std::io::{Read, Seek};
37010
37011 use common::{url::Params, ToParts};
37012 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37013
37014 let mut dd = common::DefaultDelegate;
37015 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37016 dlg.begin(common::MethodInfo {
37017 id: "networkconnectivity.projects.locations.spokes.testIamPermissions",
37018 http_method: hyper::Method::POST,
37019 });
37020
37021 for &field in ["alt", "resource"].iter() {
37022 if self._additional_params.contains_key(field) {
37023 dlg.finished(false);
37024 return Err(common::Error::FieldClash(field));
37025 }
37026 }
37027
37028 let mut params = Params::with_capacity(4 + self._additional_params.len());
37029 params.push("resource", self._resource);
37030
37031 params.extend(self._additional_params.iter());
37032
37033 params.push("alt", "json");
37034 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
37035 if self._scopes.is_empty() {
37036 self._scopes
37037 .insert(Scope::CloudPlatform.as_ref().to_string());
37038 }
37039
37040 #[allow(clippy::single_element_loop)]
37041 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
37042 url = params.uri_replacement(url, param_name, find_this, true);
37043 }
37044 {
37045 let to_remove = ["resource"];
37046 params.remove_params(&to_remove);
37047 }
37048
37049 let url = params.parse_with_url(&url);
37050
37051 let mut json_mime_type = mime::APPLICATION_JSON;
37052 let mut request_value_reader = {
37053 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37054 common::remove_json_null_values(&mut value);
37055 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37056 serde_json::to_writer(&mut dst, &value).unwrap();
37057 dst
37058 };
37059 let request_size = request_value_reader
37060 .seek(std::io::SeekFrom::End(0))
37061 .unwrap();
37062 request_value_reader
37063 .seek(std::io::SeekFrom::Start(0))
37064 .unwrap();
37065
37066 loop {
37067 let token = match self
37068 .hub
37069 .auth
37070 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37071 .await
37072 {
37073 Ok(token) => token,
37074 Err(e) => match dlg.token(e) {
37075 Ok(token) => token,
37076 Err(e) => {
37077 dlg.finished(false);
37078 return Err(common::Error::MissingToken(e));
37079 }
37080 },
37081 };
37082 request_value_reader
37083 .seek(std::io::SeekFrom::Start(0))
37084 .unwrap();
37085 let mut req_result = {
37086 let client = &self.hub.client;
37087 dlg.pre_request();
37088 let mut req_builder = hyper::Request::builder()
37089 .method(hyper::Method::POST)
37090 .uri(url.as_str())
37091 .header(USER_AGENT, self.hub._user_agent.clone());
37092
37093 if let Some(token) = token.as_ref() {
37094 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37095 }
37096
37097 let request = req_builder
37098 .header(CONTENT_TYPE, json_mime_type.to_string())
37099 .header(CONTENT_LENGTH, request_size as u64)
37100 .body(common::to_body(
37101 request_value_reader.get_ref().clone().into(),
37102 ));
37103
37104 client.request(request.unwrap()).await
37105 };
37106
37107 match req_result {
37108 Err(err) => {
37109 if let common::Retry::After(d) = dlg.http_error(&err) {
37110 sleep(d).await;
37111 continue;
37112 }
37113 dlg.finished(false);
37114 return Err(common::Error::HttpError(err));
37115 }
37116 Ok(res) => {
37117 let (mut parts, body) = res.into_parts();
37118 let mut body = common::Body::new(body);
37119 if !parts.status.is_success() {
37120 let bytes = common::to_bytes(body).await.unwrap_or_default();
37121 let error = serde_json::from_str(&common::to_string(&bytes));
37122 let response = common::to_response(parts, bytes.into());
37123
37124 if let common::Retry::After(d) =
37125 dlg.http_failure(&response, error.as_ref().ok())
37126 {
37127 sleep(d).await;
37128 continue;
37129 }
37130
37131 dlg.finished(false);
37132
37133 return Err(match error {
37134 Ok(value) => common::Error::BadRequest(value),
37135 _ => common::Error::Failure(response),
37136 });
37137 }
37138 let response = {
37139 let bytes = common::to_bytes(body).await.unwrap_or_default();
37140 let encoded = common::to_string(&bytes);
37141 match serde_json::from_str(&encoded) {
37142 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37143 Err(error) => {
37144 dlg.response_json_decode_error(&encoded, &error);
37145 return Err(common::Error::JsonDecodeError(
37146 encoded.to_string(),
37147 error,
37148 ));
37149 }
37150 }
37151 };
37152
37153 dlg.finished(true);
37154 return Ok(response);
37155 }
37156 }
37157 }
37158 }
37159
37160 ///
37161 /// Sets the *request* property to the given value.
37162 ///
37163 /// Even though the property as already been set when instantiating this call,
37164 /// we provide this method for API completeness.
37165 pub fn request(
37166 mut self,
37167 new_value: TestIamPermissionsRequest,
37168 ) -> ProjectLocationSpokeTestIamPermissionCall<'a, C> {
37169 self._request = new_value;
37170 self
37171 }
37172 /// 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.
37173 ///
37174 /// Sets the *resource* path property to the given value.
37175 ///
37176 /// Even though the property as already been set when instantiating this call,
37177 /// we provide this method for API completeness.
37178 pub fn resource(mut self, new_value: &str) -> ProjectLocationSpokeTestIamPermissionCall<'a, C> {
37179 self._resource = new_value.to_string();
37180 self
37181 }
37182 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37183 /// while executing the actual API request.
37184 ///
37185 /// ````text
37186 /// It should be used to handle progress information, and to implement a certain level of resilience.
37187 /// ````
37188 ///
37189 /// Sets the *delegate* property to the given value.
37190 pub fn delegate(
37191 mut self,
37192 new_value: &'a mut dyn common::Delegate,
37193 ) -> ProjectLocationSpokeTestIamPermissionCall<'a, C> {
37194 self._delegate = Some(new_value);
37195 self
37196 }
37197
37198 /// Set any additional parameter of the query string used in the request.
37199 /// It should be used to set parameters which are not yet available through their own
37200 /// setters.
37201 ///
37202 /// Please note that this method must not be used to set any of the known parameters
37203 /// which have their own setter method. If done anyway, the request will fail.
37204 ///
37205 /// # Additional Parameters
37206 ///
37207 /// * *$.xgafv* (query-string) - V1 error format.
37208 /// * *access_token* (query-string) - OAuth access token.
37209 /// * *alt* (query-string) - Data format for response.
37210 /// * *callback* (query-string) - JSONP
37211 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37212 /// * *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.
37213 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37214 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37215 /// * *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.
37216 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37217 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37218 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSpokeTestIamPermissionCall<'a, C>
37219 where
37220 T: AsRef<str>,
37221 {
37222 self._additional_params
37223 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37224 self
37225 }
37226
37227 /// Identifies the authorization scope for the method you are building.
37228 ///
37229 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37230 /// [`Scope::CloudPlatform`].
37231 ///
37232 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37233 /// tokens for more than one scope.
37234 ///
37235 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37236 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37237 /// sufficient, a read-write scope will do as well.
37238 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSpokeTestIamPermissionCall<'a, C>
37239 where
37240 St: AsRef<str>,
37241 {
37242 self._scopes.insert(String::from(scope.as_ref()));
37243 self
37244 }
37245 /// Identifies the authorization scope(s) for the method you are building.
37246 ///
37247 /// See [`Self::add_scope()`] for details.
37248 pub fn add_scopes<I, St>(
37249 mut self,
37250 scopes: I,
37251 ) -> ProjectLocationSpokeTestIamPermissionCall<'a, C>
37252 where
37253 I: IntoIterator<Item = St>,
37254 St: AsRef<str>,
37255 {
37256 self._scopes
37257 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37258 self
37259 }
37260
37261 /// Removes all scopes, and no default scope will be used either.
37262 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37263 /// for details).
37264 pub fn clear_scopes(mut self) -> ProjectLocationSpokeTestIamPermissionCall<'a, C> {
37265 self._scopes.clear();
37266 self
37267 }
37268}
37269
37270/// CheckConsumerConfig validates the consumer network and project for potential PSC connection creation. This method performs several checks, including: - Validating the existence and permissions of the service class. - Ensuring the consumer network exists and is accessible. - Verifying XPN relationships if applicable. - Checking for compatible IP versions between the consumer network and the requested version. This method performs a dynamic IAM check for the `networkconnectivity.serviceClasses.use` permission on the service class resource in the Prepare phase.
37271///
37272/// A builder for the *locations.checkConsumerConfig* method supported by a *project* resource.
37273/// It is not used directly, but through a [`ProjectMethods`] instance.
37274///
37275/// # Example
37276///
37277/// Instantiate a resource method builder
37278///
37279/// ```test_harness,no_run
37280/// # extern crate hyper;
37281/// # extern crate hyper_rustls;
37282/// # extern crate google_networkconnectivity1 as networkconnectivity1;
37283/// use networkconnectivity1::api::CheckConsumerConfigRequest;
37284/// # async fn dox() {
37285/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37286///
37287/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37288/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37289/// # .with_native_roots()
37290/// # .unwrap()
37291/// # .https_only()
37292/// # .enable_http2()
37293/// # .build();
37294///
37295/// # let executor = hyper_util::rt::TokioExecutor::new();
37296/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37297/// # secret,
37298/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37299/// # yup_oauth2::client::CustomHyperClientBuilder::from(
37300/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
37301/// # ),
37302/// # ).build().await.unwrap();
37303///
37304/// # let client = hyper_util::client::legacy::Client::builder(
37305/// # hyper_util::rt::TokioExecutor::new()
37306/// # )
37307/// # .build(
37308/// # hyper_rustls::HttpsConnectorBuilder::new()
37309/// # .with_native_roots()
37310/// # .unwrap()
37311/// # .https_or_http()
37312/// # .enable_http2()
37313/// # .build()
37314/// # );
37315/// # let mut hub = Networkconnectivity::new(client, auth);
37316/// // As the method needs a request, you would usually fill it with the desired information
37317/// // into the respective structure. Some of the parts shown here might not be applicable !
37318/// // Values shown here are possibly random and not representative !
37319/// let mut req = CheckConsumerConfigRequest::default();
37320///
37321/// // You can configure optional parameters by calling the respective setters at will, and
37322/// // execute the final call using `doit()`.
37323/// // Values shown here are possibly random and not representative !
37324/// let result = hub.projects().locations_check_consumer_config(req, "location")
37325/// .doit().await;
37326/// # }
37327/// ```
37328pub struct ProjectLocationCheckConsumerConfigCall<'a, C>
37329where
37330 C: 'a,
37331{
37332 hub: &'a Networkconnectivity<C>,
37333 _request: CheckConsumerConfigRequest,
37334 _location: String,
37335 _delegate: Option<&'a mut dyn common::Delegate>,
37336 _additional_params: HashMap<String, String>,
37337 _scopes: BTreeSet<String>,
37338}
37339
37340impl<'a, C> common::CallBuilder for ProjectLocationCheckConsumerConfigCall<'a, C> {}
37341
37342impl<'a, C> ProjectLocationCheckConsumerConfigCall<'a, C>
37343where
37344 C: common::Connector,
37345{
37346 /// Perform the operation you have build so far.
37347 pub async fn doit(mut self) -> common::Result<(common::Response, CheckConsumerConfigResponse)> {
37348 use std::borrow::Cow;
37349 use std::io::{Read, Seek};
37350
37351 use common::{url::Params, ToParts};
37352 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37353
37354 let mut dd = common::DefaultDelegate;
37355 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37356 dlg.begin(common::MethodInfo {
37357 id: "networkconnectivity.projects.locations.checkConsumerConfig",
37358 http_method: hyper::Method::POST,
37359 });
37360
37361 for &field in ["alt", "location"].iter() {
37362 if self._additional_params.contains_key(field) {
37363 dlg.finished(false);
37364 return Err(common::Error::FieldClash(field));
37365 }
37366 }
37367
37368 let mut params = Params::with_capacity(4 + self._additional_params.len());
37369 params.push("location", self._location);
37370
37371 params.extend(self._additional_params.iter());
37372
37373 params.push("alt", "json");
37374 let mut url = self.hub._base_url.clone() + "v1/{+location}:checkConsumerConfig";
37375 if self._scopes.is_empty() {
37376 self._scopes
37377 .insert(Scope::CloudPlatform.as_ref().to_string());
37378 }
37379
37380 #[allow(clippy::single_element_loop)]
37381 for &(find_this, param_name) in [("{+location}", "location")].iter() {
37382 url = params.uri_replacement(url, param_name, find_this, true);
37383 }
37384 {
37385 let to_remove = ["location"];
37386 params.remove_params(&to_remove);
37387 }
37388
37389 let url = params.parse_with_url(&url);
37390
37391 let mut json_mime_type = mime::APPLICATION_JSON;
37392 let mut request_value_reader = {
37393 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37394 common::remove_json_null_values(&mut value);
37395 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37396 serde_json::to_writer(&mut dst, &value).unwrap();
37397 dst
37398 };
37399 let request_size = request_value_reader
37400 .seek(std::io::SeekFrom::End(0))
37401 .unwrap();
37402 request_value_reader
37403 .seek(std::io::SeekFrom::Start(0))
37404 .unwrap();
37405
37406 loop {
37407 let token = match self
37408 .hub
37409 .auth
37410 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37411 .await
37412 {
37413 Ok(token) => token,
37414 Err(e) => match dlg.token(e) {
37415 Ok(token) => token,
37416 Err(e) => {
37417 dlg.finished(false);
37418 return Err(common::Error::MissingToken(e));
37419 }
37420 },
37421 };
37422 request_value_reader
37423 .seek(std::io::SeekFrom::Start(0))
37424 .unwrap();
37425 let mut req_result = {
37426 let client = &self.hub.client;
37427 dlg.pre_request();
37428 let mut req_builder = hyper::Request::builder()
37429 .method(hyper::Method::POST)
37430 .uri(url.as_str())
37431 .header(USER_AGENT, self.hub._user_agent.clone());
37432
37433 if let Some(token) = token.as_ref() {
37434 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37435 }
37436
37437 let request = req_builder
37438 .header(CONTENT_TYPE, json_mime_type.to_string())
37439 .header(CONTENT_LENGTH, request_size as u64)
37440 .body(common::to_body(
37441 request_value_reader.get_ref().clone().into(),
37442 ));
37443
37444 client.request(request.unwrap()).await
37445 };
37446
37447 match req_result {
37448 Err(err) => {
37449 if let common::Retry::After(d) = dlg.http_error(&err) {
37450 sleep(d).await;
37451 continue;
37452 }
37453 dlg.finished(false);
37454 return Err(common::Error::HttpError(err));
37455 }
37456 Ok(res) => {
37457 let (mut parts, body) = res.into_parts();
37458 let mut body = common::Body::new(body);
37459 if !parts.status.is_success() {
37460 let bytes = common::to_bytes(body).await.unwrap_or_default();
37461 let error = serde_json::from_str(&common::to_string(&bytes));
37462 let response = common::to_response(parts, bytes.into());
37463
37464 if let common::Retry::After(d) =
37465 dlg.http_failure(&response, error.as_ref().ok())
37466 {
37467 sleep(d).await;
37468 continue;
37469 }
37470
37471 dlg.finished(false);
37472
37473 return Err(match error {
37474 Ok(value) => common::Error::BadRequest(value),
37475 _ => common::Error::Failure(response),
37476 });
37477 }
37478 let response = {
37479 let bytes = common::to_bytes(body).await.unwrap_or_default();
37480 let encoded = common::to_string(&bytes);
37481 match serde_json::from_str(&encoded) {
37482 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37483 Err(error) => {
37484 dlg.response_json_decode_error(&encoded, &error);
37485 return Err(common::Error::JsonDecodeError(
37486 encoded.to_string(),
37487 error,
37488 ));
37489 }
37490 }
37491 };
37492
37493 dlg.finished(true);
37494 return Ok(response);
37495 }
37496 }
37497 }
37498 }
37499
37500 ///
37501 /// Sets the *request* property to the given value.
37502 ///
37503 /// Even though the property as already been set when instantiating this call,
37504 /// we provide this method for API completeness.
37505 pub fn request(
37506 mut self,
37507 new_value: CheckConsumerConfigRequest,
37508 ) -> ProjectLocationCheckConsumerConfigCall<'a, C> {
37509 self._request = new_value;
37510 self
37511 }
37512 /// Required. The location resource path. Example: - projects/{project}/locations/{location}
37513 ///
37514 /// Sets the *location* path property to the given value.
37515 ///
37516 /// Even though the property as already been set when instantiating this call,
37517 /// we provide this method for API completeness.
37518 pub fn location(mut self, new_value: &str) -> ProjectLocationCheckConsumerConfigCall<'a, C> {
37519 self._location = new_value.to_string();
37520 self
37521 }
37522 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37523 /// while executing the actual API request.
37524 ///
37525 /// ````text
37526 /// It should be used to handle progress information, and to implement a certain level of resilience.
37527 /// ````
37528 ///
37529 /// Sets the *delegate* property to the given value.
37530 pub fn delegate(
37531 mut self,
37532 new_value: &'a mut dyn common::Delegate,
37533 ) -> ProjectLocationCheckConsumerConfigCall<'a, C> {
37534 self._delegate = Some(new_value);
37535 self
37536 }
37537
37538 /// Set any additional parameter of the query string used in the request.
37539 /// It should be used to set parameters which are not yet available through their own
37540 /// setters.
37541 ///
37542 /// Please note that this method must not be used to set any of the known parameters
37543 /// which have their own setter method. If done anyway, the request will fail.
37544 ///
37545 /// # Additional Parameters
37546 ///
37547 /// * *$.xgafv* (query-string) - V1 error format.
37548 /// * *access_token* (query-string) - OAuth access token.
37549 /// * *alt* (query-string) - Data format for response.
37550 /// * *callback* (query-string) - JSONP
37551 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37552 /// * *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.
37553 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37554 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37555 /// * *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.
37556 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37557 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37558 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCheckConsumerConfigCall<'a, C>
37559 where
37560 T: AsRef<str>,
37561 {
37562 self._additional_params
37563 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37564 self
37565 }
37566
37567 /// Identifies the authorization scope for the method you are building.
37568 ///
37569 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37570 /// [`Scope::CloudPlatform`].
37571 ///
37572 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37573 /// tokens for more than one scope.
37574 ///
37575 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37576 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37577 /// sufficient, a read-write scope will do as well.
37578 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCheckConsumerConfigCall<'a, C>
37579 where
37580 St: AsRef<str>,
37581 {
37582 self._scopes.insert(String::from(scope.as_ref()));
37583 self
37584 }
37585 /// Identifies the authorization scope(s) for the method you are building.
37586 ///
37587 /// See [`Self::add_scope()`] for details.
37588 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCheckConsumerConfigCall<'a, C>
37589 where
37590 I: IntoIterator<Item = St>,
37591 St: AsRef<str>,
37592 {
37593 self._scopes
37594 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37595 self
37596 }
37597
37598 /// Removes all scopes, and no default scope will be used either.
37599 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37600 /// for details).
37601 pub fn clear_scopes(mut self) -> ProjectLocationCheckConsumerConfigCall<'a, C> {
37602 self._scopes.clear();
37603 self
37604 }
37605}
37606
37607/// Gets information about a location.
37608///
37609/// A builder for the *locations.get* method supported by a *project* resource.
37610/// It is not used directly, but through a [`ProjectMethods`] instance.
37611///
37612/// # Example
37613///
37614/// Instantiate a resource method builder
37615///
37616/// ```test_harness,no_run
37617/// # extern crate hyper;
37618/// # extern crate hyper_rustls;
37619/// # extern crate google_networkconnectivity1 as networkconnectivity1;
37620/// # async fn dox() {
37621/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37622///
37623/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37624/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37625/// # .with_native_roots()
37626/// # .unwrap()
37627/// # .https_only()
37628/// # .enable_http2()
37629/// # .build();
37630///
37631/// # let executor = hyper_util::rt::TokioExecutor::new();
37632/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37633/// # secret,
37634/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37635/// # yup_oauth2::client::CustomHyperClientBuilder::from(
37636/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
37637/// # ),
37638/// # ).build().await.unwrap();
37639///
37640/// # let client = hyper_util::client::legacy::Client::builder(
37641/// # hyper_util::rt::TokioExecutor::new()
37642/// # )
37643/// # .build(
37644/// # hyper_rustls::HttpsConnectorBuilder::new()
37645/// # .with_native_roots()
37646/// # .unwrap()
37647/// # .https_or_http()
37648/// # .enable_http2()
37649/// # .build()
37650/// # );
37651/// # let mut hub = Networkconnectivity::new(client, auth);
37652/// // You can configure optional parameters by calling the respective setters at will, and
37653/// // execute the final call using `doit()`.
37654/// // Values shown here are possibly random and not representative !
37655/// let result = hub.projects().locations_get("name")
37656/// .doit().await;
37657/// # }
37658/// ```
37659pub struct ProjectLocationGetCall<'a, C>
37660where
37661 C: 'a,
37662{
37663 hub: &'a Networkconnectivity<C>,
37664 _name: String,
37665 _delegate: Option<&'a mut dyn common::Delegate>,
37666 _additional_params: HashMap<String, String>,
37667 _scopes: BTreeSet<String>,
37668}
37669
37670impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
37671
37672impl<'a, C> ProjectLocationGetCall<'a, C>
37673where
37674 C: common::Connector,
37675{
37676 /// Perform the operation you have build so far.
37677 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
37678 use std::borrow::Cow;
37679 use std::io::{Read, Seek};
37680
37681 use common::{url::Params, ToParts};
37682 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37683
37684 let mut dd = common::DefaultDelegate;
37685 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37686 dlg.begin(common::MethodInfo {
37687 id: "networkconnectivity.projects.locations.get",
37688 http_method: hyper::Method::GET,
37689 });
37690
37691 for &field in ["alt", "name"].iter() {
37692 if self._additional_params.contains_key(field) {
37693 dlg.finished(false);
37694 return Err(common::Error::FieldClash(field));
37695 }
37696 }
37697
37698 let mut params = Params::with_capacity(3 + self._additional_params.len());
37699 params.push("name", self._name);
37700
37701 params.extend(self._additional_params.iter());
37702
37703 params.push("alt", "json");
37704 let mut url = self.hub._base_url.clone() + "v1/{+name}";
37705 if self._scopes.is_empty() {
37706 self._scopes
37707 .insert(Scope::CloudPlatform.as_ref().to_string());
37708 }
37709
37710 #[allow(clippy::single_element_loop)]
37711 for &(find_this, param_name) in [("{+name}", "name")].iter() {
37712 url = params.uri_replacement(url, param_name, find_this, true);
37713 }
37714 {
37715 let to_remove = ["name"];
37716 params.remove_params(&to_remove);
37717 }
37718
37719 let url = params.parse_with_url(&url);
37720
37721 loop {
37722 let token = match self
37723 .hub
37724 .auth
37725 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37726 .await
37727 {
37728 Ok(token) => token,
37729 Err(e) => match dlg.token(e) {
37730 Ok(token) => token,
37731 Err(e) => {
37732 dlg.finished(false);
37733 return Err(common::Error::MissingToken(e));
37734 }
37735 },
37736 };
37737 let mut req_result = {
37738 let client = &self.hub.client;
37739 dlg.pre_request();
37740 let mut req_builder = hyper::Request::builder()
37741 .method(hyper::Method::GET)
37742 .uri(url.as_str())
37743 .header(USER_AGENT, self.hub._user_agent.clone());
37744
37745 if let Some(token) = token.as_ref() {
37746 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37747 }
37748
37749 let request = req_builder
37750 .header(CONTENT_LENGTH, 0_u64)
37751 .body(common::to_body::<String>(None));
37752
37753 client.request(request.unwrap()).await
37754 };
37755
37756 match req_result {
37757 Err(err) => {
37758 if let common::Retry::After(d) = dlg.http_error(&err) {
37759 sleep(d).await;
37760 continue;
37761 }
37762 dlg.finished(false);
37763 return Err(common::Error::HttpError(err));
37764 }
37765 Ok(res) => {
37766 let (mut parts, body) = res.into_parts();
37767 let mut body = common::Body::new(body);
37768 if !parts.status.is_success() {
37769 let bytes = common::to_bytes(body).await.unwrap_or_default();
37770 let error = serde_json::from_str(&common::to_string(&bytes));
37771 let response = common::to_response(parts, bytes.into());
37772
37773 if let common::Retry::After(d) =
37774 dlg.http_failure(&response, error.as_ref().ok())
37775 {
37776 sleep(d).await;
37777 continue;
37778 }
37779
37780 dlg.finished(false);
37781
37782 return Err(match error {
37783 Ok(value) => common::Error::BadRequest(value),
37784 _ => common::Error::Failure(response),
37785 });
37786 }
37787 let response = {
37788 let bytes = common::to_bytes(body).await.unwrap_or_default();
37789 let encoded = common::to_string(&bytes);
37790 match serde_json::from_str(&encoded) {
37791 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37792 Err(error) => {
37793 dlg.response_json_decode_error(&encoded, &error);
37794 return Err(common::Error::JsonDecodeError(
37795 encoded.to_string(),
37796 error,
37797 ));
37798 }
37799 }
37800 };
37801
37802 dlg.finished(true);
37803 return Ok(response);
37804 }
37805 }
37806 }
37807 }
37808
37809 /// Resource name for the location.
37810 ///
37811 /// Sets the *name* path property to the given value.
37812 ///
37813 /// Even though the property as already been set when instantiating this call,
37814 /// we provide this method for API completeness.
37815 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
37816 self._name = new_value.to_string();
37817 self
37818 }
37819 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37820 /// while executing the actual API request.
37821 ///
37822 /// ````text
37823 /// It should be used to handle progress information, and to implement a certain level of resilience.
37824 /// ````
37825 ///
37826 /// Sets the *delegate* property to the given value.
37827 pub fn delegate(
37828 mut self,
37829 new_value: &'a mut dyn common::Delegate,
37830 ) -> ProjectLocationGetCall<'a, C> {
37831 self._delegate = Some(new_value);
37832 self
37833 }
37834
37835 /// Set any additional parameter of the query string used in the request.
37836 /// It should be used to set parameters which are not yet available through their own
37837 /// setters.
37838 ///
37839 /// Please note that this method must not be used to set any of the known parameters
37840 /// which have their own setter method. If done anyway, the request will fail.
37841 ///
37842 /// # Additional Parameters
37843 ///
37844 /// * *$.xgafv* (query-string) - V1 error format.
37845 /// * *access_token* (query-string) - OAuth access token.
37846 /// * *alt* (query-string) - Data format for response.
37847 /// * *callback* (query-string) - JSONP
37848 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37849 /// * *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.
37850 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37851 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37852 /// * *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.
37853 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37854 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37855 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
37856 where
37857 T: AsRef<str>,
37858 {
37859 self._additional_params
37860 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37861 self
37862 }
37863
37864 /// Identifies the authorization scope for the method you are building.
37865 ///
37866 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37867 /// [`Scope::CloudPlatform`].
37868 ///
37869 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37870 /// tokens for more than one scope.
37871 ///
37872 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37873 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37874 /// sufficient, a read-write scope will do as well.
37875 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
37876 where
37877 St: AsRef<str>,
37878 {
37879 self._scopes.insert(String::from(scope.as_ref()));
37880 self
37881 }
37882 /// Identifies the authorization scope(s) for the method you are building.
37883 ///
37884 /// See [`Self::add_scope()`] for details.
37885 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
37886 where
37887 I: IntoIterator<Item = St>,
37888 St: AsRef<str>,
37889 {
37890 self._scopes
37891 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37892 self
37893 }
37894
37895 /// Removes all scopes, and no default scope will be used either.
37896 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37897 /// for details).
37898 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
37899 self._scopes.clear();
37900 self
37901 }
37902}
37903
37904/// Lists information about the supported locations for this service.
37905///
37906/// A builder for the *locations.list* method supported by a *project* resource.
37907/// It is not used directly, but through a [`ProjectMethods`] instance.
37908///
37909/// # Example
37910///
37911/// Instantiate a resource method builder
37912///
37913/// ```test_harness,no_run
37914/// # extern crate hyper;
37915/// # extern crate hyper_rustls;
37916/// # extern crate google_networkconnectivity1 as networkconnectivity1;
37917/// # async fn dox() {
37918/// # use networkconnectivity1::{Networkconnectivity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37919///
37920/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37921/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
37922/// # .with_native_roots()
37923/// # .unwrap()
37924/// # .https_only()
37925/// # .enable_http2()
37926/// # .build();
37927///
37928/// # let executor = hyper_util::rt::TokioExecutor::new();
37929/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
37930/// # secret,
37931/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37932/// # yup_oauth2::client::CustomHyperClientBuilder::from(
37933/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
37934/// # ),
37935/// # ).build().await.unwrap();
37936///
37937/// # let client = hyper_util::client::legacy::Client::builder(
37938/// # hyper_util::rt::TokioExecutor::new()
37939/// # )
37940/// # .build(
37941/// # hyper_rustls::HttpsConnectorBuilder::new()
37942/// # .with_native_roots()
37943/// # .unwrap()
37944/// # .https_or_http()
37945/// # .enable_http2()
37946/// # .build()
37947/// # );
37948/// # let mut hub = Networkconnectivity::new(client, auth);
37949/// // You can configure optional parameters by calling the respective setters at will, and
37950/// // execute the final call using `doit()`.
37951/// // Values shown here are possibly random and not representative !
37952/// let result = hub.projects().locations_list("name")
37953/// .page_token("clita")
37954/// .page_size(-99)
37955/// .filter("aliquyam")
37956/// .add_extra_location_types("magna")
37957/// .doit().await;
37958/// # }
37959/// ```
37960pub struct ProjectLocationListCall<'a, C>
37961where
37962 C: 'a,
37963{
37964 hub: &'a Networkconnectivity<C>,
37965 _name: String,
37966 _page_token: Option<String>,
37967 _page_size: Option<i32>,
37968 _filter: Option<String>,
37969 _extra_location_types: Vec<String>,
37970 _delegate: Option<&'a mut dyn common::Delegate>,
37971 _additional_params: HashMap<String, String>,
37972 _scopes: BTreeSet<String>,
37973}
37974
37975impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
37976
37977impl<'a, C> ProjectLocationListCall<'a, C>
37978where
37979 C: common::Connector,
37980{
37981 /// Perform the operation you have build so far.
37982 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
37983 use std::borrow::Cow;
37984 use std::io::{Read, Seek};
37985
37986 use common::{url::Params, ToParts};
37987 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37988
37989 let mut dd = common::DefaultDelegate;
37990 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37991 dlg.begin(common::MethodInfo {
37992 id: "networkconnectivity.projects.locations.list",
37993 http_method: hyper::Method::GET,
37994 });
37995
37996 for &field in [
37997 "alt",
37998 "name",
37999 "pageToken",
38000 "pageSize",
38001 "filter",
38002 "extraLocationTypes",
38003 ]
38004 .iter()
38005 {
38006 if self._additional_params.contains_key(field) {
38007 dlg.finished(false);
38008 return Err(common::Error::FieldClash(field));
38009 }
38010 }
38011
38012 let mut params = Params::with_capacity(7 + self._additional_params.len());
38013 params.push("name", self._name);
38014 if let Some(value) = self._page_token.as_ref() {
38015 params.push("pageToken", value);
38016 }
38017 if let Some(value) = self._page_size.as_ref() {
38018 params.push("pageSize", value.to_string());
38019 }
38020 if let Some(value) = self._filter.as_ref() {
38021 params.push("filter", value);
38022 }
38023 if !self._extra_location_types.is_empty() {
38024 for f in self._extra_location_types.iter() {
38025 params.push("extraLocationTypes", f);
38026 }
38027 }
38028
38029 params.extend(self._additional_params.iter());
38030
38031 params.push("alt", "json");
38032 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
38033 if self._scopes.is_empty() {
38034 self._scopes
38035 .insert(Scope::CloudPlatform.as_ref().to_string());
38036 }
38037
38038 #[allow(clippy::single_element_loop)]
38039 for &(find_this, param_name) in [("{+name}", "name")].iter() {
38040 url = params.uri_replacement(url, param_name, find_this, true);
38041 }
38042 {
38043 let to_remove = ["name"];
38044 params.remove_params(&to_remove);
38045 }
38046
38047 let url = params.parse_with_url(&url);
38048
38049 loop {
38050 let token = match self
38051 .hub
38052 .auth
38053 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38054 .await
38055 {
38056 Ok(token) => token,
38057 Err(e) => match dlg.token(e) {
38058 Ok(token) => token,
38059 Err(e) => {
38060 dlg.finished(false);
38061 return Err(common::Error::MissingToken(e));
38062 }
38063 },
38064 };
38065 let mut req_result = {
38066 let client = &self.hub.client;
38067 dlg.pre_request();
38068 let mut req_builder = hyper::Request::builder()
38069 .method(hyper::Method::GET)
38070 .uri(url.as_str())
38071 .header(USER_AGENT, self.hub._user_agent.clone());
38072
38073 if let Some(token) = token.as_ref() {
38074 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38075 }
38076
38077 let request = req_builder
38078 .header(CONTENT_LENGTH, 0_u64)
38079 .body(common::to_body::<String>(None));
38080
38081 client.request(request.unwrap()).await
38082 };
38083
38084 match req_result {
38085 Err(err) => {
38086 if let common::Retry::After(d) = dlg.http_error(&err) {
38087 sleep(d).await;
38088 continue;
38089 }
38090 dlg.finished(false);
38091 return Err(common::Error::HttpError(err));
38092 }
38093 Ok(res) => {
38094 let (mut parts, body) = res.into_parts();
38095 let mut body = common::Body::new(body);
38096 if !parts.status.is_success() {
38097 let bytes = common::to_bytes(body).await.unwrap_or_default();
38098 let error = serde_json::from_str(&common::to_string(&bytes));
38099 let response = common::to_response(parts, bytes.into());
38100
38101 if let common::Retry::After(d) =
38102 dlg.http_failure(&response, error.as_ref().ok())
38103 {
38104 sleep(d).await;
38105 continue;
38106 }
38107
38108 dlg.finished(false);
38109
38110 return Err(match error {
38111 Ok(value) => common::Error::BadRequest(value),
38112 _ => common::Error::Failure(response),
38113 });
38114 }
38115 let response = {
38116 let bytes = common::to_bytes(body).await.unwrap_or_default();
38117 let encoded = common::to_string(&bytes);
38118 match serde_json::from_str(&encoded) {
38119 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38120 Err(error) => {
38121 dlg.response_json_decode_error(&encoded, &error);
38122 return Err(common::Error::JsonDecodeError(
38123 encoded.to_string(),
38124 error,
38125 ));
38126 }
38127 }
38128 };
38129
38130 dlg.finished(true);
38131 return Ok(response);
38132 }
38133 }
38134 }
38135 }
38136
38137 /// The resource that owns the locations collection, if applicable.
38138 ///
38139 /// Sets the *name* path property to the given value.
38140 ///
38141 /// Even though the property as already been set when instantiating this call,
38142 /// we provide this method for API completeness.
38143 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
38144 self._name = new_value.to_string();
38145 self
38146 }
38147 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
38148 ///
38149 /// Sets the *page token* query property to the given value.
38150 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
38151 self._page_token = Some(new_value.to_string());
38152 self
38153 }
38154 /// The maximum number of results to return. If not set, the service selects a default.
38155 ///
38156 /// Sets the *page size* query property to the given value.
38157 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
38158 self._page_size = Some(new_value);
38159 self
38160 }
38161 /// 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).
38162 ///
38163 /// Sets the *filter* query property to the given value.
38164 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
38165 self._filter = Some(new_value.to_string());
38166 self
38167 }
38168 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
38169 ///
38170 /// Append the given value to the *extra location types* query property.
38171 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
38172 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
38173 self._extra_location_types.push(new_value.to_string());
38174 self
38175 }
38176 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38177 /// while executing the actual API request.
38178 ///
38179 /// ````text
38180 /// It should be used to handle progress information, and to implement a certain level of resilience.
38181 /// ````
38182 ///
38183 /// Sets the *delegate* property to the given value.
38184 pub fn delegate(
38185 mut self,
38186 new_value: &'a mut dyn common::Delegate,
38187 ) -> ProjectLocationListCall<'a, C> {
38188 self._delegate = Some(new_value);
38189 self
38190 }
38191
38192 /// Set any additional parameter of the query string used in the request.
38193 /// It should be used to set parameters which are not yet available through their own
38194 /// setters.
38195 ///
38196 /// Please note that this method must not be used to set any of the known parameters
38197 /// which have their own setter method. If done anyway, the request will fail.
38198 ///
38199 /// # Additional Parameters
38200 ///
38201 /// * *$.xgafv* (query-string) - V1 error format.
38202 /// * *access_token* (query-string) - OAuth access token.
38203 /// * *alt* (query-string) - Data format for response.
38204 /// * *callback* (query-string) - JSONP
38205 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38206 /// * *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.
38207 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38208 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38209 /// * *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.
38210 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38211 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38212 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
38213 where
38214 T: AsRef<str>,
38215 {
38216 self._additional_params
38217 .insert(name.as_ref().to_string(), value.as_ref().to_string());
38218 self
38219 }
38220
38221 /// Identifies the authorization scope for the method you are building.
38222 ///
38223 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38224 /// [`Scope::CloudPlatform`].
38225 ///
38226 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38227 /// tokens for more than one scope.
38228 ///
38229 /// Usually there is more than one suitable scope to authorize an operation, some of which may
38230 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38231 /// sufficient, a read-write scope will do as well.
38232 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
38233 where
38234 St: AsRef<str>,
38235 {
38236 self._scopes.insert(String::from(scope.as_ref()));
38237 self
38238 }
38239 /// Identifies the authorization scope(s) for the method you are building.
38240 ///
38241 /// See [`Self::add_scope()`] for details.
38242 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
38243 where
38244 I: IntoIterator<Item = St>,
38245 St: AsRef<str>,
38246 {
38247 self._scopes
38248 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38249 self
38250 }
38251
38252 /// Removes all scopes, and no default scope will be used either.
38253 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38254 /// for details).
38255 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
38256 self._scopes.clear();
38257 self
38258 }
38259}