google_gameservices1/
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 GameServices 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_gameservices1 as gameservices1;
49/// use gameservices1::{Result, Error};
50/// # async fn dox() {
51/// use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace  `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62///     .with_native_roots()
63///     .unwrap()
64///     .https_only()
65///     .enable_http2()
66///     .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70///     secret,
71///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72///     yup_oauth2::client::CustomHyperClientBuilder::from(
73///         hyper_util::client::legacy::Client::builder(executor).build(connector),
74///     ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78///     hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81///     hyper_rustls::HttpsConnectorBuilder::new()
82///         .with_native_roots()
83///         .unwrap()
84///         .https_or_http()
85///         .enable_http2()
86///         .build()
87/// );
88/// let mut hub = GameServices::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.projects().locations_game_server_deployments_get_iam_policy("resource")
93///              .options_requested_policy_version(-27)
94///              .doit().await;
95///
96/// match result {
97///     Err(e) => match e {
98///         // The Error enum provides details about what exactly happened.
99///         // You can also just use its `Debug`, `Display` or `Error` traits
100///          Error::HttpError(_)
101///         |Error::Io(_)
102///         |Error::MissingAPIKey
103///         |Error::MissingToken(_)
104///         |Error::Cancelled
105///         |Error::UploadSizeLimitExceeded(_, _)
106///         |Error::Failure(_)
107///         |Error::BadRequest(_)
108///         |Error::FieldClash(_)
109///         |Error::JsonDecodeError(_, _) => println!("{}", e),
110///     },
111///     Ok(res) => println!("Success: {:?}", res),
112/// }
113/// # }
114/// ```
115#[derive(Clone)]
116pub struct GameServices<C> {
117    pub client: common::Client<C>,
118    pub auth: Box<dyn common::GetToken>,
119    _user_agent: String,
120    _base_url: String,
121    _root_url: String,
122}
123
124impl<C> common::Hub for GameServices<C> {}
125
126impl<'a, C> GameServices<C> {
127    pub fn new<A: 'static + common::GetToken>(
128        client: common::Client<C>,
129        auth: A,
130    ) -> GameServices<C> {
131        GameServices {
132            client,
133            auth: Box::new(auth),
134            _user_agent: "google-api-rust-client/7.0.0".to_string(),
135            _base_url: "https://gameservices.googleapis.com/".to_string(),
136            _root_url: "https://gameservices.googleapis.com/".to_string(),
137        }
138    }
139
140    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
141        ProjectMethods { hub: self }
142    }
143
144    /// Set the user-agent header field to use in all requests to the server.
145    /// It defaults to `google-api-rust-client/7.0.0`.
146    ///
147    /// Returns the previously set user-agent.
148    pub fn user_agent(&mut self, agent_name: String) -> String {
149        std::mem::replace(&mut self._user_agent, agent_name)
150    }
151
152    /// Set the base url to use in all requests to the server.
153    /// It defaults to `https://gameservices.googleapis.com/`.
154    ///
155    /// Returns the previously set base url.
156    pub fn base_url(&mut self, new_base_url: String) -> String {
157        std::mem::replace(&mut self._base_url, new_base_url)
158    }
159
160    /// Set the root url to use in all requests to the server.
161    /// It defaults to `https://gameservices.googleapis.com/`.
162    ///
163    /// Returns the previously set root url.
164    pub fn root_url(&mut self, new_root_url: String) -> String {
165        std::mem::replace(&mut self._root_url, new_root_url)
166    }
167}
168
169// ############
170// SCHEMAS ###
171// ##########
172/// 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.
173///
174/// This type is not used in any activity, and only used as *part* of another schema.
175///
176#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
177#[serde_with::serde_as]
178#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
179pub struct AuditConfig {
180    /// The configuration for logging of each type of permission.
181    #[serde(rename = "auditLogConfigs")]
182    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
183    /// 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.
184    pub service: Option<String>,
185}
186
187impl common::Part for AuditConfig {}
188
189/// 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.
190///
191/// This type is not used in any activity, and only used as *part* of another schema.
192///
193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
194#[serde_with::serde_as]
195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
196pub struct AuditLogConfig {
197    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
198    #[serde(rename = "exemptedMembers")]
199    pub exempted_members: Option<Vec<String>>,
200    /// no description provided
201    #[serde(rename = "ignoreChildExemptions")]
202    pub ignore_child_exemptions: Option<bool>,
203    /// The log type that this config enables.
204    #[serde(rename = "logType")]
205    pub log_type: Option<String>,
206}
207
208impl common::Part for AuditLogConfig {}
209
210/// Authorization-related information used by Cloud Audit Logging.
211///
212/// This type is not used in any activity, and only used as *part* of another schema.
213///
214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
215#[serde_with::serde_as]
216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
217pub struct AuthorizationLoggingOptions {
218    /// The type of the permission that was checked.
219    #[serde(rename = "permissionType")]
220    pub permission_type: Option<String>,
221}
222
223impl common::Part for AuthorizationLoggingOptions {}
224
225/// Associates `members`, or principals, with a `role`.
226///
227/// This type is not used in any activity, and only used as *part* of another schema.
228///
229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
230#[serde_with::serde_as]
231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
232pub struct Binding {
233    /// no description provided
234    #[serde(rename = "bindingId")]
235    pub binding_id: Option<String>,
236    /// 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).
237    pub condition: Option<Expr>,
238    /// 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`. * `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. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`.
239    pub members: Option<Vec<String>>,
240    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
241    pub role: Option<String>,
242}
243
244impl common::Part for Binding {}
245
246/// The request message for Operations.CancelOperation.
247///
248/// # Activities
249///
250/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
251/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
252///
253/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
255#[serde_with::serde_as]
256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
257pub struct CancelOperationRequest {
258    _never_set: Option<bool>,
259}
260
261impl common::RequestValue for CancelOperationRequest {}
262
263/// Write a Cloud Audit log
264///
265/// This type is not used in any activity, and only used as *part* of another schema.
266///
267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
268#[serde_with::serde_as]
269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
270pub struct CloudAuditOptions {
271    /// Information used by the Cloud Audit Logging pipeline.
272    #[serde(rename = "authorizationLoggingOptions")]
273    pub authorization_logging_options: Option<AuthorizationLoggingOptions>,
274    /// The log_name to populate in the Cloud Audit Record.
275    #[serde(rename = "logName")]
276    pub log_name: Option<String>,
277}
278
279impl common::Part for CloudAuditOptions {}
280
281/// A condition to be met.
282///
283/// This type is not used in any activity, and only used as *part* of another schema.
284///
285#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
286#[serde_with::serde_as]
287#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
288pub struct Condition {
289    /// Trusted attributes supplied by the IAM system.
290    pub iam: Option<String>,
291    /// An operator to apply the subject with.
292    pub op: Option<String>,
293    /// Trusted attributes discharged by the service.
294    pub svc: Option<String>,
295    /// Trusted attributes supplied by any service that owns resources and uses the IAM system for access control.
296    pub sys: Option<String>,
297    /// The objects of the condition.
298    pub values: Option<Vec<String>>,
299}
300
301impl common::Part for Condition {}
302
303/// Increment a streamz counter with the specified metric and field names. Metric names should start with a '/', generally be lowercase-only, and end in "_count". Field names should not contain an initial slash. The actual exported metric names will have "/iam/policy" prepended. Field names correspond to IAM request parameters and field values are their respective values. Supported field names: - "authority", which is "[token]" if IAMContext.token is present, otherwise the value of IAMContext.authority_selector if present, and otherwise a representation of IAMContext.principal; or - "iam_principal", a representation of IAMContext.principal even if a token or authority selector is present; or - "" (empty string), resulting in a counter with no fields. Examples: counter { metric: "/debug_access_count" field: "iam_principal" } ==> increment counter /iam/policy/debug_access_count {iam_principal=[value of IAMContext.principal]}
304///
305/// This type is not used in any activity, and only used as *part* of another schema.
306///
307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
308#[serde_with::serde_as]
309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
310pub struct CounterOptions {
311    /// Custom fields.
312    #[serde(rename = "customFields")]
313    pub custom_fields: Option<Vec<CustomField>>,
314    /// The field value to attribute.
315    pub field: Option<String>,
316    /// The metric to update.
317    pub metric: Option<String>,
318}
319
320impl common::Part for CounterOptions {}
321
322/// Custom fields. These can be used to create a counter with arbitrary field/value pairs. See: go/rpcsp-custom-fields.
323///
324/// This type is not used in any activity, and only used as *part* of another schema.
325///
326#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
327#[serde_with::serde_as]
328#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
329pub struct CustomField {
330    /// Name is the field name.
331    pub name: Option<String>,
332    /// Value is the field value. It is important that in contrast to the CounterOptions.field, the value here is a constant that is not derived from the IAMContext.
333    pub value: Option<String>,
334}
335
336impl common::Part for CustomField {}
337
338/// Write a Data Access (Gin) log
339///
340/// This type is not used in any activity, and only used as *part* of another schema.
341///
342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
343#[serde_with::serde_as]
344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
345pub struct DataAccessOptions {
346    /// no description provided
347    #[serde(rename = "logMode")]
348    pub log_mode: Option<String>,
349}
350
351impl common::Part for DataAccessOptions {}
352
353/// 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); }
354///
355/// # Activities
356///
357/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
358/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
359///
360/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
361/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
362#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
363#[serde_with::serde_as]
364#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
365pub struct Empty {
366    _never_set: Option<bool>,
367}
368
369impl common::ResponseResult for Empty {}
370
371/// 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.
372///
373/// This type is not used in any activity, and only used as *part* of another schema.
374///
375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
376#[serde_with::serde_as]
377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
378pub struct Expr {
379    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
380    pub description: Option<String>,
381    /// Textual representation of an expression in Common Expression Language syntax.
382    pub expression: Option<String>,
383    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
384    pub location: Option<String>,
385    /// 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.
386    pub title: Option<String>,
387}
388
389impl common::Part for Expr {}
390
391/// The response message for Locations.ListLocations.
392///
393/// # Activities
394///
395/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
396/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
397///
398/// * [locations list projects](ProjectLocationListCall) (response)
399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
400#[serde_with::serde_as]
401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
402pub struct ListLocationsResponse {
403    /// A list of locations that matches the specified filter in the request.
404    pub locations: Option<Vec<Location>>,
405    /// The standard List next-page token.
406    #[serde(rename = "nextPageToken")]
407    pub next_page_token: Option<String>,
408}
409
410impl common::ResponseResult for ListLocationsResponse {}
411
412/// The response message for Operations.ListOperations.
413///
414/// # Activities
415///
416/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
417/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
418///
419/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
421#[serde_with::serde_as]
422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
423pub struct ListOperationsResponse {
424    /// The standard List next-page token.
425    #[serde(rename = "nextPageToken")]
426    pub next_page_token: Option<String>,
427    /// A list of operations that matches the specified filter in the request.
428    pub operations: Option<Vec<Operation>>,
429}
430
431impl common::ResponseResult for ListOperationsResponse {}
432
433/// A resource that represents Google Cloud Platform location.
434///
435/// # Activities
436///
437/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
438/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
439///
440/// * [locations get projects](ProjectLocationGetCall) (response)
441#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
442#[serde_with::serde_as]
443#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
444pub struct Location {
445    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
446    #[serde(rename = "displayName")]
447    pub display_name: Option<String>,
448    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
449    pub labels: Option<HashMap<String, String>>,
450    /// The canonical id for this location. For example: `"us-east1"`.
451    #[serde(rename = "locationId")]
452    pub location_id: Option<String>,
453    /// Service-specific metadata. For example the available capacity at the given location.
454    pub metadata: Option<HashMap<String, serde_json::Value>>,
455    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
456    pub name: Option<String>,
457}
458
459impl common::ResponseResult for Location {}
460
461/// Specifies what kind of log the caller must write
462///
463/// This type is not used in any activity, and only used as *part* of another schema.
464///
465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
466#[serde_with::serde_as]
467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
468pub struct LogConfig {
469    /// Cloud audit options.
470    #[serde(rename = "cloudAudit")]
471    pub cloud_audit: Option<CloudAuditOptions>,
472    /// Counter options.
473    pub counter: Option<CounterOptions>,
474    /// Data access options.
475    #[serde(rename = "dataAccess")]
476    pub data_access: Option<DataAccessOptions>,
477}
478
479impl common::Part for LogConfig {}
480
481/// This resource represents a long-running operation that is the result of a network API call.
482///
483/// # Activities
484///
485/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
486/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
487///
488/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
490#[serde_with::serde_as]
491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
492pub struct Operation {
493    /// 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.
494    pub done: Option<bool>,
495    /// The error result of the operation in case of failure or cancellation.
496    pub error: Option<Status>,
497    /// 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.
498    pub metadata: Option<HashMap<String, serde_json::Value>>,
499    /// 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}`.
500    pub name: Option<String>,
501    /// The normal response of the operation in case of success. 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`.
502    pub response: Option<HashMap<String, serde_json::Value>>,
503}
504
505impl common::ResponseResult for Operation {}
506
507/// 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/).
508///
509/// # Activities
510///
511/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
512/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
513///
514/// * [locations game server deployments get iam policy projects](ProjectLocationGameServerDeploymentGetIamPolicyCall) (response)
515/// * [locations game server deployments set iam policy projects](ProjectLocationGameServerDeploymentSetIamPolicyCall) (response)
516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
517#[serde_with::serde_as]
518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
519pub struct Policy {
520    /// Specifies cloud audit logging configuration for this policy.
521    #[serde(rename = "auditConfigs")]
522    pub audit_configs: Option<Vec<AuditConfig>>,
523    /// 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`.
524    pub bindings: Option<Vec<Binding>>,
525    /// `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.
526    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
527    pub etag: Option<Vec<u8>>,
528    /// If more than one rule is specified, the rules are applied in the following manner: - All matching LOG rules are always applied. - If any DENY/DENY_WITH_LOG rule matches, permission is denied. Logging will be applied if one or more matching rule requires logging. - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is granted. Logging will be applied if one or more matching rule requires logging. - Otherwise, if no rule applies, permission is denied.
529    pub rules: Option<Vec<Rule>>,
530    /// 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).
531    pub version: Option<i32>,
532}
533
534impl common::ResponseResult for Policy {}
535
536/// A rule to be applied in a Policy.
537///
538/// This type is not used in any activity, and only used as *part* of another schema.
539///
540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
541#[serde_with::serde_as]
542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
543pub struct Rule {
544    /// Required
545    pub action: Option<String>,
546    /// Additional restrictions that must be met. All conditions must pass for the rule to match.
547    pub conditions: Option<Vec<Condition>>,
548    /// Human-readable description of the rule.
549    pub description: Option<String>,
550    /// If one or more 'in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries.
551    #[serde(rename = "in")]
552    pub in_: Option<Vec<String>>,
553    /// The config returned to callers of CheckPolicy for any entries that match the LOG action.
554    #[serde(rename = "logConfig")]
555    pub log_config: Option<Vec<LogConfig>>,
556    /// If one or more 'not_in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries. The format for in and not_in entries can be found at in the Local IAM documentation (see go/local-iam#features).
557    #[serde(rename = "notIn")]
558    pub not_in: Option<Vec<String>>,
559    /// A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.
560    pub permissions: Option<Vec<String>>,
561}
562
563impl common::Part for Rule {}
564
565/// Request message for `SetIamPolicy` method.
566///
567/// # Activities
568///
569/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
570/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
571///
572/// * [locations game server deployments set iam policy projects](ProjectLocationGameServerDeploymentSetIamPolicyCall) (request)
573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
574#[serde_with::serde_as]
575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
576pub struct SetIamPolicyRequest {
577    /// 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.
578    pub policy: Option<Policy>,
579    /// 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"`
580    #[serde(rename = "updateMask")]
581    pub update_mask: Option<common::FieldMask>,
582}
583
584impl common::RequestValue for SetIamPolicyRequest {}
585
586/// 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).
587///
588/// This type is not used in any activity, and only used as *part* of another schema.
589///
590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
591#[serde_with::serde_as]
592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
593pub struct Status {
594    /// The status code, which should be an enum value of google.rpc.Code.
595    pub code: Option<i32>,
596    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
597    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
598    /// 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.
599    pub message: Option<String>,
600}
601
602impl common::Part for Status {}
603
604/// Request message for `TestIamPermissions` method.
605///
606/// # Activities
607///
608/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
609/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
610///
611/// * [locations game server deployments test iam permissions projects](ProjectLocationGameServerDeploymentTestIamPermissionCall) (request)
612#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
613#[serde_with::serde_as]
614#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
615pub struct TestIamPermissionsRequest {
616    /// 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).
617    pub permissions: Option<Vec<String>>,
618}
619
620impl common::RequestValue for TestIamPermissionsRequest {}
621
622/// Response message for `TestIamPermissions` method.
623///
624/// # Activities
625///
626/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
627/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
628///
629/// * [locations game server deployments test iam permissions projects](ProjectLocationGameServerDeploymentTestIamPermissionCall) (response)
630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
631#[serde_with::serde_as]
632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
633pub struct TestIamPermissionsResponse {
634    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
635    pub permissions: Option<Vec<String>>,
636}
637
638impl common::ResponseResult for TestIamPermissionsResponse {}
639
640// ###################
641// MethodBuilders ###
642// #################
643
644/// A builder providing access to all methods supported on *project* resources.
645/// It is not used directly, but through the [`GameServices`] hub.
646///
647/// # Example
648///
649/// Instantiate a resource builder
650///
651/// ```test_harness,no_run
652/// extern crate hyper;
653/// extern crate hyper_rustls;
654/// extern crate google_gameservices1 as gameservices1;
655///
656/// # async fn dox() {
657/// use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
658///
659/// let secret: yup_oauth2::ApplicationSecret = Default::default();
660/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
661///     .with_native_roots()
662///     .unwrap()
663///     .https_only()
664///     .enable_http2()
665///     .build();
666///
667/// let executor = hyper_util::rt::TokioExecutor::new();
668/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
669///     secret,
670///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
671///     yup_oauth2::client::CustomHyperClientBuilder::from(
672///         hyper_util::client::legacy::Client::builder(executor).build(connector),
673///     ),
674/// ).build().await.unwrap();
675///
676/// let client = hyper_util::client::legacy::Client::builder(
677///     hyper_util::rt::TokioExecutor::new()
678/// )
679/// .build(
680///     hyper_rustls::HttpsConnectorBuilder::new()
681///         .with_native_roots()
682///         .unwrap()
683///         .https_or_http()
684///         .enable_http2()
685///         .build()
686/// );
687/// let mut hub = GameServices::new(client, auth);
688/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
689/// // like `locations_game_server_deployments_get_iam_policy(...)`, `locations_game_server_deployments_set_iam_policy(...)`, `locations_game_server_deployments_test_iam_permissions(...)`, `locations_get(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)`
690/// // to build up your call.
691/// let rb = hub.projects();
692/// # }
693/// ```
694pub struct ProjectMethods<'a, C>
695where
696    C: 'a,
697{
698    hub: &'a GameServices<C>,
699}
700
701impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
702
703impl<'a, C> ProjectMethods<'a, C> {
704    /// Create a builder to help you perform the following task:
705    ///
706    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
707    ///
708    /// # Arguments
709    ///
710    /// * `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.
711    pub fn locations_game_server_deployments_get_iam_policy(
712        &self,
713        resource: &str,
714    ) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C> {
715        ProjectLocationGameServerDeploymentGetIamPolicyCall {
716            hub: self.hub,
717            _resource: resource.to_string(),
718            _options_requested_policy_version: Default::default(),
719            _delegate: Default::default(),
720            _additional_params: Default::default(),
721            _scopes: Default::default(),
722        }
723    }
724
725    /// Create a builder to help you perform the following task:
726    ///
727    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
728    ///
729    /// # Arguments
730    ///
731    /// * `request` - No description provided.
732    /// * `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.
733    pub fn locations_game_server_deployments_set_iam_policy(
734        &self,
735        request: SetIamPolicyRequest,
736        resource: &str,
737    ) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C> {
738        ProjectLocationGameServerDeploymentSetIamPolicyCall {
739            hub: self.hub,
740            _request: request,
741            _resource: resource.to_string(),
742            _delegate: Default::default(),
743            _additional_params: Default::default(),
744            _scopes: Default::default(),
745        }
746    }
747
748    /// Create a builder to help you perform the following task:
749    ///
750    /// 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.
751    ///
752    /// # Arguments
753    ///
754    /// * `request` - No description provided.
755    /// * `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.
756    pub fn locations_game_server_deployments_test_iam_permissions(
757        &self,
758        request: TestIamPermissionsRequest,
759        resource: &str,
760    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C> {
761        ProjectLocationGameServerDeploymentTestIamPermissionCall {
762            hub: self.hub,
763            _request: request,
764            _resource: resource.to_string(),
765            _delegate: Default::default(),
766            _additional_params: Default::default(),
767            _scopes: Default::default(),
768        }
769    }
770
771    /// Create a builder to help you perform the following task:
772    ///
773    /// 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`.
774    ///
775    /// # Arguments
776    ///
777    /// * `request` - No description provided.
778    /// * `name` - The name of the operation resource to be cancelled.
779    pub fn locations_operations_cancel(
780        &self,
781        request: CancelOperationRequest,
782        name: &str,
783    ) -> ProjectLocationOperationCancelCall<'a, C> {
784        ProjectLocationOperationCancelCall {
785            hub: self.hub,
786            _request: request,
787            _name: name.to_string(),
788            _delegate: Default::default(),
789            _additional_params: Default::default(),
790            _scopes: Default::default(),
791        }
792    }
793
794    /// Create a builder to help you perform the following task:
795    ///
796    /// 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`.
797    ///
798    /// # Arguments
799    ///
800    /// * `name` - The name of the operation resource to be deleted.
801    pub fn locations_operations_delete(
802        &self,
803        name: &str,
804    ) -> ProjectLocationOperationDeleteCall<'a, C> {
805        ProjectLocationOperationDeleteCall {
806            hub: self.hub,
807            _name: name.to_string(),
808            _delegate: Default::default(),
809            _additional_params: Default::default(),
810            _scopes: Default::default(),
811        }
812    }
813
814    /// Create a builder to help you perform the following task:
815    ///
816    /// 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.
817    ///
818    /// # Arguments
819    ///
820    /// * `name` - The name of the operation resource.
821    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
822        ProjectLocationOperationGetCall {
823            hub: self.hub,
824            _name: name.to_string(),
825            _delegate: Default::default(),
826            _additional_params: Default::default(),
827            _scopes: Default::default(),
828        }
829    }
830
831    /// Create a builder to help you perform the following task:
832    ///
833    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
834    ///
835    /// # Arguments
836    ///
837    /// * `name` - The name of the operation's parent resource.
838    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
839        ProjectLocationOperationListCall {
840            hub: self.hub,
841            _name: name.to_string(),
842            _page_token: Default::default(),
843            _page_size: Default::default(),
844            _filter: Default::default(),
845            _delegate: Default::default(),
846            _additional_params: Default::default(),
847            _scopes: Default::default(),
848        }
849    }
850
851    /// Create a builder to help you perform the following task:
852    ///
853    /// Gets information about a location.
854    ///
855    /// # Arguments
856    ///
857    /// * `name` - Resource name for the location.
858    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
859        ProjectLocationGetCall {
860            hub: self.hub,
861            _name: name.to_string(),
862            _delegate: Default::default(),
863            _additional_params: Default::default(),
864            _scopes: Default::default(),
865        }
866    }
867
868    /// Create a builder to help you perform the following task:
869    ///
870    /// Lists information about the supported locations for this service.
871    ///
872    /// # Arguments
873    ///
874    /// * `name` - The resource that owns the locations collection, if applicable.
875    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
876        ProjectLocationListCall {
877            hub: self.hub,
878            _name: name.to_string(),
879            _page_token: Default::default(),
880            _page_size: Default::default(),
881            _include_unrevealed_locations: Default::default(),
882            _filter: Default::default(),
883            _delegate: Default::default(),
884            _additional_params: Default::default(),
885            _scopes: Default::default(),
886        }
887    }
888}
889
890// ###################
891// CallBuilders   ###
892// #################
893
894/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
895///
896/// A builder for the *locations.gameServerDeployments.getIamPolicy* method supported by a *project* resource.
897/// It is not used directly, but through a [`ProjectMethods`] instance.
898///
899/// # Example
900///
901/// Instantiate a resource method builder
902///
903/// ```test_harness,no_run
904/// # extern crate hyper;
905/// # extern crate hyper_rustls;
906/// # extern crate google_gameservices1 as gameservices1;
907/// # async fn dox() {
908/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
909///
910/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
911/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
912/// #     .with_native_roots()
913/// #     .unwrap()
914/// #     .https_only()
915/// #     .enable_http2()
916/// #     .build();
917///
918/// # let executor = hyper_util::rt::TokioExecutor::new();
919/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
920/// #     secret,
921/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
922/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
923/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
924/// #     ),
925/// # ).build().await.unwrap();
926///
927/// # let client = hyper_util::client::legacy::Client::builder(
928/// #     hyper_util::rt::TokioExecutor::new()
929/// # )
930/// # .build(
931/// #     hyper_rustls::HttpsConnectorBuilder::new()
932/// #         .with_native_roots()
933/// #         .unwrap()
934/// #         .https_or_http()
935/// #         .enable_http2()
936/// #         .build()
937/// # );
938/// # let mut hub = GameServices::new(client, auth);
939/// // You can configure optional parameters by calling the respective setters at will, and
940/// // execute the final call using `doit()`.
941/// // Values shown here are possibly random and not representative !
942/// let result = hub.projects().locations_game_server_deployments_get_iam_policy("resource")
943///              .options_requested_policy_version(-80)
944///              .doit().await;
945/// # }
946/// ```
947pub struct ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C>
948where
949    C: 'a,
950{
951    hub: &'a GameServices<C>,
952    _resource: String,
953    _options_requested_policy_version: Option<i32>,
954    _delegate: Option<&'a mut dyn common::Delegate>,
955    _additional_params: HashMap<String, String>,
956    _scopes: BTreeSet<String>,
957}
958
959impl<'a, C> common::CallBuilder for ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C> {}
960
961impl<'a, C> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C>
962where
963    C: common::Connector,
964{
965    /// Perform the operation you have build so far.
966    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
967        use std::borrow::Cow;
968        use std::io::{Read, Seek};
969
970        use common::{url::Params, ToParts};
971        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
972
973        let mut dd = common::DefaultDelegate;
974        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
975        dlg.begin(common::MethodInfo {
976            id: "gameservices.projects.locations.gameServerDeployments.getIamPolicy",
977            http_method: hyper::Method::GET,
978        });
979
980        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
981            if self._additional_params.contains_key(field) {
982                dlg.finished(false);
983                return Err(common::Error::FieldClash(field));
984            }
985        }
986
987        let mut params = Params::with_capacity(4 + self._additional_params.len());
988        params.push("resource", self._resource);
989        if let Some(value) = self._options_requested_policy_version.as_ref() {
990            params.push("options.requestedPolicyVersion", value.to_string());
991        }
992
993        params.extend(self._additional_params.iter());
994
995        params.push("alt", "json");
996        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
997        if self._scopes.is_empty() {
998            self._scopes
999                .insert(Scope::CloudPlatform.as_ref().to_string());
1000        }
1001
1002        #[allow(clippy::single_element_loop)]
1003        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
1004            url = params.uri_replacement(url, param_name, find_this, true);
1005        }
1006        {
1007            let to_remove = ["resource"];
1008            params.remove_params(&to_remove);
1009        }
1010
1011        let url = params.parse_with_url(&url);
1012
1013        loop {
1014            let token = match self
1015                .hub
1016                .auth
1017                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1018                .await
1019            {
1020                Ok(token) => token,
1021                Err(e) => match dlg.token(e) {
1022                    Ok(token) => token,
1023                    Err(e) => {
1024                        dlg.finished(false);
1025                        return Err(common::Error::MissingToken(e));
1026                    }
1027                },
1028            };
1029            let mut req_result = {
1030                let client = &self.hub.client;
1031                dlg.pre_request();
1032                let mut req_builder = hyper::Request::builder()
1033                    .method(hyper::Method::GET)
1034                    .uri(url.as_str())
1035                    .header(USER_AGENT, self.hub._user_agent.clone());
1036
1037                if let Some(token) = token.as_ref() {
1038                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1039                }
1040
1041                let request = req_builder
1042                    .header(CONTENT_LENGTH, 0_u64)
1043                    .body(common::to_body::<String>(None));
1044
1045                client.request(request.unwrap()).await
1046            };
1047
1048            match req_result {
1049                Err(err) => {
1050                    if let common::Retry::After(d) = dlg.http_error(&err) {
1051                        sleep(d).await;
1052                        continue;
1053                    }
1054                    dlg.finished(false);
1055                    return Err(common::Error::HttpError(err));
1056                }
1057                Ok(res) => {
1058                    let (mut parts, body) = res.into_parts();
1059                    let mut body = common::Body::new(body);
1060                    if !parts.status.is_success() {
1061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1062                        let error = serde_json::from_str(&common::to_string(&bytes));
1063                        let response = common::to_response(parts, bytes.into());
1064
1065                        if let common::Retry::After(d) =
1066                            dlg.http_failure(&response, error.as_ref().ok())
1067                        {
1068                            sleep(d).await;
1069                            continue;
1070                        }
1071
1072                        dlg.finished(false);
1073
1074                        return Err(match error {
1075                            Ok(value) => common::Error::BadRequest(value),
1076                            _ => common::Error::Failure(response),
1077                        });
1078                    }
1079                    let response = {
1080                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1081                        let encoded = common::to_string(&bytes);
1082                        match serde_json::from_str(&encoded) {
1083                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1084                            Err(error) => {
1085                                dlg.response_json_decode_error(&encoded, &error);
1086                                return Err(common::Error::JsonDecodeError(
1087                                    encoded.to_string(),
1088                                    error,
1089                                ));
1090                            }
1091                        }
1092                    };
1093
1094                    dlg.finished(true);
1095                    return Ok(response);
1096                }
1097            }
1098        }
1099    }
1100
1101    /// 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.
1102    ///
1103    /// Sets the *resource* path property to the given value.
1104    ///
1105    /// Even though the property as already been set when instantiating this call,
1106    /// we provide this method for API completeness.
1107    pub fn resource(
1108        mut self,
1109        new_value: &str,
1110    ) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C> {
1111        self._resource = new_value.to_string();
1112        self
1113    }
1114    /// 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).
1115    ///
1116    /// Sets the *options.requested policy version* query property to the given value.
1117    pub fn options_requested_policy_version(
1118        mut self,
1119        new_value: i32,
1120    ) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C> {
1121        self._options_requested_policy_version = Some(new_value);
1122        self
1123    }
1124    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1125    /// while executing the actual API request.
1126    ///
1127    /// ````text
1128    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1129    /// ````
1130    ///
1131    /// Sets the *delegate* property to the given value.
1132    pub fn delegate(
1133        mut self,
1134        new_value: &'a mut dyn common::Delegate,
1135    ) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C> {
1136        self._delegate = Some(new_value);
1137        self
1138    }
1139
1140    /// Set any additional parameter of the query string used in the request.
1141    /// It should be used to set parameters which are not yet available through their own
1142    /// setters.
1143    ///
1144    /// Please note that this method must not be used to set any of the known parameters
1145    /// which have their own setter method. If done anyway, the request will fail.
1146    ///
1147    /// # Additional Parameters
1148    ///
1149    /// * *$.xgafv* (query-string) - V1 error format.
1150    /// * *access_token* (query-string) - OAuth access token.
1151    /// * *alt* (query-string) - Data format for response.
1152    /// * *callback* (query-string) - JSONP
1153    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1154    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1155    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1156    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1157    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1158    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1159    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1160    pub fn param<T>(
1161        mut self,
1162        name: T,
1163        value: T,
1164    ) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C>
1165    where
1166        T: AsRef<str>,
1167    {
1168        self._additional_params
1169            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1170        self
1171    }
1172
1173    /// Identifies the authorization scope for the method you are building.
1174    ///
1175    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1176    /// [`Scope::CloudPlatform`].
1177    ///
1178    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1179    /// tokens for more than one scope.
1180    ///
1181    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1182    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1183    /// sufficient, a read-write scope will do as well.
1184    pub fn add_scope<St>(
1185        mut self,
1186        scope: St,
1187    ) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C>
1188    where
1189        St: AsRef<str>,
1190    {
1191        self._scopes.insert(String::from(scope.as_ref()));
1192        self
1193    }
1194    /// Identifies the authorization scope(s) for the method you are building.
1195    ///
1196    /// See [`Self::add_scope()`] for details.
1197    pub fn add_scopes<I, St>(
1198        mut self,
1199        scopes: I,
1200    ) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C>
1201    where
1202        I: IntoIterator<Item = St>,
1203        St: AsRef<str>,
1204    {
1205        self._scopes
1206            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1207        self
1208    }
1209
1210    /// Removes all scopes, and no default scope will be used either.
1211    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1212    /// for details).
1213    pub fn clear_scopes(mut self) -> ProjectLocationGameServerDeploymentGetIamPolicyCall<'a, C> {
1214        self._scopes.clear();
1215        self
1216    }
1217}
1218
1219/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1220///
1221/// A builder for the *locations.gameServerDeployments.setIamPolicy* method supported by a *project* resource.
1222/// It is not used directly, but through a [`ProjectMethods`] instance.
1223///
1224/// # Example
1225///
1226/// Instantiate a resource method builder
1227///
1228/// ```test_harness,no_run
1229/// # extern crate hyper;
1230/// # extern crate hyper_rustls;
1231/// # extern crate google_gameservices1 as gameservices1;
1232/// use gameservices1::api::SetIamPolicyRequest;
1233/// # async fn dox() {
1234/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1235///
1236/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1237/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1238/// #     .with_native_roots()
1239/// #     .unwrap()
1240/// #     .https_only()
1241/// #     .enable_http2()
1242/// #     .build();
1243///
1244/// # let executor = hyper_util::rt::TokioExecutor::new();
1245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1246/// #     secret,
1247/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1248/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1249/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1250/// #     ),
1251/// # ).build().await.unwrap();
1252///
1253/// # let client = hyper_util::client::legacy::Client::builder(
1254/// #     hyper_util::rt::TokioExecutor::new()
1255/// # )
1256/// # .build(
1257/// #     hyper_rustls::HttpsConnectorBuilder::new()
1258/// #         .with_native_roots()
1259/// #         .unwrap()
1260/// #         .https_or_http()
1261/// #         .enable_http2()
1262/// #         .build()
1263/// # );
1264/// # let mut hub = GameServices::new(client, auth);
1265/// // As the method needs a request, you would usually fill it with the desired information
1266/// // into the respective structure. Some of the parts shown here might not be applicable !
1267/// // Values shown here are possibly random and not representative !
1268/// let mut req = SetIamPolicyRequest::default();
1269///
1270/// // You can configure optional parameters by calling the respective setters at will, and
1271/// // execute the final call using `doit()`.
1272/// // Values shown here are possibly random and not representative !
1273/// let result = hub.projects().locations_game_server_deployments_set_iam_policy(req, "resource")
1274///              .doit().await;
1275/// # }
1276/// ```
1277pub struct ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C>
1278where
1279    C: 'a,
1280{
1281    hub: &'a GameServices<C>,
1282    _request: SetIamPolicyRequest,
1283    _resource: String,
1284    _delegate: Option<&'a mut dyn common::Delegate>,
1285    _additional_params: HashMap<String, String>,
1286    _scopes: BTreeSet<String>,
1287}
1288
1289impl<'a, C> common::CallBuilder for ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C> {}
1290
1291impl<'a, C> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C>
1292where
1293    C: common::Connector,
1294{
1295    /// Perform the operation you have build so far.
1296    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
1297        use std::borrow::Cow;
1298        use std::io::{Read, Seek};
1299
1300        use common::{url::Params, ToParts};
1301        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1302
1303        let mut dd = common::DefaultDelegate;
1304        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1305        dlg.begin(common::MethodInfo {
1306            id: "gameservices.projects.locations.gameServerDeployments.setIamPolicy",
1307            http_method: hyper::Method::POST,
1308        });
1309
1310        for &field in ["alt", "resource"].iter() {
1311            if self._additional_params.contains_key(field) {
1312                dlg.finished(false);
1313                return Err(common::Error::FieldClash(field));
1314            }
1315        }
1316
1317        let mut params = Params::with_capacity(4 + self._additional_params.len());
1318        params.push("resource", self._resource);
1319
1320        params.extend(self._additional_params.iter());
1321
1322        params.push("alt", "json");
1323        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
1324        if self._scopes.is_empty() {
1325            self._scopes
1326                .insert(Scope::CloudPlatform.as_ref().to_string());
1327        }
1328
1329        #[allow(clippy::single_element_loop)]
1330        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
1331            url = params.uri_replacement(url, param_name, find_this, true);
1332        }
1333        {
1334            let to_remove = ["resource"];
1335            params.remove_params(&to_remove);
1336        }
1337
1338        let url = params.parse_with_url(&url);
1339
1340        let mut json_mime_type = mime::APPLICATION_JSON;
1341        let mut request_value_reader = {
1342            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1343            common::remove_json_null_values(&mut value);
1344            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1345            serde_json::to_writer(&mut dst, &value).unwrap();
1346            dst
1347        };
1348        let request_size = request_value_reader
1349            .seek(std::io::SeekFrom::End(0))
1350            .unwrap();
1351        request_value_reader
1352            .seek(std::io::SeekFrom::Start(0))
1353            .unwrap();
1354
1355        loop {
1356            let token = match self
1357                .hub
1358                .auth
1359                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1360                .await
1361            {
1362                Ok(token) => token,
1363                Err(e) => match dlg.token(e) {
1364                    Ok(token) => token,
1365                    Err(e) => {
1366                        dlg.finished(false);
1367                        return Err(common::Error::MissingToken(e));
1368                    }
1369                },
1370            };
1371            request_value_reader
1372                .seek(std::io::SeekFrom::Start(0))
1373                .unwrap();
1374            let mut req_result = {
1375                let client = &self.hub.client;
1376                dlg.pre_request();
1377                let mut req_builder = hyper::Request::builder()
1378                    .method(hyper::Method::POST)
1379                    .uri(url.as_str())
1380                    .header(USER_AGENT, self.hub._user_agent.clone());
1381
1382                if let Some(token) = token.as_ref() {
1383                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1384                }
1385
1386                let request = req_builder
1387                    .header(CONTENT_TYPE, json_mime_type.to_string())
1388                    .header(CONTENT_LENGTH, request_size as u64)
1389                    .body(common::to_body(
1390                        request_value_reader.get_ref().clone().into(),
1391                    ));
1392
1393                client.request(request.unwrap()).await
1394            };
1395
1396            match req_result {
1397                Err(err) => {
1398                    if let common::Retry::After(d) = dlg.http_error(&err) {
1399                        sleep(d).await;
1400                        continue;
1401                    }
1402                    dlg.finished(false);
1403                    return Err(common::Error::HttpError(err));
1404                }
1405                Ok(res) => {
1406                    let (mut parts, body) = res.into_parts();
1407                    let mut body = common::Body::new(body);
1408                    if !parts.status.is_success() {
1409                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1410                        let error = serde_json::from_str(&common::to_string(&bytes));
1411                        let response = common::to_response(parts, bytes.into());
1412
1413                        if let common::Retry::After(d) =
1414                            dlg.http_failure(&response, error.as_ref().ok())
1415                        {
1416                            sleep(d).await;
1417                            continue;
1418                        }
1419
1420                        dlg.finished(false);
1421
1422                        return Err(match error {
1423                            Ok(value) => common::Error::BadRequest(value),
1424                            _ => common::Error::Failure(response),
1425                        });
1426                    }
1427                    let response = {
1428                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1429                        let encoded = common::to_string(&bytes);
1430                        match serde_json::from_str(&encoded) {
1431                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1432                            Err(error) => {
1433                                dlg.response_json_decode_error(&encoded, &error);
1434                                return Err(common::Error::JsonDecodeError(
1435                                    encoded.to_string(),
1436                                    error,
1437                                ));
1438                            }
1439                        }
1440                    };
1441
1442                    dlg.finished(true);
1443                    return Ok(response);
1444                }
1445            }
1446        }
1447    }
1448
1449    ///
1450    /// Sets the *request* property to the given value.
1451    ///
1452    /// Even though the property as already been set when instantiating this call,
1453    /// we provide this method for API completeness.
1454    pub fn request(
1455        mut self,
1456        new_value: SetIamPolicyRequest,
1457    ) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C> {
1458        self._request = new_value;
1459        self
1460    }
1461    /// 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.
1462    ///
1463    /// Sets the *resource* path property to the given value.
1464    ///
1465    /// Even though the property as already been set when instantiating this call,
1466    /// we provide this method for API completeness.
1467    pub fn resource(
1468        mut self,
1469        new_value: &str,
1470    ) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C> {
1471        self._resource = new_value.to_string();
1472        self
1473    }
1474    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1475    /// while executing the actual API request.
1476    ///
1477    /// ````text
1478    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1479    /// ````
1480    ///
1481    /// Sets the *delegate* property to the given value.
1482    pub fn delegate(
1483        mut self,
1484        new_value: &'a mut dyn common::Delegate,
1485    ) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C> {
1486        self._delegate = Some(new_value);
1487        self
1488    }
1489
1490    /// Set any additional parameter of the query string used in the request.
1491    /// It should be used to set parameters which are not yet available through their own
1492    /// setters.
1493    ///
1494    /// Please note that this method must not be used to set any of the known parameters
1495    /// which have their own setter method. If done anyway, the request will fail.
1496    ///
1497    /// # Additional Parameters
1498    ///
1499    /// * *$.xgafv* (query-string) - V1 error format.
1500    /// * *access_token* (query-string) - OAuth access token.
1501    /// * *alt* (query-string) - Data format for response.
1502    /// * *callback* (query-string) - JSONP
1503    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1504    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1505    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1506    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1507    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1508    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1509    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1510    pub fn param<T>(
1511        mut self,
1512        name: T,
1513        value: T,
1514    ) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C>
1515    where
1516        T: AsRef<str>,
1517    {
1518        self._additional_params
1519            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1520        self
1521    }
1522
1523    /// Identifies the authorization scope for the method you are building.
1524    ///
1525    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1526    /// [`Scope::CloudPlatform`].
1527    ///
1528    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1529    /// tokens for more than one scope.
1530    ///
1531    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1532    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1533    /// sufficient, a read-write scope will do as well.
1534    pub fn add_scope<St>(
1535        mut self,
1536        scope: St,
1537    ) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C>
1538    where
1539        St: AsRef<str>,
1540    {
1541        self._scopes.insert(String::from(scope.as_ref()));
1542        self
1543    }
1544    /// Identifies the authorization scope(s) for the method you are building.
1545    ///
1546    /// See [`Self::add_scope()`] for details.
1547    pub fn add_scopes<I, St>(
1548        mut self,
1549        scopes: I,
1550    ) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C>
1551    where
1552        I: IntoIterator<Item = St>,
1553        St: AsRef<str>,
1554    {
1555        self._scopes
1556            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1557        self
1558    }
1559
1560    /// Removes all scopes, and no default scope will be used either.
1561    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1562    /// for details).
1563    pub fn clear_scopes(mut self) -> ProjectLocationGameServerDeploymentSetIamPolicyCall<'a, C> {
1564        self._scopes.clear();
1565        self
1566    }
1567}
1568
1569/// 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.
1570///
1571/// A builder for the *locations.gameServerDeployments.testIamPermissions* method supported by a *project* resource.
1572/// It is not used directly, but through a [`ProjectMethods`] instance.
1573///
1574/// # Example
1575///
1576/// Instantiate a resource method builder
1577///
1578/// ```test_harness,no_run
1579/// # extern crate hyper;
1580/// # extern crate hyper_rustls;
1581/// # extern crate google_gameservices1 as gameservices1;
1582/// use gameservices1::api::TestIamPermissionsRequest;
1583/// # async fn dox() {
1584/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1585///
1586/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1587/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1588/// #     .with_native_roots()
1589/// #     .unwrap()
1590/// #     .https_only()
1591/// #     .enable_http2()
1592/// #     .build();
1593///
1594/// # let executor = hyper_util::rt::TokioExecutor::new();
1595/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1596/// #     secret,
1597/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1598/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1599/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1600/// #     ),
1601/// # ).build().await.unwrap();
1602///
1603/// # let client = hyper_util::client::legacy::Client::builder(
1604/// #     hyper_util::rt::TokioExecutor::new()
1605/// # )
1606/// # .build(
1607/// #     hyper_rustls::HttpsConnectorBuilder::new()
1608/// #         .with_native_roots()
1609/// #         .unwrap()
1610/// #         .https_or_http()
1611/// #         .enable_http2()
1612/// #         .build()
1613/// # );
1614/// # let mut hub = GameServices::new(client, auth);
1615/// // As the method needs a request, you would usually fill it with the desired information
1616/// // into the respective structure. Some of the parts shown here might not be applicable !
1617/// // Values shown here are possibly random and not representative !
1618/// let mut req = TestIamPermissionsRequest::default();
1619///
1620/// // You can configure optional parameters by calling the respective setters at will, and
1621/// // execute the final call using `doit()`.
1622/// // Values shown here are possibly random and not representative !
1623/// let result = hub.projects().locations_game_server_deployments_test_iam_permissions(req, "resource")
1624///              .doit().await;
1625/// # }
1626/// ```
1627pub struct ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C>
1628where
1629    C: 'a,
1630{
1631    hub: &'a GameServices<C>,
1632    _request: TestIamPermissionsRequest,
1633    _resource: String,
1634    _delegate: Option<&'a mut dyn common::Delegate>,
1635    _additional_params: HashMap<String, String>,
1636    _scopes: BTreeSet<String>,
1637}
1638
1639impl<'a, C> common::CallBuilder
1640    for ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C>
1641{
1642}
1643
1644impl<'a, C> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C>
1645where
1646    C: common::Connector,
1647{
1648    /// Perform the operation you have build so far.
1649    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
1650        use std::borrow::Cow;
1651        use std::io::{Read, Seek};
1652
1653        use common::{url::Params, ToParts};
1654        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1655
1656        let mut dd = common::DefaultDelegate;
1657        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1658        dlg.begin(common::MethodInfo {
1659            id: "gameservices.projects.locations.gameServerDeployments.testIamPermissions",
1660            http_method: hyper::Method::POST,
1661        });
1662
1663        for &field in ["alt", "resource"].iter() {
1664            if self._additional_params.contains_key(field) {
1665                dlg.finished(false);
1666                return Err(common::Error::FieldClash(field));
1667            }
1668        }
1669
1670        let mut params = Params::with_capacity(4 + self._additional_params.len());
1671        params.push("resource", self._resource);
1672
1673        params.extend(self._additional_params.iter());
1674
1675        params.push("alt", "json");
1676        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
1677        if self._scopes.is_empty() {
1678            self._scopes
1679                .insert(Scope::CloudPlatform.as_ref().to_string());
1680        }
1681
1682        #[allow(clippy::single_element_loop)]
1683        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
1684            url = params.uri_replacement(url, param_name, find_this, true);
1685        }
1686        {
1687            let to_remove = ["resource"];
1688            params.remove_params(&to_remove);
1689        }
1690
1691        let url = params.parse_with_url(&url);
1692
1693        let mut json_mime_type = mime::APPLICATION_JSON;
1694        let mut request_value_reader = {
1695            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1696            common::remove_json_null_values(&mut value);
1697            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1698            serde_json::to_writer(&mut dst, &value).unwrap();
1699            dst
1700        };
1701        let request_size = request_value_reader
1702            .seek(std::io::SeekFrom::End(0))
1703            .unwrap();
1704        request_value_reader
1705            .seek(std::io::SeekFrom::Start(0))
1706            .unwrap();
1707
1708        loop {
1709            let token = match self
1710                .hub
1711                .auth
1712                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1713                .await
1714            {
1715                Ok(token) => token,
1716                Err(e) => match dlg.token(e) {
1717                    Ok(token) => token,
1718                    Err(e) => {
1719                        dlg.finished(false);
1720                        return Err(common::Error::MissingToken(e));
1721                    }
1722                },
1723            };
1724            request_value_reader
1725                .seek(std::io::SeekFrom::Start(0))
1726                .unwrap();
1727            let mut req_result = {
1728                let client = &self.hub.client;
1729                dlg.pre_request();
1730                let mut req_builder = hyper::Request::builder()
1731                    .method(hyper::Method::POST)
1732                    .uri(url.as_str())
1733                    .header(USER_AGENT, self.hub._user_agent.clone());
1734
1735                if let Some(token) = token.as_ref() {
1736                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1737                }
1738
1739                let request = req_builder
1740                    .header(CONTENT_TYPE, json_mime_type.to_string())
1741                    .header(CONTENT_LENGTH, request_size as u64)
1742                    .body(common::to_body(
1743                        request_value_reader.get_ref().clone().into(),
1744                    ));
1745
1746                client.request(request.unwrap()).await
1747            };
1748
1749            match req_result {
1750                Err(err) => {
1751                    if let common::Retry::After(d) = dlg.http_error(&err) {
1752                        sleep(d).await;
1753                        continue;
1754                    }
1755                    dlg.finished(false);
1756                    return Err(common::Error::HttpError(err));
1757                }
1758                Ok(res) => {
1759                    let (mut parts, body) = res.into_parts();
1760                    let mut body = common::Body::new(body);
1761                    if !parts.status.is_success() {
1762                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1763                        let error = serde_json::from_str(&common::to_string(&bytes));
1764                        let response = common::to_response(parts, bytes.into());
1765
1766                        if let common::Retry::After(d) =
1767                            dlg.http_failure(&response, error.as_ref().ok())
1768                        {
1769                            sleep(d).await;
1770                            continue;
1771                        }
1772
1773                        dlg.finished(false);
1774
1775                        return Err(match error {
1776                            Ok(value) => common::Error::BadRequest(value),
1777                            _ => common::Error::Failure(response),
1778                        });
1779                    }
1780                    let response = {
1781                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1782                        let encoded = common::to_string(&bytes);
1783                        match serde_json::from_str(&encoded) {
1784                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1785                            Err(error) => {
1786                                dlg.response_json_decode_error(&encoded, &error);
1787                                return Err(common::Error::JsonDecodeError(
1788                                    encoded.to_string(),
1789                                    error,
1790                                ));
1791                            }
1792                        }
1793                    };
1794
1795                    dlg.finished(true);
1796                    return Ok(response);
1797                }
1798            }
1799        }
1800    }
1801
1802    ///
1803    /// Sets the *request* property to the given value.
1804    ///
1805    /// Even though the property as already been set when instantiating this call,
1806    /// we provide this method for API completeness.
1807    pub fn request(
1808        mut self,
1809        new_value: TestIamPermissionsRequest,
1810    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C> {
1811        self._request = new_value;
1812        self
1813    }
1814    /// 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.
1815    ///
1816    /// Sets the *resource* path property to the given value.
1817    ///
1818    /// Even though the property as already been set when instantiating this call,
1819    /// we provide this method for API completeness.
1820    pub fn resource(
1821        mut self,
1822        new_value: &str,
1823    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C> {
1824        self._resource = new_value.to_string();
1825        self
1826    }
1827    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1828    /// while executing the actual API request.
1829    ///
1830    /// ````text
1831    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1832    /// ````
1833    ///
1834    /// Sets the *delegate* property to the given value.
1835    pub fn delegate(
1836        mut self,
1837        new_value: &'a mut dyn common::Delegate,
1838    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C> {
1839        self._delegate = Some(new_value);
1840        self
1841    }
1842
1843    /// Set any additional parameter of the query string used in the request.
1844    /// It should be used to set parameters which are not yet available through their own
1845    /// setters.
1846    ///
1847    /// Please note that this method must not be used to set any of the known parameters
1848    /// which have their own setter method. If done anyway, the request will fail.
1849    ///
1850    /// # Additional Parameters
1851    ///
1852    /// * *$.xgafv* (query-string) - V1 error format.
1853    /// * *access_token* (query-string) - OAuth access token.
1854    /// * *alt* (query-string) - Data format for response.
1855    /// * *callback* (query-string) - JSONP
1856    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1857    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1858    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1859    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1860    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1861    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1862    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1863    pub fn param<T>(
1864        mut self,
1865        name: T,
1866        value: T,
1867    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C>
1868    where
1869        T: AsRef<str>,
1870    {
1871        self._additional_params
1872            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1873        self
1874    }
1875
1876    /// Identifies the authorization scope for the method you are building.
1877    ///
1878    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1879    /// [`Scope::CloudPlatform`].
1880    ///
1881    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1882    /// tokens for more than one scope.
1883    ///
1884    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1885    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1886    /// sufficient, a read-write scope will do as well.
1887    pub fn add_scope<St>(
1888        mut self,
1889        scope: St,
1890    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C>
1891    where
1892        St: AsRef<str>,
1893    {
1894        self._scopes.insert(String::from(scope.as_ref()));
1895        self
1896    }
1897    /// Identifies the authorization scope(s) for the method you are building.
1898    ///
1899    /// See [`Self::add_scope()`] for details.
1900    pub fn add_scopes<I, St>(
1901        mut self,
1902        scopes: I,
1903    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C>
1904    where
1905        I: IntoIterator<Item = St>,
1906        St: AsRef<str>,
1907    {
1908        self._scopes
1909            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1910        self
1911    }
1912
1913    /// Removes all scopes, and no default scope will be used either.
1914    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1915    /// for details).
1916    pub fn clear_scopes(
1917        mut self,
1918    ) -> ProjectLocationGameServerDeploymentTestIamPermissionCall<'a, C> {
1919        self._scopes.clear();
1920        self
1921    }
1922}
1923
1924/// 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`.
1925///
1926/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
1927/// It is not used directly, but through a [`ProjectMethods`] instance.
1928///
1929/// # Example
1930///
1931/// Instantiate a resource method builder
1932///
1933/// ```test_harness,no_run
1934/// # extern crate hyper;
1935/// # extern crate hyper_rustls;
1936/// # extern crate google_gameservices1 as gameservices1;
1937/// use gameservices1::api::CancelOperationRequest;
1938/// # async fn dox() {
1939/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1940///
1941/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1942/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1943/// #     .with_native_roots()
1944/// #     .unwrap()
1945/// #     .https_only()
1946/// #     .enable_http2()
1947/// #     .build();
1948///
1949/// # let executor = hyper_util::rt::TokioExecutor::new();
1950/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1951/// #     secret,
1952/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1953/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1954/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1955/// #     ),
1956/// # ).build().await.unwrap();
1957///
1958/// # let client = hyper_util::client::legacy::Client::builder(
1959/// #     hyper_util::rt::TokioExecutor::new()
1960/// # )
1961/// # .build(
1962/// #     hyper_rustls::HttpsConnectorBuilder::new()
1963/// #         .with_native_roots()
1964/// #         .unwrap()
1965/// #         .https_or_http()
1966/// #         .enable_http2()
1967/// #         .build()
1968/// # );
1969/// # let mut hub = GameServices::new(client, auth);
1970/// // As the method needs a request, you would usually fill it with the desired information
1971/// // into the respective structure. Some of the parts shown here might not be applicable !
1972/// // Values shown here are possibly random and not representative !
1973/// let mut req = CancelOperationRequest::default();
1974///
1975/// // You can configure optional parameters by calling the respective setters at will, and
1976/// // execute the final call using `doit()`.
1977/// // Values shown here are possibly random and not representative !
1978/// let result = hub.projects().locations_operations_cancel(req, "name")
1979///              .doit().await;
1980/// # }
1981/// ```
1982pub struct ProjectLocationOperationCancelCall<'a, C>
1983where
1984    C: 'a,
1985{
1986    hub: &'a GameServices<C>,
1987    _request: CancelOperationRequest,
1988    _name: String,
1989    _delegate: Option<&'a mut dyn common::Delegate>,
1990    _additional_params: HashMap<String, String>,
1991    _scopes: BTreeSet<String>,
1992}
1993
1994impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
1995
1996impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
1997where
1998    C: common::Connector,
1999{
2000    /// Perform the operation you have build so far.
2001    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2002        use std::borrow::Cow;
2003        use std::io::{Read, Seek};
2004
2005        use common::{url::Params, ToParts};
2006        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2007
2008        let mut dd = common::DefaultDelegate;
2009        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2010        dlg.begin(common::MethodInfo {
2011            id: "gameservices.projects.locations.operations.cancel",
2012            http_method: hyper::Method::POST,
2013        });
2014
2015        for &field in ["alt", "name"].iter() {
2016            if self._additional_params.contains_key(field) {
2017                dlg.finished(false);
2018                return Err(common::Error::FieldClash(field));
2019            }
2020        }
2021
2022        let mut params = Params::with_capacity(4 + self._additional_params.len());
2023        params.push("name", self._name);
2024
2025        params.extend(self._additional_params.iter());
2026
2027        params.push("alt", "json");
2028        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
2029        if self._scopes.is_empty() {
2030            self._scopes
2031                .insert(Scope::CloudPlatform.as_ref().to_string());
2032        }
2033
2034        #[allow(clippy::single_element_loop)]
2035        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2036            url = params.uri_replacement(url, param_name, find_this, true);
2037        }
2038        {
2039            let to_remove = ["name"];
2040            params.remove_params(&to_remove);
2041        }
2042
2043        let url = params.parse_with_url(&url);
2044
2045        let mut json_mime_type = mime::APPLICATION_JSON;
2046        let mut request_value_reader = {
2047            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2048            common::remove_json_null_values(&mut value);
2049            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2050            serde_json::to_writer(&mut dst, &value).unwrap();
2051            dst
2052        };
2053        let request_size = request_value_reader
2054            .seek(std::io::SeekFrom::End(0))
2055            .unwrap();
2056        request_value_reader
2057            .seek(std::io::SeekFrom::Start(0))
2058            .unwrap();
2059
2060        loop {
2061            let token = match self
2062                .hub
2063                .auth
2064                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2065                .await
2066            {
2067                Ok(token) => token,
2068                Err(e) => match dlg.token(e) {
2069                    Ok(token) => token,
2070                    Err(e) => {
2071                        dlg.finished(false);
2072                        return Err(common::Error::MissingToken(e));
2073                    }
2074                },
2075            };
2076            request_value_reader
2077                .seek(std::io::SeekFrom::Start(0))
2078                .unwrap();
2079            let mut req_result = {
2080                let client = &self.hub.client;
2081                dlg.pre_request();
2082                let mut req_builder = hyper::Request::builder()
2083                    .method(hyper::Method::POST)
2084                    .uri(url.as_str())
2085                    .header(USER_AGENT, self.hub._user_agent.clone());
2086
2087                if let Some(token) = token.as_ref() {
2088                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2089                }
2090
2091                let request = req_builder
2092                    .header(CONTENT_TYPE, json_mime_type.to_string())
2093                    .header(CONTENT_LENGTH, request_size as u64)
2094                    .body(common::to_body(
2095                        request_value_reader.get_ref().clone().into(),
2096                    ));
2097
2098                client.request(request.unwrap()).await
2099            };
2100
2101            match req_result {
2102                Err(err) => {
2103                    if let common::Retry::After(d) = dlg.http_error(&err) {
2104                        sleep(d).await;
2105                        continue;
2106                    }
2107                    dlg.finished(false);
2108                    return Err(common::Error::HttpError(err));
2109                }
2110                Ok(res) => {
2111                    let (mut parts, body) = res.into_parts();
2112                    let mut body = common::Body::new(body);
2113                    if !parts.status.is_success() {
2114                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2115                        let error = serde_json::from_str(&common::to_string(&bytes));
2116                        let response = common::to_response(parts, bytes.into());
2117
2118                        if let common::Retry::After(d) =
2119                            dlg.http_failure(&response, error.as_ref().ok())
2120                        {
2121                            sleep(d).await;
2122                            continue;
2123                        }
2124
2125                        dlg.finished(false);
2126
2127                        return Err(match error {
2128                            Ok(value) => common::Error::BadRequest(value),
2129                            _ => common::Error::Failure(response),
2130                        });
2131                    }
2132                    let response = {
2133                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2134                        let encoded = common::to_string(&bytes);
2135                        match serde_json::from_str(&encoded) {
2136                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2137                            Err(error) => {
2138                                dlg.response_json_decode_error(&encoded, &error);
2139                                return Err(common::Error::JsonDecodeError(
2140                                    encoded.to_string(),
2141                                    error,
2142                                ));
2143                            }
2144                        }
2145                    };
2146
2147                    dlg.finished(true);
2148                    return Ok(response);
2149                }
2150            }
2151        }
2152    }
2153
2154    ///
2155    /// Sets the *request* property to the given value.
2156    ///
2157    /// Even though the property as already been set when instantiating this call,
2158    /// we provide this method for API completeness.
2159    pub fn request(
2160        mut self,
2161        new_value: CancelOperationRequest,
2162    ) -> ProjectLocationOperationCancelCall<'a, C> {
2163        self._request = new_value;
2164        self
2165    }
2166    /// The name of the operation resource to be cancelled.
2167    ///
2168    /// Sets the *name* path property to the given value.
2169    ///
2170    /// Even though the property as already been set when instantiating this call,
2171    /// we provide this method for API completeness.
2172    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
2173        self._name = new_value.to_string();
2174        self
2175    }
2176    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2177    /// while executing the actual API request.
2178    ///
2179    /// ````text
2180    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2181    /// ````
2182    ///
2183    /// Sets the *delegate* property to the given value.
2184    pub fn delegate(
2185        mut self,
2186        new_value: &'a mut dyn common::Delegate,
2187    ) -> ProjectLocationOperationCancelCall<'a, C> {
2188        self._delegate = Some(new_value);
2189        self
2190    }
2191
2192    /// Set any additional parameter of the query string used in the request.
2193    /// It should be used to set parameters which are not yet available through their own
2194    /// setters.
2195    ///
2196    /// Please note that this method must not be used to set any of the known parameters
2197    /// which have their own setter method. If done anyway, the request will fail.
2198    ///
2199    /// # Additional Parameters
2200    ///
2201    /// * *$.xgafv* (query-string) - V1 error format.
2202    /// * *access_token* (query-string) - OAuth access token.
2203    /// * *alt* (query-string) - Data format for response.
2204    /// * *callback* (query-string) - JSONP
2205    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2206    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2207    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2208    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2209    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2210    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2211    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2212    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
2213    where
2214        T: AsRef<str>,
2215    {
2216        self._additional_params
2217            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2218        self
2219    }
2220
2221    /// Identifies the authorization scope for the method you are building.
2222    ///
2223    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2224    /// [`Scope::CloudPlatform`].
2225    ///
2226    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2227    /// tokens for more than one scope.
2228    ///
2229    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2230    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2231    /// sufficient, a read-write scope will do as well.
2232    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
2233    where
2234        St: AsRef<str>,
2235    {
2236        self._scopes.insert(String::from(scope.as_ref()));
2237        self
2238    }
2239    /// Identifies the authorization scope(s) for the method you are building.
2240    ///
2241    /// See [`Self::add_scope()`] for details.
2242    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
2243    where
2244        I: IntoIterator<Item = St>,
2245        St: AsRef<str>,
2246    {
2247        self._scopes
2248            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2249        self
2250    }
2251
2252    /// Removes all scopes, and no default scope will be used either.
2253    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2254    /// for details).
2255    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
2256        self._scopes.clear();
2257        self
2258    }
2259}
2260
2261/// 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`.
2262///
2263/// A builder for the *locations.operations.delete* method supported by a *project* resource.
2264/// It is not used directly, but through a [`ProjectMethods`] instance.
2265///
2266/// # Example
2267///
2268/// Instantiate a resource method builder
2269///
2270/// ```test_harness,no_run
2271/// # extern crate hyper;
2272/// # extern crate hyper_rustls;
2273/// # extern crate google_gameservices1 as gameservices1;
2274/// # async fn dox() {
2275/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2276///
2277/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2278/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2279/// #     .with_native_roots()
2280/// #     .unwrap()
2281/// #     .https_only()
2282/// #     .enable_http2()
2283/// #     .build();
2284///
2285/// # let executor = hyper_util::rt::TokioExecutor::new();
2286/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2287/// #     secret,
2288/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2289/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2290/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2291/// #     ),
2292/// # ).build().await.unwrap();
2293///
2294/// # let client = hyper_util::client::legacy::Client::builder(
2295/// #     hyper_util::rt::TokioExecutor::new()
2296/// # )
2297/// # .build(
2298/// #     hyper_rustls::HttpsConnectorBuilder::new()
2299/// #         .with_native_roots()
2300/// #         .unwrap()
2301/// #         .https_or_http()
2302/// #         .enable_http2()
2303/// #         .build()
2304/// # );
2305/// # let mut hub = GameServices::new(client, auth);
2306/// // You can configure optional parameters by calling the respective setters at will, and
2307/// // execute the final call using `doit()`.
2308/// // Values shown here are possibly random and not representative !
2309/// let result = hub.projects().locations_operations_delete("name")
2310///              .doit().await;
2311/// # }
2312/// ```
2313pub struct ProjectLocationOperationDeleteCall<'a, C>
2314where
2315    C: 'a,
2316{
2317    hub: &'a GameServices<C>,
2318    _name: String,
2319    _delegate: Option<&'a mut dyn common::Delegate>,
2320    _additional_params: HashMap<String, String>,
2321    _scopes: BTreeSet<String>,
2322}
2323
2324impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
2325
2326impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
2327where
2328    C: common::Connector,
2329{
2330    /// Perform the operation you have build so far.
2331    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2332        use std::borrow::Cow;
2333        use std::io::{Read, Seek};
2334
2335        use common::{url::Params, ToParts};
2336        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2337
2338        let mut dd = common::DefaultDelegate;
2339        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2340        dlg.begin(common::MethodInfo {
2341            id: "gameservices.projects.locations.operations.delete",
2342            http_method: hyper::Method::DELETE,
2343        });
2344
2345        for &field in ["alt", "name"].iter() {
2346            if self._additional_params.contains_key(field) {
2347                dlg.finished(false);
2348                return Err(common::Error::FieldClash(field));
2349            }
2350        }
2351
2352        let mut params = Params::with_capacity(3 + self._additional_params.len());
2353        params.push("name", self._name);
2354
2355        params.extend(self._additional_params.iter());
2356
2357        params.push("alt", "json");
2358        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2359        if self._scopes.is_empty() {
2360            self._scopes
2361                .insert(Scope::CloudPlatform.as_ref().to_string());
2362        }
2363
2364        #[allow(clippy::single_element_loop)]
2365        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2366            url = params.uri_replacement(url, param_name, find_this, true);
2367        }
2368        {
2369            let to_remove = ["name"];
2370            params.remove_params(&to_remove);
2371        }
2372
2373        let url = params.parse_with_url(&url);
2374
2375        loop {
2376            let token = match self
2377                .hub
2378                .auth
2379                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2380                .await
2381            {
2382                Ok(token) => token,
2383                Err(e) => match dlg.token(e) {
2384                    Ok(token) => token,
2385                    Err(e) => {
2386                        dlg.finished(false);
2387                        return Err(common::Error::MissingToken(e));
2388                    }
2389                },
2390            };
2391            let mut req_result = {
2392                let client = &self.hub.client;
2393                dlg.pre_request();
2394                let mut req_builder = hyper::Request::builder()
2395                    .method(hyper::Method::DELETE)
2396                    .uri(url.as_str())
2397                    .header(USER_AGENT, self.hub._user_agent.clone());
2398
2399                if let Some(token) = token.as_ref() {
2400                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2401                }
2402
2403                let request = req_builder
2404                    .header(CONTENT_LENGTH, 0_u64)
2405                    .body(common::to_body::<String>(None));
2406
2407                client.request(request.unwrap()).await
2408            };
2409
2410            match req_result {
2411                Err(err) => {
2412                    if let common::Retry::After(d) = dlg.http_error(&err) {
2413                        sleep(d).await;
2414                        continue;
2415                    }
2416                    dlg.finished(false);
2417                    return Err(common::Error::HttpError(err));
2418                }
2419                Ok(res) => {
2420                    let (mut parts, body) = res.into_parts();
2421                    let mut body = common::Body::new(body);
2422                    if !parts.status.is_success() {
2423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2424                        let error = serde_json::from_str(&common::to_string(&bytes));
2425                        let response = common::to_response(parts, bytes.into());
2426
2427                        if let common::Retry::After(d) =
2428                            dlg.http_failure(&response, error.as_ref().ok())
2429                        {
2430                            sleep(d).await;
2431                            continue;
2432                        }
2433
2434                        dlg.finished(false);
2435
2436                        return Err(match error {
2437                            Ok(value) => common::Error::BadRequest(value),
2438                            _ => common::Error::Failure(response),
2439                        });
2440                    }
2441                    let response = {
2442                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2443                        let encoded = common::to_string(&bytes);
2444                        match serde_json::from_str(&encoded) {
2445                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2446                            Err(error) => {
2447                                dlg.response_json_decode_error(&encoded, &error);
2448                                return Err(common::Error::JsonDecodeError(
2449                                    encoded.to_string(),
2450                                    error,
2451                                ));
2452                            }
2453                        }
2454                    };
2455
2456                    dlg.finished(true);
2457                    return Ok(response);
2458                }
2459            }
2460        }
2461    }
2462
2463    /// The name of the operation resource to be deleted.
2464    ///
2465    /// Sets the *name* path property to the given value.
2466    ///
2467    /// Even though the property as already been set when instantiating this call,
2468    /// we provide this method for API completeness.
2469    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
2470        self._name = new_value.to_string();
2471        self
2472    }
2473    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2474    /// while executing the actual API request.
2475    ///
2476    /// ````text
2477    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2478    /// ````
2479    ///
2480    /// Sets the *delegate* property to the given value.
2481    pub fn delegate(
2482        mut self,
2483        new_value: &'a mut dyn common::Delegate,
2484    ) -> ProjectLocationOperationDeleteCall<'a, C> {
2485        self._delegate = Some(new_value);
2486        self
2487    }
2488
2489    /// Set any additional parameter of the query string used in the request.
2490    /// It should be used to set parameters which are not yet available through their own
2491    /// setters.
2492    ///
2493    /// Please note that this method must not be used to set any of the known parameters
2494    /// which have their own setter method. If done anyway, the request will fail.
2495    ///
2496    /// # Additional Parameters
2497    ///
2498    /// * *$.xgafv* (query-string) - V1 error format.
2499    /// * *access_token* (query-string) - OAuth access token.
2500    /// * *alt* (query-string) - Data format for response.
2501    /// * *callback* (query-string) - JSONP
2502    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2503    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2504    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2505    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2506    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2507    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2508    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2509    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
2510    where
2511        T: AsRef<str>,
2512    {
2513        self._additional_params
2514            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2515        self
2516    }
2517
2518    /// Identifies the authorization scope for the method you are building.
2519    ///
2520    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2521    /// [`Scope::CloudPlatform`].
2522    ///
2523    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2524    /// tokens for more than one scope.
2525    ///
2526    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2527    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2528    /// sufficient, a read-write scope will do as well.
2529    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
2530    where
2531        St: AsRef<str>,
2532    {
2533        self._scopes.insert(String::from(scope.as_ref()));
2534        self
2535    }
2536    /// Identifies the authorization scope(s) for the method you are building.
2537    ///
2538    /// See [`Self::add_scope()`] for details.
2539    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
2540    where
2541        I: IntoIterator<Item = St>,
2542        St: AsRef<str>,
2543    {
2544        self._scopes
2545            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2546        self
2547    }
2548
2549    /// Removes all scopes, and no default scope will be used either.
2550    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2551    /// for details).
2552    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
2553        self._scopes.clear();
2554        self
2555    }
2556}
2557
2558/// 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.
2559///
2560/// A builder for the *locations.operations.get* method supported by a *project* resource.
2561/// It is not used directly, but through a [`ProjectMethods`] instance.
2562///
2563/// # Example
2564///
2565/// Instantiate a resource method builder
2566///
2567/// ```test_harness,no_run
2568/// # extern crate hyper;
2569/// # extern crate hyper_rustls;
2570/// # extern crate google_gameservices1 as gameservices1;
2571/// # async fn dox() {
2572/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2573///
2574/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2575/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2576/// #     .with_native_roots()
2577/// #     .unwrap()
2578/// #     .https_only()
2579/// #     .enable_http2()
2580/// #     .build();
2581///
2582/// # let executor = hyper_util::rt::TokioExecutor::new();
2583/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2584/// #     secret,
2585/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2586/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2587/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2588/// #     ),
2589/// # ).build().await.unwrap();
2590///
2591/// # let client = hyper_util::client::legacy::Client::builder(
2592/// #     hyper_util::rt::TokioExecutor::new()
2593/// # )
2594/// # .build(
2595/// #     hyper_rustls::HttpsConnectorBuilder::new()
2596/// #         .with_native_roots()
2597/// #         .unwrap()
2598/// #         .https_or_http()
2599/// #         .enable_http2()
2600/// #         .build()
2601/// # );
2602/// # let mut hub = GameServices::new(client, auth);
2603/// // You can configure optional parameters by calling the respective setters at will, and
2604/// // execute the final call using `doit()`.
2605/// // Values shown here are possibly random and not representative !
2606/// let result = hub.projects().locations_operations_get("name")
2607///              .doit().await;
2608/// # }
2609/// ```
2610pub struct ProjectLocationOperationGetCall<'a, C>
2611where
2612    C: 'a,
2613{
2614    hub: &'a GameServices<C>,
2615    _name: String,
2616    _delegate: Option<&'a mut dyn common::Delegate>,
2617    _additional_params: HashMap<String, String>,
2618    _scopes: BTreeSet<String>,
2619}
2620
2621impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
2622
2623impl<'a, C> ProjectLocationOperationGetCall<'a, C>
2624where
2625    C: common::Connector,
2626{
2627    /// Perform the operation you have build so far.
2628    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2629        use std::borrow::Cow;
2630        use std::io::{Read, Seek};
2631
2632        use common::{url::Params, ToParts};
2633        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2634
2635        let mut dd = common::DefaultDelegate;
2636        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2637        dlg.begin(common::MethodInfo {
2638            id: "gameservices.projects.locations.operations.get",
2639            http_method: hyper::Method::GET,
2640        });
2641
2642        for &field in ["alt", "name"].iter() {
2643            if self._additional_params.contains_key(field) {
2644                dlg.finished(false);
2645                return Err(common::Error::FieldClash(field));
2646            }
2647        }
2648
2649        let mut params = Params::with_capacity(3 + self._additional_params.len());
2650        params.push("name", self._name);
2651
2652        params.extend(self._additional_params.iter());
2653
2654        params.push("alt", "json");
2655        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2656        if self._scopes.is_empty() {
2657            self._scopes
2658                .insert(Scope::CloudPlatform.as_ref().to_string());
2659        }
2660
2661        #[allow(clippy::single_element_loop)]
2662        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2663            url = params.uri_replacement(url, param_name, find_this, true);
2664        }
2665        {
2666            let to_remove = ["name"];
2667            params.remove_params(&to_remove);
2668        }
2669
2670        let url = params.parse_with_url(&url);
2671
2672        loop {
2673            let token = match self
2674                .hub
2675                .auth
2676                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2677                .await
2678            {
2679                Ok(token) => token,
2680                Err(e) => match dlg.token(e) {
2681                    Ok(token) => token,
2682                    Err(e) => {
2683                        dlg.finished(false);
2684                        return Err(common::Error::MissingToken(e));
2685                    }
2686                },
2687            };
2688            let mut req_result = {
2689                let client = &self.hub.client;
2690                dlg.pre_request();
2691                let mut req_builder = hyper::Request::builder()
2692                    .method(hyper::Method::GET)
2693                    .uri(url.as_str())
2694                    .header(USER_AGENT, self.hub._user_agent.clone());
2695
2696                if let Some(token) = token.as_ref() {
2697                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2698                }
2699
2700                let request = req_builder
2701                    .header(CONTENT_LENGTH, 0_u64)
2702                    .body(common::to_body::<String>(None));
2703
2704                client.request(request.unwrap()).await
2705            };
2706
2707            match req_result {
2708                Err(err) => {
2709                    if let common::Retry::After(d) = dlg.http_error(&err) {
2710                        sleep(d).await;
2711                        continue;
2712                    }
2713                    dlg.finished(false);
2714                    return Err(common::Error::HttpError(err));
2715                }
2716                Ok(res) => {
2717                    let (mut parts, body) = res.into_parts();
2718                    let mut body = common::Body::new(body);
2719                    if !parts.status.is_success() {
2720                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2721                        let error = serde_json::from_str(&common::to_string(&bytes));
2722                        let response = common::to_response(parts, bytes.into());
2723
2724                        if let common::Retry::After(d) =
2725                            dlg.http_failure(&response, error.as_ref().ok())
2726                        {
2727                            sleep(d).await;
2728                            continue;
2729                        }
2730
2731                        dlg.finished(false);
2732
2733                        return Err(match error {
2734                            Ok(value) => common::Error::BadRequest(value),
2735                            _ => common::Error::Failure(response),
2736                        });
2737                    }
2738                    let response = {
2739                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2740                        let encoded = common::to_string(&bytes);
2741                        match serde_json::from_str(&encoded) {
2742                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2743                            Err(error) => {
2744                                dlg.response_json_decode_error(&encoded, &error);
2745                                return Err(common::Error::JsonDecodeError(
2746                                    encoded.to_string(),
2747                                    error,
2748                                ));
2749                            }
2750                        }
2751                    };
2752
2753                    dlg.finished(true);
2754                    return Ok(response);
2755                }
2756            }
2757        }
2758    }
2759
2760    /// The name of the operation resource.
2761    ///
2762    /// Sets the *name* path property to the given value.
2763    ///
2764    /// Even though the property as already been set when instantiating this call,
2765    /// we provide this method for API completeness.
2766    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
2767        self._name = new_value.to_string();
2768        self
2769    }
2770    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2771    /// while executing the actual API request.
2772    ///
2773    /// ````text
2774    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2775    /// ````
2776    ///
2777    /// Sets the *delegate* property to the given value.
2778    pub fn delegate(
2779        mut self,
2780        new_value: &'a mut dyn common::Delegate,
2781    ) -> ProjectLocationOperationGetCall<'a, C> {
2782        self._delegate = Some(new_value);
2783        self
2784    }
2785
2786    /// Set any additional parameter of the query string used in the request.
2787    /// It should be used to set parameters which are not yet available through their own
2788    /// setters.
2789    ///
2790    /// Please note that this method must not be used to set any of the known parameters
2791    /// which have their own setter method. If done anyway, the request will fail.
2792    ///
2793    /// # Additional Parameters
2794    ///
2795    /// * *$.xgafv* (query-string) - V1 error format.
2796    /// * *access_token* (query-string) - OAuth access token.
2797    /// * *alt* (query-string) - Data format for response.
2798    /// * *callback* (query-string) - JSONP
2799    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2800    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2801    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2802    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2803    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2804    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2805    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2806    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
2807    where
2808        T: AsRef<str>,
2809    {
2810        self._additional_params
2811            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2812        self
2813    }
2814
2815    /// Identifies the authorization scope for the method you are building.
2816    ///
2817    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2818    /// [`Scope::CloudPlatform`].
2819    ///
2820    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2821    /// tokens for more than one scope.
2822    ///
2823    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2824    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2825    /// sufficient, a read-write scope will do as well.
2826    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
2827    where
2828        St: AsRef<str>,
2829    {
2830        self._scopes.insert(String::from(scope.as_ref()));
2831        self
2832    }
2833    /// Identifies the authorization scope(s) for the method you are building.
2834    ///
2835    /// See [`Self::add_scope()`] for details.
2836    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
2837    where
2838        I: IntoIterator<Item = St>,
2839        St: AsRef<str>,
2840    {
2841        self._scopes
2842            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2843        self
2844    }
2845
2846    /// Removes all scopes, and no default scope will be used either.
2847    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2848    /// for details).
2849    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
2850        self._scopes.clear();
2851        self
2852    }
2853}
2854
2855/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
2856///
2857/// A builder for the *locations.operations.list* method supported by a *project* resource.
2858/// It is not used directly, but through a [`ProjectMethods`] instance.
2859///
2860/// # Example
2861///
2862/// Instantiate a resource method builder
2863///
2864/// ```test_harness,no_run
2865/// # extern crate hyper;
2866/// # extern crate hyper_rustls;
2867/// # extern crate google_gameservices1 as gameservices1;
2868/// # async fn dox() {
2869/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2870///
2871/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2872/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2873/// #     .with_native_roots()
2874/// #     .unwrap()
2875/// #     .https_only()
2876/// #     .enable_http2()
2877/// #     .build();
2878///
2879/// # let executor = hyper_util::rt::TokioExecutor::new();
2880/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2881/// #     secret,
2882/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2883/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2884/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2885/// #     ),
2886/// # ).build().await.unwrap();
2887///
2888/// # let client = hyper_util::client::legacy::Client::builder(
2889/// #     hyper_util::rt::TokioExecutor::new()
2890/// # )
2891/// # .build(
2892/// #     hyper_rustls::HttpsConnectorBuilder::new()
2893/// #         .with_native_roots()
2894/// #         .unwrap()
2895/// #         .https_or_http()
2896/// #         .enable_http2()
2897/// #         .build()
2898/// # );
2899/// # let mut hub = GameServices::new(client, auth);
2900/// // You can configure optional parameters by calling the respective setters at will, and
2901/// // execute the final call using `doit()`.
2902/// // Values shown here are possibly random and not representative !
2903/// let result = hub.projects().locations_operations_list("name")
2904///              .page_token("Lorem")
2905///              .page_size(-12)
2906///              .filter("eos")
2907///              .doit().await;
2908/// # }
2909/// ```
2910pub struct ProjectLocationOperationListCall<'a, C>
2911where
2912    C: 'a,
2913{
2914    hub: &'a GameServices<C>,
2915    _name: String,
2916    _page_token: Option<String>,
2917    _page_size: Option<i32>,
2918    _filter: Option<String>,
2919    _delegate: Option<&'a mut dyn common::Delegate>,
2920    _additional_params: HashMap<String, String>,
2921    _scopes: BTreeSet<String>,
2922}
2923
2924impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
2925
2926impl<'a, C> ProjectLocationOperationListCall<'a, C>
2927where
2928    C: common::Connector,
2929{
2930    /// Perform the operation you have build so far.
2931    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
2932        use std::borrow::Cow;
2933        use std::io::{Read, Seek};
2934
2935        use common::{url::Params, ToParts};
2936        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2937
2938        let mut dd = common::DefaultDelegate;
2939        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2940        dlg.begin(common::MethodInfo {
2941            id: "gameservices.projects.locations.operations.list",
2942            http_method: hyper::Method::GET,
2943        });
2944
2945        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
2946            if self._additional_params.contains_key(field) {
2947                dlg.finished(false);
2948                return Err(common::Error::FieldClash(field));
2949            }
2950        }
2951
2952        let mut params = Params::with_capacity(6 + self._additional_params.len());
2953        params.push("name", self._name);
2954        if let Some(value) = self._page_token.as_ref() {
2955            params.push("pageToken", value);
2956        }
2957        if let Some(value) = self._page_size.as_ref() {
2958            params.push("pageSize", value.to_string());
2959        }
2960        if let Some(value) = self._filter.as_ref() {
2961            params.push("filter", value);
2962        }
2963
2964        params.extend(self._additional_params.iter());
2965
2966        params.push("alt", "json");
2967        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
2968        if self._scopes.is_empty() {
2969            self._scopes
2970                .insert(Scope::CloudPlatform.as_ref().to_string());
2971        }
2972
2973        #[allow(clippy::single_element_loop)]
2974        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2975            url = params.uri_replacement(url, param_name, find_this, true);
2976        }
2977        {
2978            let to_remove = ["name"];
2979            params.remove_params(&to_remove);
2980        }
2981
2982        let url = params.parse_with_url(&url);
2983
2984        loop {
2985            let token = match self
2986                .hub
2987                .auth
2988                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2989                .await
2990            {
2991                Ok(token) => token,
2992                Err(e) => match dlg.token(e) {
2993                    Ok(token) => token,
2994                    Err(e) => {
2995                        dlg.finished(false);
2996                        return Err(common::Error::MissingToken(e));
2997                    }
2998                },
2999            };
3000            let mut req_result = {
3001                let client = &self.hub.client;
3002                dlg.pre_request();
3003                let mut req_builder = hyper::Request::builder()
3004                    .method(hyper::Method::GET)
3005                    .uri(url.as_str())
3006                    .header(USER_AGENT, self.hub._user_agent.clone());
3007
3008                if let Some(token) = token.as_ref() {
3009                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3010                }
3011
3012                let request = req_builder
3013                    .header(CONTENT_LENGTH, 0_u64)
3014                    .body(common::to_body::<String>(None));
3015
3016                client.request(request.unwrap()).await
3017            };
3018
3019            match req_result {
3020                Err(err) => {
3021                    if let common::Retry::After(d) = dlg.http_error(&err) {
3022                        sleep(d).await;
3023                        continue;
3024                    }
3025                    dlg.finished(false);
3026                    return Err(common::Error::HttpError(err));
3027                }
3028                Ok(res) => {
3029                    let (mut parts, body) = res.into_parts();
3030                    let mut body = common::Body::new(body);
3031                    if !parts.status.is_success() {
3032                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3033                        let error = serde_json::from_str(&common::to_string(&bytes));
3034                        let response = common::to_response(parts, bytes.into());
3035
3036                        if let common::Retry::After(d) =
3037                            dlg.http_failure(&response, error.as_ref().ok())
3038                        {
3039                            sleep(d).await;
3040                            continue;
3041                        }
3042
3043                        dlg.finished(false);
3044
3045                        return Err(match error {
3046                            Ok(value) => common::Error::BadRequest(value),
3047                            _ => common::Error::Failure(response),
3048                        });
3049                    }
3050                    let response = {
3051                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3052                        let encoded = common::to_string(&bytes);
3053                        match serde_json::from_str(&encoded) {
3054                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3055                            Err(error) => {
3056                                dlg.response_json_decode_error(&encoded, &error);
3057                                return Err(common::Error::JsonDecodeError(
3058                                    encoded.to_string(),
3059                                    error,
3060                                ));
3061                            }
3062                        }
3063                    };
3064
3065                    dlg.finished(true);
3066                    return Ok(response);
3067                }
3068            }
3069        }
3070    }
3071
3072    /// The name of the operation's parent resource.
3073    ///
3074    /// Sets the *name* path property to the given value.
3075    ///
3076    /// Even though the property as already been set when instantiating this call,
3077    /// we provide this method for API completeness.
3078    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
3079        self._name = new_value.to_string();
3080        self
3081    }
3082    /// The standard list page token.
3083    ///
3084    /// Sets the *page token* query property to the given value.
3085    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
3086        self._page_token = Some(new_value.to_string());
3087        self
3088    }
3089    /// The standard list page size.
3090    ///
3091    /// Sets the *page size* query property to the given value.
3092    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
3093        self._page_size = Some(new_value);
3094        self
3095    }
3096    /// The standard list filter.
3097    ///
3098    /// Sets the *filter* query property to the given value.
3099    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
3100        self._filter = Some(new_value.to_string());
3101        self
3102    }
3103    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3104    /// while executing the actual API request.
3105    ///
3106    /// ````text
3107    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3108    /// ````
3109    ///
3110    /// Sets the *delegate* property to the given value.
3111    pub fn delegate(
3112        mut self,
3113        new_value: &'a mut dyn common::Delegate,
3114    ) -> ProjectLocationOperationListCall<'a, C> {
3115        self._delegate = Some(new_value);
3116        self
3117    }
3118
3119    /// Set any additional parameter of the query string used in the request.
3120    /// It should be used to set parameters which are not yet available through their own
3121    /// setters.
3122    ///
3123    /// Please note that this method must not be used to set any of the known parameters
3124    /// which have their own setter method. If done anyway, the request will fail.
3125    ///
3126    /// # Additional Parameters
3127    ///
3128    /// * *$.xgafv* (query-string) - V1 error format.
3129    /// * *access_token* (query-string) - OAuth access token.
3130    /// * *alt* (query-string) - Data format for response.
3131    /// * *callback* (query-string) - JSONP
3132    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3133    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3134    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3135    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3136    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3137    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3138    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3139    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
3140    where
3141        T: AsRef<str>,
3142    {
3143        self._additional_params
3144            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3145        self
3146    }
3147
3148    /// Identifies the authorization scope for the method you are building.
3149    ///
3150    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3151    /// [`Scope::CloudPlatform`].
3152    ///
3153    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3154    /// tokens for more than one scope.
3155    ///
3156    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3157    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3158    /// sufficient, a read-write scope will do as well.
3159    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
3160    where
3161        St: AsRef<str>,
3162    {
3163        self._scopes.insert(String::from(scope.as_ref()));
3164        self
3165    }
3166    /// Identifies the authorization scope(s) for the method you are building.
3167    ///
3168    /// See [`Self::add_scope()`] for details.
3169    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
3170    where
3171        I: IntoIterator<Item = St>,
3172        St: AsRef<str>,
3173    {
3174        self._scopes
3175            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3176        self
3177    }
3178
3179    /// Removes all scopes, and no default scope will be used either.
3180    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3181    /// for details).
3182    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
3183        self._scopes.clear();
3184        self
3185    }
3186}
3187
3188/// Gets information about a location.
3189///
3190/// A builder for the *locations.get* method supported by a *project* resource.
3191/// It is not used directly, but through a [`ProjectMethods`] instance.
3192///
3193/// # Example
3194///
3195/// Instantiate a resource method builder
3196///
3197/// ```test_harness,no_run
3198/// # extern crate hyper;
3199/// # extern crate hyper_rustls;
3200/// # extern crate google_gameservices1 as gameservices1;
3201/// # async fn dox() {
3202/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3203///
3204/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3205/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3206/// #     .with_native_roots()
3207/// #     .unwrap()
3208/// #     .https_only()
3209/// #     .enable_http2()
3210/// #     .build();
3211///
3212/// # let executor = hyper_util::rt::TokioExecutor::new();
3213/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3214/// #     secret,
3215/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3216/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3217/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3218/// #     ),
3219/// # ).build().await.unwrap();
3220///
3221/// # let client = hyper_util::client::legacy::Client::builder(
3222/// #     hyper_util::rt::TokioExecutor::new()
3223/// # )
3224/// # .build(
3225/// #     hyper_rustls::HttpsConnectorBuilder::new()
3226/// #         .with_native_roots()
3227/// #         .unwrap()
3228/// #         .https_or_http()
3229/// #         .enable_http2()
3230/// #         .build()
3231/// # );
3232/// # let mut hub = GameServices::new(client, auth);
3233/// // You can configure optional parameters by calling the respective setters at will, and
3234/// // execute the final call using `doit()`.
3235/// // Values shown here are possibly random and not representative !
3236/// let result = hub.projects().locations_get("name")
3237///              .doit().await;
3238/// # }
3239/// ```
3240pub struct ProjectLocationGetCall<'a, C>
3241where
3242    C: 'a,
3243{
3244    hub: &'a GameServices<C>,
3245    _name: String,
3246    _delegate: Option<&'a mut dyn common::Delegate>,
3247    _additional_params: HashMap<String, String>,
3248    _scopes: BTreeSet<String>,
3249}
3250
3251impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
3252
3253impl<'a, C> ProjectLocationGetCall<'a, C>
3254where
3255    C: common::Connector,
3256{
3257    /// Perform the operation you have build so far.
3258    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
3259        use std::borrow::Cow;
3260        use std::io::{Read, Seek};
3261
3262        use common::{url::Params, ToParts};
3263        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3264
3265        let mut dd = common::DefaultDelegate;
3266        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3267        dlg.begin(common::MethodInfo {
3268            id: "gameservices.projects.locations.get",
3269            http_method: hyper::Method::GET,
3270        });
3271
3272        for &field in ["alt", "name"].iter() {
3273            if self._additional_params.contains_key(field) {
3274                dlg.finished(false);
3275                return Err(common::Error::FieldClash(field));
3276            }
3277        }
3278
3279        let mut params = Params::with_capacity(3 + self._additional_params.len());
3280        params.push("name", self._name);
3281
3282        params.extend(self._additional_params.iter());
3283
3284        params.push("alt", "json");
3285        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3286        if self._scopes.is_empty() {
3287            self._scopes
3288                .insert(Scope::CloudPlatform.as_ref().to_string());
3289        }
3290
3291        #[allow(clippy::single_element_loop)]
3292        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3293            url = params.uri_replacement(url, param_name, find_this, true);
3294        }
3295        {
3296            let to_remove = ["name"];
3297            params.remove_params(&to_remove);
3298        }
3299
3300        let url = params.parse_with_url(&url);
3301
3302        loop {
3303            let token = match self
3304                .hub
3305                .auth
3306                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3307                .await
3308            {
3309                Ok(token) => token,
3310                Err(e) => match dlg.token(e) {
3311                    Ok(token) => token,
3312                    Err(e) => {
3313                        dlg.finished(false);
3314                        return Err(common::Error::MissingToken(e));
3315                    }
3316                },
3317            };
3318            let mut req_result = {
3319                let client = &self.hub.client;
3320                dlg.pre_request();
3321                let mut req_builder = hyper::Request::builder()
3322                    .method(hyper::Method::GET)
3323                    .uri(url.as_str())
3324                    .header(USER_AGENT, self.hub._user_agent.clone());
3325
3326                if let Some(token) = token.as_ref() {
3327                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3328                }
3329
3330                let request = req_builder
3331                    .header(CONTENT_LENGTH, 0_u64)
3332                    .body(common::to_body::<String>(None));
3333
3334                client.request(request.unwrap()).await
3335            };
3336
3337            match req_result {
3338                Err(err) => {
3339                    if let common::Retry::After(d) = dlg.http_error(&err) {
3340                        sleep(d).await;
3341                        continue;
3342                    }
3343                    dlg.finished(false);
3344                    return Err(common::Error::HttpError(err));
3345                }
3346                Ok(res) => {
3347                    let (mut parts, body) = res.into_parts();
3348                    let mut body = common::Body::new(body);
3349                    if !parts.status.is_success() {
3350                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3351                        let error = serde_json::from_str(&common::to_string(&bytes));
3352                        let response = common::to_response(parts, bytes.into());
3353
3354                        if let common::Retry::After(d) =
3355                            dlg.http_failure(&response, error.as_ref().ok())
3356                        {
3357                            sleep(d).await;
3358                            continue;
3359                        }
3360
3361                        dlg.finished(false);
3362
3363                        return Err(match error {
3364                            Ok(value) => common::Error::BadRequest(value),
3365                            _ => common::Error::Failure(response),
3366                        });
3367                    }
3368                    let response = {
3369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3370                        let encoded = common::to_string(&bytes);
3371                        match serde_json::from_str(&encoded) {
3372                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3373                            Err(error) => {
3374                                dlg.response_json_decode_error(&encoded, &error);
3375                                return Err(common::Error::JsonDecodeError(
3376                                    encoded.to_string(),
3377                                    error,
3378                                ));
3379                            }
3380                        }
3381                    };
3382
3383                    dlg.finished(true);
3384                    return Ok(response);
3385                }
3386            }
3387        }
3388    }
3389
3390    /// Resource name for the location.
3391    ///
3392    /// Sets the *name* path property to the given value.
3393    ///
3394    /// Even though the property as already been set when instantiating this call,
3395    /// we provide this method for API completeness.
3396    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
3397        self._name = new_value.to_string();
3398        self
3399    }
3400    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3401    /// while executing the actual API request.
3402    ///
3403    /// ````text
3404    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3405    /// ````
3406    ///
3407    /// Sets the *delegate* property to the given value.
3408    pub fn delegate(
3409        mut self,
3410        new_value: &'a mut dyn common::Delegate,
3411    ) -> ProjectLocationGetCall<'a, C> {
3412        self._delegate = Some(new_value);
3413        self
3414    }
3415
3416    /// Set any additional parameter of the query string used in the request.
3417    /// It should be used to set parameters which are not yet available through their own
3418    /// setters.
3419    ///
3420    /// Please note that this method must not be used to set any of the known parameters
3421    /// which have their own setter method. If done anyway, the request will fail.
3422    ///
3423    /// # Additional Parameters
3424    ///
3425    /// * *$.xgafv* (query-string) - V1 error format.
3426    /// * *access_token* (query-string) - OAuth access token.
3427    /// * *alt* (query-string) - Data format for response.
3428    /// * *callback* (query-string) - JSONP
3429    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3430    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3431    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3432    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3433    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3434    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3435    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3436    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
3437    where
3438        T: AsRef<str>,
3439    {
3440        self._additional_params
3441            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3442        self
3443    }
3444
3445    /// Identifies the authorization scope for the method you are building.
3446    ///
3447    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3448    /// [`Scope::CloudPlatform`].
3449    ///
3450    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3451    /// tokens for more than one scope.
3452    ///
3453    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3454    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3455    /// sufficient, a read-write scope will do as well.
3456    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
3457    where
3458        St: AsRef<str>,
3459    {
3460        self._scopes.insert(String::from(scope.as_ref()));
3461        self
3462    }
3463    /// Identifies the authorization scope(s) for the method you are building.
3464    ///
3465    /// See [`Self::add_scope()`] for details.
3466    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
3467    where
3468        I: IntoIterator<Item = St>,
3469        St: AsRef<str>,
3470    {
3471        self._scopes
3472            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3473        self
3474    }
3475
3476    /// Removes all scopes, and no default scope will be used either.
3477    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3478    /// for details).
3479    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
3480        self._scopes.clear();
3481        self
3482    }
3483}
3484
3485/// Lists information about the supported locations for this service.
3486///
3487/// A builder for the *locations.list* method supported by a *project* resource.
3488/// It is not used directly, but through a [`ProjectMethods`] instance.
3489///
3490/// # Example
3491///
3492/// Instantiate a resource method builder
3493///
3494/// ```test_harness,no_run
3495/// # extern crate hyper;
3496/// # extern crate hyper_rustls;
3497/// # extern crate google_gameservices1 as gameservices1;
3498/// # async fn dox() {
3499/// # use gameservices1::{GameServices, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3500///
3501/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3502/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3503/// #     .with_native_roots()
3504/// #     .unwrap()
3505/// #     .https_only()
3506/// #     .enable_http2()
3507/// #     .build();
3508///
3509/// # let executor = hyper_util::rt::TokioExecutor::new();
3510/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3511/// #     secret,
3512/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3513/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3514/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3515/// #     ),
3516/// # ).build().await.unwrap();
3517///
3518/// # let client = hyper_util::client::legacy::Client::builder(
3519/// #     hyper_util::rt::TokioExecutor::new()
3520/// # )
3521/// # .build(
3522/// #     hyper_rustls::HttpsConnectorBuilder::new()
3523/// #         .with_native_roots()
3524/// #         .unwrap()
3525/// #         .https_or_http()
3526/// #         .enable_http2()
3527/// #         .build()
3528/// # );
3529/// # let mut hub = GameServices::new(client, auth);
3530/// // You can configure optional parameters by calling the respective setters at will, and
3531/// // execute the final call using `doit()`.
3532/// // Values shown here are possibly random and not representative !
3533/// let result = hub.projects().locations_list("name")
3534///              .page_token("ipsum")
3535///              .page_size(-88)
3536///              .include_unrevealed_locations(true)
3537///              .filter("duo")
3538///              .doit().await;
3539/// # }
3540/// ```
3541pub struct ProjectLocationListCall<'a, C>
3542where
3543    C: 'a,
3544{
3545    hub: &'a GameServices<C>,
3546    _name: String,
3547    _page_token: Option<String>,
3548    _page_size: Option<i32>,
3549    _include_unrevealed_locations: Option<bool>,
3550    _filter: Option<String>,
3551    _delegate: Option<&'a mut dyn common::Delegate>,
3552    _additional_params: HashMap<String, String>,
3553    _scopes: BTreeSet<String>,
3554}
3555
3556impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
3557
3558impl<'a, C> ProjectLocationListCall<'a, C>
3559where
3560    C: common::Connector,
3561{
3562    /// Perform the operation you have build so far.
3563    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
3564        use std::borrow::Cow;
3565        use std::io::{Read, Seek};
3566
3567        use common::{url::Params, ToParts};
3568        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3569
3570        let mut dd = common::DefaultDelegate;
3571        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3572        dlg.begin(common::MethodInfo {
3573            id: "gameservices.projects.locations.list",
3574            http_method: hyper::Method::GET,
3575        });
3576
3577        for &field in [
3578            "alt",
3579            "name",
3580            "pageToken",
3581            "pageSize",
3582            "includeUnrevealedLocations",
3583            "filter",
3584        ]
3585        .iter()
3586        {
3587            if self._additional_params.contains_key(field) {
3588                dlg.finished(false);
3589                return Err(common::Error::FieldClash(field));
3590            }
3591        }
3592
3593        let mut params = Params::with_capacity(7 + self._additional_params.len());
3594        params.push("name", self._name);
3595        if let Some(value) = self._page_token.as_ref() {
3596            params.push("pageToken", value);
3597        }
3598        if let Some(value) = self._page_size.as_ref() {
3599            params.push("pageSize", value.to_string());
3600        }
3601        if let Some(value) = self._include_unrevealed_locations.as_ref() {
3602            params.push("includeUnrevealedLocations", value.to_string());
3603        }
3604        if let Some(value) = self._filter.as_ref() {
3605            params.push("filter", value);
3606        }
3607
3608        params.extend(self._additional_params.iter());
3609
3610        params.push("alt", "json");
3611        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
3612        if self._scopes.is_empty() {
3613            self._scopes
3614                .insert(Scope::CloudPlatform.as_ref().to_string());
3615        }
3616
3617        #[allow(clippy::single_element_loop)]
3618        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3619            url = params.uri_replacement(url, param_name, find_this, true);
3620        }
3621        {
3622            let to_remove = ["name"];
3623            params.remove_params(&to_remove);
3624        }
3625
3626        let url = params.parse_with_url(&url);
3627
3628        loop {
3629            let token = match self
3630                .hub
3631                .auth
3632                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3633                .await
3634            {
3635                Ok(token) => token,
3636                Err(e) => match dlg.token(e) {
3637                    Ok(token) => token,
3638                    Err(e) => {
3639                        dlg.finished(false);
3640                        return Err(common::Error::MissingToken(e));
3641                    }
3642                },
3643            };
3644            let mut req_result = {
3645                let client = &self.hub.client;
3646                dlg.pre_request();
3647                let mut req_builder = hyper::Request::builder()
3648                    .method(hyper::Method::GET)
3649                    .uri(url.as_str())
3650                    .header(USER_AGENT, self.hub._user_agent.clone());
3651
3652                if let Some(token) = token.as_ref() {
3653                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3654                }
3655
3656                let request = req_builder
3657                    .header(CONTENT_LENGTH, 0_u64)
3658                    .body(common::to_body::<String>(None));
3659
3660                client.request(request.unwrap()).await
3661            };
3662
3663            match req_result {
3664                Err(err) => {
3665                    if let common::Retry::After(d) = dlg.http_error(&err) {
3666                        sleep(d).await;
3667                        continue;
3668                    }
3669                    dlg.finished(false);
3670                    return Err(common::Error::HttpError(err));
3671                }
3672                Ok(res) => {
3673                    let (mut parts, body) = res.into_parts();
3674                    let mut body = common::Body::new(body);
3675                    if !parts.status.is_success() {
3676                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3677                        let error = serde_json::from_str(&common::to_string(&bytes));
3678                        let response = common::to_response(parts, bytes.into());
3679
3680                        if let common::Retry::After(d) =
3681                            dlg.http_failure(&response, error.as_ref().ok())
3682                        {
3683                            sleep(d).await;
3684                            continue;
3685                        }
3686
3687                        dlg.finished(false);
3688
3689                        return Err(match error {
3690                            Ok(value) => common::Error::BadRequest(value),
3691                            _ => common::Error::Failure(response),
3692                        });
3693                    }
3694                    let response = {
3695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3696                        let encoded = common::to_string(&bytes);
3697                        match serde_json::from_str(&encoded) {
3698                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3699                            Err(error) => {
3700                                dlg.response_json_decode_error(&encoded, &error);
3701                                return Err(common::Error::JsonDecodeError(
3702                                    encoded.to_string(),
3703                                    error,
3704                                ));
3705                            }
3706                        }
3707                    };
3708
3709                    dlg.finished(true);
3710                    return Ok(response);
3711                }
3712            }
3713        }
3714    }
3715
3716    /// The resource that owns the locations collection, if applicable.
3717    ///
3718    /// Sets the *name* path property to the given value.
3719    ///
3720    /// Even though the property as already been set when instantiating this call,
3721    /// we provide this method for API completeness.
3722    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
3723        self._name = new_value.to_string();
3724        self
3725    }
3726    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
3727    ///
3728    /// Sets the *page token* query property to the given value.
3729    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
3730        self._page_token = Some(new_value.to_string());
3731        self
3732    }
3733    /// The maximum number of results to return. If not set, the service selects a default.
3734    ///
3735    /// Sets the *page size* query property to the given value.
3736    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
3737        self._page_size = Some(new_value);
3738        self
3739    }
3740    /// If true, the returned list will include locations which are not yet revealed.
3741    ///
3742    /// Sets the *include unrevealed locations* query property to the given value.
3743    pub fn include_unrevealed_locations(
3744        mut self,
3745        new_value: bool,
3746    ) -> ProjectLocationListCall<'a, C> {
3747        self._include_unrevealed_locations = Some(new_value);
3748        self
3749    }
3750    /// 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).
3751    ///
3752    /// Sets the *filter* query property to the given value.
3753    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
3754        self._filter = Some(new_value.to_string());
3755        self
3756    }
3757    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3758    /// while executing the actual API request.
3759    ///
3760    /// ````text
3761    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3762    /// ````
3763    ///
3764    /// Sets the *delegate* property to the given value.
3765    pub fn delegate(
3766        mut self,
3767        new_value: &'a mut dyn common::Delegate,
3768    ) -> ProjectLocationListCall<'a, C> {
3769        self._delegate = Some(new_value);
3770        self
3771    }
3772
3773    /// Set any additional parameter of the query string used in the request.
3774    /// It should be used to set parameters which are not yet available through their own
3775    /// setters.
3776    ///
3777    /// Please note that this method must not be used to set any of the known parameters
3778    /// which have their own setter method. If done anyway, the request will fail.
3779    ///
3780    /// # Additional Parameters
3781    ///
3782    /// * *$.xgafv* (query-string) - V1 error format.
3783    /// * *access_token* (query-string) - OAuth access token.
3784    /// * *alt* (query-string) - Data format for response.
3785    /// * *callback* (query-string) - JSONP
3786    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3787    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3788    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3789    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3790    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3791    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3792    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3793    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
3794    where
3795        T: AsRef<str>,
3796    {
3797        self._additional_params
3798            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3799        self
3800    }
3801
3802    /// Identifies the authorization scope for the method you are building.
3803    ///
3804    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3805    /// [`Scope::CloudPlatform`].
3806    ///
3807    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3808    /// tokens for more than one scope.
3809    ///
3810    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3811    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3812    /// sufficient, a read-write scope will do as well.
3813    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
3814    where
3815        St: AsRef<str>,
3816    {
3817        self._scopes.insert(String::from(scope.as_ref()));
3818        self
3819    }
3820    /// Identifies the authorization scope(s) for the method you are building.
3821    ///
3822    /// See [`Self::add_scope()`] for details.
3823    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
3824    where
3825        I: IntoIterator<Item = St>,
3826        St: AsRef<str>,
3827    {
3828        self._scopes
3829            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3830        self
3831    }
3832
3833    /// Removes all scopes, and no default scope will be used either.
3834    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3835    /// for details).
3836    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
3837        self._scopes.clear();
3838        self
3839    }
3840}