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