google_remotebuildexecution2/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud Platform data
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all RemoteBuildExecution related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_remotebuildexecution2 as remotebuildexecution2;
49/// use remotebuildexecution2::{Result, Error};
50/// # async fn dox() {
51/// use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace  `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62///     secret,
63///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64/// ).build().await.unwrap();
65///
66/// let client = hyper_util::client::legacy::Client::builder(
67///     hyper_util::rt::TokioExecutor::new()
68/// )
69/// .build(
70///     hyper_rustls::HttpsConnectorBuilder::new()
71///         .with_native_roots()
72///         .unwrap()
73///         .https_or_http()
74///         .enable_http1()
75///         .build()
76/// );
77/// let mut hub = RemoteBuildExecution::new(client, auth);
78/// // You can configure optional parameters by calling the respective setters at will, and
79/// // execute the final call using `doit()`.
80/// // Values shown here are possibly random and not representative !
81/// let result = hub.action_results().get("instanceName", "hash", -4)
82///              .inline_stdout(true)
83///              .inline_stderr(false)
84///              .add_inline_output_files("amet")
85///              .doit().await;
86///
87/// match result {
88///     Err(e) => match e {
89///         // The Error enum provides details about what exactly happened.
90///         // You can also just use its `Debug`, `Display` or `Error` traits
91///          Error::HttpError(_)
92///         |Error::Io(_)
93///         |Error::MissingAPIKey
94///         |Error::MissingToken(_)
95///         |Error::Cancelled
96///         |Error::UploadSizeLimitExceeded(_, _)
97///         |Error::Failure(_)
98///         |Error::BadRequest(_)
99///         |Error::FieldClash(_)
100///         |Error::JsonDecodeError(_, _) => println!("{}", e),
101///     },
102///     Ok(res) => println!("Success: {:?}", res),
103/// }
104/// # }
105/// ```
106#[derive(Clone)]
107pub struct RemoteBuildExecution<C> {
108    pub client: common::Client<C>,
109    pub auth: Box<dyn common::GetToken>,
110    _user_agent: String,
111    _base_url: String,
112    _root_url: String,
113}
114
115impl<C> common::Hub for RemoteBuildExecution<C> {}
116
117impl<'a, C> RemoteBuildExecution<C> {
118    pub fn new<A: 'static + common::GetToken>(
119        client: common::Client<C>,
120        auth: A,
121    ) -> RemoteBuildExecution<C> {
122        RemoteBuildExecution {
123            client,
124            auth: Box::new(auth),
125            _user_agent: "google-api-rust-client/6.0.0".to_string(),
126            _base_url: "https://remotebuildexecution.googleapis.com/".to_string(),
127            _root_url: "https://remotebuildexecution.googleapis.com/".to_string(),
128        }
129    }
130
131    pub fn action_results(&'a self) -> ActionResultMethods<'a, C> {
132        ActionResultMethods { hub: self }
133    }
134    pub fn actions(&'a self) -> ActionMethods<'a, C> {
135        ActionMethods { hub: self }
136    }
137    pub fn blobs(&'a self) -> BlobMethods<'a, C> {
138        BlobMethods { hub: self }
139    }
140    pub fn methods(&'a self) -> MethodMethods<'a, C> {
141        MethodMethods { hub: self }
142    }
143    pub fn operations(&'a self) -> OperationMethods<'a, C> {
144        OperationMethods { hub: self }
145    }
146
147    /// Set the user-agent header field to use in all requests to the server.
148    /// It defaults to `google-api-rust-client/6.0.0`.
149    ///
150    /// Returns the previously set user-agent.
151    pub fn user_agent(&mut self, agent_name: String) -> String {
152        std::mem::replace(&mut self._user_agent, agent_name)
153    }
154
155    /// Set the base url to use in all requests to the server.
156    /// It defaults to `https://remotebuildexecution.googleapis.com/`.
157    ///
158    /// Returns the previously set base url.
159    pub fn base_url(&mut self, new_base_url: String) -> String {
160        std::mem::replace(&mut self._base_url, new_base_url)
161    }
162
163    /// Set the root url to use in all requests to the server.
164    /// It defaults to `https://remotebuildexecution.googleapis.com/`.
165    ///
166    /// Returns the previously set root url.
167    pub fn root_url(&mut self, new_root_url: String) -> String {
168        std::mem::replace(&mut self._root_url, new_root_url)
169    }
170}
171
172// ############
173// SCHEMAS ###
174// ##########
175/// Describes the server/instance capabilities for updating the action cache.
176///
177/// This type is not used in any activity, and only used as *part* of another schema.
178///
179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
180#[serde_with::serde_as]
181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
182pub struct BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities {
183    /// no description provided
184    #[serde(rename = "updateEnabled")]
185    pub update_enabled: Option<bool>,
186}
187
188impl common::Part for BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities {}
189
190/// An ActionResult represents the result of an Action being run. It is advised that at least one field (for example `ActionResult.execution_metadata.Worker`) have a non-default value, to ensure that the serialized value is non-empty, which can then be used as a basic data sanity check.
191///
192/// # Activities
193///
194/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
195/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
196///
197/// * [get action results](ActionResultGetCall) (response)
198/// * [update action results](ActionResultUpdateCall) (request|response)
199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
200#[serde_with::serde_as]
201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
202pub struct BuildBazelRemoteExecutionV2ActionResult {
203    /// The details of the execution that originally produced this result.
204    #[serde(rename = "executionMetadata")]
205    pub execution_metadata: Option<BuildBazelRemoteExecutionV2ExecutedActionMetadata>,
206    /// The exit code of the command.
207    #[serde(rename = "exitCode")]
208    pub exit_code: Option<i32>,
209    /// The output directories of the action. For each output directory requested in the `output_directories` or `output_paths` field of the Action, if the corresponding directory existed after the action completed, a single entry will be present in the output list, which will contain the digest of a Tree message containing the directory tree, and the path equal exactly to the corresponding Action output_directories member. As an example, suppose the Action had an output directory `a/b/dir` and the execution produced the following contents in `a/b/dir`: a file named `bar` and a directory named `foo` with an executable file named `baz`. Then, output_directory will contain (hashes shortened for readability): ```json // OutputDirectory proto: { path: "a/b/dir" tree_digest: { hash: "4a73bc9d03...", size: 55 } } // Tree proto with hash "4a73bc9d03..." and size 55: { root: { files: [ { name: "bar", digest: { hash: "4a73bc9d03...", size: 65534 } } ], directories: [ { name: "foo", digest: { hash: "4cf2eda940...", size: 43 } } ] } children : { // (Directory proto with hash "4cf2eda940..." and size 43) files: [ { name: "baz", digest: { hash: "b2c941073e...", size: 1294, }, is_executable: true } ] } } ``` If an output of the same name as listed in `output_files` of the Command was found in `output_directories`, but was not a directory, the server will return a FAILED_PRECONDITION.
210    #[serde(rename = "outputDirectories")]
211    pub output_directories: Option<Vec<BuildBazelRemoteExecutionV2OutputDirectory>>,
212    /// The output directories of the action that are symbolic links to other directories. Those may be links to other output directories, or input directories, or even absolute paths outside of the working directory, if the server supports SymlinkAbsolutePathStrategy.ALLOWED. For each output directory requested in the `output_directories` field of the Action, if the directory existed after the action completed, a single entry will be present either in this field, or in the `output_directories` field, if the directory was not a symbolic link. If an output of the same name was found, but was a symbolic link to a file instead of a directory, the server will return a FAILED_PRECONDITION. If the action does not produce the requested output, then that output will be omitted from the list. The server is free to arrange the output list as desired; clients MUST NOT assume that the output list is sorted. DEPRECATED as of v2.1. Servers that wish to be compatible with v2.0 API should still populate this field in addition to `output_symlinks`.
213    #[serde(rename = "outputDirectorySymlinks")]
214    pub output_directory_symlinks: Option<Vec<BuildBazelRemoteExecutionV2OutputSymlink>>,
215    /// The output files of the action that are symbolic links to other files. Those may be links to other output files, or input files, or even absolute paths outside of the working directory, if the server supports SymlinkAbsolutePathStrategy.ALLOWED. For each output file requested in the `output_files` or `output_paths` field of the Action, if the corresponding file existed after the action completed, a single entry will be present either in this field, or in the `output_files` field, if the file was not a symbolic link. If an output symbolic link of the same name as listed in `output_files` of the Command was found, but its target type was not a regular file, the server will return a FAILED_PRECONDITION. If the action does not produce the requested output, then that output will be omitted from the list. The server is free to arrange the output list as desired; clients MUST NOT assume that the output list is sorted. DEPRECATED as of v2.1. Servers that wish to be compatible with v2.0 API should still populate this field in addition to `output_symlinks`.
216    #[serde(rename = "outputFileSymlinks")]
217    pub output_file_symlinks: Option<Vec<BuildBazelRemoteExecutionV2OutputSymlink>>,
218    /// The output files of the action. For each output file requested in the `output_files` or `output_paths` field of the Action, if the corresponding file existed after the action completed, a single entry will be present either in this field, or the `output_file_symlinks` field if the file was a symbolic link to another file (`output_symlinks` field after v2.1). If an output listed in `output_files` was found, but was a directory rather than a regular file, the server will return a FAILED_PRECONDITION. If the action does not produce the requested output, then that output will be omitted from the list. The server is free to arrange the output list as desired; clients MUST NOT assume that the output list is sorted.
219    #[serde(rename = "outputFiles")]
220    pub output_files: Option<Vec<BuildBazelRemoteExecutionV2OutputFile>>,
221    /// New in v2.1: this field will only be populated if the command `output_paths` field was used, and not the pre v2.1 `output_files` or `output_directories` fields. The output paths of the action that are symbolic links to other paths. Those may be links to other outputs, or inputs, or even absolute paths outside of the working directory, if the server supports SymlinkAbsolutePathStrategy.ALLOWED. A single entry for each output requested in `output_paths` field of the Action, if the corresponding path existed after the action completed and was a symbolic link. If the action does not produce a requested output, then that output will be omitted from the list. The server is free to arrange the output list as desired; clients MUST NOT assume that the output list is sorted.
222    #[serde(rename = "outputSymlinks")]
223    pub output_symlinks: Option<Vec<BuildBazelRemoteExecutionV2OutputSymlink>>,
224    /// The digest for a blob containing the standard error of the action, which can be retrieved from the ContentAddressableStorage.
225    #[serde(rename = "stderrDigest")]
226    pub stderr_digest: Option<BuildBazelRemoteExecutionV2Digest>,
227    /// The standard error buffer of the action. The server SHOULD NOT inline stderr unless requested by the client in the GetActionResultRequest message. The server MAY omit inlining, even if requested, and MUST do so if inlining would cause the response to exceed message size limits.
228    #[serde(rename = "stderrRaw")]
229    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
230    pub stderr_raw: Option<Vec<u8>>,
231    /// The digest for a blob containing the standard output of the action, which can be retrieved from the ContentAddressableStorage.
232    #[serde(rename = "stdoutDigest")]
233    pub stdout_digest: Option<BuildBazelRemoteExecutionV2Digest>,
234    /// The standard output buffer of the action. The server SHOULD NOT inline stdout unless requested by the client in the GetActionResultRequest message. The server MAY omit inlining, even if requested, and MUST do so if inlining would cause the response to exceed message size limits.
235    #[serde(rename = "stdoutRaw")]
236    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
237    pub stdout_raw: Option<Vec<u8>>,
238}
239
240impl common::RequestValue for BuildBazelRemoteExecutionV2ActionResult {}
241impl common::ResponseResult for BuildBazelRemoteExecutionV2ActionResult {}
242
243/// A request message for ContentAddressableStorage.BatchReadBlobs.
244///
245/// # Activities
246///
247/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
248/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
249///
250/// * [batch read blobs](BlobBatchReadCall) (request)
251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
252#[serde_with::serde_as]
253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
254pub struct BuildBazelRemoteExecutionV2BatchReadBlobsRequest {
255    /// The individual blob digests.
256    pub digests: Option<Vec<BuildBazelRemoteExecutionV2Digest>>,
257}
258
259impl common::RequestValue for BuildBazelRemoteExecutionV2BatchReadBlobsRequest {}
260
261/// A response message for ContentAddressableStorage.BatchReadBlobs.
262///
263/// # Activities
264///
265/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
266/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
267///
268/// * [batch read blobs](BlobBatchReadCall) (response)
269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
270#[serde_with::serde_as]
271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
272pub struct BuildBazelRemoteExecutionV2BatchReadBlobsResponse {
273    /// The responses to the requests.
274    pub responses: Option<Vec<BuildBazelRemoteExecutionV2BatchReadBlobsResponseResponse>>,
275}
276
277impl common::ResponseResult for BuildBazelRemoteExecutionV2BatchReadBlobsResponse {}
278
279/// A response corresponding to a single blob that the client tried to download.
280///
281/// This type is not used in any activity, and only used as *part* of another schema.
282///
283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
284#[serde_with::serde_as]
285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
286pub struct BuildBazelRemoteExecutionV2BatchReadBlobsResponseResponse {
287    /// The raw binary data.
288    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
289    pub data: Option<Vec<u8>>,
290    /// The digest to which this response corresponds.
291    pub digest: Option<BuildBazelRemoteExecutionV2Digest>,
292    /// The result of attempting to download that blob.
293    pub status: Option<GoogleRpcStatus>,
294}
295
296impl common::Part for BuildBazelRemoteExecutionV2BatchReadBlobsResponseResponse {}
297
298/// A request message for ContentAddressableStorage.BatchUpdateBlobs.
299///
300/// # Activities
301///
302/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
303/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
304///
305/// * [batch update blobs](BlobBatchUpdateCall) (request)
306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
307#[serde_with::serde_as]
308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
309pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest {
310    /// The individual upload requests.
311    pub requests: Option<Vec<BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest>>,
312}
313
314impl common::RequestValue for BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest {}
315
316/// A request corresponding to a single blob that the client wants to upload.
317///
318/// This type is not used in any activity, and only used as *part* of another schema.
319///
320#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
321#[serde_with::serde_as]
322#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
323pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest {
324    /// The raw binary data.
325    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
326    pub data: Option<Vec<u8>>,
327    /// The digest of the blob. This MUST be the digest of `data`.
328    pub digest: Option<BuildBazelRemoteExecutionV2Digest>,
329}
330
331impl common::Part for BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest {}
332
333/// A response message for ContentAddressableStorage.BatchUpdateBlobs.
334///
335/// # Activities
336///
337/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
338/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
339///
340/// * [batch update blobs](BlobBatchUpdateCall) (response)
341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
342#[serde_with::serde_as]
343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
344pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsResponse {
345    /// The responses to the requests.
346    pub responses: Option<Vec<BuildBazelRemoteExecutionV2BatchUpdateBlobsResponseResponse>>,
347}
348
349impl common::ResponseResult for BuildBazelRemoteExecutionV2BatchUpdateBlobsResponse {}
350
351/// A response corresponding to a single blob that the client tried to upload.
352///
353/// This type is not used in any activity, and only used as *part* of another schema.
354///
355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
356#[serde_with::serde_as]
357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
358pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsResponseResponse {
359    /// The blob digest to which this response corresponds.
360    pub digest: Option<BuildBazelRemoteExecutionV2Digest>,
361    /// The result of attempting to upload that blob.
362    pub status: Option<GoogleRpcStatus>,
363}
364
365impl common::Part for BuildBazelRemoteExecutionV2BatchUpdateBlobsResponseResponse {}
366
367/// Capabilities of the remote cache system.
368///
369/// This type is not used in any activity, and only used as *part* of another schema.
370///
371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
372#[serde_with::serde_as]
373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
374pub struct BuildBazelRemoteExecutionV2CacheCapabilities {
375    /// Capabilities for updating the action cache.
376    #[serde(rename = "actionCacheUpdateCapabilities")]
377    pub action_cache_update_capabilities:
378        Option<BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities>,
379    /// Supported cache priority range for both CAS and ActionCache.
380    #[serde(rename = "cachePriorityCapabilities")]
381    pub cache_priority_capabilities: Option<BuildBazelRemoteExecutionV2PriorityCapabilities>,
382    /// All the digest functions supported by the remote cache. Remote cache may support multiple digest functions simultaneously.
383    #[serde(rename = "digestFunction")]
384    pub digest_function: Option<Vec<String>>,
385    /// Maximum total size of blobs to be uploaded/downloaded using batch methods. A value of 0 means no limit is set, although in practice there will always be a message size limitation of the protocol in use, e.g. GRPC.
386    #[serde(rename = "maxBatchTotalSizeBytes")]
387    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
388    pub max_batch_total_size_bytes: Option<i64>,
389    /// Compressors supported by the "compressed-blobs" bytestream resources. Servers MUST support identity/no-compression, even if it is not listed here. Note that this does not imply which if any compressors are supported by the server at the gRPC level.
390    #[serde(rename = "supportedCompressor")]
391    pub supported_compressor: Option<Vec<String>>,
392    /// Whether absolute symlink targets are supported.
393    #[serde(rename = "symlinkAbsolutePathStrategy")]
394    pub symlink_absolute_path_strategy: Option<String>,
395}
396
397impl common::Part for BuildBazelRemoteExecutionV2CacheCapabilities {}
398
399/// A content digest. A digest for a given blob consists of the size of the blob and its hash. The hash algorithm to use is defined by the server. The size is considered to be an integral part of the digest and cannot be separated. That is, even if the `hash` field is correctly specified but `size_bytes` is not, the server MUST reject the request. The reason for including the size in the digest is as follows: in a great many cases, the server needs to know the size of the blob it is about to work with prior to starting an operation with it, such as flattening Merkle tree structures or streaming it to a worker. Technically, the server could implement a separate metadata store, but this results in a significantly more complicated implementation as opposed to having the client specify the size up-front (or storing the size along with the digest in every message where digests are embedded). This does mean that the API leaks some implementation details of (what we consider to be) a reasonable server implementation, but we consider this to be a worthwhile tradeoff. When a `Digest` is used to refer to a proto message, it always refers to the message in binary encoded form. To ensure consistent hashing, clients and servers MUST ensure that they serialize messages according to the following rules, even if there are alternate valid encodings for the same message: * Fields are serialized in tag order. * There are no unknown fields. * There are no duplicate fields. * Fields are serialized according to the default semantics for their type. Most protocol buffer implementations will always follow these rules when serializing, but care should be taken to avoid shortcuts. For instance, concatenating two messages to merge them may produce duplicate fields.
400///
401/// This type is not used in any activity, and only used as *part* of another schema.
402///
403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
404#[serde_with::serde_as]
405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
406pub struct BuildBazelRemoteExecutionV2Digest {
407    /// The hash. In the case of SHA-256, it will always be a lowercase hex string exactly 64 characters long.
408    pub hash: Option<String>,
409    /// The size of the blob, in bytes.
410    #[serde(rename = "sizeBytes")]
411    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
412    pub size_bytes: Option<i64>,
413}
414
415impl common::Part for BuildBazelRemoteExecutionV2Digest {}
416
417/// A `Directory` represents a directory node in a file tree, containing zero or more children FileNodes, DirectoryNodes and SymlinkNodes. Each `Node` contains its name in the directory, either the digest of its content (either a file blob or a `Directory` proto) or a symlink target, as well as possibly some metadata about the file or directory. In order to ensure that two equivalent directory trees hash to the same value, the following restrictions MUST be obeyed when constructing a a `Directory`: * Every child in the directory must have a path of exactly one segment. Multiple levels of directory hierarchy may not be collapsed. * Each child in the directory must have a unique path segment (file name). Note that while the API itself is case-sensitive, the environment where the Action is executed may or may not be case-sensitive. That is, it is legal to call the API with a Directory that has both "Foo" and "foo" as children, but the Action may be rejected by the remote system upon execution. * The files, directories and symlinks in the directory must each be sorted in lexicographical order by path. The path strings must be sorted by code point, equivalently, by UTF-8 bytes. * The NodeProperties of files, directories, and symlinks must be sorted in lexicographical order by property name. A `Directory` that obeys the restrictions is said to be in canonical form. As an example, the following could be used for a file named `bar` and a directory named `foo` with an executable file named `baz` (hashes shortened for readability): ```json // (Directory proto) { files: [ { name: "bar", digest: { hash: "4a73bc9d03...", size: 65534 }, node_properties: [ { "name": "MTime", "value": "2017-01-15T01:30:15.01Z" } ] } ], directories: [ { name: "foo", digest: { hash: "4cf2eda940...", size: 43 } } ] } // (Directory proto with hash "4cf2eda940..." and size 43) { files: [ { name: "baz", digest: { hash: "b2c941073e...", size: 1294, }, is_executable: true } ] } ```
418///
419/// This type is not used in any activity, and only used as *part* of another schema.
420///
421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
422#[serde_with::serde_as]
423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
424pub struct BuildBazelRemoteExecutionV2Directory {
425    /// The subdirectories in the directory.
426    pub directories: Option<Vec<BuildBazelRemoteExecutionV2DirectoryNode>>,
427    /// The files in the directory.
428    pub files: Option<Vec<BuildBazelRemoteExecutionV2FileNode>>,
429    /// no description provided
430    #[serde(rename = "nodeProperties")]
431    pub node_properties: Option<BuildBazelRemoteExecutionV2NodeProperties>,
432    /// The symlinks in the directory.
433    pub symlinks: Option<Vec<BuildBazelRemoteExecutionV2SymlinkNode>>,
434}
435
436impl common::Part for BuildBazelRemoteExecutionV2Directory {}
437
438/// A `DirectoryNode` represents a child of a Directory which is itself a `Directory` and its associated metadata.
439///
440/// This type is not used in any activity, and only used as *part* of another schema.
441///
442#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
443#[serde_with::serde_as]
444#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
445pub struct BuildBazelRemoteExecutionV2DirectoryNode {
446    /// The digest of the Directory object represented. See Digest for information about how to take the digest of a proto message.
447    pub digest: Option<BuildBazelRemoteExecutionV2Digest>,
448    /// The name of the directory.
449    pub name: Option<String>,
450}
451
452impl common::Part for BuildBazelRemoteExecutionV2DirectoryNode {}
453
454/// A request message for Execution.Execute.
455///
456/// # Activities
457///
458/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
459/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
460///
461/// * [execute actions](ActionExecuteCall) (request)
462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
463#[serde_with::serde_as]
464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
465pub struct BuildBazelRemoteExecutionV2ExecuteRequest {
466    /// The digest of the Action to execute.
467    #[serde(rename = "actionDigest")]
468    pub action_digest: Option<BuildBazelRemoteExecutionV2Digest>,
469    /// An optional policy for execution of the action. The server will have a default policy if this is not provided.
470    #[serde(rename = "executionPolicy")]
471    pub execution_policy: Option<BuildBazelRemoteExecutionV2ExecutionPolicy>,
472    /// An optional policy for the results of this execution in the remote cache. The server will have a default policy if this is not provided. This may be applied to both the ActionResult and the associated blobs.
473    #[serde(rename = "resultsCachePolicy")]
474    pub results_cache_policy: Option<BuildBazelRemoteExecutionV2ResultsCachePolicy>,
475    /// If true, the action will be executed even if its result is already present in the ActionCache. The execution is still allowed to be merged with other in-flight executions of the same action, however - semantically, the service MUST only guarantee that the results of an execution with this field set were not visible before the corresponding execution request was sent. Note that actions from execution requests setting this field set are still eligible to be entered into the action cache upon completion, and services SHOULD overwrite any existing entries that may exist. This allows skip_cache_lookup requests to be used as a mechanism for replacing action cache entries that reference outputs no longer available or that are poisoned in any way. If false, the result may be served from the action cache.
476    #[serde(rename = "skipCacheLookup")]
477    pub skip_cache_lookup: Option<bool>,
478}
479
480impl common::RequestValue for BuildBazelRemoteExecutionV2ExecuteRequest {}
481
482/// ExecutedActionMetadata contains details about a completed execution.
483///
484/// This type is not used in any activity, and only used as *part* of another schema.
485///
486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
487#[serde_with::serde_as]
488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
489pub struct BuildBazelRemoteExecutionV2ExecutedActionMetadata {
490    /// Details that are specific to the kind of worker used. For example, on POSIX-like systems this could contain a message with getrusage(2) statistics.
491    #[serde(rename = "auxiliaryMetadata")]
492    pub auxiliary_metadata: Option<Vec<HashMap<String, serde_json::Value>>>,
493    /// When the worker completed executing the action command.
494    #[serde(rename = "executionCompletedTimestamp")]
495    pub execution_completed_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
496    /// When the worker started executing the action command.
497    #[serde(rename = "executionStartTimestamp")]
498    pub execution_start_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
499    /// When the worker finished fetching action inputs.
500    #[serde(rename = "inputFetchCompletedTimestamp")]
501    pub input_fetch_completed_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
502    /// When the worker started fetching action inputs.
503    #[serde(rename = "inputFetchStartTimestamp")]
504    pub input_fetch_start_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
505    /// When the worker finished uploading action outputs.
506    #[serde(rename = "outputUploadCompletedTimestamp")]
507    pub output_upload_completed_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
508    /// When the worker started uploading action outputs.
509    #[serde(rename = "outputUploadStartTimestamp")]
510    pub output_upload_start_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
511    /// When was the action added to the queue.
512    #[serde(rename = "queuedTimestamp")]
513    pub queued_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
514    /// The name of the worker which ran the execution.
515    pub worker: Option<String>,
516    /// When the worker completed the action, including all stages.
517    #[serde(rename = "workerCompletedTimestamp")]
518    pub worker_completed_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
519    /// When the worker received the action.
520    #[serde(rename = "workerStartTimestamp")]
521    pub worker_start_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
522}
523
524impl common::Part for BuildBazelRemoteExecutionV2ExecutedActionMetadata {}
525
526/// Capabilities of the remote execution system.
527///
528/// This type is not used in any activity, and only used as *part* of another schema.
529///
530#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
531#[serde_with::serde_as]
532#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
533pub struct BuildBazelRemoteExecutionV2ExecutionCapabilities {
534    /// Remote execution may only support a single digest function.
535    #[serde(rename = "digestFunction")]
536    pub digest_function: Option<String>,
537    /// Whether remote execution is enabled for the particular server/instance.
538    #[serde(rename = "execEnabled")]
539    pub exec_enabled: Option<bool>,
540    /// Supported execution priority range.
541    #[serde(rename = "executionPriorityCapabilities")]
542    pub execution_priority_capabilities: Option<BuildBazelRemoteExecutionV2PriorityCapabilities>,
543    /// Supported node properties.
544    #[serde(rename = "supportedNodeProperties")]
545    pub supported_node_properties: Option<Vec<String>>,
546}
547
548impl common::Part for BuildBazelRemoteExecutionV2ExecutionCapabilities {}
549
550/// An `ExecutionPolicy` can be used to control the scheduling of the action.
551///
552/// This type is not used in any activity, and only used as *part* of another schema.
553///
554#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
555#[serde_with::serde_as]
556#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
557pub struct BuildBazelRemoteExecutionV2ExecutionPolicy {
558    /// The priority (relative importance) of this action. Generally, a lower value means that the action should be run sooner than actions having a greater priority value, but the interpretation of a given value is server- dependent. A priority of 0 means the *default* priority. Priorities may be positive or negative, and such actions should run later or sooner than actions having the default priority, respectively. The particular semantics of this field is up to the server. In particular, every server will have their own supported range of priorities, and will decide how these map into scheduling policy.
559    pub priority: Option<i32>,
560}
561
562impl common::Part for BuildBazelRemoteExecutionV2ExecutionPolicy {}
563
564/// A `FileNode` represents a single file and associated metadata.
565///
566/// This type is not used in any activity, and only used as *part* of another schema.
567///
568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
569#[serde_with::serde_as]
570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
571pub struct BuildBazelRemoteExecutionV2FileNode {
572    /// The digest of the file's content.
573    pub digest: Option<BuildBazelRemoteExecutionV2Digest>,
574    /// True if file is executable, false otherwise.
575    #[serde(rename = "isExecutable")]
576    pub is_executable: Option<bool>,
577    /// The name of the file.
578    pub name: Option<String>,
579    /// no description provided
580    #[serde(rename = "nodeProperties")]
581    pub node_properties: Option<BuildBazelRemoteExecutionV2NodeProperties>,
582}
583
584impl common::Part for BuildBazelRemoteExecutionV2FileNode {}
585
586/// A request message for ContentAddressableStorage.FindMissingBlobs.
587///
588/// # Activities
589///
590/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
591/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
592///
593/// * [find missing blobs](BlobFindMissingCall) (request)
594#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
595#[serde_with::serde_as]
596#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
597pub struct BuildBazelRemoteExecutionV2FindMissingBlobsRequest {
598    /// A list of the blobs to check.
599    #[serde(rename = "blobDigests")]
600    pub blob_digests: Option<Vec<BuildBazelRemoteExecutionV2Digest>>,
601}
602
603impl common::RequestValue for BuildBazelRemoteExecutionV2FindMissingBlobsRequest {}
604
605/// A response message for ContentAddressableStorage.FindMissingBlobs.
606///
607/// # Activities
608///
609/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
610/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
611///
612/// * [find missing blobs](BlobFindMissingCall) (response)
613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
614#[serde_with::serde_as]
615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
616pub struct BuildBazelRemoteExecutionV2FindMissingBlobsResponse {
617    /// A list of the blobs requested *not* present in the storage.
618    #[serde(rename = "missingBlobDigests")]
619    pub missing_blob_digests: Option<Vec<BuildBazelRemoteExecutionV2Digest>>,
620}
621
622impl common::ResponseResult for BuildBazelRemoteExecutionV2FindMissingBlobsResponse {}
623
624/// A response message for ContentAddressableStorage.GetTree.
625///
626/// # Activities
627///
628/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
629/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
630///
631/// * [get tree blobs](BlobGetTreeCall) (response)
632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
633#[serde_with::serde_as]
634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
635pub struct BuildBazelRemoteExecutionV2GetTreeResponse {
636    /// The directories descended from the requested root.
637    pub directories: Option<Vec<BuildBazelRemoteExecutionV2Directory>>,
638    /// If present, signifies that there are more results which the client can retrieve by passing this as the page_token in a subsequent request. If empty, signifies that this is the last page of results.
639    #[serde(rename = "nextPageToken")]
640    pub next_page_token: Option<String>,
641}
642
643impl common::ResponseResult for BuildBazelRemoteExecutionV2GetTreeResponse {}
644
645/// Node properties for FileNodes, DirectoryNodes, and SymlinkNodes. The server is responsible for specifying the properties that it accepts.
646///
647/// This type is not used in any activity, and only used as *part* of another schema.
648///
649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
650#[serde_with::serde_as]
651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
652pub struct BuildBazelRemoteExecutionV2NodeProperties {
653    /// The file's last modification timestamp.
654    pub mtime: Option<chrono::DateTime<chrono::offset::Utc>>,
655    /// A list of string-based NodeProperties.
656    pub properties: Option<Vec<BuildBazelRemoteExecutionV2NodeProperty>>,
657    /// The UNIX file mode, e.g., 0755.
658    #[serde(rename = "unixMode")]
659    pub unix_mode: Option<u32>,
660}
661
662impl common::Part for BuildBazelRemoteExecutionV2NodeProperties {}
663
664/// A single property for FileNodes, DirectoryNodes, and SymlinkNodes. The server is responsible for specifying the property `name`s that it accepts. If permitted by the server, the same `name` may occur multiple times.
665///
666/// This type is not used in any activity, and only used as *part* of another schema.
667///
668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
669#[serde_with::serde_as]
670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
671pub struct BuildBazelRemoteExecutionV2NodeProperty {
672    /// The property name.
673    pub name: Option<String>,
674    /// The property value.
675    pub value: Option<String>,
676}
677
678impl common::Part for BuildBazelRemoteExecutionV2NodeProperty {}
679
680/// An `OutputDirectory` is the output in an `ActionResult` corresponding to a directory's full contents rather than a single file.
681///
682/// This type is not used in any activity, and only used as *part* of another schema.
683///
684#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
685#[serde_with::serde_as]
686#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
687pub struct BuildBazelRemoteExecutionV2OutputDirectory {
688    /// The full path of the directory relative to the working directory. The path separator is a forward slash `/`. Since this is a relative path, it MUST NOT begin with a leading forward slash. The empty string value is allowed, and it denotes the entire working directory.
689    pub path: Option<String>,
690    /// The digest of the encoded Tree proto containing the directory's contents.
691    #[serde(rename = "treeDigest")]
692    pub tree_digest: Option<BuildBazelRemoteExecutionV2Digest>,
693}
694
695impl common::Part for BuildBazelRemoteExecutionV2OutputDirectory {}
696
697/// An `OutputFile` is similar to a FileNode, but it is used as an output in an `ActionResult`. It allows a full file path rather than only a name.
698///
699/// This type is not used in any activity, and only used as *part* of another schema.
700///
701#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
702#[serde_with::serde_as]
703#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
704pub struct BuildBazelRemoteExecutionV2OutputFile {
705    /// The contents of the file if inlining was requested. The server SHOULD NOT inline file contents unless requested by the client in the GetActionResultRequest message. The server MAY omit inlining, even if requested, and MUST do so if inlining would cause the response to exceed message size limits.
706    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
707    pub contents: Option<Vec<u8>>,
708    /// The digest of the file's content.
709    pub digest: Option<BuildBazelRemoteExecutionV2Digest>,
710    /// True if file is executable, false otherwise.
711    #[serde(rename = "isExecutable")]
712    pub is_executable: Option<bool>,
713    /// no description provided
714    #[serde(rename = "nodeProperties")]
715    pub node_properties: Option<BuildBazelRemoteExecutionV2NodeProperties>,
716    /// The full path of the file relative to the working directory, including the filename. The path separator is a forward slash `/`. Since this is a relative path, it MUST NOT begin with a leading forward slash.
717    pub path: Option<String>,
718}
719
720impl common::Part for BuildBazelRemoteExecutionV2OutputFile {}
721
722/// An `OutputSymlink` is similar to a Symlink, but it is used as an output in an `ActionResult`. `OutputSymlink` is binary-compatible with `SymlinkNode`.
723///
724/// This type is not used in any activity, and only used as *part* of another schema.
725///
726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
727#[serde_with::serde_as]
728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
729pub struct BuildBazelRemoteExecutionV2OutputSymlink {
730    /// no description provided
731    #[serde(rename = "nodeProperties")]
732    pub node_properties: Option<BuildBazelRemoteExecutionV2NodeProperties>,
733    /// The full path of the symlink relative to the working directory, including the filename. The path separator is a forward slash `/`. Since this is a relative path, it MUST NOT begin with a leading forward slash.
734    pub path: Option<String>,
735    /// The target path of the symlink. The path separator is a forward slash `/`. The target path can be relative to the parent directory of the symlink or it can be an absolute path starting with `/`. Support for absolute paths can be checked using the Capabilities API. `..` components are allowed anywhere in the target path.
736    pub target: Option<String>,
737}
738
739impl common::Part for BuildBazelRemoteExecutionV2OutputSymlink {}
740
741/// Allowed values for priority in ResultsCachePolicy and ExecutionPolicy Used for querying both cache and execution valid priority ranges.
742///
743/// This type is not used in any activity, and only used as *part* of another schema.
744///
745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
746#[serde_with::serde_as]
747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
748pub struct BuildBazelRemoteExecutionV2PriorityCapabilities {
749    /// no description provided
750    pub priorities: Option<Vec<BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange>>,
751}
752
753impl common::Part for BuildBazelRemoteExecutionV2PriorityCapabilities {}
754
755/// Supported range of priorities, including boundaries.
756///
757/// This type is not used in any activity, and only used as *part* of another schema.
758///
759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
760#[serde_with::serde_as]
761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
762pub struct BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange {
763    /// The maximum numeric value for this priority range, which represents the least urgent task or shortest retained item.
764    #[serde(rename = "maxPriority")]
765    pub max_priority: Option<i32>,
766    /// The minimum numeric value for this priority range, which represents the most urgent task or longest retained item.
767    #[serde(rename = "minPriority")]
768    pub min_priority: Option<i32>,
769}
770
771impl common::Part for BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange {}
772
773/// A `ResultsCachePolicy` is used for fine-grained control over how action outputs are stored in the CAS and Action Cache.
774///
775/// This type is not used in any activity, and only used as *part* of another schema.
776///
777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
778#[serde_with::serde_as]
779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
780pub struct BuildBazelRemoteExecutionV2ResultsCachePolicy {
781    /// The priority (relative importance) of this content in the overall cache. Generally, a lower value means a longer retention time or other advantage, but the interpretation of a given value is server-dependent. A priority of 0 means a *default* value, decided by the server. The particular semantics of this field is up to the server. In particular, every server will have their own supported range of priorities, and will decide how these map into retention/eviction policy.
782    pub priority: Option<i32>,
783}
784
785impl common::Part for BuildBazelRemoteExecutionV2ResultsCachePolicy {}
786
787/// A response message for Capabilities.GetCapabilities.
788///
789/// # Activities
790///
791/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
792/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
793///
794/// * [get capabilities](MethodGetCapabilityCall) (response)
795#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
796#[serde_with::serde_as]
797#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
798pub struct BuildBazelRemoteExecutionV2ServerCapabilities {
799    /// Capabilities of the remote cache system.
800    #[serde(rename = "cacheCapabilities")]
801    pub cache_capabilities: Option<BuildBazelRemoteExecutionV2CacheCapabilities>,
802    /// Earliest RE API version supported, including deprecated versions.
803    #[serde(rename = "deprecatedApiVersion")]
804    pub deprecated_api_version: Option<BuildBazelSemverSemVer>,
805    /// Capabilities of the remote execution system.
806    #[serde(rename = "executionCapabilities")]
807    pub execution_capabilities: Option<BuildBazelRemoteExecutionV2ExecutionCapabilities>,
808    /// Latest RE API version supported.
809    #[serde(rename = "highApiVersion")]
810    pub high_api_version: Option<BuildBazelSemverSemVer>,
811    /// Earliest non-deprecated RE API version supported.
812    #[serde(rename = "lowApiVersion")]
813    pub low_api_version: Option<BuildBazelSemverSemVer>,
814}
815
816impl common::ResponseResult for BuildBazelRemoteExecutionV2ServerCapabilities {}
817
818/// A `SymlinkNode` represents a symbolic link.
819///
820/// This type is not used in any activity, and only used as *part* of another schema.
821///
822#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
823#[serde_with::serde_as]
824#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
825pub struct BuildBazelRemoteExecutionV2SymlinkNode {
826    /// The name of the symlink.
827    pub name: Option<String>,
828    /// no description provided
829    #[serde(rename = "nodeProperties")]
830    pub node_properties: Option<BuildBazelRemoteExecutionV2NodeProperties>,
831    /// The target path of the symlink. The path separator is a forward slash `/`. The target path can be relative to the parent directory of the symlink or it can be an absolute path starting with `/`. Support for absolute paths can be checked using the Capabilities API. `..` components are allowed anywhere in the target path as logical canonicalization may lead to different behavior in the presence of directory symlinks (e.g. `foo/../bar` may not be the same as `bar`). To reduce potential cache misses, canonicalization is still recommended where this is possible without impacting correctness.
832    pub target: Option<String>,
833}
834
835impl common::Part for BuildBazelRemoteExecutionV2SymlinkNode {}
836
837/// A request message for WaitExecution.
838///
839/// # Activities
840///
841/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
842/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
843///
844/// * [wait execution operations](OperationWaitExecutionCall) (request)
845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
846#[serde_with::serde_as]
847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
848pub struct BuildBazelRemoteExecutionV2WaitExecutionRequest {
849    _never_set: Option<bool>,
850}
851
852impl common::RequestValue for BuildBazelRemoteExecutionV2WaitExecutionRequest {}
853
854/// The full version of a given tool.
855///
856/// This type is not used in any activity, and only used as *part* of another schema.
857///
858#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
859#[serde_with::serde_as]
860#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
861pub struct BuildBazelSemverSemVer {
862    /// The major version, e.g 10 for 10.2.3.
863    pub major: Option<i32>,
864    /// The minor version, e.g. 2 for 10.2.3.
865    pub minor: Option<i32>,
866    /// The patch version, e.g 3 for 10.2.3.
867    pub patch: Option<i32>,
868    /// The pre-release version. Either this field or major/minor/patch fields must be filled. They are mutually exclusive. Pre-release versions are assumed to be earlier than any released versions.
869    pub prerelease: Option<String>,
870}
871
872impl common::Part for BuildBazelSemverSemVer {}
873
874/// This resource represents a long-running operation that is the result of a network API call.
875///
876/// # Activities
877///
878/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
879/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
880///
881/// * [execute actions](ActionExecuteCall) (response)
882/// * [wait execution operations](OperationWaitExecutionCall) (response)
883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
884#[serde_with::serde_as]
885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
886pub struct GoogleLongrunningOperation {
887    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
888    pub done: Option<bool>,
889    /// The error result of the operation in case of failure or cancellation.
890    pub error: Option<GoogleRpcStatus>,
891    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
892    pub metadata: Option<HashMap<String, serde_json::Value>>,
893    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
894    pub name: Option<String>,
895    /// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
896    pub response: Option<HashMap<String, serde_json::Value>>,
897}
898
899impl common::ResponseResult for GoogleLongrunningOperation {}
900
901/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
902///
903/// This type is not used in any activity, and only used as *part* of another schema.
904///
905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
906#[serde_with::serde_as]
907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
908pub struct GoogleRpcStatus {
909    /// The status code, which should be an enum value of google.rpc.Code.
910    pub code: Option<i32>,
911    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
912    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
913    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
914    pub message: Option<String>,
915}
916
917impl common::Part for GoogleRpcStatus {}
918
919// ###################
920// MethodBuilders ###
921// #################
922
923/// A builder providing access to all methods supported on *actionResult* resources.
924/// It is not used directly, but through the [`RemoteBuildExecution`] hub.
925///
926/// # Example
927///
928/// Instantiate a resource builder
929///
930/// ```test_harness,no_run
931/// extern crate hyper;
932/// extern crate hyper_rustls;
933/// extern crate google_remotebuildexecution2 as remotebuildexecution2;
934///
935/// # async fn dox() {
936/// use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
937///
938/// let secret: yup_oauth2::ApplicationSecret = Default::default();
939/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
940///     secret,
941///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
942/// ).build().await.unwrap();
943///
944/// let client = hyper_util::client::legacy::Client::builder(
945///     hyper_util::rt::TokioExecutor::new()
946/// )
947/// .build(
948///     hyper_rustls::HttpsConnectorBuilder::new()
949///         .with_native_roots()
950///         .unwrap()
951///         .https_or_http()
952///         .enable_http1()
953///         .build()
954/// );
955/// let mut hub = RemoteBuildExecution::new(client, auth);
956/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
957/// // like `get(...)` and `update(...)`
958/// // to build up your call.
959/// let rb = hub.action_results();
960/// # }
961/// ```
962pub struct ActionResultMethods<'a, C>
963where
964    C: 'a,
965{
966    hub: &'a RemoteBuildExecution<C>,
967}
968
969impl<'a, C> common::MethodsBuilder for ActionResultMethods<'a, C> {}
970
971impl<'a, C> ActionResultMethods<'a, C> {
972    /// Create a builder to help you perform the following task:
973    ///
974    /// Retrieve a cached execution result. Implementations SHOULD ensure that any blobs referenced from the ContentAddressableStorage are available at the time of returning the ActionResult and will be for some period of time afterwards. The lifetimes of the referenced blobs SHOULD be increased if necessary and applicable. Errors: * `NOT_FOUND`: The requested `ActionResult` is not in the cache.
975    ///
976    /// # Arguments
977    ///
978    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
979    /// * `hash` - The hash. In the case of SHA-256, it will always be a lowercase hex string exactly 64 characters long.
980    /// * `sizeBytes` - The size of the blob, in bytes.
981    pub fn get(
982        &self,
983        instance_name: &str,
984        hash: &str,
985        size_bytes: i64,
986    ) -> ActionResultGetCall<'a, C> {
987        ActionResultGetCall {
988            hub: self.hub,
989            _instance_name: instance_name.to_string(),
990            _hash: hash.to_string(),
991            _size_bytes: size_bytes,
992            _inline_stdout: Default::default(),
993            _inline_stderr: Default::default(),
994            _inline_output_files: Default::default(),
995            _delegate: Default::default(),
996            _additional_params: Default::default(),
997            _scopes: Default::default(),
998        }
999    }
1000
1001    /// Create a builder to help you perform the following task:
1002    ///
1003    /// Upload a new execution result. In order to allow the server to perform access control based on the type of action, and to assist with client debugging, the client MUST first upload the Action that produced the result, along with its Command, into the `ContentAddressableStorage`. Server implementations MAY modify the `UpdateActionResultRequest.action_result` and return an equivalent value. Errors: * `INVALID_ARGUMENT`: One or more arguments are invalid. * `FAILED_PRECONDITION`: One or more errors occurred in updating the action result, such as a missing command or action. * `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the entry to the cache.
1004    ///
1005    /// # Arguments
1006    ///
1007    /// * `request` - No description provided.
1008    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1009    /// * `hash` - The hash. In the case of SHA-256, it will always be a lowercase hex string exactly 64 characters long.
1010    /// * `sizeBytes` - The size of the blob, in bytes.
1011    pub fn update(
1012        &self,
1013        request: BuildBazelRemoteExecutionV2ActionResult,
1014        instance_name: &str,
1015        hash: &str,
1016        size_bytes: i64,
1017    ) -> ActionResultUpdateCall<'a, C> {
1018        ActionResultUpdateCall {
1019            hub: self.hub,
1020            _request: request,
1021            _instance_name: instance_name.to_string(),
1022            _hash: hash.to_string(),
1023            _size_bytes: size_bytes,
1024            _results_cache_policy_priority: Default::default(),
1025            _delegate: Default::default(),
1026            _additional_params: Default::default(),
1027            _scopes: Default::default(),
1028        }
1029    }
1030}
1031
1032/// A builder providing access to all methods supported on *action* resources.
1033/// It is not used directly, but through the [`RemoteBuildExecution`] hub.
1034///
1035/// # Example
1036///
1037/// Instantiate a resource builder
1038///
1039/// ```test_harness,no_run
1040/// extern crate hyper;
1041/// extern crate hyper_rustls;
1042/// extern crate google_remotebuildexecution2 as remotebuildexecution2;
1043///
1044/// # async fn dox() {
1045/// use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1046///
1047/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1048/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1049///     secret,
1050///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1051/// ).build().await.unwrap();
1052///
1053/// let client = hyper_util::client::legacy::Client::builder(
1054///     hyper_util::rt::TokioExecutor::new()
1055/// )
1056/// .build(
1057///     hyper_rustls::HttpsConnectorBuilder::new()
1058///         .with_native_roots()
1059///         .unwrap()
1060///         .https_or_http()
1061///         .enable_http1()
1062///         .build()
1063/// );
1064/// let mut hub = RemoteBuildExecution::new(client, auth);
1065/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1066/// // like `execute(...)`
1067/// // to build up your call.
1068/// let rb = hub.actions();
1069/// # }
1070/// ```
1071pub struct ActionMethods<'a, C>
1072where
1073    C: 'a,
1074{
1075    hub: &'a RemoteBuildExecution<C>,
1076}
1077
1078impl<'a, C> common::MethodsBuilder for ActionMethods<'a, C> {}
1079
1080impl<'a, C> ActionMethods<'a, C> {
1081    /// Create a builder to help you perform the following task:
1082    ///
1083    /// Execute an action remotely. In order to execute an action, the client must first upload all of the inputs, the Command to run, and the Action into the ContentAddressableStorage. It then calls `Execute` with an `action_digest` referring to them. The server will run the action and eventually return the result. The input `Action`'s fields MUST meet the various canonicalization requirements specified in the documentation for their types so that it has the same digest as other logically equivalent `Action`s. The server MAY enforce the requirements and return errors if a non-canonical input is received. It MAY also proceed without verifying some or all of the requirements, such as for performance reasons. If the server does not verify the requirement, then it will treat the `Action` as distinct from another logically equivalent action if they hash differently. Returns a stream of google.longrunning.Operation messages describing the resulting execution, with eventual `response` ExecuteResponse. The `metadata` on the operation is of type ExecuteOperationMetadata. If the client remains connected after the first response is returned after the server, then updates are streamed as if the client had called WaitExecution until the execution completes or the request reaches an error. The operation can also be queried using Operations API. The server NEED NOT implement other methods or functionality of the Operations API. Errors discovered during creation of the `Operation` will be reported as gRPC Status errors, while errors that occurred while running the action will be reported in the `status` field of the `ExecuteResponse`. The server MUST NOT set the `error` field of the `Operation` proto. The possible errors include: * `INVALID_ARGUMENT`: One or more arguments are invalid. * `FAILED_PRECONDITION`: One or more errors occurred in setting up the action requested, such as a missing input or command or no worker being available. The client may be able to fix the errors and retry. * `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run the action. * `UNAVAILABLE`: Due to a transient condition, such as all workers being occupied (and the server does not support a queue), the action could not be started. The client should retry. * `INTERNAL`: An internal error occurred in the execution engine or the worker. * `DEADLINE_EXCEEDED`: The execution timed out. * `CANCELLED`: The operation was cancelled by the client. This status is only possible if the server implements the Operations API CancelOperation method, and it was called for the current execution. In the case of a missing input or command, the server SHOULD additionally send a PreconditionFailure error detail where, for each requested blob not present in the CAS, there is a `Violation` with a `type` of `MISSING` and a `subject` of `"blobs/{hash}/{size}"` indicating the digest of the missing blob. The server does not need to guarantee that a call to this method leads to at most one execution of the action. The server MAY execute the action multiple times, potentially in parallel. These redundant executions MAY continue to run, even if the operation is completed.
1084    ///
1085    /// # Arguments
1086    ///
1087    /// * `request` - No description provided.
1088    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1089    pub fn execute(
1090        &self,
1091        request: BuildBazelRemoteExecutionV2ExecuteRequest,
1092        instance_name: &str,
1093    ) -> ActionExecuteCall<'a, C> {
1094        ActionExecuteCall {
1095            hub: self.hub,
1096            _request: request,
1097            _instance_name: instance_name.to_string(),
1098            _delegate: Default::default(),
1099            _additional_params: Default::default(),
1100            _scopes: Default::default(),
1101        }
1102    }
1103}
1104
1105/// A builder providing access to all methods supported on *blob* resources.
1106/// It is not used directly, but through the [`RemoteBuildExecution`] hub.
1107///
1108/// # Example
1109///
1110/// Instantiate a resource builder
1111///
1112/// ```test_harness,no_run
1113/// extern crate hyper;
1114/// extern crate hyper_rustls;
1115/// extern crate google_remotebuildexecution2 as remotebuildexecution2;
1116///
1117/// # async fn dox() {
1118/// use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1119///
1120/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1121/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1122///     secret,
1123///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1124/// ).build().await.unwrap();
1125///
1126/// let client = hyper_util::client::legacy::Client::builder(
1127///     hyper_util::rt::TokioExecutor::new()
1128/// )
1129/// .build(
1130///     hyper_rustls::HttpsConnectorBuilder::new()
1131///         .with_native_roots()
1132///         .unwrap()
1133///         .https_or_http()
1134///         .enable_http1()
1135///         .build()
1136/// );
1137/// let mut hub = RemoteBuildExecution::new(client, auth);
1138/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1139/// // like `batch_read(...)`, `batch_update(...)`, `find_missing(...)` and `get_tree(...)`
1140/// // to build up your call.
1141/// let rb = hub.blobs();
1142/// # }
1143/// ```
1144pub struct BlobMethods<'a, C>
1145where
1146    C: 'a,
1147{
1148    hub: &'a RemoteBuildExecution<C>,
1149}
1150
1151impl<'a, C> common::MethodsBuilder for BlobMethods<'a, C> {}
1152
1153impl<'a, C> BlobMethods<'a, C> {
1154    /// Create a builder to help you perform the following task:
1155    ///
1156    /// Download many blobs at once. The server may enforce a limit of the combined total size of blobs to be downloaded using this API. This limit may be obtained using the Capabilities API. Requests exceeding the limit should either be split into smaller chunks or downloaded using the ByteStream API, as appropriate. This request is equivalent to calling a Bytestream `Read` request on each individual blob, in parallel. The requests may succeed or fail independently. Errors: * `INVALID_ARGUMENT`: The client attempted to read more than the server supported limit. Every error on individual read will be returned in the corresponding digest status.
1157    ///
1158    /// # Arguments
1159    ///
1160    /// * `request` - No description provided.
1161    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1162    pub fn batch_read(
1163        &self,
1164        request: BuildBazelRemoteExecutionV2BatchReadBlobsRequest,
1165        instance_name: &str,
1166    ) -> BlobBatchReadCall<'a, C> {
1167        BlobBatchReadCall {
1168            hub: self.hub,
1169            _request: request,
1170            _instance_name: instance_name.to_string(),
1171            _delegate: Default::default(),
1172            _additional_params: Default::default(),
1173            _scopes: Default::default(),
1174        }
1175    }
1176
1177    /// Create a builder to help you perform the following task:
1178    ///
1179    /// Upload many blobs at once. The server may enforce a limit of the combined total size of blobs to be uploaded using this API. This limit may be obtained using the Capabilities API. Requests exceeding the limit should either be split into smaller chunks or uploaded using the ByteStream API, as appropriate. This request is equivalent to calling a Bytestream `Write` request on each individual blob, in parallel. The requests may succeed or fail independently. Errors: * `INVALID_ARGUMENT`: The client attempted to upload more than the server supported limit. Individual requests may return the following errors, additionally: * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. * `INVALID_ARGUMENT`: The Digest does not match the provided data.
1180    ///
1181    /// # Arguments
1182    ///
1183    /// * `request` - No description provided.
1184    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1185    pub fn batch_update(
1186        &self,
1187        request: BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest,
1188        instance_name: &str,
1189    ) -> BlobBatchUpdateCall<'a, C> {
1190        BlobBatchUpdateCall {
1191            hub: self.hub,
1192            _request: request,
1193            _instance_name: instance_name.to_string(),
1194            _delegate: Default::default(),
1195            _additional_params: Default::default(),
1196            _scopes: Default::default(),
1197        }
1198    }
1199
1200    /// Create a builder to help you perform the following task:
1201    ///
1202    /// Determine if blobs are present in the CAS. Clients can use this API before uploading blobs to determine which ones are already present in the CAS and do not need to be uploaded again. Servers SHOULD increase the lifetimes of the referenced blobs if necessary and applicable. There are no method-specific errors.
1203    ///
1204    /// # Arguments
1205    ///
1206    /// * `request` - No description provided.
1207    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1208    pub fn find_missing(
1209        &self,
1210        request: BuildBazelRemoteExecutionV2FindMissingBlobsRequest,
1211        instance_name: &str,
1212    ) -> BlobFindMissingCall<'a, C> {
1213        BlobFindMissingCall {
1214            hub: self.hub,
1215            _request: request,
1216            _instance_name: instance_name.to_string(),
1217            _delegate: Default::default(),
1218            _additional_params: Default::default(),
1219            _scopes: Default::default(),
1220        }
1221    }
1222
1223    /// Create a builder to help you perform the following task:
1224    ///
1225    /// Fetch the entire directory tree rooted at a node. This request must be targeted at a Directory stored in the ContentAddressableStorage (CAS). The server will enumerate the `Directory` tree recursively and return every node descended from the root. The GetTreeRequest.page_token parameter can be used to skip ahead in the stream (e.g. when retrying a partially completed and aborted request), by setting it to a value taken from GetTreeResponse.next_page_token of the last successfully processed GetTreeResponse). The exact traversal order is unspecified and, unless retrieving subsequent pages from an earlier request, is not guaranteed to be stable across multiple invocations of `GetTree`. If part of the tree is missing from the CAS, the server will return the portion present and omit the rest. Errors: * `NOT_FOUND`: The requested tree root is not present in the CAS.
1226    ///
1227    /// # Arguments
1228    ///
1229    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1230    /// * `hash` - The hash. In the case of SHA-256, it will always be a lowercase hex string exactly 64 characters long.
1231    /// * `sizeBytes` - The size of the blob, in bytes.
1232    pub fn get_tree(
1233        &self,
1234        instance_name: &str,
1235        hash: &str,
1236        size_bytes: i64,
1237    ) -> BlobGetTreeCall<'a, C> {
1238        BlobGetTreeCall {
1239            hub: self.hub,
1240            _instance_name: instance_name.to_string(),
1241            _hash: hash.to_string(),
1242            _size_bytes: size_bytes,
1243            _page_token: Default::default(),
1244            _page_size: Default::default(),
1245            _delegate: Default::default(),
1246            _additional_params: Default::default(),
1247            _scopes: Default::default(),
1248        }
1249    }
1250}
1251
1252/// A builder providing access to all methods supported on *operation* resources.
1253/// It is not used directly, but through the [`RemoteBuildExecution`] hub.
1254///
1255/// # Example
1256///
1257/// Instantiate a resource builder
1258///
1259/// ```test_harness,no_run
1260/// extern crate hyper;
1261/// extern crate hyper_rustls;
1262/// extern crate google_remotebuildexecution2 as remotebuildexecution2;
1263///
1264/// # async fn dox() {
1265/// use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1266///
1267/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1268/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1269///     secret,
1270///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1271/// ).build().await.unwrap();
1272///
1273/// let client = hyper_util::client::legacy::Client::builder(
1274///     hyper_util::rt::TokioExecutor::new()
1275/// )
1276/// .build(
1277///     hyper_rustls::HttpsConnectorBuilder::new()
1278///         .with_native_roots()
1279///         .unwrap()
1280///         .https_or_http()
1281///         .enable_http1()
1282///         .build()
1283/// );
1284/// let mut hub = RemoteBuildExecution::new(client, auth);
1285/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1286/// // like `wait_execution(...)`
1287/// // to build up your call.
1288/// let rb = hub.operations();
1289/// # }
1290/// ```
1291pub struct OperationMethods<'a, C>
1292where
1293    C: 'a,
1294{
1295    hub: &'a RemoteBuildExecution<C>,
1296}
1297
1298impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
1299
1300impl<'a, C> OperationMethods<'a, C> {
1301    /// Create a builder to help you perform the following task:
1302    ///
1303    /// Wait for an execution operation to complete. When the client initially makes the request, the server immediately responds with the current status of the execution. The server will leave the request stream open until the operation completes, and then respond with the completed operation. The server MAY choose to stream additional updates as execution progresses, such as to provide an update as to the state of the execution.
1304    ///
1305    /// # Arguments
1306    ///
1307    /// * `request` - No description provided.
1308    /// * `name` - The name of the Operation returned by Execute.
1309    pub fn wait_execution(
1310        &self,
1311        request: BuildBazelRemoteExecutionV2WaitExecutionRequest,
1312        name: &str,
1313    ) -> OperationWaitExecutionCall<'a, C> {
1314        OperationWaitExecutionCall {
1315            hub: self.hub,
1316            _request: request,
1317            _name: name.to_string(),
1318            _delegate: Default::default(),
1319            _additional_params: Default::default(),
1320            _scopes: Default::default(),
1321        }
1322    }
1323}
1324
1325/// A builder providing access to all free methods, which are not associated with a particular resource.
1326/// It is not used directly, but through the [`RemoteBuildExecution`] hub.
1327///
1328/// # Example
1329///
1330/// Instantiate a resource builder
1331///
1332/// ```test_harness,no_run
1333/// extern crate hyper;
1334/// extern crate hyper_rustls;
1335/// extern crate google_remotebuildexecution2 as remotebuildexecution2;
1336///
1337/// # async fn dox() {
1338/// use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1339///
1340/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1341/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1342///     secret,
1343///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1344/// ).build().await.unwrap();
1345///
1346/// let client = hyper_util::client::legacy::Client::builder(
1347///     hyper_util::rt::TokioExecutor::new()
1348/// )
1349/// .build(
1350///     hyper_rustls::HttpsConnectorBuilder::new()
1351///         .with_native_roots()
1352///         .unwrap()
1353///         .https_or_http()
1354///         .enable_http1()
1355///         .build()
1356/// );
1357/// let mut hub = RemoteBuildExecution::new(client, auth);
1358/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1359/// // like `get_capabilities(...)`
1360/// // to build up your call.
1361/// let rb = hub.methods();
1362/// # }
1363/// ```
1364pub struct MethodMethods<'a, C>
1365where
1366    C: 'a,
1367{
1368    hub: &'a RemoteBuildExecution<C>,
1369}
1370
1371impl<'a, C> common::MethodsBuilder for MethodMethods<'a, C> {}
1372
1373impl<'a, C> MethodMethods<'a, C> {
1374    /// Create a builder to help you perform the following task:
1375    ///
1376    /// GetCapabilities returns the server capabilities configuration of the remote endpoint. Only the capabilities of the services supported by the endpoint will be returned: * Execution + CAS + Action Cache endpoints should return both CacheCapabilities and ExecutionCapabilities. * Execution only endpoints should return ExecutionCapabilities. * CAS + Action Cache only endpoints should return CacheCapabilities.
1377    ///
1378    /// # Arguments
1379    ///
1380    /// * `instanceName` - The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1381    pub fn get_capabilities(&self, instance_name: &str) -> MethodGetCapabilityCall<'a, C> {
1382        MethodGetCapabilityCall {
1383            hub: self.hub,
1384            _instance_name: instance_name.to_string(),
1385            _delegate: Default::default(),
1386            _additional_params: Default::default(),
1387            _scopes: Default::default(),
1388        }
1389    }
1390}
1391
1392// ###################
1393// CallBuilders   ###
1394// #################
1395
1396/// Retrieve a cached execution result. Implementations SHOULD ensure that any blobs referenced from the ContentAddressableStorage are available at the time of returning the ActionResult and will be for some period of time afterwards. The lifetimes of the referenced blobs SHOULD be increased if necessary and applicable. Errors: * `NOT_FOUND`: The requested `ActionResult` is not in the cache.
1397///
1398/// A builder for the *get* method supported by a *actionResult* resource.
1399/// It is not used directly, but through a [`ActionResultMethods`] instance.
1400///
1401/// # Example
1402///
1403/// Instantiate a resource method builder
1404///
1405/// ```test_harness,no_run
1406/// # extern crate hyper;
1407/// # extern crate hyper_rustls;
1408/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
1409/// # async fn dox() {
1410/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1411///
1412/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1413/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1414/// #     secret,
1415/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1416/// # ).build().await.unwrap();
1417///
1418/// # let client = hyper_util::client::legacy::Client::builder(
1419/// #     hyper_util::rt::TokioExecutor::new()
1420/// # )
1421/// # .build(
1422/// #     hyper_rustls::HttpsConnectorBuilder::new()
1423/// #         .with_native_roots()
1424/// #         .unwrap()
1425/// #         .https_or_http()
1426/// #         .enable_http1()
1427/// #         .build()
1428/// # );
1429/// # let mut hub = RemoteBuildExecution::new(client, auth);
1430/// // You can configure optional parameters by calling the respective setters at will, and
1431/// // execute the final call using `doit()`.
1432/// // Values shown here are possibly random and not representative !
1433/// let result = hub.action_results().get("instanceName", "hash", -93)
1434///              .inline_stdout(true)
1435///              .inline_stderr(true)
1436///              .add_inline_output_files("ipsum")
1437///              .doit().await;
1438/// # }
1439/// ```
1440pub struct ActionResultGetCall<'a, C>
1441where
1442    C: 'a,
1443{
1444    hub: &'a RemoteBuildExecution<C>,
1445    _instance_name: String,
1446    _hash: String,
1447    _size_bytes: i64,
1448    _inline_stdout: Option<bool>,
1449    _inline_stderr: Option<bool>,
1450    _inline_output_files: Vec<String>,
1451    _delegate: Option<&'a mut dyn common::Delegate>,
1452    _additional_params: HashMap<String, String>,
1453    _scopes: BTreeSet<String>,
1454}
1455
1456impl<'a, C> common::CallBuilder for ActionResultGetCall<'a, C> {}
1457
1458impl<'a, C> ActionResultGetCall<'a, C>
1459where
1460    C: common::Connector,
1461{
1462    /// Perform the operation you have build so far.
1463    pub async fn doit(
1464        mut self,
1465    ) -> common::Result<(common::Response, BuildBazelRemoteExecutionV2ActionResult)> {
1466        use std::borrow::Cow;
1467        use std::io::{Read, Seek};
1468
1469        use common::{url::Params, ToParts};
1470        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1471
1472        let mut dd = common::DefaultDelegate;
1473        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1474        dlg.begin(common::MethodInfo {
1475            id: "remotebuildexecution.actionResults.get",
1476            http_method: hyper::Method::GET,
1477        });
1478
1479        for &field in [
1480            "alt",
1481            "instanceName",
1482            "hash",
1483            "sizeBytes",
1484            "inlineStdout",
1485            "inlineStderr",
1486            "inlineOutputFiles",
1487        ]
1488        .iter()
1489        {
1490            if self._additional_params.contains_key(field) {
1491                dlg.finished(false);
1492                return Err(common::Error::FieldClash(field));
1493            }
1494        }
1495
1496        let mut params = Params::with_capacity(8 + self._additional_params.len());
1497        params.push("instanceName", self._instance_name);
1498        params.push("hash", self._hash);
1499        params.push("sizeBytes", self._size_bytes.to_string());
1500        if let Some(value) = self._inline_stdout.as_ref() {
1501            params.push("inlineStdout", value.to_string());
1502        }
1503        if let Some(value) = self._inline_stderr.as_ref() {
1504            params.push("inlineStderr", value.to_string());
1505        }
1506        if !self._inline_output_files.is_empty() {
1507            for f in self._inline_output_files.iter() {
1508                params.push("inlineOutputFiles", f);
1509            }
1510        }
1511
1512        params.extend(self._additional_params.iter());
1513
1514        params.push("alt", "json");
1515        let mut url =
1516            self.hub._base_url.clone() + "v2/{+instanceName}/actionResults/{hash}/{sizeBytes}";
1517        if self._scopes.is_empty() {
1518            self._scopes
1519                .insert(Scope::CloudPlatform.as_ref().to_string());
1520        }
1521
1522        #[allow(clippy::single_element_loop)]
1523        for &(find_this, param_name) in [
1524            ("{+instanceName}", "instanceName"),
1525            ("{hash}", "hash"),
1526            ("{sizeBytes}", "sizeBytes"),
1527        ]
1528        .iter()
1529        {
1530            url = params.uri_replacement(url, param_name, find_this, true);
1531        }
1532        {
1533            let to_remove = ["sizeBytes", "hash", "instanceName"];
1534            params.remove_params(&to_remove);
1535        }
1536
1537        let url = params.parse_with_url(&url);
1538
1539        loop {
1540            let token = match self
1541                .hub
1542                .auth
1543                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1544                .await
1545            {
1546                Ok(token) => token,
1547                Err(e) => match dlg.token(e) {
1548                    Ok(token) => token,
1549                    Err(e) => {
1550                        dlg.finished(false);
1551                        return Err(common::Error::MissingToken(e));
1552                    }
1553                },
1554            };
1555            let mut req_result = {
1556                let client = &self.hub.client;
1557                dlg.pre_request();
1558                let mut req_builder = hyper::Request::builder()
1559                    .method(hyper::Method::GET)
1560                    .uri(url.as_str())
1561                    .header(USER_AGENT, self.hub._user_agent.clone());
1562
1563                if let Some(token) = token.as_ref() {
1564                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1565                }
1566
1567                let request = req_builder
1568                    .header(CONTENT_LENGTH, 0_u64)
1569                    .body(common::to_body::<String>(None));
1570
1571                client.request(request.unwrap()).await
1572            };
1573
1574            match req_result {
1575                Err(err) => {
1576                    if let common::Retry::After(d) = dlg.http_error(&err) {
1577                        sleep(d).await;
1578                        continue;
1579                    }
1580                    dlg.finished(false);
1581                    return Err(common::Error::HttpError(err));
1582                }
1583                Ok(res) => {
1584                    let (mut parts, body) = res.into_parts();
1585                    let mut body = common::Body::new(body);
1586                    if !parts.status.is_success() {
1587                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1588                        let error = serde_json::from_str(&common::to_string(&bytes));
1589                        let response = common::to_response(parts, bytes.into());
1590
1591                        if let common::Retry::After(d) =
1592                            dlg.http_failure(&response, error.as_ref().ok())
1593                        {
1594                            sleep(d).await;
1595                            continue;
1596                        }
1597
1598                        dlg.finished(false);
1599
1600                        return Err(match error {
1601                            Ok(value) => common::Error::BadRequest(value),
1602                            _ => common::Error::Failure(response),
1603                        });
1604                    }
1605                    let response = {
1606                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1607                        let encoded = common::to_string(&bytes);
1608                        match serde_json::from_str(&encoded) {
1609                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1610                            Err(error) => {
1611                                dlg.response_json_decode_error(&encoded, &error);
1612                                return Err(common::Error::JsonDecodeError(
1613                                    encoded.to_string(),
1614                                    error,
1615                                ));
1616                            }
1617                        }
1618                    };
1619
1620                    dlg.finished(true);
1621                    return Ok(response);
1622                }
1623            }
1624        }
1625    }
1626
1627    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
1628    ///
1629    /// Sets the *instance name* path property to the given value.
1630    ///
1631    /// Even though the property as already been set when instantiating this call,
1632    /// we provide this method for API completeness.
1633    pub fn instance_name(mut self, new_value: &str) -> ActionResultGetCall<'a, C> {
1634        self._instance_name = new_value.to_string();
1635        self
1636    }
1637    /// The hash. In the case of SHA-256, it will always be a lowercase hex string exactly 64 characters long.
1638    ///
1639    /// Sets the *hash* path property to the given value.
1640    ///
1641    /// Even though the property as already been set when instantiating this call,
1642    /// we provide this method for API completeness.
1643    pub fn hash(mut self, new_value: &str) -> ActionResultGetCall<'a, C> {
1644        self._hash = new_value.to_string();
1645        self
1646    }
1647    /// The size of the blob, in bytes.
1648    ///
1649    /// Sets the *size bytes* path property to the given value.
1650    ///
1651    /// Even though the property as already been set when instantiating this call,
1652    /// we provide this method for API completeness.
1653    pub fn size_bytes(mut self, new_value: i64) -> ActionResultGetCall<'a, C> {
1654        self._size_bytes = new_value;
1655        self
1656    }
1657    /// A hint to the server to request inlining stdout in the ActionResult message.
1658    ///
1659    /// Sets the *inline stdout* query property to the given value.
1660    pub fn inline_stdout(mut self, new_value: bool) -> ActionResultGetCall<'a, C> {
1661        self._inline_stdout = Some(new_value);
1662        self
1663    }
1664    /// A hint to the server to request inlining stderr in the ActionResult message.
1665    ///
1666    /// Sets the *inline stderr* query property to the given value.
1667    pub fn inline_stderr(mut self, new_value: bool) -> ActionResultGetCall<'a, C> {
1668        self._inline_stderr = Some(new_value);
1669        self
1670    }
1671    /// A hint to the server to inline the contents of the listed output files. Each path needs to exactly match one file path in either `output_paths` or `output_files` (DEPRECATED since v2.1) in the Command message.
1672    ///
1673    /// Append the given value to the *inline output files* query property.
1674    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
1675    pub fn add_inline_output_files(mut self, new_value: &str) -> ActionResultGetCall<'a, C> {
1676        self._inline_output_files.push(new_value.to_string());
1677        self
1678    }
1679    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1680    /// while executing the actual API request.
1681    ///
1682    /// ````text
1683    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1684    /// ````
1685    ///
1686    /// Sets the *delegate* property to the given value.
1687    pub fn delegate(
1688        mut self,
1689        new_value: &'a mut dyn common::Delegate,
1690    ) -> ActionResultGetCall<'a, C> {
1691        self._delegate = Some(new_value);
1692        self
1693    }
1694
1695    /// Set any additional parameter of the query string used in the request.
1696    /// It should be used to set parameters which are not yet available through their own
1697    /// setters.
1698    ///
1699    /// Please note that this method must not be used to set any of the known parameters
1700    /// which have their own setter method. If done anyway, the request will fail.
1701    ///
1702    /// # Additional Parameters
1703    ///
1704    /// * *$.xgafv* (query-string) - V1 error format.
1705    /// * *access_token* (query-string) - OAuth access token.
1706    /// * *alt* (query-string) - Data format for response.
1707    /// * *callback* (query-string) - JSONP
1708    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1709    /// * *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.
1710    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1711    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1712    /// * *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.
1713    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1714    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1715    pub fn param<T>(mut self, name: T, value: T) -> ActionResultGetCall<'a, C>
1716    where
1717        T: AsRef<str>,
1718    {
1719        self._additional_params
1720            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1721        self
1722    }
1723
1724    /// Identifies the authorization scope for the method you are building.
1725    ///
1726    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1727    /// [`Scope::CloudPlatform`].
1728    ///
1729    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1730    /// tokens for more than one scope.
1731    ///
1732    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1733    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1734    /// sufficient, a read-write scope will do as well.
1735    pub fn add_scope<St>(mut self, scope: St) -> ActionResultGetCall<'a, C>
1736    where
1737        St: AsRef<str>,
1738    {
1739        self._scopes.insert(String::from(scope.as_ref()));
1740        self
1741    }
1742    /// Identifies the authorization scope(s) for the method you are building.
1743    ///
1744    /// See [`Self::add_scope()`] for details.
1745    pub fn add_scopes<I, St>(mut self, scopes: I) -> ActionResultGetCall<'a, C>
1746    where
1747        I: IntoIterator<Item = St>,
1748        St: AsRef<str>,
1749    {
1750        self._scopes
1751            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1752        self
1753    }
1754
1755    /// Removes all scopes, and no default scope will be used either.
1756    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1757    /// for details).
1758    pub fn clear_scopes(mut self) -> ActionResultGetCall<'a, C> {
1759        self._scopes.clear();
1760        self
1761    }
1762}
1763
1764/// Upload a new execution result. In order to allow the server to perform access control based on the type of action, and to assist with client debugging, the client MUST first upload the Action that produced the result, along with its Command, into the `ContentAddressableStorage`. Server implementations MAY modify the `UpdateActionResultRequest.action_result` and return an equivalent value. Errors: * `INVALID_ARGUMENT`: One or more arguments are invalid. * `FAILED_PRECONDITION`: One or more errors occurred in updating the action result, such as a missing command or action. * `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the entry to the cache.
1765///
1766/// A builder for the *update* method supported by a *actionResult* resource.
1767/// It is not used directly, but through a [`ActionResultMethods`] instance.
1768///
1769/// # Example
1770///
1771/// Instantiate a resource method builder
1772///
1773/// ```test_harness,no_run
1774/// # extern crate hyper;
1775/// # extern crate hyper_rustls;
1776/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
1777/// use remotebuildexecution2::api::BuildBazelRemoteExecutionV2ActionResult;
1778/// # async fn dox() {
1779/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1780///
1781/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1782/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1783/// #     secret,
1784/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1785/// # ).build().await.unwrap();
1786///
1787/// # let client = hyper_util::client::legacy::Client::builder(
1788/// #     hyper_util::rt::TokioExecutor::new()
1789/// # )
1790/// # .build(
1791/// #     hyper_rustls::HttpsConnectorBuilder::new()
1792/// #         .with_native_roots()
1793/// #         .unwrap()
1794/// #         .https_or_http()
1795/// #         .enable_http1()
1796/// #         .build()
1797/// # );
1798/// # let mut hub = RemoteBuildExecution::new(client, auth);
1799/// // As the method needs a request, you would usually fill it with the desired information
1800/// // into the respective structure. Some of the parts shown here might not be applicable !
1801/// // Values shown here are possibly random and not representative !
1802/// let mut req = BuildBazelRemoteExecutionV2ActionResult::default();
1803///
1804/// // You can configure optional parameters by calling the respective setters at will, and
1805/// // execute the final call using `doit()`.
1806/// // Values shown here are possibly random and not representative !
1807/// let result = hub.action_results().update(req, "instanceName", "hash", -17)
1808///              .results_cache_policy_priority(-99)
1809///              .doit().await;
1810/// # }
1811/// ```
1812pub struct ActionResultUpdateCall<'a, C>
1813where
1814    C: 'a,
1815{
1816    hub: &'a RemoteBuildExecution<C>,
1817    _request: BuildBazelRemoteExecutionV2ActionResult,
1818    _instance_name: String,
1819    _hash: String,
1820    _size_bytes: i64,
1821    _results_cache_policy_priority: Option<i32>,
1822    _delegate: Option<&'a mut dyn common::Delegate>,
1823    _additional_params: HashMap<String, String>,
1824    _scopes: BTreeSet<String>,
1825}
1826
1827impl<'a, C> common::CallBuilder for ActionResultUpdateCall<'a, C> {}
1828
1829impl<'a, C> ActionResultUpdateCall<'a, C>
1830where
1831    C: common::Connector,
1832{
1833    /// Perform the operation you have build so far.
1834    pub async fn doit(
1835        mut self,
1836    ) -> common::Result<(common::Response, BuildBazelRemoteExecutionV2ActionResult)> {
1837        use std::borrow::Cow;
1838        use std::io::{Read, Seek};
1839
1840        use common::{url::Params, ToParts};
1841        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1842
1843        let mut dd = common::DefaultDelegate;
1844        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1845        dlg.begin(common::MethodInfo {
1846            id: "remotebuildexecution.actionResults.update",
1847            http_method: hyper::Method::PUT,
1848        });
1849
1850        for &field in [
1851            "alt",
1852            "instanceName",
1853            "hash",
1854            "sizeBytes",
1855            "resultsCachePolicy.priority",
1856        ]
1857        .iter()
1858        {
1859            if self._additional_params.contains_key(field) {
1860                dlg.finished(false);
1861                return Err(common::Error::FieldClash(field));
1862            }
1863        }
1864
1865        let mut params = Params::with_capacity(7 + self._additional_params.len());
1866        params.push("instanceName", self._instance_name);
1867        params.push("hash", self._hash);
1868        params.push("sizeBytes", self._size_bytes.to_string());
1869        if let Some(value) = self._results_cache_policy_priority.as_ref() {
1870            params.push("resultsCachePolicy.priority", value.to_string());
1871        }
1872
1873        params.extend(self._additional_params.iter());
1874
1875        params.push("alt", "json");
1876        let mut url =
1877            self.hub._base_url.clone() + "v2/{+instanceName}/actionResults/{hash}/{sizeBytes}";
1878        if self._scopes.is_empty() {
1879            self._scopes
1880                .insert(Scope::CloudPlatform.as_ref().to_string());
1881        }
1882
1883        #[allow(clippy::single_element_loop)]
1884        for &(find_this, param_name) in [
1885            ("{+instanceName}", "instanceName"),
1886            ("{hash}", "hash"),
1887            ("{sizeBytes}", "sizeBytes"),
1888        ]
1889        .iter()
1890        {
1891            url = params.uri_replacement(url, param_name, find_this, true);
1892        }
1893        {
1894            let to_remove = ["sizeBytes", "hash", "instanceName"];
1895            params.remove_params(&to_remove);
1896        }
1897
1898        let url = params.parse_with_url(&url);
1899
1900        let mut json_mime_type = mime::APPLICATION_JSON;
1901        let mut request_value_reader = {
1902            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1903            common::remove_json_null_values(&mut value);
1904            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1905            serde_json::to_writer(&mut dst, &value).unwrap();
1906            dst
1907        };
1908        let request_size = request_value_reader
1909            .seek(std::io::SeekFrom::End(0))
1910            .unwrap();
1911        request_value_reader
1912            .seek(std::io::SeekFrom::Start(0))
1913            .unwrap();
1914
1915        loop {
1916            let token = match self
1917                .hub
1918                .auth
1919                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1920                .await
1921            {
1922                Ok(token) => token,
1923                Err(e) => match dlg.token(e) {
1924                    Ok(token) => token,
1925                    Err(e) => {
1926                        dlg.finished(false);
1927                        return Err(common::Error::MissingToken(e));
1928                    }
1929                },
1930            };
1931            request_value_reader
1932                .seek(std::io::SeekFrom::Start(0))
1933                .unwrap();
1934            let mut req_result = {
1935                let client = &self.hub.client;
1936                dlg.pre_request();
1937                let mut req_builder = hyper::Request::builder()
1938                    .method(hyper::Method::PUT)
1939                    .uri(url.as_str())
1940                    .header(USER_AGENT, self.hub._user_agent.clone());
1941
1942                if let Some(token) = token.as_ref() {
1943                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1944                }
1945
1946                let request = req_builder
1947                    .header(CONTENT_TYPE, json_mime_type.to_string())
1948                    .header(CONTENT_LENGTH, request_size as u64)
1949                    .body(common::to_body(
1950                        request_value_reader.get_ref().clone().into(),
1951                    ));
1952
1953                client.request(request.unwrap()).await
1954            };
1955
1956            match req_result {
1957                Err(err) => {
1958                    if let common::Retry::After(d) = dlg.http_error(&err) {
1959                        sleep(d).await;
1960                        continue;
1961                    }
1962                    dlg.finished(false);
1963                    return Err(common::Error::HttpError(err));
1964                }
1965                Ok(res) => {
1966                    let (mut parts, body) = res.into_parts();
1967                    let mut body = common::Body::new(body);
1968                    if !parts.status.is_success() {
1969                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1970                        let error = serde_json::from_str(&common::to_string(&bytes));
1971                        let response = common::to_response(parts, bytes.into());
1972
1973                        if let common::Retry::After(d) =
1974                            dlg.http_failure(&response, error.as_ref().ok())
1975                        {
1976                            sleep(d).await;
1977                            continue;
1978                        }
1979
1980                        dlg.finished(false);
1981
1982                        return Err(match error {
1983                            Ok(value) => common::Error::BadRequest(value),
1984                            _ => common::Error::Failure(response),
1985                        });
1986                    }
1987                    let response = {
1988                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1989                        let encoded = common::to_string(&bytes);
1990                        match serde_json::from_str(&encoded) {
1991                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1992                            Err(error) => {
1993                                dlg.response_json_decode_error(&encoded, &error);
1994                                return Err(common::Error::JsonDecodeError(
1995                                    encoded.to_string(),
1996                                    error,
1997                                ));
1998                            }
1999                        }
2000                    };
2001
2002                    dlg.finished(true);
2003                    return Ok(response);
2004                }
2005            }
2006        }
2007    }
2008
2009    ///
2010    /// Sets the *request* property to the given value.
2011    ///
2012    /// Even though the property as already been set when instantiating this call,
2013    /// we provide this method for API completeness.
2014    pub fn request(
2015        mut self,
2016        new_value: BuildBazelRemoteExecutionV2ActionResult,
2017    ) -> ActionResultUpdateCall<'a, C> {
2018        self._request = new_value;
2019        self
2020    }
2021    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
2022    ///
2023    /// Sets the *instance name* path property to the given value.
2024    ///
2025    /// Even though the property as already been set when instantiating this call,
2026    /// we provide this method for API completeness.
2027    pub fn instance_name(mut self, new_value: &str) -> ActionResultUpdateCall<'a, C> {
2028        self._instance_name = new_value.to_string();
2029        self
2030    }
2031    /// The hash. In the case of SHA-256, it will always be a lowercase hex string exactly 64 characters long.
2032    ///
2033    /// Sets the *hash* path property to the given value.
2034    ///
2035    /// Even though the property as already been set when instantiating this call,
2036    /// we provide this method for API completeness.
2037    pub fn hash(mut self, new_value: &str) -> ActionResultUpdateCall<'a, C> {
2038        self._hash = new_value.to_string();
2039        self
2040    }
2041    /// The size of the blob, in bytes.
2042    ///
2043    /// Sets the *size bytes* path property to the given value.
2044    ///
2045    /// Even though the property as already been set when instantiating this call,
2046    /// we provide this method for API completeness.
2047    pub fn size_bytes(mut self, new_value: i64) -> ActionResultUpdateCall<'a, C> {
2048        self._size_bytes = new_value;
2049        self
2050    }
2051    /// The priority (relative importance) of this content in the overall cache. Generally, a lower value means a longer retention time or other advantage, but the interpretation of a given value is server-dependent. A priority of 0 means a *default* value, decided by the server. The particular semantics of this field is up to the server. In particular, every server will have their own supported range of priorities, and will decide how these map into retention/eviction policy.
2052    ///
2053    /// Sets the *results cache policy.priority* query property to the given value.
2054    pub fn results_cache_policy_priority(
2055        mut self,
2056        new_value: i32,
2057    ) -> ActionResultUpdateCall<'a, C> {
2058        self._results_cache_policy_priority = Some(new_value);
2059        self
2060    }
2061    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2062    /// while executing the actual API request.
2063    ///
2064    /// ````text
2065    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2066    /// ````
2067    ///
2068    /// Sets the *delegate* property to the given value.
2069    pub fn delegate(
2070        mut self,
2071        new_value: &'a mut dyn common::Delegate,
2072    ) -> ActionResultUpdateCall<'a, C> {
2073        self._delegate = Some(new_value);
2074        self
2075    }
2076
2077    /// Set any additional parameter of the query string used in the request.
2078    /// It should be used to set parameters which are not yet available through their own
2079    /// setters.
2080    ///
2081    /// Please note that this method must not be used to set any of the known parameters
2082    /// which have their own setter method. If done anyway, the request will fail.
2083    ///
2084    /// # Additional Parameters
2085    ///
2086    /// * *$.xgafv* (query-string) - V1 error format.
2087    /// * *access_token* (query-string) - OAuth access token.
2088    /// * *alt* (query-string) - Data format for response.
2089    /// * *callback* (query-string) - JSONP
2090    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2091    /// * *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.
2092    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2093    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2094    /// * *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.
2095    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2096    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2097    pub fn param<T>(mut self, name: T, value: T) -> ActionResultUpdateCall<'a, C>
2098    where
2099        T: AsRef<str>,
2100    {
2101        self._additional_params
2102            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2103        self
2104    }
2105
2106    /// Identifies the authorization scope for the method you are building.
2107    ///
2108    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2109    /// [`Scope::CloudPlatform`].
2110    ///
2111    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2112    /// tokens for more than one scope.
2113    ///
2114    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2115    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2116    /// sufficient, a read-write scope will do as well.
2117    pub fn add_scope<St>(mut self, scope: St) -> ActionResultUpdateCall<'a, C>
2118    where
2119        St: AsRef<str>,
2120    {
2121        self._scopes.insert(String::from(scope.as_ref()));
2122        self
2123    }
2124    /// Identifies the authorization scope(s) for the method you are building.
2125    ///
2126    /// See [`Self::add_scope()`] for details.
2127    pub fn add_scopes<I, St>(mut self, scopes: I) -> ActionResultUpdateCall<'a, C>
2128    where
2129        I: IntoIterator<Item = St>,
2130        St: AsRef<str>,
2131    {
2132        self._scopes
2133            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2134        self
2135    }
2136
2137    /// Removes all scopes, and no default scope will be used either.
2138    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2139    /// for details).
2140    pub fn clear_scopes(mut self) -> ActionResultUpdateCall<'a, C> {
2141        self._scopes.clear();
2142        self
2143    }
2144}
2145
2146/// Execute an action remotely. In order to execute an action, the client must first upload all of the inputs, the Command to run, and the Action into the ContentAddressableStorage. It then calls `Execute` with an `action_digest` referring to them. The server will run the action and eventually return the result. The input `Action`'s fields MUST meet the various canonicalization requirements specified in the documentation for their types so that it has the same digest as other logically equivalent `Action`s. The server MAY enforce the requirements and return errors if a non-canonical input is received. It MAY also proceed without verifying some or all of the requirements, such as for performance reasons. If the server does not verify the requirement, then it will treat the `Action` as distinct from another logically equivalent action if they hash differently. Returns a stream of google.longrunning.Operation messages describing the resulting execution, with eventual `response` ExecuteResponse. The `metadata` on the operation is of type ExecuteOperationMetadata. If the client remains connected after the first response is returned after the server, then updates are streamed as if the client had called WaitExecution until the execution completes or the request reaches an error. The operation can also be queried using Operations API. The server NEED NOT implement other methods or functionality of the Operations API. Errors discovered during creation of the `Operation` will be reported as gRPC Status errors, while errors that occurred while running the action will be reported in the `status` field of the `ExecuteResponse`. The server MUST NOT set the `error` field of the `Operation` proto. The possible errors include: * `INVALID_ARGUMENT`: One or more arguments are invalid. * `FAILED_PRECONDITION`: One or more errors occurred in setting up the action requested, such as a missing input or command or no worker being available. The client may be able to fix the errors and retry. * `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run the action. * `UNAVAILABLE`: Due to a transient condition, such as all workers being occupied (and the server does not support a queue), the action could not be started. The client should retry. * `INTERNAL`: An internal error occurred in the execution engine or the worker. * `DEADLINE_EXCEEDED`: The execution timed out. * `CANCELLED`: The operation was cancelled by the client. This status is only possible if the server implements the Operations API CancelOperation method, and it was called for the current execution. In the case of a missing input or command, the server SHOULD additionally send a PreconditionFailure error detail where, for each requested blob not present in the CAS, there is a `Violation` with a `type` of `MISSING` and a `subject` of `"blobs/{hash}/{size}"` indicating the digest of the missing blob. The server does not need to guarantee that a call to this method leads to at most one execution of the action. The server MAY execute the action multiple times, potentially in parallel. These redundant executions MAY continue to run, even if the operation is completed.
2147///
2148/// A builder for the *execute* method supported by a *action* resource.
2149/// It is not used directly, but through a [`ActionMethods`] instance.
2150///
2151/// # Example
2152///
2153/// Instantiate a resource method builder
2154///
2155/// ```test_harness,no_run
2156/// # extern crate hyper;
2157/// # extern crate hyper_rustls;
2158/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
2159/// use remotebuildexecution2::api::BuildBazelRemoteExecutionV2ExecuteRequest;
2160/// # async fn dox() {
2161/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2162///
2163/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2164/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2165/// #     secret,
2166/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2167/// # ).build().await.unwrap();
2168///
2169/// # let client = hyper_util::client::legacy::Client::builder(
2170/// #     hyper_util::rt::TokioExecutor::new()
2171/// # )
2172/// # .build(
2173/// #     hyper_rustls::HttpsConnectorBuilder::new()
2174/// #         .with_native_roots()
2175/// #         .unwrap()
2176/// #         .https_or_http()
2177/// #         .enable_http1()
2178/// #         .build()
2179/// # );
2180/// # let mut hub = RemoteBuildExecution::new(client, auth);
2181/// // As the method needs a request, you would usually fill it with the desired information
2182/// // into the respective structure. Some of the parts shown here might not be applicable !
2183/// // Values shown here are possibly random and not representative !
2184/// let mut req = BuildBazelRemoteExecutionV2ExecuteRequest::default();
2185///
2186/// // You can configure optional parameters by calling the respective setters at will, and
2187/// // execute the final call using `doit()`.
2188/// // Values shown here are possibly random and not representative !
2189/// let result = hub.actions().execute(req, "instanceName")
2190///              .doit().await;
2191/// # }
2192/// ```
2193pub struct ActionExecuteCall<'a, C>
2194where
2195    C: 'a,
2196{
2197    hub: &'a RemoteBuildExecution<C>,
2198    _request: BuildBazelRemoteExecutionV2ExecuteRequest,
2199    _instance_name: String,
2200    _delegate: Option<&'a mut dyn common::Delegate>,
2201    _additional_params: HashMap<String, String>,
2202    _scopes: BTreeSet<String>,
2203}
2204
2205impl<'a, C> common::CallBuilder for ActionExecuteCall<'a, C> {}
2206
2207impl<'a, C> ActionExecuteCall<'a, C>
2208where
2209    C: common::Connector,
2210{
2211    /// Perform the operation you have build so far.
2212    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
2213        use std::borrow::Cow;
2214        use std::io::{Read, Seek};
2215
2216        use common::{url::Params, ToParts};
2217        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2218
2219        let mut dd = common::DefaultDelegate;
2220        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2221        dlg.begin(common::MethodInfo {
2222            id: "remotebuildexecution.actions.execute",
2223            http_method: hyper::Method::POST,
2224        });
2225
2226        for &field in ["alt", "instanceName"].iter() {
2227            if self._additional_params.contains_key(field) {
2228                dlg.finished(false);
2229                return Err(common::Error::FieldClash(field));
2230            }
2231        }
2232
2233        let mut params = Params::with_capacity(4 + self._additional_params.len());
2234        params.push("instanceName", self._instance_name);
2235
2236        params.extend(self._additional_params.iter());
2237
2238        params.push("alt", "json");
2239        let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/actions:execute";
2240        if self._scopes.is_empty() {
2241            self._scopes
2242                .insert(Scope::CloudPlatform.as_ref().to_string());
2243        }
2244
2245        #[allow(clippy::single_element_loop)]
2246        for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() {
2247            url = params.uri_replacement(url, param_name, find_this, true);
2248        }
2249        {
2250            let to_remove = ["instanceName"];
2251            params.remove_params(&to_remove);
2252        }
2253
2254        let url = params.parse_with_url(&url);
2255
2256        let mut json_mime_type = mime::APPLICATION_JSON;
2257        let mut request_value_reader = {
2258            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2259            common::remove_json_null_values(&mut value);
2260            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2261            serde_json::to_writer(&mut dst, &value).unwrap();
2262            dst
2263        };
2264        let request_size = request_value_reader
2265            .seek(std::io::SeekFrom::End(0))
2266            .unwrap();
2267        request_value_reader
2268            .seek(std::io::SeekFrom::Start(0))
2269            .unwrap();
2270
2271        loop {
2272            let token = match self
2273                .hub
2274                .auth
2275                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2276                .await
2277            {
2278                Ok(token) => token,
2279                Err(e) => match dlg.token(e) {
2280                    Ok(token) => token,
2281                    Err(e) => {
2282                        dlg.finished(false);
2283                        return Err(common::Error::MissingToken(e));
2284                    }
2285                },
2286            };
2287            request_value_reader
2288                .seek(std::io::SeekFrom::Start(0))
2289                .unwrap();
2290            let mut req_result = {
2291                let client = &self.hub.client;
2292                dlg.pre_request();
2293                let mut req_builder = hyper::Request::builder()
2294                    .method(hyper::Method::POST)
2295                    .uri(url.as_str())
2296                    .header(USER_AGENT, self.hub._user_agent.clone());
2297
2298                if let Some(token) = token.as_ref() {
2299                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2300                }
2301
2302                let request = req_builder
2303                    .header(CONTENT_TYPE, json_mime_type.to_string())
2304                    .header(CONTENT_LENGTH, request_size as u64)
2305                    .body(common::to_body(
2306                        request_value_reader.get_ref().clone().into(),
2307                    ));
2308
2309                client.request(request.unwrap()).await
2310            };
2311
2312            match req_result {
2313                Err(err) => {
2314                    if let common::Retry::After(d) = dlg.http_error(&err) {
2315                        sleep(d).await;
2316                        continue;
2317                    }
2318                    dlg.finished(false);
2319                    return Err(common::Error::HttpError(err));
2320                }
2321                Ok(res) => {
2322                    let (mut parts, body) = res.into_parts();
2323                    let mut body = common::Body::new(body);
2324                    if !parts.status.is_success() {
2325                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2326                        let error = serde_json::from_str(&common::to_string(&bytes));
2327                        let response = common::to_response(parts, bytes.into());
2328
2329                        if let common::Retry::After(d) =
2330                            dlg.http_failure(&response, error.as_ref().ok())
2331                        {
2332                            sleep(d).await;
2333                            continue;
2334                        }
2335
2336                        dlg.finished(false);
2337
2338                        return Err(match error {
2339                            Ok(value) => common::Error::BadRequest(value),
2340                            _ => common::Error::Failure(response),
2341                        });
2342                    }
2343                    let response = {
2344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2345                        let encoded = common::to_string(&bytes);
2346                        match serde_json::from_str(&encoded) {
2347                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2348                            Err(error) => {
2349                                dlg.response_json_decode_error(&encoded, &error);
2350                                return Err(common::Error::JsonDecodeError(
2351                                    encoded.to_string(),
2352                                    error,
2353                                ));
2354                            }
2355                        }
2356                    };
2357
2358                    dlg.finished(true);
2359                    return Ok(response);
2360                }
2361            }
2362        }
2363    }
2364
2365    ///
2366    /// Sets the *request* property to the given value.
2367    ///
2368    /// Even though the property as already been set when instantiating this call,
2369    /// we provide this method for API completeness.
2370    pub fn request(
2371        mut self,
2372        new_value: BuildBazelRemoteExecutionV2ExecuteRequest,
2373    ) -> ActionExecuteCall<'a, C> {
2374        self._request = new_value;
2375        self
2376    }
2377    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
2378    ///
2379    /// Sets the *instance name* path property to the given value.
2380    ///
2381    /// Even though the property as already been set when instantiating this call,
2382    /// we provide this method for API completeness.
2383    pub fn instance_name(mut self, new_value: &str) -> ActionExecuteCall<'a, C> {
2384        self._instance_name = new_value.to_string();
2385        self
2386    }
2387    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2388    /// while executing the actual API request.
2389    ///
2390    /// ````text
2391    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2392    /// ````
2393    ///
2394    /// Sets the *delegate* property to the given value.
2395    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ActionExecuteCall<'a, C> {
2396        self._delegate = Some(new_value);
2397        self
2398    }
2399
2400    /// Set any additional parameter of the query string used in the request.
2401    /// It should be used to set parameters which are not yet available through their own
2402    /// setters.
2403    ///
2404    /// Please note that this method must not be used to set any of the known parameters
2405    /// which have their own setter method. If done anyway, the request will fail.
2406    ///
2407    /// # Additional Parameters
2408    ///
2409    /// * *$.xgafv* (query-string) - V1 error format.
2410    /// * *access_token* (query-string) - OAuth access token.
2411    /// * *alt* (query-string) - Data format for response.
2412    /// * *callback* (query-string) - JSONP
2413    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2414    /// * *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.
2415    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2416    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2417    /// * *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.
2418    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2419    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2420    pub fn param<T>(mut self, name: T, value: T) -> ActionExecuteCall<'a, C>
2421    where
2422        T: AsRef<str>,
2423    {
2424        self._additional_params
2425            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2426        self
2427    }
2428
2429    /// Identifies the authorization scope for the method you are building.
2430    ///
2431    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2432    /// [`Scope::CloudPlatform`].
2433    ///
2434    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2435    /// tokens for more than one scope.
2436    ///
2437    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2438    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2439    /// sufficient, a read-write scope will do as well.
2440    pub fn add_scope<St>(mut self, scope: St) -> ActionExecuteCall<'a, C>
2441    where
2442        St: AsRef<str>,
2443    {
2444        self._scopes.insert(String::from(scope.as_ref()));
2445        self
2446    }
2447    /// Identifies the authorization scope(s) for the method you are building.
2448    ///
2449    /// See [`Self::add_scope()`] for details.
2450    pub fn add_scopes<I, St>(mut self, scopes: I) -> ActionExecuteCall<'a, C>
2451    where
2452        I: IntoIterator<Item = St>,
2453        St: AsRef<str>,
2454    {
2455        self._scopes
2456            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2457        self
2458    }
2459
2460    /// Removes all scopes, and no default scope will be used either.
2461    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2462    /// for details).
2463    pub fn clear_scopes(mut self) -> ActionExecuteCall<'a, C> {
2464        self._scopes.clear();
2465        self
2466    }
2467}
2468
2469/// Download many blobs at once. The server may enforce a limit of the combined total size of blobs to be downloaded using this API. This limit may be obtained using the Capabilities API. Requests exceeding the limit should either be split into smaller chunks or downloaded using the ByteStream API, as appropriate. This request is equivalent to calling a Bytestream `Read` request on each individual blob, in parallel. The requests may succeed or fail independently. Errors: * `INVALID_ARGUMENT`: The client attempted to read more than the server supported limit. Every error on individual read will be returned in the corresponding digest status.
2470///
2471/// A builder for the *batchRead* method supported by a *blob* resource.
2472/// It is not used directly, but through a [`BlobMethods`] instance.
2473///
2474/// # Example
2475///
2476/// Instantiate a resource method builder
2477///
2478/// ```test_harness,no_run
2479/// # extern crate hyper;
2480/// # extern crate hyper_rustls;
2481/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
2482/// use remotebuildexecution2::api::BuildBazelRemoteExecutionV2BatchReadBlobsRequest;
2483/// # async fn dox() {
2484/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2485///
2486/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2487/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2488/// #     secret,
2489/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2490/// # ).build().await.unwrap();
2491///
2492/// # let client = hyper_util::client::legacy::Client::builder(
2493/// #     hyper_util::rt::TokioExecutor::new()
2494/// # )
2495/// # .build(
2496/// #     hyper_rustls::HttpsConnectorBuilder::new()
2497/// #         .with_native_roots()
2498/// #         .unwrap()
2499/// #         .https_or_http()
2500/// #         .enable_http1()
2501/// #         .build()
2502/// # );
2503/// # let mut hub = RemoteBuildExecution::new(client, auth);
2504/// // As the method needs a request, you would usually fill it with the desired information
2505/// // into the respective structure. Some of the parts shown here might not be applicable !
2506/// // Values shown here are possibly random and not representative !
2507/// let mut req = BuildBazelRemoteExecutionV2BatchReadBlobsRequest::default();
2508///
2509/// // You can configure optional parameters by calling the respective setters at will, and
2510/// // execute the final call using `doit()`.
2511/// // Values shown here are possibly random and not representative !
2512/// let result = hub.blobs().batch_read(req, "instanceName")
2513///              .doit().await;
2514/// # }
2515/// ```
2516pub struct BlobBatchReadCall<'a, C>
2517where
2518    C: 'a,
2519{
2520    hub: &'a RemoteBuildExecution<C>,
2521    _request: BuildBazelRemoteExecutionV2BatchReadBlobsRequest,
2522    _instance_name: String,
2523    _delegate: Option<&'a mut dyn common::Delegate>,
2524    _additional_params: HashMap<String, String>,
2525    _scopes: BTreeSet<String>,
2526}
2527
2528impl<'a, C> common::CallBuilder for BlobBatchReadCall<'a, C> {}
2529
2530impl<'a, C> BlobBatchReadCall<'a, C>
2531where
2532    C: common::Connector,
2533{
2534    /// Perform the operation you have build so far.
2535    pub async fn doit(
2536        mut self,
2537    ) -> common::Result<(
2538        common::Response,
2539        BuildBazelRemoteExecutionV2BatchReadBlobsResponse,
2540    )> {
2541        use std::borrow::Cow;
2542        use std::io::{Read, Seek};
2543
2544        use common::{url::Params, ToParts};
2545        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2546
2547        let mut dd = common::DefaultDelegate;
2548        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2549        dlg.begin(common::MethodInfo {
2550            id: "remotebuildexecution.blobs.batchRead",
2551            http_method: hyper::Method::POST,
2552        });
2553
2554        for &field in ["alt", "instanceName"].iter() {
2555            if self._additional_params.contains_key(field) {
2556                dlg.finished(false);
2557                return Err(common::Error::FieldClash(field));
2558            }
2559        }
2560
2561        let mut params = Params::with_capacity(4 + self._additional_params.len());
2562        params.push("instanceName", self._instance_name);
2563
2564        params.extend(self._additional_params.iter());
2565
2566        params.push("alt", "json");
2567        let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/blobs:batchRead";
2568        if self._scopes.is_empty() {
2569            self._scopes
2570                .insert(Scope::CloudPlatform.as_ref().to_string());
2571        }
2572
2573        #[allow(clippy::single_element_loop)]
2574        for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() {
2575            url = params.uri_replacement(url, param_name, find_this, true);
2576        }
2577        {
2578            let to_remove = ["instanceName"];
2579            params.remove_params(&to_remove);
2580        }
2581
2582        let url = params.parse_with_url(&url);
2583
2584        let mut json_mime_type = mime::APPLICATION_JSON;
2585        let mut request_value_reader = {
2586            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2587            common::remove_json_null_values(&mut value);
2588            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2589            serde_json::to_writer(&mut dst, &value).unwrap();
2590            dst
2591        };
2592        let request_size = request_value_reader
2593            .seek(std::io::SeekFrom::End(0))
2594            .unwrap();
2595        request_value_reader
2596            .seek(std::io::SeekFrom::Start(0))
2597            .unwrap();
2598
2599        loop {
2600            let token = match self
2601                .hub
2602                .auth
2603                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2604                .await
2605            {
2606                Ok(token) => token,
2607                Err(e) => match dlg.token(e) {
2608                    Ok(token) => token,
2609                    Err(e) => {
2610                        dlg.finished(false);
2611                        return Err(common::Error::MissingToken(e));
2612                    }
2613                },
2614            };
2615            request_value_reader
2616                .seek(std::io::SeekFrom::Start(0))
2617                .unwrap();
2618            let mut req_result = {
2619                let client = &self.hub.client;
2620                dlg.pre_request();
2621                let mut req_builder = hyper::Request::builder()
2622                    .method(hyper::Method::POST)
2623                    .uri(url.as_str())
2624                    .header(USER_AGENT, self.hub._user_agent.clone());
2625
2626                if let Some(token) = token.as_ref() {
2627                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2628                }
2629
2630                let request = req_builder
2631                    .header(CONTENT_TYPE, json_mime_type.to_string())
2632                    .header(CONTENT_LENGTH, request_size as u64)
2633                    .body(common::to_body(
2634                        request_value_reader.get_ref().clone().into(),
2635                    ));
2636
2637                client.request(request.unwrap()).await
2638            };
2639
2640            match req_result {
2641                Err(err) => {
2642                    if let common::Retry::After(d) = dlg.http_error(&err) {
2643                        sleep(d).await;
2644                        continue;
2645                    }
2646                    dlg.finished(false);
2647                    return Err(common::Error::HttpError(err));
2648                }
2649                Ok(res) => {
2650                    let (mut parts, body) = res.into_parts();
2651                    let mut body = common::Body::new(body);
2652                    if !parts.status.is_success() {
2653                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2654                        let error = serde_json::from_str(&common::to_string(&bytes));
2655                        let response = common::to_response(parts, bytes.into());
2656
2657                        if let common::Retry::After(d) =
2658                            dlg.http_failure(&response, error.as_ref().ok())
2659                        {
2660                            sleep(d).await;
2661                            continue;
2662                        }
2663
2664                        dlg.finished(false);
2665
2666                        return Err(match error {
2667                            Ok(value) => common::Error::BadRequest(value),
2668                            _ => common::Error::Failure(response),
2669                        });
2670                    }
2671                    let response = {
2672                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2673                        let encoded = common::to_string(&bytes);
2674                        match serde_json::from_str(&encoded) {
2675                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2676                            Err(error) => {
2677                                dlg.response_json_decode_error(&encoded, &error);
2678                                return Err(common::Error::JsonDecodeError(
2679                                    encoded.to_string(),
2680                                    error,
2681                                ));
2682                            }
2683                        }
2684                    };
2685
2686                    dlg.finished(true);
2687                    return Ok(response);
2688                }
2689            }
2690        }
2691    }
2692
2693    ///
2694    /// Sets the *request* property to the given value.
2695    ///
2696    /// Even though the property as already been set when instantiating this call,
2697    /// we provide this method for API completeness.
2698    pub fn request(
2699        mut self,
2700        new_value: BuildBazelRemoteExecutionV2BatchReadBlobsRequest,
2701    ) -> BlobBatchReadCall<'a, C> {
2702        self._request = new_value;
2703        self
2704    }
2705    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
2706    ///
2707    /// Sets the *instance name* path property to the given value.
2708    ///
2709    /// Even though the property as already been set when instantiating this call,
2710    /// we provide this method for API completeness.
2711    pub fn instance_name(mut self, new_value: &str) -> BlobBatchReadCall<'a, C> {
2712        self._instance_name = new_value.to_string();
2713        self
2714    }
2715    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2716    /// while executing the actual API request.
2717    ///
2718    /// ````text
2719    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2720    /// ````
2721    ///
2722    /// Sets the *delegate* property to the given value.
2723    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> BlobBatchReadCall<'a, C> {
2724        self._delegate = Some(new_value);
2725        self
2726    }
2727
2728    /// Set any additional parameter of the query string used in the request.
2729    /// It should be used to set parameters which are not yet available through their own
2730    /// setters.
2731    ///
2732    /// Please note that this method must not be used to set any of the known parameters
2733    /// which have their own setter method. If done anyway, the request will fail.
2734    ///
2735    /// # Additional Parameters
2736    ///
2737    /// * *$.xgafv* (query-string) - V1 error format.
2738    /// * *access_token* (query-string) - OAuth access token.
2739    /// * *alt* (query-string) - Data format for response.
2740    /// * *callback* (query-string) - JSONP
2741    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2742    /// * *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.
2743    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2744    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2745    /// * *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.
2746    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2747    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2748    pub fn param<T>(mut self, name: T, value: T) -> BlobBatchReadCall<'a, C>
2749    where
2750        T: AsRef<str>,
2751    {
2752        self._additional_params
2753            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2754        self
2755    }
2756
2757    /// Identifies the authorization scope for the method you are building.
2758    ///
2759    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2760    /// [`Scope::CloudPlatform`].
2761    ///
2762    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2763    /// tokens for more than one scope.
2764    ///
2765    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2766    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2767    /// sufficient, a read-write scope will do as well.
2768    pub fn add_scope<St>(mut self, scope: St) -> BlobBatchReadCall<'a, C>
2769    where
2770        St: AsRef<str>,
2771    {
2772        self._scopes.insert(String::from(scope.as_ref()));
2773        self
2774    }
2775    /// Identifies the authorization scope(s) for the method you are building.
2776    ///
2777    /// See [`Self::add_scope()`] for details.
2778    pub fn add_scopes<I, St>(mut self, scopes: I) -> BlobBatchReadCall<'a, C>
2779    where
2780        I: IntoIterator<Item = St>,
2781        St: AsRef<str>,
2782    {
2783        self._scopes
2784            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2785        self
2786    }
2787
2788    /// Removes all scopes, and no default scope will be used either.
2789    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2790    /// for details).
2791    pub fn clear_scopes(mut self) -> BlobBatchReadCall<'a, C> {
2792        self._scopes.clear();
2793        self
2794    }
2795}
2796
2797/// Upload many blobs at once. The server may enforce a limit of the combined total size of blobs to be uploaded using this API. This limit may be obtained using the Capabilities API. Requests exceeding the limit should either be split into smaller chunks or uploaded using the ByteStream API, as appropriate. This request is equivalent to calling a Bytestream `Write` request on each individual blob, in parallel. The requests may succeed or fail independently. Errors: * `INVALID_ARGUMENT`: The client attempted to upload more than the server supported limit. Individual requests may return the following errors, additionally: * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. * `INVALID_ARGUMENT`: The Digest does not match the provided data.
2798///
2799/// A builder for the *batchUpdate* method supported by a *blob* resource.
2800/// It is not used directly, but through a [`BlobMethods`] instance.
2801///
2802/// # Example
2803///
2804/// Instantiate a resource method builder
2805///
2806/// ```test_harness,no_run
2807/// # extern crate hyper;
2808/// # extern crate hyper_rustls;
2809/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
2810/// use remotebuildexecution2::api::BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest;
2811/// # async fn dox() {
2812/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2813///
2814/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2815/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2816/// #     secret,
2817/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2818/// # ).build().await.unwrap();
2819///
2820/// # let client = hyper_util::client::legacy::Client::builder(
2821/// #     hyper_util::rt::TokioExecutor::new()
2822/// # )
2823/// # .build(
2824/// #     hyper_rustls::HttpsConnectorBuilder::new()
2825/// #         .with_native_roots()
2826/// #         .unwrap()
2827/// #         .https_or_http()
2828/// #         .enable_http1()
2829/// #         .build()
2830/// # );
2831/// # let mut hub = RemoteBuildExecution::new(client, auth);
2832/// // As the method needs a request, you would usually fill it with the desired information
2833/// // into the respective structure. Some of the parts shown here might not be applicable !
2834/// // Values shown here are possibly random and not representative !
2835/// let mut req = BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest::default();
2836///
2837/// // You can configure optional parameters by calling the respective setters at will, and
2838/// // execute the final call using `doit()`.
2839/// // Values shown here are possibly random and not representative !
2840/// let result = hub.blobs().batch_update(req, "instanceName")
2841///              .doit().await;
2842/// # }
2843/// ```
2844pub struct BlobBatchUpdateCall<'a, C>
2845where
2846    C: 'a,
2847{
2848    hub: &'a RemoteBuildExecution<C>,
2849    _request: BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest,
2850    _instance_name: String,
2851    _delegate: Option<&'a mut dyn common::Delegate>,
2852    _additional_params: HashMap<String, String>,
2853    _scopes: BTreeSet<String>,
2854}
2855
2856impl<'a, C> common::CallBuilder for BlobBatchUpdateCall<'a, C> {}
2857
2858impl<'a, C> BlobBatchUpdateCall<'a, C>
2859where
2860    C: common::Connector,
2861{
2862    /// Perform the operation you have build so far.
2863    pub async fn doit(
2864        mut self,
2865    ) -> common::Result<(
2866        common::Response,
2867        BuildBazelRemoteExecutionV2BatchUpdateBlobsResponse,
2868    )> {
2869        use std::borrow::Cow;
2870        use std::io::{Read, Seek};
2871
2872        use common::{url::Params, ToParts};
2873        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2874
2875        let mut dd = common::DefaultDelegate;
2876        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2877        dlg.begin(common::MethodInfo {
2878            id: "remotebuildexecution.blobs.batchUpdate",
2879            http_method: hyper::Method::POST,
2880        });
2881
2882        for &field in ["alt", "instanceName"].iter() {
2883            if self._additional_params.contains_key(field) {
2884                dlg.finished(false);
2885                return Err(common::Error::FieldClash(field));
2886            }
2887        }
2888
2889        let mut params = Params::with_capacity(4 + self._additional_params.len());
2890        params.push("instanceName", self._instance_name);
2891
2892        params.extend(self._additional_params.iter());
2893
2894        params.push("alt", "json");
2895        let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/blobs:batchUpdate";
2896        if self._scopes.is_empty() {
2897            self._scopes
2898                .insert(Scope::CloudPlatform.as_ref().to_string());
2899        }
2900
2901        #[allow(clippy::single_element_loop)]
2902        for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() {
2903            url = params.uri_replacement(url, param_name, find_this, true);
2904        }
2905        {
2906            let to_remove = ["instanceName"];
2907            params.remove_params(&to_remove);
2908        }
2909
2910        let url = params.parse_with_url(&url);
2911
2912        let mut json_mime_type = mime::APPLICATION_JSON;
2913        let mut request_value_reader = {
2914            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2915            common::remove_json_null_values(&mut value);
2916            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2917            serde_json::to_writer(&mut dst, &value).unwrap();
2918            dst
2919        };
2920        let request_size = request_value_reader
2921            .seek(std::io::SeekFrom::End(0))
2922            .unwrap();
2923        request_value_reader
2924            .seek(std::io::SeekFrom::Start(0))
2925            .unwrap();
2926
2927        loop {
2928            let token = match self
2929                .hub
2930                .auth
2931                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2932                .await
2933            {
2934                Ok(token) => token,
2935                Err(e) => match dlg.token(e) {
2936                    Ok(token) => token,
2937                    Err(e) => {
2938                        dlg.finished(false);
2939                        return Err(common::Error::MissingToken(e));
2940                    }
2941                },
2942            };
2943            request_value_reader
2944                .seek(std::io::SeekFrom::Start(0))
2945                .unwrap();
2946            let mut req_result = {
2947                let client = &self.hub.client;
2948                dlg.pre_request();
2949                let mut req_builder = hyper::Request::builder()
2950                    .method(hyper::Method::POST)
2951                    .uri(url.as_str())
2952                    .header(USER_AGENT, self.hub._user_agent.clone());
2953
2954                if let Some(token) = token.as_ref() {
2955                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2956                }
2957
2958                let request = req_builder
2959                    .header(CONTENT_TYPE, json_mime_type.to_string())
2960                    .header(CONTENT_LENGTH, request_size as u64)
2961                    .body(common::to_body(
2962                        request_value_reader.get_ref().clone().into(),
2963                    ));
2964
2965                client.request(request.unwrap()).await
2966            };
2967
2968            match req_result {
2969                Err(err) => {
2970                    if let common::Retry::After(d) = dlg.http_error(&err) {
2971                        sleep(d).await;
2972                        continue;
2973                    }
2974                    dlg.finished(false);
2975                    return Err(common::Error::HttpError(err));
2976                }
2977                Ok(res) => {
2978                    let (mut parts, body) = res.into_parts();
2979                    let mut body = common::Body::new(body);
2980                    if !parts.status.is_success() {
2981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2982                        let error = serde_json::from_str(&common::to_string(&bytes));
2983                        let response = common::to_response(parts, bytes.into());
2984
2985                        if let common::Retry::After(d) =
2986                            dlg.http_failure(&response, error.as_ref().ok())
2987                        {
2988                            sleep(d).await;
2989                            continue;
2990                        }
2991
2992                        dlg.finished(false);
2993
2994                        return Err(match error {
2995                            Ok(value) => common::Error::BadRequest(value),
2996                            _ => common::Error::Failure(response),
2997                        });
2998                    }
2999                    let response = {
3000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3001                        let encoded = common::to_string(&bytes);
3002                        match serde_json::from_str(&encoded) {
3003                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3004                            Err(error) => {
3005                                dlg.response_json_decode_error(&encoded, &error);
3006                                return Err(common::Error::JsonDecodeError(
3007                                    encoded.to_string(),
3008                                    error,
3009                                ));
3010                            }
3011                        }
3012                    };
3013
3014                    dlg.finished(true);
3015                    return Ok(response);
3016                }
3017            }
3018        }
3019    }
3020
3021    ///
3022    /// Sets the *request* property to the given value.
3023    ///
3024    /// Even though the property as already been set when instantiating this call,
3025    /// we provide this method for API completeness.
3026    pub fn request(
3027        mut self,
3028        new_value: BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest,
3029    ) -> BlobBatchUpdateCall<'a, C> {
3030        self._request = new_value;
3031        self
3032    }
3033    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
3034    ///
3035    /// Sets the *instance name* path property to the given value.
3036    ///
3037    /// Even though the property as already been set when instantiating this call,
3038    /// we provide this method for API completeness.
3039    pub fn instance_name(mut self, new_value: &str) -> BlobBatchUpdateCall<'a, C> {
3040        self._instance_name = new_value.to_string();
3041        self
3042    }
3043    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3044    /// while executing the actual API request.
3045    ///
3046    /// ````text
3047    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3048    /// ````
3049    ///
3050    /// Sets the *delegate* property to the given value.
3051    pub fn delegate(
3052        mut self,
3053        new_value: &'a mut dyn common::Delegate,
3054    ) -> BlobBatchUpdateCall<'a, C> {
3055        self._delegate = Some(new_value);
3056        self
3057    }
3058
3059    /// Set any additional parameter of the query string used in the request.
3060    /// It should be used to set parameters which are not yet available through their own
3061    /// setters.
3062    ///
3063    /// Please note that this method must not be used to set any of the known parameters
3064    /// which have their own setter method. If done anyway, the request will fail.
3065    ///
3066    /// # Additional Parameters
3067    ///
3068    /// * *$.xgafv* (query-string) - V1 error format.
3069    /// * *access_token* (query-string) - OAuth access token.
3070    /// * *alt* (query-string) - Data format for response.
3071    /// * *callback* (query-string) - JSONP
3072    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3073    /// * *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.
3074    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3075    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3076    /// * *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.
3077    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3078    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3079    pub fn param<T>(mut self, name: T, value: T) -> BlobBatchUpdateCall<'a, C>
3080    where
3081        T: AsRef<str>,
3082    {
3083        self._additional_params
3084            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3085        self
3086    }
3087
3088    /// Identifies the authorization scope for the method you are building.
3089    ///
3090    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3091    /// [`Scope::CloudPlatform`].
3092    ///
3093    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3094    /// tokens for more than one scope.
3095    ///
3096    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3097    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3098    /// sufficient, a read-write scope will do as well.
3099    pub fn add_scope<St>(mut self, scope: St) -> BlobBatchUpdateCall<'a, C>
3100    where
3101        St: AsRef<str>,
3102    {
3103        self._scopes.insert(String::from(scope.as_ref()));
3104        self
3105    }
3106    /// Identifies the authorization scope(s) for the method you are building.
3107    ///
3108    /// See [`Self::add_scope()`] for details.
3109    pub fn add_scopes<I, St>(mut self, scopes: I) -> BlobBatchUpdateCall<'a, C>
3110    where
3111        I: IntoIterator<Item = St>,
3112        St: AsRef<str>,
3113    {
3114        self._scopes
3115            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3116        self
3117    }
3118
3119    /// Removes all scopes, and no default scope will be used either.
3120    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3121    /// for details).
3122    pub fn clear_scopes(mut self) -> BlobBatchUpdateCall<'a, C> {
3123        self._scopes.clear();
3124        self
3125    }
3126}
3127
3128/// Determine if blobs are present in the CAS. Clients can use this API before uploading blobs to determine which ones are already present in the CAS and do not need to be uploaded again. Servers SHOULD increase the lifetimes of the referenced blobs if necessary and applicable. There are no method-specific errors.
3129///
3130/// A builder for the *findMissing* method supported by a *blob* resource.
3131/// It is not used directly, but through a [`BlobMethods`] instance.
3132///
3133/// # Example
3134///
3135/// Instantiate a resource method builder
3136///
3137/// ```test_harness,no_run
3138/// # extern crate hyper;
3139/// # extern crate hyper_rustls;
3140/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
3141/// use remotebuildexecution2::api::BuildBazelRemoteExecutionV2FindMissingBlobsRequest;
3142/// # async fn dox() {
3143/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3144///
3145/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3146/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3147/// #     secret,
3148/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3149/// # ).build().await.unwrap();
3150///
3151/// # let client = hyper_util::client::legacy::Client::builder(
3152/// #     hyper_util::rt::TokioExecutor::new()
3153/// # )
3154/// # .build(
3155/// #     hyper_rustls::HttpsConnectorBuilder::new()
3156/// #         .with_native_roots()
3157/// #         .unwrap()
3158/// #         .https_or_http()
3159/// #         .enable_http1()
3160/// #         .build()
3161/// # );
3162/// # let mut hub = RemoteBuildExecution::new(client, auth);
3163/// // As the method needs a request, you would usually fill it with the desired information
3164/// // into the respective structure. Some of the parts shown here might not be applicable !
3165/// // Values shown here are possibly random and not representative !
3166/// let mut req = BuildBazelRemoteExecutionV2FindMissingBlobsRequest::default();
3167///
3168/// // You can configure optional parameters by calling the respective setters at will, and
3169/// // execute the final call using `doit()`.
3170/// // Values shown here are possibly random and not representative !
3171/// let result = hub.blobs().find_missing(req, "instanceName")
3172///              .doit().await;
3173/// # }
3174/// ```
3175pub struct BlobFindMissingCall<'a, C>
3176where
3177    C: 'a,
3178{
3179    hub: &'a RemoteBuildExecution<C>,
3180    _request: BuildBazelRemoteExecutionV2FindMissingBlobsRequest,
3181    _instance_name: String,
3182    _delegate: Option<&'a mut dyn common::Delegate>,
3183    _additional_params: HashMap<String, String>,
3184    _scopes: BTreeSet<String>,
3185}
3186
3187impl<'a, C> common::CallBuilder for BlobFindMissingCall<'a, C> {}
3188
3189impl<'a, C> BlobFindMissingCall<'a, C>
3190where
3191    C: common::Connector,
3192{
3193    /// Perform the operation you have build so far.
3194    pub async fn doit(
3195        mut self,
3196    ) -> common::Result<(
3197        common::Response,
3198        BuildBazelRemoteExecutionV2FindMissingBlobsResponse,
3199    )> {
3200        use std::borrow::Cow;
3201        use std::io::{Read, Seek};
3202
3203        use common::{url::Params, ToParts};
3204        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3205
3206        let mut dd = common::DefaultDelegate;
3207        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3208        dlg.begin(common::MethodInfo {
3209            id: "remotebuildexecution.blobs.findMissing",
3210            http_method: hyper::Method::POST,
3211        });
3212
3213        for &field in ["alt", "instanceName"].iter() {
3214            if self._additional_params.contains_key(field) {
3215                dlg.finished(false);
3216                return Err(common::Error::FieldClash(field));
3217            }
3218        }
3219
3220        let mut params = Params::with_capacity(4 + self._additional_params.len());
3221        params.push("instanceName", self._instance_name);
3222
3223        params.extend(self._additional_params.iter());
3224
3225        params.push("alt", "json");
3226        let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/blobs:findMissing";
3227        if self._scopes.is_empty() {
3228            self._scopes
3229                .insert(Scope::CloudPlatform.as_ref().to_string());
3230        }
3231
3232        #[allow(clippy::single_element_loop)]
3233        for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() {
3234            url = params.uri_replacement(url, param_name, find_this, true);
3235        }
3236        {
3237            let to_remove = ["instanceName"];
3238            params.remove_params(&to_remove);
3239        }
3240
3241        let url = params.parse_with_url(&url);
3242
3243        let mut json_mime_type = mime::APPLICATION_JSON;
3244        let mut request_value_reader = {
3245            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3246            common::remove_json_null_values(&mut value);
3247            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3248            serde_json::to_writer(&mut dst, &value).unwrap();
3249            dst
3250        };
3251        let request_size = request_value_reader
3252            .seek(std::io::SeekFrom::End(0))
3253            .unwrap();
3254        request_value_reader
3255            .seek(std::io::SeekFrom::Start(0))
3256            .unwrap();
3257
3258        loop {
3259            let token = match self
3260                .hub
3261                .auth
3262                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3263                .await
3264            {
3265                Ok(token) => token,
3266                Err(e) => match dlg.token(e) {
3267                    Ok(token) => token,
3268                    Err(e) => {
3269                        dlg.finished(false);
3270                        return Err(common::Error::MissingToken(e));
3271                    }
3272                },
3273            };
3274            request_value_reader
3275                .seek(std::io::SeekFrom::Start(0))
3276                .unwrap();
3277            let mut req_result = {
3278                let client = &self.hub.client;
3279                dlg.pre_request();
3280                let mut req_builder = hyper::Request::builder()
3281                    .method(hyper::Method::POST)
3282                    .uri(url.as_str())
3283                    .header(USER_AGENT, self.hub._user_agent.clone());
3284
3285                if let Some(token) = token.as_ref() {
3286                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3287                }
3288
3289                let request = req_builder
3290                    .header(CONTENT_TYPE, json_mime_type.to_string())
3291                    .header(CONTENT_LENGTH, request_size as u64)
3292                    .body(common::to_body(
3293                        request_value_reader.get_ref().clone().into(),
3294                    ));
3295
3296                client.request(request.unwrap()).await
3297            };
3298
3299            match req_result {
3300                Err(err) => {
3301                    if let common::Retry::After(d) = dlg.http_error(&err) {
3302                        sleep(d).await;
3303                        continue;
3304                    }
3305                    dlg.finished(false);
3306                    return Err(common::Error::HttpError(err));
3307                }
3308                Ok(res) => {
3309                    let (mut parts, body) = res.into_parts();
3310                    let mut body = common::Body::new(body);
3311                    if !parts.status.is_success() {
3312                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3313                        let error = serde_json::from_str(&common::to_string(&bytes));
3314                        let response = common::to_response(parts, bytes.into());
3315
3316                        if let common::Retry::After(d) =
3317                            dlg.http_failure(&response, error.as_ref().ok())
3318                        {
3319                            sleep(d).await;
3320                            continue;
3321                        }
3322
3323                        dlg.finished(false);
3324
3325                        return Err(match error {
3326                            Ok(value) => common::Error::BadRequest(value),
3327                            _ => common::Error::Failure(response),
3328                        });
3329                    }
3330                    let response = {
3331                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3332                        let encoded = common::to_string(&bytes);
3333                        match serde_json::from_str(&encoded) {
3334                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3335                            Err(error) => {
3336                                dlg.response_json_decode_error(&encoded, &error);
3337                                return Err(common::Error::JsonDecodeError(
3338                                    encoded.to_string(),
3339                                    error,
3340                                ));
3341                            }
3342                        }
3343                    };
3344
3345                    dlg.finished(true);
3346                    return Ok(response);
3347                }
3348            }
3349        }
3350    }
3351
3352    ///
3353    /// Sets the *request* property to the given value.
3354    ///
3355    /// Even though the property as already been set when instantiating this call,
3356    /// we provide this method for API completeness.
3357    pub fn request(
3358        mut self,
3359        new_value: BuildBazelRemoteExecutionV2FindMissingBlobsRequest,
3360    ) -> BlobFindMissingCall<'a, C> {
3361        self._request = new_value;
3362        self
3363    }
3364    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
3365    ///
3366    /// Sets the *instance name* path property to the given value.
3367    ///
3368    /// Even though the property as already been set when instantiating this call,
3369    /// we provide this method for API completeness.
3370    pub fn instance_name(mut self, new_value: &str) -> BlobFindMissingCall<'a, C> {
3371        self._instance_name = new_value.to_string();
3372        self
3373    }
3374    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3375    /// while executing the actual API request.
3376    ///
3377    /// ````text
3378    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3379    /// ````
3380    ///
3381    /// Sets the *delegate* property to the given value.
3382    pub fn delegate(
3383        mut self,
3384        new_value: &'a mut dyn common::Delegate,
3385    ) -> BlobFindMissingCall<'a, C> {
3386        self._delegate = Some(new_value);
3387        self
3388    }
3389
3390    /// Set any additional parameter of the query string used in the request.
3391    /// It should be used to set parameters which are not yet available through their own
3392    /// setters.
3393    ///
3394    /// Please note that this method must not be used to set any of the known parameters
3395    /// which have their own setter method. If done anyway, the request will fail.
3396    ///
3397    /// # Additional Parameters
3398    ///
3399    /// * *$.xgafv* (query-string) - V1 error format.
3400    /// * *access_token* (query-string) - OAuth access token.
3401    /// * *alt* (query-string) - Data format for response.
3402    /// * *callback* (query-string) - JSONP
3403    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3404    /// * *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.
3405    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3406    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3407    /// * *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.
3408    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3409    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3410    pub fn param<T>(mut self, name: T, value: T) -> BlobFindMissingCall<'a, C>
3411    where
3412        T: AsRef<str>,
3413    {
3414        self._additional_params
3415            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3416        self
3417    }
3418
3419    /// Identifies the authorization scope for the method you are building.
3420    ///
3421    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3422    /// [`Scope::CloudPlatform`].
3423    ///
3424    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3425    /// tokens for more than one scope.
3426    ///
3427    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3428    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3429    /// sufficient, a read-write scope will do as well.
3430    pub fn add_scope<St>(mut self, scope: St) -> BlobFindMissingCall<'a, C>
3431    where
3432        St: AsRef<str>,
3433    {
3434        self._scopes.insert(String::from(scope.as_ref()));
3435        self
3436    }
3437    /// Identifies the authorization scope(s) for the method you are building.
3438    ///
3439    /// See [`Self::add_scope()`] for details.
3440    pub fn add_scopes<I, St>(mut self, scopes: I) -> BlobFindMissingCall<'a, C>
3441    where
3442        I: IntoIterator<Item = St>,
3443        St: AsRef<str>,
3444    {
3445        self._scopes
3446            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3447        self
3448    }
3449
3450    /// Removes all scopes, and no default scope will be used either.
3451    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3452    /// for details).
3453    pub fn clear_scopes(mut self) -> BlobFindMissingCall<'a, C> {
3454        self._scopes.clear();
3455        self
3456    }
3457}
3458
3459/// Fetch the entire directory tree rooted at a node. This request must be targeted at a Directory stored in the ContentAddressableStorage (CAS). The server will enumerate the `Directory` tree recursively and return every node descended from the root. The GetTreeRequest.page_token parameter can be used to skip ahead in the stream (e.g. when retrying a partially completed and aborted request), by setting it to a value taken from GetTreeResponse.next_page_token of the last successfully processed GetTreeResponse). The exact traversal order is unspecified and, unless retrieving subsequent pages from an earlier request, is not guaranteed to be stable across multiple invocations of `GetTree`. If part of the tree is missing from the CAS, the server will return the portion present and omit the rest. Errors: * `NOT_FOUND`: The requested tree root is not present in the CAS.
3460///
3461/// A builder for the *getTree* method supported by a *blob* resource.
3462/// It is not used directly, but through a [`BlobMethods`] instance.
3463///
3464/// # Example
3465///
3466/// Instantiate a resource method builder
3467///
3468/// ```test_harness,no_run
3469/// # extern crate hyper;
3470/// # extern crate hyper_rustls;
3471/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
3472/// # async fn dox() {
3473/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3474///
3475/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3476/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3477/// #     secret,
3478/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3479/// # ).build().await.unwrap();
3480///
3481/// # let client = hyper_util::client::legacy::Client::builder(
3482/// #     hyper_util::rt::TokioExecutor::new()
3483/// # )
3484/// # .build(
3485/// #     hyper_rustls::HttpsConnectorBuilder::new()
3486/// #         .with_native_roots()
3487/// #         .unwrap()
3488/// #         .https_or_http()
3489/// #         .enable_http1()
3490/// #         .build()
3491/// # );
3492/// # let mut hub = RemoteBuildExecution::new(client, auth);
3493/// // You can configure optional parameters by calling the respective setters at will, and
3494/// // execute the final call using `doit()`.
3495/// // Values shown here are possibly random and not representative !
3496/// let result = hub.blobs().get_tree("instanceName", "hash", -61)
3497///              .page_token("Stet")
3498///              .page_size(-13)
3499///              .doit().await;
3500/// # }
3501/// ```
3502pub struct BlobGetTreeCall<'a, C>
3503where
3504    C: 'a,
3505{
3506    hub: &'a RemoteBuildExecution<C>,
3507    _instance_name: String,
3508    _hash: String,
3509    _size_bytes: i64,
3510    _page_token: Option<String>,
3511    _page_size: Option<i32>,
3512    _delegate: Option<&'a mut dyn common::Delegate>,
3513    _additional_params: HashMap<String, String>,
3514    _scopes: BTreeSet<String>,
3515}
3516
3517impl<'a, C> common::CallBuilder for BlobGetTreeCall<'a, C> {}
3518
3519impl<'a, C> BlobGetTreeCall<'a, C>
3520where
3521    C: common::Connector,
3522{
3523    /// Perform the operation you have build so far.
3524    pub async fn doit(
3525        mut self,
3526    ) -> common::Result<(common::Response, BuildBazelRemoteExecutionV2GetTreeResponse)> {
3527        use std::borrow::Cow;
3528        use std::io::{Read, Seek};
3529
3530        use common::{url::Params, ToParts};
3531        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3532
3533        let mut dd = common::DefaultDelegate;
3534        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3535        dlg.begin(common::MethodInfo {
3536            id: "remotebuildexecution.blobs.getTree",
3537            http_method: hyper::Method::GET,
3538        });
3539
3540        for &field in [
3541            "alt",
3542            "instanceName",
3543            "hash",
3544            "sizeBytes",
3545            "pageToken",
3546            "pageSize",
3547        ]
3548        .iter()
3549        {
3550            if self._additional_params.contains_key(field) {
3551                dlg.finished(false);
3552                return Err(common::Error::FieldClash(field));
3553            }
3554        }
3555
3556        let mut params = Params::with_capacity(7 + self._additional_params.len());
3557        params.push("instanceName", self._instance_name);
3558        params.push("hash", self._hash);
3559        params.push("sizeBytes", self._size_bytes.to_string());
3560        if let Some(value) = self._page_token.as_ref() {
3561            params.push("pageToken", value);
3562        }
3563        if let Some(value) = self._page_size.as_ref() {
3564            params.push("pageSize", value.to_string());
3565        }
3566
3567        params.extend(self._additional_params.iter());
3568
3569        params.push("alt", "json");
3570        let mut url =
3571            self.hub._base_url.clone() + "v2/{+instanceName}/blobs/{hash}/{sizeBytes}:getTree";
3572        if self._scopes.is_empty() {
3573            self._scopes
3574                .insert(Scope::CloudPlatform.as_ref().to_string());
3575        }
3576
3577        #[allow(clippy::single_element_loop)]
3578        for &(find_this, param_name) in [
3579            ("{+instanceName}", "instanceName"),
3580            ("{hash}", "hash"),
3581            ("{sizeBytes}", "sizeBytes"),
3582        ]
3583        .iter()
3584        {
3585            url = params.uri_replacement(url, param_name, find_this, true);
3586        }
3587        {
3588            let to_remove = ["sizeBytes", "hash", "instanceName"];
3589            params.remove_params(&to_remove);
3590        }
3591
3592        let url = params.parse_with_url(&url);
3593
3594        loop {
3595            let token = match self
3596                .hub
3597                .auth
3598                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3599                .await
3600            {
3601                Ok(token) => token,
3602                Err(e) => match dlg.token(e) {
3603                    Ok(token) => token,
3604                    Err(e) => {
3605                        dlg.finished(false);
3606                        return Err(common::Error::MissingToken(e));
3607                    }
3608                },
3609            };
3610            let mut req_result = {
3611                let client = &self.hub.client;
3612                dlg.pre_request();
3613                let mut req_builder = hyper::Request::builder()
3614                    .method(hyper::Method::GET)
3615                    .uri(url.as_str())
3616                    .header(USER_AGENT, self.hub._user_agent.clone());
3617
3618                if let Some(token) = token.as_ref() {
3619                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3620                }
3621
3622                let request = req_builder
3623                    .header(CONTENT_LENGTH, 0_u64)
3624                    .body(common::to_body::<String>(None));
3625
3626                client.request(request.unwrap()).await
3627            };
3628
3629            match req_result {
3630                Err(err) => {
3631                    if let common::Retry::After(d) = dlg.http_error(&err) {
3632                        sleep(d).await;
3633                        continue;
3634                    }
3635                    dlg.finished(false);
3636                    return Err(common::Error::HttpError(err));
3637                }
3638                Ok(res) => {
3639                    let (mut parts, body) = res.into_parts();
3640                    let mut body = common::Body::new(body);
3641                    if !parts.status.is_success() {
3642                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3643                        let error = serde_json::from_str(&common::to_string(&bytes));
3644                        let response = common::to_response(parts, bytes.into());
3645
3646                        if let common::Retry::After(d) =
3647                            dlg.http_failure(&response, error.as_ref().ok())
3648                        {
3649                            sleep(d).await;
3650                            continue;
3651                        }
3652
3653                        dlg.finished(false);
3654
3655                        return Err(match error {
3656                            Ok(value) => common::Error::BadRequest(value),
3657                            _ => common::Error::Failure(response),
3658                        });
3659                    }
3660                    let response = {
3661                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3662                        let encoded = common::to_string(&bytes);
3663                        match serde_json::from_str(&encoded) {
3664                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3665                            Err(error) => {
3666                                dlg.response_json_decode_error(&encoded, &error);
3667                                return Err(common::Error::JsonDecodeError(
3668                                    encoded.to_string(),
3669                                    error,
3670                                ));
3671                            }
3672                        }
3673                    };
3674
3675                    dlg.finished(true);
3676                    return Ok(response);
3677                }
3678            }
3679        }
3680    }
3681
3682    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
3683    ///
3684    /// Sets the *instance name* path property to the given value.
3685    ///
3686    /// Even though the property as already been set when instantiating this call,
3687    /// we provide this method for API completeness.
3688    pub fn instance_name(mut self, new_value: &str) -> BlobGetTreeCall<'a, C> {
3689        self._instance_name = new_value.to_string();
3690        self
3691    }
3692    /// The hash. In the case of SHA-256, it will always be a lowercase hex string exactly 64 characters long.
3693    ///
3694    /// Sets the *hash* path property to the given value.
3695    ///
3696    /// Even though the property as already been set when instantiating this call,
3697    /// we provide this method for API completeness.
3698    pub fn hash(mut self, new_value: &str) -> BlobGetTreeCall<'a, C> {
3699        self._hash = new_value.to_string();
3700        self
3701    }
3702    /// The size of the blob, in bytes.
3703    ///
3704    /// Sets the *size bytes* path property to the given value.
3705    ///
3706    /// Even though the property as already been set when instantiating this call,
3707    /// we provide this method for API completeness.
3708    pub fn size_bytes(mut self, new_value: i64) -> BlobGetTreeCall<'a, C> {
3709        self._size_bytes = new_value;
3710        self
3711    }
3712    /// A page token, which must be a value received in a previous GetTreeResponse. If present, the server will use that token as an offset, returning only that page and the ones that succeed it.
3713    ///
3714    /// Sets the *page token* query property to the given value.
3715    pub fn page_token(mut self, new_value: &str) -> BlobGetTreeCall<'a, C> {
3716        self._page_token = Some(new_value.to_string());
3717        self
3718    }
3719    /// A maximum page size to request. If present, the server will request no more than this many items. Regardless of whether a page size is specified, the server may place its own limit on the number of items to be returned and require the client to retrieve more items using a subsequent request.
3720    ///
3721    /// Sets the *page size* query property to the given value.
3722    pub fn page_size(mut self, new_value: i32) -> BlobGetTreeCall<'a, C> {
3723        self._page_size = Some(new_value);
3724        self
3725    }
3726    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3727    /// while executing the actual API request.
3728    ///
3729    /// ````text
3730    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3731    /// ````
3732    ///
3733    /// Sets the *delegate* property to the given value.
3734    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> BlobGetTreeCall<'a, C> {
3735        self._delegate = Some(new_value);
3736        self
3737    }
3738
3739    /// Set any additional parameter of the query string used in the request.
3740    /// It should be used to set parameters which are not yet available through their own
3741    /// setters.
3742    ///
3743    /// Please note that this method must not be used to set any of the known parameters
3744    /// which have their own setter method. If done anyway, the request will fail.
3745    ///
3746    /// # Additional Parameters
3747    ///
3748    /// * *$.xgafv* (query-string) - V1 error format.
3749    /// * *access_token* (query-string) - OAuth access token.
3750    /// * *alt* (query-string) - Data format for response.
3751    /// * *callback* (query-string) - JSONP
3752    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3753    /// * *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.
3754    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3755    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3756    /// * *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.
3757    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3758    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3759    pub fn param<T>(mut self, name: T, value: T) -> BlobGetTreeCall<'a, C>
3760    where
3761        T: AsRef<str>,
3762    {
3763        self._additional_params
3764            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3765        self
3766    }
3767
3768    /// Identifies the authorization scope for the method you are building.
3769    ///
3770    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3771    /// [`Scope::CloudPlatform`].
3772    ///
3773    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3774    /// tokens for more than one scope.
3775    ///
3776    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3777    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3778    /// sufficient, a read-write scope will do as well.
3779    pub fn add_scope<St>(mut self, scope: St) -> BlobGetTreeCall<'a, C>
3780    where
3781        St: AsRef<str>,
3782    {
3783        self._scopes.insert(String::from(scope.as_ref()));
3784        self
3785    }
3786    /// Identifies the authorization scope(s) for the method you are building.
3787    ///
3788    /// See [`Self::add_scope()`] for details.
3789    pub fn add_scopes<I, St>(mut self, scopes: I) -> BlobGetTreeCall<'a, C>
3790    where
3791        I: IntoIterator<Item = St>,
3792        St: AsRef<str>,
3793    {
3794        self._scopes
3795            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3796        self
3797    }
3798
3799    /// Removes all scopes, and no default scope will be used either.
3800    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3801    /// for details).
3802    pub fn clear_scopes(mut self) -> BlobGetTreeCall<'a, C> {
3803        self._scopes.clear();
3804        self
3805    }
3806}
3807
3808/// Wait for an execution operation to complete. When the client initially makes the request, the server immediately responds with the current status of the execution. The server will leave the request stream open until the operation completes, and then respond with the completed operation. The server MAY choose to stream additional updates as execution progresses, such as to provide an update as to the state of the execution.
3809///
3810/// A builder for the *waitExecution* method supported by a *operation* resource.
3811/// It is not used directly, but through a [`OperationMethods`] instance.
3812///
3813/// # Example
3814///
3815/// Instantiate a resource method builder
3816///
3817/// ```test_harness,no_run
3818/// # extern crate hyper;
3819/// # extern crate hyper_rustls;
3820/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
3821/// use remotebuildexecution2::api::BuildBazelRemoteExecutionV2WaitExecutionRequest;
3822/// # async fn dox() {
3823/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3824///
3825/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3826/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3827/// #     secret,
3828/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3829/// # ).build().await.unwrap();
3830///
3831/// # let client = hyper_util::client::legacy::Client::builder(
3832/// #     hyper_util::rt::TokioExecutor::new()
3833/// # )
3834/// # .build(
3835/// #     hyper_rustls::HttpsConnectorBuilder::new()
3836/// #         .with_native_roots()
3837/// #         .unwrap()
3838/// #         .https_or_http()
3839/// #         .enable_http1()
3840/// #         .build()
3841/// # );
3842/// # let mut hub = RemoteBuildExecution::new(client, auth);
3843/// // As the method needs a request, you would usually fill it with the desired information
3844/// // into the respective structure. Some of the parts shown here might not be applicable !
3845/// // Values shown here are possibly random and not representative !
3846/// let mut req = BuildBazelRemoteExecutionV2WaitExecutionRequest::default();
3847///
3848/// // You can configure optional parameters by calling the respective setters at will, and
3849/// // execute the final call using `doit()`.
3850/// // Values shown here are possibly random and not representative !
3851/// let result = hub.operations().wait_execution(req, "name")
3852///              .doit().await;
3853/// # }
3854/// ```
3855pub struct OperationWaitExecutionCall<'a, C>
3856where
3857    C: 'a,
3858{
3859    hub: &'a RemoteBuildExecution<C>,
3860    _request: BuildBazelRemoteExecutionV2WaitExecutionRequest,
3861    _name: String,
3862    _delegate: Option<&'a mut dyn common::Delegate>,
3863    _additional_params: HashMap<String, String>,
3864    _scopes: BTreeSet<String>,
3865}
3866
3867impl<'a, C> common::CallBuilder for OperationWaitExecutionCall<'a, C> {}
3868
3869impl<'a, C> OperationWaitExecutionCall<'a, C>
3870where
3871    C: common::Connector,
3872{
3873    /// Perform the operation you have build so far.
3874    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
3875        use std::borrow::Cow;
3876        use std::io::{Read, Seek};
3877
3878        use common::{url::Params, ToParts};
3879        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3880
3881        let mut dd = common::DefaultDelegate;
3882        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3883        dlg.begin(common::MethodInfo {
3884            id: "remotebuildexecution.operations.waitExecution",
3885            http_method: hyper::Method::POST,
3886        });
3887
3888        for &field in ["alt", "name"].iter() {
3889            if self._additional_params.contains_key(field) {
3890                dlg.finished(false);
3891                return Err(common::Error::FieldClash(field));
3892            }
3893        }
3894
3895        let mut params = Params::with_capacity(4 + self._additional_params.len());
3896        params.push("name", self._name);
3897
3898        params.extend(self._additional_params.iter());
3899
3900        params.push("alt", "json");
3901        let mut url = self.hub._base_url.clone() + "v2/{+name}:waitExecution";
3902        if self._scopes.is_empty() {
3903            self._scopes
3904                .insert(Scope::CloudPlatform.as_ref().to_string());
3905        }
3906
3907        #[allow(clippy::single_element_loop)]
3908        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3909            url = params.uri_replacement(url, param_name, find_this, true);
3910        }
3911        {
3912            let to_remove = ["name"];
3913            params.remove_params(&to_remove);
3914        }
3915
3916        let url = params.parse_with_url(&url);
3917
3918        let mut json_mime_type = mime::APPLICATION_JSON;
3919        let mut request_value_reader = {
3920            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3921            common::remove_json_null_values(&mut value);
3922            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3923            serde_json::to_writer(&mut dst, &value).unwrap();
3924            dst
3925        };
3926        let request_size = request_value_reader
3927            .seek(std::io::SeekFrom::End(0))
3928            .unwrap();
3929        request_value_reader
3930            .seek(std::io::SeekFrom::Start(0))
3931            .unwrap();
3932
3933        loop {
3934            let token = match self
3935                .hub
3936                .auth
3937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3938                .await
3939            {
3940                Ok(token) => token,
3941                Err(e) => match dlg.token(e) {
3942                    Ok(token) => token,
3943                    Err(e) => {
3944                        dlg.finished(false);
3945                        return Err(common::Error::MissingToken(e));
3946                    }
3947                },
3948            };
3949            request_value_reader
3950                .seek(std::io::SeekFrom::Start(0))
3951                .unwrap();
3952            let mut req_result = {
3953                let client = &self.hub.client;
3954                dlg.pre_request();
3955                let mut req_builder = hyper::Request::builder()
3956                    .method(hyper::Method::POST)
3957                    .uri(url.as_str())
3958                    .header(USER_AGENT, self.hub._user_agent.clone());
3959
3960                if let Some(token) = token.as_ref() {
3961                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3962                }
3963
3964                let request = req_builder
3965                    .header(CONTENT_TYPE, json_mime_type.to_string())
3966                    .header(CONTENT_LENGTH, request_size as u64)
3967                    .body(common::to_body(
3968                        request_value_reader.get_ref().clone().into(),
3969                    ));
3970
3971                client.request(request.unwrap()).await
3972            };
3973
3974            match req_result {
3975                Err(err) => {
3976                    if let common::Retry::After(d) = dlg.http_error(&err) {
3977                        sleep(d).await;
3978                        continue;
3979                    }
3980                    dlg.finished(false);
3981                    return Err(common::Error::HttpError(err));
3982                }
3983                Ok(res) => {
3984                    let (mut parts, body) = res.into_parts();
3985                    let mut body = common::Body::new(body);
3986                    if !parts.status.is_success() {
3987                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3988                        let error = serde_json::from_str(&common::to_string(&bytes));
3989                        let response = common::to_response(parts, bytes.into());
3990
3991                        if let common::Retry::After(d) =
3992                            dlg.http_failure(&response, error.as_ref().ok())
3993                        {
3994                            sleep(d).await;
3995                            continue;
3996                        }
3997
3998                        dlg.finished(false);
3999
4000                        return Err(match error {
4001                            Ok(value) => common::Error::BadRequest(value),
4002                            _ => common::Error::Failure(response),
4003                        });
4004                    }
4005                    let response = {
4006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4007                        let encoded = common::to_string(&bytes);
4008                        match serde_json::from_str(&encoded) {
4009                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4010                            Err(error) => {
4011                                dlg.response_json_decode_error(&encoded, &error);
4012                                return Err(common::Error::JsonDecodeError(
4013                                    encoded.to_string(),
4014                                    error,
4015                                ));
4016                            }
4017                        }
4018                    };
4019
4020                    dlg.finished(true);
4021                    return Ok(response);
4022                }
4023            }
4024        }
4025    }
4026
4027    ///
4028    /// Sets the *request* property to the given value.
4029    ///
4030    /// Even though the property as already been set when instantiating this call,
4031    /// we provide this method for API completeness.
4032    pub fn request(
4033        mut self,
4034        new_value: BuildBazelRemoteExecutionV2WaitExecutionRequest,
4035    ) -> OperationWaitExecutionCall<'a, C> {
4036        self._request = new_value;
4037        self
4038    }
4039    /// The name of the Operation returned by Execute.
4040    ///
4041    /// Sets the *name* path property to the given value.
4042    ///
4043    /// Even though the property as already been set when instantiating this call,
4044    /// we provide this method for API completeness.
4045    pub fn name(mut self, new_value: &str) -> OperationWaitExecutionCall<'a, C> {
4046        self._name = new_value.to_string();
4047        self
4048    }
4049    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4050    /// while executing the actual API request.
4051    ///
4052    /// ````text
4053    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4054    /// ````
4055    ///
4056    /// Sets the *delegate* property to the given value.
4057    pub fn delegate(
4058        mut self,
4059        new_value: &'a mut dyn common::Delegate,
4060    ) -> OperationWaitExecutionCall<'a, C> {
4061        self._delegate = Some(new_value);
4062        self
4063    }
4064
4065    /// Set any additional parameter of the query string used in the request.
4066    /// It should be used to set parameters which are not yet available through their own
4067    /// setters.
4068    ///
4069    /// Please note that this method must not be used to set any of the known parameters
4070    /// which have their own setter method. If done anyway, the request will fail.
4071    ///
4072    /// # Additional Parameters
4073    ///
4074    /// * *$.xgafv* (query-string) - V1 error format.
4075    /// * *access_token* (query-string) - OAuth access token.
4076    /// * *alt* (query-string) - Data format for response.
4077    /// * *callback* (query-string) - JSONP
4078    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4079    /// * *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.
4080    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4081    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4082    /// * *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.
4083    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4084    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4085    pub fn param<T>(mut self, name: T, value: T) -> OperationWaitExecutionCall<'a, C>
4086    where
4087        T: AsRef<str>,
4088    {
4089        self._additional_params
4090            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4091        self
4092    }
4093
4094    /// Identifies the authorization scope for the method you are building.
4095    ///
4096    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4097    /// [`Scope::CloudPlatform`].
4098    ///
4099    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4100    /// tokens for more than one scope.
4101    ///
4102    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4103    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4104    /// sufficient, a read-write scope will do as well.
4105    pub fn add_scope<St>(mut self, scope: St) -> OperationWaitExecutionCall<'a, C>
4106    where
4107        St: AsRef<str>,
4108    {
4109        self._scopes.insert(String::from(scope.as_ref()));
4110        self
4111    }
4112    /// Identifies the authorization scope(s) for the method you are building.
4113    ///
4114    /// See [`Self::add_scope()`] for details.
4115    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationWaitExecutionCall<'a, C>
4116    where
4117        I: IntoIterator<Item = St>,
4118        St: AsRef<str>,
4119    {
4120        self._scopes
4121            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4122        self
4123    }
4124
4125    /// Removes all scopes, and no default scope will be used either.
4126    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4127    /// for details).
4128    pub fn clear_scopes(mut self) -> OperationWaitExecutionCall<'a, C> {
4129        self._scopes.clear();
4130        self
4131    }
4132}
4133
4134/// GetCapabilities returns the server capabilities configuration of the remote endpoint. Only the capabilities of the services supported by the endpoint will be returned: * Execution + CAS + Action Cache endpoints should return both CacheCapabilities and ExecutionCapabilities. * Execution only endpoints should return ExecutionCapabilities. * CAS + Action Cache only endpoints should return CacheCapabilities.
4135///
4136/// A builder for the *getCapabilities* method.
4137/// It is not used directly, but through a [`MethodMethods`] instance.
4138///
4139/// # Example
4140///
4141/// Instantiate a resource method builder
4142///
4143/// ```test_harness,no_run
4144/// # extern crate hyper;
4145/// # extern crate hyper_rustls;
4146/// # extern crate google_remotebuildexecution2 as remotebuildexecution2;
4147/// # async fn dox() {
4148/// # use remotebuildexecution2::{RemoteBuildExecution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4149///
4150/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4151/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4152/// #     secret,
4153/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4154/// # ).build().await.unwrap();
4155///
4156/// # let client = hyper_util::client::legacy::Client::builder(
4157/// #     hyper_util::rt::TokioExecutor::new()
4158/// # )
4159/// # .build(
4160/// #     hyper_rustls::HttpsConnectorBuilder::new()
4161/// #         .with_native_roots()
4162/// #         .unwrap()
4163/// #         .https_or_http()
4164/// #         .enable_http1()
4165/// #         .build()
4166/// # );
4167/// # let mut hub = RemoteBuildExecution::new(client, auth);
4168/// // You can configure optional parameters by calling the respective setters at will, and
4169/// // execute the final call using `doit()`.
4170/// // Values shown here are possibly random and not representative !
4171/// let result = hub.methods().get_capabilities("instanceName")
4172///              .doit().await;
4173/// # }
4174/// ```
4175pub struct MethodGetCapabilityCall<'a, C>
4176where
4177    C: 'a,
4178{
4179    hub: &'a RemoteBuildExecution<C>,
4180    _instance_name: String,
4181    _delegate: Option<&'a mut dyn common::Delegate>,
4182    _additional_params: HashMap<String, String>,
4183    _scopes: BTreeSet<String>,
4184}
4185
4186impl<'a, C> common::CallBuilder for MethodGetCapabilityCall<'a, C> {}
4187
4188impl<'a, C> MethodGetCapabilityCall<'a, C>
4189where
4190    C: common::Connector,
4191{
4192    /// Perform the operation you have build so far.
4193    pub async fn doit(
4194        mut self,
4195    ) -> common::Result<(
4196        common::Response,
4197        BuildBazelRemoteExecutionV2ServerCapabilities,
4198    )> {
4199        use std::borrow::Cow;
4200        use std::io::{Read, Seek};
4201
4202        use common::{url::Params, ToParts};
4203        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4204
4205        let mut dd = common::DefaultDelegate;
4206        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4207        dlg.begin(common::MethodInfo {
4208            id: "remotebuildexecution.getCapabilities",
4209            http_method: hyper::Method::GET,
4210        });
4211
4212        for &field in ["alt", "instanceName"].iter() {
4213            if self._additional_params.contains_key(field) {
4214                dlg.finished(false);
4215                return Err(common::Error::FieldClash(field));
4216            }
4217        }
4218
4219        let mut params = Params::with_capacity(3 + self._additional_params.len());
4220        params.push("instanceName", self._instance_name);
4221
4222        params.extend(self._additional_params.iter());
4223
4224        params.push("alt", "json");
4225        let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/capabilities";
4226        if self._scopes.is_empty() {
4227            self._scopes
4228                .insert(Scope::CloudPlatform.as_ref().to_string());
4229        }
4230
4231        #[allow(clippy::single_element_loop)]
4232        for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() {
4233            url = params.uri_replacement(url, param_name, find_this, true);
4234        }
4235        {
4236            let to_remove = ["instanceName"];
4237            params.remove_params(&to_remove);
4238        }
4239
4240        let url = params.parse_with_url(&url);
4241
4242        loop {
4243            let token = match self
4244                .hub
4245                .auth
4246                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4247                .await
4248            {
4249                Ok(token) => token,
4250                Err(e) => match dlg.token(e) {
4251                    Ok(token) => token,
4252                    Err(e) => {
4253                        dlg.finished(false);
4254                        return Err(common::Error::MissingToken(e));
4255                    }
4256                },
4257            };
4258            let mut req_result = {
4259                let client = &self.hub.client;
4260                dlg.pre_request();
4261                let mut req_builder = hyper::Request::builder()
4262                    .method(hyper::Method::GET)
4263                    .uri(url.as_str())
4264                    .header(USER_AGENT, self.hub._user_agent.clone());
4265
4266                if let Some(token) = token.as_ref() {
4267                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4268                }
4269
4270                let request = req_builder
4271                    .header(CONTENT_LENGTH, 0_u64)
4272                    .body(common::to_body::<String>(None));
4273
4274                client.request(request.unwrap()).await
4275            };
4276
4277            match req_result {
4278                Err(err) => {
4279                    if let common::Retry::After(d) = dlg.http_error(&err) {
4280                        sleep(d).await;
4281                        continue;
4282                    }
4283                    dlg.finished(false);
4284                    return Err(common::Error::HttpError(err));
4285                }
4286                Ok(res) => {
4287                    let (mut parts, body) = res.into_parts();
4288                    let mut body = common::Body::new(body);
4289                    if !parts.status.is_success() {
4290                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4291                        let error = serde_json::from_str(&common::to_string(&bytes));
4292                        let response = common::to_response(parts, bytes.into());
4293
4294                        if let common::Retry::After(d) =
4295                            dlg.http_failure(&response, error.as_ref().ok())
4296                        {
4297                            sleep(d).await;
4298                            continue;
4299                        }
4300
4301                        dlg.finished(false);
4302
4303                        return Err(match error {
4304                            Ok(value) => common::Error::BadRequest(value),
4305                            _ => common::Error::Failure(response),
4306                        });
4307                    }
4308                    let response = {
4309                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4310                        let encoded = common::to_string(&bytes);
4311                        match serde_json::from_str(&encoded) {
4312                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4313                            Err(error) => {
4314                                dlg.response_json_decode_error(&encoded, &error);
4315                                return Err(common::Error::JsonDecodeError(
4316                                    encoded.to_string(),
4317                                    error,
4318                                ));
4319                            }
4320                        }
4321                    };
4322
4323                    dlg.finished(true);
4324                    return Ok(response);
4325                }
4326            }
4327        }
4328    }
4329
4330    /// The instance of the execution system to operate against. A server may support multiple instances of the execution system (with their own workers, storage, caches, etc.). The server MAY require use of this field to select between them in an implementation-defined fashion, otherwise it can be omitted.
4331    ///
4332    /// Sets the *instance name* path property to the given value.
4333    ///
4334    /// Even though the property as already been set when instantiating this call,
4335    /// we provide this method for API completeness.
4336    pub fn instance_name(mut self, new_value: &str) -> MethodGetCapabilityCall<'a, C> {
4337        self._instance_name = new_value.to_string();
4338        self
4339    }
4340    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4341    /// while executing the actual API request.
4342    ///
4343    /// ````text
4344    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4345    /// ````
4346    ///
4347    /// Sets the *delegate* property to the given value.
4348    pub fn delegate(
4349        mut self,
4350        new_value: &'a mut dyn common::Delegate,
4351    ) -> MethodGetCapabilityCall<'a, C> {
4352        self._delegate = Some(new_value);
4353        self
4354    }
4355
4356    /// Set any additional parameter of the query string used in the request.
4357    /// It should be used to set parameters which are not yet available through their own
4358    /// setters.
4359    ///
4360    /// Please note that this method must not be used to set any of the known parameters
4361    /// which have their own setter method. If done anyway, the request will fail.
4362    ///
4363    /// # Additional Parameters
4364    ///
4365    /// * *$.xgafv* (query-string) - V1 error format.
4366    /// * *access_token* (query-string) - OAuth access token.
4367    /// * *alt* (query-string) - Data format for response.
4368    /// * *callback* (query-string) - JSONP
4369    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4370    /// * *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.
4371    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4372    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4373    /// * *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.
4374    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4375    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4376    pub fn param<T>(mut self, name: T, value: T) -> MethodGetCapabilityCall<'a, C>
4377    where
4378        T: AsRef<str>,
4379    {
4380        self._additional_params
4381            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4382        self
4383    }
4384
4385    /// Identifies the authorization scope for the method you are building.
4386    ///
4387    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4388    /// [`Scope::CloudPlatform`].
4389    ///
4390    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4391    /// tokens for more than one scope.
4392    ///
4393    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4394    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4395    /// sufficient, a read-write scope will do as well.
4396    pub fn add_scope<St>(mut self, scope: St) -> MethodGetCapabilityCall<'a, C>
4397    where
4398        St: AsRef<str>,
4399    {
4400        self._scopes.insert(String::from(scope.as_ref()));
4401        self
4402    }
4403    /// Identifies the authorization scope(s) for the method you are building.
4404    ///
4405    /// See [`Self::add_scope()`] for details.
4406    pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodGetCapabilityCall<'a, C>
4407    where
4408        I: IntoIterator<Item = St>,
4409        St: AsRef<str>,
4410    {
4411        self._scopes
4412            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4413        self
4414    }
4415
4416    /// Removes all scopes, and no default scope will be used either.
4417    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4418    /// for details).
4419    pub fn clear_scopes(mut self) -> MethodGetCapabilityCall<'a, C> {
4420        self._scopes.clear();
4421        self
4422    }
4423}