mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-08 12:32:08 +01:00
3254 lines
150 KiB
Rust
3254 lines
150 KiB
Rust
use std::collections::HashMap;
|
|
use std::cell::RefCell;
|
|
use std::default::Default;
|
|
use std::collections::BTreeMap;
|
|
use serde_json as json;
|
|
use std::io;
|
|
use std::fs;
|
|
use std::mem;
|
|
use std::thread::sleep;
|
|
|
|
use crate::client;
|
|
|
|
// ##############
|
|
// UTILITIES ###
|
|
// ############
|
|
|
|
/// Identifies the an OAuth2 authorization scope.
|
|
/// A scope is needed when requesting an
|
|
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
|
|
#[derive(PartialEq, Eq, Hash)]
|
|
pub enum Scope {
|
|
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
|
|
CloudPlatform,
|
|
|
|
/// Use Stackdriver Debugger
|
|
CloudDebugger,
|
|
}
|
|
|
|
impl AsRef<str> for Scope {
|
|
fn as_ref(&self) -> &str {
|
|
match *self {
|
|
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
|
|
Scope::CloudDebugger => "https://www.googleapis.com/auth/cloud_debugger",
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Default for Scope {
|
|
fn default() -> Scope {
|
|
Scope::CloudPlatform
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ########
|
|
// HUB ###
|
|
// ######
|
|
|
|
/// Central instance to access all CloudDebugger related resource activities
|
|
///
|
|
/// # Examples
|
|
///
|
|
/// Instantiate a new hub
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// extern crate hyper;
|
|
/// extern crate hyper_rustls;
|
|
/// extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// use clouddebugger2::api::Breakpoint;
|
|
/// use clouddebugger2::{Result, Error};
|
|
/// # async fn dox() {
|
|
/// use std::default::Default;
|
|
/// use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
|
/// // `client_secret`, among other things.
|
|
/// let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
|
|
/// // unless you replace `None` with the desired Flow.
|
|
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
|
|
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
|
|
/// // retrieve them from storage.
|
|
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// secret,
|
|
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// ).build().await.unwrap();
|
|
/// let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // As the method needs a request, you would usually fill it with the desired information
|
|
/// // into the respective structure. Some of the parts shown here might not be applicable !
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let mut req = Breakpoint::default();
|
|
///
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.debugger().debuggees_breakpoints_set(req, "debuggeeId")
|
|
/// .client_version("sed")
|
|
/// .canary_option("amet.")
|
|
/// .doit().await;
|
|
///
|
|
/// match result {
|
|
/// Err(e) => match e {
|
|
/// // The Error enum provides details about what exactly happened.
|
|
/// // You can also just use its `Debug`, `Display` or `Error` traits
|
|
/// Error::HttpError(_)
|
|
/// |Error::Io(_)
|
|
/// |Error::MissingAPIKey
|
|
/// |Error::MissingToken(_)
|
|
/// |Error::Cancelled
|
|
/// |Error::UploadSizeLimitExceeded(_, _)
|
|
/// |Error::Failure(_)
|
|
/// |Error::BadRequest(_)
|
|
/// |Error::FieldClash(_)
|
|
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
|
|
/// },
|
|
/// Ok(res) => println!("Success: {:?}", res),
|
|
/// }
|
|
/// # }
|
|
/// ```
|
|
#[derive(Clone)]
|
|
pub struct CloudDebugger<> {
|
|
pub client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>,
|
|
pub auth: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>,
|
|
_user_agent: String,
|
|
_base_url: String,
|
|
_root_url: String,
|
|
}
|
|
|
|
impl<'a, > client::Hub for CloudDebugger<> {}
|
|
|
|
impl<'a, > CloudDebugger<> {
|
|
|
|
pub fn new(client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>, authenticator: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>) -> CloudDebugger<> {
|
|
CloudDebugger {
|
|
client,
|
|
auth: authenticator,
|
|
_user_agent: "google-api-rust-client/3.1.0".to_string(),
|
|
_base_url: "https://clouddebugger.googleapis.com/".to_string(),
|
|
_root_url: "https://clouddebugger.googleapis.com/".to_string(),
|
|
}
|
|
}
|
|
|
|
pub fn controller(&'a self) -> ControllerMethods<'a> {
|
|
ControllerMethods { hub: &self }
|
|
}
|
|
pub fn debugger(&'a self) -> DebuggerMethods<'a> {
|
|
DebuggerMethods { hub: &self }
|
|
}
|
|
|
|
/// Set the user-agent header field to use in all requests to the server.
|
|
/// It defaults to `google-api-rust-client/3.1.0`.
|
|
///
|
|
/// Returns the previously set user-agent.
|
|
pub fn user_agent(&mut self, agent_name: String) -> String {
|
|
mem::replace(&mut self._user_agent, agent_name)
|
|
}
|
|
|
|
/// Set the base url to use in all requests to the server.
|
|
/// It defaults to `https://clouddebugger.googleapis.com/`.
|
|
///
|
|
/// Returns the previously set base url.
|
|
pub fn base_url(&mut self, new_base_url: String) -> String {
|
|
mem::replace(&mut self._base_url, new_base_url)
|
|
}
|
|
|
|
/// Set the root url to use in all requests to the server.
|
|
/// It defaults to `https://clouddebugger.googleapis.com/`.
|
|
///
|
|
/// Returns the previously set root url.
|
|
pub fn root_url(&mut self, new_root_url: String) -> String {
|
|
mem::replace(&mut self._root_url, new_root_url)
|
|
}
|
|
}
|
|
|
|
|
|
// ############
|
|
// SCHEMAS ###
|
|
// ##########
|
|
/// An alias to a repo revision.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct AliasContext {
|
|
/// The alias kind.
|
|
pub kind: Option<String>,
|
|
/// The alias name.
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
impl client::Part for AliasContext {}
|
|
|
|
|
|
/// ------------------------------------------------------------------------------ ## Breakpoint (the resource) Represents the breakpoint specification, status and results.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints set debugger](DebuggerDebuggeeBreakpointSetCall) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Breakpoint {
|
|
/// Action that the agent should perform when the code at the breakpoint location is hit.
|
|
pub action: Option<String>,
|
|
/// The deadline for the breakpoint to stay in CANARY_ACTIVE state. The value is meaningless when the breakpoint is not in CANARY_ACTIVE state.
|
|
#[serde(rename="canaryExpireTime")]
|
|
pub canary_expire_time: Option<String>,
|
|
/// Condition that triggers the breakpoint. The condition is a compound boolean expression composed using expressions in a programming language at the source location.
|
|
pub condition: Option<String>,
|
|
/// Time this breakpoint was created by the server in seconds resolution.
|
|
#[serde(rename="createTime")]
|
|
pub create_time: Option<String>,
|
|
/// 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.
|
|
#[serde(rename="evaluatedExpressions")]
|
|
pub evaluated_expressions: Option<Vec<Variable>>,
|
|
/// 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.
|
|
pub expressions: Option<Vec<String>>,
|
|
/// Time this breakpoint was finalized as seen by the server in seconds resolution.
|
|
#[serde(rename="finalTime")]
|
|
pub final_time: Option<String>,
|
|
/// Breakpoint identifier, unique in the scope of the debuggee.
|
|
pub id: Option<String>,
|
|
/// When true, indicates that this is a final result and the breakpoint state will not change from here on.
|
|
#[serde(rename="isFinalState")]
|
|
pub is_final_state: Option<bool>,
|
|
/// A set of custom breakpoint properties, populated by the agent, to be displayed to the user.
|
|
pub labels: Option<HashMap<String, String>>,
|
|
/// Breakpoint source location.
|
|
pub location: Option<SourceLocation>,
|
|
/// Indicates the severity of the log. Only relevant when action is `LOG`.
|
|
#[serde(rename="logLevel")]
|
|
pub log_level: Option<String>,
|
|
/// 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 ]`.
|
|
#[serde(rename="logMessageFormat")]
|
|
pub log_message_format: Option<String>,
|
|
/// The stack at breakpoint time, where stack_frames[0] represents the most recently entered function.
|
|
#[serde(rename="stackFrames")]
|
|
pub stack_frames: Option<Vec<StackFrame>>,
|
|
/// The current state of the breakpoint.
|
|
pub state: Option<String>,
|
|
/// 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
|
|
pub status: Option<StatusMessage>,
|
|
/// E-mail address of the user that created this breakpoint
|
|
#[serde(rename="userEmail")]
|
|
pub user_email: Option<String>,
|
|
/// 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.
|
|
#[serde(rename="variableTable")]
|
|
pub variable_table: Option<Vec<Variable>>,
|
|
}
|
|
|
|
impl client::RequestValue for Breakpoint {}
|
|
|
|
|
|
/// A CloudRepoSourceContext denotes a particular revision in a cloud repo (a repo hosted by the Google Cloud Platform).
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CloudRepoSourceContext {
|
|
/// An alias, which may be a branch or tag.
|
|
#[serde(rename="aliasContext")]
|
|
pub alias_context: Option<AliasContext>,
|
|
/// The name of an alias (branch, tag, etc.).
|
|
#[serde(rename="aliasName")]
|
|
pub alias_name: Option<String>,
|
|
/// The ID of the repo.
|
|
#[serde(rename="repoId")]
|
|
pub repo_id: Option<RepoId>,
|
|
/// A revision ID.
|
|
#[serde(rename="revisionId")]
|
|
pub revision_id: Option<String>,
|
|
}
|
|
|
|
impl client::Part for CloudRepoSourceContext {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CloudWorkspaceId {
|
|
/// The unique name of the workspace within the repo. This is the name chosen by the client in the Source API's CreateWorkspace method.
|
|
pub name: Option<String>,
|
|
/// The ID of the repo containing the workspace.
|
|
#[serde(rename="repoId")]
|
|
pub repo_id: Option<RepoId>,
|
|
}
|
|
|
|
impl client::Part for CloudWorkspaceId {}
|
|
|
|
|
|
/// A CloudWorkspaceSourceContext denotes a workspace at a particular snapshot.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct CloudWorkspaceSourceContext {
|
|
/// The ID of the snapshot. An empty snapshot_id refers to the most recent snapshot.
|
|
#[serde(rename="snapshotId")]
|
|
pub snapshot_id: Option<String>,
|
|
/// The ID of the workspace.
|
|
#[serde(rename="workspaceId")]
|
|
pub workspace_id: Option<CloudWorkspaceId>,
|
|
}
|
|
|
|
impl client::Part for CloudWorkspaceSourceContext {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Debuggee {
|
|
/// Version ID of the agent. Schema: `domain/language-platform/vmajor.minor` (for example `google.com/java-gcp/v1.1`).
|
|
#[serde(rename="agentVersion")]
|
|
pub agent_version: Option<String>,
|
|
/// Used when setting breakpoint canary for this debuggee.
|
|
#[serde(rename="canaryMode")]
|
|
pub canary_mode: Option<String>,
|
|
/// Human readable description of the debuggee. Including a human-readable project name, environment name and version information is recommended.
|
|
pub description: Option<String>,
|
|
/// References to the locations and revisions of the source code used in the deployed application.
|
|
#[serde(rename="extSourceContexts")]
|
|
pub ext_source_contexts: Option<Vec<ExtendedSourceContext>>,
|
|
/// Unique identifier for the debuggee generated by the controller service.
|
|
pub id: Option<String>,
|
|
/// If set to `true`, indicates that the agent should disable itself and detach from the debuggee.
|
|
#[serde(rename="isDisabled")]
|
|
pub is_disabled: Option<bool>,
|
|
/// If set to `true`, indicates that Controller service does not detect any activity from the debuggee agents and the application is possibly stopped.
|
|
#[serde(rename="isInactive")]
|
|
pub is_inactive: Option<bool>,
|
|
/// A set of custom debuggee properties, populated by the agent, to be displayed to the user.
|
|
pub labels: Option<HashMap<String, String>>,
|
|
/// Project the debuggee is associated with. Use project number or id when registering a Google Cloud Platform project.
|
|
pub project: Option<String>,
|
|
/// References to the locations and revisions of the source code used in the deployed application.
|
|
#[serde(rename="sourceContexts")]
|
|
pub source_contexts: Option<Vec<SourceContext>>,
|
|
/// 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.
|
|
pub status: Option<StatusMessage>,
|
|
/// 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.
|
|
pub uniquifier: Option<String>,
|
|
}
|
|
|
|
impl client::Part for Debuggee {}
|
|
|
|
|
|
/// 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); } The JSON representation for `Empty` is empty JSON object `{}`.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints delete debugger](DebuggerDebuggeeBreakpointDeleteCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Empty { _never_set: Option<bool> }
|
|
|
|
impl client::ResponseResult for Empty {}
|
|
|
|
|
|
/// An ExtendedSourceContext is a SourceContext combined with additional details describing the context.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ExtendedSourceContext {
|
|
/// Any source context.
|
|
pub context: Option<SourceContext>,
|
|
/// Labels with user defined metadata.
|
|
pub labels: Option<HashMap<String, String>>,
|
|
}
|
|
|
|
impl client::Part for ExtendedSourceContext {}
|
|
|
|
|
|
/// Represents a message with parameters.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct FormatMessage {
|
|
/// 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.`
|
|
pub format: Option<String>,
|
|
/// Optional parameters to be embedded into the message.
|
|
pub parameters: Option<Vec<String>>,
|
|
}
|
|
|
|
impl client::Part for FormatMessage {}
|
|
|
|
|
|
/// A SourceContext referring to a Gerrit project.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GerritSourceContext {
|
|
/// An alias, which may be a branch or tag.
|
|
#[serde(rename="aliasContext")]
|
|
pub alias_context: Option<AliasContext>,
|
|
/// The name of an alias (branch, tag, etc.).
|
|
#[serde(rename="aliasName")]
|
|
pub alias_name: Option<String>,
|
|
/// 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.
|
|
#[serde(rename="gerritProject")]
|
|
pub gerrit_project: Option<String>,
|
|
/// The URI of a running Gerrit instance.
|
|
#[serde(rename="hostUri")]
|
|
pub host_uri: Option<String>,
|
|
/// A revision (commit) ID.
|
|
#[serde(rename="revisionId")]
|
|
pub revision_id: Option<String>,
|
|
}
|
|
|
|
impl client::Part for GerritSourceContext {}
|
|
|
|
|
|
/// Response for getting breakpoint information.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints get debugger](DebuggerDebuggeeBreakpointGetCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GetBreakpointResponse {
|
|
/// Complete breakpoint state. The fields `id` and `location` are guaranteed to be set.
|
|
pub breakpoint: Option<Breakpoint>,
|
|
}
|
|
|
|
impl client::ResponseResult for GetBreakpointResponse {}
|
|
|
|
|
|
/// A GitSourceContext denotes a particular revision in a third party Git repository (e.g. GitHub).
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GitSourceContext {
|
|
/// Git commit hash. required.
|
|
#[serde(rename="revisionId")]
|
|
pub revision_id: Option<String>,
|
|
/// Git repository URL.
|
|
pub url: Option<String>,
|
|
}
|
|
|
|
impl client::Part for GitSourceContext {}
|
|
|
|
|
|
/// Response for listing active breakpoints.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints list controller](ControllerDebuggeeBreakpointListCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListActiveBreakpointsResponse {
|
|
/// List of all active breakpoints. The fields `id` and `location` are guaranteed to be set on each breakpoint.
|
|
pub breakpoints: Option<Vec<Breakpoint>>,
|
|
/// A token that can be used in the next method call to block until the list of breakpoints changes.
|
|
#[serde(rename="nextWaitToken")]
|
|
pub next_wait_token: Option<String>,
|
|
/// 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.
|
|
#[serde(rename="waitExpired")]
|
|
pub wait_expired: Option<bool>,
|
|
}
|
|
|
|
impl client::ResponseResult for ListActiveBreakpointsResponse {}
|
|
|
|
|
|
/// Response for listing breakpoints.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints list debugger](DebuggerDebuggeeBreakpointListCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListBreakpointsResponse {
|
|
/// 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.
|
|
pub breakpoints: Option<Vec<Breakpoint>>,
|
|
/// 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.
|
|
#[serde(rename="nextWaitToken")]
|
|
pub next_wait_token: Option<String>,
|
|
}
|
|
|
|
impl client::ResponseResult for ListBreakpointsResponse {}
|
|
|
|
|
|
/// Response for listing debuggees.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees list debugger](DebuggerDebuggeeListCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListDebuggeesResponse {
|
|
/// 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.
|
|
pub debuggees: Option<Vec<Debuggee>>,
|
|
}
|
|
|
|
impl client::ResponseResult for ListDebuggeesResponse {}
|
|
|
|
|
|
/// Selects a repo using a Google Cloud Platform project ID (e.g. winged-cargo-31) and a repo name within that project.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ProjectRepoId {
|
|
/// The ID of the project.
|
|
#[serde(rename="projectId")]
|
|
pub project_id: Option<String>,
|
|
/// The name of the repo. Leave empty for the default repo.
|
|
#[serde(rename="repoName")]
|
|
pub repo_name: Option<String>,
|
|
}
|
|
|
|
impl client::Part for ProjectRepoId {}
|
|
|
|
|
|
/// Request to register a debuggee.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees register controller](ControllerDebuggeeRegisterCall) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RegisterDebuggeeRequest {
|
|
/// Required. Debuggee information to register. The fields `project`, `uniquifier`, `description` and `agent_version` of the debuggee must be set.
|
|
pub debuggee: Option<Debuggee>,
|
|
}
|
|
|
|
impl client::RequestValue for RegisterDebuggeeRequest {}
|
|
|
|
|
|
/// Response for registering a debuggee.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees register controller](ControllerDebuggeeRegisterCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RegisterDebuggeeResponse {
|
|
/// A unique ID generated for the agent. Each RegisterDebuggee request will generate a new agent ID.
|
|
#[serde(rename="agentId")]
|
|
pub agent_id: Option<String>,
|
|
/// 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.
|
|
pub debuggee: Option<Debuggee>,
|
|
}
|
|
|
|
impl client::ResponseResult for RegisterDebuggeeResponse {}
|
|
|
|
|
|
/// A unique identifier for a cloud repo.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RepoId {
|
|
/// A combination of a project ID and a repo name.
|
|
#[serde(rename="projectRepoId")]
|
|
pub project_repo_id: Option<ProjectRepoId>,
|
|
/// A server-assigned, globally unique identifier.
|
|
pub uid: Option<String>,
|
|
}
|
|
|
|
impl client::Part for RepoId {}
|
|
|
|
|
|
/// Response for setting a breakpoint.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints set debugger](DebuggerDebuggeeBreakpointSetCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct SetBreakpointResponse {
|
|
/// Breakpoint resource. The field `id` is guaranteed to be set (in addition to the echoed fields).
|
|
pub breakpoint: Option<Breakpoint>,
|
|
}
|
|
|
|
impl client::ResponseResult for SetBreakpointResponse {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct SourceContext {
|
|
/// A SourceContext referring to a revision in a cloud repo.
|
|
#[serde(rename="cloudRepo")]
|
|
pub cloud_repo: Option<CloudRepoSourceContext>,
|
|
/// A SourceContext referring to a snapshot in a cloud workspace.
|
|
#[serde(rename="cloudWorkspace")]
|
|
pub cloud_workspace: Option<CloudWorkspaceSourceContext>,
|
|
/// A SourceContext referring to a Gerrit project.
|
|
pub gerrit: Option<GerritSourceContext>,
|
|
/// A SourceContext referring to any third party Git repo (e.g. GitHub).
|
|
pub git: Option<GitSourceContext>,
|
|
}
|
|
|
|
impl client::Part for SourceContext {}
|
|
|
|
|
|
/// Represents a location in the source code.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct SourceLocation {
|
|
/// 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.
|
|
pub column: Option<i32>,
|
|
/// Line inside the file. The first line in the file has the value `1`.
|
|
pub line: Option<i32>,
|
|
/// Path to the source file within the source context of the target binary.
|
|
pub path: Option<String>,
|
|
}
|
|
|
|
impl client::Part for SourceLocation {}
|
|
|
|
|
|
/// Represents a stack frame context.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct StackFrame {
|
|
/// Set of arguments passed to this function. Note that this might not be populated for all stack frames.
|
|
pub arguments: Option<Vec<Variable>>,
|
|
/// Demangled function name at the call site.
|
|
pub function: Option<String>,
|
|
/// Set of local variables at the stack frame location. Note that this might not be populated for all stack frames.
|
|
pub locals: Option<Vec<Variable>>,
|
|
/// Source location of the call site.
|
|
pub location: Option<SourceLocation>,
|
|
}
|
|
|
|
impl client::Part for StackFrame {}
|
|
|
|
|
|
/// 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`.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct StatusMessage {
|
|
/// Status message text.
|
|
pub description: Option<FormatMessage>,
|
|
/// Distinguishes errors from informational messages.
|
|
#[serde(rename="isError")]
|
|
pub is_error: Option<bool>,
|
|
/// Reference to which the message applies.
|
|
#[serde(rename="refersTo")]
|
|
pub refers_to: Option<String>,
|
|
}
|
|
|
|
impl client::Part for StatusMessage {}
|
|
|
|
|
|
/// Request to update an active breakpoint.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints update controller](ControllerDebuggeeBreakpointUpdateCall) (request)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct UpdateActiveBreakpointRequest {
|
|
/// Required. Updated breakpoint information. The field `id` must be set. The agent must echo all Breakpoint specification fields in the update.
|
|
pub breakpoint: Option<Breakpoint>,
|
|
}
|
|
|
|
impl client::RequestValue for UpdateActiveBreakpointRequest {}
|
|
|
|
|
|
/// Response for updating an active breakpoint. The message is defined to allow future extensions.
|
|
///
|
|
/// # Activities
|
|
///
|
|
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
|
|
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
|
///
|
|
/// * [debuggees breakpoints update controller](ControllerDebuggeeBreakpointUpdateCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct UpdateActiveBreakpointResponse { _never_set: Option<bool> }
|
|
|
|
impl client::ResponseResult for UpdateActiveBreakpointResponse {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Variable {
|
|
/// Members contained or pointed to by the variable.
|
|
pub members: Option<Vec<Variable>>,
|
|
/// Name of the variable, if any.
|
|
pub name: Option<String>,
|
|
/// 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`
|
|
pub status: Option<StatusMessage>,
|
|
/// 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.
|
|
#[serde(rename="type")]
|
|
pub type_: Option<String>,
|
|
/// Simple value of the variable.
|
|
pub value: Option<String>,
|
|
/// 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.
|
|
#[serde(rename="varTableIndex")]
|
|
pub var_table_index: Option<i32>,
|
|
}
|
|
|
|
impl client::Part for Variable {}
|
|
|
|
|
|
|
|
// ###################
|
|
// MethodBuilders ###
|
|
// #################
|
|
|
|
/// A builder providing access to all methods supported on *controller* resources.
|
|
/// It is not used directly, but through the `CloudDebugger` hub.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// extern crate hyper;
|
|
/// extern crate hyper_rustls;
|
|
/// extern crate google_clouddebugger2 as clouddebugger2;
|
|
///
|
|
/// # async fn dox() {
|
|
/// use std::default::Default;
|
|
/// use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// secret,
|
|
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// ).build().await.unwrap();
|
|
/// let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
|
|
/// // like `debuggees_breakpoints_list(...)`, `debuggees_breakpoints_update(...)` and `debuggees_register(...)`
|
|
/// // to build up your call.
|
|
/// let rb = hub.controller();
|
|
/// # }
|
|
/// ```
|
|
pub struct ControllerMethods<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
}
|
|
|
|
impl<'a> client::MethodsBuilder for ControllerMethods<'a> {}
|
|
|
|
impl<'a> ControllerMethods<'a> {
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// 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.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `debuggeeId` - Required. Identifies the debuggee.
|
|
pub fn debuggees_breakpoints_list(&self, debuggee_id: &str) -> ControllerDebuggeeBreakpointListCall<'a> {
|
|
ControllerDebuggeeBreakpointListCall {
|
|
hub: self.hub,
|
|
_debuggee_id: debuggee_id.to_string(),
|
|
_wait_token: Default::default(),
|
|
_success_on_timeout: Default::default(),
|
|
_agent_id: Default::default(),
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// 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.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `debuggeeId` - Required. Identifies the debuggee being debugged.
|
|
/// * `id` - Breakpoint identifier, unique in the scope of the debuggee.
|
|
pub fn debuggees_breakpoints_update(&self, request: UpdateActiveBreakpointRequest, debuggee_id: &str, id: &str) -> ControllerDebuggeeBreakpointUpdateCall<'a> {
|
|
ControllerDebuggeeBreakpointUpdateCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_debuggee_id: debuggee_id.to_string(),
|
|
_id: id.to_string(),
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// 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.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
pub fn debuggees_register(&self, request: RegisterDebuggeeRequest) -> ControllerDebuggeeRegisterCall<'a> {
|
|
ControllerDebuggeeRegisterCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// A builder providing access to all methods supported on *debugger* resources.
|
|
/// It is not used directly, but through the `CloudDebugger` hub.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// extern crate hyper;
|
|
/// extern crate hyper_rustls;
|
|
/// extern crate google_clouddebugger2 as clouddebugger2;
|
|
///
|
|
/// # async fn dox() {
|
|
/// use std::default::Default;
|
|
/// use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// secret,
|
|
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// ).build().await.unwrap();
|
|
/// let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
|
|
/// // like `debuggees_breakpoints_delete(...)`, `debuggees_breakpoints_get(...)`, `debuggees_breakpoints_list(...)`, `debuggees_breakpoints_set(...)` and `debuggees_list(...)`
|
|
/// // to build up your call.
|
|
/// let rb = hub.debugger();
|
|
/// # }
|
|
/// ```
|
|
pub struct DebuggerMethods<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
}
|
|
|
|
impl<'a> client::MethodsBuilder for DebuggerMethods<'a> {}
|
|
|
|
impl<'a> DebuggerMethods<'a> {
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Deletes the breakpoint from the debuggee.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `debuggeeId` - Required. ID of the debuggee whose breakpoint to delete.
|
|
/// * `breakpointId` - Required. ID of the breakpoint to delete.
|
|
pub fn debuggees_breakpoints_delete(&self, debuggee_id: &str, breakpoint_id: &str) -> DebuggerDebuggeeBreakpointDeleteCall<'a> {
|
|
DebuggerDebuggeeBreakpointDeleteCall {
|
|
hub: self.hub,
|
|
_debuggee_id: debuggee_id.to_string(),
|
|
_breakpoint_id: breakpoint_id.to_string(),
|
|
_client_version: Default::default(),
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Gets breakpoint information.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `debuggeeId` - Required. ID of the debuggee whose breakpoint to get.
|
|
/// * `breakpointId` - Required. ID of the breakpoint to get.
|
|
pub fn debuggees_breakpoints_get(&self, debuggee_id: &str, breakpoint_id: &str) -> DebuggerDebuggeeBreakpointGetCall<'a> {
|
|
DebuggerDebuggeeBreakpointGetCall {
|
|
hub: self.hub,
|
|
_debuggee_id: debuggee_id.to_string(),
|
|
_breakpoint_id: breakpoint_id.to_string(),
|
|
_client_version: Default::default(),
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists all breakpoints for the debuggee.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `debuggeeId` - Required. ID of the debuggee whose breakpoints to list.
|
|
pub fn debuggees_breakpoints_list(&self, debuggee_id: &str) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
DebuggerDebuggeeBreakpointListCall {
|
|
hub: self.hub,
|
|
_debuggee_id: debuggee_id.to_string(),
|
|
_wait_token: Default::default(),
|
|
_strip_results: Default::default(),
|
|
_include_inactive: Default::default(),
|
|
_include_all_users: Default::default(),
|
|
_client_version: Default::default(),
|
|
_action_value: Default::default(),
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Sets the breakpoint to the debuggee.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `debuggeeId` - Required. ID of the debuggee where the breakpoint is to be set.
|
|
pub fn debuggees_breakpoints_set(&self, request: Breakpoint, debuggee_id: &str) -> DebuggerDebuggeeBreakpointSetCall<'a> {
|
|
DebuggerDebuggeeBreakpointSetCall {
|
|
hub: self.hub,
|
|
_request: request,
|
|
_debuggee_id: debuggee_id.to_string(),
|
|
_client_version: Default::default(),
|
|
_canary_option: Default::default(),
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
|
|
/// Create a builder to help you perform the following task:
|
|
///
|
|
/// Lists all the debuggees that the user has access to.
|
|
pub fn debuggees_list(&self) -> DebuggerDebuggeeListCall<'a> {
|
|
DebuggerDebuggeeListCall {
|
|
hub: self.hub,
|
|
_project: Default::default(),
|
|
_include_inactive: Default::default(),
|
|
_client_version: Default::default(),
|
|
_delegate: Default::default(),
|
|
_additional_params: Default::default(),
|
|
_scopes: Default::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ###################
|
|
// CallBuilders ###
|
|
// #################
|
|
|
|
/// 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.
|
|
///
|
|
/// A builder for the *debuggees.breakpoints.list* method supported by a *controller* resource.
|
|
/// It is not used directly, but through a `ControllerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.controller().debuggees_breakpoints_list("debuggeeId")
|
|
/// .wait_token("amet.")
|
|
/// .success_on_timeout(true)
|
|
/// .agent_id("gubergren")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ControllerDebuggeeBreakpointListCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_debuggee_id: String,
|
|
_wait_token: Option<String>,
|
|
_success_on_timeout: Option<bool>,
|
|
_agent_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ControllerDebuggeeBreakpointListCall<'a> {}
|
|
|
|
impl<'a> ControllerDebuggeeBreakpointListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListActiveBreakpointsResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.controller.debuggees.breakpoints.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("debuggeeId", self._debuggee_id.to_string()));
|
|
if let Some(value) = self._wait_token {
|
|
params.push(("waitToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._success_on_timeout {
|
|
params.push(("successOnTimeout", value.to_string()));
|
|
}
|
|
if let Some(value) = self._agent_id {
|
|
params.push(("agentId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "debuggeeId", "waitToken", "successOnTimeout", "agentId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/controller/debuggees/{debuggeeId}/breakpoints";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{debuggeeId}", "debuggeeId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["debuggeeId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Required. Identifies the debuggee.
|
|
///
|
|
/// Sets the *debuggee id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn debuggee_id(mut self, new_value: &str) -> ControllerDebuggeeBreakpointListCall<'a> {
|
|
self._debuggee_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// 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"`.
|
|
///
|
|
/// Sets the *wait token* query property to the given value.
|
|
pub fn wait_token(mut self, new_value: &str) -> ControllerDebuggeeBreakpointListCall<'a> {
|
|
self._wait_token = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// 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.
|
|
///
|
|
/// Sets the *success on timeout* query property to the given value.
|
|
pub fn success_on_timeout(mut self, new_value: bool) -> ControllerDebuggeeBreakpointListCall<'a> {
|
|
self._success_on_timeout = Some(new_value);
|
|
self
|
|
}
|
|
/// Identifies the agent. This is the ID returned in the RegisterDebuggee response.
|
|
///
|
|
/// Sets the *agent id* query property to the given value.
|
|
pub fn agent_id(mut self, new_value: &str) -> ControllerDebuggeeBreakpointListCall<'a> {
|
|
self._agent_id = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ControllerDebuggeeBreakpointListCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> ControllerDebuggeeBreakpointListCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ControllerDebuggeeBreakpointListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// A builder for the *debuggees.breakpoints.update* method supported by a *controller* resource.
|
|
/// It is not used directly, but through a `ControllerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// use clouddebugger2::api::UpdateActiveBreakpointRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // As the method needs a request, you would usually fill it with the desired information
|
|
/// // into the respective structure. Some of the parts shown here might not be applicable !
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let mut req = UpdateActiveBreakpointRequest::default();
|
|
///
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.controller().debuggees_breakpoints_update(req, "debuggeeId", "id")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ControllerDebuggeeBreakpointUpdateCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_request: UpdateActiveBreakpointRequest,
|
|
_debuggee_id: String,
|
|
_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ControllerDebuggeeBreakpointUpdateCall<'a> {}
|
|
|
|
impl<'a> ControllerDebuggeeBreakpointUpdateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, UpdateActiveBreakpointResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.controller.debuggees.breakpoints.update",
|
|
http_method: hyper::Method::PUT });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("debuggeeId", self._debuggee_id.to_string()));
|
|
params.push(("id", self._id.to_string()));
|
|
for &field in ["alt", "debuggeeId", "id"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/controller/debuggees/{debuggeeId}/breakpoints/{id}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{debuggeeId}", "debuggeeId"), ("{id}", "id")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["id", "debuggeeId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::PUT).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// Sets the *request* property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn request(mut self, new_value: UpdateActiveBreakpointRequest) -> ControllerDebuggeeBreakpointUpdateCall<'a> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Required. Identifies the debuggee being debugged.
|
|
///
|
|
/// Sets the *debuggee id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn debuggee_id(mut self, new_value: &str) -> ControllerDebuggeeBreakpointUpdateCall<'a> {
|
|
self._debuggee_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// Breakpoint identifier, unique in the scope of the debuggee.
|
|
///
|
|
/// Sets the *id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn id(mut self, new_value: &str) -> ControllerDebuggeeBreakpointUpdateCall<'a> {
|
|
self._id = new_value.to_string();
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ControllerDebuggeeBreakpointUpdateCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> ControllerDebuggeeBreakpointUpdateCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ControllerDebuggeeBreakpointUpdateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// A builder for the *debuggees.register* method supported by a *controller* resource.
|
|
/// It is not used directly, but through a `ControllerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// use clouddebugger2::api::RegisterDebuggeeRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // As the method needs a request, you would usually fill it with the desired information
|
|
/// // into the respective structure. Some of the parts shown here might not be applicable !
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let mut req = RegisterDebuggeeRequest::default();
|
|
///
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.controller().debuggees_register(req)
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ControllerDebuggeeRegisterCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_request: RegisterDebuggeeRequest,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ControllerDebuggeeRegisterCall<'a> {}
|
|
|
|
impl<'a> ControllerDebuggeeRegisterCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, RegisterDebuggeeResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.controller.debuggees.register",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
for &field in ["alt"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/controller/debuggees/register";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// Sets the *request* property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn request(mut self, new_value: RegisterDebuggeeRequest) -> ControllerDebuggeeRegisterCall<'a> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ControllerDebuggeeRegisterCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> ControllerDebuggeeRegisterCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> ControllerDebuggeeRegisterCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Deletes the breakpoint from the debuggee.
|
|
///
|
|
/// A builder for the *debuggees.breakpoints.delete* method supported by a *debugger* resource.
|
|
/// It is not used directly, but through a `DebuggerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.debugger().debuggees_breakpoints_delete("debuggeeId", "breakpointId")
|
|
/// .client_version("ea")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct DebuggerDebuggeeBreakpointDeleteCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_debuggee_id: String,
|
|
_breakpoint_id: String,
|
|
_client_version: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for DebuggerDebuggeeBreakpointDeleteCall<'a> {}
|
|
|
|
impl<'a> DebuggerDebuggeeBreakpointDeleteCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.delete",
|
|
http_method: hyper::Method::DELETE });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("debuggeeId", self._debuggee_id.to_string()));
|
|
params.push(("breakpointId", self._breakpoint_id.to_string()));
|
|
if let Some(value) = self._client_version {
|
|
params.push(("clientVersion", value.to_string()));
|
|
}
|
|
for &field in ["alt", "debuggeeId", "breakpointId", "clientVersion"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/debugger/debuggees/{debuggeeId}/breakpoints/{breakpointId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{debuggeeId}", "debuggeeId"), ("{breakpointId}", "breakpointId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["breakpointId", "debuggeeId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::DELETE).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Required. ID of the debuggee whose breakpoint to delete.
|
|
///
|
|
/// Sets the *debuggee id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn debuggee_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointDeleteCall<'a> {
|
|
self._debuggee_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// Required. ID of the breakpoint to delete.
|
|
///
|
|
/// Sets the *breakpoint id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn breakpoint_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointDeleteCall<'a> {
|
|
self._breakpoint_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// Required. The client version making the call. Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
|
|
///
|
|
/// Sets the *client version* query property to the given value.
|
|
pub fn client_version(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointDeleteCall<'a> {
|
|
self._client_version = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DebuggerDebuggeeBreakpointDeleteCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> DebuggerDebuggeeBreakpointDeleteCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> DebuggerDebuggeeBreakpointDeleteCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets breakpoint information.
|
|
///
|
|
/// A builder for the *debuggees.breakpoints.get* method supported by a *debugger* resource.
|
|
/// It is not used directly, but through a `DebuggerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.debugger().debuggees_breakpoints_get("debuggeeId", "breakpointId")
|
|
/// .client_version("amet")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct DebuggerDebuggeeBreakpointGetCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_debuggee_id: String,
|
|
_breakpoint_id: String,
|
|
_client_version: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for DebuggerDebuggeeBreakpointGetCall<'a> {}
|
|
|
|
impl<'a> DebuggerDebuggeeBreakpointGetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GetBreakpointResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.get",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("debuggeeId", self._debuggee_id.to_string()));
|
|
params.push(("breakpointId", self._breakpoint_id.to_string()));
|
|
if let Some(value) = self._client_version {
|
|
params.push(("clientVersion", value.to_string()));
|
|
}
|
|
for &field in ["alt", "debuggeeId", "breakpointId", "clientVersion"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/debugger/debuggees/{debuggeeId}/breakpoints/{breakpointId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{debuggeeId}", "debuggeeId"), ("{breakpointId}", "breakpointId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["breakpointId", "debuggeeId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Required. ID of the debuggee whose breakpoint to get.
|
|
///
|
|
/// Sets the *debuggee id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn debuggee_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointGetCall<'a> {
|
|
self._debuggee_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// Required. ID of the breakpoint to get.
|
|
///
|
|
/// Sets the *breakpoint id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn breakpoint_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointGetCall<'a> {
|
|
self._breakpoint_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// Required. The client version making the call. Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
|
|
///
|
|
/// Sets the *client version* query property to the given value.
|
|
pub fn client_version(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointGetCall<'a> {
|
|
self._client_version = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DebuggerDebuggeeBreakpointGetCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> DebuggerDebuggeeBreakpointGetCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> DebuggerDebuggeeBreakpointGetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Lists all breakpoints for the debuggee.
|
|
///
|
|
/// A builder for the *debuggees.breakpoints.list* method supported by a *debugger* resource.
|
|
/// It is not used directly, but through a `DebuggerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.debugger().debuggees_breakpoints_list("debuggeeId")
|
|
/// .wait_token("ipsum")
|
|
/// .strip_results(false)
|
|
/// .include_inactive(true)
|
|
/// .include_all_users(true)
|
|
/// .client_version("ipsum")
|
|
/// .action_value("est")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct DebuggerDebuggeeBreakpointListCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_debuggee_id: String,
|
|
_wait_token: Option<String>,
|
|
_strip_results: Option<bool>,
|
|
_include_inactive: Option<bool>,
|
|
_include_all_users: Option<bool>,
|
|
_client_version: Option<String>,
|
|
_action_value: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for DebuggerDebuggeeBreakpointListCall<'a> {}
|
|
|
|
impl<'a> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListBreakpointsResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len());
|
|
params.push(("debuggeeId", self._debuggee_id.to_string()));
|
|
if let Some(value) = self._wait_token {
|
|
params.push(("waitToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._strip_results {
|
|
params.push(("stripResults", value.to_string()));
|
|
}
|
|
if let Some(value) = self._include_inactive {
|
|
params.push(("includeInactive", value.to_string()));
|
|
}
|
|
if let Some(value) = self._include_all_users {
|
|
params.push(("includeAllUsers", value.to_string()));
|
|
}
|
|
if let Some(value) = self._client_version {
|
|
params.push(("clientVersion", value.to_string()));
|
|
}
|
|
if let Some(value) = self._action_value {
|
|
params.push(("action.value", value.to_string()));
|
|
}
|
|
for &field in ["alt", "debuggeeId", "waitToken", "stripResults", "includeInactive", "includeAllUsers", "clientVersion", "action.value"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/debugger/debuggees/{debuggeeId}/breakpoints";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{debuggeeId}", "debuggeeId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["debuggeeId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Required. ID of the debuggee whose breakpoints to list.
|
|
///
|
|
/// Sets the *debuggee id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn debuggee_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._debuggee_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// 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`.
|
|
///
|
|
/// Sets the *wait token* query property to the given value.
|
|
pub fn wait_token(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._wait_token = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// This field is deprecated. The following fields are always stripped out of the result: `stack_frames`, `evaluated_expressions` and `variable_table`.
|
|
///
|
|
/// Sets the *strip results* query property to the given value.
|
|
pub fn strip_results(mut self, new_value: bool) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._strip_results = Some(new_value);
|
|
self
|
|
}
|
|
/// When set to `true`, the response includes active and inactive breakpoints. Otherwise, it includes only active breakpoints.
|
|
///
|
|
/// Sets the *include inactive* query property to the given value.
|
|
pub fn include_inactive(mut self, new_value: bool) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._include_inactive = Some(new_value);
|
|
self
|
|
}
|
|
/// When set to `true`, the response includes the list of breakpoints set by any user. Otherwise, it includes only breakpoints set by the caller.
|
|
///
|
|
/// Sets the *include all users* query property to the given value.
|
|
pub fn include_all_users(mut self, new_value: bool) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._include_all_users = Some(new_value);
|
|
self
|
|
}
|
|
/// Required. The client version making the call. Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
|
|
///
|
|
/// Sets the *client version* query property to the given value.
|
|
pub fn client_version(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._client_version = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Only breakpoints with the specified action will pass the filter.
|
|
///
|
|
/// Sets the *action.value* query property to the given value.
|
|
pub fn action_value(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._action_value = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DebuggerDebuggeeBreakpointListCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> DebuggerDebuggeeBreakpointListCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> DebuggerDebuggeeBreakpointListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Sets the breakpoint to the debuggee.
|
|
///
|
|
/// A builder for the *debuggees.breakpoints.set* method supported by a *debugger* resource.
|
|
/// It is not used directly, but through a `DebuggerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// use clouddebugger2::api::Breakpoint;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // As the method needs a request, you would usually fill it with the desired information
|
|
/// // into the respective structure. Some of the parts shown here might not be applicable !
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let mut req = Breakpoint::default();
|
|
///
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.debugger().debuggees_breakpoints_set(req, "debuggeeId")
|
|
/// .client_version("ea")
|
|
/// .canary_option("dolor")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct DebuggerDebuggeeBreakpointSetCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_request: Breakpoint,
|
|
_debuggee_id: String,
|
|
_client_version: Option<String>,
|
|
_canary_option: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for DebuggerDebuggeeBreakpointSetCall<'a> {}
|
|
|
|
impl<'a> DebuggerDebuggeeBreakpointSetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, SetBreakpointResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.set",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("debuggeeId", self._debuggee_id.to_string()));
|
|
if let Some(value) = self._client_version {
|
|
params.push(("clientVersion", value.to_string()));
|
|
}
|
|
if let Some(value) = self._canary_option {
|
|
params.push(("canaryOption", value.to_string()));
|
|
}
|
|
for &field in ["alt", "debuggeeId", "clientVersion", "canaryOption"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/debugger/debuggees/{debuggeeId}/breakpoints/set";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{debuggeeId}", "debuggeeId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["debuggeeId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// Sets the *request* property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn request(mut self, new_value: Breakpoint) -> DebuggerDebuggeeBreakpointSetCall<'a> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Required. ID of the debuggee where the breakpoint is to be set.
|
|
///
|
|
/// Sets the *debuggee id* path property to the given value.
|
|
///
|
|
/// Even though the property as already been set when instantiating this call,
|
|
/// we provide this method for API completeness.
|
|
pub fn debuggee_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointSetCall<'a> {
|
|
self._debuggee_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// Required. The client version making the call. Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
|
|
///
|
|
/// Sets the *client version* query property to the given value.
|
|
pub fn client_version(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointSetCall<'a> {
|
|
self._client_version = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The canary option set by the user upon setting breakpoint.
|
|
///
|
|
/// Sets the *canary option* query property to the given value.
|
|
pub fn canary_option(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointSetCall<'a> {
|
|
self._canary_option = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DebuggerDebuggeeBreakpointSetCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> DebuggerDebuggeeBreakpointSetCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> DebuggerDebuggeeBreakpointSetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Lists all the debuggees that the user has access to.
|
|
///
|
|
/// A builder for the *debuggees.list* method supported by a *debugger* resource.
|
|
/// It is not used directly, but through a `DebuggerMethods` instance.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// Instantiate a resource method builder
|
|
///
|
|
/// ```test_harness,no_run
|
|
/// # extern crate hyper;
|
|
/// # extern crate hyper_rustls;
|
|
/// # extern crate google_clouddebugger2 as clouddebugger2;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use clouddebugger2::{CloudDebugger, oauth2, hyper, hyper_rustls};
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = CloudDebugger::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
|
|
/// // You can configure optional parameters by calling the respective setters at will, and
|
|
/// // execute the final call using `doit()`.
|
|
/// // Values shown here are possibly random and not representative !
|
|
/// let result = hub.debugger().debuggees_list()
|
|
/// .project("Lorem")
|
|
/// .include_inactive(false)
|
|
/// .client_version("sed")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct DebuggerDebuggeeListCall<'a>
|
|
where {
|
|
|
|
hub: &'a CloudDebugger<>,
|
|
_project: Option<String>,
|
|
_include_inactive: Option<bool>,
|
|
_client_version: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for DebuggerDebuggeeListCall<'a> {}
|
|
|
|
impl<'a> DebuggerDebuggeeListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListDebuggeesResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "clouddebugger.debugger.debuggees.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
if let Some(value) = self._project {
|
|
params.push(("project", value.to_string()));
|
|
}
|
|
if let Some(value) = self._include_inactive {
|
|
params.push(("includeInactive", value.to_string()));
|
|
}
|
|
if let Some(value) = self._client_version {
|
|
params.push(("clientVersion", value.to_string()));
|
|
}
|
|
for &field in ["alt", "project", "includeInactive", "clientVersion"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v2/debugger/debuggees";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
let mut req_result = {
|
|
let client = &self.hub.client;
|
|
dlg.pre_request();
|
|
let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
let (parts, _) = res.into_parts();
|
|
let body = hyper::Body::from(res_body_string.clone());
|
|
let restored_response = hyper::Response::from_parts(parts, body);
|
|
|
|
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
|
|
dlg.finished(false);
|
|
|
|
return match server_response {
|
|
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
|
None => Err(client::Error::Failure(restored_response)),
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Required. Project number of a Google Cloud project whose debuggees to list.
|
|
///
|
|
/// Sets the *project* query property to the given value.
|
|
pub fn project(mut self, new_value: &str) -> DebuggerDebuggeeListCall<'a> {
|
|
self._project = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// When set to `true`, the result includes all debuggees. Otherwise, the result includes only debuggees that are active.
|
|
///
|
|
/// Sets the *include inactive* query property to the given value.
|
|
pub fn include_inactive(mut self, new_value: bool) -> DebuggerDebuggeeListCall<'a> {
|
|
self._include_inactive = Some(new_value);
|
|
self
|
|
}
|
|
/// Required. The client version making the call. Schema: `domain/type/version` (e.g., `google.com/intellij/v1`).
|
|
///
|
|
/// Sets the *client version* query property to the given value.
|
|
pub fn client_version(mut self, new_value: &str) -> DebuggerDebuggeeListCall<'a> {
|
|
self._client_version = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
|
/// while executing the actual API request.
|
|
///
|
|
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
|
///
|
|
/// Sets the *delegate* property to the given value.
|
|
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DebuggerDebuggeeListCall<'a> {
|
|
self._delegate = Some(new_value);
|
|
self
|
|
}
|
|
|
|
/// Set any additional parameter of the query string used in the request.
|
|
/// It should be used to set parameters which are not yet available through their own
|
|
/// setters.
|
|
///
|
|
/// Please note that this method must not be used to set any of the known parameters
|
|
/// which have their own setter method. If done anyway, the request will fail.
|
|
///
|
|
/// # Additional Parameters
|
|
///
|
|
/// * *$.xgafv* (query-string) - V1 error format.
|
|
/// * *access_token* (query-string) - OAuth access token.
|
|
/// * *alt* (query-string) - Data format for response.
|
|
/// * *callback* (query-string) - JSONP
|
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
|
/// * *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.
|
|
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
|
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
|
/// * *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.
|
|
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
|
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
|
pub fn param<T>(mut self, name: T, value: T) -> DebuggerDebuggeeListCall<'a>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
self
|
|
}
|
|
|
|
/// Identifies the authorization scope for the method you are building.
|
|
///
|
|
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
|
|
/// `Scope::CloudPlatform`.
|
|
///
|
|
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
|
/// tokens for more than one scope.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
|
/// sufficient, a read-write scope will do as well.
|
|
pub fn add_scope<T, S>(mut self, scope: T) -> DebuggerDebuggeeListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|