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