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