google_artifactregistry1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18
19    /// View your data across Google Cloud services and see the email address of your Google Account
20    CloudPlatformReadOnly,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27            Scope::CloudPlatformReadOnly => {
28                "https://www.googleapis.com/auth/cloud-platform.read-only"
29            }
30        }
31    }
32}
33
34#[allow(clippy::derivable_impls)]
35impl Default for Scope {
36    fn default() -> Scope {
37        Scope::CloudPlatform
38    }
39}
40
41// ########
42// HUB ###
43// ######
44
45/// Central instance to access all ArtifactRegistry related resource activities
46///
47/// # Examples
48///
49/// Instantiate a new hub
50///
51/// ```test_harness,no_run
52/// extern crate hyper;
53/// extern crate hyper_rustls;
54/// extern crate google_artifactregistry1 as artifactregistry1;
55/// use artifactregistry1::api::Attachment;
56/// use artifactregistry1::{Result, Error};
57/// # async fn dox() {
58/// use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59///
60/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
61/// // `client_secret`, among other things.
62/// let secret: yup_oauth2::ApplicationSecret = Default::default();
63/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
64/// // unless you replace  `None` with the desired Flow.
65/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
66/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
67/// // retrieve them from storage.
68/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
69///     .with_native_roots()
70///     .unwrap()
71///     .https_only()
72///     .enable_http2()
73///     .build();
74///
75/// let executor = hyper_util::rt::TokioExecutor::new();
76/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
77///     secret,
78///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79///     yup_oauth2::client::CustomHyperClientBuilder::from(
80///         hyper_util::client::legacy::Client::builder(executor).build(connector),
81///     ),
82/// ).build().await.unwrap();
83///
84/// let client = hyper_util::client::legacy::Client::builder(
85///     hyper_util::rt::TokioExecutor::new()
86/// )
87/// .build(
88///     hyper_rustls::HttpsConnectorBuilder::new()
89///         .with_native_roots()
90///         .unwrap()
91///         .https_or_http()
92///         .enable_http2()
93///         .build()
94/// );
95/// let mut hub = ArtifactRegistry::new(client, auth);
96/// // As the method needs a request, you would usually fill it with the desired information
97/// // into the respective structure. Some of the parts shown here might not be applicable !
98/// // Values shown here are possibly random and not representative !
99/// let mut req = Attachment::default();
100///
101/// // You can configure optional parameters by calling the respective setters at will, and
102/// // execute the final call using `doit()`.
103/// // Values shown here are possibly random and not representative !
104/// let result = hub.projects().locations_repositories_attachments_create(req, "parent")
105///              .attachment_id("At")
106///              .doit().await;
107///
108/// match result {
109///     Err(e) => match e {
110///         // The Error enum provides details about what exactly happened.
111///         // You can also just use its `Debug`, `Display` or `Error` traits
112///          Error::HttpError(_)
113///         |Error::Io(_)
114///         |Error::MissingAPIKey
115///         |Error::MissingToken(_)
116///         |Error::Cancelled
117///         |Error::UploadSizeLimitExceeded(_, _)
118///         |Error::Failure(_)
119///         |Error::BadRequest(_)
120///         |Error::FieldClash(_)
121///         |Error::JsonDecodeError(_, _) => println!("{}", e),
122///     },
123///     Ok(res) => println!("Success: {:?}", res),
124/// }
125/// # }
126/// ```
127#[derive(Clone)]
128pub struct ArtifactRegistry<C> {
129    pub client: common::Client<C>,
130    pub auth: Box<dyn common::GetToken>,
131    _user_agent: String,
132    _base_url: String,
133    _root_url: String,
134}
135
136impl<C> common::Hub for ArtifactRegistry<C> {}
137
138impl<'a, C> ArtifactRegistry<C> {
139    pub fn new<A: 'static + common::GetToken>(
140        client: common::Client<C>,
141        auth: A,
142    ) -> ArtifactRegistry<C> {
143        ArtifactRegistry {
144            client,
145            auth: Box::new(auth),
146            _user_agent: "google-api-rust-client/7.0.0".to_string(),
147            _base_url: "https://artifactregistry.googleapis.com/".to_string(),
148            _root_url: "https://artifactregistry.googleapis.com/".to_string(),
149        }
150    }
151
152    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
153        ProjectMethods { hub: self }
154    }
155
156    /// Set the user-agent header field to use in all requests to the server.
157    /// It defaults to `google-api-rust-client/7.0.0`.
158    ///
159    /// Returns the previously set user-agent.
160    pub fn user_agent(&mut self, agent_name: String) -> String {
161        std::mem::replace(&mut self._user_agent, agent_name)
162    }
163
164    /// Set the base url to use in all requests to the server.
165    /// It defaults to `https://artifactregistry.googleapis.com/`.
166    ///
167    /// Returns the previously set base url.
168    pub fn base_url(&mut self, new_base_url: String) -> String {
169        std::mem::replace(&mut self._base_url, new_base_url)
170    }
171
172    /// Set the root url to use in all requests to the server.
173    /// It defaults to `https://artifactregistry.googleapis.com/`.
174    ///
175    /// Returns the previously set root url.
176    pub fn root_url(&mut self, new_root_url: String) -> String {
177        std::mem::replace(&mut self._root_url, new_root_url)
178    }
179}
180
181// ############
182// SCHEMAS ###
183// ##########
184/// Configuration for an Apt remote repository.
185///
186/// This type is not used in any activity, and only used as *part* of another schema.
187///
188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
189#[serde_with::serde_as]
190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
191pub struct AptRepository {
192    /// Customer-specified remote repository.
193    #[serde(rename = "customRepository")]
194    pub custom_repository:
195        Option<GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryCustomRepository>,
196    /// One of the publicly available Apt repositories supported by Artifact Registry.
197    #[serde(rename = "publicRepository")]
198    pub public_repository:
199        Option<GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryPublicRepository>,
200}
201
202impl common::Part for AptRepository {}
203
204/// An Attachment refers to additional metadata that can be attached to artifacts in Artifact Registry. An attachment consists of one or more files.
205///
206/// # Activities
207///
208/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
209/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
210///
211/// * [locations repositories attachments create projects](ProjectLocationRepositoryAttachmentCreateCall) (request)
212/// * [locations repositories attachments get projects](ProjectLocationRepositoryAttachmentGetCall) (response)
213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
214#[serde_with::serde_as]
215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
216pub struct Attachment {
217    /// Optional. User annotations. These attributes can only be set and used by the user, and not by Artifact Registry. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
218    pub annotations: Option<HashMap<String, String>>,
219    /// The namespace this attachment belongs to. E.g. If an attachment is created by artifact analysis, namespace is set to `artifactanalysis.googleapis.com`.
220    #[serde(rename = "attachmentNamespace")]
221    pub attachment_namespace: Option<String>,
222    /// Output only. The time when the attachment was created.
223    #[serde(rename = "createTime")]
224    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
225    /// Required. The files that belong to this attachment. If the file ID part contains slashes, they are escaped. E.g. `projects/p1/locations/us-central1/repositories/repo1/files/sha:`.
226    pub files: Option<Vec<String>>,
227    /// The name of the attachment. E.g. `projects/p1/locations/us/repositories/repo/attachments/sbom`.
228    pub name: Option<String>,
229    /// Output only. The name of the OCI version that this attachment created. Only populated for Docker attachments. E.g. `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
230    #[serde(rename = "ociVersionName")]
231    pub oci_version_name: Option<String>,
232    /// Required. The target the attachment is for, can be a Version, Package or Repository. E.g. `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
233    pub target: Option<String>,
234    /// Type of attachment. E.g. `application/vnd.spdx+json`
235    #[serde(rename = "type")]
236    pub type_: Option<String>,
237    /// Output only. The time when the attachment was last updated.
238    #[serde(rename = "updateTime")]
239    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
240}
241
242impl common::RequestValue for Attachment {}
243impl common::ResponseResult for Attachment {}
244
245/// The request to delete multiple versions across a repository.
246///
247/// # Activities
248///
249/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
250/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
251///
252/// * [locations repositories packages versions batch delete projects](ProjectLocationRepositoryPackageVersionBatchDeleteCall) (request)
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct BatchDeleteVersionsRequest {
257    /// Required. The names of the versions to delete. The maximum number of versions deleted per batch is determined by the service and is dependent on the available resources in the region.
258    pub names: Option<Vec<String>>,
259    /// If true, the request is performed without deleting data, following AIP-163.
260    #[serde(rename = "validateOnly")]
261    pub validate_only: Option<bool>,
262}
263
264impl common::RequestValue for BatchDeleteVersionsRequest {}
265
266/// Associates `members`, or principals, with a `role`.
267///
268/// This type is not used in any activity, and only used as *part* of another schema.
269///
270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
271#[serde_with::serde_as]
272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
273pub struct Binding {
274    /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
275    pub condition: Option<Expr>,
276    /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
277    pub members: Option<Vec<String>>,
278    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
279    pub role: Option<String>,
280}
281
282impl common::Part for Binding {}
283
284/// Artifact policy configuration for repository cleanup policies.
285///
286/// This type is not used in any activity, and only used as *part* of another schema.
287///
288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
289#[serde_with::serde_as]
290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
291pub struct CleanupPolicy {
292    /// Policy action.
293    pub action: Option<String>,
294    /// Policy condition for matching versions.
295    pub condition: Option<CleanupPolicyCondition>,
296    /// The user-provided ID of the cleanup policy.
297    pub id: Option<String>,
298    /// Policy condition for retaining a minimum number of versions. May only be specified with a Keep action.
299    #[serde(rename = "mostRecentVersions")]
300    pub most_recent_versions: Option<CleanupPolicyMostRecentVersions>,
301}
302
303impl common::Part for CleanupPolicy {}
304
305/// CleanupPolicyCondition is a set of conditions attached to a CleanupPolicy. If multiple entries are set, all must be satisfied for the condition to be satisfied.
306///
307/// This type is not used in any activity, and only used as *part* of another schema.
308///
309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
310#[serde_with::serde_as]
311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
312pub struct CleanupPolicyCondition {
313    /// Match versions newer than a duration.
314    #[serde(rename = "newerThan")]
315    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
316    pub newer_than: Option<chrono::Duration>,
317    /// Match versions older than a duration.
318    #[serde(rename = "olderThan")]
319    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
320    pub older_than: Option<chrono::Duration>,
321    /// Match versions by package prefix. Applied on any prefix match.
322    #[serde(rename = "packageNamePrefixes")]
323    pub package_name_prefixes: Option<Vec<String>>,
324    /// Match versions by tag prefix. Applied on any prefix match.
325    #[serde(rename = "tagPrefixes")]
326    pub tag_prefixes: Option<Vec<String>>,
327    /// Match versions by tag status.
328    #[serde(rename = "tagState")]
329    pub tag_state: Option<String>,
330    /// Match versions by version name prefix. Applied on any prefix match.
331    #[serde(rename = "versionNamePrefixes")]
332    pub version_name_prefixes: Option<Vec<String>>,
333}
334
335impl common::Part for CleanupPolicyCondition {}
336
337/// CleanupPolicyMostRecentVersions is an alternate condition of a CleanupPolicy for retaining a minimum number of versions.
338///
339/// This type is not used in any activity, and only used as *part* of another schema.
340///
341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
342#[serde_with::serde_as]
343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
344pub struct CleanupPolicyMostRecentVersions {
345    /// Minimum number of versions to keep.
346    #[serde(rename = "keepCount")]
347    pub keep_count: Option<i32>,
348    /// List of package name prefixes that will apply this rule.
349    #[serde(rename = "packageNamePrefixes")]
350    pub package_name_prefixes: Option<Vec<String>>,
351}
352
353impl common::Part for CleanupPolicyMostRecentVersions {}
354
355/// Common remote repository settings type.
356///
357/// This type is not used in any activity, and only used as *part* of another schema.
358///
359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
360#[serde_with::serde_as]
361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
362pub struct CommonRemoteRepository {
363    /// Required. A common public repository base for remote repository.
364    pub uri: Option<String>,
365}
366
367impl common::Part for CommonRemoteRepository {}
368
369/// DockerImage represents a docker artifact. The following fields are returned as untyped metadata in the Version resource, using camelcase keys (i.e. metadata.imageSizeBytes): * imageSizeBytes * mediaType * buildTime
370///
371/// # Activities
372///
373/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
374/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
375///
376/// * [locations repositories docker images get projects](ProjectLocationRepositoryDockerImageGetCall) (response)
377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
378#[serde_with::serde_as]
379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
380pub struct DockerImage {
381    /// ArtifactType of this image, e.g. "application/vnd.example+type". If the `subject_digest` is set and no `artifact_type` is given, the `media_type` will be considered as the `artifact_type`. This field is returned as the `metadata.artifactType` field in the Version resource.
382    #[serde(rename = "artifactType")]
383    pub artifact_type: Option<String>,
384    /// The time this image was built. This field is returned as the 'metadata.buildTime' field in the Version resource. The build time is returned to the client as an RFC 3339 string, which can be easily used with the JavaScript Date constructor.
385    #[serde(rename = "buildTime")]
386    pub build_time: Option<chrono::DateTime<chrono::offset::Utc>>,
387    /// Optional. For multi-arch images (manifest lists), this field contains the list of image manifests.
388    #[serde(rename = "imageManifests")]
389    pub image_manifests: Option<Vec<ImageManifest>>,
390    /// Calculated size of the image. This field is returned as the 'metadata.imageSizeBytes' field in the Version resource.
391    #[serde(rename = "imageSizeBytes")]
392    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
393    pub image_size_bytes: Option<i64>,
394    /// Media type of this image, e.g. "application/vnd.docker.distribution.manifest.v2+json". This field is returned as the 'metadata.mediaType' field in the Version resource.
395    #[serde(rename = "mediaType")]
396    pub media_type: Option<String>,
397    /// Required. registry_location, project_id, repository_name and image id forms a unique image name:`projects//locations//repositories//dockerImages/`. For example, "projects/test-project/locations/us-west4/repositories/test-repo/dockerImages/ nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf", where "us-west4" is the registry_location, "test-project" is the project_id, "test-repo" is the repository_name and "nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf" is the image's digest.
398    pub name: Option<String>,
399    /// Tags attached to this image.
400    pub tags: Option<Vec<String>>,
401    /// Output only. The time when the docker image was last updated.
402    #[serde(rename = "updateTime")]
403    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
404    /// Time the image was uploaded.
405    #[serde(rename = "uploadTime")]
406    pub upload_time: Option<chrono::DateTime<chrono::offset::Utc>>,
407    /// Required. URL to access the image. Example: us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf
408    pub uri: Option<String>,
409}
410
411impl common::ResponseResult for DockerImage {}
412
413/// Configuration for a Docker remote repository.
414///
415/// This type is not used in any activity, and only used as *part* of another schema.
416///
417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
418#[serde_with::serde_as]
419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
420pub struct DockerRepository {
421    /// Customer-specified remote repository.
422    #[serde(rename = "customRepository")]
423    pub custom_repository: Option<
424        GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigDockerRepositoryCustomRepository,
425    >,
426    /// One of the publicly available Docker repositories supported by Artifact Registry.
427    #[serde(rename = "publicRepository")]
428    pub public_repository: Option<String>,
429}
430
431impl common::Part for DockerRepository {}
432
433/// DockerRepositoryConfig is docker related repository details. Provides additional configuration details for repositories of the docker format type.
434///
435/// This type is not used in any activity, and only used as *part* of another schema.
436///
437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
438#[serde_with::serde_as]
439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
440pub struct DockerRepositoryConfig {
441    /// The repository which enabled this flag prevents all tags from being modified, moved or deleted. This does not prevent tags from being created.
442    #[serde(rename = "immutableTags")]
443    pub immutable_tags: Option<bool>,
444}
445
446impl common::Part for DockerRepositoryConfig {}
447
448/// The response to download a file.
449///
450/// # Activities
451///
452/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
453/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
454///
455/// * [locations repositories files download projects](ProjectLocationRepositoryFileDownloadCall) (response)
456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
457#[serde_with::serde_as]
458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
459pub struct DownloadFileResponse {
460    _never_set: Option<bool>,
461}
462
463impl common::ResponseResult for DownloadFileResponse {}
464
465/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
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/// * [locations repositories packages tags delete projects](ProjectLocationRepositoryPackageTagDeleteCall) (response)
473/// * [locations repositories rules delete projects](ProjectLocationRepositoryRuleDeleteCall) (response)
474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
475#[serde_with::serde_as]
476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
477pub struct Empty {
478    _never_set: Option<bool>,
479}
480
481impl common::ResponseResult for Empty {}
482
483/// The request for exporting an artifact to a destination.
484///
485/// # Activities
486///
487/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
488/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
489///
490/// * [locations repositories export artifact projects](ProjectLocationRepositoryExportArtifactCall) (request)
491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
492#[serde_with::serde_as]
493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
494pub struct ExportArtifactRequest {
495    /// The Cloud Storage path to export the artifact to. Should start with the bucket name, and optionally have a directory path. Examples: `dst_bucket`, `dst_bucket/sub_dir`. Existing objects with the same path will be overwritten.
496    #[serde(rename = "gcsPath")]
497    pub gcs_path: Option<String>,
498    /// The artifact tag to export. Format:projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}
499    #[serde(rename = "sourceTag")]
500    pub source_tag: Option<String>,
501    /// The artifact version to export. Format: projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}
502    #[serde(rename = "sourceVersion")]
503    pub source_version: Option<String>,
504}
505
506impl common::RequestValue for ExportArtifactRequest {}
507
508/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
509///
510/// This type is not used in any activity, and only used as *part* of another schema.
511///
512#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
513#[serde_with::serde_as]
514#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
515pub struct Expr {
516    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
517    pub description: Option<String>,
518    /// Textual representation of an expression in Common Expression Language syntax.
519    pub expression: Option<String>,
520    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
521    pub location: Option<String>,
522    /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
523    pub title: Option<String>,
524}
525
526impl common::Part for Expr {}
527
528/// Files store content that is potentially associated with Packages or Versions.
529///
530/// # Activities
531///
532/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
533/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
534///
535/// * [locations repositories files get projects](ProjectLocationRepositoryFileGetCall) (response)
536/// * [locations repositories files patch projects](ProjectLocationRepositoryFilePatchCall) (request|response)
537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
538#[serde_with::serde_as]
539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
540pub struct GoogleDevtoolsArtifactregistryV1File {
541    /// Optional. Client specified annotations.
542    pub annotations: Option<HashMap<String, String>>,
543    /// Output only. The time when the File was created.
544    #[serde(rename = "createTime")]
545    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
546    /// Output only. The time when the last attempt to refresh the file's data was made. Only set when the repository is remote.
547    #[serde(rename = "fetchTime")]
548    pub fetch_time: Option<chrono::DateTime<chrono::offset::Utc>>,
549    /// The hashes of the file content.
550    pub hashes: Option<Vec<Hash>>,
551    /// The name of the file, for example: `projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt`. If the file ID part contains slashes, they are escaped.
552    pub name: Option<String>,
553    /// The name of the Package or Version that owns this file, if any.
554    pub owner: Option<String>,
555    /// The size of the File in bytes.
556    #[serde(rename = "sizeBytes")]
557    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
558    pub size_bytes: Option<i64>,
559    /// Output only. The time when the File was last updated.
560    #[serde(rename = "updateTime")]
561    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
562}
563
564impl common::RequestValue for GoogleDevtoolsArtifactregistryV1File {}
565impl common::ResponseResult for GoogleDevtoolsArtifactregistryV1File {}
566
567/// Customer-specified publicly available remote repository.
568///
569/// This type is not used in any activity, and only used as *part* of another schema.
570///
571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
572#[serde_with::serde_as]
573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
574pub struct GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryCustomRepository {
575    /// An http/https uri reference to the upstream remote repository, for ex: "https://my.apt.registry/".
576    pub uri: Option<String>,
577}
578
579impl common::Part
580    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryCustomRepository
581{
582}
583
584/// Publicly available Apt repositories constructed from a common repository base and a custom repository path.
585///
586/// This type is not used in any activity, and only used as *part* of another schema.
587///
588#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
589#[serde_with::serde_as]
590#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
591pub struct GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryPublicRepository {
592    /// A common public repository base for Apt.
593    #[serde(rename = "repositoryBase")]
594    pub repository_base: Option<String>,
595    /// A custom field to define a path to a specific repository from the base.
596    #[serde(rename = "repositoryPath")]
597    pub repository_path: Option<String>,
598}
599
600impl common::Part
601    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigAptRepositoryPublicRepository
602{
603}
604
605/// Customer-specified publicly available remote repository.
606///
607/// This type is not used in any activity, and only used as *part* of another schema.
608///
609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
610#[serde_with::serde_as]
611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
612pub struct GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigDockerRepositoryCustomRepository {
613    /// An http/https uri reference to the custom remote repository, for ex: "https://registry-1.docker.io".
614    pub uri: Option<String>,
615}
616
617impl common::Part
618    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigDockerRepositoryCustomRepository
619{
620}
621
622/// Customer-specified publicly available remote repository.
623///
624/// This type is not used in any activity, and only used as *part* of another schema.
625///
626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
627#[serde_with::serde_as]
628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
629pub struct GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigMavenRepositoryCustomRepository {
630    /// An http/https uri reference to the upstream remote repository, for ex: "https://my.maven.registry/".
631    pub uri: Option<String>,
632}
633
634impl common::Part
635    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigMavenRepositoryCustomRepository
636{
637}
638
639/// Customer-specified publicly available remote repository.
640///
641/// This type is not used in any activity, and only used as *part* of another schema.
642///
643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
644#[serde_with::serde_as]
645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
646pub struct GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigNpmRepositoryCustomRepository {
647    /// An http/https uri reference to the upstream remote repository, for ex: "https://my.npm.registry/".
648    pub uri: Option<String>,
649}
650
651impl common::Part
652    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigNpmRepositoryCustomRepository
653{
654}
655
656/// Customer-specified publicly available remote repository.
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 GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigPythonRepositoryCustomRepository {
664    /// An http/https uri reference to the upstream remote repository, for ex: "https://my.python.registry/".
665    pub uri: Option<String>,
666}
667
668impl common::Part
669    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigPythonRepositoryCustomRepository
670{
671}
672
673/// Customer-specified publicly available remote repository.
674///
675/// This type is not used in any activity, and only used as *part* of another schema.
676///
677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
678#[serde_with::serde_as]
679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
680pub struct GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryCustomRepository {
681    /// An http/https uri reference to the upstream remote repository, for ex: "https://my.yum.registry/".
682    pub uri: Option<String>,
683}
684
685impl common::Part
686    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryCustomRepository
687{
688}
689
690/// Publicly available Yum repositories constructed from a common repository base and a custom repository path.
691///
692/// This type is not used in any activity, and only used as *part* of another schema.
693///
694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
695#[serde_with::serde_as]
696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
697pub struct GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryPublicRepository {
698    /// A common public repository base for Yum.
699    #[serde(rename = "repositoryBase")]
700    pub repository_base: Option<String>,
701    /// A custom field to define a path to a specific repository from the base.
702    #[serde(rename = "repositoryPath")]
703    pub repository_path: Option<String>,
704}
705
706impl common::Part
707    for GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryPublicRepository
708{
709}
710
711/// A rule defines the deny or allow action of the operation it applies to and the conditions required for the rule to apply. You can set one rule for an entire repository and one rule for each package within.
712///
713/// # Activities
714///
715/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
716/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
717///
718/// * [locations repositories rules create projects](ProjectLocationRepositoryRuleCreateCall) (request|response)
719/// * [locations repositories rules get projects](ProjectLocationRepositoryRuleGetCall) (response)
720/// * [locations repositories rules patch projects](ProjectLocationRepositoryRulePatchCall) (request|response)
721#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
722#[serde_with::serde_as]
723#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
724pub struct GoogleDevtoolsArtifactregistryV1Rule {
725    /// The action this rule takes.
726    pub action: Option<String>,
727    /// Optional. A CEL expression for conditions that must be met in order for the rule to apply. If not provided, the rule matches all objects.
728    pub condition: Option<Expr>,
729    /// The name of the rule, for example: `projects/p1/locations/us-central1/repositories/repo1/rules/rule1`.
730    pub name: Option<String>,
731    /// no description provided
732    pub operation: Option<String>,
733    /// The package ID the rule applies to. If empty, this rule applies to all packages inside the repository.
734    #[serde(rename = "packageId")]
735    pub package_id: Option<String>,
736}
737
738impl common::RequestValue for GoogleDevtoolsArtifactregistryV1Rule {}
739impl common::ResponseResult for GoogleDevtoolsArtifactregistryV1Rule {}
740
741/// A hash of file content.
742///
743/// This type is not used in any activity, and only used as *part* of another schema.
744///
745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
746#[serde_with::serde_as]
747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
748pub struct Hash {
749    /// The algorithm used to compute the hash value.
750    #[serde(rename = "type")]
751    pub type_: Option<String>,
752    /// The hash value.
753    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
754    pub value: Option<Vec<u8>>,
755}
756
757impl common::Part for Hash {}
758
759/// Details of a single image manifest within a multi-arch image.
760///
761/// This type is not used in any activity, and only used as *part* of another schema.
762///
763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
764#[serde_with::serde_as]
765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
766pub struct ImageManifest {
767    /// Optional. The CPU architecture of the image. Values are provided by the Docker client and are not validated by Artifact Registry. Example values include "amd64", "arm64", "ppc64le", "s390x", "riscv64", "mips64le", etc.
768    pub architecture: Option<String>,
769    /// Optional. The manifest digest, in the format "sha256:".
770    pub digest: Option<String>,
771    /// Optional. The media type of the manifest, e.g., "application/vnd.docker.distribution.manifest.v2+json"
772    #[serde(rename = "mediaType")]
773    pub media_type: Option<String>,
774    /// Optional. The operating system of the image. Values are provided by the Docker client and are not validated by Artifact Registry. Example values include "linux", "windows", "darwin", "aix", etc.
775    pub os: Option<String>,
776    /// Optional. The required OS features for the image, for example on Windows `win32k`.
777    #[serde(rename = "osFeatures")]
778    pub os_features: Option<Vec<String>>,
779    /// Optional. The OS version of the image, for example on Windows `10.0.14393.1066`.
780    #[serde(rename = "osVersion")]
781    pub os_version: Option<String>,
782    /// Optional. The variant of the CPU in the image, for example `v7` to specify ARMv7 when architecture is `arm`.
783    pub variant: Option<String>,
784}
785
786impl common::Part for ImageManifest {}
787
788/// Google Cloud Storage location where the artifacts currently reside.
789///
790/// This type is not used in any activity, and only used as *part* of another schema.
791///
792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
793#[serde_with::serde_as]
794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
795pub struct ImportAptArtifactsGcsSource {
796    /// Cloud Storage paths URI (e.g., gs://my_bucket//my_object).
797    pub uris: Option<Vec<String>>,
798    /// Supports URI wildcards for matching multiple objects from a single URI.
799    #[serde(rename = "useWildcards")]
800    pub use_wildcards: Option<bool>,
801}
802
803impl common::Part for ImportAptArtifactsGcsSource {}
804
805/// The request to import new apt artifacts.
806///
807/// # Activities
808///
809/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
810/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
811///
812/// * [locations repositories apt artifacts import projects](ProjectLocationRepositoryAptArtifactImportCall) (request)
813#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
814#[serde_with::serde_as]
815#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
816pub struct ImportAptArtifactsRequest {
817    /// Google Cloud Storage location where input content is located.
818    #[serde(rename = "gcsSource")]
819    pub gcs_source: Option<ImportAptArtifactsGcsSource>,
820}
821
822impl common::RequestValue for ImportAptArtifactsRequest {}
823
824/// Google Cloud Storage location where the artifacts currently reside.
825///
826/// This type is not used in any activity, and only used as *part* of another schema.
827///
828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
829#[serde_with::serde_as]
830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
831pub struct ImportGoogetArtifactsGcsSource {
832    /// Cloud Storage paths URI (e.g., `gs://my_bucket/my_object`).
833    pub uris: Option<Vec<String>>,
834    /// Supports URI wildcards for matching multiple objects from a single URI.
835    #[serde(rename = "useWildcards")]
836    pub use_wildcards: Option<bool>,
837}
838
839impl common::Part for ImportGoogetArtifactsGcsSource {}
840
841/// The request to import new googet artifacts.
842///
843/// # Activities
844///
845/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
846/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
847///
848/// * [locations repositories googet artifacts import projects](ProjectLocationRepositoryGoogetArtifactImportCall) (request)
849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
850#[serde_with::serde_as]
851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
852pub struct ImportGoogetArtifactsRequest {
853    /// Google Cloud Storage location where input content is located.
854    #[serde(rename = "gcsSource")]
855    pub gcs_source: Option<ImportGoogetArtifactsGcsSource>,
856}
857
858impl common::RequestValue for ImportGoogetArtifactsRequest {}
859
860/// Google Cloud Storage location where the artifacts currently reside.
861///
862/// This type is not used in any activity, and only used as *part* of another schema.
863///
864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
865#[serde_with::serde_as]
866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
867pub struct ImportYumArtifactsGcsSource {
868    /// Cloud Storage paths URI (e.g., gs://my_bucket//my_object).
869    pub uris: Option<Vec<String>>,
870    /// Supports URI wildcards for matching multiple objects from a single URI.
871    #[serde(rename = "useWildcards")]
872    pub use_wildcards: Option<bool>,
873}
874
875impl common::Part for ImportYumArtifactsGcsSource {}
876
877/// The request to import new yum artifacts.
878///
879/// # Activities
880///
881/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
882/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
883///
884/// * [locations repositories yum artifacts import projects](ProjectLocationRepositoryYumArtifactImportCall) (request)
885#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
886#[serde_with::serde_as]
887#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
888pub struct ImportYumArtifactsRequest {
889    /// Google Cloud Storage location where input content is located.
890    #[serde(rename = "gcsSource")]
891    pub gcs_source: Option<ImportYumArtifactsGcsSource>,
892}
893
894impl common::RequestValue for ImportYumArtifactsRequest {}
895
896/// The response from listing attachments.
897///
898/// # Activities
899///
900/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
901/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
902///
903/// * [locations repositories attachments list projects](ProjectLocationRepositoryAttachmentListCall) (response)
904#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
905#[serde_with::serde_as]
906#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
907pub struct ListAttachmentsResponse {
908    /// The attachments returned.
909    pub attachments: Option<Vec<Attachment>>,
910    /// The token to retrieve the next page of attachments, or empty if there are no more attachments to return.
911    #[serde(rename = "nextPageToken")]
912    pub next_page_token: Option<String>,
913}
914
915impl common::ResponseResult for ListAttachmentsResponse {}
916
917/// The response from listing docker images.
918///
919/// # Activities
920///
921/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
922/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
923///
924/// * [locations repositories docker images list projects](ProjectLocationRepositoryDockerImageListCall) (response)
925#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
926#[serde_with::serde_as]
927#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
928pub struct ListDockerImagesResponse {
929    /// The docker images returned.
930    #[serde(rename = "dockerImages")]
931    pub docker_images: Option<Vec<DockerImage>>,
932    /// The token to retrieve the next page of artifacts, or empty if there are no more artifacts to return.
933    #[serde(rename = "nextPageToken")]
934    pub next_page_token: Option<String>,
935}
936
937impl common::ResponseResult for ListDockerImagesResponse {}
938
939/// The response from listing files.
940///
941/// # Activities
942///
943/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
944/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
945///
946/// * [locations repositories files list projects](ProjectLocationRepositoryFileListCall) (response)
947#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
948#[serde_with::serde_as]
949#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
950pub struct ListFilesResponse {
951    /// The files returned.
952    pub files: Option<Vec<GoogleDevtoolsArtifactregistryV1File>>,
953    /// The token to retrieve the next page of files, or empty if there are no more files to return.
954    #[serde(rename = "nextPageToken")]
955    pub next_page_token: Option<String>,
956}
957
958impl common::ResponseResult for ListFilesResponse {}
959
960/// The response message for Locations.ListLocations.
961///
962/// # Activities
963///
964/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
965/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
966///
967/// * [locations list projects](ProjectLocationListCall) (response)
968#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
969#[serde_with::serde_as]
970#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
971pub struct ListLocationsResponse {
972    /// A list of locations that matches the specified filter in the request.
973    pub locations: Option<Vec<Location>>,
974    /// The standard List next-page token.
975    #[serde(rename = "nextPageToken")]
976    pub next_page_token: Option<String>,
977}
978
979impl common::ResponseResult for ListLocationsResponse {}
980
981/// The response from listing maven artifacts.
982///
983/// # Activities
984///
985/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
986/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
987///
988/// * [locations repositories maven artifacts list projects](ProjectLocationRepositoryMavenArtifactListCall) (response)
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct ListMavenArtifactsResponse {
993    /// The maven artifacts returned.
994    #[serde(rename = "mavenArtifacts")]
995    pub maven_artifacts: Option<Vec<MavenArtifact>>,
996    /// The token to retrieve the next page of artifacts, or empty if there are no more artifacts to return.
997    #[serde(rename = "nextPageToken")]
998    pub next_page_token: Option<String>,
999}
1000
1001impl common::ResponseResult for ListMavenArtifactsResponse {}
1002
1003/// The response from listing npm packages.
1004///
1005/// # Activities
1006///
1007/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1008/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1009///
1010/// * [locations repositories npm packages list projects](ProjectLocationRepositoryNpmPackageListCall) (response)
1011#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1012#[serde_with::serde_as]
1013#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1014pub struct ListNpmPackagesResponse {
1015    /// The token to retrieve the next page of artifacts, or empty if there are no more artifacts to return.
1016    #[serde(rename = "nextPageToken")]
1017    pub next_page_token: Option<String>,
1018    /// The npm packages returned.
1019    #[serde(rename = "npmPackages")]
1020    pub npm_packages: Option<Vec<NpmPackage>>,
1021}
1022
1023impl common::ResponseResult for ListNpmPackagesResponse {}
1024
1025/// The response from listing packages.
1026///
1027/// # Activities
1028///
1029/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1030/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1031///
1032/// * [locations repositories packages list projects](ProjectLocationRepositoryPackageListCall) (response)
1033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1034#[serde_with::serde_as]
1035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1036pub struct ListPackagesResponse {
1037    /// The token to retrieve the next page of packages, or empty if there are no more packages to return.
1038    #[serde(rename = "nextPageToken")]
1039    pub next_page_token: Option<String>,
1040    /// The packages returned.
1041    pub packages: Option<Vec<Package>>,
1042}
1043
1044impl common::ResponseResult for ListPackagesResponse {}
1045
1046/// The response from listing python packages.
1047///
1048/// # Activities
1049///
1050/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1051/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1052///
1053/// * [locations repositories python packages list projects](ProjectLocationRepositoryPythonPackageListCall) (response)
1054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1055#[serde_with::serde_as]
1056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1057pub struct ListPythonPackagesResponse {
1058    /// The token to retrieve the next page of artifacts, or empty if there are no more artifacts to return.
1059    #[serde(rename = "nextPageToken")]
1060    pub next_page_token: Option<String>,
1061    /// The python packages returned.
1062    #[serde(rename = "pythonPackages")]
1063    pub python_packages: Option<Vec<PythonPackage>>,
1064}
1065
1066impl common::ResponseResult for ListPythonPackagesResponse {}
1067
1068/// The response from listing repositories.
1069///
1070/// # Activities
1071///
1072/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1073/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1074///
1075/// * [locations repositories list projects](ProjectLocationRepositoryListCall) (response)
1076#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1077#[serde_with::serde_as]
1078#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1079pub struct ListRepositoriesResponse {
1080    /// The token to retrieve the next page of repositories, or empty if there are no more repositories to return.
1081    #[serde(rename = "nextPageToken")]
1082    pub next_page_token: Option<String>,
1083    /// The repositories returned.
1084    pub repositories: Option<Vec<Repository>>,
1085}
1086
1087impl common::ResponseResult for ListRepositoriesResponse {}
1088
1089/// The response from listing rules.
1090///
1091/// # Activities
1092///
1093/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1094/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1095///
1096/// * [locations repositories rules list projects](ProjectLocationRepositoryRuleListCall) (response)
1097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1098#[serde_with::serde_as]
1099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1100pub struct ListRulesResponse {
1101    /// The token to retrieve the next page of rules, or empty if there are no more rules to return.
1102    #[serde(rename = "nextPageToken")]
1103    pub next_page_token: Option<String>,
1104    /// The rules returned.
1105    pub rules: Option<Vec<GoogleDevtoolsArtifactregistryV1Rule>>,
1106}
1107
1108impl common::ResponseResult for ListRulesResponse {}
1109
1110/// The response from listing tags.
1111///
1112/// # Activities
1113///
1114/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1115/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1116///
1117/// * [locations repositories packages tags list projects](ProjectLocationRepositoryPackageTagListCall) (response)
1118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1119#[serde_with::serde_as]
1120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1121pub struct ListTagsResponse {
1122    /// The token to retrieve the next page of tags, or empty if there are no more tags to return.
1123    #[serde(rename = "nextPageToken")]
1124    pub next_page_token: Option<String>,
1125    /// The tags returned.
1126    pub tags: Option<Vec<Tag>>,
1127}
1128
1129impl common::ResponseResult for ListTagsResponse {}
1130
1131/// The response from listing versions.
1132///
1133/// # Activities
1134///
1135/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1136/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1137///
1138/// * [locations repositories packages versions list projects](ProjectLocationRepositoryPackageVersionListCall) (response)
1139#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1140#[serde_with::serde_as]
1141#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1142pub struct ListVersionsResponse {
1143    /// The token to retrieve the next page of versions, or empty if there are no more versions to return.
1144    #[serde(rename = "nextPageToken")]
1145    pub next_page_token: Option<String>,
1146    /// The versions returned.
1147    pub versions: Option<Vec<Version>>,
1148}
1149
1150impl common::ResponseResult for ListVersionsResponse {}
1151
1152/// A resource that represents a Google Cloud location.
1153///
1154/// # Activities
1155///
1156/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1157/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1158///
1159/// * [locations get projects](ProjectLocationGetCall) (response)
1160#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1161#[serde_with::serde_as]
1162#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1163pub struct Location {
1164    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1165    #[serde(rename = "displayName")]
1166    pub display_name: Option<String>,
1167    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1168    pub labels: Option<HashMap<String, String>>,
1169    /// The canonical id for this location. For example: `"us-east1"`.
1170    #[serde(rename = "locationId")]
1171    pub location_id: Option<String>,
1172    /// Service-specific metadata. For example the available capacity at the given location.
1173    pub metadata: Option<HashMap<String, serde_json::Value>>,
1174    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1175    pub name: Option<String>,
1176}
1177
1178impl common::ResponseResult for Location {}
1179
1180/// MavenArtifact represents a maven artifact.
1181///
1182/// # Activities
1183///
1184/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1185/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1186///
1187/// * [locations repositories maven artifacts get projects](ProjectLocationRepositoryMavenArtifactGetCall) (response)
1188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1189#[serde_with::serde_as]
1190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1191pub struct MavenArtifact {
1192    /// Artifact ID for the artifact.
1193    #[serde(rename = "artifactId")]
1194    pub artifact_id: Option<String>,
1195    /// Output only. Time the artifact was created.
1196    #[serde(rename = "createTime")]
1197    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1198    /// Group ID for the artifact. Example: com.google.guava
1199    #[serde(rename = "groupId")]
1200    pub group_id: Option<String>,
1201    /// Required. registry_location, project_id, repository_name and maven_artifact forms a unique artifact For example, "projects/test-project/locations/us-west4/repositories/test-repo/mavenArtifacts/ com.google.guava:guava:31.0-jre", where "us-west4" is the registry_location, "test-project" is the project_id, "test-repo" is the repository_name and "com.google.guava:guava:31.0-jre" is the maven artifact.
1202    pub name: Option<String>,
1203    /// Required. URL to access the pom file of the artifact. Example: us-west4-maven.pkg.dev/test-project/test-repo/com/google/guava/guava/31.0/guava-31.0.pom
1204    #[serde(rename = "pomUri")]
1205    pub pom_uri: Option<String>,
1206    /// Output only. Time the artifact was updated.
1207    #[serde(rename = "updateTime")]
1208    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1209    /// Version of this artifact.
1210    pub version: Option<String>,
1211}
1212
1213impl common::ResponseResult for MavenArtifact {}
1214
1215/// Configuration for a Maven remote repository.
1216///
1217/// This type is not used in any activity, and only used as *part* of another schema.
1218///
1219#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1220#[serde_with::serde_as]
1221#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1222pub struct MavenRepository {
1223    /// Customer-specified remote repository.
1224    #[serde(rename = "customRepository")]
1225    pub custom_repository: Option<
1226        GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigMavenRepositoryCustomRepository,
1227    >,
1228    /// One of the publicly available Maven repositories supported by Artifact Registry.
1229    #[serde(rename = "publicRepository")]
1230    pub public_repository: Option<String>,
1231}
1232
1233impl common::Part for MavenRepository {}
1234
1235/// MavenRepositoryConfig is maven related repository details. Provides additional configuration details for repositories of the maven format type.
1236///
1237/// This type is not used in any activity, and only used as *part* of another schema.
1238///
1239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1240#[serde_with::serde_as]
1241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1242pub struct MavenRepositoryConfig {
1243    /// The repository with this flag will allow publishing the same snapshot versions.
1244    #[serde(rename = "allowSnapshotOverwrites")]
1245    pub allow_snapshot_overwrites: Option<bool>,
1246    /// Version policy defines the versions that the registry will accept.
1247    #[serde(rename = "versionPolicy")]
1248    pub version_policy: Option<String>,
1249}
1250
1251impl common::Part for MavenRepositoryConfig {}
1252
1253/// NpmPackage represents an npm artifact.
1254///
1255/// # Activities
1256///
1257/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1258/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1259///
1260/// * [locations repositories npm packages get projects](ProjectLocationRepositoryNpmPackageGetCall) (response)
1261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1262#[serde_with::serde_as]
1263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1264pub struct NpmPackage {
1265    /// Output only. Time the package was created.
1266    #[serde(rename = "createTime")]
1267    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1268    /// Required. registry_location, project_id, repository_name and npm_package forms a unique package For example, "projects/test-project/locations/us-west4/repositories/test-repo/npmPackages/ npm_test:1.0.0", where "us-west4" is the registry_location, "test-project" is the project_id, "test-repo" is the repository_name and npm_test:1.0.0" is the npm package.
1269    pub name: Option<String>,
1270    /// Package for the artifact.
1271    #[serde(rename = "packageName")]
1272    pub package_name: Option<String>,
1273    /// Tags attached to this package.
1274    pub tags: Option<Vec<String>>,
1275    /// Output only. Time the package was updated.
1276    #[serde(rename = "updateTime")]
1277    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1278    /// Version of this package.
1279    pub version: Option<String>,
1280}
1281
1282impl common::ResponseResult for NpmPackage {}
1283
1284/// Configuration for a Npm remote repository.
1285///
1286/// This type is not used in any activity, and only used as *part* of another schema.
1287///
1288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1289#[serde_with::serde_as]
1290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1291pub struct NpmRepository {
1292    /// Customer-specified remote repository.
1293    #[serde(rename = "customRepository")]
1294    pub custom_repository:
1295        Option<GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigNpmRepositoryCustomRepository>,
1296    /// One of the publicly available Npm repositories supported by Artifact Registry.
1297    #[serde(rename = "publicRepository")]
1298    pub public_repository: Option<String>,
1299}
1300
1301impl common::Part for NpmRepository {}
1302
1303/// This resource represents a long-running operation that is the result of a network API call.
1304///
1305/// # Activities
1306///
1307/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1308/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1309///
1310/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1311/// * [locations repositories apt artifacts import projects](ProjectLocationRepositoryAptArtifactImportCall) (response)
1312/// * [locations repositories attachments create projects](ProjectLocationRepositoryAttachmentCreateCall) (response)
1313/// * [locations repositories attachments delete projects](ProjectLocationRepositoryAttachmentDeleteCall) (response)
1314/// * [locations repositories files delete projects](ProjectLocationRepositoryFileDeleteCall) (response)
1315/// * [locations repositories googet artifacts import projects](ProjectLocationRepositoryGoogetArtifactImportCall) (response)
1316/// * [locations repositories packages versions batch delete projects](ProjectLocationRepositoryPackageVersionBatchDeleteCall) (response)
1317/// * [locations repositories packages versions delete projects](ProjectLocationRepositoryPackageVersionDeleteCall) (response)
1318/// * [locations repositories packages delete projects](ProjectLocationRepositoryPackageDeleteCall) (response)
1319/// * [locations repositories yum artifacts import projects](ProjectLocationRepositoryYumArtifactImportCall) (response)
1320/// * [locations repositories create projects](ProjectLocationRepositoryCreateCall) (response)
1321/// * [locations repositories delete projects](ProjectLocationRepositoryDeleteCall) (response)
1322/// * [locations repositories export artifact projects](ProjectLocationRepositoryExportArtifactCall) (response)
1323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1324#[serde_with::serde_as]
1325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1326pub struct Operation {
1327    /// 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.
1328    pub done: Option<bool>,
1329    /// The error result of the operation in case of failure or cancellation.
1330    pub error: Option<Status>,
1331    /// 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.
1332    pub metadata: Option<HashMap<String, serde_json::Value>>,
1333    /// 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}`.
1334    pub name: Option<String>,
1335    /// The normal, successful response of the operation. 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`.
1336    pub response: Option<HashMap<String, serde_json::Value>>,
1337}
1338
1339impl common::ResponseResult for Operation {}
1340
1341/// Packages are named collections of versions.
1342///
1343/// # Activities
1344///
1345/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1346/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1347///
1348/// * [locations repositories packages get projects](ProjectLocationRepositoryPackageGetCall) (response)
1349/// * [locations repositories packages patch projects](ProjectLocationRepositoryPackagePatchCall) (request|response)
1350#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1351#[serde_with::serde_as]
1352#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1353pub struct Package {
1354    /// Optional. Client specified annotations.
1355    pub annotations: Option<HashMap<String, String>>,
1356    /// The time when the package was created.
1357    #[serde(rename = "createTime")]
1358    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1359    /// The display name of the package.
1360    #[serde(rename = "displayName")]
1361    pub display_name: Option<String>,
1362    /// The name of the package, for example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1`. If the package ID part contains slashes, the slashes are escaped.
1363    pub name: Option<String>,
1364    /// The time when the package was last updated. This includes publishing a new version of the package.
1365    #[serde(rename = "updateTime")]
1366    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1367}
1368
1369impl common::RequestValue for Package {}
1370impl common::ResponseResult for Package {}
1371
1372/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
1373///
1374/// # Activities
1375///
1376/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1377/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1378///
1379/// * [locations repositories get iam policy projects](ProjectLocationRepositoryGetIamPolicyCall) (response)
1380/// * [locations repositories set iam policy projects](ProjectLocationRepositorySetIamPolicyCall) (response)
1381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1382#[serde_with::serde_as]
1383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1384pub struct Policy {
1385    /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
1386    pub bindings: Option<Vec<Binding>>,
1387    /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
1388    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1389    pub etag: Option<Vec<u8>>,
1390    /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1391    pub version: Option<i32>,
1392}
1393
1394impl common::ResponseResult for Policy {}
1395
1396/// The Artifact Registry settings that apply to a Project.
1397///
1398/// # Activities
1399///
1400/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1401/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1402///
1403/// * [get project settings projects](ProjectGetProjectSettingCall) (response)
1404/// * [update project settings projects](ProjectUpdateProjectSettingCall) (request|response)
1405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1406#[serde_with::serde_as]
1407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1408pub struct ProjectSettings {
1409    /// The redirection state of the legacy repositories in this project.
1410    #[serde(rename = "legacyRedirectionState")]
1411    pub legacy_redirection_state: Option<String>,
1412    /// The name of the project's settings. Always of the form: projects/{project-id}/projectSettings In update request: never set In response: always set
1413    pub name: Option<String>,
1414    /// The percentage of pull traffic to redirect from GCR to AR when using partial redirection.
1415    #[serde(rename = "pullPercent")]
1416    pub pull_percent: Option<i32>,
1417}
1418
1419impl common::RequestValue for ProjectSettings {}
1420impl common::ResponseResult for ProjectSettings {}
1421
1422/// PythonPackage represents a python artifact.
1423///
1424/// # Activities
1425///
1426/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1427/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1428///
1429/// * [locations repositories python packages get projects](ProjectLocationRepositoryPythonPackageGetCall) (response)
1430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1431#[serde_with::serde_as]
1432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1433pub struct PythonPackage {
1434    /// Output only. Time the package was created.
1435    #[serde(rename = "createTime")]
1436    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1437    /// Required. registry_location, project_id, repository_name and python_package forms a unique package name:`projects//locations//repository//pythonPackages/`. For example, "projects/test-project/locations/us-west4/repositories/test-repo/pythonPackages/ python_package:1.0.0", where "us-west4" is the registry_location, "test-project" is the project_id, "test-repo" is the repository_name and python_package:1.0.0" is the python package.
1438    pub name: Option<String>,
1439    /// Package for the artifact.
1440    #[serde(rename = "packageName")]
1441    pub package_name: Option<String>,
1442    /// Output only. Time the package was updated.
1443    #[serde(rename = "updateTime")]
1444    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1445    /// Required. URL to access the package. Example: us-west4-python.pkg.dev/test-project/test-repo/python_package/file-name-1.0.0.tar.gz
1446    pub uri: Option<String>,
1447    /// Version of this package.
1448    pub version: Option<String>,
1449}
1450
1451impl common::ResponseResult for PythonPackage {}
1452
1453/// Configuration for a Python remote repository.
1454///
1455/// This type is not used in any activity, and only used as *part* of another schema.
1456///
1457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1458#[serde_with::serde_as]
1459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1460pub struct PythonRepository {
1461    /// Customer-specified remote repository.
1462    #[serde(rename = "customRepository")]
1463    pub custom_repository: Option<
1464        GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigPythonRepositoryCustomRepository,
1465    >,
1466    /// One of the publicly available Python repositories supported by Artifact Registry.
1467    #[serde(rename = "publicRepository")]
1468    pub public_repository: Option<String>,
1469}
1470
1471impl common::Part for PythonRepository {}
1472
1473/// Remote repository configuration.
1474///
1475/// This type is not used in any activity, and only used as *part* of another schema.
1476///
1477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1478#[serde_with::serde_as]
1479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1480pub struct RemoteRepositoryConfig {
1481    /// Specific settings for an Apt remote repository.
1482    #[serde(rename = "aptRepository")]
1483    pub apt_repository: Option<AptRepository>,
1484    /// Common remote repository settings. Used as the remote repository upstream URL.
1485    #[serde(rename = "commonRepository")]
1486    pub common_repository: Option<CommonRemoteRepository>,
1487    /// The description of the remote source.
1488    pub description: Option<String>,
1489    /// Input only. A create/update remote repo option to avoid making a HEAD/GET request to validate a remote repo and any supplied upstream credentials.
1490    #[serde(rename = "disableUpstreamValidation")]
1491    pub disable_upstream_validation: Option<bool>,
1492    /// Specific settings for a Docker remote repository.
1493    #[serde(rename = "dockerRepository")]
1494    pub docker_repository: Option<DockerRepository>,
1495    /// Specific settings for a Maven remote repository.
1496    #[serde(rename = "mavenRepository")]
1497    pub maven_repository: Option<MavenRepository>,
1498    /// Specific settings for an Npm remote repository.
1499    #[serde(rename = "npmRepository")]
1500    pub npm_repository: Option<NpmRepository>,
1501    /// Specific settings for a Python remote repository.
1502    #[serde(rename = "pythonRepository")]
1503    pub python_repository: Option<PythonRepository>,
1504    /// Optional. The credentials used to access the remote repository.
1505    #[serde(rename = "upstreamCredentials")]
1506    pub upstream_credentials: Option<UpstreamCredentials>,
1507    /// Specific settings for a Yum remote repository.
1508    #[serde(rename = "yumRepository")]
1509    pub yum_repository: Option<YumRepository>,
1510}
1511
1512impl common::Part for RemoteRepositoryConfig {}
1513
1514/// A Repository for storing artifacts with a specific format.
1515///
1516/// # Activities
1517///
1518/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1519/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1520///
1521/// * [locations repositories create projects](ProjectLocationRepositoryCreateCall) (request)
1522/// * [locations repositories get projects](ProjectLocationRepositoryGetCall) (response)
1523/// * [locations repositories patch projects](ProjectLocationRepositoryPatchCall) (request|response)
1524#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1525#[serde_with::serde_as]
1526#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1527pub struct Repository {
1528    /// Optional. Cleanup policies for this repository. Cleanup policies indicate when certain package versions can be automatically deleted. Map keys are policy IDs supplied by users during policy creation. They must unique within a repository and be under 128 characters in length.
1529    #[serde(rename = "cleanupPolicies")]
1530    pub cleanup_policies: Option<HashMap<String, CleanupPolicy>>,
1531    /// Optional. If true, the cleanup pipeline is prevented from deleting versions in this repository.
1532    #[serde(rename = "cleanupPolicyDryRun")]
1533    pub cleanup_policy_dry_run: Option<bool>,
1534    /// Output only. The time when the repository was created.
1535    #[serde(rename = "createTime")]
1536    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1537    /// The user-provided description of the repository.
1538    pub description: Option<String>,
1539    /// Optional. If this is true, an unspecified repo type will be treated as error rather than defaulting to standard.
1540    #[serde(rename = "disallowUnspecifiedMode")]
1541    pub disallow_unspecified_mode: Option<bool>,
1542    /// Docker repository config contains repository level configuration for the repositories of docker type.
1543    #[serde(rename = "dockerConfig")]
1544    pub docker_config: Option<DockerRepositoryConfig>,
1545    /// Optional. The format of packages that are stored in the repository.
1546    pub format: Option<String>,
1547    /// The Cloud KMS resource name of the customer managed encryption key that's used to encrypt the contents of the Repository. Has the form: `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. This value may not be changed after the Repository has been created.
1548    #[serde(rename = "kmsKeyName")]
1549    pub kms_key_name: Option<String>,
1550    /// Labels with user-defined metadata. This field may contain up to 64 entries. Label keys and values may be no longer than 63 characters. Label keys must begin with a lowercase letter and may only contain lowercase letters, numeric characters, underscores, and dashes.
1551    pub labels: Option<HashMap<String, String>>,
1552    /// Maven repository config contains repository level configuration for the repositories of maven type.
1553    #[serde(rename = "mavenConfig")]
1554    pub maven_config: Option<MavenRepositoryConfig>,
1555    /// Optional. The mode of the repository.
1556    pub mode: Option<String>,
1557    /// The name of the repository, for example: `projects/p1/locations/us-central1/repositories/repo1`. For each location in a project, repository names must be unique.
1558    pub name: Option<String>,
1559    /// Output only. The repository endpoint, for example: `us-docker.pkg.dev/my-proj/my-repo`.
1560    #[serde(rename = "registryUri")]
1561    pub registry_uri: Option<String>,
1562    /// Configuration specific for a Remote Repository.
1563    #[serde(rename = "remoteRepositoryConfig")]
1564    pub remote_repository_config: Option<RemoteRepositoryConfig>,
1565    /// Output only. Whether or not this repository satisfies PZI.
1566    #[serde(rename = "satisfiesPzi")]
1567    pub satisfies_pzi: Option<bool>,
1568    /// Output only. Whether or not this repository satisfies PZS.
1569    #[serde(rename = "satisfiesPzs")]
1570    pub satisfies_pzs: Option<bool>,
1571    /// Output only. The size, in bytes, of all artifact storage in this repository. Repositories that are generally available or in public preview use this to calculate storage costs.
1572    #[serde(rename = "sizeBytes")]
1573    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1574    pub size_bytes: Option<i64>,
1575    /// Output only. The time when the repository was last updated.
1576    #[serde(rename = "updateTime")]
1577    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1578    /// Configuration specific for a Virtual Repository.
1579    #[serde(rename = "virtualRepositoryConfig")]
1580    pub virtual_repository_config: Option<VirtualRepositoryConfig>,
1581    /// Optional. Config and state for vulnerability scanning of resources within this Repository.
1582    #[serde(rename = "vulnerabilityScanningConfig")]
1583    pub vulnerability_scanning_config: Option<VulnerabilityScanningConfig>,
1584}
1585
1586impl common::RequestValue for Repository {}
1587impl common::ResponseResult for Repository {}
1588
1589/// Request message for `SetIamPolicy` method.
1590///
1591/// # Activities
1592///
1593/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1594/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1595///
1596/// * [locations repositories set iam policy projects](ProjectLocationRepositorySetIamPolicyCall) (request)
1597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1598#[serde_with::serde_as]
1599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1600pub struct SetIamPolicyRequest {
1601    /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
1602    pub policy: Option<Policy>,
1603}
1604
1605impl common::RequestValue for SetIamPolicyRequest {}
1606
1607/// 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).
1608///
1609/// This type is not used in any activity, and only used as *part* of another schema.
1610///
1611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1612#[serde_with::serde_as]
1613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1614pub struct Status {
1615    /// The status code, which should be an enum value of google.rpc.Code.
1616    pub code: Option<i32>,
1617    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1618    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1619    /// 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.
1620    pub message: Option<String>,
1621}
1622
1623impl common::Part for Status {}
1624
1625/// Tags point to a version and represent an alternative name that can be used to access the version.
1626///
1627/// # Activities
1628///
1629/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1630/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1631///
1632/// * [locations repositories packages tags create projects](ProjectLocationRepositoryPackageTagCreateCall) (request|response)
1633/// * [locations repositories packages tags get projects](ProjectLocationRepositoryPackageTagGetCall) (response)
1634/// * [locations repositories packages tags patch projects](ProjectLocationRepositoryPackageTagPatchCall) (request|response)
1635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1636#[serde_with::serde_as]
1637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1638pub struct Tag {
1639    /// The name of the tag, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". If the package part contains slashes, the slashes are escaped. The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else must be URL encoded.
1640    pub name: Option<String>,
1641    /// The name of the version the tag refers to, for example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811` If the package or version ID parts contain slashes, the slashes are escaped.
1642    pub version: Option<String>,
1643}
1644
1645impl common::RequestValue for Tag {}
1646impl common::ResponseResult for Tag {}
1647
1648/// Request message for `TestIamPermissions` method.
1649///
1650/// # Activities
1651///
1652/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1653/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1654///
1655/// * [locations repositories test iam permissions projects](ProjectLocationRepositoryTestIamPermissionCall) (request)
1656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1657#[serde_with::serde_as]
1658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1659pub struct TestIamPermissionsRequest {
1660    /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1661    pub permissions: Option<Vec<String>>,
1662}
1663
1664impl common::RequestValue for TestIamPermissionsRequest {}
1665
1666/// Response message for `TestIamPermissions` method.
1667///
1668/// # Activities
1669///
1670/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1671/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1672///
1673/// * [locations repositories test iam permissions projects](ProjectLocationRepositoryTestIamPermissionCall) (response)
1674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1675#[serde_with::serde_as]
1676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1677pub struct TestIamPermissionsResponse {
1678    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1679    pub permissions: Option<Vec<String>>,
1680}
1681
1682impl common::ResponseResult for TestIamPermissionsResponse {}
1683
1684/// The response to upload an artifact.
1685///
1686/// # Activities
1687///
1688/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1689/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1690///
1691/// * [locations repositories apt artifacts upload projects](ProjectLocationRepositoryAptArtifactUploadCall) (response)
1692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1693#[serde_with::serde_as]
1694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1695pub struct UploadAptArtifactMediaResponse {
1696    /// Operation to be returned to the user.
1697    pub operation: Option<Operation>,
1698}
1699
1700impl common::ResponseResult for UploadAptArtifactMediaResponse {}
1701
1702/// The request to upload an artifact.
1703///
1704/// # Activities
1705///
1706/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1707/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1708///
1709/// * [locations repositories apt artifacts upload projects](ProjectLocationRepositoryAptArtifactUploadCall) (request)
1710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1711#[serde_with::serde_as]
1712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1713pub struct UploadAptArtifactRequest {
1714    _never_set: Option<bool>,
1715}
1716
1717impl common::RequestValue for UploadAptArtifactRequest {}
1718
1719/// The response to upload a generic artifact.
1720///
1721/// # Activities
1722///
1723/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1724/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1725///
1726/// * [locations repositories files upload projects](ProjectLocationRepositoryFileUploadCall) (response)
1727#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1728#[serde_with::serde_as]
1729#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1730pub struct UploadFileMediaResponse {
1731    /// Operation that will be returned to the user.
1732    pub operation: Option<Operation>,
1733}
1734
1735impl common::ResponseResult for UploadFileMediaResponse {}
1736
1737/// The request to upload a file.
1738///
1739/// # Activities
1740///
1741/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1742/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1743///
1744/// * [locations repositories files upload projects](ProjectLocationRepositoryFileUploadCall) (request)
1745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1746#[serde_with::serde_as]
1747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1748pub struct UploadFileRequest {
1749    /// Optional. The ID of the file. If left empty will default to sha256 digest of the content uploaded.
1750    #[serde(rename = "fileId")]
1751    pub file_id: Option<String>,
1752}
1753
1754impl common::RequestValue for UploadFileRequest {}
1755
1756/// The response to upload a generic artifact.
1757///
1758/// # Activities
1759///
1760/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1761/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1762///
1763/// * [locations repositories generic artifacts upload projects](ProjectLocationRepositoryGenericArtifactUploadCall) (response)
1764#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1765#[serde_with::serde_as]
1766#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1767pub struct UploadGenericArtifactMediaResponse {
1768    /// Operation that will be returned to the user.
1769    pub operation: Option<Operation>,
1770}
1771
1772impl common::ResponseResult for UploadGenericArtifactMediaResponse {}
1773
1774/// The request to upload a generic artifact. The created GenericArtifact will have the resource name {parent}/genericArtifacts/package_id:version_id. The created file will have the resource name {parent}/files/package_id:version_id:filename.
1775///
1776/// # Activities
1777///
1778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1780///
1781/// * [locations repositories generic artifacts upload projects](ProjectLocationRepositoryGenericArtifactUploadCall) (request)
1782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1783#[serde_with::serde_as]
1784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1785pub struct UploadGenericArtifactRequest {
1786    /// The name of the file of the generic artifact to be uploaded. E.g. `example-file.zip` The filename is limited to letters, numbers, and url safe characters, i.e. [a-zA-Z0-9-_.~@].
1787    pub filename: Option<String>,
1788    /// The ID of the package of the generic artifact. If the package does not exist, a new package will be created. The `package_id` should start and end with a letter or number, only contain letters, numbers, hyphens, underscores, and periods, and not exceed 256 characters.
1789    #[serde(rename = "packageId")]
1790    pub package_id: Option<String>,
1791    /// The ID of the version of the generic artifact. If the version does not exist, a new version will be created. The version_id must start and end with a letter or number, can only contain lowercase letters, numbers, the following characters [-.+~:], i.e.[a-z0-9-.+~:] and cannot exceed a total of 128 characters. Creating a version called `latest` is not allowed.
1792    #[serde(rename = "versionId")]
1793    pub version_id: Option<String>,
1794}
1795
1796impl common::RequestValue for UploadGenericArtifactRequest {}
1797
1798/// The response to upload a Go module.
1799///
1800/// # Activities
1801///
1802/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1803/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1804///
1805/// * [locations repositories go modules upload projects](ProjectLocationRepositoryGoModuleUploadCall) (response)
1806#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1807#[serde_with::serde_as]
1808#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1809pub struct UploadGoModuleMediaResponse {
1810    /// Operation to be returned to the user.
1811    pub operation: Option<Operation>,
1812}
1813
1814impl common::ResponseResult for UploadGoModuleMediaResponse {}
1815
1816/// The request to upload a Go module.
1817///
1818/// # Activities
1819///
1820/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1821/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1822///
1823/// * [locations repositories go modules upload projects](ProjectLocationRepositoryGoModuleUploadCall) (request)
1824#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1825#[serde_with::serde_as]
1826#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1827pub struct UploadGoModuleRequest {
1828    _never_set: Option<bool>,
1829}
1830
1831impl common::RequestValue for UploadGoModuleRequest {}
1832
1833/// The response to upload an artifact.
1834///
1835/// # Activities
1836///
1837/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1838/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1839///
1840/// * [locations repositories googet artifacts upload projects](ProjectLocationRepositoryGoogetArtifactUploadCall) (response)
1841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1842#[serde_with::serde_as]
1843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1844pub struct UploadGoogetArtifactMediaResponse {
1845    /// Operation to be returned to the user.
1846    pub operation: Option<Operation>,
1847}
1848
1849impl common::ResponseResult for UploadGoogetArtifactMediaResponse {}
1850
1851/// The request to upload an artifact.
1852///
1853/// # Activities
1854///
1855/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1856/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1857///
1858/// * [locations repositories googet artifacts upload projects](ProjectLocationRepositoryGoogetArtifactUploadCall) (request)
1859#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1860#[serde_with::serde_as]
1861#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1862pub struct UploadGoogetArtifactRequest {
1863    _never_set: Option<bool>,
1864}
1865
1866impl common::RequestValue for UploadGoogetArtifactRequest {}
1867
1868/// The response to upload an artifact.
1869///
1870/// # Activities
1871///
1872/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1873/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1874///
1875/// * [locations repositories kfp artifacts upload projects](ProjectLocationRepositoryKfpArtifactUploadCall) (response)
1876#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1877#[serde_with::serde_as]
1878#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1879pub struct UploadKfpArtifactMediaResponse {
1880    /// Operation that will be returned to the user.
1881    pub operation: Option<Operation>,
1882}
1883
1884impl common::ResponseResult for UploadKfpArtifactMediaResponse {}
1885
1886/// The request to upload an artifact.
1887///
1888/// # Activities
1889///
1890/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1891/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1892///
1893/// * [locations repositories kfp artifacts upload projects](ProjectLocationRepositoryKfpArtifactUploadCall) (request)
1894#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1895#[serde_with::serde_as]
1896#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1897pub struct UploadKfpArtifactRequest {
1898    /// Description of the package version.
1899    pub description: Option<String>,
1900    /// Tags to be created with the version.
1901    pub tags: Option<Vec<String>>,
1902}
1903
1904impl common::RequestValue for UploadKfpArtifactRequest {}
1905
1906/// The response to upload an artifact.
1907///
1908/// # Activities
1909///
1910/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1911/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1912///
1913/// * [locations repositories yum artifacts upload projects](ProjectLocationRepositoryYumArtifactUploadCall) (response)
1914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1915#[serde_with::serde_as]
1916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1917pub struct UploadYumArtifactMediaResponse {
1918    /// Operation to be returned to the user.
1919    pub operation: Option<Operation>,
1920}
1921
1922impl common::ResponseResult for UploadYumArtifactMediaResponse {}
1923
1924/// The request to upload an artifact.
1925///
1926/// # Activities
1927///
1928/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1929/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1930///
1931/// * [locations repositories yum artifacts upload projects](ProjectLocationRepositoryYumArtifactUploadCall) (request)
1932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1933#[serde_with::serde_as]
1934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1935pub struct UploadYumArtifactRequest {
1936    _never_set: Option<bool>,
1937}
1938
1939impl common::RequestValue for UploadYumArtifactRequest {}
1940
1941/// The credentials to access the remote repository.
1942///
1943/// This type is not used in any activity, and only used as *part* of another schema.
1944///
1945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1946#[serde_with::serde_as]
1947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1948pub struct UpstreamCredentials {
1949    /// Use username and password to access the remote repository.
1950    #[serde(rename = "usernamePasswordCredentials")]
1951    pub username_password_credentials: Option<UsernamePasswordCredentials>,
1952}
1953
1954impl common::Part for UpstreamCredentials {}
1955
1956/// Artifact policy configuration for the repository contents.
1957///
1958/// This type is not used in any activity, and only used as *part* of another schema.
1959///
1960#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1961#[serde_with::serde_as]
1962#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1963pub struct UpstreamPolicy {
1964    /// The user-provided ID of the upstream policy.
1965    pub id: Option<String>,
1966    /// Entries with a greater priority value take precedence in the pull order.
1967    pub priority: Option<i32>,
1968    /// A reference to the repository resource, for example: `projects/p1/locations/us-central1/repositories/repo1`.
1969    pub repository: Option<String>,
1970}
1971
1972impl common::Part for UpstreamPolicy {}
1973
1974/// Username and password credentials.
1975///
1976/// This type is not used in any activity, and only used as *part* of another schema.
1977///
1978#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1979#[serde_with::serde_as]
1980#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1981pub struct UsernamePasswordCredentials {
1982    /// The Secret Manager key version that holds the password to access the remote repository. Must be in the format of `projects/{project}/secrets/{secret}/versions/{version}`.
1983    #[serde(rename = "passwordSecretVersion")]
1984    pub password_secret_version: Option<String>,
1985    /// The username to access the remote repository.
1986    pub username: Option<String>,
1987}
1988
1989impl common::Part for UsernamePasswordCredentials {}
1990
1991/// The Artifact Registry VPC SC config that apply to a Project.
1992///
1993/// # Activities
1994///
1995/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1996/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1997///
1998/// * [locations get vpcsc config projects](ProjectLocationGetVpcscConfigCall) (response)
1999/// * [locations update vpcsc config projects](ProjectLocationUpdateVpcscConfigCall) (request|response)
2000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2001#[serde_with::serde_as]
2002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2003pub struct VPCSCConfig {
2004    /// The name of the project's VPC SC Config. Always of the form: projects/{projectID}/locations/{location}/vpcscConfig In update request: never set In response: always set
2005    pub name: Option<String>,
2006    /// The project per location VPC SC policy that defines the VPC SC behavior for the Remote Repository (Allow/Deny).
2007    #[serde(rename = "vpcscPolicy")]
2008    pub vpcsc_policy: Option<String>,
2009}
2010
2011impl common::RequestValue for VPCSCConfig {}
2012impl common::ResponseResult for VPCSCConfig {}
2013
2014/// The body of a version resource. A version resource represents a collection of components, such as files and other data. This may correspond to a version in many package management schemes.
2015///
2016/// # Activities
2017///
2018/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2019/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2020///
2021/// * [locations repositories packages versions get projects](ProjectLocationRepositoryPackageVersionGetCall) (response)
2022/// * [locations repositories packages versions patch projects](ProjectLocationRepositoryPackageVersionPatchCall) (request|response)
2023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2024#[serde_with::serde_as]
2025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2026pub struct Version {
2027    /// Optional. Client specified annotations.
2028    pub annotations: Option<HashMap<String, String>>,
2029    /// The time when the version was created.
2030    #[serde(rename = "createTime")]
2031    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2032    /// Optional. Description of the version, as specified in its metadata.
2033    pub description: Option<String>,
2034    /// Output only. Repository-specific Metadata stored against this version. The fields returned are defined by the underlying repository-specific resource. Currently, the resources could be: DockerImage MavenArtifact
2035    pub metadata: Option<HashMap<String, serde_json::Value>>,
2036    /// The name of the version, for example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1`. If the package or version ID parts contain slashes, the slashes are escaped.
2037    pub name: Option<String>,
2038    /// Output only. A list of related tags. Will contain up to 100 tags that reference this version.
2039    #[serde(rename = "relatedTags")]
2040    pub related_tags: Option<Vec<Tag>>,
2041    /// The time when the version was last updated.
2042    #[serde(rename = "updateTime")]
2043    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2044}
2045
2046impl common::RequestValue for Version {}
2047impl common::ResponseResult for Version {}
2048
2049/// Virtual repository configuration.
2050///
2051/// This type is not used in any activity, and only used as *part* of another schema.
2052///
2053#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2054#[serde_with::serde_as]
2055#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2056pub struct VirtualRepositoryConfig {
2057    /// Policies that configure the upstream artifacts distributed by the Virtual Repository. Upstream policies cannot be set on a standard repository.
2058    #[serde(rename = "upstreamPolicies")]
2059    pub upstream_policies: Option<Vec<UpstreamPolicy>>,
2060}
2061
2062impl common::Part for VirtualRepositoryConfig {}
2063
2064/// Config on whether to perform vulnerability scanning for resources in this repository, as well as output fields describing current state.
2065///
2066/// This type is not used in any activity, and only used as *part* of another schema.
2067///
2068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2069#[serde_with::serde_as]
2070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2071pub struct VulnerabilityScanningConfig {
2072    /// Optional. Config for whether this repository has vulnerability scanning disabled.
2073    #[serde(rename = "enablementConfig")]
2074    pub enablement_config: Option<String>,
2075    /// Output only. State of feature enablement, combining repository enablement config and API enablement state.
2076    #[serde(rename = "enablementState")]
2077    pub enablement_state: Option<String>,
2078    /// Output only. Reason for the repository state.
2079    #[serde(rename = "enablementStateReason")]
2080    pub enablement_state_reason: Option<String>,
2081    /// Output only. The last time this repository config was enabled.
2082    #[serde(rename = "lastEnableTime")]
2083    pub last_enable_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2084}
2085
2086impl common::Part for VulnerabilityScanningConfig {}
2087
2088/// Configuration for a Yum remote repository.
2089///
2090/// This type is not used in any activity, and only used as *part* of another schema.
2091///
2092#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2093#[serde_with::serde_as]
2094#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2095pub struct YumRepository {
2096    /// Customer-specified remote repository.
2097    #[serde(rename = "customRepository")]
2098    pub custom_repository:
2099        Option<GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryCustomRepository>,
2100    /// One of the publicly available Yum repositories supported by Artifact Registry.
2101    #[serde(rename = "publicRepository")]
2102    pub public_repository:
2103        Option<GoogleDevtoolsArtifactregistryV1RemoteRepositoryConfigYumRepositoryPublicRepository>,
2104}
2105
2106impl common::Part for YumRepository {}
2107
2108// ###################
2109// MethodBuilders ###
2110// #################
2111
2112/// A builder providing access to all methods supported on *project* resources.
2113/// It is not used directly, but through the [`ArtifactRegistry`] hub.
2114///
2115/// # Example
2116///
2117/// Instantiate a resource builder
2118///
2119/// ```test_harness,no_run
2120/// extern crate hyper;
2121/// extern crate hyper_rustls;
2122/// extern crate google_artifactregistry1 as artifactregistry1;
2123///
2124/// # async fn dox() {
2125/// use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2126///
2127/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2128/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2129///     .with_native_roots()
2130///     .unwrap()
2131///     .https_only()
2132///     .enable_http2()
2133///     .build();
2134///
2135/// let executor = hyper_util::rt::TokioExecutor::new();
2136/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2137///     secret,
2138///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2139///     yup_oauth2::client::CustomHyperClientBuilder::from(
2140///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2141///     ),
2142/// ).build().await.unwrap();
2143///
2144/// let client = hyper_util::client::legacy::Client::builder(
2145///     hyper_util::rt::TokioExecutor::new()
2146/// )
2147/// .build(
2148///     hyper_rustls::HttpsConnectorBuilder::new()
2149///         .with_native_roots()
2150///         .unwrap()
2151///         .https_or_http()
2152///         .enable_http2()
2153///         .build()
2154/// );
2155/// let mut hub = ArtifactRegistry::new(client, auth);
2156/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2157/// // like `get_project_settings(...)`, `locations_get(...)`, `locations_get_vpcsc_config(...)`, `locations_list(...)`, `locations_operations_get(...)`, `locations_repositories_apt_artifacts_import(...)`, `locations_repositories_apt_artifacts_upload(...)`, `locations_repositories_attachments_create(...)`, `locations_repositories_attachments_delete(...)`, `locations_repositories_attachments_get(...)`, `locations_repositories_attachments_list(...)`, `locations_repositories_create(...)`, `locations_repositories_delete(...)`, `locations_repositories_docker_images_get(...)`, `locations_repositories_docker_images_list(...)`, `locations_repositories_export_artifact(...)`, `locations_repositories_files_delete(...)`, `locations_repositories_files_download(...)`, `locations_repositories_files_get(...)`, `locations_repositories_files_list(...)`, `locations_repositories_files_patch(...)`, `locations_repositories_files_upload(...)`, `locations_repositories_generic_artifacts_upload(...)`, `locations_repositories_get(...)`, `locations_repositories_get_iam_policy(...)`, `locations_repositories_go_modules_upload(...)`, `locations_repositories_googet_artifacts_import(...)`, `locations_repositories_googet_artifacts_upload(...)`, `locations_repositories_kfp_artifacts_upload(...)`, `locations_repositories_list(...)`, `locations_repositories_maven_artifacts_get(...)`, `locations_repositories_maven_artifacts_list(...)`, `locations_repositories_npm_packages_get(...)`, `locations_repositories_npm_packages_list(...)`, `locations_repositories_packages_delete(...)`, `locations_repositories_packages_get(...)`, `locations_repositories_packages_list(...)`, `locations_repositories_packages_patch(...)`, `locations_repositories_packages_tags_create(...)`, `locations_repositories_packages_tags_delete(...)`, `locations_repositories_packages_tags_get(...)`, `locations_repositories_packages_tags_list(...)`, `locations_repositories_packages_tags_patch(...)`, `locations_repositories_packages_versions_batch_delete(...)`, `locations_repositories_packages_versions_delete(...)`, `locations_repositories_packages_versions_get(...)`, `locations_repositories_packages_versions_list(...)`, `locations_repositories_packages_versions_patch(...)`, `locations_repositories_patch(...)`, `locations_repositories_python_packages_get(...)`, `locations_repositories_python_packages_list(...)`, `locations_repositories_rules_create(...)`, `locations_repositories_rules_delete(...)`, `locations_repositories_rules_get(...)`, `locations_repositories_rules_list(...)`, `locations_repositories_rules_patch(...)`, `locations_repositories_set_iam_policy(...)`, `locations_repositories_test_iam_permissions(...)`, `locations_repositories_yum_artifacts_import(...)`, `locations_repositories_yum_artifacts_upload(...)`, `locations_update_vpcsc_config(...)` and `update_project_settings(...)`
2158/// // to build up your call.
2159/// let rb = hub.projects();
2160/// # }
2161/// ```
2162pub struct ProjectMethods<'a, C>
2163where
2164    C: 'a,
2165{
2166    hub: &'a ArtifactRegistry<C>,
2167}
2168
2169impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2170
2171impl<'a, C> ProjectMethods<'a, C> {
2172    /// Create a builder to help you perform the following task:
2173    ///
2174    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2175    ///
2176    /// # Arguments
2177    ///
2178    /// * `name` - The name of the operation resource.
2179    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2180        ProjectLocationOperationGetCall {
2181            hub: self.hub,
2182            _name: name.to_string(),
2183            _delegate: Default::default(),
2184            _additional_params: Default::default(),
2185            _scopes: Default::default(),
2186        }
2187    }
2188
2189    /// Create a builder to help you perform the following task:
2190    ///
2191    /// Imports Apt artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.
2192    ///
2193    /// # Arguments
2194    ///
2195    /// * `request` - No description provided.
2196    /// * `parent` - The name of the parent resource where the artifacts will be imported.
2197    pub fn locations_repositories_apt_artifacts_import(
2198        &self,
2199        request: ImportAptArtifactsRequest,
2200        parent: &str,
2201    ) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C> {
2202        ProjectLocationRepositoryAptArtifactImportCall {
2203            hub: self.hub,
2204            _request: request,
2205            _parent: parent.to_string(),
2206            _delegate: Default::default(),
2207            _additional_params: Default::default(),
2208            _scopes: Default::default(),
2209        }
2210    }
2211
2212    /// Create a builder to help you perform the following task:
2213    ///
2214    /// Directly uploads an Apt artifact. The returned Operation will complete once the resources are uploaded. Package, Version, and File resources are created based on the imported artifact. Imported artifacts that conflict with existing resources are ignored.
2215    ///
2216    /// # Arguments
2217    ///
2218    /// * `request` - No description provided.
2219    /// * `parent` - The name of the parent resource where the artifacts will be uploaded.
2220    pub fn locations_repositories_apt_artifacts_upload(
2221        &self,
2222        request: UploadAptArtifactRequest,
2223        parent: &str,
2224    ) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C> {
2225        ProjectLocationRepositoryAptArtifactUploadCall {
2226            hub: self.hub,
2227            _request: request,
2228            _parent: parent.to_string(),
2229            _delegate: Default::default(),
2230            _additional_params: Default::default(),
2231            _scopes: Default::default(),
2232        }
2233    }
2234
2235    /// Create a builder to help you perform the following task:
2236    ///
2237    /// Creates an attachment. The returned Operation will finish once the attachment has been created. Its response will be the created attachment.
2238    ///
2239    /// # Arguments
2240    ///
2241    /// * `request` - No description provided.
2242    /// * `parent` - Required. The name of the parent resource where the attachment will be created.
2243    pub fn locations_repositories_attachments_create(
2244        &self,
2245        request: Attachment,
2246        parent: &str,
2247    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C> {
2248        ProjectLocationRepositoryAttachmentCreateCall {
2249            hub: self.hub,
2250            _request: request,
2251            _parent: parent.to_string(),
2252            _attachment_id: Default::default(),
2253            _delegate: Default::default(),
2254            _additional_params: Default::default(),
2255            _scopes: Default::default(),
2256        }
2257    }
2258
2259    /// Create a builder to help you perform the following task:
2260    ///
2261    /// Deletes an attachment. The returned Operation will finish once the attachments has been deleted. It will not have any Operation metadata and will return a `google.protobuf.Empty` response.
2262    ///
2263    /// # Arguments
2264    ///
2265    /// * `name` - Required. The name of the attachment to delete.
2266    pub fn locations_repositories_attachments_delete(
2267        &self,
2268        name: &str,
2269    ) -> ProjectLocationRepositoryAttachmentDeleteCall<'a, C> {
2270        ProjectLocationRepositoryAttachmentDeleteCall {
2271            hub: self.hub,
2272            _name: name.to_string(),
2273            _delegate: Default::default(),
2274            _additional_params: Default::default(),
2275            _scopes: Default::default(),
2276        }
2277    }
2278
2279    /// Create a builder to help you perform the following task:
2280    ///
2281    /// Gets an attachment.
2282    ///
2283    /// # Arguments
2284    ///
2285    /// * `name` - Required. The name of the attachment to retrieve.
2286    pub fn locations_repositories_attachments_get(
2287        &self,
2288        name: &str,
2289    ) -> ProjectLocationRepositoryAttachmentGetCall<'a, C> {
2290        ProjectLocationRepositoryAttachmentGetCall {
2291            hub: self.hub,
2292            _name: name.to_string(),
2293            _delegate: Default::default(),
2294            _additional_params: Default::default(),
2295            _scopes: Default::default(),
2296        }
2297    }
2298
2299    /// Create a builder to help you perform the following task:
2300    ///
2301    /// Lists attachments.
2302    ///
2303    /// # Arguments
2304    ///
2305    /// * `parent` - Required. The name of the parent resource whose attachments will be listed.
2306    pub fn locations_repositories_attachments_list(
2307        &self,
2308        parent: &str,
2309    ) -> ProjectLocationRepositoryAttachmentListCall<'a, C> {
2310        ProjectLocationRepositoryAttachmentListCall {
2311            hub: self.hub,
2312            _parent: parent.to_string(),
2313            _page_token: Default::default(),
2314            _page_size: Default::default(),
2315            _filter: Default::default(),
2316            _delegate: Default::default(),
2317            _additional_params: Default::default(),
2318            _scopes: Default::default(),
2319        }
2320    }
2321
2322    /// Create a builder to help you perform the following task:
2323    ///
2324    /// Gets a docker image.
2325    ///
2326    /// # Arguments
2327    ///
2328    /// * `name` - Required. The name of the docker images.
2329    pub fn locations_repositories_docker_images_get(
2330        &self,
2331        name: &str,
2332    ) -> ProjectLocationRepositoryDockerImageGetCall<'a, C> {
2333        ProjectLocationRepositoryDockerImageGetCall {
2334            hub: self.hub,
2335            _name: name.to_string(),
2336            _delegate: Default::default(),
2337            _additional_params: Default::default(),
2338            _scopes: Default::default(),
2339        }
2340    }
2341
2342    /// Create a builder to help you perform the following task:
2343    ///
2344    /// Lists docker images.
2345    ///
2346    /// # Arguments
2347    ///
2348    /// * `parent` - Required. The name of the parent resource whose docker images will be listed.
2349    pub fn locations_repositories_docker_images_list(
2350        &self,
2351        parent: &str,
2352    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C> {
2353        ProjectLocationRepositoryDockerImageListCall {
2354            hub: self.hub,
2355            _parent: parent.to_string(),
2356            _page_token: Default::default(),
2357            _page_size: Default::default(),
2358            _order_by: Default::default(),
2359            _delegate: Default::default(),
2360            _additional_params: Default::default(),
2361            _scopes: Default::default(),
2362        }
2363    }
2364
2365    /// Create a builder to help you perform the following task:
2366    ///
2367    /// Deletes a file and all of its content. It is only allowed on generic repositories. The returned operation will complete once the file has been deleted.
2368    ///
2369    /// # Arguments
2370    ///
2371    /// * `name` - Required. The name of the file to delete.
2372    pub fn locations_repositories_files_delete(
2373        &self,
2374        name: &str,
2375    ) -> ProjectLocationRepositoryFileDeleteCall<'a, C> {
2376        ProjectLocationRepositoryFileDeleteCall {
2377            hub: self.hub,
2378            _name: name.to_string(),
2379            _delegate: Default::default(),
2380            _additional_params: Default::default(),
2381            _scopes: Default::default(),
2382        }
2383    }
2384
2385    /// Create a builder to help you perform the following task:
2386    ///
2387    /// Download a file.
2388    ///
2389    /// # Arguments
2390    ///
2391    /// * `name` - Required. The name of the file to download.
2392    pub fn locations_repositories_files_download(
2393        &self,
2394        name: &str,
2395    ) -> ProjectLocationRepositoryFileDownloadCall<'a, C> {
2396        ProjectLocationRepositoryFileDownloadCall {
2397            hub: self.hub,
2398            _name: name.to_string(),
2399            _delegate: Default::default(),
2400            _additional_params: Default::default(),
2401            _scopes: Default::default(),
2402        }
2403    }
2404
2405    /// Create a builder to help you perform the following task:
2406    ///
2407    /// Gets a file.
2408    ///
2409    /// # Arguments
2410    ///
2411    /// * `name` - Required. The name of the file to retrieve.
2412    pub fn locations_repositories_files_get(
2413        &self,
2414        name: &str,
2415    ) -> ProjectLocationRepositoryFileGetCall<'a, C> {
2416        ProjectLocationRepositoryFileGetCall {
2417            hub: self.hub,
2418            _name: name.to_string(),
2419            _delegate: Default::default(),
2420            _additional_params: Default::default(),
2421            _scopes: Default::default(),
2422        }
2423    }
2424
2425    /// Create a builder to help you perform the following task:
2426    ///
2427    /// Lists files.
2428    ///
2429    /// # Arguments
2430    ///
2431    /// * `parent` - Required. The name of the repository whose files will be listed. For example: "projects/p1/locations/us-central1/repositories/repo1
2432    pub fn locations_repositories_files_list(
2433        &self,
2434        parent: &str,
2435    ) -> ProjectLocationRepositoryFileListCall<'a, C> {
2436        ProjectLocationRepositoryFileListCall {
2437            hub: self.hub,
2438            _parent: parent.to_string(),
2439            _page_token: Default::default(),
2440            _page_size: Default::default(),
2441            _order_by: Default::default(),
2442            _filter: Default::default(),
2443            _delegate: Default::default(),
2444            _additional_params: Default::default(),
2445            _scopes: Default::default(),
2446        }
2447    }
2448
2449    /// Create a builder to help you perform the following task:
2450    ///
2451    /// Updates a file.
2452    ///
2453    /// # Arguments
2454    ///
2455    /// * `request` - No description provided.
2456    /// * `name` - The name of the file, for example: `projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt`. If the file ID part contains slashes, they are escaped.
2457    pub fn locations_repositories_files_patch(
2458        &self,
2459        request: GoogleDevtoolsArtifactregistryV1File,
2460        name: &str,
2461    ) -> ProjectLocationRepositoryFilePatchCall<'a, C> {
2462        ProjectLocationRepositoryFilePatchCall {
2463            hub: self.hub,
2464            _request: request,
2465            _name: name.to_string(),
2466            _update_mask: Default::default(),
2467            _delegate: Default::default(),
2468            _additional_params: Default::default(),
2469            _scopes: Default::default(),
2470        }
2471    }
2472
2473    /// Create a builder to help you perform the following task:
2474    ///
2475    /// Directly uploads a file to a repository. The returned Operation will complete once the resources are uploaded.
2476    ///
2477    /// # Arguments
2478    ///
2479    /// * `request` - No description provided.
2480    /// * `parent` - Required. The resource name of the repository where the file will be uploaded.
2481    pub fn locations_repositories_files_upload(
2482        &self,
2483        request: UploadFileRequest,
2484        parent: &str,
2485    ) -> ProjectLocationRepositoryFileUploadCall<'a, C> {
2486        ProjectLocationRepositoryFileUploadCall {
2487            hub: self.hub,
2488            _request: request,
2489            _parent: parent.to_string(),
2490            _delegate: Default::default(),
2491            _additional_params: Default::default(),
2492            _scopes: Default::default(),
2493        }
2494    }
2495
2496    /// Create a builder to help you perform the following task:
2497    ///
2498    /// Directly uploads a Generic artifact. The returned operation will complete once the resources are uploaded. Package, version, and file resources are created based on the uploaded artifact. Uploaded artifacts that conflict with existing resources will raise an `ALREADY_EXISTS` error.
2499    ///
2500    /// # Arguments
2501    ///
2502    /// * `request` - No description provided.
2503    /// * `parent` - The resource name of the repository where the generic artifact will be uploaded.
2504    pub fn locations_repositories_generic_artifacts_upload(
2505        &self,
2506        request: UploadGenericArtifactRequest,
2507        parent: &str,
2508    ) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C> {
2509        ProjectLocationRepositoryGenericArtifactUploadCall {
2510            hub: self.hub,
2511            _request: request,
2512            _parent: parent.to_string(),
2513            _delegate: Default::default(),
2514            _additional_params: Default::default(),
2515            _scopes: Default::default(),
2516        }
2517    }
2518
2519    /// Create a builder to help you perform the following task:
2520    ///
2521    /// Directly uploads a Go module. The returned Operation will complete once the Go module is uploaded. Package, Version, and File resources are created based on the uploaded Go module.
2522    ///
2523    /// # Arguments
2524    ///
2525    /// * `request` - No description provided.
2526    /// * `parent` - The resource name of the repository where the Go module will be uploaded.
2527    pub fn locations_repositories_go_modules_upload(
2528        &self,
2529        request: UploadGoModuleRequest,
2530        parent: &str,
2531    ) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C> {
2532        ProjectLocationRepositoryGoModuleUploadCall {
2533            hub: self.hub,
2534            _request: request,
2535            _parent: parent.to_string(),
2536            _delegate: Default::default(),
2537            _additional_params: Default::default(),
2538            _scopes: Default::default(),
2539        }
2540    }
2541
2542    /// Create a builder to help you perform the following task:
2543    ///
2544    /// Imports GooGet artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.
2545    ///
2546    /// # Arguments
2547    ///
2548    /// * `request` - No description provided.
2549    /// * `parent` - The name of the parent resource where the artifacts will be imported.
2550    pub fn locations_repositories_googet_artifacts_import(
2551        &self,
2552        request: ImportGoogetArtifactsRequest,
2553        parent: &str,
2554    ) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C> {
2555        ProjectLocationRepositoryGoogetArtifactImportCall {
2556            hub: self.hub,
2557            _request: request,
2558            _parent: parent.to_string(),
2559            _delegate: Default::default(),
2560            _additional_params: Default::default(),
2561            _scopes: Default::default(),
2562        }
2563    }
2564
2565    /// Create a builder to help you perform the following task:
2566    ///
2567    /// Directly uploads a GooGet artifact. The returned Operation will complete once the resources are uploaded. Package, Version, and File resources are created based on the imported artifact. Imported artifacts that conflict with existing resources are ignored.
2568    ///
2569    /// # Arguments
2570    ///
2571    /// * `request` - No description provided.
2572    /// * `parent` - The name of the parent resource where the artifacts will be uploaded.
2573    pub fn locations_repositories_googet_artifacts_upload(
2574        &self,
2575        request: UploadGoogetArtifactRequest,
2576        parent: &str,
2577    ) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C> {
2578        ProjectLocationRepositoryGoogetArtifactUploadCall {
2579            hub: self.hub,
2580            _request: request,
2581            _parent: parent.to_string(),
2582            _delegate: Default::default(),
2583            _additional_params: Default::default(),
2584            _scopes: Default::default(),
2585        }
2586    }
2587
2588    /// Create a builder to help you perform the following task:
2589    ///
2590    /// Directly uploads a KFP artifact. The returned Operation will complete once the resource is uploaded. Package, Version, and File resources will be created based on the uploaded artifact. Uploaded artifacts that conflict with existing resources will be overwritten.
2591    ///
2592    /// # Arguments
2593    ///
2594    /// * `request` - No description provided.
2595    /// * `parent` - The resource name of the repository where the KFP artifact will be uploaded.
2596    pub fn locations_repositories_kfp_artifacts_upload(
2597        &self,
2598        request: UploadKfpArtifactRequest,
2599        parent: &str,
2600    ) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C> {
2601        ProjectLocationRepositoryKfpArtifactUploadCall {
2602            hub: self.hub,
2603            _request: request,
2604            _parent: parent.to_string(),
2605            _delegate: Default::default(),
2606            _additional_params: Default::default(),
2607            _scopes: Default::default(),
2608        }
2609    }
2610
2611    /// Create a builder to help you perform the following task:
2612    ///
2613    /// Gets a maven artifact.
2614    ///
2615    /// # Arguments
2616    ///
2617    /// * `name` - Required. The name of the maven artifact.
2618    pub fn locations_repositories_maven_artifacts_get(
2619        &self,
2620        name: &str,
2621    ) -> ProjectLocationRepositoryMavenArtifactGetCall<'a, C> {
2622        ProjectLocationRepositoryMavenArtifactGetCall {
2623            hub: self.hub,
2624            _name: name.to_string(),
2625            _delegate: Default::default(),
2626            _additional_params: Default::default(),
2627            _scopes: Default::default(),
2628        }
2629    }
2630
2631    /// Create a builder to help you perform the following task:
2632    ///
2633    /// Lists maven artifacts.
2634    ///
2635    /// # Arguments
2636    ///
2637    /// * `parent` - Required. The name of the parent resource whose maven artifacts will be listed.
2638    pub fn locations_repositories_maven_artifacts_list(
2639        &self,
2640        parent: &str,
2641    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C> {
2642        ProjectLocationRepositoryMavenArtifactListCall {
2643            hub: self.hub,
2644            _parent: parent.to_string(),
2645            _page_token: Default::default(),
2646            _page_size: Default::default(),
2647            _delegate: Default::default(),
2648            _additional_params: Default::default(),
2649            _scopes: Default::default(),
2650        }
2651    }
2652
2653    /// Create a builder to help you perform the following task:
2654    ///
2655    /// Gets a npm package.
2656    ///
2657    /// # Arguments
2658    ///
2659    /// * `name` - Required. The name of the npm package.
2660    pub fn locations_repositories_npm_packages_get(
2661        &self,
2662        name: &str,
2663    ) -> ProjectLocationRepositoryNpmPackageGetCall<'a, C> {
2664        ProjectLocationRepositoryNpmPackageGetCall {
2665            hub: self.hub,
2666            _name: name.to_string(),
2667            _delegate: Default::default(),
2668            _additional_params: Default::default(),
2669            _scopes: Default::default(),
2670        }
2671    }
2672
2673    /// Create a builder to help you perform the following task:
2674    ///
2675    /// Lists npm packages.
2676    ///
2677    /// # Arguments
2678    ///
2679    /// * `parent` - Required. The name of the parent resource whose npm packages will be listed.
2680    pub fn locations_repositories_npm_packages_list(
2681        &self,
2682        parent: &str,
2683    ) -> ProjectLocationRepositoryNpmPackageListCall<'a, C> {
2684        ProjectLocationRepositoryNpmPackageListCall {
2685            hub: self.hub,
2686            _parent: parent.to_string(),
2687            _page_token: Default::default(),
2688            _page_size: Default::default(),
2689            _delegate: Default::default(),
2690            _additional_params: Default::default(),
2691            _scopes: Default::default(),
2692        }
2693    }
2694
2695    /// Create a builder to help you perform the following task:
2696    ///
2697    /// Creates a tag.
2698    ///
2699    /// # Arguments
2700    ///
2701    /// * `request` - No description provided.
2702    /// * `parent` - The name of the parent resource where the tag will be created.
2703    pub fn locations_repositories_packages_tags_create(
2704        &self,
2705        request: Tag,
2706        parent: &str,
2707    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
2708        ProjectLocationRepositoryPackageTagCreateCall {
2709            hub: self.hub,
2710            _request: request,
2711            _parent: parent.to_string(),
2712            _tag_id: Default::default(),
2713            _delegate: Default::default(),
2714            _additional_params: Default::default(),
2715            _scopes: Default::default(),
2716        }
2717    }
2718
2719    /// Create a builder to help you perform the following task:
2720    ///
2721    /// Deletes a tag.
2722    ///
2723    /// # Arguments
2724    ///
2725    /// * `name` - The name of the tag to delete.
2726    pub fn locations_repositories_packages_tags_delete(
2727        &self,
2728        name: &str,
2729    ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
2730        ProjectLocationRepositoryPackageTagDeleteCall {
2731            hub: self.hub,
2732            _name: name.to_string(),
2733            _delegate: Default::default(),
2734            _additional_params: Default::default(),
2735            _scopes: Default::default(),
2736        }
2737    }
2738
2739    /// Create a builder to help you perform the following task:
2740    ///
2741    /// Gets a tag.
2742    ///
2743    /// # Arguments
2744    ///
2745    /// * `name` - The name of the tag to retrieve.
2746    pub fn locations_repositories_packages_tags_get(
2747        &self,
2748        name: &str,
2749    ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
2750        ProjectLocationRepositoryPackageTagGetCall {
2751            hub: self.hub,
2752            _name: name.to_string(),
2753            _delegate: Default::default(),
2754            _additional_params: Default::default(),
2755            _scopes: Default::default(),
2756        }
2757    }
2758
2759    /// Create a builder to help you perform the following task:
2760    ///
2761    /// Lists tags.
2762    ///
2763    /// # Arguments
2764    ///
2765    /// * `parent` - The name of the parent package whose tags will be listed. For example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1`.
2766    pub fn locations_repositories_packages_tags_list(
2767        &self,
2768        parent: &str,
2769    ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
2770        ProjectLocationRepositoryPackageTagListCall {
2771            hub: self.hub,
2772            _parent: parent.to_string(),
2773            _page_token: Default::default(),
2774            _page_size: Default::default(),
2775            _filter: Default::default(),
2776            _delegate: Default::default(),
2777            _additional_params: Default::default(),
2778            _scopes: Default::default(),
2779        }
2780    }
2781
2782    /// Create a builder to help you perform the following task:
2783    ///
2784    /// Updates a tag.
2785    ///
2786    /// # Arguments
2787    ///
2788    /// * `request` - No description provided.
2789    /// * `name` - The name of the tag, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". If the package part contains slashes, the slashes are escaped. The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else must be URL encoded.
2790    pub fn locations_repositories_packages_tags_patch(
2791        &self,
2792        request: Tag,
2793        name: &str,
2794    ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
2795        ProjectLocationRepositoryPackageTagPatchCall {
2796            hub: self.hub,
2797            _request: request,
2798            _name: name.to_string(),
2799            _update_mask: Default::default(),
2800            _delegate: Default::default(),
2801            _additional_params: Default::default(),
2802            _scopes: Default::default(),
2803        }
2804    }
2805
2806    /// Create a builder to help you perform the following task:
2807    ///
2808    /// Deletes multiple versions across a repository. The returned operation will complete once the versions have been deleted.
2809    ///
2810    /// # Arguments
2811    ///
2812    /// * `request` - No description provided.
2813    /// * `parent` - The name of the repository holding all requested versions.
2814    pub fn locations_repositories_packages_versions_batch_delete(
2815        &self,
2816        request: BatchDeleteVersionsRequest,
2817        parent: &str,
2818    ) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C> {
2819        ProjectLocationRepositoryPackageVersionBatchDeleteCall {
2820            hub: self.hub,
2821            _request: request,
2822            _parent: parent.to_string(),
2823            _delegate: Default::default(),
2824            _additional_params: Default::default(),
2825            _scopes: Default::default(),
2826        }
2827    }
2828
2829    /// Create a builder to help you perform the following task:
2830    ///
2831    /// Deletes a version and all of its content. The returned operation will complete once the version has been deleted.
2832    ///
2833    /// # Arguments
2834    ///
2835    /// * `name` - The name of the version to delete.
2836    pub fn locations_repositories_packages_versions_delete(
2837        &self,
2838        name: &str,
2839    ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
2840        ProjectLocationRepositoryPackageVersionDeleteCall {
2841            hub: self.hub,
2842            _name: name.to_string(),
2843            _force: Default::default(),
2844            _delegate: Default::default(),
2845            _additional_params: Default::default(),
2846            _scopes: Default::default(),
2847        }
2848    }
2849
2850    /// Create a builder to help you perform the following task:
2851    ///
2852    /// Gets a version
2853    ///
2854    /// # Arguments
2855    ///
2856    /// * `name` - The name of the version to retrieve.
2857    pub fn locations_repositories_packages_versions_get(
2858        &self,
2859        name: &str,
2860    ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
2861        ProjectLocationRepositoryPackageVersionGetCall {
2862            hub: self.hub,
2863            _name: name.to_string(),
2864            _view: Default::default(),
2865            _delegate: Default::default(),
2866            _additional_params: Default::default(),
2867            _scopes: Default::default(),
2868        }
2869    }
2870
2871    /// Create a builder to help you perform the following task:
2872    ///
2873    /// Lists versions.
2874    ///
2875    /// # Arguments
2876    ///
2877    /// * `parent` - The name of the parent resource whose versions will be listed.
2878    pub fn locations_repositories_packages_versions_list(
2879        &self,
2880        parent: &str,
2881    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
2882        ProjectLocationRepositoryPackageVersionListCall {
2883            hub: self.hub,
2884            _parent: parent.to_string(),
2885            _view: Default::default(),
2886            _page_token: Default::default(),
2887            _page_size: Default::default(),
2888            _order_by: Default::default(),
2889            _filter: Default::default(),
2890            _delegate: Default::default(),
2891            _additional_params: Default::default(),
2892            _scopes: Default::default(),
2893        }
2894    }
2895
2896    /// Create a builder to help you perform the following task:
2897    ///
2898    /// Updates a version.
2899    ///
2900    /// # Arguments
2901    ///
2902    /// * `request` - No description provided.
2903    /// * `name` - The name of the version, for example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1`. If the package or version ID parts contain slashes, the slashes are escaped.
2904    pub fn locations_repositories_packages_versions_patch(
2905        &self,
2906        request: Version,
2907        name: &str,
2908    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C> {
2909        ProjectLocationRepositoryPackageVersionPatchCall {
2910            hub: self.hub,
2911            _request: request,
2912            _name: name.to_string(),
2913            _update_mask: Default::default(),
2914            _delegate: Default::default(),
2915            _additional_params: Default::default(),
2916            _scopes: Default::default(),
2917        }
2918    }
2919
2920    /// Create a builder to help you perform the following task:
2921    ///
2922    /// Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.
2923    ///
2924    /// # Arguments
2925    ///
2926    /// * `name` - Required. The name of the package to delete.
2927    pub fn locations_repositories_packages_delete(
2928        &self,
2929        name: &str,
2930    ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
2931        ProjectLocationRepositoryPackageDeleteCall {
2932            hub: self.hub,
2933            _name: name.to_string(),
2934            _delegate: Default::default(),
2935            _additional_params: Default::default(),
2936            _scopes: Default::default(),
2937        }
2938    }
2939
2940    /// Create a builder to help you perform the following task:
2941    ///
2942    /// Gets a package.
2943    ///
2944    /// # Arguments
2945    ///
2946    /// * `name` - Required. The name of the package to retrieve.
2947    pub fn locations_repositories_packages_get(
2948        &self,
2949        name: &str,
2950    ) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
2951        ProjectLocationRepositoryPackageGetCall {
2952            hub: self.hub,
2953            _name: name.to_string(),
2954            _delegate: Default::default(),
2955            _additional_params: Default::default(),
2956            _scopes: Default::default(),
2957        }
2958    }
2959
2960    /// Create a builder to help you perform the following task:
2961    ///
2962    /// Lists packages.
2963    ///
2964    /// # Arguments
2965    ///
2966    /// * `parent` - Required. The name of the parent resource whose packages will be listed.
2967    pub fn locations_repositories_packages_list(
2968        &self,
2969        parent: &str,
2970    ) -> ProjectLocationRepositoryPackageListCall<'a, C> {
2971        ProjectLocationRepositoryPackageListCall {
2972            hub: self.hub,
2973            _parent: parent.to_string(),
2974            _page_token: Default::default(),
2975            _page_size: Default::default(),
2976            _order_by: Default::default(),
2977            _filter: Default::default(),
2978            _delegate: Default::default(),
2979            _additional_params: Default::default(),
2980            _scopes: Default::default(),
2981        }
2982    }
2983
2984    /// Create a builder to help you perform the following task:
2985    ///
2986    /// Updates a package.
2987    ///
2988    /// # Arguments
2989    ///
2990    /// * `request` - No description provided.
2991    /// * `name` - The name of the package, for example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1`. If the package ID part contains slashes, the slashes are escaped.
2992    pub fn locations_repositories_packages_patch(
2993        &self,
2994        request: Package,
2995        name: &str,
2996    ) -> ProjectLocationRepositoryPackagePatchCall<'a, C> {
2997        ProjectLocationRepositoryPackagePatchCall {
2998            hub: self.hub,
2999            _request: request,
3000            _name: name.to_string(),
3001            _update_mask: Default::default(),
3002            _delegate: Default::default(),
3003            _additional_params: Default::default(),
3004            _scopes: Default::default(),
3005        }
3006    }
3007
3008    /// Create a builder to help you perform the following task:
3009    ///
3010    /// Gets a python package.
3011    ///
3012    /// # Arguments
3013    ///
3014    /// * `name` - Required. The name of the python package.
3015    pub fn locations_repositories_python_packages_get(
3016        &self,
3017        name: &str,
3018    ) -> ProjectLocationRepositoryPythonPackageGetCall<'a, C> {
3019        ProjectLocationRepositoryPythonPackageGetCall {
3020            hub: self.hub,
3021            _name: name.to_string(),
3022            _delegate: Default::default(),
3023            _additional_params: Default::default(),
3024            _scopes: Default::default(),
3025        }
3026    }
3027
3028    /// Create a builder to help you perform the following task:
3029    ///
3030    /// Lists python packages.
3031    ///
3032    /// # Arguments
3033    ///
3034    /// * `parent` - Required. The name of the parent resource whose python packages will be listed.
3035    pub fn locations_repositories_python_packages_list(
3036        &self,
3037        parent: &str,
3038    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C> {
3039        ProjectLocationRepositoryPythonPackageListCall {
3040            hub: self.hub,
3041            _parent: parent.to_string(),
3042            _page_token: Default::default(),
3043            _page_size: Default::default(),
3044            _delegate: Default::default(),
3045            _additional_params: Default::default(),
3046            _scopes: Default::default(),
3047        }
3048    }
3049
3050    /// Create a builder to help you perform the following task:
3051    ///
3052    /// Creates a rule.
3053    ///
3054    /// # Arguments
3055    ///
3056    /// * `request` - No description provided.
3057    /// * `parent` - Required. The name of the parent resource where the rule will be created.
3058    pub fn locations_repositories_rules_create(
3059        &self,
3060        request: GoogleDevtoolsArtifactregistryV1Rule,
3061        parent: &str,
3062    ) -> ProjectLocationRepositoryRuleCreateCall<'a, C> {
3063        ProjectLocationRepositoryRuleCreateCall {
3064            hub: self.hub,
3065            _request: request,
3066            _parent: parent.to_string(),
3067            _rule_id: Default::default(),
3068            _delegate: Default::default(),
3069            _additional_params: Default::default(),
3070            _scopes: Default::default(),
3071        }
3072    }
3073
3074    /// Create a builder to help you perform the following task:
3075    ///
3076    /// Deletes a rule.
3077    ///
3078    /// # Arguments
3079    ///
3080    /// * `name` - Required. The name of the rule to delete.
3081    pub fn locations_repositories_rules_delete(
3082        &self,
3083        name: &str,
3084    ) -> ProjectLocationRepositoryRuleDeleteCall<'a, C> {
3085        ProjectLocationRepositoryRuleDeleteCall {
3086            hub: self.hub,
3087            _name: name.to_string(),
3088            _delegate: Default::default(),
3089            _additional_params: Default::default(),
3090            _scopes: Default::default(),
3091        }
3092    }
3093
3094    /// Create a builder to help you perform the following task:
3095    ///
3096    /// Gets a rule.
3097    ///
3098    /// # Arguments
3099    ///
3100    /// * `name` - Required. The name of the rule to retrieve.
3101    pub fn locations_repositories_rules_get(
3102        &self,
3103        name: &str,
3104    ) -> ProjectLocationRepositoryRuleGetCall<'a, C> {
3105        ProjectLocationRepositoryRuleGetCall {
3106            hub: self.hub,
3107            _name: name.to_string(),
3108            _delegate: Default::default(),
3109            _additional_params: Default::default(),
3110            _scopes: Default::default(),
3111        }
3112    }
3113
3114    /// Create a builder to help you perform the following task:
3115    ///
3116    /// Lists rules.
3117    ///
3118    /// # Arguments
3119    ///
3120    /// * `parent` - Required. The name of the parent repository whose rules will be listed. For example: `projects/p1/locations/us-central1/repositories/repo1`.
3121    pub fn locations_repositories_rules_list(
3122        &self,
3123        parent: &str,
3124    ) -> ProjectLocationRepositoryRuleListCall<'a, C> {
3125        ProjectLocationRepositoryRuleListCall {
3126            hub: self.hub,
3127            _parent: parent.to_string(),
3128            _page_token: Default::default(),
3129            _page_size: Default::default(),
3130            _delegate: Default::default(),
3131            _additional_params: Default::default(),
3132            _scopes: Default::default(),
3133        }
3134    }
3135
3136    /// Create a builder to help you perform the following task:
3137    ///
3138    /// Updates a rule.
3139    ///
3140    /// # Arguments
3141    ///
3142    /// * `request` - No description provided.
3143    /// * `name` - The name of the rule, for example: `projects/p1/locations/us-central1/repositories/repo1/rules/rule1`.
3144    pub fn locations_repositories_rules_patch(
3145        &self,
3146        request: GoogleDevtoolsArtifactregistryV1Rule,
3147        name: &str,
3148    ) -> ProjectLocationRepositoryRulePatchCall<'a, C> {
3149        ProjectLocationRepositoryRulePatchCall {
3150            hub: self.hub,
3151            _request: request,
3152            _name: name.to_string(),
3153            _update_mask: Default::default(),
3154            _delegate: Default::default(),
3155            _additional_params: Default::default(),
3156            _scopes: Default::default(),
3157        }
3158    }
3159
3160    /// Create a builder to help you perform the following task:
3161    ///
3162    /// Imports Yum (RPM) artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.
3163    ///
3164    /// # Arguments
3165    ///
3166    /// * `request` - No description provided.
3167    /// * `parent` - The name of the parent resource where the artifacts will be imported.
3168    pub fn locations_repositories_yum_artifacts_import(
3169        &self,
3170        request: ImportYumArtifactsRequest,
3171        parent: &str,
3172    ) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C> {
3173        ProjectLocationRepositoryYumArtifactImportCall {
3174            hub: self.hub,
3175            _request: request,
3176            _parent: parent.to_string(),
3177            _delegate: Default::default(),
3178            _additional_params: Default::default(),
3179            _scopes: Default::default(),
3180        }
3181    }
3182
3183    /// Create a builder to help you perform the following task:
3184    ///
3185    /// Directly uploads a Yum artifact. The returned Operation will complete once the resources are uploaded. Package, Version, and File resources are created based on the imported artifact. Imported artifacts that conflict with existing resources are ignored.
3186    ///
3187    /// # Arguments
3188    ///
3189    /// * `request` - No description provided.
3190    /// * `parent` - The name of the parent resource where the artifacts will be uploaded.
3191    pub fn locations_repositories_yum_artifacts_upload(
3192        &self,
3193        request: UploadYumArtifactRequest,
3194        parent: &str,
3195    ) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C> {
3196        ProjectLocationRepositoryYumArtifactUploadCall {
3197            hub: self.hub,
3198            _request: request,
3199            _parent: parent.to_string(),
3200            _delegate: Default::default(),
3201            _additional_params: Default::default(),
3202            _scopes: Default::default(),
3203        }
3204    }
3205
3206    /// Create a builder to help you perform the following task:
3207    ///
3208    /// Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.
3209    ///
3210    /// # Arguments
3211    ///
3212    /// * `request` - No description provided.
3213    /// * `parent` - Required. The name of the parent resource where the repository will be created.
3214    pub fn locations_repositories_create(
3215        &self,
3216        request: Repository,
3217        parent: &str,
3218    ) -> ProjectLocationRepositoryCreateCall<'a, C> {
3219        ProjectLocationRepositoryCreateCall {
3220            hub: self.hub,
3221            _request: request,
3222            _parent: parent.to_string(),
3223            _repository_id: Default::default(),
3224            _delegate: Default::default(),
3225            _additional_params: Default::default(),
3226            _scopes: Default::default(),
3227        }
3228    }
3229
3230    /// Create a builder to help you perform the following task:
3231    ///
3232    /// Deletes a repository and all of its contents. The returned Operation will finish once the repository has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.
3233    ///
3234    /// # Arguments
3235    ///
3236    /// * `name` - Required. The name of the repository to delete.
3237    pub fn locations_repositories_delete(
3238        &self,
3239        name: &str,
3240    ) -> ProjectLocationRepositoryDeleteCall<'a, C> {
3241        ProjectLocationRepositoryDeleteCall {
3242            hub: self.hub,
3243            _name: name.to_string(),
3244            _delegate: Default::default(),
3245            _additional_params: Default::default(),
3246            _scopes: Default::default(),
3247        }
3248    }
3249
3250    /// Create a builder to help you perform the following task:
3251    ///
3252    /// Exports an artifact to a Cloud Storage bucket.
3253    ///
3254    /// # Arguments
3255    ///
3256    /// * `request` - No description provided.
3257    /// * `repository` - Required. The repository of the artifact to export. Format: projects/{project}/locations/{location}/repositories/{repository}
3258    pub fn locations_repositories_export_artifact(
3259        &self,
3260        request: ExportArtifactRequest,
3261        repository: &str,
3262    ) -> ProjectLocationRepositoryExportArtifactCall<'a, C> {
3263        ProjectLocationRepositoryExportArtifactCall {
3264            hub: self.hub,
3265            _request: request,
3266            _repository: repository.to_string(),
3267            _delegate: Default::default(),
3268            _additional_params: Default::default(),
3269            _scopes: Default::default(),
3270        }
3271    }
3272
3273    /// Create a builder to help you perform the following task:
3274    ///
3275    /// Gets a repository.
3276    ///
3277    /// # Arguments
3278    ///
3279    /// * `name` - Required. The name of the repository to retrieve.
3280    pub fn locations_repositories_get(
3281        &self,
3282        name: &str,
3283    ) -> ProjectLocationRepositoryGetCall<'a, C> {
3284        ProjectLocationRepositoryGetCall {
3285            hub: self.hub,
3286            _name: name.to_string(),
3287            _delegate: Default::default(),
3288            _additional_params: Default::default(),
3289            _scopes: Default::default(),
3290        }
3291    }
3292
3293    /// Create a builder to help you perform the following task:
3294    ///
3295    /// Gets the IAM policy for a given resource.
3296    ///
3297    /// # Arguments
3298    ///
3299    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3300    pub fn locations_repositories_get_iam_policy(
3301        &self,
3302        resource: &str,
3303    ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
3304        ProjectLocationRepositoryGetIamPolicyCall {
3305            hub: self.hub,
3306            _resource: resource.to_string(),
3307            _options_requested_policy_version: Default::default(),
3308            _delegate: Default::default(),
3309            _additional_params: Default::default(),
3310            _scopes: Default::default(),
3311        }
3312    }
3313
3314    /// Create a builder to help you perform the following task:
3315    ///
3316    /// Lists repositories.
3317    ///
3318    /// # Arguments
3319    ///
3320    /// * `parent` - Required. The name of the parent resource whose repositories will be listed.
3321    pub fn locations_repositories_list(
3322        &self,
3323        parent: &str,
3324    ) -> ProjectLocationRepositoryListCall<'a, C> {
3325        ProjectLocationRepositoryListCall {
3326            hub: self.hub,
3327            _parent: parent.to_string(),
3328            _page_token: Default::default(),
3329            _page_size: Default::default(),
3330            _order_by: Default::default(),
3331            _filter: Default::default(),
3332            _delegate: Default::default(),
3333            _additional_params: Default::default(),
3334            _scopes: Default::default(),
3335        }
3336    }
3337
3338    /// Create a builder to help you perform the following task:
3339    ///
3340    /// Updates a repository.
3341    ///
3342    /// # Arguments
3343    ///
3344    /// * `request` - No description provided.
3345    /// * `name` - The name of the repository, for example: `projects/p1/locations/us-central1/repositories/repo1`. For each location in a project, repository names must be unique.
3346    pub fn locations_repositories_patch(
3347        &self,
3348        request: Repository,
3349        name: &str,
3350    ) -> ProjectLocationRepositoryPatchCall<'a, C> {
3351        ProjectLocationRepositoryPatchCall {
3352            hub: self.hub,
3353            _request: request,
3354            _name: name.to_string(),
3355            _update_mask: Default::default(),
3356            _delegate: Default::default(),
3357            _additional_params: Default::default(),
3358            _scopes: Default::default(),
3359        }
3360    }
3361
3362    /// Create a builder to help you perform the following task:
3363    ///
3364    /// Updates the IAM policy for a given resource.
3365    ///
3366    /// # Arguments
3367    ///
3368    /// * `request` - No description provided.
3369    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3370    pub fn locations_repositories_set_iam_policy(
3371        &self,
3372        request: SetIamPolicyRequest,
3373        resource: &str,
3374    ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
3375        ProjectLocationRepositorySetIamPolicyCall {
3376            hub: self.hub,
3377            _request: request,
3378            _resource: resource.to_string(),
3379            _delegate: Default::default(),
3380            _additional_params: Default::default(),
3381            _scopes: Default::default(),
3382        }
3383    }
3384
3385    /// Create a builder to help you perform the following task:
3386    ///
3387    /// Tests if the caller has a list of permissions on a resource.
3388    ///
3389    /// # Arguments
3390    ///
3391    /// * `request` - No description provided.
3392    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3393    pub fn locations_repositories_test_iam_permissions(
3394        &self,
3395        request: TestIamPermissionsRequest,
3396        resource: &str,
3397    ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
3398        ProjectLocationRepositoryTestIamPermissionCall {
3399            hub: self.hub,
3400            _request: request,
3401            _resource: resource.to_string(),
3402            _delegate: Default::default(),
3403            _additional_params: Default::default(),
3404            _scopes: Default::default(),
3405        }
3406    }
3407
3408    /// Create a builder to help you perform the following task:
3409    ///
3410    /// Gets information about a location.
3411    ///
3412    /// # Arguments
3413    ///
3414    /// * `name` - Resource name for the location.
3415    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
3416        ProjectLocationGetCall {
3417            hub: self.hub,
3418            _name: name.to_string(),
3419            _delegate: Default::default(),
3420            _additional_params: Default::default(),
3421            _scopes: Default::default(),
3422        }
3423    }
3424
3425    /// Create a builder to help you perform the following task:
3426    ///
3427    /// Retrieves the VPCSC Config for the Project.
3428    ///
3429    /// # Arguments
3430    ///
3431    /// * `name` - Required. The name of the VPCSCConfig resource.
3432    pub fn locations_get_vpcsc_config(
3433        &self,
3434        name: &str,
3435    ) -> ProjectLocationGetVpcscConfigCall<'a, C> {
3436        ProjectLocationGetVpcscConfigCall {
3437            hub: self.hub,
3438            _name: name.to_string(),
3439            _delegate: Default::default(),
3440            _additional_params: Default::default(),
3441            _scopes: Default::default(),
3442        }
3443    }
3444
3445    /// Create a builder to help you perform the following task:
3446    ///
3447    /// Lists information about the supported locations for this service.
3448    ///
3449    /// # Arguments
3450    ///
3451    /// * `name` - The resource that owns the locations collection, if applicable.
3452    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
3453        ProjectLocationListCall {
3454            hub: self.hub,
3455            _name: name.to_string(),
3456            _page_token: Default::default(),
3457            _page_size: Default::default(),
3458            _filter: Default::default(),
3459            _extra_location_types: Default::default(),
3460            _delegate: Default::default(),
3461            _additional_params: Default::default(),
3462            _scopes: Default::default(),
3463        }
3464    }
3465
3466    /// Create a builder to help you perform the following task:
3467    ///
3468    /// Updates the VPCSC Config for the Project.
3469    ///
3470    /// # Arguments
3471    ///
3472    /// * `request` - No description provided.
3473    /// * `name` - The name of the project's VPC SC Config. Always of the form: projects/{projectID}/locations/{location}/vpcscConfig In update request: never set In response: always set
3474    pub fn locations_update_vpcsc_config(
3475        &self,
3476        request: VPCSCConfig,
3477        name: &str,
3478    ) -> ProjectLocationUpdateVpcscConfigCall<'a, C> {
3479        ProjectLocationUpdateVpcscConfigCall {
3480            hub: self.hub,
3481            _request: request,
3482            _name: name.to_string(),
3483            _update_mask: Default::default(),
3484            _delegate: Default::default(),
3485            _additional_params: Default::default(),
3486            _scopes: Default::default(),
3487        }
3488    }
3489
3490    /// Create a builder to help you perform the following task:
3491    ///
3492    /// Retrieves the Settings for the Project.
3493    ///
3494    /// # Arguments
3495    ///
3496    /// * `name` - Required. The name of the projectSettings resource.
3497    pub fn get_project_settings(&self, name: &str) -> ProjectGetProjectSettingCall<'a, C> {
3498        ProjectGetProjectSettingCall {
3499            hub: self.hub,
3500            _name: name.to_string(),
3501            _delegate: Default::default(),
3502            _additional_params: Default::default(),
3503            _scopes: Default::default(),
3504        }
3505    }
3506
3507    /// Create a builder to help you perform the following task:
3508    ///
3509    /// Updates the Settings for the Project.
3510    ///
3511    /// # Arguments
3512    ///
3513    /// * `request` - No description provided.
3514    /// * `name` - The name of the project's settings. Always of the form: projects/{project-id}/projectSettings In update request: never set In response: always set
3515    pub fn update_project_settings(
3516        &self,
3517        request: ProjectSettings,
3518        name: &str,
3519    ) -> ProjectUpdateProjectSettingCall<'a, C> {
3520        ProjectUpdateProjectSettingCall {
3521            hub: self.hub,
3522            _request: request,
3523            _name: name.to_string(),
3524            _update_mask: Default::default(),
3525            _delegate: Default::default(),
3526            _additional_params: Default::default(),
3527            _scopes: Default::default(),
3528        }
3529    }
3530}
3531
3532// ###################
3533// CallBuilders   ###
3534// #################
3535
3536/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3537///
3538/// A builder for the *locations.operations.get* method supported by a *project* resource.
3539/// It is not used directly, but through a [`ProjectMethods`] instance.
3540///
3541/// # Example
3542///
3543/// Instantiate a resource method builder
3544///
3545/// ```test_harness,no_run
3546/// # extern crate hyper;
3547/// # extern crate hyper_rustls;
3548/// # extern crate google_artifactregistry1 as artifactregistry1;
3549/// # async fn dox() {
3550/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3551///
3552/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3553/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3554/// #     .with_native_roots()
3555/// #     .unwrap()
3556/// #     .https_only()
3557/// #     .enable_http2()
3558/// #     .build();
3559///
3560/// # let executor = hyper_util::rt::TokioExecutor::new();
3561/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3562/// #     secret,
3563/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3564/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3565/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3566/// #     ),
3567/// # ).build().await.unwrap();
3568///
3569/// # let client = hyper_util::client::legacy::Client::builder(
3570/// #     hyper_util::rt::TokioExecutor::new()
3571/// # )
3572/// # .build(
3573/// #     hyper_rustls::HttpsConnectorBuilder::new()
3574/// #         .with_native_roots()
3575/// #         .unwrap()
3576/// #         .https_or_http()
3577/// #         .enable_http2()
3578/// #         .build()
3579/// # );
3580/// # let mut hub = ArtifactRegistry::new(client, auth);
3581/// // You can configure optional parameters by calling the respective setters at will, and
3582/// // execute the final call using `doit()`.
3583/// // Values shown here are possibly random and not representative !
3584/// let result = hub.projects().locations_operations_get("name")
3585///              .doit().await;
3586/// # }
3587/// ```
3588pub struct ProjectLocationOperationGetCall<'a, C>
3589where
3590    C: 'a,
3591{
3592    hub: &'a ArtifactRegistry<C>,
3593    _name: String,
3594    _delegate: Option<&'a mut dyn common::Delegate>,
3595    _additional_params: HashMap<String, String>,
3596    _scopes: BTreeSet<String>,
3597}
3598
3599impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
3600
3601impl<'a, C> ProjectLocationOperationGetCall<'a, C>
3602where
3603    C: common::Connector,
3604{
3605    /// Perform the operation you have build so far.
3606    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3607        use std::borrow::Cow;
3608        use std::io::{Read, Seek};
3609
3610        use common::{url::Params, ToParts};
3611        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3612
3613        let mut dd = common::DefaultDelegate;
3614        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3615        dlg.begin(common::MethodInfo {
3616            id: "artifactregistry.projects.locations.operations.get",
3617            http_method: hyper::Method::GET,
3618        });
3619
3620        for &field in ["alt", "name"].iter() {
3621            if self._additional_params.contains_key(field) {
3622                dlg.finished(false);
3623                return Err(common::Error::FieldClash(field));
3624            }
3625        }
3626
3627        let mut params = Params::with_capacity(3 + self._additional_params.len());
3628        params.push("name", self._name);
3629
3630        params.extend(self._additional_params.iter());
3631
3632        params.push("alt", "json");
3633        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3634        if self._scopes.is_empty() {
3635            self._scopes
3636                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3637        }
3638
3639        #[allow(clippy::single_element_loop)]
3640        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3641            url = params.uri_replacement(url, param_name, find_this, true);
3642        }
3643        {
3644            let to_remove = ["name"];
3645            params.remove_params(&to_remove);
3646        }
3647
3648        let url = params.parse_with_url(&url);
3649
3650        loop {
3651            let token = match self
3652                .hub
3653                .auth
3654                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3655                .await
3656            {
3657                Ok(token) => token,
3658                Err(e) => match dlg.token(e) {
3659                    Ok(token) => token,
3660                    Err(e) => {
3661                        dlg.finished(false);
3662                        return Err(common::Error::MissingToken(e));
3663                    }
3664                },
3665            };
3666            let mut req_result = {
3667                let client = &self.hub.client;
3668                dlg.pre_request();
3669                let mut req_builder = hyper::Request::builder()
3670                    .method(hyper::Method::GET)
3671                    .uri(url.as_str())
3672                    .header(USER_AGENT, self.hub._user_agent.clone());
3673
3674                if let Some(token) = token.as_ref() {
3675                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3676                }
3677
3678                let request = req_builder
3679                    .header(CONTENT_LENGTH, 0_u64)
3680                    .body(common::to_body::<String>(None));
3681
3682                client.request(request.unwrap()).await
3683            };
3684
3685            match req_result {
3686                Err(err) => {
3687                    if let common::Retry::After(d) = dlg.http_error(&err) {
3688                        sleep(d).await;
3689                        continue;
3690                    }
3691                    dlg.finished(false);
3692                    return Err(common::Error::HttpError(err));
3693                }
3694                Ok(res) => {
3695                    let (mut parts, body) = res.into_parts();
3696                    let mut body = common::Body::new(body);
3697                    if !parts.status.is_success() {
3698                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3699                        let error = serde_json::from_str(&common::to_string(&bytes));
3700                        let response = common::to_response(parts, bytes.into());
3701
3702                        if let common::Retry::After(d) =
3703                            dlg.http_failure(&response, error.as_ref().ok())
3704                        {
3705                            sleep(d).await;
3706                            continue;
3707                        }
3708
3709                        dlg.finished(false);
3710
3711                        return Err(match error {
3712                            Ok(value) => common::Error::BadRequest(value),
3713                            _ => common::Error::Failure(response),
3714                        });
3715                    }
3716                    let response = {
3717                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3718                        let encoded = common::to_string(&bytes);
3719                        match serde_json::from_str(&encoded) {
3720                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3721                            Err(error) => {
3722                                dlg.response_json_decode_error(&encoded, &error);
3723                                return Err(common::Error::JsonDecodeError(
3724                                    encoded.to_string(),
3725                                    error,
3726                                ));
3727                            }
3728                        }
3729                    };
3730
3731                    dlg.finished(true);
3732                    return Ok(response);
3733                }
3734            }
3735        }
3736    }
3737
3738    /// The name of the operation resource.
3739    ///
3740    /// Sets the *name* path property to the given value.
3741    ///
3742    /// Even though the property as already been set when instantiating this call,
3743    /// we provide this method for API completeness.
3744    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
3745        self._name = new_value.to_string();
3746        self
3747    }
3748    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3749    /// while executing the actual API request.
3750    ///
3751    /// ````text
3752    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3753    /// ````
3754    ///
3755    /// Sets the *delegate* property to the given value.
3756    pub fn delegate(
3757        mut self,
3758        new_value: &'a mut dyn common::Delegate,
3759    ) -> ProjectLocationOperationGetCall<'a, C> {
3760        self._delegate = Some(new_value);
3761        self
3762    }
3763
3764    /// Set any additional parameter of the query string used in the request.
3765    /// It should be used to set parameters which are not yet available through their own
3766    /// setters.
3767    ///
3768    /// Please note that this method must not be used to set any of the known parameters
3769    /// which have their own setter method. If done anyway, the request will fail.
3770    ///
3771    /// # Additional Parameters
3772    ///
3773    /// * *$.xgafv* (query-string) - V1 error format.
3774    /// * *access_token* (query-string) - OAuth access token.
3775    /// * *alt* (query-string) - Data format for response.
3776    /// * *callback* (query-string) - JSONP
3777    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3778    /// * *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.
3779    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3780    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3781    /// * *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.
3782    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3783    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3784    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
3785    where
3786        T: AsRef<str>,
3787    {
3788        self._additional_params
3789            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3790        self
3791    }
3792
3793    /// Identifies the authorization scope for the method you are building.
3794    ///
3795    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3796    /// [`Scope::CloudPlatformReadOnly`].
3797    ///
3798    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3799    /// tokens for more than one scope.
3800    ///
3801    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3802    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3803    /// sufficient, a read-write scope will do as well.
3804    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
3805    where
3806        St: AsRef<str>,
3807    {
3808        self._scopes.insert(String::from(scope.as_ref()));
3809        self
3810    }
3811    /// Identifies the authorization scope(s) for the method you are building.
3812    ///
3813    /// See [`Self::add_scope()`] for details.
3814    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
3815    where
3816        I: IntoIterator<Item = St>,
3817        St: AsRef<str>,
3818    {
3819        self._scopes
3820            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3821        self
3822    }
3823
3824    /// Removes all scopes, and no default scope will be used either.
3825    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3826    /// for details).
3827    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
3828        self._scopes.clear();
3829        self
3830    }
3831}
3832
3833/// Imports Apt artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.
3834///
3835/// A builder for the *locations.repositories.aptArtifacts.import* method supported by a *project* resource.
3836/// It is not used directly, but through a [`ProjectMethods`] instance.
3837///
3838/// # Example
3839///
3840/// Instantiate a resource method builder
3841///
3842/// ```test_harness,no_run
3843/// # extern crate hyper;
3844/// # extern crate hyper_rustls;
3845/// # extern crate google_artifactregistry1 as artifactregistry1;
3846/// use artifactregistry1::api::ImportAptArtifactsRequest;
3847/// # async fn dox() {
3848/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3849///
3850/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3851/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3852/// #     .with_native_roots()
3853/// #     .unwrap()
3854/// #     .https_only()
3855/// #     .enable_http2()
3856/// #     .build();
3857///
3858/// # let executor = hyper_util::rt::TokioExecutor::new();
3859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3860/// #     secret,
3861/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3862/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3863/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3864/// #     ),
3865/// # ).build().await.unwrap();
3866///
3867/// # let client = hyper_util::client::legacy::Client::builder(
3868/// #     hyper_util::rt::TokioExecutor::new()
3869/// # )
3870/// # .build(
3871/// #     hyper_rustls::HttpsConnectorBuilder::new()
3872/// #         .with_native_roots()
3873/// #         .unwrap()
3874/// #         .https_or_http()
3875/// #         .enable_http2()
3876/// #         .build()
3877/// # );
3878/// # let mut hub = ArtifactRegistry::new(client, auth);
3879/// // As the method needs a request, you would usually fill it with the desired information
3880/// // into the respective structure. Some of the parts shown here might not be applicable !
3881/// // Values shown here are possibly random and not representative !
3882/// let mut req = ImportAptArtifactsRequest::default();
3883///
3884/// // You can configure optional parameters by calling the respective setters at will, and
3885/// // execute the final call using `doit()`.
3886/// // Values shown here are possibly random and not representative !
3887/// let result = hub.projects().locations_repositories_apt_artifacts_import(req, "parent")
3888///              .doit().await;
3889/// # }
3890/// ```
3891pub struct ProjectLocationRepositoryAptArtifactImportCall<'a, C>
3892where
3893    C: 'a,
3894{
3895    hub: &'a ArtifactRegistry<C>,
3896    _request: ImportAptArtifactsRequest,
3897    _parent: String,
3898    _delegate: Option<&'a mut dyn common::Delegate>,
3899    _additional_params: HashMap<String, String>,
3900    _scopes: BTreeSet<String>,
3901}
3902
3903impl<'a, C> common::CallBuilder for ProjectLocationRepositoryAptArtifactImportCall<'a, C> {}
3904
3905impl<'a, C> ProjectLocationRepositoryAptArtifactImportCall<'a, C>
3906where
3907    C: common::Connector,
3908{
3909    /// Perform the operation you have build so far.
3910    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3911        use std::borrow::Cow;
3912        use std::io::{Read, Seek};
3913
3914        use common::{url::Params, ToParts};
3915        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3916
3917        let mut dd = common::DefaultDelegate;
3918        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3919        dlg.begin(common::MethodInfo {
3920            id: "artifactregistry.projects.locations.repositories.aptArtifacts.import",
3921            http_method: hyper::Method::POST,
3922        });
3923
3924        for &field in ["alt", "parent"].iter() {
3925            if self._additional_params.contains_key(field) {
3926                dlg.finished(false);
3927                return Err(common::Error::FieldClash(field));
3928            }
3929        }
3930
3931        let mut params = Params::with_capacity(4 + self._additional_params.len());
3932        params.push("parent", self._parent);
3933
3934        params.extend(self._additional_params.iter());
3935
3936        params.push("alt", "json");
3937        let mut url = self.hub._base_url.clone() + "v1/{+parent}/aptArtifacts:import";
3938        if self._scopes.is_empty() {
3939            self._scopes
3940                .insert(Scope::CloudPlatform.as_ref().to_string());
3941        }
3942
3943        #[allow(clippy::single_element_loop)]
3944        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3945            url = params.uri_replacement(url, param_name, find_this, true);
3946        }
3947        {
3948            let to_remove = ["parent"];
3949            params.remove_params(&to_remove);
3950        }
3951
3952        let url = params.parse_with_url(&url);
3953
3954        let mut json_mime_type = mime::APPLICATION_JSON;
3955        let mut request_value_reader = {
3956            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3957            common::remove_json_null_values(&mut value);
3958            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3959            serde_json::to_writer(&mut dst, &value).unwrap();
3960            dst
3961        };
3962        let request_size = request_value_reader
3963            .seek(std::io::SeekFrom::End(0))
3964            .unwrap();
3965        request_value_reader
3966            .seek(std::io::SeekFrom::Start(0))
3967            .unwrap();
3968
3969        loop {
3970            let token = match self
3971                .hub
3972                .auth
3973                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3974                .await
3975            {
3976                Ok(token) => token,
3977                Err(e) => match dlg.token(e) {
3978                    Ok(token) => token,
3979                    Err(e) => {
3980                        dlg.finished(false);
3981                        return Err(common::Error::MissingToken(e));
3982                    }
3983                },
3984            };
3985            request_value_reader
3986                .seek(std::io::SeekFrom::Start(0))
3987                .unwrap();
3988            let mut req_result = {
3989                let client = &self.hub.client;
3990                dlg.pre_request();
3991                let mut req_builder = hyper::Request::builder()
3992                    .method(hyper::Method::POST)
3993                    .uri(url.as_str())
3994                    .header(USER_AGENT, self.hub._user_agent.clone());
3995
3996                if let Some(token) = token.as_ref() {
3997                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3998                }
3999
4000                let request = req_builder
4001                    .header(CONTENT_TYPE, json_mime_type.to_string())
4002                    .header(CONTENT_LENGTH, request_size as u64)
4003                    .body(common::to_body(
4004                        request_value_reader.get_ref().clone().into(),
4005                    ));
4006
4007                client.request(request.unwrap()).await
4008            };
4009
4010            match req_result {
4011                Err(err) => {
4012                    if let common::Retry::After(d) = dlg.http_error(&err) {
4013                        sleep(d).await;
4014                        continue;
4015                    }
4016                    dlg.finished(false);
4017                    return Err(common::Error::HttpError(err));
4018                }
4019                Ok(res) => {
4020                    let (mut parts, body) = res.into_parts();
4021                    let mut body = common::Body::new(body);
4022                    if !parts.status.is_success() {
4023                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4024                        let error = serde_json::from_str(&common::to_string(&bytes));
4025                        let response = common::to_response(parts, bytes.into());
4026
4027                        if let common::Retry::After(d) =
4028                            dlg.http_failure(&response, error.as_ref().ok())
4029                        {
4030                            sleep(d).await;
4031                            continue;
4032                        }
4033
4034                        dlg.finished(false);
4035
4036                        return Err(match error {
4037                            Ok(value) => common::Error::BadRequest(value),
4038                            _ => common::Error::Failure(response),
4039                        });
4040                    }
4041                    let response = {
4042                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4043                        let encoded = common::to_string(&bytes);
4044                        match serde_json::from_str(&encoded) {
4045                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4046                            Err(error) => {
4047                                dlg.response_json_decode_error(&encoded, &error);
4048                                return Err(common::Error::JsonDecodeError(
4049                                    encoded.to_string(),
4050                                    error,
4051                                ));
4052                            }
4053                        }
4054                    };
4055
4056                    dlg.finished(true);
4057                    return Ok(response);
4058                }
4059            }
4060        }
4061    }
4062
4063    ///
4064    /// Sets the *request* property to the given value.
4065    ///
4066    /// Even though the property as already been set when instantiating this call,
4067    /// we provide this method for API completeness.
4068    pub fn request(
4069        mut self,
4070        new_value: ImportAptArtifactsRequest,
4071    ) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C> {
4072        self._request = new_value;
4073        self
4074    }
4075    /// The name of the parent resource where the artifacts will be imported.
4076    ///
4077    /// Sets the *parent* path property to the given value.
4078    ///
4079    /// Even though the property as already been set when instantiating this call,
4080    /// we provide this method for API completeness.
4081    pub fn parent(
4082        mut self,
4083        new_value: &str,
4084    ) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C> {
4085        self._parent = new_value.to_string();
4086        self
4087    }
4088    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4089    /// while executing the actual API request.
4090    ///
4091    /// ````text
4092    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4093    /// ````
4094    ///
4095    /// Sets the *delegate* property to the given value.
4096    pub fn delegate(
4097        mut self,
4098        new_value: &'a mut dyn common::Delegate,
4099    ) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C> {
4100        self._delegate = Some(new_value);
4101        self
4102    }
4103
4104    /// Set any additional parameter of the query string used in the request.
4105    /// It should be used to set parameters which are not yet available through their own
4106    /// setters.
4107    ///
4108    /// Please note that this method must not be used to set any of the known parameters
4109    /// which have their own setter method. If done anyway, the request will fail.
4110    ///
4111    /// # Additional Parameters
4112    ///
4113    /// * *$.xgafv* (query-string) - V1 error format.
4114    /// * *access_token* (query-string) - OAuth access token.
4115    /// * *alt* (query-string) - Data format for response.
4116    /// * *callback* (query-string) - JSONP
4117    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4118    /// * *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.
4119    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4120    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4121    /// * *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.
4122    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4123    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4124    pub fn param<T>(
4125        mut self,
4126        name: T,
4127        value: T,
4128    ) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C>
4129    where
4130        T: AsRef<str>,
4131    {
4132        self._additional_params
4133            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4134        self
4135    }
4136
4137    /// Identifies the authorization scope for the method you are building.
4138    ///
4139    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4140    /// [`Scope::CloudPlatform`].
4141    ///
4142    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4143    /// tokens for more than one scope.
4144    ///
4145    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4146    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4147    /// sufficient, a read-write scope will do as well.
4148    pub fn add_scope<St>(
4149        mut self,
4150        scope: St,
4151    ) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C>
4152    where
4153        St: AsRef<str>,
4154    {
4155        self._scopes.insert(String::from(scope.as_ref()));
4156        self
4157    }
4158    /// Identifies the authorization scope(s) for the method you are building.
4159    ///
4160    /// See [`Self::add_scope()`] for details.
4161    pub fn add_scopes<I, St>(
4162        mut self,
4163        scopes: I,
4164    ) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C>
4165    where
4166        I: IntoIterator<Item = St>,
4167        St: AsRef<str>,
4168    {
4169        self._scopes
4170            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4171        self
4172    }
4173
4174    /// Removes all scopes, and no default scope will be used either.
4175    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4176    /// for details).
4177    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryAptArtifactImportCall<'a, C> {
4178        self._scopes.clear();
4179        self
4180    }
4181}
4182
4183/// Directly uploads an Apt artifact. The returned Operation will complete once the resources are uploaded. Package, Version, and File resources are created based on the imported artifact. Imported artifacts that conflict with existing resources are ignored.
4184///
4185/// A builder for the *locations.repositories.aptArtifacts.upload* method supported by a *project* resource.
4186/// It is not used directly, but through a [`ProjectMethods`] instance.
4187///
4188/// # Example
4189///
4190/// Instantiate a resource method builder
4191///
4192/// ```test_harness,no_run
4193/// # extern crate hyper;
4194/// # extern crate hyper_rustls;
4195/// # extern crate google_artifactregistry1 as artifactregistry1;
4196/// use artifactregistry1::api::UploadAptArtifactRequest;
4197/// use std::fs;
4198/// # async fn dox() {
4199/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4200///
4201/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4202/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4203/// #     .with_native_roots()
4204/// #     .unwrap()
4205/// #     .https_only()
4206/// #     .enable_http2()
4207/// #     .build();
4208///
4209/// # let executor = hyper_util::rt::TokioExecutor::new();
4210/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4211/// #     secret,
4212/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4213/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4214/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4215/// #     ),
4216/// # ).build().await.unwrap();
4217///
4218/// # let client = hyper_util::client::legacy::Client::builder(
4219/// #     hyper_util::rt::TokioExecutor::new()
4220/// # )
4221/// # .build(
4222/// #     hyper_rustls::HttpsConnectorBuilder::new()
4223/// #         .with_native_roots()
4224/// #         .unwrap()
4225/// #         .https_or_http()
4226/// #         .enable_http2()
4227/// #         .build()
4228/// # );
4229/// # let mut hub = ArtifactRegistry::new(client, auth);
4230/// // As the method needs a request, you would usually fill it with the desired information
4231/// // into the respective structure. Some of the parts shown here might not be applicable !
4232/// // Values shown here are possibly random and not representative !
4233/// let mut req = UploadAptArtifactRequest::default();
4234///
4235/// // You can configure optional parameters by calling the respective setters at will, and
4236/// // execute the final call using `upload(...)`.
4237/// // Values shown here are possibly random and not representative !
4238/// let result = hub.projects().locations_repositories_apt_artifacts_upload(req, "parent")
4239///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
4240/// # }
4241/// ```
4242pub struct ProjectLocationRepositoryAptArtifactUploadCall<'a, C>
4243where
4244    C: 'a,
4245{
4246    hub: &'a ArtifactRegistry<C>,
4247    _request: UploadAptArtifactRequest,
4248    _parent: String,
4249    _delegate: Option<&'a mut dyn common::Delegate>,
4250    _additional_params: HashMap<String, String>,
4251    _scopes: BTreeSet<String>,
4252}
4253
4254impl<'a, C> common::CallBuilder for ProjectLocationRepositoryAptArtifactUploadCall<'a, C> {}
4255
4256impl<'a, C> ProjectLocationRepositoryAptArtifactUploadCall<'a, C>
4257where
4258    C: common::Connector,
4259{
4260    /// Perform the operation you have build so far.
4261    async fn doit<RS>(
4262        mut self,
4263        mut reader: RS,
4264        reader_mime_type: mime::Mime,
4265        protocol: common::UploadProtocol,
4266    ) -> common::Result<(common::Response, UploadAptArtifactMediaResponse)>
4267    where
4268        RS: common::ReadSeek,
4269    {
4270        use std::borrow::Cow;
4271        use std::io::{Read, Seek};
4272
4273        use common::{url::Params, ToParts};
4274        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4275
4276        let mut dd = common::DefaultDelegate;
4277        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4278        dlg.begin(common::MethodInfo {
4279            id: "artifactregistry.projects.locations.repositories.aptArtifacts.upload",
4280            http_method: hyper::Method::POST,
4281        });
4282
4283        for &field in ["alt", "parent"].iter() {
4284            if self._additional_params.contains_key(field) {
4285                dlg.finished(false);
4286                return Err(common::Error::FieldClash(field));
4287            }
4288        }
4289
4290        let mut params = Params::with_capacity(4 + self._additional_params.len());
4291        params.push("parent", self._parent);
4292
4293        params.extend(self._additional_params.iter());
4294
4295        params.push("alt", "json");
4296        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
4297            (
4298                self.hub._root_url.clone() + "upload/v1/{+parent}/aptArtifacts:create",
4299                "multipart",
4300            )
4301        } else {
4302            unreachable!()
4303        };
4304        params.push("uploadType", upload_type);
4305        if self._scopes.is_empty() {
4306            self._scopes
4307                .insert(Scope::CloudPlatform.as_ref().to_string());
4308        }
4309
4310        #[allow(clippy::single_element_loop)]
4311        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4312            url = params.uri_replacement(url, param_name, find_this, true);
4313        }
4314        {
4315            let to_remove = ["parent"];
4316            params.remove_params(&to_remove);
4317        }
4318
4319        let url = params.parse_with_url(&url);
4320
4321        let mut json_mime_type = mime::APPLICATION_JSON;
4322        let mut request_value_reader = {
4323            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4324            common::remove_json_null_values(&mut value);
4325            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4326            serde_json::to_writer(&mut dst, &value).unwrap();
4327            dst
4328        };
4329        let request_size = request_value_reader
4330            .seek(std::io::SeekFrom::End(0))
4331            .unwrap();
4332        request_value_reader
4333            .seek(std::io::SeekFrom::Start(0))
4334            .unwrap();
4335
4336        loop {
4337            let token = match self
4338                .hub
4339                .auth
4340                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4341                .await
4342            {
4343                Ok(token) => token,
4344                Err(e) => match dlg.token(e) {
4345                    Ok(token) => token,
4346                    Err(e) => {
4347                        dlg.finished(false);
4348                        return Err(common::Error::MissingToken(e));
4349                    }
4350                },
4351            };
4352            request_value_reader
4353                .seek(std::io::SeekFrom::Start(0))
4354                .unwrap();
4355            let mut req_result = {
4356                let mut mp_reader: common::MultiPartReader = Default::default();
4357                let (mut body_reader, content_type) = match protocol {
4358                    common::UploadProtocol::Simple => {
4359                        mp_reader.reserve_exact(2);
4360                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
4361                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
4362
4363                        mp_reader
4364                            .add_part(
4365                                &mut request_value_reader,
4366                                request_size,
4367                                json_mime_type.clone(),
4368                            )
4369                            .add_part(&mut reader, size, reader_mime_type.clone());
4370                        (
4371                            &mut mp_reader as &mut (dyn std::io::Read + Send),
4372                            common::MultiPartReader::mime_type(),
4373                        )
4374                    }
4375                    _ => (
4376                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
4377                        json_mime_type.clone(),
4378                    ),
4379                };
4380                let client = &self.hub.client;
4381                dlg.pre_request();
4382                let mut req_builder = hyper::Request::builder()
4383                    .method(hyper::Method::POST)
4384                    .uri(url.as_str())
4385                    .header(USER_AGENT, self.hub._user_agent.clone());
4386
4387                if let Some(token) = token.as_ref() {
4388                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4389                }
4390
4391                let mut body_reader_bytes = vec![];
4392                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
4393                let request = req_builder
4394                    .header(CONTENT_TYPE, content_type.to_string())
4395                    .body(common::to_body(body_reader_bytes.into()));
4396
4397                client.request(request.unwrap()).await
4398            };
4399
4400            match req_result {
4401                Err(err) => {
4402                    if let common::Retry::After(d) = dlg.http_error(&err) {
4403                        sleep(d).await;
4404                        continue;
4405                    }
4406                    dlg.finished(false);
4407                    return Err(common::Error::HttpError(err));
4408                }
4409                Ok(res) => {
4410                    let (mut parts, body) = res.into_parts();
4411                    let mut body = common::Body::new(body);
4412                    if !parts.status.is_success() {
4413                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4414                        let error = serde_json::from_str(&common::to_string(&bytes));
4415                        let response = common::to_response(parts, bytes.into());
4416
4417                        if let common::Retry::After(d) =
4418                            dlg.http_failure(&response, error.as_ref().ok())
4419                        {
4420                            sleep(d).await;
4421                            continue;
4422                        }
4423
4424                        dlg.finished(false);
4425
4426                        return Err(match error {
4427                            Ok(value) => common::Error::BadRequest(value),
4428                            _ => common::Error::Failure(response),
4429                        });
4430                    }
4431                    let response = {
4432                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4433                        let encoded = common::to_string(&bytes);
4434                        match serde_json::from_str(&encoded) {
4435                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4436                            Err(error) => {
4437                                dlg.response_json_decode_error(&encoded, &error);
4438                                return Err(common::Error::JsonDecodeError(
4439                                    encoded.to_string(),
4440                                    error,
4441                                ));
4442                            }
4443                        }
4444                    };
4445
4446                    dlg.finished(true);
4447                    return Ok(response);
4448                }
4449            }
4450        }
4451    }
4452
4453    /// Upload media all at once.
4454    /// If the upload fails for whichever reason, all progress is lost.
4455    ///
4456    /// * *multipart*: yes
4457    /// * *max size*: 0kb
4458    /// * *valid mime types*: '*/*'
4459    pub async fn upload<RS>(
4460        self,
4461        stream: RS,
4462        mime_type: mime::Mime,
4463    ) -> common::Result<(common::Response, UploadAptArtifactMediaResponse)>
4464    where
4465        RS: common::ReadSeek,
4466    {
4467        self.doit(stream, mime_type, common::UploadProtocol::Simple)
4468            .await
4469    }
4470
4471    ///
4472    /// Sets the *request* property to the given value.
4473    ///
4474    /// Even though the property as already been set when instantiating this call,
4475    /// we provide this method for API completeness.
4476    pub fn request(
4477        mut self,
4478        new_value: UploadAptArtifactRequest,
4479    ) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C> {
4480        self._request = new_value;
4481        self
4482    }
4483    /// The name of the parent resource where the artifacts will be uploaded.
4484    ///
4485    /// Sets the *parent* path property to the given value.
4486    ///
4487    /// Even though the property as already been set when instantiating this call,
4488    /// we provide this method for API completeness.
4489    pub fn parent(
4490        mut self,
4491        new_value: &str,
4492    ) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C> {
4493        self._parent = new_value.to_string();
4494        self
4495    }
4496    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4497    /// while executing the actual API request.
4498    ///
4499    /// ````text
4500    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4501    /// ````
4502    ///
4503    /// Sets the *delegate* property to the given value.
4504    pub fn delegate(
4505        mut self,
4506        new_value: &'a mut dyn common::Delegate,
4507    ) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C> {
4508        self._delegate = Some(new_value);
4509        self
4510    }
4511
4512    /// Set any additional parameter of the query string used in the request.
4513    /// It should be used to set parameters which are not yet available through their own
4514    /// setters.
4515    ///
4516    /// Please note that this method must not be used to set any of the known parameters
4517    /// which have their own setter method. If done anyway, the request will fail.
4518    ///
4519    /// # Additional Parameters
4520    ///
4521    /// * *$.xgafv* (query-string) - V1 error format.
4522    /// * *access_token* (query-string) - OAuth access token.
4523    /// * *alt* (query-string) - Data format for response.
4524    /// * *callback* (query-string) - JSONP
4525    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4526    /// * *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.
4527    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4528    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4529    /// * *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.
4530    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4531    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4532    pub fn param<T>(
4533        mut self,
4534        name: T,
4535        value: T,
4536    ) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C>
4537    where
4538        T: AsRef<str>,
4539    {
4540        self._additional_params
4541            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4542        self
4543    }
4544
4545    /// Identifies the authorization scope for the method you are building.
4546    ///
4547    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4548    /// [`Scope::CloudPlatform`].
4549    ///
4550    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4551    /// tokens for more than one scope.
4552    ///
4553    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4554    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4555    /// sufficient, a read-write scope will do as well.
4556    pub fn add_scope<St>(
4557        mut self,
4558        scope: St,
4559    ) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C>
4560    where
4561        St: AsRef<str>,
4562    {
4563        self._scopes.insert(String::from(scope.as_ref()));
4564        self
4565    }
4566    /// Identifies the authorization scope(s) for the method you are building.
4567    ///
4568    /// See [`Self::add_scope()`] for details.
4569    pub fn add_scopes<I, St>(
4570        mut self,
4571        scopes: I,
4572    ) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C>
4573    where
4574        I: IntoIterator<Item = St>,
4575        St: AsRef<str>,
4576    {
4577        self._scopes
4578            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4579        self
4580    }
4581
4582    /// Removes all scopes, and no default scope will be used either.
4583    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4584    /// for details).
4585    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryAptArtifactUploadCall<'a, C> {
4586        self._scopes.clear();
4587        self
4588    }
4589}
4590
4591/// Creates an attachment. The returned Operation will finish once the attachment has been created. Its response will be the created attachment.
4592///
4593/// A builder for the *locations.repositories.attachments.create* method supported by a *project* resource.
4594/// It is not used directly, but through a [`ProjectMethods`] instance.
4595///
4596/// # Example
4597///
4598/// Instantiate a resource method builder
4599///
4600/// ```test_harness,no_run
4601/// # extern crate hyper;
4602/// # extern crate hyper_rustls;
4603/// # extern crate google_artifactregistry1 as artifactregistry1;
4604/// use artifactregistry1::api::Attachment;
4605/// # async fn dox() {
4606/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4607///
4608/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4609/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4610/// #     .with_native_roots()
4611/// #     .unwrap()
4612/// #     .https_only()
4613/// #     .enable_http2()
4614/// #     .build();
4615///
4616/// # let executor = hyper_util::rt::TokioExecutor::new();
4617/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4618/// #     secret,
4619/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4620/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4621/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4622/// #     ),
4623/// # ).build().await.unwrap();
4624///
4625/// # let client = hyper_util::client::legacy::Client::builder(
4626/// #     hyper_util::rt::TokioExecutor::new()
4627/// # )
4628/// # .build(
4629/// #     hyper_rustls::HttpsConnectorBuilder::new()
4630/// #         .with_native_roots()
4631/// #         .unwrap()
4632/// #         .https_or_http()
4633/// #         .enable_http2()
4634/// #         .build()
4635/// # );
4636/// # let mut hub = ArtifactRegistry::new(client, auth);
4637/// // As the method needs a request, you would usually fill it with the desired information
4638/// // into the respective structure. Some of the parts shown here might not be applicable !
4639/// // Values shown here are possibly random and not representative !
4640/// let mut req = Attachment::default();
4641///
4642/// // You can configure optional parameters by calling the respective setters at will, and
4643/// // execute the final call using `doit()`.
4644/// // Values shown here are possibly random and not representative !
4645/// let result = hub.projects().locations_repositories_attachments_create(req, "parent")
4646///              .attachment_id("amet.")
4647///              .doit().await;
4648/// # }
4649/// ```
4650pub struct ProjectLocationRepositoryAttachmentCreateCall<'a, C>
4651where
4652    C: 'a,
4653{
4654    hub: &'a ArtifactRegistry<C>,
4655    _request: Attachment,
4656    _parent: String,
4657    _attachment_id: Option<String>,
4658    _delegate: Option<&'a mut dyn common::Delegate>,
4659    _additional_params: HashMap<String, String>,
4660    _scopes: BTreeSet<String>,
4661}
4662
4663impl<'a, C> common::CallBuilder for ProjectLocationRepositoryAttachmentCreateCall<'a, C> {}
4664
4665impl<'a, C> ProjectLocationRepositoryAttachmentCreateCall<'a, C>
4666where
4667    C: common::Connector,
4668{
4669    /// Perform the operation you have build so far.
4670    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4671        use std::borrow::Cow;
4672        use std::io::{Read, Seek};
4673
4674        use common::{url::Params, ToParts};
4675        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4676
4677        let mut dd = common::DefaultDelegate;
4678        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4679        dlg.begin(common::MethodInfo {
4680            id: "artifactregistry.projects.locations.repositories.attachments.create",
4681            http_method: hyper::Method::POST,
4682        });
4683
4684        for &field in ["alt", "parent", "attachmentId"].iter() {
4685            if self._additional_params.contains_key(field) {
4686                dlg.finished(false);
4687                return Err(common::Error::FieldClash(field));
4688            }
4689        }
4690
4691        let mut params = Params::with_capacity(5 + self._additional_params.len());
4692        params.push("parent", self._parent);
4693        if let Some(value) = self._attachment_id.as_ref() {
4694            params.push("attachmentId", value);
4695        }
4696
4697        params.extend(self._additional_params.iter());
4698
4699        params.push("alt", "json");
4700        let mut url = self.hub._base_url.clone() + "v1/{+parent}/attachments";
4701        if self._scopes.is_empty() {
4702            self._scopes
4703                .insert(Scope::CloudPlatform.as_ref().to_string());
4704        }
4705
4706        #[allow(clippy::single_element_loop)]
4707        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4708            url = params.uri_replacement(url, param_name, find_this, true);
4709        }
4710        {
4711            let to_remove = ["parent"];
4712            params.remove_params(&to_remove);
4713        }
4714
4715        let url = params.parse_with_url(&url);
4716
4717        let mut json_mime_type = mime::APPLICATION_JSON;
4718        let mut request_value_reader = {
4719            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4720            common::remove_json_null_values(&mut value);
4721            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4722            serde_json::to_writer(&mut dst, &value).unwrap();
4723            dst
4724        };
4725        let request_size = request_value_reader
4726            .seek(std::io::SeekFrom::End(0))
4727            .unwrap();
4728        request_value_reader
4729            .seek(std::io::SeekFrom::Start(0))
4730            .unwrap();
4731
4732        loop {
4733            let token = match self
4734                .hub
4735                .auth
4736                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4737                .await
4738            {
4739                Ok(token) => token,
4740                Err(e) => match dlg.token(e) {
4741                    Ok(token) => token,
4742                    Err(e) => {
4743                        dlg.finished(false);
4744                        return Err(common::Error::MissingToken(e));
4745                    }
4746                },
4747            };
4748            request_value_reader
4749                .seek(std::io::SeekFrom::Start(0))
4750                .unwrap();
4751            let mut req_result = {
4752                let client = &self.hub.client;
4753                dlg.pre_request();
4754                let mut req_builder = hyper::Request::builder()
4755                    .method(hyper::Method::POST)
4756                    .uri(url.as_str())
4757                    .header(USER_AGENT, self.hub._user_agent.clone());
4758
4759                if let Some(token) = token.as_ref() {
4760                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4761                }
4762
4763                let request = req_builder
4764                    .header(CONTENT_TYPE, json_mime_type.to_string())
4765                    .header(CONTENT_LENGTH, request_size as u64)
4766                    .body(common::to_body(
4767                        request_value_reader.get_ref().clone().into(),
4768                    ));
4769
4770                client.request(request.unwrap()).await
4771            };
4772
4773            match req_result {
4774                Err(err) => {
4775                    if let common::Retry::After(d) = dlg.http_error(&err) {
4776                        sleep(d).await;
4777                        continue;
4778                    }
4779                    dlg.finished(false);
4780                    return Err(common::Error::HttpError(err));
4781                }
4782                Ok(res) => {
4783                    let (mut parts, body) = res.into_parts();
4784                    let mut body = common::Body::new(body);
4785                    if !parts.status.is_success() {
4786                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4787                        let error = serde_json::from_str(&common::to_string(&bytes));
4788                        let response = common::to_response(parts, bytes.into());
4789
4790                        if let common::Retry::After(d) =
4791                            dlg.http_failure(&response, error.as_ref().ok())
4792                        {
4793                            sleep(d).await;
4794                            continue;
4795                        }
4796
4797                        dlg.finished(false);
4798
4799                        return Err(match error {
4800                            Ok(value) => common::Error::BadRequest(value),
4801                            _ => common::Error::Failure(response),
4802                        });
4803                    }
4804                    let response = {
4805                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4806                        let encoded = common::to_string(&bytes);
4807                        match serde_json::from_str(&encoded) {
4808                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4809                            Err(error) => {
4810                                dlg.response_json_decode_error(&encoded, &error);
4811                                return Err(common::Error::JsonDecodeError(
4812                                    encoded.to_string(),
4813                                    error,
4814                                ));
4815                            }
4816                        }
4817                    };
4818
4819                    dlg.finished(true);
4820                    return Ok(response);
4821                }
4822            }
4823        }
4824    }
4825
4826    ///
4827    /// Sets the *request* property to the given value.
4828    ///
4829    /// Even though the property as already been set when instantiating this call,
4830    /// we provide this method for API completeness.
4831    pub fn request(
4832        mut self,
4833        new_value: Attachment,
4834    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C> {
4835        self._request = new_value;
4836        self
4837    }
4838    /// Required. The name of the parent resource where the attachment will be created.
4839    ///
4840    /// Sets the *parent* path property to the given value.
4841    ///
4842    /// Even though the property as already been set when instantiating this call,
4843    /// we provide this method for API completeness.
4844    pub fn parent(
4845        mut self,
4846        new_value: &str,
4847    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C> {
4848        self._parent = new_value.to_string();
4849        self
4850    }
4851    /// Required. The attachment id to use for this attachment.
4852    ///
4853    /// Sets the *attachment id* query property to the given value.
4854    pub fn attachment_id(
4855        mut self,
4856        new_value: &str,
4857    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C> {
4858        self._attachment_id = Some(new_value.to_string());
4859        self
4860    }
4861    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4862    /// while executing the actual API request.
4863    ///
4864    /// ````text
4865    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4866    /// ````
4867    ///
4868    /// Sets the *delegate* property to the given value.
4869    pub fn delegate(
4870        mut self,
4871        new_value: &'a mut dyn common::Delegate,
4872    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C> {
4873        self._delegate = Some(new_value);
4874        self
4875    }
4876
4877    /// Set any additional parameter of the query string used in the request.
4878    /// It should be used to set parameters which are not yet available through their own
4879    /// setters.
4880    ///
4881    /// Please note that this method must not be used to set any of the known parameters
4882    /// which have their own setter method. If done anyway, the request will fail.
4883    ///
4884    /// # Additional Parameters
4885    ///
4886    /// * *$.xgafv* (query-string) - V1 error format.
4887    /// * *access_token* (query-string) - OAuth access token.
4888    /// * *alt* (query-string) - Data format for response.
4889    /// * *callback* (query-string) - JSONP
4890    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4891    /// * *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.
4892    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4893    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4894    /// * *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.
4895    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4896    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4897    pub fn param<T>(
4898        mut self,
4899        name: T,
4900        value: T,
4901    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C>
4902    where
4903        T: AsRef<str>,
4904    {
4905        self._additional_params
4906            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4907        self
4908    }
4909
4910    /// Identifies the authorization scope for the method you are building.
4911    ///
4912    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4913    /// [`Scope::CloudPlatform`].
4914    ///
4915    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4916    /// tokens for more than one scope.
4917    ///
4918    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4919    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4920    /// sufficient, a read-write scope will do as well.
4921    pub fn add_scope<St>(
4922        mut self,
4923        scope: St,
4924    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C>
4925    where
4926        St: AsRef<str>,
4927    {
4928        self._scopes.insert(String::from(scope.as_ref()));
4929        self
4930    }
4931    /// Identifies the authorization scope(s) for the method you are building.
4932    ///
4933    /// See [`Self::add_scope()`] for details.
4934    pub fn add_scopes<I, St>(
4935        mut self,
4936        scopes: I,
4937    ) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C>
4938    where
4939        I: IntoIterator<Item = St>,
4940        St: AsRef<str>,
4941    {
4942        self._scopes
4943            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4944        self
4945    }
4946
4947    /// Removes all scopes, and no default scope will be used either.
4948    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4949    /// for details).
4950    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryAttachmentCreateCall<'a, C> {
4951        self._scopes.clear();
4952        self
4953    }
4954}
4955
4956/// Deletes an attachment. The returned Operation will finish once the attachments has been deleted. It will not have any Operation metadata and will return a `google.protobuf.Empty` response.
4957///
4958/// A builder for the *locations.repositories.attachments.delete* method supported by a *project* resource.
4959/// It is not used directly, but through a [`ProjectMethods`] instance.
4960///
4961/// # Example
4962///
4963/// Instantiate a resource method builder
4964///
4965/// ```test_harness,no_run
4966/// # extern crate hyper;
4967/// # extern crate hyper_rustls;
4968/// # extern crate google_artifactregistry1 as artifactregistry1;
4969/// # async fn dox() {
4970/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4971///
4972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4973/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4974/// #     .with_native_roots()
4975/// #     .unwrap()
4976/// #     .https_only()
4977/// #     .enable_http2()
4978/// #     .build();
4979///
4980/// # let executor = hyper_util::rt::TokioExecutor::new();
4981/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4982/// #     secret,
4983/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4984/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4985/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4986/// #     ),
4987/// # ).build().await.unwrap();
4988///
4989/// # let client = hyper_util::client::legacy::Client::builder(
4990/// #     hyper_util::rt::TokioExecutor::new()
4991/// # )
4992/// # .build(
4993/// #     hyper_rustls::HttpsConnectorBuilder::new()
4994/// #         .with_native_roots()
4995/// #         .unwrap()
4996/// #         .https_or_http()
4997/// #         .enable_http2()
4998/// #         .build()
4999/// # );
5000/// # let mut hub = ArtifactRegistry::new(client, auth);
5001/// // You can configure optional parameters by calling the respective setters at will, and
5002/// // execute the final call using `doit()`.
5003/// // Values shown here are possibly random and not representative !
5004/// let result = hub.projects().locations_repositories_attachments_delete("name")
5005///              .doit().await;
5006/// # }
5007/// ```
5008pub struct ProjectLocationRepositoryAttachmentDeleteCall<'a, C>
5009where
5010    C: 'a,
5011{
5012    hub: &'a ArtifactRegistry<C>,
5013    _name: String,
5014    _delegate: Option<&'a mut dyn common::Delegate>,
5015    _additional_params: HashMap<String, String>,
5016    _scopes: BTreeSet<String>,
5017}
5018
5019impl<'a, C> common::CallBuilder for ProjectLocationRepositoryAttachmentDeleteCall<'a, C> {}
5020
5021impl<'a, C> ProjectLocationRepositoryAttachmentDeleteCall<'a, C>
5022where
5023    C: common::Connector,
5024{
5025    /// Perform the operation you have build so far.
5026    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5027        use std::borrow::Cow;
5028        use std::io::{Read, Seek};
5029
5030        use common::{url::Params, ToParts};
5031        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5032
5033        let mut dd = common::DefaultDelegate;
5034        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5035        dlg.begin(common::MethodInfo {
5036            id: "artifactregistry.projects.locations.repositories.attachments.delete",
5037            http_method: hyper::Method::DELETE,
5038        });
5039
5040        for &field in ["alt", "name"].iter() {
5041            if self._additional_params.contains_key(field) {
5042                dlg.finished(false);
5043                return Err(common::Error::FieldClash(field));
5044            }
5045        }
5046
5047        let mut params = Params::with_capacity(3 + self._additional_params.len());
5048        params.push("name", self._name);
5049
5050        params.extend(self._additional_params.iter());
5051
5052        params.push("alt", "json");
5053        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5054        if self._scopes.is_empty() {
5055            self._scopes
5056                .insert(Scope::CloudPlatform.as_ref().to_string());
5057        }
5058
5059        #[allow(clippy::single_element_loop)]
5060        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5061            url = params.uri_replacement(url, param_name, find_this, true);
5062        }
5063        {
5064            let to_remove = ["name"];
5065            params.remove_params(&to_remove);
5066        }
5067
5068        let url = params.parse_with_url(&url);
5069
5070        loop {
5071            let token = match self
5072                .hub
5073                .auth
5074                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5075                .await
5076            {
5077                Ok(token) => token,
5078                Err(e) => match dlg.token(e) {
5079                    Ok(token) => token,
5080                    Err(e) => {
5081                        dlg.finished(false);
5082                        return Err(common::Error::MissingToken(e));
5083                    }
5084                },
5085            };
5086            let mut req_result = {
5087                let client = &self.hub.client;
5088                dlg.pre_request();
5089                let mut req_builder = hyper::Request::builder()
5090                    .method(hyper::Method::DELETE)
5091                    .uri(url.as_str())
5092                    .header(USER_AGENT, self.hub._user_agent.clone());
5093
5094                if let Some(token) = token.as_ref() {
5095                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5096                }
5097
5098                let request = req_builder
5099                    .header(CONTENT_LENGTH, 0_u64)
5100                    .body(common::to_body::<String>(None));
5101
5102                client.request(request.unwrap()).await
5103            };
5104
5105            match req_result {
5106                Err(err) => {
5107                    if let common::Retry::After(d) = dlg.http_error(&err) {
5108                        sleep(d).await;
5109                        continue;
5110                    }
5111                    dlg.finished(false);
5112                    return Err(common::Error::HttpError(err));
5113                }
5114                Ok(res) => {
5115                    let (mut parts, body) = res.into_parts();
5116                    let mut body = common::Body::new(body);
5117                    if !parts.status.is_success() {
5118                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5119                        let error = serde_json::from_str(&common::to_string(&bytes));
5120                        let response = common::to_response(parts, bytes.into());
5121
5122                        if let common::Retry::After(d) =
5123                            dlg.http_failure(&response, error.as_ref().ok())
5124                        {
5125                            sleep(d).await;
5126                            continue;
5127                        }
5128
5129                        dlg.finished(false);
5130
5131                        return Err(match error {
5132                            Ok(value) => common::Error::BadRequest(value),
5133                            _ => common::Error::Failure(response),
5134                        });
5135                    }
5136                    let response = {
5137                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5138                        let encoded = common::to_string(&bytes);
5139                        match serde_json::from_str(&encoded) {
5140                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5141                            Err(error) => {
5142                                dlg.response_json_decode_error(&encoded, &error);
5143                                return Err(common::Error::JsonDecodeError(
5144                                    encoded.to_string(),
5145                                    error,
5146                                ));
5147                            }
5148                        }
5149                    };
5150
5151                    dlg.finished(true);
5152                    return Ok(response);
5153                }
5154            }
5155        }
5156    }
5157
5158    /// Required. The name of the attachment to delete.
5159    ///
5160    /// Sets the *name* path property to the given value.
5161    ///
5162    /// Even though the property as already been set when instantiating this call,
5163    /// we provide this method for API completeness.
5164    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryAttachmentDeleteCall<'a, C> {
5165        self._name = new_value.to_string();
5166        self
5167    }
5168    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5169    /// while executing the actual API request.
5170    ///
5171    /// ````text
5172    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5173    /// ````
5174    ///
5175    /// Sets the *delegate* property to the given value.
5176    pub fn delegate(
5177        mut self,
5178        new_value: &'a mut dyn common::Delegate,
5179    ) -> ProjectLocationRepositoryAttachmentDeleteCall<'a, C> {
5180        self._delegate = Some(new_value);
5181        self
5182    }
5183
5184    /// Set any additional parameter of the query string used in the request.
5185    /// It should be used to set parameters which are not yet available through their own
5186    /// setters.
5187    ///
5188    /// Please note that this method must not be used to set any of the known parameters
5189    /// which have their own setter method. If done anyway, the request will fail.
5190    ///
5191    /// # Additional Parameters
5192    ///
5193    /// * *$.xgafv* (query-string) - V1 error format.
5194    /// * *access_token* (query-string) - OAuth access token.
5195    /// * *alt* (query-string) - Data format for response.
5196    /// * *callback* (query-string) - JSONP
5197    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5198    /// * *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.
5199    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5200    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5201    /// * *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.
5202    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5203    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5204    pub fn param<T>(
5205        mut self,
5206        name: T,
5207        value: T,
5208    ) -> ProjectLocationRepositoryAttachmentDeleteCall<'a, C>
5209    where
5210        T: AsRef<str>,
5211    {
5212        self._additional_params
5213            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5214        self
5215    }
5216
5217    /// Identifies the authorization scope for the method you are building.
5218    ///
5219    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5220    /// [`Scope::CloudPlatform`].
5221    ///
5222    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5223    /// tokens for more than one scope.
5224    ///
5225    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5226    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5227    /// sufficient, a read-write scope will do as well.
5228    pub fn add_scope<St>(
5229        mut self,
5230        scope: St,
5231    ) -> ProjectLocationRepositoryAttachmentDeleteCall<'a, C>
5232    where
5233        St: AsRef<str>,
5234    {
5235        self._scopes.insert(String::from(scope.as_ref()));
5236        self
5237    }
5238    /// Identifies the authorization scope(s) for the method you are building.
5239    ///
5240    /// See [`Self::add_scope()`] for details.
5241    pub fn add_scopes<I, St>(
5242        mut self,
5243        scopes: I,
5244    ) -> ProjectLocationRepositoryAttachmentDeleteCall<'a, C>
5245    where
5246        I: IntoIterator<Item = St>,
5247        St: AsRef<str>,
5248    {
5249        self._scopes
5250            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5251        self
5252    }
5253
5254    /// Removes all scopes, and no default scope will be used either.
5255    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5256    /// for details).
5257    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryAttachmentDeleteCall<'a, C> {
5258        self._scopes.clear();
5259        self
5260    }
5261}
5262
5263/// Gets an attachment.
5264///
5265/// A builder for the *locations.repositories.attachments.get* method supported by a *project* resource.
5266/// It is not used directly, but through a [`ProjectMethods`] instance.
5267///
5268/// # Example
5269///
5270/// Instantiate a resource method builder
5271///
5272/// ```test_harness,no_run
5273/// # extern crate hyper;
5274/// # extern crate hyper_rustls;
5275/// # extern crate google_artifactregistry1 as artifactregistry1;
5276/// # async fn dox() {
5277/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5278///
5279/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5280/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5281/// #     .with_native_roots()
5282/// #     .unwrap()
5283/// #     .https_only()
5284/// #     .enable_http2()
5285/// #     .build();
5286///
5287/// # let executor = hyper_util::rt::TokioExecutor::new();
5288/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5289/// #     secret,
5290/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5291/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5292/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5293/// #     ),
5294/// # ).build().await.unwrap();
5295///
5296/// # let client = hyper_util::client::legacy::Client::builder(
5297/// #     hyper_util::rt::TokioExecutor::new()
5298/// # )
5299/// # .build(
5300/// #     hyper_rustls::HttpsConnectorBuilder::new()
5301/// #         .with_native_roots()
5302/// #         .unwrap()
5303/// #         .https_or_http()
5304/// #         .enable_http2()
5305/// #         .build()
5306/// # );
5307/// # let mut hub = ArtifactRegistry::new(client, auth);
5308/// // You can configure optional parameters by calling the respective setters at will, and
5309/// // execute the final call using `doit()`.
5310/// // Values shown here are possibly random and not representative !
5311/// let result = hub.projects().locations_repositories_attachments_get("name")
5312///              .doit().await;
5313/// # }
5314/// ```
5315pub struct ProjectLocationRepositoryAttachmentGetCall<'a, C>
5316where
5317    C: 'a,
5318{
5319    hub: &'a ArtifactRegistry<C>,
5320    _name: String,
5321    _delegate: Option<&'a mut dyn common::Delegate>,
5322    _additional_params: HashMap<String, String>,
5323    _scopes: BTreeSet<String>,
5324}
5325
5326impl<'a, C> common::CallBuilder for ProjectLocationRepositoryAttachmentGetCall<'a, C> {}
5327
5328impl<'a, C> ProjectLocationRepositoryAttachmentGetCall<'a, C>
5329where
5330    C: common::Connector,
5331{
5332    /// Perform the operation you have build so far.
5333    pub async fn doit(mut self) -> common::Result<(common::Response, Attachment)> {
5334        use std::borrow::Cow;
5335        use std::io::{Read, Seek};
5336
5337        use common::{url::Params, ToParts};
5338        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5339
5340        let mut dd = common::DefaultDelegate;
5341        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5342        dlg.begin(common::MethodInfo {
5343            id: "artifactregistry.projects.locations.repositories.attachments.get",
5344            http_method: hyper::Method::GET,
5345        });
5346
5347        for &field in ["alt", "name"].iter() {
5348            if self._additional_params.contains_key(field) {
5349                dlg.finished(false);
5350                return Err(common::Error::FieldClash(field));
5351            }
5352        }
5353
5354        let mut params = Params::with_capacity(3 + self._additional_params.len());
5355        params.push("name", self._name);
5356
5357        params.extend(self._additional_params.iter());
5358
5359        params.push("alt", "json");
5360        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5361        if self._scopes.is_empty() {
5362            self._scopes
5363                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5364        }
5365
5366        #[allow(clippy::single_element_loop)]
5367        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5368            url = params.uri_replacement(url, param_name, find_this, true);
5369        }
5370        {
5371            let to_remove = ["name"];
5372            params.remove_params(&to_remove);
5373        }
5374
5375        let url = params.parse_with_url(&url);
5376
5377        loop {
5378            let token = match self
5379                .hub
5380                .auth
5381                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5382                .await
5383            {
5384                Ok(token) => token,
5385                Err(e) => match dlg.token(e) {
5386                    Ok(token) => token,
5387                    Err(e) => {
5388                        dlg.finished(false);
5389                        return Err(common::Error::MissingToken(e));
5390                    }
5391                },
5392            };
5393            let mut req_result = {
5394                let client = &self.hub.client;
5395                dlg.pre_request();
5396                let mut req_builder = hyper::Request::builder()
5397                    .method(hyper::Method::GET)
5398                    .uri(url.as_str())
5399                    .header(USER_AGENT, self.hub._user_agent.clone());
5400
5401                if let Some(token) = token.as_ref() {
5402                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5403                }
5404
5405                let request = req_builder
5406                    .header(CONTENT_LENGTH, 0_u64)
5407                    .body(common::to_body::<String>(None));
5408
5409                client.request(request.unwrap()).await
5410            };
5411
5412            match req_result {
5413                Err(err) => {
5414                    if let common::Retry::After(d) = dlg.http_error(&err) {
5415                        sleep(d).await;
5416                        continue;
5417                    }
5418                    dlg.finished(false);
5419                    return Err(common::Error::HttpError(err));
5420                }
5421                Ok(res) => {
5422                    let (mut parts, body) = res.into_parts();
5423                    let mut body = common::Body::new(body);
5424                    if !parts.status.is_success() {
5425                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5426                        let error = serde_json::from_str(&common::to_string(&bytes));
5427                        let response = common::to_response(parts, bytes.into());
5428
5429                        if let common::Retry::After(d) =
5430                            dlg.http_failure(&response, error.as_ref().ok())
5431                        {
5432                            sleep(d).await;
5433                            continue;
5434                        }
5435
5436                        dlg.finished(false);
5437
5438                        return Err(match error {
5439                            Ok(value) => common::Error::BadRequest(value),
5440                            _ => common::Error::Failure(response),
5441                        });
5442                    }
5443                    let response = {
5444                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5445                        let encoded = common::to_string(&bytes);
5446                        match serde_json::from_str(&encoded) {
5447                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5448                            Err(error) => {
5449                                dlg.response_json_decode_error(&encoded, &error);
5450                                return Err(common::Error::JsonDecodeError(
5451                                    encoded.to_string(),
5452                                    error,
5453                                ));
5454                            }
5455                        }
5456                    };
5457
5458                    dlg.finished(true);
5459                    return Ok(response);
5460                }
5461            }
5462        }
5463    }
5464
5465    /// Required. The name of the attachment to retrieve.
5466    ///
5467    /// Sets the *name* path property to the given value.
5468    ///
5469    /// Even though the property as already been set when instantiating this call,
5470    /// we provide this method for API completeness.
5471    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryAttachmentGetCall<'a, C> {
5472        self._name = new_value.to_string();
5473        self
5474    }
5475    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5476    /// while executing the actual API request.
5477    ///
5478    /// ````text
5479    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5480    /// ````
5481    ///
5482    /// Sets the *delegate* property to the given value.
5483    pub fn delegate(
5484        mut self,
5485        new_value: &'a mut dyn common::Delegate,
5486    ) -> ProjectLocationRepositoryAttachmentGetCall<'a, C> {
5487        self._delegate = Some(new_value);
5488        self
5489    }
5490
5491    /// Set any additional parameter of the query string used in the request.
5492    /// It should be used to set parameters which are not yet available through their own
5493    /// setters.
5494    ///
5495    /// Please note that this method must not be used to set any of the known parameters
5496    /// which have their own setter method. If done anyway, the request will fail.
5497    ///
5498    /// # Additional Parameters
5499    ///
5500    /// * *$.xgafv* (query-string) - V1 error format.
5501    /// * *access_token* (query-string) - OAuth access token.
5502    /// * *alt* (query-string) - Data format for response.
5503    /// * *callback* (query-string) - JSONP
5504    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5505    /// * *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.
5506    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5507    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5508    /// * *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.
5509    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5510    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5511    pub fn param<T>(
5512        mut self,
5513        name: T,
5514        value: T,
5515    ) -> ProjectLocationRepositoryAttachmentGetCall<'a, C>
5516    where
5517        T: AsRef<str>,
5518    {
5519        self._additional_params
5520            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5521        self
5522    }
5523
5524    /// Identifies the authorization scope for the method you are building.
5525    ///
5526    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5527    /// [`Scope::CloudPlatformReadOnly`].
5528    ///
5529    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5530    /// tokens for more than one scope.
5531    ///
5532    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5533    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5534    /// sufficient, a read-write scope will do as well.
5535    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryAttachmentGetCall<'a, C>
5536    where
5537        St: AsRef<str>,
5538    {
5539        self._scopes.insert(String::from(scope.as_ref()));
5540        self
5541    }
5542    /// Identifies the authorization scope(s) for the method you are building.
5543    ///
5544    /// See [`Self::add_scope()`] for details.
5545    pub fn add_scopes<I, St>(
5546        mut self,
5547        scopes: I,
5548    ) -> ProjectLocationRepositoryAttachmentGetCall<'a, C>
5549    where
5550        I: IntoIterator<Item = St>,
5551        St: AsRef<str>,
5552    {
5553        self._scopes
5554            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5555        self
5556    }
5557
5558    /// Removes all scopes, and no default scope will be used either.
5559    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5560    /// for details).
5561    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryAttachmentGetCall<'a, C> {
5562        self._scopes.clear();
5563        self
5564    }
5565}
5566
5567/// Lists attachments.
5568///
5569/// A builder for the *locations.repositories.attachments.list* method supported by a *project* resource.
5570/// It is not used directly, but through a [`ProjectMethods`] instance.
5571///
5572/// # Example
5573///
5574/// Instantiate a resource method builder
5575///
5576/// ```test_harness,no_run
5577/// # extern crate hyper;
5578/// # extern crate hyper_rustls;
5579/// # extern crate google_artifactregistry1 as artifactregistry1;
5580/// # async fn dox() {
5581/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5582///
5583/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5584/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5585/// #     .with_native_roots()
5586/// #     .unwrap()
5587/// #     .https_only()
5588/// #     .enable_http2()
5589/// #     .build();
5590///
5591/// # let executor = hyper_util::rt::TokioExecutor::new();
5592/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5593/// #     secret,
5594/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5595/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5596/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5597/// #     ),
5598/// # ).build().await.unwrap();
5599///
5600/// # let client = hyper_util::client::legacy::Client::builder(
5601/// #     hyper_util::rt::TokioExecutor::new()
5602/// # )
5603/// # .build(
5604/// #     hyper_rustls::HttpsConnectorBuilder::new()
5605/// #         .with_native_roots()
5606/// #         .unwrap()
5607/// #         .https_or_http()
5608/// #         .enable_http2()
5609/// #         .build()
5610/// # );
5611/// # let mut hub = ArtifactRegistry::new(client, auth);
5612/// // You can configure optional parameters by calling the respective setters at will, and
5613/// // execute the final call using `doit()`.
5614/// // Values shown here are possibly random and not representative !
5615/// let result = hub.projects().locations_repositories_attachments_list("parent")
5616///              .page_token("Lorem")
5617///              .page_size(-12)
5618///              .filter("eos")
5619///              .doit().await;
5620/// # }
5621/// ```
5622pub struct ProjectLocationRepositoryAttachmentListCall<'a, C>
5623where
5624    C: 'a,
5625{
5626    hub: &'a ArtifactRegistry<C>,
5627    _parent: String,
5628    _page_token: Option<String>,
5629    _page_size: Option<i32>,
5630    _filter: Option<String>,
5631    _delegate: Option<&'a mut dyn common::Delegate>,
5632    _additional_params: HashMap<String, String>,
5633    _scopes: BTreeSet<String>,
5634}
5635
5636impl<'a, C> common::CallBuilder for ProjectLocationRepositoryAttachmentListCall<'a, C> {}
5637
5638impl<'a, C> ProjectLocationRepositoryAttachmentListCall<'a, C>
5639where
5640    C: common::Connector,
5641{
5642    /// Perform the operation you have build so far.
5643    pub async fn doit(mut self) -> common::Result<(common::Response, ListAttachmentsResponse)> {
5644        use std::borrow::Cow;
5645        use std::io::{Read, Seek};
5646
5647        use common::{url::Params, ToParts};
5648        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5649
5650        let mut dd = common::DefaultDelegate;
5651        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5652        dlg.begin(common::MethodInfo {
5653            id: "artifactregistry.projects.locations.repositories.attachments.list",
5654            http_method: hyper::Method::GET,
5655        });
5656
5657        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
5658            if self._additional_params.contains_key(field) {
5659                dlg.finished(false);
5660                return Err(common::Error::FieldClash(field));
5661            }
5662        }
5663
5664        let mut params = Params::with_capacity(6 + self._additional_params.len());
5665        params.push("parent", self._parent);
5666        if let Some(value) = self._page_token.as_ref() {
5667            params.push("pageToken", value);
5668        }
5669        if let Some(value) = self._page_size.as_ref() {
5670            params.push("pageSize", value.to_string());
5671        }
5672        if let Some(value) = self._filter.as_ref() {
5673            params.push("filter", value);
5674        }
5675
5676        params.extend(self._additional_params.iter());
5677
5678        params.push("alt", "json");
5679        let mut url = self.hub._base_url.clone() + "v1/{+parent}/attachments";
5680        if self._scopes.is_empty() {
5681            self._scopes
5682                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5683        }
5684
5685        #[allow(clippy::single_element_loop)]
5686        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5687            url = params.uri_replacement(url, param_name, find_this, true);
5688        }
5689        {
5690            let to_remove = ["parent"];
5691            params.remove_params(&to_remove);
5692        }
5693
5694        let url = params.parse_with_url(&url);
5695
5696        loop {
5697            let token = match self
5698                .hub
5699                .auth
5700                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5701                .await
5702            {
5703                Ok(token) => token,
5704                Err(e) => match dlg.token(e) {
5705                    Ok(token) => token,
5706                    Err(e) => {
5707                        dlg.finished(false);
5708                        return Err(common::Error::MissingToken(e));
5709                    }
5710                },
5711            };
5712            let mut req_result = {
5713                let client = &self.hub.client;
5714                dlg.pre_request();
5715                let mut req_builder = hyper::Request::builder()
5716                    .method(hyper::Method::GET)
5717                    .uri(url.as_str())
5718                    .header(USER_AGENT, self.hub._user_agent.clone());
5719
5720                if let Some(token) = token.as_ref() {
5721                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5722                }
5723
5724                let request = req_builder
5725                    .header(CONTENT_LENGTH, 0_u64)
5726                    .body(common::to_body::<String>(None));
5727
5728                client.request(request.unwrap()).await
5729            };
5730
5731            match req_result {
5732                Err(err) => {
5733                    if let common::Retry::After(d) = dlg.http_error(&err) {
5734                        sleep(d).await;
5735                        continue;
5736                    }
5737                    dlg.finished(false);
5738                    return Err(common::Error::HttpError(err));
5739                }
5740                Ok(res) => {
5741                    let (mut parts, body) = res.into_parts();
5742                    let mut body = common::Body::new(body);
5743                    if !parts.status.is_success() {
5744                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5745                        let error = serde_json::from_str(&common::to_string(&bytes));
5746                        let response = common::to_response(parts, bytes.into());
5747
5748                        if let common::Retry::After(d) =
5749                            dlg.http_failure(&response, error.as_ref().ok())
5750                        {
5751                            sleep(d).await;
5752                            continue;
5753                        }
5754
5755                        dlg.finished(false);
5756
5757                        return Err(match error {
5758                            Ok(value) => common::Error::BadRequest(value),
5759                            _ => common::Error::Failure(response),
5760                        });
5761                    }
5762                    let response = {
5763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5764                        let encoded = common::to_string(&bytes);
5765                        match serde_json::from_str(&encoded) {
5766                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5767                            Err(error) => {
5768                                dlg.response_json_decode_error(&encoded, &error);
5769                                return Err(common::Error::JsonDecodeError(
5770                                    encoded.to_string(),
5771                                    error,
5772                                ));
5773                            }
5774                        }
5775                    };
5776
5777                    dlg.finished(true);
5778                    return Ok(response);
5779                }
5780            }
5781        }
5782    }
5783
5784    /// Required. The name of the parent resource whose attachments will be listed.
5785    ///
5786    /// Sets the *parent* path property to the given value.
5787    ///
5788    /// Even though the property as already been set when instantiating this call,
5789    /// we provide this method for API completeness.
5790    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryAttachmentListCall<'a, C> {
5791        self._parent = new_value.to_string();
5792        self
5793    }
5794    /// The next_page_token value returned from a previous list request, if any.
5795    ///
5796    /// Sets the *page token* query property to the given value.
5797    pub fn page_token(
5798        mut self,
5799        new_value: &str,
5800    ) -> ProjectLocationRepositoryAttachmentListCall<'a, C> {
5801        self._page_token = Some(new_value.to_string());
5802        self
5803    }
5804    /// The maximum number of attachments to return. Maximum page size is 1,000.
5805    ///
5806    /// Sets the *page size* query property to the given value.
5807    pub fn page_size(
5808        mut self,
5809        new_value: i32,
5810    ) -> ProjectLocationRepositoryAttachmentListCall<'a, C> {
5811        self._page_size = Some(new_value);
5812        self
5813    }
5814    /// Optional. An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: * `target` * `type` * `attachment_namespace`
5815    ///
5816    /// Sets the *filter* query property to the given value.
5817    pub fn filter(mut self, new_value: &str) -> ProjectLocationRepositoryAttachmentListCall<'a, C> {
5818        self._filter = Some(new_value.to_string());
5819        self
5820    }
5821    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5822    /// while executing the actual API request.
5823    ///
5824    /// ````text
5825    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5826    /// ````
5827    ///
5828    /// Sets the *delegate* property to the given value.
5829    pub fn delegate(
5830        mut self,
5831        new_value: &'a mut dyn common::Delegate,
5832    ) -> ProjectLocationRepositoryAttachmentListCall<'a, C> {
5833        self._delegate = Some(new_value);
5834        self
5835    }
5836
5837    /// Set any additional parameter of the query string used in the request.
5838    /// It should be used to set parameters which are not yet available through their own
5839    /// setters.
5840    ///
5841    /// Please note that this method must not be used to set any of the known parameters
5842    /// which have their own setter method. If done anyway, the request will fail.
5843    ///
5844    /// # Additional Parameters
5845    ///
5846    /// * *$.xgafv* (query-string) - V1 error format.
5847    /// * *access_token* (query-string) - OAuth access token.
5848    /// * *alt* (query-string) - Data format for response.
5849    /// * *callback* (query-string) - JSONP
5850    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5851    /// * *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.
5852    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5853    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5854    /// * *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.
5855    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5856    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5857    pub fn param<T>(
5858        mut self,
5859        name: T,
5860        value: T,
5861    ) -> ProjectLocationRepositoryAttachmentListCall<'a, C>
5862    where
5863        T: AsRef<str>,
5864    {
5865        self._additional_params
5866            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5867        self
5868    }
5869
5870    /// Identifies the authorization scope for the method you are building.
5871    ///
5872    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5873    /// [`Scope::CloudPlatformReadOnly`].
5874    ///
5875    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5876    /// tokens for more than one scope.
5877    ///
5878    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5879    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5880    /// sufficient, a read-write scope will do as well.
5881    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryAttachmentListCall<'a, C>
5882    where
5883        St: AsRef<str>,
5884    {
5885        self._scopes.insert(String::from(scope.as_ref()));
5886        self
5887    }
5888    /// Identifies the authorization scope(s) for the method you are building.
5889    ///
5890    /// See [`Self::add_scope()`] for details.
5891    pub fn add_scopes<I, St>(
5892        mut self,
5893        scopes: I,
5894    ) -> ProjectLocationRepositoryAttachmentListCall<'a, C>
5895    where
5896        I: IntoIterator<Item = St>,
5897        St: AsRef<str>,
5898    {
5899        self._scopes
5900            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5901        self
5902    }
5903
5904    /// Removes all scopes, and no default scope will be used either.
5905    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5906    /// for details).
5907    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryAttachmentListCall<'a, C> {
5908        self._scopes.clear();
5909        self
5910    }
5911}
5912
5913/// Gets a docker image.
5914///
5915/// A builder for the *locations.repositories.dockerImages.get* method supported by a *project* resource.
5916/// It is not used directly, but through a [`ProjectMethods`] instance.
5917///
5918/// # Example
5919///
5920/// Instantiate a resource method builder
5921///
5922/// ```test_harness,no_run
5923/// # extern crate hyper;
5924/// # extern crate hyper_rustls;
5925/// # extern crate google_artifactregistry1 as artifactregistry1;
5926/// # async fn dox() {
5927/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5928///
5929/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5930/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5931/// #     .with_native_roots()
5932/// #     .unwrap()
5933/// #     .https_only()
5934/// #     .enable_http2()
5935/// #     .build();
5936///
5937/// # let executor = hyper_util::rt::TokioExecutor::new();
5938/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5939/// #     secret,
5940/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5941/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5942/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5943/// #     ),
5944/// # ).build().await.unwrap();
5945///
5946/// # let client = hyper_util::client::legacy::Client::builder(
5947/// #     hyper_util::rt::TokioExecutor::new()
5948/// # )
5949/// # .build(
5950/// #     hyper_rustls::HttpsConnectorBuilder::new()
5951/// #         .with_native_roots()
5952/// #         .unwrap()
5953/// #         .https_or_http()
5954/// #         .enable_http2()
5955/// #         .build()
5956/// # );
5957/// # let mut hub = ArtifactRegistry::new(client, auth);
5958/// // You can configure optional parameters by calling the respective setters at will, and
5959/// // execute the final call using `doit()`.
5960/// // Values shown here are possibly random and not representative !
5961/// let result = hub.projects().locations_repositories_docker_images_get("name")
5962///              .doit().await;
5963/// # }
5964/// ```
5965pub struct ProjectLocationRepositoryDockerImageGetCall<'a, C>
5966where
5967    C: 'a,
5968{
5969    hub: &'a ArtifactRegistry<C>,
5970    _name: String,
5971    _delegate: Option<&'a mut dyn common::Delegate>,
5972    _additional_params: HashMap<String, String>,
5973    _scopes: BTreeSet<String>,
5974}
5975
5976impl<'a, C> common::CallBuilder for ProjectLocationRepositoryDockerImageGetCall<'a, C> {}
5977
5978impl<'a, C> ProjectLocationRepositoryDockerImageGetCall<'a, C>
5979where
5980    C: common::Connector,
5981{
5982    /// Perform the operation you have build so far.
5983    pub async fn doit(mut self) -> common::Result<(common::Response, DockerImage)> {
5984        use std::borrow::Cow;
5985        use std::io::{Read, Seek};
5986
5987        use common::{url::Params, ToParts};
5988        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5989
5990        let mut dd = common::DefaultDelegate;
5991        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5992        dlg.begin(common::MethodInfo {
5993            id: "artifactregistry.projects.locations.repositories.dockerImages.get",
5994            http_method: hyper::Method::GET,
5995        });
5996
5997        for &field in ["alt", "name"].iter() {
5998            if self._additional_params.contains_key(field) {
5999                dlg.finished(false);
6000                return Err(common::Error::FieldClash(field));
6001            }
6002        }
6003
6004        let mut params = Params::with_capacity(3 + self._additional_params.len());
6005        params.push("name", self._name);
6006
6007        params.extend(self._additional_params.iter());
6008
6009        params.push("alt", "json");
6010        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6011        if self._scopes.is_empty() {
6012            self._scopes
6013                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6014        }
6015
6016        #[allow(clippy::single_element_loop)]
6017        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6018            url = params.uri_replacement(url, param_name, find_this, true);
6019        }
6020        {
6021            let to_remove = ["name"];
6022            params.remove_params(&to_remove);
6023        }
6024
6025        let url = params.parse_with_url(&url);
6026
6027        loop {
6028            let token = match self
6029                .hub
6030                .auth
6031                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6032                .await
6033            {
6034                Ok(token) => token,
6035                Err(e) => match dlg.token(e) {
6036                    Ok(token) => token,
6037                    Err(e) => {
6038                        dlg.finished(false);
6039                        return Err(common::Error::MissingToken(e));
6040                    }
6041                },
6042            };
6043            let mut req_result = {
6044                let client = &self.hub.client;
6045                dlg.pre_request();
6046                let mut req_builder = hyper::Request::builder()
6047                    .method(hyper::Method::GET)
6048                    .uri(url.as_str())
6049                    .header(USER_AGENT, self.hub._user_agent.clone());
6050
6051                if let Some(token) = token.as_ref() {
6052                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6053                }
6054
6055                let request = req_builder
6056                    .header(CONTENT_LENGTH, 0_u64)
6057                    .body(common::to_body::<String>(None));
6058
6059                client.request(request.unwrap()).await
6060            };
6061
6062            match req_result {
6063                Err(err) => {
6064                    if let common::Retry::After(d) = dlg.http_error(&err) {
6065                        sleep(d).await;
6066                        continue;
6067                    }
6068                    dlg.finished(false);
6069                    return Err(common::Error::HttpError(err));
6070                }
6071                Ok(res) => {
6072                    let (mut parts, body) = res.into_parts();
6073                    let mut body = common::Body::new(body);
6074                    if !parts.status.is_success() {
6075                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6076                        let error = serde_json::from_str(&common::to_string(&bytes));
6077                        let response = common::to_response(parts, bytes.into());
6078
6079                        if let common::Retry::After(d) =
6080                            dlg.http_failure(&response, error.as_ref().ok())
6081                        {
6082                            sleep(d).await;
6083                            continue;
6084                        }
6085
6086                        dlg.finished(false);
6087
6088                        return Err(match error {
6089                            Ok(value) => common::Error::BadRequest(value),
6090                            _ => common::Error::Failure(response),
6091                        });
6092                    }
6093                    let response = {
6094                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6095                        let encoded = common::to_string(&bytes);
6096                        match serde_json::from_str(&encoded) {
6097                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6098                            Err(error) => {
6099                                dlg.response_json_decode_error(&encoded, &error);
6100                                return Err(common::Error::JsonDecodeError(
6101                                    encoded.to_string(),
6102                                    error,
6103                                ));
6104                            }
6105                        }
6106                    };
6107
6108                    dlg.finished(true);
6109                    return Ok(response);
6110                }
6111            }
6112        }
6113    }
6114
6115    /// Required. The name of the docker images.
6116    ///
6117    /// Sets the *name* path property to the given value.
6118    ///
6119    /// Even though the property as already been set when instantiating this call,
6120    /// we provide this method for API completeness.
6121    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryDockerImageGetCall<'a, C> {
6122        self._name = new_value.to_string();
6123        self
6124    }
6125    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6126    /// while executing the actual API request.
6127    ///
6128    /// ````text
6129    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6130    /// ````
6131    ///
6132    /// Sets the *delegate* property to the given value.
6133    pub fn delegate(
6134        mut self,
6135        new_value: &'a mut dyn common::Delegate,
6136    ) -> ProjectLocationRepositoryDockerImageGetCall<'a, C> {
6137        self._delegate = Some(new_value);
6138        self
6139    }
6140
6141    /// Set any additional parameter of the query string used in the request.
6142    /// It should be used to set parameters which are not yet available through their own
6143    /// setters.
6144    ///
6145    /// Please note that this method must not be used to set any of the known parameters
6146    /// which have their own setter method. If done anyway, the request will fail.
6147    ///
6148    /// # Additional Parameters
6149    ///
6150    /// * *$.xgafv* (query-string) - V1 error format.
6151    /// * *access_token* (query-string) - OAuth access token.
6152    /// * *alt* (query-string) - Data format for response.
6153    /// * *callback* (query-string) - JSONP
6154    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6155    /// * *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.
6156    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6157    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6158    /// * *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.
6159    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6160    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6161    pub fn param<T>(
6162        mut self,
6163        name: T,
6164        value: T,
6165    ) -> ProjectLocationRepositoryDockerImageGetCall<'a, C>
6166    where
6167        T: AsRef<str>,
6168    {
6169        self._additional_params
6170            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6171        self
6172    }
6173
6174    /// Identifies the authorization scope for the method you are building.
6175    ///
6176    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6177    /// [`Scope::CloudPlatformReadOnly`].
6178    ///
6179    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6180    /// tokens for more than one scope.
6181    ///
6182    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6183    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6184    /// sufficient, a read-write scope will do as well.
6185    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryDockerImageGetCall<'a, C>
6186    where
6187        St: AsRef<str>,
6188    {
6189        self._scopes.insert(String::from(scope.as_ref()));
6190        self
6191    }
6192    /// Identifies the authorization scope(s) for the method you are building.
6193    ///
6194    /// See [`Self::add_scope()`] for details.
6195    pub fn add_scopes<I, St>(
6196        mut self,
6197        scopes: I,
6198    ) -> ProjectLocationRepositoryDockerImageGetCall<'a, C>
6199    where
6200        I: IntoIterator<Item = St>,
6201        St: AsRef<str>,
6202    {
6203        self._scopes
6204            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6205        self
6206    }
6207
6208    /// Removes all scopes, and no default scope will be used either.
6209    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6210    /// for details).
6211    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryDockerImageGetCall<'a, C> {
6212        self._scopes.clear();
6213        self
6214    }
6215}
6216
6217/// Lists docker images.
6218///
6219/// A builder for the *locations.repositories.dockerImages.list* method supported by a *project* resource.
6220/// It is not used directly, but through a [`ProjectMethods`] instance.
6221///
6222/// # Example
6223///
6224/// Instantiate a resource method builder
6225///
6226/// ```test_harness,no_run
6227/// # extern crate hyper;
6228/// # extern crate hyper_rustls;
6229/// # extern crate google_artifactregistry1 as artifactregistry1;
6230/// # async fn dox() {
6231/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6232///
6233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6234/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6235/// #     .with_native_roots()
6236/// #     .unwrap()
6237/// #     .https_only()
6238/// #     .enable_http2()
6239/// #     .build();
6240///
6241/// # let executor = hyper_util::rt::TokioExecutor::new();
6242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6243/// #     secret,
6244/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6245/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6246/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6247/// #     ),
6248/// # ).build().await.unwrap();
6249///
6250/// # let client = hyper_util::client::legacy::Client::builder(
6251/// #     hyper_util::rt::TokioExecutor::new()
6252/// # )
6253/// # .build(
6254/// #     hyper_rustls::HttpsConnectorBuilder::new()
6255/// #         .with_native_roots()
6256/// #         .unwrap()
6257/// #         .https_or_http()
6258/// #         .enable_http2()
6259/// #         .build()
6260/// # );
6261/// # let mut hub = ArtifactRegistry::new(client, auth);
6262/// // You can configure optional parameters by calling the respective setters at will, and
6263/// // execute the final call using `doit()`.
6264/// // Values shown here are possibly random and not representative !
6265/// let result = hub.projects().locations_repositories_docker_images_list("parent")
6266///              .page_token("ipsum")
6267///              .page_size(-88)
6268///              .order_by("amet")
6269///              .doit().await;
6270/// # }
6271/// ```
6272pub struct ProjectLocationRepositoryDockerImageListCall<'a, C>
6273where
6274    C: 'a,
6275{
6276    hub: &'a ArtifactRegistry<C>,
6277    _parent: String,
6278    _page_token: Option<String>,
6279    _page_size: Option<i32>,
6280    _order_by: Option<String>,
6281    _delegate: Option<&'a mut dyn common::Delegate>,
6282    _additional_params: HashMap<String, String>,
6283    _scopes: BTreeSet<String>,
6284}
6285
6286impl<'a, C> common::CallBuilder for ProjectLocationRepositoryDockerImageListCall<'a, C> {}
6287
6288impl<'a, C> ProjectLocationRepositoryDockerImageListCall<'a, C>
6289where
6290    C: common::Connector,
6291{
6292    /// Perform the operation you have build so far.
6293    pub async fn doit(mut self) -> common::Result<(common::Response, ListDockerImagesResponse)> {
6294        use std::borrow::Cow;
6295        use std::io::{Read, Seek};
6296
6297        use common::{url::Params, ToParts};
6298        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6299
6300        let mut dd = common::DefaultDelegate;
6301        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6302        dlg.begin(common::MethodInfo {
6303            id: "artifactregistry.projects.locations.repositories.dockerImages.list",
6304            http_method: hyper::Method::GET,
6305        });
6306
6307        for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy"].iter() {
6308            if self._additional_params.contains_key(field) {
6309                dlg.finished(false);
6310                return Err(common::Error::FieldClash(field));
6311            }
6312        }
6313
6314        let mut params = Params::with_capacity(6 + self._additional_params.len());
6315        params.push("parent", self._parent);
6316        if let Some(value) = self._page_token.as_ref() {
6317            params.push("pageToken", value);
6318        }
6319        if let Some(value) = self._page_size.as_ref() {
6320            params.push("pageSize", value.to_string());
6321        }
6322        if let Some(value) = self._order_by.as_ref() {
6323            params.push("orderBy", value);
6324        }
6325
6326        params.extend(self._additional_params.iter());
6327
6328        params.push("alt", "json");
6329        let mut url = self.hub._base_url.clone() + "v1/{+parent}/dockerImages";
6330        if self._scopes.is_empty() {
6331            self._scopes
6332                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6333        }
6334
6335        #[allow(clippy::single_element_loop)]
6336        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6337            url = params.uri_replacement(url, param_name, find_this, true);
6338        }
6339        {
6340            let to_remove = ["parent"];
6341            params.remove_params(&to_remove);
6342        }
6343
6344        let url = params.parse_with_url(&url);
6345
6346        loop {
6347            let token = match self
6348                .hub
6349                .auth
6350                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6351                .await
6352            {
6353                Ok(token) => token,
6354                Err(e) => match dlg.token(e) {
6355                    Ok(token) => token,
6356                    Err(e) => {
6357                        dlg.finished(false);
6358                        return Err(common::Error::MissingToken(e));
6359                    }
6360                },
6361            };
6362            let mut req_result = {
6363                let client = &self.hub.client;
6364                dlg.pre_request();
6365                let mut req_builder = hyper::Request::builder()
6366                    .method(hyper::Method::GET)
6367                    .uri(url.as_str())
6368                    .header(USER_AGENT, self.hub._user_agent.clone());
6369
6370                if let Some(token) = token.as_ref() {
6371                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6372                }
6373
6374                let request = req_builder
6375                    .header(CONTENT_LENGTH, 0_u64)
6376                    .body(common::to_body::<String>(None));
6377
6378                client.request(request.unwrap()).await
6379            };
6380
6381            match req_result {
6382                Err(err) => {
6383                    if let common::Retry::After(d) = dlg.http_error(&err) {
6384                        sleep(d).await;
6385                        continue;
6386                    }
6387                    dlg.finished(false);
6388                    return Err(common::Error::HttpError(err));
6389                }
6390                Ok(res) => {
6391                    let (mut parts, body) = res.into_parts();
6392                    let mut body = common::Body::new(body);
6393                    if !parts.status.is_success() {
6394                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6395                        let error = serde_json::from_str(&common::to_string(&bytes));
6396                        let response = common::to_response(parts, bytes.into());
6397
6398                        if let common::Retry::After(d) =
6399                            dlg.http_failure(&response, error.as_ref().ok())
6400                        {
6401                            sleep(d).await;
6402                            continue;
6403                        }
6404
6405                        dlg.finished(false);
6406
6407                        return Err(match error {
6408                            Ok(value) => common::Error::BadRequest(value),
6409                            _ => common::Error::Failure(response),
6410                        });
6411                    }
6412                    let response = {
6413                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6414                        let encoded = common::to_string(&bytes);
6415                        match serde_json::from_str(&encoded) {
6416                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6417                            Err(error) => {
6418                                dlg.response_json_decode_error(&encoded, &error);
6419                                return Err(common::Error::JsonDecodeError(
6420                                    encoded.to_string(),
6421                                    error,
6422                                ));
6423                            }
6424                        }
6425                    };
6426
6427                    dlg.finished(true);
6428                    return Ok(response);
6429                }
6430            }
6431        }
6432    }
6433
6434    /// Required. The name of the parent resource whose docker images will be listed.
6435    ///
6436    /// Sets the *parent* path property to the given value.
6437    ///
6438    /// Even though the property as already been set when instantiating this call,
6439    /// we provide this method for API completeness.
6440    pub fn parent(
6441        mut self,
6442        new_value: &str,
6443    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C> {
6444        self._parent = new_value.to_string();
6445        self
6446    }
6447    /// The next_page_token value returned from a previous list request, if any.
6448    ///
6449    /// Sets the *page token* query property to the given value.
6450    pub fn page_token(
6451        mut self,
6452        new_value: &str,
6453    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C> {
6454        self._page_token = Some(new_value.to_string());
6455        self
6456    }
6457    /// The maximum number of artifacts to return. Maximum page size is 1,000.
6458    ///
6459    /// Sets the *page size* query property to the given value.
6460    pub fn page_size(
6461        mut self,
6462        new_value: i32,
6463    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C> {
6464        self._page_size = Some(new_value);
6465        self
6466    }
6467    /// The field to order the results by.
6468    ///
6469    /// Sets the *order by* query property to the given value.
6470    pub fn order_by(
6471        mut self,
6472        new_value: &str,
6473    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C> {
6474        self._order_by = Some(new_value.to_string());
6475        self
6476    }
6477    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6478    /// while executing the actual API request.
6479    ///
6480    /// ````text
6481    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6482    /// ````
6483    ///
6484    /// Sets the *delegate* property to the given value.
6485    pub fn delegate(
6486        mut self,
6487        new_value: &'a mut dyn common::Delegate,
6488    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C> {
6489        self._delegate = Some(new_value);
6490        self
6491    }
6492
6493    /// Set any additional parameter of the query string used in the request.
6494    /// It should be used to set parameters which are not yet available through their own
6495    /// setters.
6496    ///
6497    /// Please note that this method must not be used to set any of the known parameters
6498    /// which have their own setter method. If done anyway, the request will fail.
6499    ///
6500    /// # Additional Parameters
6501    ///
6502    /// * *$.xgafv* (query-string) - V1 error format.
6503    /// * *access_token* (query-string) - OAuth access token.
6504    /// * *alt* (query-string) - Data format for response.
6505    /// * *callback* (query-string) - JSONP
6506    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6507    /// * *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.
6508    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6509    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6510    /// * *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.
6511    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6512    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6513    pub fn param<T>(
6514        mut self,
6515        name: T,
6516        value: T,
6517    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C>
6518    where
6519        T: AsRef<str>,
6520    {
6521        self._additional_params
6522            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6523        self
6524    }
6525
6526    /// Identifies the authorization scope for the method you are building.
6527    ///
6528    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6529    /// [`Scope::CloudPlatformReadOnly`].
6530    ///
6531    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6532    /// tokens for more than one scope.
6533    ///
6534    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6535    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6536    /// sufficient, a read-write scope will do as well.
6537    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryDockerImageListCall<'a, C>
6538    where
6539        St: AsRef<str>,
6540    {
6541        self._scopes.insert(String::from(scope.as_ref()));
6542        self
6543    }
6544    /// Identifies the authorization scope(s) for the method you are building.
6545    ///
6546    /// See [`Self::add_scope()`] for details.
6547    pub fn add_scopes<I, St>(
6548        mut self,
6549        scopes: I,
6550    ) -> ProjectLocationRepositoryDockerImageListCall<'a, C>
6551    where
6552        I: IntoIterator<Item = St>,
6553        St: AsRef<str>,
6554    {
6555        self._scopes
6556            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6557        self
6558    }
6559
6560    /// Removes all scopes, and no default scope will be used either.
6561    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6562    /// for details).
6563    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryDockerImageListCall<'a, C> {
6564        self._scopes.clear();
6565        self
6566    }
6567}
6568
6569/// Deletes a file and all of its content. It is only allowed on generic repositories. The returned operation will complete once the file has been deleted.
6570///
6571/// A builder for the *locations.repositories.files.delete* method supported by a *project* resource.
6572/// It is not used directly, but through a [`ProjectMethods`] instance.
6573///
6574/// # Example
6575///
6576/// Instantiate a resource method builder
6577///
6578/// ```test_harness,no_run
6579/// # extern crate hyper;
6580/// # extern crate hyper_rustls;
6581/// # extern crate google_artifactregistry1 as artifactregistry1;
6582/// # async fn dox() {
6583/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6584///
6585/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6586/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6587/// #     .with_native_roots()
6588/// #     .unwrap()
6589/// #     .https_only()
6590/// #     .enable_http2()
6591/// #     .build();
6592///
6593/// # let executor = hyper_util::rt::TokioExecutor::new();
6594/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6595/// #     secret,
6596/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6597/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6598/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6599/// #     ),
6600/// # ).build().await.unwrap();
6601///
6602/// # let client = hyper_util::client::legacy::Client::builder(
6603/// #     hyper_util::rt::TokioExecutor::new()
6604/// # )
6605/// # .build(
6606/// #     hyper_rustls::HttpsConnectorBuilder::new()
6607/// #         .with_native_roots()
6608/// #         .unwrap()
6609/// #         .https_or_http()
6610/// #         .enable_http2()
6611/// #         .build()
6612/// # );
6613/// # let mut hub = ArtifactRegistry::new(client, auth);
6614/// // You can configure optional parameters by calling the respective setters at will, and
6615/// // execute the final call using `doit()`.
6616/// // Values shown here are possibly random and not representative !
6617/// let result = hub.projects().locations_repositories_files_delete("name")
6618///              .doit().await;
6619/// # }
6620/// ```
6621pub struct ProjectLocationRepositoryFileDeleteCall<'a, C>
6622where
6623    C: 'a,
6624{
6625    hub: &'a ArtifactRegistry<C>,
6626    _name: String,
6627    _delegate: Option<&'a mut dyn common::Delegate>,
6628    _additional_params: HashMap<String, String>,
6629    _scopes: BTreeSet<String>,
6630}
6631
6632impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFileDeleteCall<'a, C> {}
6633
6634impl<'a, C> ProjectLocationRepositoryFileDeleteCall<'a, C>
6635where
6636    C: common::Connector,
6637{
6638    /// Perform the operation you have build so far.
6639    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6640        use std::borrow::Cow;
6641        use std::io::{Read, Seek};
6642
6643        use common::{url::Params, ToParts};
6644        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6645
6646        let mut dd = common::DefaultDelegate;
6647        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6648        dlg.begin(common::MethodInfo {
6649            id: "artifactregistry.projects.locations.repositories.files.delete",
6650            http_method: hyper::Method::DELETE,
6651        });
6652
6653        for &field in ["alt", "name"].iter() {
6654            if self._additional_params.contains_key(field) {
6655                dlg.finished(false);
6656                return Err(common::Error::FieldClash(field));
6657            }
6658        }
6659
6660        let mut params = Params::with_capacity(3 + self._additional_params.len());
6661        params.push("name", self._name);
6662
6663        params.extend(self._additional_params.iter());
6664
6665        params.push("alt", "json");
6666        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6667        if self._scopes.is_empty() {
6668            self._scopes
6669                .insert(Scope::CloudPlatform.as_ref().to_string());
6670        }
6671
6672        #[allow(clippy::single_element_loop)]
6673        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6674            url = params.uri_replacement(url, param_name, find_this, true);
6675        }
6676        {
6677            let to_remove = ["name"];
6678            params.remove_params(&to_remove);
6679        }
6680
6681        let url = params.parse_with_url(&url);
6682
6683        loop {
6684            let token = match self
6685                .hub
6686                .auth
6687                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6688                .await
6689            {
6690                Ok(token) => token,
6691                Err(e) => match dlg.token(e) {
6692                    Ok(token) => token,
6693                    Err(e) => {
6694                        dlg.finished(false);
6695                        return Err(common::Error::MissingToken(e));
6696                    }
6697                },
6698            };
6699            let mut req_result = {
6700                let client = &self.hub.client;
6701                dlg.pre_request();
6702                let mut req_builder = hyper::Request::builder()
6703                    .method(hyper::Method::DELETE)
6704                    .uri(url.as_str())
6705                    .header(USER_AGENT, self.hub._user_agent.clone());
6706
6707                if let Some(token) = token.as_ref() {
6708                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6709                }
6710
6711                let request = req_builder
6712                    .header(CONTENT_LENGTH, 0_u64)
6713                    .body(common::to_body::<String>(None));
6714
6715                client.request(request.unwrap()).await
6716            };
6717
6718            match req_result {
6719                Err(err) => {
6720                    if let common::Retry::After(d) = dlg.http_error(&err) {
6721                        sleep(d).await;
6722                        continue;
6723                    }
6724                    dlg.finished(false);
6725                    return Err(common::Error::HttpError(err));
6726                }
6727                Ok(res) => {
6728                    let (mut parts, body) = res.into_parts();
6729                    let mut body = common::Body::new(body);
6730                    if !parts.status.is_success() {
6731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6732                        let error = serde_json::from_str(&common::to_string(&bytes));
6733                        let response = common::to_response(parts, bytes.into());
6734
6735                        if let common::Retry::After(d) =
6736                            dlg.http_failure(&response, error.as_ref().ok())
6737                        {
6738                            sleep(d).await;
6739                            continue;
6740                        }
6741
6742                        dlg.finished(false);
6743
6744                        return Err(match error {
6745                            Ok(value) => common::Error::BadRequest(value),
6746                            _ => common::Error::Failure(response),
6747                        });
6748                    }
6749                    let response = {
6750                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6751                        let encoded = common::to_string(&bytes);
6752                        match serde_json::from_str(&encoded) {
6753                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6754                            Err(error) => {
6755                                dlg.response_json_decode_error(&encoded, &error);
6756                                return Err(common::Error::JsonDecodeError(
6757                                    encoded.to_string(),
6758                                    error,
6759                                ));
6760                            }
6761                        }
6762                    };
6763
6764                    dlg.finished(true);
6765                    return Ok(response);
6766                }
6767            }
6768        }
6769    }
6770
6771    /// Required. The name of the file to delete.
6772    ///
6773    /// Sets the *name* path property to the given value.
6774    ///
6775    /// Even though the property as already been set when instantiating this call,
6776    /// we provide this method for API completeness.
6777    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryFileDeleteCall<'a, C> {
6778        self._name = new_value.to_string();
6779        self
6780    }
6781    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6782    /// while executing the actual API request.
6783    ///
6784    /// ````text
6785    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6786    /// ````
6787    ///
6788    /// Sets the *delegate* property to the given value.
6789    pub fn delegate(
6790        mut self,
6791        new_value: &'a mut dyn common::Delegate,
6792    ) -> ProjectLocationRepositoryFileDeleteCall<'a, C> {
6793        self._delegate = Some(new_value);
6794        self
6795    }
6796
6797    /// Set any additional parameter of the query string used in the request.
6798    /// It should be used to set parameters which are not yet available through their own
6799    /// setters.
6800    ///
6801    /// Please note that this method must not be used to set any of the known parameters
6802    /// which have their own setter method. If done anyway, the request will fail.
6803    ///
6804    /// # Additional Parameters
6805    ///
6806    /// * *$.xgafv* (query-string) - V1 error format.
6807    /// * *access_token* (query-string) - OAuth access token.
6808    /// * *alt* (query-string) - Data format for response.
6809    /// * *callback* (query-string) - JSONP
6810    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6811    /// * *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.
6812    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6813    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6814    /// * *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.
6815    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6816    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6817    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFileDeleteCall<'a, C>
6818    where
6819        T: AsRef<str>,
6820    {
6821        self._additional_params
6822            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6823        self
6824    }
6825
6826    /// Identifies the authorization scope for the method you are building.
6827    ///
6828    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6829    /// [`Scope::CloudPlatform`].
6830    ///
6831    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6832    /// tokens for more than one scope.
6833    ///
6834    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6835    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6836    /// sufficient, a read-write scope will do as well.
6837    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFileDeleteCall<'a, C>
6838    where
6839        St: AsRef<str>,
6840    {
6841        self._scopes.insert(String::from(scope.as_ref()));
6842        self
6843    }
6844    /// Identifies the authorization scope(s) for the method you are building.
6845    ///
6846    /// See [`Self::add_scope()`] for details.
6847    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryFileDeleteCall<'a, C>
6848    where
6849        I: IntoIterator<Item = St>,
6850        St: AsRef<str>,
6851    {
6852        self._scopes
6853            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6854        self
6855    }
6856
6857    /// Removes all scopes, and no default scope will be used either.
6858    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6859    /// for details).
6860    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFileDeleteCall<'a, C> {
6861        self._scopes.clear();
6862        self
6863    }
6864}
6865
6866/// Download a file.
6867///
6868/// This method supports **media download**. To enable it, adjust the builder like this:
6869/// `.param("alt", "media")`.
6870/// Please note that due to missing multi-part support on the server side, you will only receive the media,
6871/// but not the `DownloadFileResponse` structure that you would usually get. The latter will be a default value.
6872///
6873/// A builder for the *locations.repositories.files.download* method supported by a *project* resource.
6874/// It is not used directly, but through a [`ProjectMethods`] instance.
6875///
6876/// # Example
6877///
6878/// Instantiate a resource method builder
6879///
6880/// ```test_harness,no_run
6881/// # extern crate hyper;
6882/// # extern crate hyper_rustls;
6883/// # extern crate google_artifactregistry1 as artifactregistry1;
6884/// # async fn dox() {
6885/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6886///
6887/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6888/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6889/// #     .with_native_roots()
6890/// #     .unwrap()
6891/// #     .https_only()
6892/// #     .enable_http2()
6893/// #     .build();
6894///
6895/// # let executor = hyper_util::rt::TokioExecutor::new();
6896/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6897/// #     secret,
6898/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6899/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6900/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6901/// #     ),
6902/// # ).build().await.unwrap();
6903///
6904/// # let client = hyper_util::client::legacy::Client::builder(
6905/// #     hyper_util::rt::TokioExecutor::new()
6906/// # )
6907/// # .build(
6908/// #     hyper_rustls::HttpsConnectorBuilder::new()
6909/// #         .with_native_roots()
6910/// #         .unwrap()
6911/// #         .https_or_http()
6912/// #         .enable_http2()
6913/// #         .build()
6914/// # );
6915/// # let mut hub = ArtifactRegistry::new(client, auth);
6916/// // You can configure optional parameters by calling the respective setters at will, and
6917/// // execute the final call using `doit()`.
6918/// // Values shown here are possibly random and not representative !
6919/// let result = hub.projects().locations_repositories_files_download("name")
6920///              .doit().await;
6921/// # }
6922/// ```
6923pub struct ProjectLocationRepositoryFileDownloadCall<'a, C>
6924where
6925    C: 'a,
6926{
6927    hub: &'a ArtifactRegistry<C>,
6928    _name: String,
6929    _delegate: Option<&'a mut dyn common::Delegate>,
6930    _additional_params: HashMap<String, String>,
6931    _scopes: BTreeSet<String>,
6932}
6933
6934impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFileDownloadCall<'a, C> {}
6935
6936impl<'a, C> ProjectLocationRepositoryFileDownloadCall<'a, C>
6937where
6938    C: common::Connector,
6939{
6940    /// Perform the operation you have build so far.
6941    pub async fn doit(mut self) -> common::Result<(common::Response, DownloadFileResponse)> {
6942        use std::borrow::Cow;
6943        use std::io::{Read, Seek};
6944
6945        use common::{url::Params, ToParts};
6946        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6947
6948        let mut dd = common::DefaultDelegate;
6949        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6950        dlg.begin(common::MethodInfo {
6951            id: "artifactregistry.projects.locations.repositories.files.download",
6952            http_method: hyper::Method::GET,
6953        });
6954
6955        for &field in ["name"].iter() {
6956            if self._additional_params.contains_key(field) {
6957                dlg.finished(false);
6958                return Err(common::Error::FieldClash(field));
6959            }
6960        }
6961
6962        let mut params = Params::with_capacity(2 + self._additional_params.len());
6963        params.push("name", self._name);
6964
6965        params.extend(self._additional_params.iter());
6966
6967        let (alt_field_missing, enable_resource_parsing) = {
6968            if let Some(value) = params.get("alt") {
6969                (false, value == "json")
6970            } else {
6971                (true, true)
6972            }
6973        };
6974        if alt_field_missing {
6975            params.push("alt", "json");
6976        }
6977        let mut url = self.hub._base_url.clone() + "v1/{+name}:download";
6978        if self._scopes.is_empty() {
6979            self._scopes
6980                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6981        }
6982
6983        #[allow(clippy::single_element_loop)]
6984        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6985            url = params.uri_replacement(url, param_name, find_this, true);
6986        }
6987        {
6988            let to_remove = ["name"];
6989            params.remove_params(&to_remove);
6990        }
6991
6992        let url = params.parse_with_url(&url);
6993
6994        loop {
6995            let token = match self
6996                .hub
6997                .auth
6998                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6999                .await
7000            {
7001                Ok(token) => token,
7002                Err(e) => match dlg.token(e) {
7003                    Ok(token) => token,
7004                    Err(e) => {
7005                        dlg.finished(false);
7006                        return Err(common::Error::MissingToken(e));
7007                    }
7008                },
7009            };
7010            let mut req_result = {
7011                let client = &self.hub.client;
7012                dlg.pre_request();
7013                let mut req_builder = hyper::Request::builder()
7014                    .method(hyper::Method::GET)
7015                    .uri(url.as_str())
7016                    .header(USER_AGENT, self.hub._user_agent.clone());
7017
7018                if let Some(token) = token.as_ref() {
7019                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7020                }
7021
7022                let request = req_builder
7023                    .header(CONTENT_LENGTH, 0_u64)
7024                    .body(common::to_body::<String>(None));
7025
7026                client.request(request.unwrap()).await
7027            };
7028
7029            match req_result {
7030                Err(err) => {
7031                    if let common::Retry::After(d) = dlg.http_error(&err) {
7032                        sleep(d).await;
7033                        continue;
7034                    }
7035                    dlg.finished(false);
7036                    return Err(common::Error::HttpError(err));
7037                }
7038                Ok(res) => {
7039                    let (mut parts, body) = res.into_parts();
7040                    let mut body = common::Body::new(body);
7041                    if !parts.status.is_success() {
7042                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7043                        let error = serde_json::from_str(&common::to_string(&bytes));
7044                        let response = common::to_response(parts, bytes.into());
7045
7046                        if let common::Retry::After(d) =
7047                            dlg.http_failure(&response, error.as_ref().ok())
7048                        {
7049                            sleep(d).await;
7050                            continue;
7051                        }
7052
7053                        dlg.finished(false);
7054
7055                        return Err(match error {
7056                            Ok(value) => common::Error::BadRequest(value),
7057                            _ => common::Error::Failure(response),
7058                        });
7059                    }
7060                    let response = if enable_resource_parsing {
7061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7062                        let encoded = common::to_string(&bytes);
7063                        match serde_json::from_str(&encoded) {
7064                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7065                            Err(error) => {
7066                                dlg.response_json_decode_error(&encoded, &error);
7067                                return Err(common::Error::JsonDecodeError(
7068                                    encoded.to_string(),
7069                                    error,
7070                                ));
7071                            }
7072                        }
7073                    } else {
7074                        (
7075                            common::Response::from_parts(parts, body),
7076                            Default::default(),
7077                        )
7078                    };
7079
7080                    dlg.finished(true);
7081                    return Ok(response);
7082                }
7083            }
7084        }
7085    }
7086
7087    /// Required. The name of the file to download.
7088    ///
7089    /// Sets the *name* path property to the given value.
7090    ///
7091    /// Even though the property as already been set when instantiating this call,
7092    /// we provide this method for API completeness.
7093    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryFileDownloadCall<'a, C> {
7094        self._name = new_value.to_string();
7095        self
7096    }
7097    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7098    /// while executing the actual API request.
7099    ///
7100    /// ````text
7101    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7102    /// ````
7103    ///
7104    /// Sets the *delegate* property to the given value.
7105    pub fn delegate(
7106        mut self,
7107        new_value: &'a mut dyn common::Delegate,
7108    ) -> ProjectLocationRepositoryFileDownloadCall<'a, C> {
7109        self._delegate = Some(new_value);
7110        self
7111    }
7112
7113    /// Set any additional parameter of the query string used in the request.
7114    /// It should be used to set parameters which are not yet available through their own
7115    /// setters.
7116    ///
7117    /// Please note that this method must not be used to set any of the known parameters
7118    /// which have their own setter method. If done anyway, the request will fail.
7119    ///
7120    /// # Additional Parameters
7121    ///
7122    /// * *$.xgafv* (query-string) - V1 error format.
7123    /// * *access_token* (query-string) - OAuth access token.
7124    /// * *alt* (query-string) - Data format for response.
7125    /// * *callback* (query-string) - JSONP
7126    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7127    /// * *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.
7128    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7129    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7130    /// * *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.
7131    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7132    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7133    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFileDownloadCall<'a, C>
7134    where
7135        T: AsRef<str>,
7136    {
7137        self._additional_params
7138            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7139        self
7140    }
7141
7142    /// Identifies the authorization scope for the method you are building.
7143    ///
7144    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7145    /// [`Scope::CloudPlatformReadOnly`].
7146    ///
7147    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7148    /// tokens for more than one scope.
7149    ///
7150    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7151    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7152    /// sufficient, a read-write scope will do as well.
7153    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFileDownloadCall<'a, C>
7154    where
7155        St: AsRef<str>,
7156    {
7157        self._scopes.insert(String::from(scope.as_ref()));
7158        self
7159    }
7160    /// Identifies the authorization scope(s) for the method you are building.
7161    ///
7162    /// See [`Self::add_scope()`] for details.
7163    pub fn add_scopes<I, St>(
7164        mut self,
7165        scopes: I,
7166    ) -> ProjectLocationRepositoryFileDownloadCall<'a, C>
7167    where
7168        I: IntoIterator<Item = St>,
7169        St: AsRef<str>,
7170    {
7171        self._scopes
7172            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7173        self
7174    }
7175
7176    /// Removes all scopes, and no default scope will be used either.
7177    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7178    /// for details).
7179    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFileDownloadCall<'a, C> {
7180        self._scopes.clear();
7181        self
7182    }
7183}
7184
7185/// Gets a file.
7186///
7187/// A builder for the *locations.repositories.files.get* method supported by a *project* resource.
7188/// It is not used directly, but through a [`ProjectMethods`] instance.
7189///
7190/// # Example
7191///
7192/// Instantiate a resource method builder
7193///
7194/// ```test_harness,no_run
7195/// # extern crate hyper;
7196/// # extern crate hyper_rustls;
7197/// # extern crate google_artifactregistry1 as artifactregistry1;
7198/// # async fn dox() {
7199/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7200///
7201/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7202/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7203/// #     .with_native_roots()
7204/// #     .unwrap()
7205/// #     .https_only()
7206/// #     .enable_http2()
7207/// #     .build();
7208///
7209/// # let executor = hyper_util::rt::TokioExecutor::new();
7210/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7211/// #     secret,
7212/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7213/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7214/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7215/// #     ),
7216/// # ).build().await.unwrap();
7217///
7218/// # let client = hyper_util::client::legacy::Client::builder(
7219/// #     hyper_util::rt::TokioExecutor::new()
7220/// # )
7221/// # .build(
7222/// #     hyper_rustls::HttpsConnectorBuilder::new()
7223/// #         .with_native_roots()
7224/// #         .unwrap()
7225/// #         .https_or_http()
7226/// #         .enable_http2()
7227/// #         .build()
7228/// # );
7229/// # let mut hub = ArtifactRegistry::new(client, auth);
7230/// // You can configure optional parameters by calling the respective setters at will, and
7231/// // execute the final call using `doit()`.
7232/// // Values shown here are possibly random and not representative !
7233/// let result = hub.projects().locations_repositories_files_get("name")
7234///              .doit().await;
7235/// # }
7236/// ```
7237pub struct ProjectLocationRepositoryFileGetCall<'a, C>
7238where
7239    C: 'a,
7240{
7241    hub: &'a ArtifactRegistry<C>,
7242    _name: String,
7243    _delegate: Option<&'a mut dyn common::Delegate>,
7244    _additional_params: HashMap<String, String>,
7245    _scopes: BTreeSet<String>,
7246}
7247
7248impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFileGetCall<'a, C> {}
7249
7250impl<'a, C> ProjectLocationRepositoryFileGetCall<'a, C>
7251where
7252    C: common::Connector,
7253{
7254    /// Perform the operation you have build so far.
7255    pub async fn doit(
7256        mut self,
7257    ) -> common::Result<(common::Response, GoogleDevtoolsArtifactregistryV1File)> {
7258        use std::borrow::Cow;
7259        use std::io::{Read, Seek};
7260
7261        use common::{url::Params, ToParts};
7262        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7263
7264        let mut dd = common::DefaultDelegate;
7265        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7266        dlg.begin(common::MethodInfo {
7267            id: "artifactregistry.projects.locations.repositories.files.get",
7268            http_method: hyper::Method::GET,
7269        });
7270
7271        for &field in ["alt", "name"].iter() {
7272            if self._additional_params.contains_key(field) {
7273                dlg.finished(false);
7274                return Err(common::Error::FieldClash(field));
7275            }
7276        }
7277
7278        let mut params = Params::with_capacity(3 + self._additional_params.len());
7279        params.push("name", self._name);
7280
7281        params.extend(self._additional_params.iter());
7282
7283        params.push("alt", "json");
7284        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7285        if self._scopes.is_empty() {
7286            self._scopes
7287                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7288        }
7289
7290        #[allow(clippy::single_element_loop)]
7291        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7292            url = params.uri_replacement(url, param_name, find_this, true);
7293        }
7294        {
7295            let to_remove = ["name"];
7296            params.remove_params(&to_remove);
7297        }
7298
7299        let url = params.parse_with_url(&url);
7300
7301        loop {
7302            let token = match self
7303                .hub
7304                .auth
7305                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7306                .await
7307            {
7308                Ok(token) => token,
7309                Err(e) => match dlg.token(e) {
7310                    Ok(token) => token,
7311                    Err(e) => {
7312                        dlg.finished(false);
7313                        return Err(common::Error::MissingToken(e));
7314                    }
7315                },
7316            };
7317            let mut req_result = {
7318                let client = &self.hub.client;
7319                dlg.pre_request();
7320                let mut req_builder = hyper::Request::builder()
7321                    .method(hyper::Method::GET)
7322                    .uri(url.as_str())
7323                    .header(USER_AGENT, self.hub._user_agent.clone());
7324
7325                if let Some(token) = token.as_ref() {
7326                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7327                }
7328
7329                let request = req_builder
7330                    .header(CONTENT_LENGTH, 0_u64)
7331                    .body(common::to_body::<String>(None));
7332
7333                client.request(request.unwrap()).await
7334            };
7335
7336            match req_result {
7337                Err(err) => {
7338                    if let common::Retry::After(d) = dlg.http_error(&err) {
7339                        sleep(d).await;
7340                        continue;
7341                    }
7342                    dlg.finished(false);
7343                    return Err(common::Error::HttpError(err));
7344                }
7345                Ok(res) => {
7346                    let (mut parts, body) = res.into_parts();
7347                    let mut body = common::Body::new(body);
7348                    if !parts.status.is_success() {
7349                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7350                        let error = serde_json::from_str(&common::to_string(&bytes));
7351                        let response = common::to_response(parts, bytes.into());
7352
7353                        if let common::Retry::After(d) =
7354                            dlg.http_failure(&response, error.as_ref().ok())
7355                        {
7356                            sleep(d).await;
7357                            continue;
7358                        }
7359
7360                        dlg.finished(false);
7361
7362                        return Err(match error {
7363                            Ok(value) => common::Error::BadRequest(value),
7364                            _ => common::Error::Failure(response),
7365                        });
7366                    }
7367                    let response = {
7368                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7369                        let encoded = common::to_string(&bytes);
7370                        match serde_json::from_str(&encoded) {
7371                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7372                            Err(error) => {
7373                                dlg.response_json_decode_error(&encoded, &error);
7374                                return Err(common::Error::JsonDecodeError(
7375                                    encoded.to_string(),
7376                                    error,
7377                                ));
7378                            }
7379                        }
7380                    };
7381
7382                    dlg.finished(true);
7383                    return Ok(response);
7384                }
7385            }
7386        }
7387    }
7388
7389    /// Required. The name of the file to retrieve.
7390    ///
7391    /// Sets the *name* path property to the given value.
7392    ///
7393    /// Even though the property as already been set when instantiating this call,
7394    /// we provide this method for API completeness.
7395    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryFileGetCall<'a, C> {
7396        self._name = new_value.to_string();
7397        self
7398    }
7399    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7400    /// while executing the actual API request.
7401    ///
7402    /// ````text
7403    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7404    /// ````
7405    ///
7406    /// Sets the *delegate* property to the given value.
7407    pub fn delegate(
7408        mut self,
7409        new_value: &'a mut dyn common::Delegate,
7410    ) -> ProjectLocationRepositoryFileGetCall<'a, C> {
7411        self._delegate = Some(new_value);
7412        self
7413    }
7414
7415    /// Set any additional parameter of the query string used in the request.
7416    /// It should be used to set parameters which are not yet available through their own
7417    /// setters.
7418    ///
7419    /// Please note that this method must not be used to set any of the known parameters
7420    /// which have their own setter method. If done anyway, the request will fail.
7421    ///
7422    /// # Additional Parameters
7423    ///
7424    /// * *$.xgafv* (query-string) - V1 error format.
7425    /// * *access_token* (query-string) - OAuth access token.
7426    /// * *alt* (query-string) - Data format for response.
7427    /// * *callback* (query-string) - JSONP
7428    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7429    /// * *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.
7430    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7431    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7432    /// * *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.
7433    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7434    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7435    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFileGetCall<'a, C>
7436    where
7437        T: AsRef<str>,
7438    {
7439        self._additional_params
7440            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7441        self
7442    }
7443
7444    /// Identifies the authorization scope for the method you are building.
7445    ///
7446    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7447    /// [`Scope::CloudPlatformReadOnly`].
7448    ///
7449    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7450    /// tokens for more than one scope.
7451    ///
7452    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7453    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7454    /// sufficient, a read-write scope will do as well.
7455    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFileGetCall<'a, C>
7456    where
7457        St: AsRef<str>,
7458    {
7459        self._scopes.insert(String::from(scope.as_ref()));
7460        self
7461    }
7462    /// Identifies the authorization scope(s) for the method you are building.
7463    ///
7464    /// See [`Self::add_scope()`] for details.
7465    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryFileGetCall<'a, C>
7466    where
7467        I: IntoIterator<Item = St>,
7468        St: AsRef<str>,
7469    {
7470        self._scopes
7471            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7472        self
7473    }
7474
7475    /// Removes all scopes, and no default scope will be used either.
7476    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7477    /// for details).
7478    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFileGetCall<'a, C> {
7479        self._scopes.clear();
7480        self
7481    }
7482}
7483
7484/// Lists files.
7485///
7486/// A builder for the *locations.repositories.files.list* method supported by a *project* resource.
7487/// It is not used directly, but through a [`ProjectMethods`] instance.
7488///
7489/// # Example
7490///
7491/// Instantiate a resource method builder
7492///
7493/// ```test_harness,no_run
7494/// # extern crate hyper;
7495/// # extern crate hyper_rustls;
7496/// # extern crate google_artifactregistry1 as artifactregistry1;
7497/// # async fn dox() {
7498/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7499///
7500/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7501/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7502/// #     .with_native_roots()
7503/// #     .unwrap()
7504/// #     .https_only()
7505/// #     .enable_http2()
7506/// #     .build();
7507///
7508/// # let executor = hyper_util::rt::TokioExecutor::new();
7509/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7510/// #     secret,
7511/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7512/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7513/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7514/// #     ),
7515/// # ).build().await.unwrap();
7516///
7517/// # let client = hyper_util::client::legacy::Client::builder(
7518/// #     hyper_util::rt::TokioExecutor::new()
7519/// # )
7520/// # .build(
7521/// #     hyper_rustls::HttpsConnectorBuilder::new()
7522/// #         .with_native_roots()
7523/// #         .unwrap()
7524/// #         .https_or_http()
7525/// #         .enable_http2()
7526/// #         .build()
7527/// # );
7528/// # let mut hub = ArtifactRegistry::new(client, auth);
7529/// // You can configure optional parameters by calling the respective setters at will, and
7530/// // execute the final call using `doit()`.
7531/// // Values shown here are possibly random and not representative !
7532/// let result = hub.projects().locations_repositories_files_list("parent")
7533///              .page_token("gubergren")
7534///              .page_size(-16)
7535///              .order_by("est")
7536///              .filter("ipsum")
7537///              .doit().await;
7538/// # }
7539/// ```
7540pub struct ProjectLocationRepositoryFileListCall<'a, C>
7541where
7542    C: 'a,
7543{
7544    hub: &'a ArtifactRegistry<C>,
7545    _parent: String,
7546    _page_token: Option<String>,
7547    _page_size: Option<i32>,
7548    _order_by: Option<String>,
7549    _filter: Option<String>,
7550    _delegate: Option<&'a mut dyn common::Delegate>,
7551    _additional_params: HashMap<String, String>,
7552    _scopes: BTreeSet<String>,
7553}
7554
7555impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFileListCall<'a, C> {}
7556
7557impl<'a, C> ProjectLocationRepositoryFileListCall<'a, C>
7558where
7559    C: common::Connector,
7560{
7561    /// Perform the operation you have build so far.
7562    pub async fn doit(mut self) -> common::Result<(common::Response, ListFilesResponse)> {
7563        use std::borrow::Cow;
7564        use std::io::{Read, Seek};
7565
7566        use common::{url::Params, ToParts};
7567        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7568
7569        let mut dd = common::DefaultDelegate;
7570        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7571        dlg.begin(common::MethodInfo {
7572            id: "artifactregistry.projects.locations.repositories.files.list",
7573            http_method: hyper::Method::GET,
7574        });
7575
7576        for &field in [
7577            "alt",
7578            "parent",
7579            "pageToken",
7580            "pageSize",
7581            "orderBy",
7582            "filter",
7583        ]
7584        .iter()
7585        {
7586            if self._additional_params.contains_key(field) {
7587                dlg.finished(false);
7588                return Err(common::Error::FieldClash(field));
7589            }
7590        }
7591
7592        let mut params = Params::with_capacity(7 + self._additional_params.len());
7593        params.push("parent", self._parent);
7594        if let Some(value) = self._page_token.as_ref() {
7595            params.push("pageToken", value);
7596        }
7597        if let Some(value) = self._page_size.as_ref() {
7598            params.push("pageSize", value.to_string());
7599        }
7600        if let Some(value) = self._order_by.as_ref() {
7601            params.push("orderBy", value);
7602        }
7603        if let Some(value) = self._filter.as_ref() {
7604            params.push("filter", value);
7605        }
7606
7607        params.extend(self._additional_params.iter());
7608
7609        params.push("alt", "json");
7610        let mut url = self.hub._base_url.clone() + "v1/{+parent}/files";
7611        if self._scopes.is_empty() {
7612            self._scopes
7613                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7614        }
7615
7616        #[allow(clippy::single_element_loop)]
7617        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7618            url = params.uri_replacement(url, param_name, find_this, true);
7619        }
7620        {
7621            let to_remove = ["parent"];
7622            params.remove_params(&to_remove);
7623        }
7624
7625        let url = params.parse_with_url(&url);
7626
7627        loop {
7628            let token = match self
7629                .hub
7630                .auth
7631                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7632                .await
7633            {
7634                Ok(token) => token,
7635                Err(e) => match dlg.token(e) {
7636                    Ok(token) => token,
7637                    Err(e) => {
7638                        dlg.finished(false);
7639                        return Err(common::Error::MissingToken(e));
7640                    }
7641                },
7642            };
7643            let mut req_result = {
7644                let client = &self.hub.client;
7645                dlg.pre_request();
7646                let mut req_builder = hyper::Request::builder()
7647                    .method(hyper::Method::GET)
7648                    .uri(url.as_str())
7649                    .header(USER_AGENT, self.hub._user_agent.clone());
7650
7651                if let Some(token) = token.as_ref() {
7652                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7653                }
7654
7655                let request = req_builder
7656                    .header(CONTENT_LENGTH, 0_u64)
7657                    .body(common::to_body::<String>(None));
7658
7659                client.request(request.unwrap()).await
7660            };
7661
7662            match req_result {
7663                Err(err) => {
7664                    if let common::Retry::After(d) = dlg.http_error(&err) {
7665                        sleep(d).await;
7666                        continue;
7667                    }
7668                    dlg.finished(false);
7669                    return Err(common::Error::HttpError(err));
7670                }
7671                Ok(res) => {
7672                    let (mut parts, body) = res.into_parts();
7673                    let mut body = common::Body::new(body);
7674                    if !parts.status.is_success() {
7675                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7676                        let error = serde_json::from_str(&common::to_string(&bytes));
7677                        let response = common::to_response(parts, bytes.into());
7678
7679                        if let common::Retry::After(d) =
7680                            dlg.http_failure(&response, error.as_ref().ok())
7681                        {
7682                            sleep(d).await;
7683                            continue;
7684                        }
7685
7686                        dlg.finished(false);
7687
7688                        return Err(match error {
7689                            Ok(value) => common::Error::BadRequest(value),
7690                            _ => common::Error::Failure(response),
7691                        });
7692                    }
7693                    let response = {
7694                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7695                        let encoded = common::to_string(&bytes);
7696                        match serde_json::from_str(&encoded) {
7697                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7698                            Err(error) => {
7699                                dlg.response_json_decode_error(&encoded, &error);
7700                                return Err(common::Error::JsonDecodeError(
7701                                    encoded.to_string(),
7702                                    error,
7703                                ));
7704                            }
7705                        }
7706                    };
7707
7708                    dlg.finished(true);
7709                    return Ok(response);
7710                }
7711            }
7712        }
7713    }
7714
7715    /// Required. The name of the repository whose files will be listed. For example: "projects/p1/locations/us-central1/repositories/repo1
7716    ///
7717    /// Sets the *parent* path property to the given value.
7718    ///
7719    /// Even though the property as already been set when instantiating this call,
7720    /// we provide this method for API completeness.
7721    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryFileListCall<'a, C> {
7722        self._parent = new_value.to_string();
7723        self
7724    }
7725    /// The next_page_token value returned from a previous list request, if any.
7726    ///
7727    /// Sets the *page token* query property to the given value.
7728    pub fn page_token(mut self, new_value: &str) -> ProjectLocationRepositoryFileListCall<'a, C> {
7729        self._page_token = Some(new_value.to_string());
7730        self
7731    }
7732    /// The maximum number of files to return. Maximum page size is 1,000.
7733    ///
7734    /// Sets the *page size* query property to the given value.
7735    pub fn page_size(mut self, new_value: i32) -> ProjectLocationRepositoryFileListCall<'a, C> {
7736        self._page_size = Some(new_value);
7737        self
7738    }
7739    /// The field to order the results by.
7740    ///
7741    /// Sets the *order by* query property to the given value.
7742    pub fn order_by(mut self, new_value: &str) -> ProjectLocationRepositoryFileListCall<'a, C> {
7743        self._order_by = Some(new_value.to_string());
7744        self
7745    }
7746    /// An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: * `name` * `owner` * `annotations` Examples of using a filter: To filter the results of your request to files with the name `my_file.txt` in project `my-project` in the `us-central` region, in repository `my-repo`, append the following filter expression to your request: * `name="projects/my-project/locations/us-central1/repositories/my-repo/files/my-file.txt"` You can also use wildcards to match any number of characters before or after the value: * `name="projects/my-project/locations/us-central1/repositories/my-repo/files/my-*"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/files/*file.txt"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/files/*file*"` To filter the results of your request to files owned by the version `1.0` in package `pkg1`, append the following filter expression to your request: * `owner="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/versions/1.0"` To filter the results of your request to files with the annotation key-value pair [`external_link`: `external_link_value`], append the following filter expression to your request: * `"annotations.external_link:external_link_value"` To filter just for a specific annotation key `external_link`, append the following filter expression to your request: * `"annotations.external_link"` If the annotation key or value contains special characters, you can escape them by surrounding the value with backticks. For example, to filter the results of your request to files with the annotation key-value pair [`external.link`:`https://example.com/my-file`], append the following filter expression to your request: * `` "annotations.`external.link`:`https://example.com/my-file`" `` You can also filter with annotations with a wildcard to match any number of characters before or after the value: * `` "annotations.*_link:`*example.com*`" ``
7747    ///
7748    /// Sets the *filter* query property to the given value.
7749    pub fn filter(mut self, new_value: &str) -> ProjectLocationRepositoryFileListCall<'a, C> {
7750        self._filter = Some(new_value.to_string());
7751        self
7752    }
7753    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7754    /// while executing the actual API request.
7755    ///
7756    /// ````text
7757    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7758    /// ````
7759    ///
7760    /// Sets the *delegate* property to the given value.
7761    pub fn delegate(
7762        mut self,
7763        new_value: &'a mut dyn common::Delegate,
7764    ) -> ProjectLocationRepositoryFileListCall<'a, C> {
7765        self._delegate = Some(new_value);
7766        self
7767    }
7768
7769    /// Set any additional parameter of the query string used in the request.
7770    /// It should be used to set parameters which are not yet available through their own
7771    /// setters.
7772    ///
7773    /// Please note that this method must not be used to set any of the known parameters
7774    /// which have their own setter method. If done anyway, the request will fail.
7775    ///
7776    /// # Additional Parameters
7777    ///
7778    /// * *$.xgafv* (query-string) - V1 error format.
7779    /// * *access_token* (query-string) - OAuth access token.
7780    /// * *alt* (query-string) - Data format for response.
7781    /// * *callback* (query-string) - JSONP
7782    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7783    /// * *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.
7784    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7785    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7786    /// * *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.
7787    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7788    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7789    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFileListCall<'a, C>
7790    where
7791        T: AsRef<str>,
7792    {
7793        self._additional_params
7794            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7795        self
7796    }
7797
7798    /// Identifies the authorization scope for the method you are building.
7799    ///
7800    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7801    /// [`Scope::CloudPlatformReadOnly`].
7802    ///
7803    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7804    /// tokens for more than one scope.
7805    ///
7806    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7807    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7808    /// sufficient, a read-write scope will do as well.
7809    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFileListCall<'a, C>
7810    where
7811        St: AsRef<str>,
7812    {
7813        self._scopes.insert(String::from(scope.as_ref()));
7814        self
7815    }
7816    /// Identifies the authorization scope(s) for the method you are building.
7817    ///
7818    /// See [`Self::add_scope()`] for details.
7819    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryFileListCall<'a, C>
7820    where
7821        I: IntoIterator<Item = St>,
7822        St: AsRef<str>,
7823    {
7824        self._scopes
7825            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7826        self
7827    }
7828
7829    /// Removes all scopes, and no default scope will be used either.
7830    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7831    /// for details).
7832    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFileListCall<'a, C> {
7833        self._scopes.clear();
7834        self
7835    }
7836}
7837
7838/// Updates a file.
7839///
7840/// A builder for the *locations.repositories.files.patch* method supported by a *project* resource.
7841/// It is not used directly, but through a [`ProjectMethods`] instance.
7842///
7843/// # Example
7844///
7845/// Instantiate a resource method builder
7846///
7847/// ```test_harness,no_run
7848/// # extern crate hyper;
7849/// # extern crate hyper_rustls;
7850/// # extern crate google_artifactregistry1 as artifactregistry1;
7851/// use artifactregistry1::api::GoogleDevtoolsArtifactregistryV1File;
7852/// # async fn dox() {
7853/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7854///
7855/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7856/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7857/// #     .with_native_roots()
7858/// #     .unwrap()
7859/// #     .https_only()
7860/// #     .enable_http2()
7861/// #     .build();
7862///
7863/// # let executor = hyper_util::rt::TokioExecutor::new();
7864/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7865/// #     secret,
7866/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7867/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7868/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7869/// #     ),
7870/// # ).build().await.unwrap();
7871///
7872/// # let client = hyper_util::client::legacy::Client::builder(
7873/// #     hyper_util::rt::TokioExecutor::new()
7874/// # )
7875/// # .build(
7876/// #     hyper_rustls::HttpsConnectorBuilder::new()
7877/// #         .with_native_roots()
7878/// #         .unwrap()
7879/// #         .https_or_http()
7880/// #         .enable_http2()
7881/// #         .build()
7882/// # );
7883/// # let mut hub = ArtifactRegistry::new(client, auth);
7884/// // As the method needs a request, you would usually fill it with the desired information
7885/// // into the respective structure. Some of the parts shown here might not be applicable !
7886/// // Values shown here are possibly random and not representative !
7887/// let mut req = GoogleDevtoolsArtifactregistryV1File::default();
7888///
7889/// // You can configure optional parameters by calling the respective setters at will, and
7890/// // execute the final call using `doit()`.
7891/// // Values shown here are possibly random and not representative !
7892/// let result = hub.projects().locations_repositories_files_patch(req, "name")
7893///              .update_mask(FieldMask::new::<&str>(&[]))
7894///              .doit().await;
7895/// # }
7896/// ```
7897pub struct ProjectLocationRepositoryFilePatchCall<'a, C>
7898where
7899    C: 'a,
7900{
7901    hub: &'a ArtifactRegistry<C>,
7902    _request: GoogleDevtoolsArtifactregistryV1File,
7903    _name: String,
7904    _update_mask: Option<common::FieldMask>,
7905    _delegate: Option<&'a mut dyn common::Delegate>,
7906    _additional_params: HashMap<String, String>,
7907    _scopes: BTreeSet<String>,
7908}
7909
7910impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFilePatchCall<'a, C> {}
7911
7912impl<'a, C> ProjectLocationRepositoryFilePatchCall<'a, C>
7913where
7914    C: common::Connector,
7915{
7916    /// Perform the operation you have build so far.
7917    pub async fn doit(
7918        mut self,
7919    ) -> common::Result<(common::Response, GoogleDevtoolsArtifactregistryV1File)> {
7920        use std::borrow::Cow;
7921        use std::io::{Read, Seek};
7922
7923        use common::{url::Params, ToParts};
7924        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7925
7926        let mut dd = common::DefaultDelegate;
7927        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7928        dlg.begin(common::MethodInfo {
7929            id: "artifactregistry.projects.locations.repositories.files.patch",
7930            http_method: hyper::Method::PATCH,
7931        });
7932
7933        for &field in ["alt", "name", "updateMask"].iter() {
7934            if self._additional_params.contains_key(field) {
7935                dlg.finished(false);
7936                return Err(common::Error::FieldClash(field));
7937            }
7938        }
7939
7940        let mut params = Params::with_capacity(5 + self._additional_params.len());
7941        params.push("name", self._name);
7942        if let Some(value) = self._update_mask.as_ref() {
7943            params.push("updateMask", value.to_string());
7944        }
7945
7946        params.extend(self._additional_params.iter());
7947
7948        params.push("alt", "json");
7949        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7950        if self._scopes.is_empty() {
7951            self._scopes
7952                .insert(Scope::CloudPlatform.as_ref().to_string());
7953        }
7954
7955        #[allow(clippy::single_element_loop)]
7956        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7957            url = params.uri_replacement(url, param_name, find_this, true);
7958        }
7959        {
7960            let to_remove = ["name"];
7961            params.remove_params(&to_remove);
7962        }
7963
7964        let url = params.parse_with_url(&url);
7965
7966        let mut json_mime_type = mime::APPLICATION_JSON;
7967        let mut request_value_reader = {
7968            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7969            common::remove_json_null_values(&mut value);
7970            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7971            serde_json::to_writer(&mut dst, &value).unwrap();
7972            dst
7973        };
7974        let request_size = request_value_reader
7975            .seek(std::io::SeekFrom::End(0))
7976            .unwrap();
7977        request_value_reader
7978            .seek(std::io::SeekFrom::Start(0))
7979            .unwrap();
7980
7981        loop {
7982            let token = match self
7983                .hub
7984                .auth
7985                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7986                .await
7987            {
7988                Ok(token) => token,
7989                Err(e) => match dlg.token(e) {
7990                    Ok(token) => token,
7991                    Err(e) => {
7992                        dlg.finished(false);
7993                        return Err(common::Error::MissingToken(e));
7994                    }
7995                },
7996            };
7997            request_value_reader
7998                .seek(std::io::SeekFrom::Start(0))
7999                .unwrap();
8000            let mut req_result = {
8001                let client = &self.hub.client;
8002                dlg.pre_request();
8003                let mut req_builder = hyper::Request::builder()
8004                    .method(hyper::Method::PATCH)
8005                    .uri(url.as_str())
8006                    .header(USER_AGENT, self.hub._user_agent.clone());
8007
8008                if let Some(token) = token.as_ref() {
8009                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8010                }
8011
8012                let request = req_builder
8013                    .header(CONTENT_TYPE, json_mime_type.to_string())
8014                    .header(CONTENT_LENGTH, request_size as u64)
8015                    .body(common::to_body(
8016                        request_value_reader.get_ref().clone().into(),
8017                    ));
8018
8019                client.request(request.unwrap()).await
8020            };
8021
8022            match req_result {
8023                Err(err) => {
8024                    if let common::Retry::After(d) = dlg.http_error(&err) {
8025                        sleep(d).await;
8026                        continue;
8027                    }
8028                    dlg.finished(false);
8029                    return Err(common::Error::HttpError(err));
8030                }
8031                Ok(res) => {
8032                    let (mut parts, body) = res.into_parts();
8033                    let mut body = common::Body::new(body);
8034                    if !parts.status.is_success() {
8035                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8036                        let error = serde_json::from_str(&common::to_string(&bytes));
8037                        let response = common::to_response(parts, bytes.into());
8038
8039                        if let common::Retry::After(d) =
8040                            dlg.http_failure(&response, error.as_ref().ok())
8041                        {
8042                            sleep(d).await;
8043                            continue;
8044                        }
8045
8046                        dlg.finished(false);
8047
8048                        return Err(match error {
8049                            Ok(value) => common::Error::BadRequest(value),
8050                            _ => common::Error::Failure(response),
8051                        });
8052                    }
8053                    let response = {
8054                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8055                        let encoded = common::to_string(&bytes);
8056                        match serde_json::from_str(&encoded) {
8057                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8058                            Err(error) => {
8059                                dlg.response_json_decode_error(&encoded, &error);
8060                                return Err(common::Error::JsonDecodeError(
8061                                    encoded.to_string(),
8062                                    error,
8063                                ));
8064                            }
8065                        }
8066                    };
8067
8068                    dlg.finished(true);
8069                    return Ok(response);
8070                }
8071            }
8072        }
8073    }
8074
8075    ///
8076    /// Sets the *request* property to the given value.
8077    ///
8078    /// Even though the property as already been set when instantiating this call,
8079    /// we provide this method for API completeness.
8080    pub fn request(
8081        mut self,
8082        new_value: GoogleDevtoolsArtifactregistryV1File,
8083    ) -> ProjectLocationRepositoryFilePatchCall<'a, C> {
8084        self._request = new_value;
8085        self
8086    }
8087    /// The name of the file, for example: `projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt`. If the file ID part contains slashes, they are escaped.
8088    ///
8089    /// Sets the *name* path property to the given value.
8090    ///
8091    /// Even though the property as already been set when instantiating this call,
8092    /// we provide this method for API completeness.
8093    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryFilePatchCall<'a, C> {
8094        self._name = new_value.to_string();
8095        self
8096    }
8097    /// Required. The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
8098    ///
8099    /// Sets the *update mask* query property to the given value.
8100    pub fn update_mask(
8101        mut self,
8102        new_value: common::FieldMask,
8103    ) -> ProjectLocationRepositoryFilePatchCall<'a, C> {
8104        self._update_mask = Some(new_value);
8105        self
8106    }
8107    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8108    /// while executing the actual API request.
8109    ///
8110    /// ````text
8111    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8112    /// ````
8113    ///
8114    /// Sets the *delegate* property to the given value.
8115    pub fn delegate(
8116        mut self,
8117        new_value: &'a mut dyn common::Delegate,
8118    ) -> ProjectLocationRepositoryFilePatchCall<'a, C> {
8119        self._delegate = Some(new_value);
8120        self
8121    }
8122
8123    /// Set any additional parameter of the query string used in the request.
8124    /// It should be used to set parameters which are not yet available through their own
8125    /// setters.
8126    ///
8127    /// Please note that this method must not be used to set any of the known parameters
8128    /// which have their own setter method. If done anyway, the request will fail.
8129    ///
8130    /// # Additional Parameters
8131    ///
8132    /// * *$.xgafv* (query-string) - V1 error format.
8133    /// * *access_token* (query-string) - OAuth access token.
8134    /// * *alt* (query-string) - Data format for response.
8135    /// * *callback* (query-string) - JSONP
8136    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8137    /// * *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.
8138    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8139    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8140    /// * *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.
8141    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8142    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8143    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFilePatchCall<'a, C>
8144    where
8145        T: AsRef<str>,
8146    {
8147        self._additional_params
8148            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8149        self
8150    }
8151
8152    /// Identifies the authorization scope for the method you are building.
8153    ///
8154    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8155    /// [`Scope::CloudPlatform`].
8156    ///
8157    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8158    /// tokens for more than one scope.
8159    ///
8160    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8161    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8162    /// sufficient, a read-write scope will do as well.
8163    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFilePatchCall<'a, C>
8164    where
8165        St: AsRef<str>,
8166    {
8167        self._scopes.insert(String::from(scope.as_ref()));
8168        self
8169    }
8170    /// Identifies the authorization scope(s) for the method you are building.
8171    ///
8172    /// See [`Self::add_scope()`] for details.
8173    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryFilePatchCall<'a, C>
8174    where
8175        I: IntoIterator<Item = St>,
8176        St: AsRef<str>,
8177    {
8178        self._scopes
8179            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8180        self
8181    }
8182
8183    /// Removes all scopes, and no default scope will be used either.
8184    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8185    /// for details).
8186    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFilePatchCall<'a, C> {
8187        self._scopes.clear();
8188        self
8189    }
8190}
8191
8192/// Directly uploads a file to a repository. The returned Operation will complete once the resources are uploaded.
8193///
8194/// A builder for the *locations.repositories.files.upload* method supported by a *project* resource.
8195/// It is not used directly, but through a [`ProjectMethods`] instance.
8196///
8197/// # Example
8198///
8199/// Instantiate a resource method builder
8200///
8201/// ```test_harness,no_run
8202/// # extern crate hyper;
8203/// # extern crate hyper_rustls;
8204/// # extern crate google_artifactregistry1 as artifactregistry1;
8205/// use artifactregistry1::api::UploadFileRequest;
8206/// use std::fs;
8207/// # async fn dox() {
8208/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8209///
8210/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8211/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8212/// #     .with_native_roots()
8213/// #     .unwrap()
8214/// #     .https_only()
8215/// #     .enable_http2()
8216/// #     .build();
8217///
8218/// # let executor = hyper_util::rt::TokioExecutor::new();
8219/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8220/// #     secret,
8221/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8222/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8223/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8224/// #     ),
8225/// # ).build().await.unwrap();
8226///
8227/// # let client = hyper_util::client::legacy::Client::builder(
8228/// #     hyper_util::rt::TokioExecutor::new()
8229/// # )
8230/// # .build(
8231/// #     hyper_rustls::HttpsConnectorBuilder::new()
8232/// #         .with_native_roots()
8233/// #         .unwrap()
8234/// #         .https_or_http()
8235/// #         .enable_http2()
8236/// #         .build()
8237/// # );
8238/// # let mut hub = ArtifactRegistry::new(client, auth);
8239/// // As the method needs a request, you would usually fill it with the desired information
8240/// // into the respective structure. Some of the parts shown here might not be applicable !
8241/// // Values shown here are possibly random and not representative !
8242/// let mut req = UploadFileRequest::default();
8243///
8244/// // You can configure optional parameters by calling the respective setters at will, and
8245/// // execute the final call using `upload_resumable(...)`.
8246/// // Values shown here are possibly random and not representative !
8247/// let result = hub.projects().locations_repositories_files_upload(req, "parent")
8248///              .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
8249/// # }
8250/// ```
8251pub struct ProjectLocationRepositoryFileUploadCall<'a, C>
8252where
8253    C: 'a,
8254{
8255    hub: &'a ArtifactRegistry<C>,
8256    _request: UploadFileRequest,
8257    _parent: String,
8258    _delegate: Option<&'a mut dyn common::Delegate>,
8259    _additional_params: HashMap<String, String>,
8260    _scopes: BTreeSet<String>,
8261}
8262
8263impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFileUploadCall<'a, C> {}
8264
8265impl<'a, C> ProjectLocationRepositoryFileUploadCall<'a, C>
8266where
8267    C: common::Connector,
8268{
8269    /// Perform the operation you have build so far.
8270    async fn doit<RS>(
8271        mut self,
8272        mut reader: RS,
8273        reader_mime_type: mime::Mime,
8274        protocol: common::UploadProtocol,
8275    ) -> common::Result<(common::Response, UploadFileMediaResponse)>
8276    where
8277        RS: common::ReadSeek,
8278    {
8279        use std::borrow::Cow;
8280        use std::io::{Read, Seek};
8281
8282        use common::{url::Params, ToParts};
8283        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8284
8285        let mut dd = common::DefaultDelegate;
8286        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8287        dlg.begin(common::MethodInfo {
8288            id: "artifactregistry.projects.locations.repositories.files.upload",
8289            http_method: hyper::Method::POST,
8290        });
8291
8292        for &field in ["alt", "parent"].iter() {
8293            if self._additional_params.contains_key(field) {
8294                dlg.finished(false);
8295                return Err(common::Error::FieldClash(field));
8296            }
8297        }
8298
8299        let mut params = Params::with_capacity(4 + self._additional_params.len());
8300        params.push("parent", self._parent);
8301
8302        params.extend(self._additional_params.iter());
8303
8304        params.push("alt", "json");
8305        let (mut url, upload_type) = if protocol == common::UploadProtocol::Resumable {
8306            (
8307                self.hub._root_url.clone() + "resumable/upload/v1/{+parent}/files:upload",
8308                "resumable",
8309            )
8310        } else if protocol == common::UploadProtocol::Simple {
8311            (
8312                self.hub._root_url.clone() + "upload/v1/{+parent}/files:upload",
8313                "multipart",
8314            )
8315        } else {
8316            unreachable!()
8317        };
8318        params.push("uploadType", upload_type);
8319        if self._scopes.is_empty() {
8320            self._scopes
8321                .insert(Scope::CloudPlatform.as_ref().to_string());
8322        }
8323
8324        #[allow(clippy::single_element_loop)]
8325        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8326            url = params.uri_replacement(url, param_name, find_this, true);
8327        }
8328        {
8329            let to_remove = ["parent"];
8330            params.remove_params(&to_remove);
8331        }
8332
8333        let url = params.parse_with_url(&url);
8334
8335        let mut json_mime_type = mime::APPLICATION_JSON;
8336        let mut request_value_reader = {
8337            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8338            common::remove_json_null_values(&mut value);
8339            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8340            serde_json::to_writer(&mut dst, &value).unwrap();
8341            dst
8342        };
8343        let request_size = request_value_reader
8344            .seek(std::io::SeekFrom::End(0))
8345            .unwrap();
8346        request_value_reader
8347            .seek(std::io::SeekFrom::Start(0))
8348            .unwrap();
8349
8350        let mut upload_url_from_server;
8351
8352        loop {
8353            let token = match self
8354                .hub
8355                .auth
8356                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8357                .await
8358            {
8359                Ok(token) => token,
8360                Err(e) => match dlg.token(e) {
8361                    Ok(token) => token,
8362                    Err(e) => {
8363                        dlg.finished(false);
8364                        return Err(common::Error::MissingToken(e));
8365                    }
8366                },
8367            };
8368            request_value_reader
8369                .seek(std::io::SeekFrom::Start(0))
8370                .unwrap();
8371            let mut req_result = {
8372                let mut mp_reader: common::MultiPartReader = Default::default();
8373                let (mut body_reader, content_type) = match protocol {
8374                    common::UploadProtocol::Simple => {
8375                        mp_reader.reserve_exact(2);
8376                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
8377                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
8378
8379                        mp_reader
8380                            .add_part(
8381                                &mut request_value_reader,
8382                                request_size,
8383                                json_mime_type.clone(),
8384                            )
8385                            .add_part(&mut reader, size, reader_mime_type.clone());
8386                        (
8387                            &mut mp_reader as &mut (dyn std::io::Read + Send),
8388                            common::MultiPartReader::mime_type(),
8389                        )
8390                    }
8391                    _ => (
8392                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
8393                        json_mime_type.clone(),
8394                    ),
8395                };
8396                let client = &self.hub.client;
8397                dlg.pre_request();
8398                let mut req_builder = hyper::Request::builder()
8399                    .method(hyper::Method::POST)
8400                    .uri(url.as_str())
8401                    .header(USER_AGENT, self.hub._user_agent.clone());
8402
8403                if let Some(token) = token.as_ref() {
8404                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8405                }
8406
8407                upload_url_from_server = true;
8408                if protocol == common::UploadProtocol::Resumable {
8409                    req_builder = req_builder
8410                        .header("X-Upload-Content-Type", format!("{}", reader_mime_type));
8411                }
8412
8413                let mut body_reader_bytes = vec![];
8414                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
8415                let request = req_builder
8416                    .header(CONTENT_TYPE, content_type.to_string())
8417                    .body(common::to_body(body_reader_bytes.into()));
8418
8419                client.request(request.unwrap()).await
8420            };
8421
8422            match req_result {
8423                Err(err) => {
8424                    if let common::Retry::After(d) = dlg.http_error(&err) {
8425                        sleep(d).await;
8426                        continue;
8427                    }
8428                    dlg.finished(false);
8429                    return Err(common::Error::HttpError(err));
8430                }
8431                Ok(res) => {
8432                    let (mut parts, body) = res.into_parts();
8433                    let mut body = common::Body::new(body);
8434                    if !parts.status.is_success() {
8435                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8436                        let error = serde_json::from_str(&common::to_string(&bytes));
8437                        let response = common::to_response(parts, bytes.into());
8438
8439                        if let common::Retry::After(d) =
8440                            dlg.http_failure(&response, error.as_ref().ok())
8441                        {
8442                            sleep(d).await;
8443                            continue;
8444                        }
8445
8446                        dlg.finished(false);
8447
8448                        return Err(match error {
8449                            Ok(value) => common::Error::BadRequest(value),
8450                            _ => common::Error::Failure(response),
8451                        });
8452                    }
8453                    if protocol == common::UploadProtocol::Resumable {
8454                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
8455                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
8456
8457                        let upload_result = {
8458                            let url_str = &parts
8459                                .headers
8460                                .get("Location")
8461                                .expect("LOCATION header is part of protocol")
8462                                .to_str()
8463                                .unwrap();
8464                            if upload_url_from_server {
8465                                dlg.store_upload_url(Some(url_str));
8466                            }
8467
8468                            common::ResumableUploadHelper {
8469                                client: &self.hub.client,
8470                                delegate: dlg,
8471                                start_at: if upload_url_from_server {
8472                                    Some(0)
8473                                } else {
8474                                    None
8475                                },
8476                                auth: &self.hub.auth,
8477                                user_agent: &self.hub._user_agent,
8478                                // TODO: Check this assumption
8479                                auth_header: format!(
8480                                    "Bearer {}",
8481                                    token
8482                                        .ok_or_else(|| common::Error::MissingToken(
8483                                            "resumable upload requires token".into()
8484                                        ))?
8485                                        .as_str()
8486                                ),
8487                                url: url_str,
8488                                reader: &mut reader,
8489                                media_type: reader_mime_type.clone(),
8490                                content_length: size,
8491                            }
8492                            .upload()
8493                            .await
8494                        };
8495                        match upload_result {
8496                            None => {
8497                                dlg.finished(false);
8498                                return Err(common::Error::Cancelled);
8499                            }
8500                            Some(Err(err)) => {
8501                                dlg.finished(false);
8502                                return Err(common::Error::HttpError(err));
8503                            }
8504                            Some(Ok(response)) => {
8505                                (parts, body) = response.into_parts();
8506                                if !parts.status.is_success() {
8507                                    dlg.store_upload_url(None);
8508                                    dlg.finished(false);
8509                                    return Err(common::Error::Failure(
8510                                        common::Response::from_parts(parts, body),
8511                                    ));
8512                                }
8513                            }
8514                        }
8515                    }
8516                    let response = {
8517                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8518                        let encoded = common::to_string(&bytes);
8519                        match serde_json::from_str(&encoded) {
8520                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8521                            Err(error) => {
8522                                dlg.response_json_decode_error(&encoded, &error);
8523                                return Err(common::Error::JsonDecodeError(
8524                                    encoded.to_string(),
8525                                    error,
8526                                ));
8527                            }
8528                        }
8529                    };
8530
8531                    dlg.finished(true);
8532                    return Ok(response);
8533                }
8534            }
8535        }
8536    }
8537
8538    /// Upload media in a resumable fashion.
8539    /// Even if the upload fails or is interrupted, it can be resumed for a
8540    /// certain amount of time as the server maintains state temporarily.
8541    ///
8542    /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL
8543    /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate
8544    /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using
8545    /// `cancel_chunk_upload(...)`.
8546    ///
8547    /// * *multipart*: yes
8548    /// * *max size*: 0kb
8549    /// * *valid mime types*: '*/*'
8550    pub async fn upload_resumable<RS>(
8551        self,
8552        resumeable_stream: RS,
8553        mime_type: mime::Mime,
8554    ) -> common::Result<(common::Response, UploadFileMediaResponse)>
8555    where
8556        RS: common::ReadSeek,
8557    {
8558        self.doit(
8559            resumeable_stream,
8560            mime_type,
8561            common::UploadProtocol::Resumable,
8562        )
8563        .await
8564    }
8565    /// Upload media all at once.
8566    /// If the upload fails for whichever reason, all progress is lost.
8567    ///
8568    /// * *multipart*: yes
8569    /// * *max size*: 0kb
8570    /// * *valid mime types*: '*/*'
8571    pub async fn upload<RS>(
8572        self,
8573        stream: RS,
8574        mime_type: mime::Mime,
8575    ) -> common::Result<(common::Response, UploadFileMediaResponse)>
8576    where
8577        RS: common::ReadSeek,
8578    {
8579        self.doit(stream, mime_type, common::UploadProtocol::Simple)
8580            .await
8581    }
8582
8583    ///
8584    /// Sets the *request* property to the given value.
8585    ///
8586    /// Even though the property as already been set when instantiating this call,
8587    /// we provide this method for API completeness.
8588    pub fn request(
8589        mut self,
8590        new_value: UploadFileRequest,
8591    ) -> ProjectLocationRepositoryFileUploadCall<'a, C> {
8592        self._request = new_value;
8593        self
8594    }
8595    /// Required. The resource name of the repository where the file will be uploaded.
8596    ///
8597    /// Sets the *parent* path property to the given value.
8598    ///
8599    /// Even though the property as already been set when instantiating this call,
8600    /// we provide this method for API completeness.
8601    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryFileUploadCall<'a, C> {
8602        self._parent = new_value.to_string();
8603        self
8604    }
8605    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8606    /// while executing the actual API request.
8607    ///
8608    /// ````text
8609    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8610    /// ````
8611    ///
8612    /// Sets the *delegate* property to the given value.
8613    pub fn delegate(
8614        mut self,
8615        new_value: &'a mut dyn common::Delegate,
8616    ) -> ProjectLocationRepositoryFileUploadCall<'a, C> {
8617        self._delegate = Some(new_value);
8618        self
8619    }
8620
8621    /// Set any additional parameter of the query string used in the request.
8622    /// It should be used to set parameters which are not yet available through their own
8623    /// setters.
8624    ///
8625    /// Please note that this method must not be used to set any of the known parameters
8626    /// which have their own setter method. If done anyway, the request will fail.
8627    ///
8628    /// # Additional Parameters
8629    ///
8630    /// * *$.xgafv* (query-string) - V1 error format.
8631    /// * *access_token* (query-string) - OAuth access token.
8632    /// * *alt* (query-string) - Data format for response.
8633    /// * *callback* (query-string) - JSONP
8634    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8635    /// * *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.
8636    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8637    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8638    /// * *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.
8639    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8640    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8641    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFileUploadCall<'a, C>
8642    where
8643        T: AsRef<str>,
8644    {
8645        self._additional_params
8646            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8647        self
8648    }
8649
8650    /// Identifies the authorization scope for the method you are building.
8651    ///
8652    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8653    /// [`Scope::CloudPlatform`].
8654    ///
8655    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8656    /// tokens for more than one scope.
8657    ///
8658    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8659    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8660    /// sufficient, a read-write scope will do as well.
8661    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFileUploadCall<'a, C>
8662    where
8663        St: AsRef<str>,
8664    {
8665        self._scopes.insert(String::from(scope.as_ref()));
8666        self
8667    }
8668    /// Identifies the authorization scope(s) for the method you are building.
8669    ///
8670    /// See [`Self::add_scope()`] for details.
8671    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryFileUploadCall<'a, C>
8672    where
8673        I: IntoIterator<Item = St>,
8674        St: AsRef<str>,
8675    {
8676        self._scopes
8677            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8678        self
8679    }
8680
8681    /// Removes all scopes, and no default scope will be used either.
8682    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8683    /// for details).
8684    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFileUploadCall<'a, C> {
8685        self._scopes.clear();
8686        self
8687    }
8688}
8689
8690/// Directly uploads a Generic artifact. The returned operation will complete once the resources are uploaded. Package, version, and file resources are created based on the uploaded artifact. Uploaded artifacts that conflict with existing resources will raise an `ALREADY_EXISTS` error.
8691///
8692/// A builder for the *locations.repositories.genericArtifacts.upload* method supported by a *project* resource.
8693/// It is not used directly, but through a [`ProjectMethods`] instance.
8694///
8695/// # Example
8696///
8697/// Instantiate a resource method builder
8698///
8699/// ```test_harness,no_run
8700/// # extern crate hyper;
8701/// # extern crate hyper_rustls;
8702/// # extern crate google_artifactregistry1 as artifactregistry1;
8703/// use artifactregistry1::api::UploadGenericArtifactRequest;
8704/// use std::fs;
8705/// # async fn dox() {
8706/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8707///
8708/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8709/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8710/// #     .with_native_roots()
8711/// #     .unwrap()
8712/// #     .https_only()
8713/// #     .enable_http2()
8714/// #     .build();
8715///
8716/// # let executor = hyper_util::rt::TokioExecutor::new();
8717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8718/// #     secret,
8719/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8720/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8721/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8722/// #     ),
8723/// # ).build().await.unwrap();
8724///
8725/// # let client = hyper_util::client::legacy::Client::builder(
8726/// #     hyper_util::rt::TokioExecutor::new()
8727/// # )
8728/// # .build(
8729/// #     hyper_rustls::HttpsConnectorBuilder::new()
8730/// #         .with_native_roots()
8731/// #         .unwrap()
8732/// #         .https_or_http()
8733/// #         .enable_http2()
8734/// #         .build()
8735/// # );
8736/// # let mut hub = ArtifactRegistry::new(client, auth);
8737/// // As the method needs a request, you would usually fill it with the desired information
8738/// // into the respective structure. Some of the parts shown here might not be applicable !
8739/// // Values shown here are possibly random and not representative !
8740/// let mut req = UploadGenericArtifactRequest::default();
8741///
8742/// // You can configure optional parameters by calling the respective setters at will, and
8743/// // execute the final call using `upload_resumable(...)`.
8744/// // Values shown here are possibly random and not representative !
8745/// let result = hub.projects().locations_repositories_generic_artifacts_upload(req, "parent")
8746///              .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
8747/// # }
8748/// ```
8749pub struct ProjectLocationRepositoryGenericArtifactUploadCall<'a, C>
8750where
8751    C: 'a,
8752{
8753    hub: &'a ArtifactRegistry<C>,
8754    _request: UploadGenericArtifactRequest,
8755    _parent: String,
8756    _delegate: Option<&'a mut dyn common::Delegate>,
8757    _additional_params: HashMap<String, String>,
8758    _scopes: BTreeSet<String>,
8759}
8760
8761impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGenericArtifactUploadCall<'a, C> {}
8762
8763impl<'a, C> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C>
8764where
8765    C: common::Connector,
8766{
8767    /// Perform the operation you have build so far.
8768    async fn doit<RS>(
8769        mut self,
8770        mut reader: RS,
8771        reader_mime_type: mime::Mime,
8772        protocol: common::UploadProtocol,
8773    ) -> common::Result<(common::Response, UploadGenericArtifactMediaResponse)>
8774    where
8775        RS: common::ReadSeek,
8776    {
8777        use std::borrow::Cow;
8778        use std::io::{Read, Seek};
8779
8780        use common::{url::Params, ToParts};
8781        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8782
8783        let mut dd = common::DefaultDelegate;
8784        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8785        dlg.begin(common::MethodInfo {
8786            id: "artifactregistry.projects.locations.repositories.genericArtifacts.upload",
8787            http_method: hyper::Method::POST,
8788        });
8789
8790        for &field in ["alt", "parent"].iter() {
8791            if self._additional_params.contains_key(field) {
8792                dlg.finished(false);
8793                return Err(common::Error::FieldClash(field));
8794            }
8795        }
8796
8797        let mut params = Params::with_capacity(4 + self._additional_params.len());
8798        params.push("parent", self._parent);
8799
8800        params.extend(self._additional_params.iter());
8801
8802        params.push("alt", "json");
8803        let (mut url, upload_type) = if protocol == common::UploadProtocol::Resumable {
8804            (
8805                self.hub._root_url.clone()
8806                    + "resumable/upload/v1/{+parent}/genericArtifacts:create",
8807                "resumable",
8808            )
8809        } else if protocol == common::UploadProtocol::Simple {
8810            (
8811                self.hub._root_url.clone() + "upload/v1/{+parent}/genericArtifacts:create",
8812                "multipart",
8813            )
8814        } else {
8815            unreachable!()
8816        };
8817        params.push("uploadType", upload_type);
8818        if self._scopes.is_empty() {
8819            self._scopes
8820                .insert(Scope::CloudPlatform.as_ref().to_string());
8821        }
8822
8823        #[allow(clippy::single_element_loop)]
8824        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8825            url = params.uri_replacement(url, param_name, find_this, true);
8826        }
8827        {
8828            let to_remove = ["parent"];
8829            params.remove_params(&to_remove);
8830        }
8831
8832        let url = params.parse_with_url(&url);
8833
8834        let mut json_mime_type = mime::APPLICATION_JSON;
8835        let mut request_value_reader = {
8836            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8837            common::remove_json_null_values(&mut value);
8838            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8839            serde_json::to_writer(&mut dst, &value).unwrap();
8840            dst
8841        };
8842        let request_size = request_value_reader
8843            .seek(std::io::SeekFrom::End(0))
8844            .unwrap();
8845        request_value_reader
8846            .seek(std::io::SeekFrom::Start(0))
8847            .unwrap();
8848
8849        let mut upload_url_from_server;
8850
8851        loop {
8852            let token = match self
8853                .hub
8854                .auth
8855                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8856                .await
8857            {
8858                Ok(token) => token,
8859                Err(e) => match dlg.token(e) {
8860                    Ok(token) => token,
8861                    Err(e) => {
8862                        dlg.finished(false);
8863                        return Err(common::Error::MissingToken(e));
8864                    }
8865                },
8866            };
8867            request_value_reader
8868                .seek(std::io::SeekFrom::Start(0))
8869                .unwrap();
8870            let mut req_result = {
8871                let mut mp_reader: common::MultiPartReader = Default::default();
8872                let (mut body_reader, content_type) = match protocol {
8873                    common::UploadProtocol::Simple => {
8874                        mp_reader.reserve_exact(2);
8875                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
8876                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
8877
8878                        mp_reader
8879                            .add_part(
8880                                &mut request_value_reader,
8881                                request_size,
8882                                json_mime_type.clone(),
8883                            )
8884                            .add_part(&mut reader, size, reader_mime_type.clone());
8885                        (
8886                            &mut mp_reader as &mut (dyn std::io::Read + Send),
8887                            common::MultiPartReader::mime_type(),
8888                        )
8889                    }
8890                    _ => (
8891                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
8892                        json_mime_type.clone(),
8893                    ),
8894                };
8895                let client = &self.hub.client;
8896                dlg.pre_request();
8897                let mut req_builder = hyper::Request::builder()
8898                    .method(hyper::Method::POST)
8899                    .uri(url.as_str())
8900                    .header(USER_AGENT, self.hub._user_agent.clone());
8901
8902                if let Some(token) = token.as_ref() {
8903                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8904                }
8905
8906                upload_url_from_server = true;
8907                if protocol == common::UploadProtocol::Resumable {
8908                    req_builder = req_builder
8909                        .header("X-Upload-Content-Type", format!("{}", reader_mime_type));
8910                }
8911
8912                let mut body_reader_bytes = vec![];
8913                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
8914                let request = req_builder
8915                    .header(CONTENT_TYPE, content_type.to_string())
8916                    .body(common::to_body(body_reader_bytes.into()));
8917
8918                client.request(request.unwrap()).await
8919            };
8920
8921            match req_result {
8922                Err(err) => {
8923                    if let common::Retry::After(d) = dlg.http_error(&err) {
8924                        sleep(d).await;
8925                        continue;
8926                    }
8927                    dlg.finished(false);
8928                    return Err(common::Error::HttpError(err));
8929                }
8930                Ok(res) => {
8931                    let (mut parts, body) = res.into_parts();
8932                    let mut body = common::Body::new(body);
8933                    if !parts.status.is_success() {
8934                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8935                        let error = serde_json::from_str(&common::to_string(&bytes));
8936                        let response = common::to_response(parts, bytes.into());
8937
8938                        if let common::Retry::After(d) =
8939                            dlg.http_failure(&response, error.as_ref().ok())
8940                        {
8941                            sleep(d).await;
8942                            continue;
8943                        }
8944
8945                        dlg.finished(false);
8946
8947                        return Err(match error {
8948                            Ok(value) => common::Error::BadRequest(value),
8949                            _ => common::Error::Failure(response),
8950                        });
8951                    }
8952                    if protocol == common::UploadProtocol::Resumable {
8953                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
8954                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
8955
8956                        let upload_result = {
8957                            let url_str = &parts
8958                                .headers
8959                                .get("Location")
8960                                .expect("LOCATION header is part of protocol")
8961                                .to_str()
8962                                .unwrap();
8963                            if upload_url_from_server {
8964                                dlg.store_upload_url(Some(url_str));
8965                            }
8966
8967                            common::ResumableUploadHelper {
8968                                client: &self.hub.client,
8969                                delegate: dlg,
8970                                start_at: if upload_url_from_server {
8971                                    Some(0)
8972                                } else {
8973                                    None
8974                                },
8975                                auth: &self.hub.auth,
8976                                user_agent: &self.hub._user_agent,
8977                                // TODO: Check this assumption
8978                                auth_header: format!(
8979                                    "Bearer {}",
8980                                    token
8981                                        .ok_or_else(|| common::Error::MissingToken(
8982                                            "resumable upload requires token".into()
8983                                        ))?
8984                                        .as_str()
8985                                ),
8986                                url: url_str,
8987                                reader: &mut reader,
8988                                media_type: reader_mime_type.clone(),
8989                                content_length: size,
8990                            }
8991                            .upload()
8992                            .await
8993                        };
8994                        match upload_result {
8995                            None => {
8996                                dlg.finished(false);
8997                                return Err(common::Error::Cancelled);
8998                            }
8999                            Some(Err(err)) => {
9000                                dlg.finished(false);
9001                                return Err(common::Error::HttpError(err));
9002                            }
9003                            Some(Ok(response)) => {
9004                                (parts, body) = response.into_parts();
9005                                if !parts.status.is_success() {
9006                                    dlg.store_upload_url(None);
9007                                    dlg.finished(false);
9008                                    return Err(common::Error::Failure(
9009                                        common::Response::from_parts(parts, body),
9010                                    ));
9011                                }
9012                            }
9013                        }
9014                    }
9015                    let response = {
9016                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9017                        let encoded = common::to_string(&bytes);
9018                        match serde_json::from_str(&encoded) {
9019                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9020                            Err(error) => {
9021                                dlg.response_json_decode_error(&encoded, &error);
9022                                return Err(common::Error::JsonDecodeError(
9023                                    encoded.to_string(),
9024                                    error,
9025                                ));
9026                            }
9027                        }
9028                    };
9029
9030                    dlg.finished(true);
9031                    return Ok(response);
9032                }
9033            }
9034        }
9035    }
9036
9037    /// Upload media in a resumable fashion.
9038    /// Even if the upload fails or is interrupted, it can be resumed for a
9039    /// certain amount of time as the server maintains state temporarily.
9040    ///
9041    /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL
9042    /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate
9043    /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using
9044    /// `cancel_chunk_upload(...)`.
9045    ///
9046    /// * *multipart*: yes
9047    /// * *max size*: 0kb
9048    /// * *valid mime types*: '*/*'
9049    pub async fn upload_resumable<RS>(
9050        self,
9051        resumeable_stream: RS,
9052        mime_type: mime::Mime,
9053    ) -> common::Result<(common::Response, UploadGenericArtifactMediaResponse)>
9054    where
9055        RS: common::ReadSeek,
9056    {
9057        self.doit(
9058            resumeable_stream,
9059            mime_type,
9060            common::UploadProtocol::Resumable,
9061        )
9062        .await
9063    }
9064    /// Upload media all at once.
9065    /// If the upload fails for whichever reason, all progress is lost.
9066    ///
9067    /// * *multipart*: yes
9068    /// * *max size*: 0kb
9069    /// * *valid mime types*: '*/*'
9070    pub async fn upload<RS>(
9071        self,
9072        stream: RS,
9073        mime_type: mime::Mime,
9074    ) -> common::Result<(common::Response, UploadGenericArtifactMediaResponse)>
9075    where
9076        RS: common::ReadSeek,
9077    {
9078        self.doit(stream, mime_type, common::UploadProtocol::Simple)
9079            .await
9080    }
9081
9082    ///
9083    /// Sets the *request* property to the given value.
9084    ///
9085    /// Even though the property as already been set when instantiating this call,
9086    /// we provide this method for API completeness.
9087    pub fn request(
9088        mut self,
9089        new_value: UploadGenericArtifactRequest,
9090    ) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C> {
9091        self._request = new_value;
9092        self
9093    }
9094    /// The resource name of the repository where the generic artifact will be uploaded.
9095    ///
9096    /// Sets the *parent* path property to the given value.
9097    ///
9098    /// Even though the property as already been set when instantiating this call,
9099    /// we provide this method for API completeness.
9100    pub fn parent(
9101        mut self,
9102        new_value: &str,
9103    ) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C> {
9104        self._parent = new_value.to_string();
9105        self
9106    }
9107    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9108    /// while executing the actual API request.
9109    ///
9110    /// ````text
9111    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9112    /// ````
9113    ///
9114    /// Sets the *delegate* property to the given value.
9115    pub fn delegate(
9116        mut self,
9117        new_value: &'a mut dyn common::Delegate,
9118    ) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C> {
9119        self._delegate = Some(new_value);
9120        self
9121    }
9122
9123    /// Set any additional parameter of the query string used in the request.
9124    /// It should be used to set parameters which are not yet available through their own
9125    /// setters.
9126    ///
9127    /// Please note that this method must not be used to set any of the known parameters
9128    /// which have their own setter method. If done anyway, the request will fail.
9129    ///
9130    /// # Additional Parameters
9131    ///
9132    /// * *$.xgafv* (query-string) - V1 error format.
9133    /// * *access_token* (query-string) - OAuth access token.
9134    /// * *alt* (query-string) - Data format for response.
9135    /// * *callback* (query-string) - JSONP
9136    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9137    /// * *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.
9138    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9139    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9140    /// * *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.
9141    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9142    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9143    pub fn param<T>(
9144        mut self,
9145        name: T,
9146        value: T,
9147    ) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C>
9148    where
9149        T: AsRef<str>,
9150    {
9151        self._additional_params
9152            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9153        self
9154    }
9155
9156    /// Identifies the authorization scope for the method you are building.
9157    ///
9158    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9159    /// [`Scope::CloudPlatform`].
9160    ///
9161    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9162    /// tokens for more than one scope.
9163    ///
9164    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9165    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9166    /// sufficient, a read-write scope will do as well.
9167    pub fn add_scope<St>(
9168        mut self,
9169        scope: St,
9170    ) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C>
9171    where
9172        St: AsRef<str>,
9173    {
9174        self._scopes.insert(String::from(scope.as_ref()));
9175        self
9176    }
9177    /// Identifies the authorization scope(s) for the method you are building.
9178    ///
9179    /// See [`Self::add_scope()`] for details.
9180    pub fn add_scopes<I, St>(
9181        mut self,
9182        scopes: I,
9183    ) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C>
9184    where
9185        I: IntoIterator<Item = St>,
9186        St: AsRef<str>,
9187    {
9188        self._scopes
9189            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9190        self
9191    }
9192
9193    /// Removes all scopes, and no default scope will be used either.
9194    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9195    /// for details).
9196    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGenericArtifactUploadCall<'a, C> {
9197        self._scopes.clear();
9198        self
9199    }
9200}
9201
9202/// Directly uploads a Go module. The returned Operation will complete once the Go module is uploaded. Package, Version, and File resources are created based on the uploaded Go module.
9203///
9204/// A builder for the *locations.repositories.goModules.upload* method supported by a *project* resource.
9205/// It is not used directly, but through a [`ProjectMethods`] instance.
9206///
9207/// # Example
9208///
9209/// Instantiate a resource method builder
9210///
9211/// ```test_harness,no_run
9212/// # extern crate hyper;
9213/// # extern crate hyper_rustls;
9214/// # extern crate google_artifactregistry1 as artifactregistry1;
9215/// use artifactregistry1::api::UploadGoModuleRequest;
9216/// use std::fs;
9217/// # async fn dox() {
9218/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9219///
9220/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9221/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9222/// #     .with_native_roots()
9223/// #     .unwrap()
9224/// #     .https_only()
9225/// #     .enable_http2()
9226/// #     .build();
9227///
9228/// # let executor = hyper_util::rt::TokioExecutor::new();
9229/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9230/// #     secret,
9231/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9232/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9233/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9234/// #     ),
9235/// # ).build().await.unwrap();
9236///
9237/// # let client = hyper_util::client::legacy::Client::builder(
9238/// #     hyper_util::rt::TokioExecutor::new()
9239/// # )
9240/// # .build(
9241/// #     hyper_rustls::HttpsConnectorBuilder::new()
9242/// #         .with_native_roots()
9243/// #         .unwrap()
9244/// #         .https_or_http()
9245/// #         .enable_http2()
9246/// #         .build()
9247/// # );
9248/// # let mut hub = ArtifactRegistry::new(client, auth);
9249/// // As the method needs a request, you would usually fill it with the desired information
9250/// // into the respective structure. Some of the parts shown here might not be applicable !
9251/// // Values shown here are possibly random and not representative !
9252/// let mut req = UploadGoModuleRequest::default();
9253///
9254/// // You can configure optional parameters by calling the respective setters at will, and
9255/// // execute the final call using `upload(...)`.
9256/// // Values shown here are possibly random and not representative !
9257/// let result = hub.projects().locations_repositories_go_modules_upload(req, "parent")
9258///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
9259/// # }
9260/// ```
9261pub struct ProjectLocationRepositoryGoModuleUploadCall<'a, C>
9262where
9263    C: 'a,
9264{
9265    hub: &'a ArtifactRegistry<C>,
9266    _request: UploadGoModuleRequest,
9267    _parent: String,
9268    _delegate: Option<&'a mut dyn common::Delegate>,
9269    _additional_params: HashMap<String, String>,
9270    _scopes: BTreeSet<String>,
9271}
9272
9273impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGoModuleUploadCall<'a, C> {}
9274
9275impl<'a, C> ProjectLocationRepositoryGoModuleUploadCall<'a, C>
9276where
9277    C: common::Connector,
9278{
9279    /// Perform the operation you have build so far.
9280    async fn doit<RS>(
9281        mut self,
9282        mut reader: RS,
9283        reader_mime_type: mime::Mime,
9284        protocol: common::UploadProtocol,
9285    ) -> common::Result<(common::Response, UploadGoModuleMediaResponse)>
9286    where
9287        RS: common::ReadSeek,
9288    {
9289        use std::borrow::Cow;
9290        use std::io::{Read, Seek};
9291
9292        use common::{url::Params, ToParts};
9293        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9294
9295        let mut dd = common::DefaultDelegate;
9296        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9297        dlg.begin(common::MethodInfo {
9298            id: "artifactregistry.projects.locations.repositories.goModules.upload",
9299            http_method: hyper::Method::POST,
9300        });
9301
9302        for &field in ["alt", "parent"].iter() {
9303            if self._additional_params.contains_key(field) {
9304                dlg.finished(false);
9305                return Err(common::Error::FieldClash(field));
9306            }
9307        }
9308
9309        let mut params = Params::with_capacity(4 + self._additional_params.len());
9310        params.push("parent", self._parent);
9311
9312        params.extend(self._additional_params.iter());
9313
9314        params.push("alt", "json");
9315        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
9316            (
9317                self.hub._root_url.clone() + "upload/v1/{+parent}/goModules:create",
9318                "multipart",
9319            )
9320        } else {
9321            unreachable!()
9322        };
9323        params.push("uploadType", upload_type);
9324        if self._scopes.is_empty() {
9325            self._scopes
9326                .insert(Scope::CloudPlatform.as_ref().to_string());
9327        }
9328
9329        #[allow(clippy::single_element_loop)]
9330        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9331            url = params.uri_replacement(url, param_name, find_this, true);
9332        }
9333        {
9334            let to_remove = ["parent"];
9335            params.remove_params(&to_remove);
9336        }
9337
9338        let url = params.parse_with_url(&url);
9339
9340        let mut json_mime_type = mime::APPLICATION_JSON;
9341        let mut request_value_reader = {
9342            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9343            common::remove_json_null_values(&mut value);
9344            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9345            serde_json::to_writer(&mut dst, &value).unwrap();
9346            dst
9347        };
9348        let request_size = request_value_reader
9349            .seek(std::io::SeekFrom::End(0))
9350            .unwrap();
9351        request_value_reader
9352            .seek(std::io::SeekFrom::Start(0))
9353            .unwrap();
9354
9355        loop {
9356            let token = match self
9357                .hub
9358                .auth
9359                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9360                .await
9361            {
9362                Ok(token) => token,
9363                Err(e) => match dlg.token(e) {
9364                    Ok(token) => token,
9365                    Err(e) => {
9366                        dlg.finished(false);
9367                        return Err(common::Error::MissingToken(e));
9368                    }
9369                },
9370            };
9371            request_value_reader
9372                .seek(std::io::SeekFrom::Start(0))
9373                .unwrap();
9374            let mut req_result = {
9375                let mut mp_reader: common::MultiPartReader = Default::default();
9376                let (mut body_reader, content_type) = match protocol {
9377                    common::UploadProtocol::Simple => {
9378                        mp_reader.reserve_exact(2);
9379                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
9380                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
9381
9382                        mp_reader
9383                            .add_part(
9384                                &mut request_value_reader,
9385                                request_size,
9386                                json_mime_type.clone(),
9387                            )
9388                            .add_part(&mut reader, size, reader_mime_type.clone());
9389                        (
9390                            &mut mp_reader as &mut (dyn std::io::Read + Send),
9391                            common::MultiPartReader::mime_type(),
9392                        )
9393                    }
9394                    _ => (
9395                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
9396                        json_mime_type.clone(),
9397                    ),
9398                };
9399                let client = &self.hub.client;
9400                dlg.pre_request();
9401                let mut req_builder = hyper::Request::builder()
9402                    .method(hyper::Method::POST)
9403                    .uri(url.as_str())
9404                    .header(USER_AGENT, self.hub._user_agent.clone());
9405
9406                if let Some(token) = token.as_ref() {
9407                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9408                }
9409
9410                let mut body_reader_bytes = vec![];
9411                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
9412                let request = req_builder
9413                    .header(CONTENT_TYPE, content_type.to_string())
9414                    .body(common::to_body(body_reader_bytes.into()));
9415
9416                client.request(request.unwrap()).await
9417            };
9418
9419            match req_result {
9420                Err(err) => {
9421                    if let common::Retry::After(d) = dlg.http_error(&err) {
9422                        sleep(d).await;
9423                        continue;
9424                    }
9425                    dlg.finished(false);
9426                    return Err(common::Error::HttpError(err));
9427                }
9428                Ok(res) => {
9429                    let (mut parts, body) = res.into_parts();
9430                    let mut body = common::Body::new(body);
9431                    if !parts.status.is_success() {
9432                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9433                        let error = serde_json::from_str(&common::to_string(&bytes));
9434                        let response = common::to_response(parts, bytes.into());
9435
9436                        if let common::Retry::After(d) =
9437                            dlg.http_failure(&response, error.as_ref().ok())
9438                        {
9439                            sleep(d).await;
9440                            continue;
9441                        }
9442
9443                        dlg.finished(false);
9444
9445                        return Err(match error {
9446                            Ok(value) => common::Error::BadRequest(value),
9447                            _ => common::Error::Failure(response),
9448                        });
9449                    }
9450                    let response = {
9451                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9452                        let encoded = common::to_string(&bytes);
9453                        match serde_json::from_str(&encoded) {
9454                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9455                            Err(error) => {
9456                                dlg.response_json_decode_error(&encoded, &error);
9457                                return Err(common::Error::JsonDecodeError(
9458                                    encoded.to_string(),
9459                                    error,
9460                                ));
9461                            }
9462                        }
9463                    };
9464
9465                    dlg.finished(true);
9466                    return Ok(response);
9467                }
9468            }
9469        }
9470    }
9471
9472    /// Upload media all at once.
9473    /// If the upload fails for whichever reason, all progress is lost.
9474    ///
9475    /// * *multipart*: yes
9476    /// * *max size*: 0kb
9477    /// * *valid mime types*: '*/*'
9478    pub async fn upload<RS>(
9479        self,
9480        stream: RS,
9481        mime_type: mime::Mime,
9482    ) -> common::Result<(common::Response, UploadGoModuleMediaResponse)>
9483    where
9484        RS: common::ReadSeek,
9485    {
9486        self.doit(stream, mime_type, common::UploadProtocol::Simple)
9487            .await
9488    }
9489
9490    ///
9491    /// Sets the *request* property to the given value.
9492    ///
9493    /// Even though the property as already been set when instantiating this call,
9494    /// we provide this method for API completeness.
9495    pub fn request(
9496        mut self,
9497        new_value: UploadGoModuleRequest,
9498    ) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C> {
9499        self._request = new_value;
9500        self
9501    }
9502    /// The resource name of the repository where the Go module will be uploaded.
9503    ///
9504    /// Sets the *parent* path property to the given value.
9505    ///
9506    /// Even though the property as already been set when instantiating this call,
9507    /// we provide this method for API completeness.
9508    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C> {
9509        self._parent = new_value.to_string();
9510        self
9511    }
9512    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9513    /// while executing the actual API request.
9514    ///
9515    /// ````text
9516    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9517    /// ````
9518    ///
9519    /// Sets the *delegate* property to the given value.
9520    pub fn delegate(
9521        mut self,
9522        new_value: &'a mut dyn common::Delegate,
9523    ) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C> {
9524        self._delegate = Some(new_value);
9525        self
9526    }
9527
9528    /// Set any additional parameter of the query string used in the request.
9529    /// It should be used to set parameters which are not yet available through their own
9530    /// setters.
9531    ///
9532    /// Please note that this method must not be used to set any of the known parameters
9533    /// which have their own setter method. If done anyway, the request will fail.
9534    ///
9535    /// # Additional Parameters
9536    ///
9537    /// * *$.xgafv* (query-string) - V1 error format.
9538    /// * *access_token* (query-string) - OAuth access token.
9539    /// * *alt* (query-string) - Data format for response.
9540    /// * *callback* (query-string) - JSONP
9541    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9542    /// * *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.
9543    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9544    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9545    /// * *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.
9546    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9547    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9548    pub fn param<T>(
9549        mut self,
9550        name: T,
9551        value: T,
9552    ) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C>
9553    where
9554        T: AsRef<str>,
9555    {
9556        self._additional_params
9557            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9558        self
9559    }
9560
9561    /// Identifies the authorization scope for the method you are building.
9562    ///
9563    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9564    /// [`Scope::CloudPlatform`].
9565    ///
9566    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9567    /// tokens for more than one scope.
9568    ///
9569    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9570    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9571    /// sufficient, a read-write scope will do as well.
9572    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C>
9573    where
9574        St: AsRef<str>,
9575    {
9576        self._scopes.insert(String::from(scope.as_ref()));
9577        self
9578    }
9579    /// Identifies the authorization scope(s) for the method you are building.
9580    ///
9581    /// See [`Self::add_scope()`] for details.
9582    pub fn add_scopes<I, St>(
9583        mut self,
9584        scopes: I,
9585    ) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C>
9586    where
9587        I: IntoIterator<Item = St>,
9588        St: AsRef<str>,
9589    {
9590        self._scopes
9591            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9592        self
9593    }
9594
9595    /// Removes all scopes, and no default scope will be used either.
9596    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9597    /// for details).
9598    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGoModuleUploadCall<'a, C> {
9599        self._scopes.clear();
9600        self
9601    }
9602}
9603
9604/// Imports GooGet artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.
9605///
9606/// A builder for the *locations.repositories.googetArtifacts.import* method supported by a *project* resource.
9607/// It is not used directly, but through a [`ProjectMethods`] instance.
9608///
9609/// # Example
9610///
9611/// Instantiate a resource method builder
9612///
9613/// ```test_harness,no_run
9614/// # extern crate hyper;
9615/// # extern crate hyper_rustls;
9616/// # extern crate google_artifactregistry1 as artifactregistry1;
9617/// use artifactregistry1::api::ImportGoogetArtifactsRequest;
9618/// # async fn dox() {
9619/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9620///
9621/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9622/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9623/// #     .with_native_roots()
9624/// #     .unwrap()
9625/// #     .https_only()
9626/// #     .enable_http2()
9627/// #     .build();
9628///
9629/// # let executor = hyper_util::rt::TokioExecutor::new();
9630/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9631/// #     secret,
9632/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9633/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9634/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9635/// #     ),
9636/// # ).build().await.unwrap();
9637///
9638/// # let client = hyper_util::client::legacy::Client::builder(
9639/// #     hyper_util::rt::TokioExecutor::new()
9640/// # )
9641/// # .build(
9642/// #     hyper_rustls::HttpsConnectorBuilder::new()
9643/// #         .with_native_roots()
9644/// #         .unwrap()
9645/// #         .https_or_http()
9646/// #         .enable_http2()
9647/// #         .build()
9648/// # );
9649/// # let mut hub = ArtifactRegistry::new(client, auth);
9650/// // As the method needs a request, you would usually fill it with the desired information
9651/// // into the respective structure. Some of the parts shown here might not be applicable !
9652/// // Values shown here are possibly random and not representative !
9653/// let mut req = ImportGoogetArtifactsRequest::default();
9654///
9655/// // You can configure optional parameters by calling the respective setters at will, and
9656/// // execute the final call using `doit()`.
9657/// // Values shown here are possibly random and not representative !
9658/// let result = hub.projects().locations_repositories_googet_artifacts_import(req, "parent")
9659///              .doit().await;
9660/// # }
9661/// ```
9662pub struct ProjectLocationRepositoryGoogetArtifactImportCall<'a, C>
9663where
9664    C: 'a,
9665{
9666    hub: &'a ArtifactRegistry<C>,
9667    _request: ImportGoogetArtifactsRequest,
9668    _parent: String,
9669    _delegate: Option<&'a mut dyn common::Delegate>,
9670    _additional_params: HashMap<String, String>,
9671    _scopes: BTreeSet<String>,
9672}
9673
9674impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGoogetArtifactImportCall<'a, C> {}
9675
9676impl<'a, C> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C>
9677where
9678    C: common::Connector,
9679{
9680    /// Perform the operation you have build so far.
9681    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9682        use std::borrow::Cow;
9683        use std::io::{Read, Seek};
9684
9685        use common::{url::Params, ToParts};
9686        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9687
9688        let mut dd = common::DefaultDelegate;
9689        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9690        dlg.begin(common::MethodInfo {
9691            id: "artifactregistry.projects.locations.repositories.googetArtifacts.import",
9692            http_method: hyper::Method::POST,
9693        });
9694
9695        for &field in ["alt", "parent"].iter() {
9696            if self._additional_params.contains_key(field) {
9697                dlg.finished(false);
9698                return Err(common::Error::FieldClash(field));
9699            }
9700        }
9701
9702        let mut params = Params::with_capacity(4 + self._additional_params.len());
9703        params.push("parent", self._parent);
9704
9705        params.extend(self._additional_params.iter());
9706
9707        params.push("alt", "json");
9708        let mut url = self.hub._base_url.clone() + "v1/{+parent}/googetArtifacts:import";
9709        if self._scopes.is_empty() {
9710            self._scopes
9711                .insert(Scope::CloudPlatform.as_ref().to_string());
9712        }
9713
9714        #[allow(clippy::single_element_loop)]
9715        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9716            url = params.uri_replacement(url, param_name, find_this, true);
9717        }
9718        {
9719            let to_remove = ["parent"];
9720            params.remove_params(&to_remove);
9721        }
9722
9723        let url = params.parse_with_url(&url);
9724
9725        let mut json_mime_type = mime::APPLICATION_JSON;
9726        let mut request_value_reader = {
9727            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9728            common::remove_json_null_values(&mut value);
9729            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9730            serde_json::to_writer(&mut dst, &value).unwrap();
9731            dst
9732        };
9733        let request_size = request_value_reader
9734            .seek(std::io::SeekFrom::End(0))
9735            .unwrap();
9736        request_value_reader
9737            .seek(std::io::SeekFrom::Start(0))
9738            .unwrap();
9739
9740        loop {
9741            let token = match self
9742                .hub
9743                .auth
9744                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9745                .await
9746            {
9747                Ok(token) => token,
9748                Err(e) => match dlg.token(e) {
9749                    Ok(token) => token,
9750                    Err(e) => {
9751                        dlg.finished(false);
9752                        return Err(common::Error::MissingToken(e));
9753                    }
9754                },
9755            };
9756            request_value_reader
9757                .seek(std::io::SeekFrom::Start(0))
9758                .unwrap();
9759            let mut req_result = {
9760                let client = &self.hub.client;
9761                dlg.pre_request();
9762                let mut req_builder = hyper::Request::builder()
9763                    .method(hyper::Method::POST)
9764                    .uri(url.as_str())
9765                    .header(USER_AGENT, self.hub._user_agent.clone());
9766
9767                if let Some(token) = token.as_ref() {
9768                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9769                }
9770
9771                let request = req_builder
9772                    .header(CONTENT_TYPE, json_mime_type.to_string())
9773                    .header(CONTENT_LENGTH, request_size as u64)
9774                    .body(common::to_body(
9775                        request_value_reader.get_ref().clone().into(),
9776                    ));
9777
9778                client.request(request.unwrap()).await
9779            };
9780
9781            match req_result {
9782                Err(err) => {
9783                    if let common::Retry::After(d) = dlg.http_error(&err) {
9784                        sleep(d).await;
9785                        continue;
9786                    }
9787                    dlg.finished(false);
9788                    return Err(common::Error::HttpError(err));
9789                }
9790                Ok(res) => {
9791                    let (mut parts, body) = res.into_parts();
9792                    let mut body = common::Body::new(body);
9793                    if !parts.status.is_success() {
9794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9795                        let error = serde_json::from_str(&common::to_string(&bytes));
9796                        let response = common::to_response(parts, bytes.into());
9797
9798                        if let common::Retry::After(d) =
9799                            dlg.http_failure(&response, error.as_ref().ok())
9800                        {
9801                            sleep(d).await;
9802                            continue;
9803                        }
9804
9805                        dlg.finished(false);
9806
9807                        return Err(match error {
9808                            Ok(value) => common::Error::BadRequest(value),
9809                            _ => common::Error::Failure(response),
9810                        });
9811                    }
9812                    let response = {
9813                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9814                        let encoded = common::to_string(&bytes);
9815                        match serde_json::from_str(&encoded) {
9816                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9817                            Err(error) => {
9818                                dlg.response_json_decode_error(&encoded, &error);
9819                                return Err(common::Error::JsonDecodeError(
9820                                    encoded.to_string(),
9821                                    error,
9822                                ));
9823                            }
9824                        }
9825                    };
9826
9827                    dlg.finished(true);
9828                    return Ok(response);
9829                }
9830            }
9831        }
9832    }
9833
9834    ///
9835    /// Sets the *request* property to the given value.
9836    ///
9837    /// Even though the property as already been set when instantiating this call,
9838    /// we provide this method for API completeness.
9839    pub fn request(
9840        mut self,
9841        new_value: ImportGoogetArtifactsRequest,
9842    ) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C> {
9843        self._request = new_value;
9844        self
9845    }
9846    /// The name of the parent resource where the artifacts will be imported.
9847    ///
9848    /// Sets the *parent* path property to the given value.
9849    ///
9850    /// Even though the property as already been set when instantiating this call,
9851    /// we provide this method for API completeness.
9852    pub fn parent(
9853        mut self,
9854        new_value: &str,
9855    ) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C> {
9856        self._parent = new_value.to_string();
9857        self
9858    }
9859    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9860    /// while executing the actual API request.
9861    ///
9862    /// ````text
9863    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9864    /// ````
9865    ///
9866    /// Sets the *delegate* property to the given value.
9867    pub fn delegate(
9868        mut self,
9869        new_value: &'a mut dyn common::Delegate,
9870    ) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C> {
9871        self._delegate = Some(new_value);
9872        self
9873    }
9874
9875    /// Set any additional parameter of the query string used in the request.
9876    /// It should be used to set parameters which are not yet available through their own
9877    /// setters.
9878    ///
9879    /// Please note that this method must not be used to set any of the known parameters
9880    /// which have their own setter method. If done anyway, the request will fail.
9881    ///
9882    /// # Additional Parameters
9883    ///
9884    /// * *$.xgafv* (query-string) - V1 error format.
9885    /// * *access_token* (query-string) - OAuth access token.
9886    /// * *alt* (query-string) - Data format for response.
9887    /// * *callback* (query-string) - JSONP
9888    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9889    /// * *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.
9890    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9891    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9892    /// * *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.
9893    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9894    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9895    pub fn param<T>(
9896        mut self,
9897        name: T,
9898        value: T,
9899    ) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C>
9900    where
9901        T: AsRef<str>,
9902    {
9903        self._additional_params
9904            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9905        self
9906    }
9907
9908    /// Identifies the authorization scope for the method you are building.
9909    ///
9910    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9911    /// [`Scope::CloudPlatform`].
9912    ///
9913    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9914    /// tokens for more than one scope.
9915    ///
9916    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9917    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9918    /// sufficient, a read-write scope will do as well.
9919    pub fn add_scope<St>(
9920        mut self,
9921        scope: St,
9922    ) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C>
9923    where
9924        St: AsRef<str>,
9925    {
9926        self._scopes.insert(String::from(scope.as_ref()));
9927        self
9928    }
9929    /// Identifies the authorization scope(s) for the method you are building.
9930    ///
9931    /// See [`Self::add_scope()`] for details.
9932    pub fn add_scopes<I, St>(
9933        mut self,
9934        scopes: I,
9935    ) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C>
9936    where
9937        I: IntoIterator<Item = St>,
9938        St: AsRef<str>,
9939    {
9940        self._scopes
9941            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9942        self
9943    }
9944
9945    /// Removes all scopes, and no default scope will be used either.
9946    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9947    /// for details).
9948    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGoogetArtifactImportCall<'a, C> {
9949        self._scopes.clear();
9950        self
9951    }
9952}
9953
9954/// Directly uploads a GooGet artifact. The returned Operation will complete once the resources are uploaded. Package, Version, and File resources are created based on the imported artifact. Imported artifacts that conflict with existing resources are ignored.
9955///
9956/// A builder for the *locations.repositories.googetArtifacts.upload* method supported by a *project* resource.
9957/// It is not used directly, but through a [`ProjectMethods`] instance.
9958///
9959/// # Example
9960///
9961/// Instantiate a resource method builder
9962///
9963/// ```test_harness,no_run
9964/// # extern crate hyper;
9965/// # extern crate hyper_rustls;
9966/// # extern crate google_artifactregistry1 as artifactregistry1;
9967/// use artifactregistry1::api::UploadGoogetArtifactRequest;
9968/// use std::fs;
9969/// # async fn dox() {
9970/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9971///
9972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9973/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9974/// #     .with_native_roots()
9975/// #     .unwrap()
9976/// #     .https_only()
9977/// #     .enable_http2()
9978/// #     .build();
9979///
9980/// # let executor = hyper_util::rt::TokioExecutor::new();
9981/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9982/// #     secret,
9983/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9984/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9985/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9986/// #     ),
9987/// # ).build().await.unwrap();
9988///
9989/// # let client = hyper_util::client::legacy::Client::builder(
9990/// #     hyper_util::rt::TokioExecutor::new()
9991/// # )
9992/// # .build(
9993/// #     hyper_rustls::HttpsConnectorBuilder::new()
9994/// #         .with_native_roots()
9995/// #         .unwrap()
9996/// #         .https_or_http()
9997/// #         .enable_http2()
9998/// #         .build()
9999/// # );
10000/// # let mut hub = ArtifactRegistry::new(client, auth);
10001/// // As the method needs a request, you would usually fill it with the desired information
10002/// // into the respective structure. Some of the parts shown here might not be applicable !
10003/// // Values shown here are possibly random and not representative !
10004/// let mut req = UploadGoogetArtifactRequest::default();
10005///
10006/// // You can configure optional parameters by calling the respective setters at will, and
10007/// // execute the final call using `upload(...)`.
10008/// // Values shown here are possibly random and not representative !
10009/// let result = hub.projects().locations_repositories_googet_artifacts_upload(req, "parent")
10010///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
10011/// # }
10012/// ```
10013pub struct ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C>
10014where
10015    C: 'a,
10016{
10017    hub: &'a ArtifactRegistry<C>,
10018    _request: UploadGoogetArtifactRequest,
10019    _parent: String,
10020    _delegate: Option<&'a mut dyn common::Delegate>,
10021    _additional_params: HashMap<String, String>,
10022    _scopes: BTreeSet<String>,
10023}
10024
10025impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C> {}
10026
10027impl<'a, C> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C>
10028where
10029    C: common::Connector,
10030{
10031    /// Perform the operation you have build so far.
10032    async fn doit<RS>(
10033        mut self,
10034        mut reader: RS,
10035        reader_mime_type: mime::Mime,
10036        protocol: common::UploadProtocol,
10037    ) -> common::Result<(common::Response, UploadGoogetArtifactMediaResponse)>
10038    where
10039        RS: common::ReadSeek,
10040    {
10041        use std::borrow::Cow;
10042        use std::io::{Read, Seek};
10043
10044        use common::{url::Params, ToParts};
10045        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10046
10047        let mut dd = common::DefaultDelegate;
10048        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10049        dlg.begin(common::MethodInfo {
10050            id: "artifactregistry.projects.locations.repositories.googetArtifacts.upload",
10051            http_method: hyper::Method::POST,
10052        });
10053
10054        for &field in ["alt", "parent"].iter() {
10055            if self._additional_params.contains_key(field) {
10056                dlg.finished(false);
10057                return Err(common::Error::FieldClash(field));
10058            }
10059        }
10060
10061        let mut params = Params::with_capacity(4 + self._additional_params.len());
10062        params.push("parent", self._parent);
10063
10064        params.extend(self._additional_params.iter());
10065
10066        params.push("alt", "json");
10067        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
10068            (
10069                self.hub._root_url.clone() + "upload/v1/{+parent}/googetArtifacts:create",
10070                "multipart",
10071            )
10072        } else {
10073            unreachable!()
10074        };
10075        params.push("uploadType", upload_type);
10076        if self._scopes.is_empty() {
10077            self._scopes
10078                .insert(Scope::CloudPlatform.as_ref().to_string());
10079        }
10080
10081        #[allow(clippy::single_element_loop)]
10082        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10083            url = params.uri_replacement(url, param_name, find_this, true);
10084        }
10085        {
10086            let to_remove = ["parent"];
10087            params.remove_params(&to_remove);
10088        }
10089
10090        let url = params.parse_with_url(&url);
10091
10092        let mut json_mime_type = mime::APPLICATION_JSON;
10093        let mut request_value_reader = {
10094            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10095            common::remove_json_null_values(&mut value);
10096            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10097            serde_json::to_writer(&mut dst, &value).unwrap();
10098            dst
10099        };
10100        let request_size = request_value_reader
10101            .seek(std::io::SeekFrom::End(0))
10102            .unwrap();
10103        request_value_reader
10104            .seek(std::io::SeekFrom::Start(0))
10105            .unwrap();
10106
10107        loop {
10108            let token = match self
10109                .hub
10110                .auth
10111                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10112                .await
10113            {
10114                Ok(token) => token,
10115                Err(e) => match dlg.token(e) {
10116                    Ok(token) => token,
10117                    Err(e) => {
10118                        dlg.finished(false);
10119                        return Err(common::Error::MissingToken(e));
10120                    }
10121                },
10122            };
10123            request_value_reader
10124                .seek(std::io::SeekFrom::Start(0))
10125                .unwrap();
10126            let mut req_result = {
10127                let mut mp_reader: common::MultiPartReader = Default::default();
10128                let (mut body_reader, content_type) = match protocol {
10129                    common::UploadProtocol::Simple => {
10130                        mp_reader.reserve_exact(2);
10131                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
10132                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
10133
10134                        mp_reader
10135                            .add_part(
10136                                &mut request_value_reader,
10137                                request_size,
10138                                json_mime_type.clone(),
10139                            )
10140                            .add_part(&mut reader, size, reader_mime_type.clone());
10141                        (
10142                            &mut mp_reader as &mut (dyn std::io::Read + Send),
10143                            common::MultiPartReader::mime_type(),
10144                        )
10145                    }
10146                    _ => (
10147                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
10148                        json_mime_type.clone(),
10149                    ),
10150                };
10151                let client = &self.hub.client;
10152                dlg.pre_request();
10153                let mut req_builder = hyper::Request::builder()
10154                    .method(hyper::Method::POST)
10155                    .uri(url.as_str())
10156                    .header(USER_AGENT, self.hub._user_agent.clone());
10157
10158                if let Some(token) = token.as_ref() {
10159                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10160                }
10161
10162                let mut body_reader_bytes = vec![];
10163                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
10164                let request = req_builder
10165                    .header(CONTENT_TYPE, content_type.to_string())
10166                    .body(common::to_body(body_reader_bytes.into()));
10167
10168                client.request(request.unwrap()).await
10169            };
10170
10171            match req_result {
10172                Err(err) => {
10173                    if let common::Retry::After(d) = dlg.http_error(&err) {
10174                        sleep(d).await;
10175                        continue;
10176                    }
10177                    dlg.finished(false);
10178                    return Err(common::Error::HttpError(err));
10179                }
10180                Ok(res) => {
10181                    let (mut parts, body) = res.into_parts();
10182                    let mut body = common::Body::new(body);
10183                    if !parts.status.is_success() {
10184                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10185                        let error = serde_json::from_str(&common::to_string(&bytes));
10186                        let response = common::to_response(parts, bytes.into());
10187
10188                        if let common::Retry::After(d) =
10189                            dlg.http_failure(&response, error.as_ref().ok())
10190                        {
10191                            sleep(d).await;
10192                            continue;
10193                        }
10194
10195                        dlg.finished(false);
10196
10197                        return Err(match error {
10198                            Ok(value) => common::Error::BadRequest(value),
10199                            _ => common::Error::Failure(response),
10200                        });
10201                    }
10202                    let response = {
10203                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10204                        let encoded = common::to_string(&bytes);
10205                        match serde_json::from_str(&encoded) {
10206                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10207                            Err(error) => {
10208                                dlg.response_json_decode_error(&encoded, &error);
10209                                return Err(common::Error::JsonDecodeError(
10210                                    encoded.to_string(),
10211                                    error,
10212                                ));
10213                            }
10214                        }
10215                    };
10216
10217                    dlg.finished(true);
10218                    return Ok(response);
10219                }
10220            }
10221        }
10222    }
10223
10224    /// Upload media all at once.
10225    /// If the upload fails for whichever reason, all progress is lost.
10226    ///
10227    /// * *multipart*: yes
10228    /// * *max size*: 0kb
10229    /// * *valid mime types*: '*/*'
10230    pub async fn upload<RS>(
10231        self,
10232        stream: RS,
10233        mime_type: mime::Mime,
10234    ) -> common::Result<(common::Response, UploadGoogetArtifactMediaResponse)>
10235    where
10236        RS: common::ReadSeek,
10237    {
10238        self.doit(stream, mime_type, common::UploadProtocol::Simple)
10239            .await
10240    }
10241
10242    ///
10243    /// Sets the *request* property to the given value.
10244    ///
10245    /// Even though the property as already been set when instantiating this call,
10246    /// we provide this method for API completeness.
10247    pub fn request(
10248        mut self,
10249        new_value: UploadGoogetArtifactRequest,
10250    ) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C> {
10251        self._request = new_value;
10252        self
10253    }
10254    /// The name of the parent resource where the artifacts will be uploaded.
10255    ///
10256    /// Sets the *parent* path property to the given value.
10257    ///
10258    /// Even though the property as already been set when instantiating this call,
10259    /// we provide this method for API completeness.
10260    pub fn parent(
10261        mut self,
10262        new_value: &str,
10263    ) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C> {
10264        self._parent = new_value.to_string();
10265        self
10266    }
10267    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10268    /// while executing the actual API request.
10269    ///
10270    /// ````text
10271    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10272    /// ````
10273    ///
10274    /// Sets the *delegate* property to the given value.
10275    pub fn delegate(
10276        mut self,
10277        new_value: &'a mut dyn common::Delegate,
10278    ) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C> {
10279        self._delegate = Some(new_value);
10280        self
10281    }
10282
10283    /// Set any additional parameter of the query string used in the request.
10284    /// It should be used to set parameters which are not yet available through their own
10285    /// setters.
10286    ///
10287    /// Please note that this method must not be used to set any of the known parameters
10288    /// which have their own setter method. If done anyway, the request will fail.
10289    ///
10290    /// # Additional Parameters
10291    ///
10292    /// * *$.xgafv* (query-string) - V1 error format.
10293    /// * *access_token* (query-string) - OAuth access token.
10294    /// * *alt* (query-string) - Data format for response.
10295    /// * *callback* (query-string) - JSONP
10296    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10297    /// * *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.
10298    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10299    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10300    /// * *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.
10301    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10302    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10303    pub fn param<T>(
10304        mut self,
10305        name: T,
10306        value: T,
10307    ) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C>
10308    where
10309        T: AsRef<str>,
10310    {
10311        self._additional_params
10312            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10313        self
10314    }
10315
10316    /// Identifies the authorization scope for the method you are building.
10317    ///
10318    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10319    /// [`Scope::CloudPlatform`].
10320    ///
10321    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10322    /// tokens for more than one scope.
10323    ///
10324    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10325    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10326    /// sufficient, a read-write scope will do as well.
10327    pub fn add_scope<St>(
10328        mut self,
10329        scope: St,
10330    ) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C>
10331    where
10332        St: AsRef<str>,
10333    {
10334        self._scopes.insert(String::from(scope.as_ref()));
10335        self
10336    }
10337    /// Identifies the authorization scope(s) for the method you are building.
10338    ///
10339    /// See [`Self::add_scope()`] for details.
10340    pub fn add_scopes<I, St>(
10341        mut self,
10342        scopes: I,
10343    ) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C>
10344    where
10345        I: IntoIterator<Item = St>,
10346        St: AsRef<str>,
10347    {
10348        self._scopes
10349            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10350        self
10351    }
10352
10353    /// Removes all scopes, and no default scope will be used either.
10354    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10355    /// for details).
10356    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGoogetArtifactUploadCall<'a, C> {
10357        self._scopes.clear();
10358        self
10359    }
10360}
10361
10362/// Directly uploads a KFP artifact. The returned Operation will complete once the resource is uploaded. Package, Version, and File resources will be created based on the uploaded artifact. Uploaded artifacts that conflict with existing resources will be overwritten.
10363///
10364/// A builder for the *locations.repositories.kfpArtifacts.upload* method supported by a *project* resource.
10365/// It is not used directly, but through a [`ProjectMethods`] instance.
10366///
10367/// # Example
10368///
10369/// Instantiate a resource method builder
10370///
10371/// ```test_harness,no_run
10372/// # extern crate hyper;
10373/// # extern crate hyper_rustls;
10374/// # extern crate google_artifactregistry1 as artifactregistry1;
10375/// use artifactregistry1::api::UploadKfpArtifactRequest;
10376/// use std::fs;
10377/// # async fn dox() {
10378/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10379///
10380/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10381/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10382/// #     .with_native_roots()
10383/// #     .unwrap()
10384/// #     .https_only()
10385/// #     .enable_http2()
10386/// #     .build();
10387///
10388/// # let executor = hyper_util::rt::TokioExecutor::new();
10389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10390/// #     secret,
10391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10392/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10393/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10394/// #     ),
10395/// # ).build().await.unwrap();
10396///
10397/// # let client = hyper_util::client::legacy::Client::builder(
10398/// #     hyper_util::rt::TokioExecutor::new()
10399/// # )
10400/// # .build(
10401/// #     hyper_rustls::HttpsConnectorBuilder::new()
10402/// #         .with_native_roots()
10403/// #         .unwrap()
10404/// #         .https_or_http()
10405/// #         .enable_http2()
10406/// #         .build()
10407/// # );
10408/// # let mut hub = ArtifactRegistry::new(client, auth);
10409/// // As the method needs a request, you would usually fill it with the desired information
10410/// // into the respective structure. Some of the parts shown here might not be applicable !
10411/// // Values shown here are possibly random and not representative !
10412/// let mut req = UploadKfpArtifactRequest::default();
10413///
10414/// // You can configure optional parameters by calling the respective setters at will, and
10415/// // execute the final call using `upload(...)`.
10416/// // Values shown here are possibly random and not representative !
10417/// let result = hub.projects().locations_repositories_kfp_artifacts_upload(req, "parent")
10418///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
10419/// # }
10420/// ```
10421pub struct ProjectLocationRepositoryKfpArtifactUploadCall<'a, C>
10422where
10423    C: 'a,
10424{
10425    hub: &'a ArtifactRegistry<C>,
10426    _request: UploadKfpArtifactRequest,
10427    _parent: String,
10428    _delegate: Option<&'a mut dyn common::Delegate>,
10429    _additional_params: HashMap<String, String>,
10430    _scopes: BTreeSet<String>,
10431}
10432
10433impl<'a, C> common::CallBuilder for ProjectLocationRepositoryKfpArtifactUploadCall<'a, C> {}
10434
10435impl<'a, C> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C>
10436where
10437    C: common::Connector,
10438{
10439    /// Perform the operation you have build so far.
10440    async fn doit<RS>(
10441        mut self,
10442        mut reader: RS,
10443        reader_mime_type: mime::Mime,
10444        protocol: common::UploadProtocol,
10445    ) -> common::Result<(common::Response, UploadKfpArtifactMediaResponse)>
10446    where
10447        RS: common::ReadSeek,
10448    {
10449        use std::borrow::Cow;
10450        use std::io::{Read, Seek};
10451
10452        use common::{url::Params, ToParts};
10453        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10454
10455        let mut dd = common::DefaultDelegate;
10456        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10457        dlg.begin(common::MethodInfo {
10458            id: "artifactregistry.projects.locations.repositories.kfpArtifacts.upload",
10459            http_method: hyper::Method::POST,
10460        });
10461
10462        for &field in ["alt", "parent"].iter() {
10463            if self._additional_params.contains_key(field) {
10464                dlg.finished(false);
10465                return Err(common::Error::FieldClash(field));
10466            }
10467        }
10468
10469        let mut params = Params::with_capacity(4 + self._additional_params.len());
10470        params.push("parent", self._parent);
10471
10472        params.extend(self._additional_params.iter());
10473
10474        params.push("alt", "json");
10475        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
10476            (
10477                self.hub._root_url.clone() + "upload/v1/{+parent}/kfpArtifacts:create",
10478                "multipart",
10479            )
10480        } else {
10481            unreachable!()
10482        };
10483        params.push("uploadType", upload_type);
10484        if self._scopes.is_empty() {
10485            self._scopes
10486                .insert(Scope::CloudPlatform.as_ref().to_string());
10487        }
10488
10489        #[allow(clippy::single_element_loop)]
10490        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10491            url = params.uri_replacement(url, param_name, find_this, true);
10492        }
10493        {
10494            let to_remove = ["parent"];
10495            params.remove_params(&to_remove);
10496        }
10497
10498        let url = params.parse_with_url(&url);
10499
10500        let mut json_mime_type = mime::APPLICATION_JSON;
10501        let mut request_value_reader = {
10502            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10503            common::remove_json_null_values(&mut value);
10504            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10505            serde_json::to_writer(&mut dst, &value).unwrap();
10506            dst
10507        };
10508        let request_size = request_value_reader
10509            .seek(std::io::SeekFrom::End(0))
10510            .unwrap();
10511        request_value_reader
10512            .seek(std::io::SeekFrom::Start(0))
10513            .unwrap();
10514
10515        loop {
10516            let token = match self
10517                .hub
10518                .auth
10519                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10520                .await
10521            {
10522                Ok(token) => token,
10523                Err(e) => match dlg.token(e) {
10524                    Ok(token) => token,
10525                    Err(e) => {
10526                        dlg.finished(false);
10527                        return Err(common::Error::MissingToken(e));
10528                    }
10529                },
10530            };
10531            request_value_reader
10532                .seek(std::io::SeekFrom::Start(0))
10533                .unwrap();
10534            let mut req_result = {
10535                let mut mp_reader: common::MultiPartReader = Default::default();
10536                let (mut body_reader, content_type) = match protocol {
10537                    common::UploadProtocol::Simple => {
10538                        mp_reader.reserve_exact(2);
10539                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
10540                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
10541
10542                        mp_reader
10543                            .add_part(
10544                                &mut request_value_reader,
10545                                request_size,
10546                                json_mime_type.clone(),
10547                            )
10548                            .add_part(&mut reader, size, reader_mime_type.clone());
10549                        (
10550                            &mut mp_reader as &mut (dyn std::io::Read + Send),
10551                            common::MultiPartReader::mime_type(),
10552                        )
10553                    }
10554                    _ => (
10555                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
10556                        json_mime_type.clone(),
10557                    ),
10558                };
10559                let client = &self.hub.client;
10560                dlg.pre_request();
10561                let mut req_builder = hyper::Request::builder()
10562                    .method(hyper::Method::POST)
10563                    .uri(url.as_str())
10564                    .header(USER_AGENT, self.hub._user_agent.clone());
10565
10566                if let Some(token) = token.as_ref() {
10567                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10568                }
10569
10570                let mut body_reader_bytes = vec![];
10571                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
10572                let request = req_builder
10573                    .header(CONTENT_TYPE, content_type.to_string())
10574                    .body(common::to_body(body_reader_bytes.into()));
10575
10576                client.request(request.unwrap()).await
10577            };
10578
10579            match req_result {
10580                Err(err) => {
10581                    if let common::Retry::After(d) = dlg.http_error(&err) {
10582                        sleep(d).await;
10583                        continue;
10584                    }
10585                    dlg.finished(false);
10586                    return Err(common::Error::HttpError(err));
10587                }
10588                Ok(res) => {
10589                    let (mut parts, body) = res.into_parts();
10590                    let mut body = common::Body::new(body);
10591                    if !parts.status.is_success() {
10592                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10593                        let error = serde_json::from_str(&common::to_string(&bytes));
10594                        let response = common::to_response(parts, bytes.into());
10595
10596                        if let common::Retry::After(d) =
10597                            dlg.http_failure(&response, error.as_ref().ok())
10598                        {
10599                            sleep(d).await;
10600                            continue;
10601                        }
10602
10603                        dlg.finished(false);
10604
10605                        return Err(match error {
10606                            Ok(value) => common::Error::BadRequest(value),
10607                            _ => common::Error::Failure(response),
10608                        });
10609                    }
10610                    let response = {
10611                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10612                        let encoded = common::to_string(&bytes);
10613                        match serde_json::from_str(&encoded) {
10614                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10615                            Err(error) => {
10616                                dlg.response_json_decode_error(&encoded, &error);
10617                                return Err(common::Error::JsonDecodeError(
10618                                    encoded.to_string(),
10619                                    error,
10620                                ));
10621                            }
10622                        }
10623                    };
10624
10625                    dlg.finished(true);
10626                    return Ok(response);
10627                }
10628            }
10629        }
10630    }
10631
10632    /// Upload media all at once.
10633    /// If the upload fails for whichever reason, all progress is lost.
10634    ///
10635    /// * *multipart*: yes
10636    /// * *max size*: 0kb
10637    /// * *valid mime types*: '*/*'
10638    pub async fn upload<RS>(
10639        self,
10640        stream: RS,
10641        mime_type: mime::Mime,
10642    ) -> common::Result<(common::Response, UploadKfpArtifactMediaResponse)>
10643    where
10644        RS: common::ReadSeek,
10645    {
10646        self.doit(stream, mime_type, common::UploadProtocol::Simple)
10647            .await
10648    }
10649
10650    ///
10651    /// Sets the *request* property to the given value.
10652    ///
10653    /// Even though the property as already been set when instantiating this call,
10654    /// we provide this method for API completeness.
10655    pub fn request(
10656        mut self,
10657        new_value: UploadKfpArtifactRequest,
10658    ) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C> {
10659        self._request = new_value;
10660        self
10661    }
10662    /// The resource name of the repository where the KFP artifact will be uploaded.
10663    ///
10664    /// Sets the *parent* path property to the given value.
10665    ///
10666    /// Even though the property as already been set when instantiating this call,
10667    /// we provide this method for API completeness.
10668    pub fn parent(
10669        mut self,
10670        new_value: &str,
10671    ) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C> {
10672        self._parent = new_value.to_string();
10673        self
10674    }
10675    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10676    /// while executing the actual API request.
10677    ///
10678    /// ````text
10679    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10680    /// ````
10681    ///
10682    /// Sets the *delegate* property to the given value.
10683    pub fn delegate(
10684        mut self,
10685        new_value: &'a mut dyn common::Delegate,
10686    ) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C> {
10687        self._delegate = Some(new_value);
10688        self
10689    }
10690
10691    /// Set any additional parameter of the query string used in the request.
10692    /// It should be used to set parameters which are not yet available through their own
10693    /// setters.
10694    ///
10695    /// Please note that this method must not be used to set any of the known parameters
10696    /// which have their own setter method. If done anyway, the request will fail.
10697    ///
10698    /// # Additional Parameters
10699    ///
10700    /// * *$.xgafv* (query-string) - V1 error format.
10701    /// * *access_token* (query-string) - OAuth access token.
10702    /// * *alt* (query-string) - Data format for response.
10703    /// * *callback* (query-string) - JSONP
10704    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10705    /// * *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.
10706    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10707    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10708    /// * *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.
10709    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10710    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10711    pub fn param<T>(
10712        mut self,
10713        name: T,
10714        value: T,
10715    ) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C>
10716    where
10717        T: AsRef<str>,
10718    {
10719        self._additional_params
10720            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10721        self
10722    }
10723
10724    /// Identifies the authorization scope for the method you are building.
10725    ///
10726    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10727    /// [`Scope::CloudPlatform`].
10728    ///
10729    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10730    /// tokens for more than one scope.
10731    ///
10732    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10733    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10734    /// sufficient, a read-write scope will do as well.
10735    pub fn add_scope<St>(
10736        mut self,
10737        scope: St,
10738    ) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C>
10739    where
10740        St: AsRef<str>,
10741    {
10742        self._scopes.insert(String::from(scope.as_ref()));
10743        self
10744    }
10745    /// Identifies the authorization scope(s) for the method you are building.
10746    ///
10747    /// See [`Self::add_scope()`] for details.
10748    pub fn add_scopes<I, St>(
10749        mut self,
10750        scopes: I,
10751    ) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C>
10752    where
10753        I: IntoIterator<Item = St>,
10754        St: AsRef<str>,
10755    {
10756        self._scopes
10757            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10758        self
10759    }
10760
10761    /// Removes all scopes, and no default scope will be used either.
10762    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10763    /// for details).
10764    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryKfpArtifactUploadCall<'a, C> {
10765        self._scopes.clear();
10766        self
10767    }
10768}
10769
10770/// Gets a maven artifact.
10771///
10772/// A builder for the *locations.repositories.mavenArtifacts.get* method supported by a *project* resource.
10773/// It is not used directly, but through a [`ProjectMethods`] instance.
10774///
10775/// # Example
10776///
10777/// Instantiate a resource method builder
10778///
10779/// ```test_harness,no_run
10780/// # extern crate hyper;
10781/// # extern crate hyper_rustls;
10782/// # extern crate google_artifactregistry1 as artifactregistry1;
10783/// # async fn dox() {
10784/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10785///
10786/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10787/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10788/// #     .with_native_roots()
10789/// #     .unwrap()
10790/// #     .https_only()
10791/// #     .enable_http2()
10792/// #     .build();
10793///
10794/// # let executor = hyper_util::rt::TokioExecutor::new();
10795/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10796/// #     secret,
10797/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10798/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10799/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10800/// #     ),
10801/// # ).build().await.unwrap();
10802///
10803/// # let client = hyper_util::client::legacy::Client::builder(
10804/// #     hyper_util::rt::TokioExecutor::new()
10805/// # )
10806/// # .build(
10807/// #     hyper_rustls::HttpsConnectorBuilder::new()
10808/// #         .with_native_roots()
10809/// #         .unwrap()
10810/// #         .https_or_http()
10811/// #         .enable_http2()
10812/// #         .build()
10813/// # );
10814/// # let mut hub = ArtifactRegistry::new(client, auth);
10815/// // You can configure optional parameters by calling the respective setters at will, and
10816/// // execute the final call using `doit()`.
10817/// // Values shown here are possibly random and not representative !
10818/// let result = hub.projects().locations_repositories_maven_artifacts_get("name")
10819///              .doit().await;
10820/// # }
10821/// ```
10822pub struct ProjectLocationRepositoryMavenArtifactGetCall<'a, C>
10823where
10824    C: 'a,
10825{
10826    hub: &'a ArtifactRegistry<C>,
10827    _name: String,
10828    _delegate: Option<&'a mut dyn common::Delegate>,
10829    _additional_params: HashMap<String, String>,
10830    _scopes: BTreeSet<String>,
10831}
10832
10833impl<'a, C> common::CallBuilder for ProjectLocationRepositoryMavenArtifactGetCall<'a, C> {}
10834
10835impl<'a, C> ProjectLocationRepositoryMavenArtifactGetCall<'a, C>
10836where
10837    C: common::Connector,
10838{
10839    /// Perform the operation you have build so far.
10840    pub async fn doit(mut self) -> common::Result<(common::Response, MavenArtifact)> {
10841        use std::borrow::Cow;
10842        use std::io::{Read, Seek};
10843
10844        use common::{url::Params, ToParts};
10845        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10846
10847        let mut dd = common::DefaultDelegate;
10848        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10849        dlg.begin(common::MethodInfo {
10850            id: "artifactregistry.projects.locations.repositories.mavenArtifacts.get",
10851            http_method: hyper::Method::GET,
10852        });
10853
10854        for &field in ["alt", "name"].iter() {
10855            if self._additional_params.contains_key(field) {
10856                dlg.finished(false);
10857                return Err(common::Error::FieldClash(field));
10858            }
10859        }
10860
10861        let mut params = Params::with_capacity(3 + self._additional_params.len());
10862        params.push("name", self._name);
10863
10864        params.extend(self._additional_params.iter());
10865
10866        params.push("alt", "json");
10867        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10868        if self._scopes.is_empty() {
10869            self._scopes
10870                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
10871        }
10872
10873        #[allow(clippy::single_element_loop)]
10874        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10875            url = params.uri_replacement(url, param_name, find_this, true);
10876        }
10877        {
10878            let to_remove = ["name"];
10879            params.remove_params(&to_remove);
10880        }
10881
10882        let url = params.parse_with_url(&url);
10883
10884        loop {
10885            let token = match self
10886                .hub
10887                .auth
10888                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10889                .await
10890            {
10891                Ok(token) => token,
10892                Err(e) => match dlg.token(e) {
10893                    Ok(token) => token,
10894                    Err(e) => {
10895                        dlg.finished(false);
10896                        return Err(common::Error::MissingToken(e));
10897                    }
10898                },
10899            };
10900            let mut req_result = {
10901                let client = &self.hub.client;
10902                dlg.pre_request();
10903                let mut req_builder = hyper::Request::builder()
10904                    .method(hyper::Method::GET)
10905                    .uri(url.as_str())
10906                    .header(USER_AGENT, self.hub._user_agent.clone());
10907
10908                if let Some(token) = token.as_ref() {
10909                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10910                }
10911
10912                let request = req_builder
10913                    .header(CONTENT_LENGTH, 0_u64)
10914                    .body(common::to_body::<String>(None));
10915
10916                client.request(request.unwrap()).await
10917            };
10918
10919            match req_result {
10920                Err(err) => {
10921                    if let common::Retry::After(d) = dlg.http_error(&err) {
10922                        sleep(d).await;
10923                        continue;
10924                    }
10925                    dlg.finished(false);
10926                    return Err(common::Error::HttpError(err));
10927                }
10928                Ok(res) => {
10929                    let (mut parts, body) = res.into_parts();
10930                    let mut body = common::Body::new(body);
10931                    if !parts.status.is_success() {
10932                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10933                        let error = serde_json::from_str(&common::to_string(&bytes));
10934                        let response = common::to_response(parts, bytes.into());
10935
10936                        if let common::Retry::After(d) =
10937                            dlg.http_failure(&response, error.as_ref().ok())
10938                        {
10939                            sleep(d).await;
10940                            continue;
10941                        }
10942
10943                        dlg.finished(false);
10944
10945                        return Err(match error {
10946                            Ok(value) => common::Error::BadRequest(value),
10947                            _ => common::Error::Failure(response),
10948                        });
10949                    }
10950                    let response = {
10951                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10952                        let encoded = common::to_string(&bytes);
10953                        match serde_json::from_str(&encoded) {
10954                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10955                            Err(error) => {
10956                                dlg.response_json_decode_error(&encoded, &error);
10957                                return Err(common::Error::JsonDecodeError(
10958                                    encoded.to_string(),
10959                                    error,
10960                                ));
10961                            }
10962                        }
10963                    };
10964
10965                    dlg.finished(true);
10966                    return Ok(response);
10967                }
10968            }
10969        }
10970    }
10971
10972    /// Required. The name of the maven artifact.
10973    ///
10974    /// Sets the *name* path property to the given value.
10975    ///
10976    /// Even though the property as already been set when instantiating this call,
10977    /// we provide this method for API completeness.
10978    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryMavenArtifactGetCall<'a, C> {
10979        self._name = new_value.to_string();
10980        self
10981    }
10982    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10983    /// while executing the actual API request.
10984    ///
10985    /// ````text
10986    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10987    /// ````
10988    ///
10989    /// Sets the *delegate* property to the given value.
10990    pub fn delegate(
10991        mut self,
10992        new_value: &'a mut dyn common::Delegate,
10993    ) -> ProjectLocationRepositoryMavenArtifactGetCall<'a, C> {
10994        self._delegate = Some(new_value);
10995        self
10996    }
10997
10998    /// Set any additional parameter of the query string used in the request.
10999    /// It should be used to set parameters which are not yet available through their own
11000    /// setters.
11001    ///
11002    /// Please note that this method must not be used to set any of the known parameters
11003    /// which have their own setter method. If done anyway, the request will fail.
11004    ///
11005    /// # Additional Parameters
11006    ///
11007    /// * *$.xgafv* (query-string) - V1 error format.
11008    /// * *access_token* (query-string) - OAuth access token.
11009    /// * *alt* (query-string) - Data format for response.
11010    /// * *callback* (query-string) - JSONP
11011    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11012    /// * *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.
11013    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11014    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11015    /// * *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.
11016    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11017    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11018    pub fn param<T>(
11019        mut self,
11020        name: T,
11021        value: T,
11022    ) -> ProjectLocationRepositoryMavenArtifactGetCall<'a, C>
11023    where
11024        T: AsRef<str>,
11025    {
11026        self._additional_params
11027            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11028        self
11029    }
11030
11031    /// Identifies the authorization scope for the method you are building.
11032    ///
11033    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11034    /// [`Scope::CloudPlatformReadOnly`].
11035    ///
11036    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11037    /// tokens for more than one scope.
11038    ///
11039    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11040    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11041    /// sufficient, a read-write scope will do as well.
11042    pub fn add_scope<St>(
11043        mut self,
11044        scope: St,
11045    ) -> ProjectLocationRepositoryMavenArtifactGetCall<'a, C>
11046    where
11047        St: AsRef<str>,
11048    {
11049        self._scopes.insert(String::from(scope.as_ref()));
11050        self
11051    }
11052    /// Identifies the authorization scope(s) for the method you are building.
11053    ///
11054    /// See [`Self::add_scope()`] for details.
11055    pub fn add_scopes<I, St>(
11056        mut self,
11057        scopes: I,
11058    ) -> ProjectLocationRepositoryMavenArtifactGetCall<'a, C>
11059    where
11060        I: IntoIterator<Item = St>,
11061        St: AsRef<str>,
11062    {
11063        self._scopes
11064            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11065        self
11066    }
11067
11068    /// Removes all scopes, and no default scope will be used either.
11069    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11070    /// for details).
11071    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryMavenArtifactGetCall<'a, C> {
11072        self._scopes.clear();
11073        self
11074    }
11075}
11076
11077/// Lists maven artifacts.
11078///
11079/// A builder for the *locations.repositories.mavenArtifacts.list* method supported by a *project* resource.
11080/// It is not used directly, but through a [`ProjectMethods`] instance.
11081///
11082/// # Example
11083///
11084/// Instantiate a resource method builder
11085///
11086/// ```test_harness,no_run
11087/// # extern crate hyper;
11088/// # extern crate hyper_rustls;
11089/// # extern crate google_artifactregistry1 as artifactregistry1;
11090/// # async fn dox() {
11091/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11092///
11093/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11094/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11095/// #     .with_native_roots()
11096/// #     .unwrap()
11097/// #     .https_only()
11098/// #     .enable_http2()
11099/// #     .build();
11100///
11101/// # let executor = hyper_util::rt::TokioExecutor::new();
11102/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11103/// #     secret,
11104/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11105/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11106/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11107/// #     ),
11108/// # ).build().await.unwrap();
11109///
11110/// # let client = hyper_util::client::legacy::Client::builder(
11111/// #     hyper_util::rt::TokioExecutor::new()
11112/// # )
11113/// # .build(
11114/// #     hyper_rustls::HttpsConnectorBuilder::new()
11115/// #         .with_native_roots()
11116/// #         .unwrap()
11117/// #         .https_or_http()
11118/// #         .enable_http2()
11119/// #         .build()
11120/// # );
11121/// # let mut hub = ArtifactRegistry::new(client, auth);
11122/// // You can configure optional parameters by calling the respective setters at will, and
11123/// // execute the final call using `doit()`.
11124/// // Values shown here are possibly random and not representative !
11125/// let result = hub.projects().locations_repositories_maven_artifacts_list("parent")
11126///              .page_token("duo")
11127///              .page_size(-80)
11128///              .doit().await;
11129/// # }
11130/// ```
11131pub struct ProjectLocationRepositoryMavenArtifactListCall<'a, C>
11132where
11133    C: 'a,
11134{
11135    hub: &'a ArtifactRegistry<C>,
11136    _parent: String,
11137    _page_token: Option<String>,
11138    _page_size: Option<i32>,
11139    _delegate: Option<&'a mut dyn common::Delegate>,
11140    _additional_params: HashMap<String, String>,
11141    _scopes: BTreeSet<String>,
11142}
11143
11144impl<'a, C> common::CallBuilder for ProjectLocationRepositoryMavenArtifactListCall<'a, C> {}
11145
11146impl<'a, C> ProjectLocationRepositoryMavenArtifactListCall<'a, C>
11147where
11148    C: common::Connector,
11149{
11150    /// Perform the operation you have build so far.
11151    pub async fn doit(mut self) -> common::Result<(common::Response, ListMavenArtifactsResponse)> {
11152        use std::borrow::Cow;
11153        use std::io::{Read, Seek};
11154
11155        use common::{url::Params, ToParts};
11156        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11157
11158        let mut dd = common::DefaultDelegate;
11159        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11160        dlg.begin(common::MethodInfo {
11161            id: "artifactregistry.projects.locations.repositories.mavenArtifacts.list",
11162            http_method: hyper::Method::GET,
11163        });
11164
11165        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
11166            if self._additional_params.contains_key(field) {
11167                dlg.finished(false);
11168                return Err(common::Error::FieldClash(field));
11169            }
11170        }
11171
11172        let mut params = Params::with_capacity(5 + self._additional_params.len());
11173        params.push("parent", self._parent);
11174        if let Some(value) = self._page_token.as_ref() {
11175            params.push("pageToken", value);
11176        }
11177        if let Some(value) = self._page_size.as_ref() {
11178            params.push("pageSize", value.to_string());
11179        }
11180
11181        params.extend(self._additional_params.iter());
11182
11183        params.push("alt", "json");
11184        let mut url = self.hub._base_url.clone() + "v1/{+parent}/mavenArtifacts";
11185        if self._scopes.is_empty() {
11186            self._scopes
11187                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11188        }
11189
11190        #[allow(clippy::single_element_loop)]
11191        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11192            url = params.uri_replacement(url, param_name, find_this, true);
11193        }
11194        {
11195            let to_remove = ["parent"];
11196            params.remove_params(&to_remove);
11197        }
11198
11199        let url = params.parse_with_url(&url);
11200
11201        loop {
11202            let token = match self
11203                .hub
11204                .auth
11205                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11206                .await
11207            {
11208                Ok(token) => token,
11209                Err(e) => match dlg.token(e) {
11210                    Ok(token) => token,
11211                    Err(e) => {
11212                        dlg.finished(false);
11213                        return Err(common::Error::MissingToken(e));
11214                    }
11215                },
11216            };
11217            let mut req_result = {
11218                let client = &self.hub.client;
11219                dlg.pre_request();
11220                let mut req_builder = hyper::Request::builder()
11221                    .method(hyper::Method::GET)
11222                    .uri(url.as_str())
11223                    .header(USER_AGENT, self.hub._user_agent.clone());
11224
11225                if let Some(token) = token.as_ref() {
11226                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11227                }
11228
11229                let request = req_builder
11230                    .header(CONTENT_LENGTH, 0_u64)
11231                    .body(common::to_body::<String>(None));
11232
11233                client.request(request.unwrap()).await
11234            };
11235
11236            match req_result {
11237                Err(err) => {
11238                    if let common::Retry::After(d) = dlg.http_error(&err) {
11239                        sleep(d).await;
11240                        continue;
11241                    }
11242                    dlg.finished(false);
11243                    return Err(common::Error::HttpError(err));
11244                }
11245                Ok(res) => {
11246                    let (mut parts, body) = res.into_parts();
11247                    let mut body = common::Body::new(body);
11248                    if !parts.status.is_success() {
11249                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11250                        let error = serde_json::from_str(&common::to_string(&bytes));
11251                        let response = common::to_response(parts, bytes.into());
11252
11253                        if let common::Retry::After(d) =
11254                            dlg.http_failure(&response, error.as_ref().ok())
11255                        {
11256                            sleep(d).await;
11257                            continue;
11258                        }
11259
11260                        dlg.finished(false);
11261
11262                        return Err(match error {
11263                            Ok(value) => common::Error::BadRequest(value),
11264                            _ => common::Error::Failure(response),
11265                        });
11266                    }
11267                    let response = {
11268                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11269                        let encoded = common::to_string(&bytes);
11270                        match serde_json::from_str(&encoded) {
11271                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11272                            Err(error) => {
11273                                dlg.response_json_decode_error(&encoded, &error);
11274                                return Err(common::Error::JsonDecodeError(
11275                                    encoded.to_string(),
11276                                    error,
11277                                ));
11278                            }
11279                        }
11280                    };
11281
11282                    dlg.finished(true);
11283                    return Ok(response);
11284                }
11285            }
11286        }
11287    }
11288
11289    /// Required. The name of the parent resource whose maven artifacts will be listed.
11290    ///
11291    /// Sets the *parent* path property to the given value.
11292    ///
11293    /// Even though the property as already been set when instantiating this call,
11294    /// we provide this method for API completeness.
11295    pub fn parent(
11296        mut self,
11297        new_value: &str,
11298    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C> {
11299        self._parent = new_value.to_string();
11300        self
11301    }
11302    /// The next_page_token value returned from a previous list request, if any.
11303    ///
11304    /// Sets the *page token* query property to the given value.
11305    pub fn page_token(
11306        mut self,
11307        new_value: &str,
11308    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C> {
11309        self._page_token = Some(new_value.to_string());
11310        self
11311    }
11312    /// The maximum number of artifacts to return. Maximum page size is 1,000.
11313    ///
11314    /// Sets the *page size* query property to the given value.
11315    pub fn page_size(
11316        mut self,
11317        new_value: i32,
11318    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C> {
11319        self._page_size = Some(new_value);
11320        self
11321    }
11322    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11323    /// while executing the actual API request.
11324    ///
11325    /// ````text
11326    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11327    /// ````
11328    ///
11329    /// Sets the *delegate* property to the given value.
11330    pub fn delegate(
11331        mut self,
11332        new_value: &'a mut dyn common::Delegate,
11333    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C> {
11334        self._delegate = Some(new_value);
11335        self
11336    }
11337
11338    /// Set any additional parameter of the query string used in the request.
11339    /// It should be used to set parameters which are not yet available through their own
11340    /// setters.
11341    ///
11342    /// Please note that this method must not be used to set any of the known parameters
11343    /// which have their own setter method. If done anyway, the request will fail.
11344    ///
11345    /// # Additional Parameters
11346    ///
11347    /// * *$.xgafv* (query-string) - V1 error format.
11348    /// * *access_token* (query-string) - OAuth access token.
11349    /// * *alt* (query-string) - Data format for response.
11350    /// * *callback* (query-string) - JSONP
11351    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11352    /// * *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.
11353    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11354    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11355    /// * *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.
11356    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11357    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11358    pub fn param<T>(
11359        mut self,
11360        name: T,
11361        value: T,
11362    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C>
11363    where
11364        T: AsRef<str>,
11365    {
11366        self._additional_params
11367            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11368        self
11369    }
11370
11371    /// Identifies the authorization scope for the method you are building.
11372    ///
11373    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11374    /// [`Scope::CloudPlatformReadOnly`].
11375    ///
11376    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11377    /// tokens for more than one scope.
11378    ///
11379    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11380    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11381    /// sufficient, a read-write scope will do as well.
11382    pub fn add_scope<St>(
11383        mut self,
11384        scope: St,
11385    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C>
11386    where
11387        St: AsRef<str>,
11388    {
11389        self._scopes.insert(String::from(scope.as_ref()));
11390        self
11391    }
11392    /// Identifies the authorization scope(s) for the method you are building.
11393    ///
11394    /// See [`Self::add_scope()`] for details.
11395    pub fn add_scopes<I, St>(
11396        mut self,
11397        scopes: I,
11398    ) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C>
11399    where
11400        I: IntoIterator<Item = St>,
11401        St: AsRef<str>,
11402    {
11403        self._scopes
11404            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11405        self
11406    }
11407
11408    /// Removes all scopes, and no default scope will be used either.
11409    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11410    /// for details).
11411    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryMavenArtifactListCall<'a, C> {
11412        self._scopes.clear();
11413        self
11414    }
11415}
11416
11417/// Gets a npm package.
11418///
11419/// A builder for the *locations.repositories.npmPackages.get* method supported by a *project* resource.
11420/// It is not used directly, but through a [`ProjectMethods`] instance.
11421///
11422/// # Example
11423///
11424/// Instantiate a resource method builder
11425///
11426/// ```test_harness,no_run
11427/// # extern crate hyper;
11428/// # extern crate hyper_rustls;
11429/// # extern crate google_artifactregistry1 as artifactregistry1;
11430/// # async fn dox() {
11431/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11432///
11433/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11434/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11435/// #     .with_native_roots()
11436/// #     .unwrap()
11437/// #     .https_only()
11438/// #     .enable_http2()
11439/// #     .build();
11440///
11441/// # let executor = hyper_util::rt::TokioExecutor::new();
11442/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11443/// #     secret,
11444/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11445/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11446/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11447/// #     ),
11448/// # ).build().await.unwrap();
11449///
11450/// # let client = hyper_util::client::legacy::Client::builder(
11451/// #     hyper_util::rt::TokioExecutor::new()
11452/// # )
11453/// # .build(
11454/// #     hyper_rustls::HttpsConnectorBuilder::new()
11455/// #         .with_native_roots()
11456/// #         .unwrap()
11457/// #         .https_or_http()
11458/// #         .enable_http2()
11459/// #         .build()
11460/// # );
11461/// # let mut hub = ArtifactRegistry::new(client, auth);
11462/// // You can configure optional parameters by calling the respective setters at will, and
11463/// // execute the final call using `doit()`.
11464/// // Values shown here are possibly random and not representative !
11465/// let result = hub.projects().locations_repositories_npm_packages_get("name")
11466///              .doit().await;
11467/// # }
11468/// ```
11469pub struct ProjectLocationRepositoryNpmPackageGetCall<'a, C>
11470where
11471    C: 'a,
11472{
11473    hub: &'a ArtifactRegistry<C>,
11474    _name: String,
11475    _delegate: Option<&'a mut dyn common::Delegate>,
11476    _additional_params: HashMap<String, String>,
11477    _scopes: BTreeSet<String>,
11478}
11479
11480impl<'a, C> common::CallBuilder for ProjectLocationRepositoryNpmPackageGetCall<'a, C> {}
11481
11482impl<'a, C> ProjectLocationRepositoryNpmPackageGetCall<'a, C>
11483where
11484    C: common::Connector,
11485{
11486    /// Perform the operation you have build so far.
11487    pub async fn doit(mut self) -> common::Result<(common::Response, NpmPackage)> {
11488        use std::borrow::Cow;
11489        use std::io::{Read, Seek};
11490
11491        use common::{url::Params, ToParts};
11492        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11493
11494        let mut dd = common::DefaultDelegate;
11495        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11496        dlg.begin(common::MethodInfo {
11497            id: "artifactregistry.projects.locations.repositories.npmPackages.get",
11498            http_method: hyper::Method::GET,
11499        });
11500
11501        for &field in ["alt", "name"].iter() {
11502            if self._additional_params.contains_key(field) {
11503                dlg.finished(false);
11504                return Err(common::Error::FieldClash(field));
11505            }
11506        }
11507
11508        let mut params = Params::with_capacity(3 + self._additional_params.len());
11509        params.push("name", self._name);
11510
11511        params.extend(self._additional_params.iter());
11512
11513        params.push("alt", "json");
11514        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11515        if self._scopes.is_empty() {
11516            self._scopes
11517                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11518        }
11519
11520        #[allow(clippy::single_element_loop)]
11521        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11522            url = params.uri_replacement(url, param_name, find_this, true);
11523        }
11524        {
11525            let to_remove = ["name"];
11526            params.remove_params(&to_remove);
11527        }
11528
11529        let url = params.parse_with_url(&url);
11530
11531        loop {
11532            let token = match self
11533                .hub
11534                .auth
11535                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11536                .await
11537            {
11538                Ok(token) => token,
11539                Err(e) => match dlg.token(e) {
11540                    Ok(token) => token,
11541                    Err(e) => {
11542                        dlg.finished(false);
11543                        return Err(common::Error::MissingToken(e));
11544                    }
11545                },
11546            };
11547            let mut req_result = {
11548                let client = &self.hub.client;
11549                dlg.pre_request();
11550                let mut req_builder = hyper::Request::builder()
11551                    .method(hyper::Method::GET)
11552                    .uri(url.as_str())
11553                    .header(USER_AGENT, self.hub._user_agent.clone());
11554
11555                if let Some(token) = token.as_ref() {
11556                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11557                }
11558
11559                let request = req_builder
11560                    .header(CONTENT_LENGTH, 0_u64)
11561                    .body(common::to_body::<String>(None));
11562
11563                client.request(request.unwrap()).await
11564            };
11565
11566            match req_result {
11567                Err(err) => {
11568                    if let common::Retry::After(d) = dlg.http_error(&err) {
11569                        sleep(d).await;
11570                        continue;
11571                    }
11572                    dlg.finished(false);
11573                    return Err(common::Error::HttpError(err));
11574                }
11575                Ok(res) => {
11576                    let (mut parts, body) = res.into_parts();
11577                    let mut body = common::Body::new(body);
11578                    if !parts.status.is_success() {
11579                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11580                        let error = serde_json::from_str(&common::to_string(&bytes));
11581                        let response = common::to_response(parts, bytes.into());
11582
11583                        if let common::Retry::After(d) =
11584                            dlg.http_failure(&response, error.as_ref().ok())
11585                        {
11586                            sleep(d).await;
11587                            continue;
11588                        }
11589
11590                        dlg.finished(false);
11591
11592                        return Err(match error {
11593                            Ok(value) => common::Error::BadRequest(value),
11594                            _ => common::Error::Failure(response),
11595                        });
11596                    }
11597                    let response = {
11598                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11599                        let encoded = common::to_string(&bytes);
11600                        match serde_json::from_str(&encoded) {
11601                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11602                            Err(error) => {
11603                                dlg.response_json_decode_error(&encoded, &error);
11604                                return Err(common::Error::JsonDecodeError(
11605                                    encoded.to_string(),
11606                                    error,
11607                                ));
11608                            }
11609                        }
11610                    };
11611
11612                    dlg.finished(true);
11613                    return Ok(response);
11614                }
11615            }
11616        }
11617    }
11618
11619    /// Required. The name of the npm package.
11620    ///
11621    /// Sets the *name* path property to the given value.
11622    ///
11623    /// Even though the property as already been set when instantiating this call,
11624    /// we provide this method for API completeness.
11625    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryNpmPackageGetCall<'a, C> {
11626        self._name = new_value.to_string();
11627        self
11628    }
11629    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11630    /// while executing the actual API request.
11631    ///
11632    /// ````text
11633    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11634    /// ````
11635    ///
11636    /// Sets the *delegate* property to the given value.
11637    pub fn delegate(
11638        mut self,
11639        new_value: &'a mut dyn common::Delegate,
11640    ) -> ProjectLocationRepositoryNpmPackageGetCall<'a, C> {
11641        self._delegate = Some(new_value);
11642        self
11643    }
11644
11645    /// Set any additional parameter of the query string used in the request.
11646    /// It should be used to set parameters which are not yet available through their own
11647    /// setters.
11648    ///
11649    /// Please note that this method must not be used to set any of the known parameters
11650    /// which have their own setter method. If done anyway, the request will fail.
11651    ///
11652    /// # Additional Parameters
11653    ///
11654    /// * *$.xgafv* (query-string) - V1 error format.
11655    /// * *access_token* (query-string) - OAuth access token.
11656    /// * *alt* (query-string) - Data format for response.
11657    /// * *callback* (query-string) - JSONP
11658    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11659    /// * *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.
11660    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11661    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11662    /// * *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.
11663    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11664    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11665    pub fn param<T>(
11666        mut self,
11667        name: T,
11668        value: T,
11669    ) -> ProjectLocationRepositoryNpmPackageGetCall<'a, C>
11670    where
11671        T: AsRef<str>,
11672    {
11673        self._additional_params
11674            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11675        self
11676    }
11677
11678    /// Identifies the authorization scope for the method you are building.
11679    ///
11680    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11681    /// [`Scope::CloudPlatformReadOnly`].
11682    ///
11683    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11684    /// tokens for more than one scope.
11685    ///
11686    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11687    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11688    /// sufficient, a read-write scope will do as well.
11689    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryNpmPackageGetCall<'a, C>
11690    where
11691        St: AsRef<str>,
11692    {
11693        self._scopes.insert(String::from(scope.as_ref()));
11694        self
11695    }
11696    /// Identifies the authorization scope(s) for the method you are building.
11697    ///
11698    /// See [`Self::add_scope()`] for details.
11699    pub fn add_scopes<I, St>(
11700        mut self,
11701        scopes: I,
11702    ) -> ProjectLocationRepositoryNpmPackageGetCall<'a, C>
11703    where
11704        I: IntoIterator<Item = St>,
11705        St: AsRef<str>,
11706    {
11707        self._scopes
11708            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11709        self
11710    }
11711
11712    /// Removes all scopes, and no default scope will be used either.
11713    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11714    /// for details).
11715    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryNpmPackageGetCall<'a, C> {
11716        self._scopes.clear();
11717        self
11718    }
11719}
11720
11721/// Lists npm packages.
11722///
11723/// A builder for the *locations.repositories.npmPackages.list* method supported by a *project* resource.
11724/// It is not used directly, but through a [`ProjectMethods`] instance.
11725///
11726/// # Example
11727///
11728/// Instantiate a resource method builder
11729///
11730/// ```test_harness,no_run
11731/// # extern crate hyper;
11732/// # extern crate hyper_rustls;
11733/// # extern crate google_artifactregistry1 as artifactregistry1;
11734/// # async fn dox() {
11735/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11736///
11737/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11738/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11739/// #     .with_native_roots()
11740/// #     .unwrap()
11741/// #     .https_only()
11742/// #     .enable_http2()
11743/// #     .build();
11744///
11745/// # let executor = hyper_util::rt::TokioExecutor::new();
11746/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11747/// #     secret,
11748/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11749/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11750/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11751/// #     ),
11752/// # ).build().await.unwrap();
11753///
11754/// # let client = hyper_util::client::legacy::Client::builder(
11755/// #     hyper_util::rt::TokioExecutor::new()
11756/// # )
11757/// # .build(
11758/// #     hyper_rustls::HttpsConnectorBuilder::new()
11759/// #         .with_native_roots()
11760/// #         .unwrap()
11761/// #         .https_or_http()
11762/// #         .enable_http2()
11763/// #         .build()
11764/// # );
11765/// # let mut hub = ArtifactRegistry::new(client, auth);
11766/// // You can configure optional parameters by calling the respective setters at will, and
11767/// // execute the final call using `doit()`.
11768/// // Values shown here are possibly random and not representative !
11769/// let result = hub.projects().locations_repositories_npm_packages_list("parent")
11770///              .page_token("kasd")
11771///              .page_size(-24)
11772///              .doit().await;
11773/// # }
11774/// ```
11775pub struct ProjectLocationRepositoryNpmPackageListCall<'a, C>
11776where
11777    C: 'a,
11778{
11779    hub: &'a ArtifactRegistry<C>,
11780    _parent: String,
11781    _page_token: Option<String>,
11782    _page_size: Option<i32>,
11783    _delegate: Option<&'a mut dyn common::Delegate>,
11784    _additional_params: HashMap<String, String>,
11785    _scopes: BTreeSet<String>,
11786}
11787
11788impl<'a, C> common::CallBuilder for ProjectLocationRepositoryNpmPackageListCall<'a, C> {}
11789
11790impl<'a, C> ProjectLocationRepositoryNpmPackageListCall<'a, C>
11791where
11792    C: common::Connector,
11793{
11794    /// Perform the operation you have build so far.
11795    pub async fn doit(mut self) -> common::Result<(common::Response, ListNpmPackagesResponse)> {
11796        use std::borrow::Cow;
11797        use std::io::{Read, Seek};
11798
11799        use common::{url::Params, ToParts};
11800        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11801
11802        let mut dd = common::DefaultDelegate;
11803        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11804        dlg.begin(common::MethodInfo {
11805            id: "artifactregistry.projects.locations.repositories.npmPackages.list",
11806            http_method: hyper::Method::GET,
11807        });
11808
11809        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
11810            if self._additional_params.contains_key(field) {
11811                dlg.finished(false);
11812                return Err(common::Error::FieldClash(field));
11813            }
11814        }
11815
11816        let mut params = Params::with_capacity(5 + self._additional_params.len());
11817        params.push("parent", self._parent);
11818        if let Some(value) = self._page_token.as_ref() {
11819            params.push("pageToken", value);
11820        }
11821        if let Some(value) = self._page_size.as_ref() {
11822            params.push("pageSize", value.to_string());
11823        }
11824
11825        params.extend(self._additional_params.iter());
11826
11827        params.push("alt", "json");
11828        let mut url = self.hub._base_url.clone() + "v1/{+parent}/npmPackages";
11829        if self._scopes.is_empty() {
11830            self._scopes
11831                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11832        }
11833
11834        #[allow(clippy::single_element_loop)]
11835        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11836            url = params.uri_replacement(url, param_name, find_this, true);
11837        }
11838        {
11839            let to_remove = ["parent"];
11840            params.remove_params(&to_remove);
11841        }
11842
11843        let url = params.parse_with_url(&url);
11844
11845        loop {
11846            let token = match self
11847                .hub
11848                .auth
11849                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11850                .await
11851            {
11852                Ok(token) => token,
11853                Err(e) => match dlg.token(e) {
11854                    Ok(token) => token,
11855                    Err(e) => {
11856                        dlg.finished(false);
11857                        return Err(common::Error::MissingToken(e));
11858                    }
11859                },
11860            };
11861            let mut req_result = {
11862                let client = &self.hub.client;
11863                dlg.pre_request();
11864                let mut req_builder = hyper::Request::builder()
11865                    .method(hyper::Method::GET)
11866                    .uri(url.as_str())
11867                    .header(USER_AGENT, self.hub._user_agent.clone());
11868
11869                if let Some(token) = token.as_ref() {
11870                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11871                }
11872
11873                let request = req_builder
11874                    .header(CONTENT_LENGTH, 0_u64)
11875                    .body(common::to_body::<String>(None));
11876
11877                client.request(request.unwrap()).await
11878            };
11879
11880            match req_result {
11881                Err(err) => {
11882                    if let common::Retry::After(d) = dlg.http_error(&err) {
11883                        sleep(d).await;
11884                        continue;
11885                    }
11886                    dlg.finished(false);
11887                    return Err(common::Error::HttpError(err));
11888                }
11889                Ok(res) => {
11890                    let (mut parts, body) = res.into_parts();
11891                    let mut body = common::Body::new(body);
11892                    if !parts.status.is_success() {
11893                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11894                        let error = serde_json::from_str(&common::to_string(&bytes));
11895                        let response = common::to_response(parts, bytes.into());
11896
11897                        if let common::Retry::After(d) =
11898                            dlg.http_failure(&response, error.as_ref().ok())
11899                        {
11900                            sleep(d).await;
11901                            continue;
11902                        }
11903
11904                        dlg.finished(false);
11905
11906                        return Err(match error {
11907                            Ok(value) => common::Error::BadRequest(value),
11908                            _ => common::Error::Failure(response),
11909                        });
11910                    }
11911                    let response = {
11912                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11913                        let encoded = common::to_string(&bytes);
11914                        match serde_json::from_str(&encoded) {
11915                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11916                            Err(error) => {
11917                                dlg.response_json_decode_error(&encoded, &error);
11918                                return Err(common::Error::JsonDecodeError(
11919                                    encoded.to_string(),
11920                                    error,
11921                                ));
11922                            }
11923                        }
11924                    };
11925
11926                    dlg.finished(true);
11927                    return Ok(response);
11928                }
11929            }
11930        }
11931    }
11932
11933    /// Required. The name of the parent resource whose npm packages will be listed.
11934    ///
11935    /// Sets the *parent* path property to the given value.
11936    ///
11937    /// Even though the property as already been set when instantiating this call,
11938    /// we provide this method for API completeness.
11939    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryNpmPackageListCall<'a, C> {
11940        self._parent = new_value.to_string();
11941        self
11942    }
11943    /// The next_page_token value returned from a previous list request, if any.
11944    ///
11945    /// Sets the *page token* query property to the given value.
11946    pub fn page_token(
11947        mut self,
11948        new_value: &str,
11949    ) -> ProjectLocationRepositoryNpmPackageListCall<'a, C> {
11950        self._page_token = Some(new_value.to_string());
11951        self
11952    }
11953    /// The maximum number of artifacts to return. Maximum page size is 1,000.
11954    ///
11955    /// Sets the *page size* query property to the given value.
11956    pub fn page_size(
11957        mut self,
11958        new_value: i32,
11959    ) -> ProjectLocationRepositoryNpmPackageListCall<'a, C> {
11960        self._page_size = Some(new_value);
11961        self
11962    }
11963    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11964    /// while executing the actual API request.
11965    ///
11966    /// ````text
11967    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11968    /// ````
11969    ///
11970    /// Sets the *delegate* property to the given value.
11971    pub fn delegate(
11972        mut self,
11973        new_value: &'a mut dyn common::Delegate,
11974    ) -> ProjectLocationRepositoryNpmPackageListCall<'a, C> {
11975        self._delegate = Some(new_value);
11976        self
11977    }
11978
11979    /// Set any additional parameter of the query string used in the request.
11980    /// It should be used to set parameters which are not yet available through their own
11981    /// setters.
11982    ///
11983    /// Please note that this method must not be used to set any of the known parameters
11984    /// which have their own setter method. If done anyway, the request will fail.
11985    ///
11986    /// # Additional Parameters
11987    ///
11988    /// * *$.xgafv* (query-string) - V1 error format.
11989    /// * *access_token* (query-string) - OAuth access token.
11990    /// * *alt* (query-string) - Data format for response.
11991    /// * *callback* (query-string) - JSONP
11992    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11993    /// * *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.
11994    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11995    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11996    /// * *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.
11997    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11998    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11999    pub fn param<T>(
12000        mut self,
12001        name: T,
12002        value: T,
12003    ) -> ProjectLocationRepositoryNpmPackageListCall<'a, C>
12004    where
12005        T: AsRef<str>,
12006    {
12007        self._additional_params
12008            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12009        self
12010    }
12011
12012    /// Identifies the authorization scope for the method you are building.
12013    ///
12014    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12015    /// [`Scope::CloudPlatformReadOnly`].
12016    ///
12017    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12018    /// tokens for more than one scope.
12019    ///
12020    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12021    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12022    /// sufficient, a read-write scope will do as well.
12023    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryNpmPackageListCall<'a, C>
12024    where
12025        St: AsRef<str>,
12026    {
12027        self._scopes.insert(String::from(scope.as_ref()));
12028        self
12029    }
12030    /// Identifies the authorization scope(s) for the method you are building.
12031    ///
12032    /// See [`Self::add_scope()`] for details.
12033    pub fn add_scopes<I, St>(
12034        mut self,
12035        scopes: I,
12036    ) -> ProjectLocationRepositoryNpmPackageListCall<'a, C>
12037    where
12038        I: IntoIterator<Item = St>,
12039        St: AsRef<str>,
12040    {
12041        self._scopes
12042            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12043        self
12044    }
12045
12046    /// Removes all scopes, and no default scope will be used either.
12047    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12048    /// for details).
12049    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryNpmPackageListCall<'a, C> {
12050        self._scopes.clear();
12051        self
12052    }
12053}
12054
12055/// Creates a tag.
12056///
12057/// A builder for the *locations.repositories.packages.tags.create* method supported by a *project* resource.
12058/// It is not used directly, but through a [`ProjectMethods`] instance.
12059///
12060/// # Example
12061///
12062/// Instantiate a resource method builder
12063///
12064/// ```test_harness,no_run
12065/// # extern crate hyper;
12066/// # extern crate hyper_rustls;
12067/// # extern crate google_artifactregistry1 as artifactregistry1;
12068/// use artifactregistry1::api::Tag;
12069/// # async fn dox() {
12070/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12071///
12072/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12073/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12074/// #     .with_native_roots()
12075/// #     .unwrap()
12076/// #     .https_only()
12077/// #     .enable_http2()
12078/// #     .build();
12079///
12080/// # let executor = hyper_util::rt::TokioExecutor::new();
12081/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12082/// #     secret,
12083/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12084/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12085/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12086/// #     ),
12087/// # ).build().await.unwrap();
12088///
12089/// # let client = hyper_util::client::legacy::Client::builder(
12090/// #     hyper_util::rt::TokioExecutor::new()
12091/// # )
12092/// # .build(
12093/// #     hyper_rustls::HttpsConnectorBuilder::new()
12094/// #         .with_native_roots()
12095/// #         .unwrap()
12096/// #         .https_or_http()
12097/// #         .enable_http2()
12098/// #         .build()
12099/// # );
12100/// # let mut hub = ArtifactRegistry::new(client, auth);
12101/// // As the method needs a request, you would usually fill it with the desired information
12102/// // into the respective structure. Some of the parts shown here might not be applicable !
12103/// // Values shown here are possibly random and not representative !
12104/// let mut req = Tag::default();
12105///
12106/// // You can configure optional parameters by calling the respective setters at will, and
12107/// // execute the final call using `doit()`.
12108/// // Values shown here are possibly random and not representative !
12109/// let result = hub.projects().locations_repositories_packages_tags_create(req, "parent")
12110///              .tag_id("et")
12111///              .doit().await;
12112/// # }
12113/// ```
12114pub struct ProjectLocationRepositoryPackageTagCreateCall<'a, C>
12115where
12116    C: 'a,
12117{
12118    hub: &'a ArtifactRegistry<C>,
12119    _request: Tag,
12120    _parent: String,
12121    _tag_id: Option<String>,
12122    _delegate: Option<&'a mut dyn common::Delegate>,
12123    _additional_params: HashMap<String, String>,
12124    _scopes: BTreeSet<String>,
12125}
12126
12127impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagCreateCall<'a, C> {}
12128
12129impl<'a, C> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
12130where
12131    C: common::Connector,
12132{
12133    /// Perform the operation you have build so far.
12134    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
12135        use std::borrow::Cow;
12136        use std::io::{Read, Seek};
12137
12138        use common::{url::Params, ToParts};
12139        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12140
12141        let mut dd = common::DefaultDelegate;
12142        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12143        dlg.begin(common::MethodInfo {
12144            id: "artifactregistry.projects.locations.repositories.packages.tags.create",
12145            http_method: hyper::Method::POST,
12146        });
12147
12148        for &field in ["alt", "parent", "tagId"].iter() {
12149            if self._additional_params.contains_key(field) {
12150                dlg.finished(false);
12151                return Err(common::Error::FieldClash(field));
12152            }
12153        }
12154
12155        let mut params = Params::with_capacity(5 + self._additional_params.len());
12156        params.push("parent", self._parent);
12157        if let Some(value) = self._tag_id.as_ref() {
12158            params.push("tagId", value);
12159        }
12160
12161        params.extend(self._additional_params.iter());
12162
12163        params.push("alt", "json");
12164        let mut url = self.hub._base_url.clone() + "v1/{+parent}/tags";
12165        if self._scopes.is_empty() {
12166            self._scopes
12167                .insert(Scope::CloudPlatform.as_ref().to_string());
12168        }
12169
12170        #[allow(clippy::single_element_loop)]
12171        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12172            url = params.uri_replacement(url, param_name, find_this, true);
12173        }
12174        {
12175            let to_remove = ["parent"];
12176            params.remove_params(&to_remove);
12177        }
12178
12179        let url = params.parse_with_url(&url);
12180
12181        let mut json_mime_type = mime::APPLICATION_JSON;
12182        let mut request_value_reader = {
12183            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12184            common::remove_json_null_values(&mut value);
12185            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12186            serde_json::to_writer(&mut dst, &value).unwrap();
12187            dst
12188        };
12189        let request_size = request_value_reader
12190            .seek(std::io::SeekFrom::End(0))
12191            .unwrap();
12192        request_value_reader
12193            .seek(std::io::SeekFrom::Start(0))
12194            .unwrap();
12195
12196        loop {
12197            let token = match self
12198                .hub
12199                .auth
12200                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12201                .await
12202            {
12203                Ok(token) => token,
12204                Err(e) => match dlg.token(e) {
12205                    Ok(token) => token,
12206                    Err(e) => {
12207                        dlg.finished(false);
12208                        return Err(common::Error::MissingToken(e));
12209                    }
12210                },
12211            };
12212            request_value_reader
12213                .seek(std::io::SeekFrom::Start(0))
12214                .unwrap();
12215            let mut req_result = {
12216                let client = &self.hub.client;
12217                dlg.pre_request();
12218                let mut req_builder = hyper::Request::builder()
12219                    .method(hyper::Method::POST)
12220                    .uri(url.as_str())
12221                    .header(USER_AGENT, self.hub._user_agent.clone());
12222
12223                if let Some(token) = token.as_ref() {
12224                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12225                }
12226
12227                let request = req_builder
12228                    .header(CONTENT_TYPE, json_mime_type.to_string())
12229                    .header(CONTENT_LENGTH, request_size as u64)
12230                    .body(common::to_body(
12231                        request_value_reader.get_ref().clone().into(),
12232                    ));
12233
12234                client.request(request.unwrap()).await
12235            };
12236
12237            match req_result {
12238                Err(err) => {
12239                    if let common::Retry::After(d) = dlg.http_error(&err) {
12240                        sleep(d).await;
12241                        continue;
12242                    }
12243                    dlg.finished(false);
12244                    return Err(common::Error::HttpError(err));
12245                }
12246                Ok(res) => {
12247                    let (mut parts, body) = res.into_parts();
12248                    let mut body = common::Body::new(body);
12249                    if !parts.status.is_success() {
12250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12251                        let error = serde_json::from_str(&common::to_string(&bytes));
12252                        let response = common::to_response(parts, bytes.into());
12253
12254                        if let common::Retry::After(d) =
12255                            dlg.http_failure(&response, error.as_ref().ok())
12256                        {
12257                            sleep(d).await;
12258                            continue;
12259                        }
12260
12261                        dlg.finished(false);
12262
12263                        return Err(match error {
12264                            Ok(value) => common::Error::BadRequest(value),
12265                            _ => common::Error::Failure(response),
12266                        });
12267                    }
12268                    let response = {
12269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12270                        let encoded = common::to_string(&bytes);
12271                        match serde_json::from_str(&encoded) {
12272                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12273                            Err(error) => {
12274                                dlg.response_json_decode_error(&encoded, &error);
12275                                return Err(common::Error::JsonDecodeError(
12276                                    encoded.to_string(),
12277                                    error,
12278                                ));
12279                            }
12280                        }
12281                    };
12282
12283                    dlg.finished(true);
12284                    return Ok(response);
12285                }
12286            }
12287        }
12288    }
12289
12290    ///
12291    /// Sets the *request* property to the given value.
12292    ///
12293    /// Even though the property as already been set when instantiating this call,
12294    /// we provide this method for API completeness.
12295    pub fn request(
12296        mut self,
12297        new_value: Tag,
12298    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
12299        self._request = new_value;
12300        self
12301    }
12302    /// The name of the parent resource where the tag will be created.
12303    ///
12304    /// Sets the *parent* path property to the given value.
12305    ///
12306    /// Even though the property as already been set when instantiating this call,
12307    /// we provide this method for API completeness.
12308    pub fn parent(
12309        mut self,
12310        new_value: &str,
12311    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
12312        self._parent = new_value.to_string();
12313        self
12314    }
12315    /// The tag id to use for this repository.
12316    ///
12317    /// Sets the *tag id* query property to the given value.
12318    pub fn tag_id(
12319        mut self,
12320        new_value: &str,
12321    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
12322        self._tag_id = Some(new_value.to_string());
12323        self
12324    }
12325    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12326    /// while executing the actual API request.
12327    ///
12328    /// ````text
12329    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12330    /// ````
12331    ///
12332    /// Sets the *delegate* property to the given value.
12333    pub fn delegate(
12334        mut self,
12335        new_value: &'a mut dyn common::Delegate,
12336    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
12337        self._delegate = Some(new_value);
12338        self
12339    }
12340
12341    /// Set any additional parameter of the query string used in the request.
12342    /// It should be used to set parameters which are not yet available through their own
12343    /// setters.
12344    ///
12345    /// Please note that this method must not be used to set any of the known parameters
12346    /// which have their own setter method. If done anyway, the request will fail.
12347    ///
12348    /// # Additional Parameters
12349    ///
12350    /// * *$.xgafv* (query-string) - V1 error format.
12351    /// * *access_token* (query-string) - OAuth access token.
12352    /// * *alt* (query-string) - Data format for response.
12353    /// * *callback* (query-string) - JSONP
12354    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12355    /// * *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.
12356    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12357    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12358    /// * *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.
12359    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12360    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12361    pub fn param<T>(
12362        mut self,
12363        name: T,
12364        value: T,
12365    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
12366    where
12367        T: AsRef<str>,
12368    {
12369        self._additional_params
12370            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12371        self
12372    }
12373
12374    /// Identifies the authorization scope for the method you are building.
12375    ///
12376    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12377    /// [`Scope::CloudPlatform`].
12378    ///
12379    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12380    /// tokens for more than one scope.
12381    ///
12382    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12383    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12384    /// sufficient, a read-write scope will do as well.
12385    pub fn add_scope<St>(
12386        mut self,
12387        scope: St,
12388    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
12389    where
12390        St: AsRef<str>,
12391    {
12392        self._scopes.insert(String::from(scope.as_ref()));
12393        self
12394    }
12395    /// Identifies the authorization scope(s) for the method you are building.
12396    ///
12397    /// See [`Self::add_scope()`] for details.
12398    pub fn add_scopes<I, St>(
12399        mut self,
12400        scopes: I,
12401    ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
12402    where
12403        I: IntoIterator<Item = St>,
12404        St: AsRef<str>,
12405    {
12406        self._scopes
12407            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12408        self
12409    }
12410
12411    /// Removes all scopes, and no default scope will be used either.
12412    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12413    /// for details).
12414    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
12415        self._scopes.clear();
12416        self
12417    }
12418}
12419
12420/// Deletes a tag.
12421///
12422/// A builder for the *locations.repositories.packages.tags.delete* method supported by a *project* resource.
12423/// It is not used directly, but through a [`ProjectMethods`] instance.
12424///
12425/// # Example
12426///
12427/// Instantiate a resource method builder
12428///
12429/// ```test_harness,no_run
12430/// # extern crate hyper;
12431/// # extern crate hyper_rustls;
12432/// # extern crate google_artifactregistry1 as artifactregistry1;
12433/// # async fn dox() {
12434/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12435///
12436/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12437/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12438/// #     .with_native_roots()
12439/// #     .unwrap()
12440/// #     .https_only()
12441/// #     .enable_http2()
12442/// #     .build();
12443///
12444/// # let executor = hyper_util::rt::TokioExecutor::new();
12445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12446/// #     secret,
12447/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12448/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12449/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12450/// #     ),
12451/// # ).build().await.unwrap();
12452///
12453/// # let client = hyper_util::client::legacy::Client::builder(
12454/// #     hyper_util::rt::TokioExecutor::new()
12455/// # )
12456/// # .build(
12457/// #     hyper_rustls::HttpsConnectorBuilder::new()
12458/// #         .with_native_roots()
12459/// #         .unwrap()
12460/// #         .https_or_http()
12461/// #         .enable_http2()
12462/// #         .build()
12463/// # );
12464/// # let mut hub = ArtifactRegistry::new(client, auth);
12465/// // You can configure optional parameters by calling the respective setters at will, and
12466/// // execute the final call using `doit()`.
12467/// // Values shown here are possibly random and not representative !
12468/// let result = hub.projects().locations_repositories_packages_tags_delete("name")
12469///              .doit().await;
12470/// # }
12471/// ```
12472pub struct ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
12473where
12474    C: 'a,
12475{
12476    hub: &'a ArtifactRegistry<C>,
12477    _name: String,
12478    _delegate: Option<&'a mut dyn common::Delegate>,
12479    _additional_params: HashMap<String, String>,
12480    _scopes: BTreeSet<String>,
12481}
12482
12483impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {}
12484
12485impl<'a, C> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
12486where
12487    C: common::Connector,
12488{
12489    /// Perform the operation you have build so far.
12490    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
12491        use std::borrow::Cow;
12492        use std::io::{Read, Seek};
12493
12494        use common::{url::Params, ToParts};
12495        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12496
12497        let mut dd = common::DefaultDelegate;
12498        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12499        dlg.begin(common::MethodInfo {
12500            id: "artifactregistry.projects.locations.repositories.packages.tags.delete",
12501            http_method: hyper::Method::DELETE,
12502        });
12503
12504        for &field in ["alt", "name"].iter() {
12505            if self._additional_params.contains_key(field) {
12506                dlg.finished(false);
12507                return Err(common::Error::FieldClash(field));
12508            }
12509        }
12510
12511        let mut params = Params::with_capacity(3 + self._additional_params.len());
12512        params.push("name", self._name);
12513
12514        params.extend(self._additional_params.iter());
12515
12516        params.push("alt", "json");
12517        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12518        if self._scopes.is_empty() {
12519            self._scopes
12520                .insert(Scope::CloudPlatform.as_ref().to_string());
12521        }
12522
12523        #[allow(clippy::single_element_loop)]
12524        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12525            url = params.uri_replacement(url, param_name, find_this, true);
12526        }
12527        {
12528            let to_remove = ["name"];
12529            params.remove_params(&to_remove);
12530        }
12531
12532        let url = params.parse_with_url(&url);
12533
12534        loop {
12535            let token = match self
12536                .hub
12537                .auth
12538                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12539                .await
12540            {
12541                Ok(token) => token,
12542                Err(e) => match dlg.token(e) {
12543                    Ok(token) => token,
12544                    Err(e) => {
12545                        dlg.finished(false);
12546                        return Err(common::Error::MissingToken(e));
12547                    }
12548                },
12549            };
12550            let mut req_result = {
12551                let client = &self.hub.client;
12552                dlg.pre_request();
12553                let mut req_builder = hyper::Request::builder()
12554                    .method(hyper::Method::DELETE)
12555                    .uri(url.as_str())
12556                    .header(USER_AGENT, self.hub._user_agent.clone());
12557
12558                if let Some(token) = token.as_ref() {
12559                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12560                }
12561
12562                let request = req_builder
12563                    .header(CONTENT_LENGTH, 0_u64)
12564                    .body(common::to_body::<String>(None));
12565
12566                client.request(request.unwrap()).await
12567            };
12568
12569            match req_result {
12570                Err(err) => {
12571                    if let common::Retry::After(d) = dlg.http_error(&err) {
12572                        sleep(d).await;
12573                        continue;
12574                    }
12575                    dlg.finished(false);
12576                    return Err(common::Error::HttpError(err));
12577                }
12578                Ok(res) => {
12579                    let (mut parts, body) = res.into_parts();
12580                    let mut body = common::Body::new(body);
12581                    if !parts.status.is_success() {
12582                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12583                        let error = serde_json::from_str(&common::to_string(&bytes));
12584                        let response = common::to_response(parts, bytes.into());
12585
12586                        if let common::Retry::After(d) =
12587                            dlg.http_failure(&response, error.as_ref().ok())
12588                        {
12589                            sleep(d).await;
12590                            continue;
12591                        }
12592
12593                        dlg.finished(false);
12594
12595                        return Err(match error {
12596                            Ok(value) => common::Error::BadRequest(value),
12597                            _ => common::Error::Failure(response),
12598                        });
12599                    }
12600                    let response = {
12601                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12602                        let encoded = common::to_string(&bytes);
12603                        match serde_json::from_str(&encoded) {
12604                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12605                            Err(error) => {
12606                                dlg.response_json_decode_error(&encoded, &error);
12607                                return Err(common::Error::JsonDecodeError(
12608                                    encoded.to_string(),
12609                                    error,
12610                                ));
12611                            }
12612                        }
12613                    };
12614
12615                    dlg.finished(true);
12616                    return Ok(response);
12617                }
12618            }
12619        }
12620    }
12621
12622    /// The name of the tag to delete.
12623    ///
12624    /// Sets the *name* path property to the given value.
12625    ///
12626    /// Even though the property as already been set when instantiating this call,
12627    /// we provide this method for API completeness.
12628    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
12629        self._name = new_value.to_string();
12630        self
12631    }
12632    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12633    /// while executing the actual API request.
12634    ///
12635    /// ````text
12636    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12637    /// ````
12638    ///
12639    /// Sets the *delegate* property to the given value.
12640    pub fn delegate(
12641        mut self,
12642        new_value: &'a mut dyn common::Delegate,
12643    ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
12644        self._delegate = Some(new_value);
12645        self
12646    }
12647
12648    /// Set any additional parameter of the query string used in the request.
12649    /// It should be used to set parameters which are not yet available through their own
12650    /// setters.
12651    ///
12652    /// Please note that this method must not be used to set any of the known parameters
12653    /// which have their own setter method. If done anyway, the request will fail.
12654    ///
12655    /// # Additional Parameters
12656    ///
12657    /// * *$.xgafv* (query-string) - V1 error format.
12658    /// * *access_token* (query-string) - OAuth access token.
12659    /// * *alt* (query-string) - Data format for response.
12660    /// * *callback* (query-string) - JSONP
12661    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12662    /// * *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.
12663    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12664    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12665    /// * *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.
12666    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12667    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12668    pub fn param<T>(
12669        mut self,
12670        name: T,
12671        value: T,
12672    ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
12673    where
12674        T: AsRef<str>,
12675    {
12676        self._additional_params
12677            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12678        self
12679    }
12680
12681    /// Identifies the authorization scope for the method you are building.
12682    ///
12683    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12684    /// [`Scope::CloudPlatform`].
12685    ///
12686    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12687    /// tokens for more than one scope.
12688    ///
12689    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12690    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12691    /// sufficient, a read-write scope will do as well.
12692    pub fn add_scope<St>(
12693        mut self,
12694        scope: St,
12695    ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
12696    where
12697        St: AsRef<str>,
12698    {
12699        self._scopes.insert(String::from(scope.as_ref()));
12700        self
12701    }
12702    /// Identifies the authorization scope(s) for the method you are building.
12703    ///
12704    /// See [`Self::add_scope()`] for details.
12705    pub fn add_scopes<I, St>(
12706        mut self,
12707        scopes: I,
12708    ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
12709    where
12710        I: IntoIterator<Item = St>,
12711        St: AsRef<str>,
12712    {
12713        self._scopes
12714            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12715        self
12716    }
12717
12718    /// Removes all scopes, and no default scope will be used either.
12719    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12720    /// for details).
12721    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
12722        self._scopes.clear();
12723        self
12724    }
12725}
12726
12727/// Gets a tag.
12728///
12729/// A builder for the *locations.repositories.packages.tags.get* method supported by a *project* resource.
12730/// It is not used directly, but through a [`ProjectMethods`] instance.
12731///
12732/// # Example
12733///
12734/// Instantiate a resource method builder
12735///
12736/// ```test_harness,no_run
12737/// # extern crate hyper;
12738/// # extern crate hyper_rustls;
12739/// # extern crate google_artifactregistry1 as artifactregistry1;
12740/// # async fn dox() {
12741/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12742///
12743/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12744/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12745/// #     .with_native_roots()
12746/// #     .unwrap()
12747/// #     .https_only()
12748/// #     .enable_http2()
12749/// #     .build();
12750///
12751/// # let executor = hyper_util::rt::TokioExecutor::new();
12752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12753/// #     secret,
12754/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12755/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12756/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12757/// #     ),
12758/// # ).build().await.unwrap();
12759///
12760/// # let client = hyper_util::client::legacy::Client::builder(
12761/// #     hyper_util::rt::TokioExecutor::new()
12762/// # )
12763/// # .build(
12764/// #     hyper_rustls::HttpsConnectorBuilder::new()
12765/// #         .with_native_roots()
12766/// #         .unwrap()
12767/// #         .https_or_http()
12768/// #         .enable_http2()
12769/// #         .build()
12770/// # );
12771/// # let mut hub = ArtifactRegistry::new(client, auth);
12772/// // You can configure optional parameters by calling the respective setters at will, and
12773/// // execute the final call using `doit()`.
12774/// // Values shown here are possibly random and not representative !
12775/// let result = hub.projects().locations_repositories_packages_tags_get("name")
12776///              .doit().await;
12777/// # }
12778/// ```
12779pub struct ProjectLocationRepositoryPackageTagGetCall<'a, C>
12780where
12781    C: 'a,
12782{
12783    hub: &'a ArtifactRegistry<C>,
12784    _name: String,
12785    _delegate: Option<&'a mut dyn common::Delegate>,
12786    _additional_params: HashMap<String, String>,
12787    _scopes: BTreeSet<String>,
12788}
12789
12790impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagGetCall<'a, C> {}
12791
12792impl<'a, C> ProjectLocationRepositoryPackageTagGetCall<'a, C>
12793where
12794    C: common::Connector,
12795{
12796    /// Perform the operation you have build so far.
12797    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
12798        use std::borrow::Cow;
12799        use std::io::{Read, Seek};
12800
12801        use common::{url::Params, ToParts};
12802        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12803
12804        let mut dd = common::DefaultDelegate;
12805        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12806        dlg.begin(common::MethodInfo {
12807            id: "artifactregistry.projects.locations.repositories.packages.tags.get",
12808            http_method: hyper::Method::GET,
12809        });
12810
12811        for &field in ["alt", "name"].iter() {
12812            if self._additional_params.contains_key(field) {
12813                dlg.finished(false);
12814                return Err(common::Error::FieldClash(field));
12815            }
12816        }
12817
12818        let mut params = Params::with_capacity(3 + self._additional_params.len());
12819        params.push("name", self._name);
12820
12821        params.extend(self._additional_params.iter());
12822
12823        params.push("alt", "json");
12824        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12825        if self._scopes.is_empty() {
12826            self._scopes
12827                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
12828        }
12829
12830        #[allow(clippy::single_element_loop)]
12831        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12832            url = params.uri_replacement(url, param_name, find_this, true);
12833        }
12834        {
12835            let to_remove = ["name"];
12836            params.remove_params(&to_remove);
12837        }
12838
12839        let url = params.parse_with_url(&url);
12840
12841        loop {
12842            let token = match self
12843                .hub
12844                .auth
12845                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12846                .await
12847            {
12848                Ok(token) => token,
12849                Err(e) => match dlg.token(e) {
12850                    Ok(token) => token,
12851                    Err(e) => {
12852                        dlg.finished(false);
12853                        return Err(common::Error::MissingToken(e));
12854                    }
12855                },
12856            };
12857            let mut req_result = {
12858                let client = &self.hub.client;
12859                dlg.pre_request();
12860                let mut req_builder = hyper::Request::builder()
12861                    .method(hyper::Method::GET)
12862                    .uri(url.as_str())
12863                    .header(USER_AGENT, self.hub._user_agent.clone());
12864
12865                if let Some(token) = token.as_ref() {
12866                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12867                }
12868
12869                let request = req_builder
12870                    .header(CONTENT_LENGTH, 0_u64)
12871                    .body(common::to_body::<String>(None));
12872
12873                client.request(request.unwrap()).await
12874            };
12875
12876            match req_result {
12877                Err(err) => {
12878                    if let common::Retry::After(d) = dlg.http_error(&err) {
12879                        sleep(d).await;
12880                        continue;
12881                    }
12882                    dlg.finished(false);
12883                    return Err(common::Error::HttpError(err));
12884                }
12885                Ok(res) => {
12886                    let (mut parts, body) = res.into_parts();
12887                    let mut body = common::Body::new(body);
12888                    if !parts.status.is_success() {
12889                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12890                        let error = serde_json::from_str(&common::to_string(&bytes));
12891                        let response = common::to_response(parts, bytes.into());
12892
12893                        if let common::Retry::After(d) =
12894                            dlg.http_failure(&response, error.as_ref().ok())
12895                        {
12896                            sleep(d).await;
12897                            continue;
12898                        }
12899
12900                        dlg.finished(false);
12901
12902                        return Err(match error {
12903                            Ok(value) => common::Error::BadRequest(value),
12904                            _ => common::Error::Failure(response),
12905                        });
12906                    }
12907                    let response = {
12908                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12909                        let encoded = common::to_string(&bytes);
12910                        match serde_json::from_str(&encoded) {
12911                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12912                            Err(error) => {
12913                                dlg.response_json_decode_error(&encoded, &error);
12914                                return Err(common::Error::JsonDecodeError(
12915                                    encoded.to_string(),
12916                                    error,
12917                                ));
12918                            }
12919                        }
12920                    };
12921
12922                    dlg.finished(true);
12923                    return Ok(response);
12924                }
12925            }
12926        }
12927    }
12928
12929    /// The name of the tag to retrieve.
12930    ///
12931    /// Sets the *name* path property to the given value.
12932    ///
12933    /// Even though the property as already been set when instantiating this call,
12934    /// we provide this method for API completeness.
12935    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
12936        self._name = new_value.to_string();
12937        self
12938    }
12939    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12940    /// while executing the actual API request.
12941    ///
12942    /// ````text
12943    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12944    /// ````
12945    ///
12946    /// Sets the *delegate* property to the given value.
12947    pub fn delegate(
12948        mut self,
12949        new_value: &'a mut dyn common::Delegate,
12950    ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
12951        self._delegate = Some(new_value);
12952        self
12953    }
12954
12955    /// Set any additional parameter of the query string used in the request.
12956    /// It should be used to set parameters which are not yet available through their own
12957    /// setters.
12958    ///
12959    /// Please note that this method must not be used to set any of the known parameters
12960    /// which have their own setter method. If done anyway, the request will fail.
12961    ///
12962    /// # Additional Parameters
12963    ///
12964    /// * *$.xgafv* (query-string) - V1 error format.
12965    /// * *access_token* (query-string) - OAuth access token.
12966    /// * *alt* (query-string) - Data format for response.
12967    /// * *callback* (query-string) - JSONP
12968    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12969    /// * *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.
12970    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12971    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12972    /// * *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.
12973    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12974    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12975    pub fn param<T>(
12976        mut self,
12977        name: T,
12978        value: T,
12979    ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C>
12980    where
12981        T: AsRef<str>,
12982    {
12983        self._additional_params
12984            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12985        self
12986    }
12987
12988    /// Identifies the authorization scope for the method you are building.
12989    ///
12990    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12991    /// [`Scope::CloudPlatformReadOnly`].
12992    ///
12993    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12994    /// tokens for more than one scope.
12995    ///
12996    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12997    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12998    /// sufficient, a read-write scope will do as well.
12999    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageTagGetCall<'a, C>
13000    where
13001        St: AsRef<str>,
13002    {
13003        self._scopes.insert(String::from(scope.as_ref()));
13004        self
13005    }
13006    /// Identifies the authorization scope(s) for the method you are building.
13007    ///
13008    /// See [`Self::add_scope()`] for details.
13009    pub fn add_scopes<I, St>(
13010        mut self,
13011        scopes: I,
13012    ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C>
13013    where
13014        I: IntoIterator<Item = St>,
13015        St: AsRef<str>,
13016    {
13017        self._scopes
13018            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13019        self
13020    }
13021
13022    /// Removes all scopes, and no default scope will be used either.
13023    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13024    /// for details).
13025    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
13026        self._scopes.clear();
13027        self
13028    }
13029}
13030
13031/// Lists tags.
13032///
13033/// A builder for the *locations.repositories.packages.tags.list* method supported by a *project* resource.
13034/// It is not used directly, but through a [`ProjectMethods`] instance.
13035///
13036/// # Example
13037///
13038/// Instantiate a resource method builder
13039///
13040/// ```test_harness,no_run
13041/// # extern crate hyper;
13042/// # extern crate hyper_rustls;
13043/// # extern crate google_artifactregistry1 as artifactregistry1;
13044/// # async fn dox() {
13045/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13046///
13047/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13048/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13049/// #     .with_native_roots()
13050/// #     .unwrap()
13051/// #     .https_only()
13052/// #     .enable_http2()
13053/// #     .build();
13054///
13055/// # let executor = hyper_util::rt::TokioExecutor::new();
13056/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13057/// #     secret,
13058/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13059/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13060/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13061/// #     ),
13062/// # ).build().await.unwrap();
13063///
13064/// # let client = hyper_util::client::legacy::Client::builder(
13065/// #     hyper_util::rt::TokioExecutor::new()
13066/// # )
13067/// # .build(
13068/// #     hyper_rustls::HttpsConnectorBuilder::new()
13069/// #         .with_native_roots()
13070/// #         .unwrap()
13071/// #         .https_or_http()
13072/// #         .enable_http2()
13073/// #         .build()
13074/// # );
13075/// # let mut hub = ArtifactRegistry::new(client, auth);
13076/// // You can configure optional parameters by calling the respective setters at will, and
13077/// // execute the final call using `doit()`.
13078/// // Values shown here are possibly random and not representative !
13079/// let result = hub.projects().locations_repositories_packages_tags_list("parent")
13080///              .page_token("sed")
13081///              .page_size(-20)
13082///              .filter("dolore")
13083///              .doit().await;
13084/// # }
13085/// ```
13086pub struct ProjectLocationRepositoryPackageTagListCall<'a, C>
13087where
13088    C: 'a,
13089{
13090    hub: &'a ArtifactRegistry<C>,
13091    _parent: String,
13092    _page_token: Option<String>,
13093    _page_size: Option<i32>,
13094    _filter: Option<String>,
13095    _delegate: Option<&'a mut dyn common::Delegate>,
13096    _additional_params: HashMap<String, String>,
13097    _scopes: BTreeSet<String>,
13098}
13099
13100impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagListCall<'a, C> {}
13101
13102impl<'a, C> ProjectLocationRepositoryPackageTagListCall<'a, C>
13103where
13104    C: common::Connector,
13105{
13106    /// Perform the operation you have build so far.
13107    pub async fn doit(mut self) -> common::Result<(common::Response, ListTagsResponse)> {
13108        use std::borrow::Cow;
13109        use std::io::{Read, Seek};
13110
13111        use common::{url::Params, ToParts};
13112        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13113
13114        let mut dd = common::DefaultDelegate;
13115        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13116        dlg.begin(common::MethodInfo {
13117            id: "artifactregistry.projects.locations.repositories.packages.tags.list",
13118            http_method: hyper::Method::GET,
13119        });
13120
13121        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
13122            if self._additional_params.contains_key(field) {
13123                dlg.finished(false);
13124                return Err(common::Error::FieldClash(field));
13125            }
13126        }
13127
13128        let mut params = Params::with_capacity(6 + self._additional_params.len());
13129        params.push("parent", self._parent);
13130        if let Some(value) = self._page_token.as_ref() {
13131            params.push("pageToken", value);
13132        }
13133        if let Some(value) = self._page_size.as_ref() {
13134            params.push("pageSize", value.to_string());
13135        }
13136        if let Some(value) = self._filter.as_ref() {
13137            params.push("filter", value);
13138        }
13139
13140        params.extend(self._additional_params.iter());
13141
13142        params.push("alt", "json");
13143        let mut url = self.hub._base_url.clone() + "v1/{+parent}/tags";
13144        if self._scopes.is_empty() {
13145            self._scopes
13146                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
13147        }
13148
13149        #[allow(clippy::single_element_loop)]
13150        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13151            url = params.uri_replacement(url, param_name, find_this, true);
13152        }
13153        {
13154            let to_remove = ["parent"];
13155            params.remove_params(&to_remove);
13156        }
13157
13158        let url = params.parse_with_url(&url);
13159
13160        loop {
13161            let token = match self
13162                .hub
13163                .auth
13164                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13165                .await
13166            {
13167                Ok(token) => token,
13168                Err(e) => match dlg.token(e) {
13169                    Ok(token) => token,
13170                    Err(e) => {
13171                        dlg.finished(false);
13172                        return Err(common::Error::MissingToken(e));
13173                    }
13174                },
13175            };
13176            let mut req_result = {
13177                let client = &self.hub.client;
13178                dlg.pre_request();
13179                let mut req_builder = hyper::Request::builder()
13180                    .method(hyper::Method::GET)
13181                    .uri(url.as_str())
13182                    .header(USER_AGENT, self.hub._user_agent.clone());
13183
13184                if let Some(token) = token.as_ref() {
13185                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13186                }
13187
13188                let request = req_builder
13189                    .header(CONTENT_LENGTH, 0_u64)
13190                    .body(common::to_body::<String>(None));
13191
13192                client.request(request.unwrap()).await
13193            };
13194
13195            match req_result {
13196                Err(err) => {
13197                    if let common::Retry::After(d) = dlg.http_error(&err) {
13198                        sleep(d).await;
13199                        continue;
13200                    }
13201                    dlg.finished(false);
13202                    return Err(common::Error::HttpError(err));
13203                }
13204                Ok(res) => {
13205                    let (mut parts, body) = res.into_parts();
13206                    let mut body = common::Body::new(body);
13207                    if !parts.status.is_success() {
13208                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13209                        let error = serde_json::from_str(&common::to_string(&bytes));
13210                        let response = common::to_response(parts, bytes.into());
13211
13212                        if let common::Retry::After(d) =
13213                            dlg.http_failure(&response, error.as_ref().ok())
13214                        {
13215                            sleep(d).await;
13216                            continue;
13217                        }
13218
13219                        dlg.finished(false);
13220
13221                        return Err(match error {
13222                            Ok(value) => common::Error::BadRequest(value),
13223                            _ => common::Error::Failure(response),
13224                        });
13225                    }
13226                    let response = {
13227                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13228                        let encoded = common::to_string(&bytes);
13229                        match serde_json::from_str(&encoded) {
13230                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13231                            Err(error) => {
13232                                dlg.response_json_decode_error(&encoded, &error);
13233                                return Err(common::Error::JsonDecodeError(
13234                                    encoded.to_string(),
13235                                    error,
13236                                ));
13237                            }
13238                        }
13239                    };
13240
13241                    dlg.finished(true);
13242                    return Ok(response);
13243                }
13244            }
13245        }
13246    }
13247
13248    /// The name of the parent package whose tags will be listed. For example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1`.
13249    ///
13250    /// Sets the *parent* path property to the given value.
13251    ///
13252    /// Even though the property as already been set when instantiating this call,
13253    /// we provide this method for API completeness.
13254    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
13255        self._parent = new_value.to_string();
13256        self
13257    }
13258    /// The next_page_token value returned from a previous list request, if any.
13259    ///
13260    /// Sets the *page token* query property to the given value.
13261    pub fn page_token(
13262        mut self,
13263        new_value: &str,
13264    ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
13265        self._page_token = Some(new_value.to_string());
13266        self
13267    }
13268    /// The maximum number of tags to return. Maximum page size is 1,000.
13269    ///
13270    /// Sets the *page size* query property to the given value.
13271    pub fn page_size(
13272        mut self,
13273        new_value: i32,
13274    ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
13275        self._page_size = Some(new_value);
13276        self
13277    }
13278    /// An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: * `name` * `version` Examples of using a filter: To filter the results of your request to tags with the name `my-tag` in package `my-package` in repository `my-repo` in project "`y-project` in the us-central region, append the following filter expression to your request: * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/tags/my-tag"` You can also use wildcards to match any number of characters before or after the value: * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/tags/my*"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/tags/*tag"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/tags/*tag*"` To filter the results of your request to tags applied to the version `1.0` in package `my-package`, append the following filter expression to your request: * `version="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/versions/1.0"`
13279    ///
13280    /// Sets the *filter* query property to the given value.
13281    pub fn filter(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
13282        self._filter = Some(new_value.to_string());
13283        self
13284    }
13285    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13286    /// while executing the actual API request.
13287    ///
13288    /// ````text
13289    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13290    /// ````
13291    ///
13292    /// Sets the *delegate* property to the given value.
13293    pub fn delegate(
13294        mut self,
13295        new_value: &'a mut dyn common::Delegate,
13296    ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
13297        self._delegate = Some(new_value);
13298        self
13299    }
13300
13301    /// Set any additional parameter of the query string used in the request.
13302    /// It should be used to set parameters which are not yet available through their own
13303    /// setters.
13304    ///
13305    /// Please note that this method must not be used to set any of the known parameters
13306    /// which have their own setter method. If done anyway, the request will fail.
13307    ///
13308    /// # Additional Parameters
13309    ///
13310    /// * *$.xgafv* (query-string) - V1 error format.
13311    /// * *access_token* (query-string) - OAuth access token.
13312    /// * *alt* (query-string) - Data format for response.
13313    /// * *callback* (query-string) - JSONP
13314    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13315    /// * *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.
13316    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13317    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13318    /// * *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.
13319    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13320    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13321    pub fn param<T>(
13322        mut self,
13323        name: T,
13324        value: T,
13325    ) -> ProjectLocationRepositoryPackageTagListCall<'a, C>
13326    where
13327        T: AsRef<str>,
13328    {
13329        self._additional_params
13330            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13331        self
13332    }
13333
13334    /// Identifies the authorization scope for the method you are building.
13335    ///
13336    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13337    /// [`Scope::CloudPlatformReadOnly`].
13338    ///
13339    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13340    /// tokens for more than one scope.
13341    ///
13342    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13343    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13344    /// sufficient, a read-write scope will do as well.
13345    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageTagListCall<'a, C>
13346    where
13347        St: AsRef<str>,
13348    {
13349        self._scopes.insert(String::from(scope.as_ref()));
13350        self
13351    }
13352    /// Identifies the authorization scope(s) for the method you are building.
13353    ///
13354    /// See [`Self::add_scope()`] for details.
13355    pub fn add_scopes<I, St>(
13356        mut self,
13357        scopes: I,
13358    ) -> ProjectLocationRepositoryPackageTagListCall<'a, C>
13359    where
13360        I: IntoIterator<Item = St>,
13361        St: AsRef<str>,
13362    {
13363        self._scopes
13364            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13365        self
13366    }
13367
13368    /// Removes all scopes, and no default scope will be used either.
13369    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13370    /// for details).
13371    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
13372        self._scopes.clear();
13373        self
13374    }
13375}
13376
13377/// Updates a tag.
13378///
13379/// A builder for the *locations.repositories.packages.tags.patch* method supported by a *project* resource.
13380/// It is not used directly, but through a [`ProjectMethods`] instance.
13381///
13382/// # Example
13383///
13384/// Instantiate a resource method builder
13385///
13386/// ```test_harness,no_run
13387/// # extern crate hyper;
13388/// # extern crate hyper_rustls;
13389/// # extern crate google_artifactregistry1 as artifactregistry1;
13390/// use artifactregistry1::api::Tag;
13391/// # async fn dox() {
13392/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13393///
13394/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13395/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13396/// #     .with_native_roots()
13397/// #     .unwrap()
13398/// #     .https_only()
13399/// #     .enable_http2()
13400/// #     .build();
13401///
13402/// # let executor = hyper_util::rt::TokioExecutor::new();
13403/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13404/// #     secret,
13405/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13406/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13407/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13408/// #     ),
13409/// # ).build().await.unwrap();
13410///
13411/// # let client = hyper_util::client::legacy::Client::builder(
13412/// #     hyper_util::rt::TokioExecutor::new()
13413/// # )
13414/// # .build(
13415/// #     hyper_rustls::HttpsConnectorBuilder::new()
13416/// #         .with_native_roots()
13417/// #         .unwrap()
13418/// #         .https_or_http()
13419/// #         .enable_http2()
13420/// #         .build()
13421/// # );
13422/// # let mut hub = ArtifactRegistry::new(client, auth);
13423/// // As the method needs a request, you would usually fill it with the desired information
13424/// // into the respective structure. Some of the parts shown here might not be applicable !
13425/// // Values shown here are possibly random and not representative !
13426/// let mut req = Tag::default();
13427///
13428/// // You can configure optional parameters by calling the respective setters at will, and
13429/// // execute the final call using `doit()`.
13430/// // Values shown here are possibly random and not representative !
13431/// let result = hub.projects().locations_repositories_packages_tags_patch(req, "name")
13432///              .update_mask(FieldMask::new::<&str>(&[]))
13433///              .doit().await;
13434/// # }
13435/// ```
13436pub struct ProjectLocationRepositoryPackageTagPatchCall<'a, C>
13437where
13438    C: 'a,
13439{
13440    hub: &'a ArtifactRegistry<C>,
13441    _request: Tag,
13442    _name: String,
13443    _update_mask: Option<common::FieldMask>,
13444    _delegate: Option<&'a mut dyn common::Delegate>,
13445    _additional_params: HashMap<String, String>,
13446    _scopes: BTreeSet<String>,
13447}
13448
13449impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagPatchCall<'a, C> {}
13450
13451impl<'a, C> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
13452where
13453    C: common::Connector,
13454{
13455    /// Perform the operation you have build so far.
13456    pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
13457        use std::borrow::Cow;
13458        use std::io::{Read, Seek};
13459
13460        use common::{url::Params, ToParts};
13461        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13462
13463        let mut dd = common::DefaultDelegate;
13464        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13465        dlg.begin(common::MethodInfo {
13466            id: "artifactregistry.projects.locations.repositories.packages.tags.patch",
13467            http_method: hyper::Method::PATCH,
13468        });
13469
13470        for &field in ["alt", "name", "updateMask"].iter() {
13471            if self._additional_params.contains_key(field) {
13472                dlg.finished(false);
13473                return Err(common::Error::FieldClash(field));
13474            }
13475        }
13476
13477        let mut params = Params::with_capacity(5 + self._additional_params.len());
13478        params.push("name", self._name);
13479        if let Some(value) = self._update_mask.as_ref() {
13480            params.push("updateMask", value.to_string());
13481        }
13482
13483        params.extend(self._additional_params.iter());
13484
13485        params.push("alt", "json");
13486        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13487        if self._scopes.is_empty() {
13488            self._scopes
13489                .insert(Scope::CloudPlatform.as_ref().to_string());
13490        }
13491
13492        #[allow(clippy::single_element_loop)]
13493        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13494            url = params.uri_replacement(url, param_name, find_this, true);
13495        }
13496        {
13497            let to_remove = ["name"];
13498            params.remove_params(&to_remove);
13499        }
13500
13501        let url = params.parse_with_url(&url);
13502
13503        let mut json_mime_type = mime::APPLICATION_JSON;
13504        let mut request_value_reader = {
13505            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13506            common::remove_json_null_values(&mut value);
13507            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13508            serde_json::to_writer(&mut dst, &value).unwrap();
13509            dst
13510        };
13511        let request_size = request_value_reader
13512            .seek(std::io::SeekFrom::End(0))
13513            .unwrap();
13514        request_value_reader
13515            .seek(std::io::SeekFrom::Start(0))
13516            .unwrap();
13517
13518        loop {
13519            let token = match self
13520                .hub
13521                .auth
13522                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13523                .await
13524            {
13525                Ok(token) => token,
13526                Err(e) => match dlg.token(e) {
13527                    Ok(token) => token,
13528                    Err(e) => {
13529                        dlg.finished(false);
13530                        return Err(common::Error::MissingToken(e));
13531                    }
13532                },
13533            };
13534            request_value_reader
13535                .seek(std::io::SeekFrom::Start(0))
13536                .unwrap();
13537            let mut req_result = {
13538                let client = &self.hub.client;
13539                dlg.pre_request();
13540                let mut req_builder = hyper::Request::builder()
13541                    .method(hyper::Method::PATCH)
13542                    .uri(url.as_str())
13543                    .header(USER_AGENT, self.hub._user_agent.clone());
13544
13545                if let Some(token) = token.as_ref() {
13546                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13547                }
13548
13549                let request = req_builder
13550                    .header(CONTENT_TYPE, json_mime_type.to_string())
13551                    .header(CONTENT_LENGTH, request_size as u64)
13552                    .body(common::to_body(
13553                        request_value_reader.get_ref().clone().into(),
13554                    ));
13555
13556                client.request(request.unwrap()).await
13557            };
13558
13559            match req_result {
13560                Err(err) => {
13561                    if let common::Retry::After(d) = dlg.http_error(&err) {
13562                        sleep(d).await;
13563                        continue;
13564                    }
13565                    dlg.finished(false);
13566                    return Err(common::Error::HttpError(err));
13567                }
13568                Ok(res) => {
13569                    let (mut parts, body) = res.into_parts();
13570                    let mut body = common::Body::new(body);
13571                    if !parts.status.is_success() {
13572                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13573                        let error = serde_json::from_str(&common::to_string(&bytes));
13574                        let response = common::to_response(parts, bytes.into());
13575
13576                        if let common::Retry::After(d) =
13577                            dlg.http_failure(&response, error.as_ref().ok())
13578                        {
13579                            sleep(d).await;
13580                            continue;
13581                        }
13582
13583                        dlg.finished(false);
13584
13585                        return Err(match error {
13586                            Ok(value) => common::Error::BadRequest(value),
13587                            _ => common::Error::Failure(response),
13588                        });
13589                    }
13590                    let response = {
13591                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13592                        let encoded = common::to_string(&bytes);
13593                        match serde_json::from_str(&encoded) {
13594                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13595                            Err(error) => {
13596                                dlg.response_json_decode_error(&encoded, &error);
13597                                return Err(common::Error::JsonDecodeError(
13598                                    encoded.to_string(),
13599                                    error,
13600                                ));
13601                            }
13602                        }
13603                    };
13604
13605                    dlg.finished(true);
13606                    return Ok(response);
13607                }
13608            }
13609        }
13610    }
13611
13612    ///
13613    /// Sets the *request* property to the given value.
13614    ///
13615    /// Even though the property as already been set when instantiating this call,
13616    /// we provide this method for API completeness.
13617    pub fn request(
13618        mut self,
13619        new_value: Tag,
13620    ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
13621        self._request = new_value;
13622        self
13623    }
13624    /// The name of the tag, for example: "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". If the package part contains slashes, the slashes are escaped. The tag part can only have characters in [a-zA-Z0-9\-._~:@], anything else must be URL encoded.
13625    ///
13626    /// Sets the *name* path property to the given value.
13627    ///
13628    /// Even though the property as already been set when instantiating this call,
13629    /// we provide this method for API completeness.
13630    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
13631        self._name = new_value.to_string();
13632        self
13633    }
13634    /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
13635    ///
13636    /// Sets the *update mask* query property to the given value.
13637    pub fn update_mask(
13638        mut self,
13639        new_value: common::FieldMask,
13640    ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
13641        self._update_mask = Some(new_value);
13642        self
13643    }
13644    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13645    /// while executing the actual API request.
13646    ///
13647    /// ````text
13648    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13649    /// ````
13650    ///
13651    /// Sets the *delegate* property to the given value.
13652    pub fn delegate(
13653        mut self,
13654        new_value: &'a mut dyn common::Delegate,
13655    ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
13656        self._delegate = Some(new_value);
13657        self
13658    }
13659
13660    /// Set any additional parameter of the query string used in the request.
13661    /// It should be used to set parameters which are not yet available through their own
13662    /// setters.
13663    ///
13664    /// Please note that this method must not be used to set any of the known parameters
13665    /// which have their own setter method. If done anyway, the request will fail.
13666    ///
13667    /// # Additional Parameters
13668    ///
13669    /// * *$.xgafv* (query-string) - V1 error format.
13670    /// * *access_token* (query-string) - OAuth access token.
13671    /// * *alt* (query-string) - Data format for response.
13672    /// * *callback* (query-string) - JSONP
13673    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13674    /// * *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.
13675    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13676    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13677    /// * *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.
13678    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13679    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13680    pub fn param<T>(
13681        mut self,
13682        name: T,
13683        value: T,
13684    ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
13685    where
13686        T: AsRef<str>,
13687    {
13688        self._additional_params
13689            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13690        self
13691    }
13692
13693    /// Identifies the authorization scope for the method you are building.
13694    ///
13695    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13696    /// [`Scope::CloudPlatform`].
13697    ///
13698    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13699    /// tokens for more than one scope.
13700    ///
13701    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13702    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13703    /// sufficient, a read-write scope will do as well.
13704    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
13705    where
13706        St: AsRef<str>,
13707    {
13708        self._scopes.insert(String::from(scope.as_ref()));
13709        self
13710    }
13711    /// Identifies the authorization scope(s) for the method you are building.
13712    ///
13713    /// See [`Self::add_scope()`] for details.
13714    pub fn add_scopes<I, St>(
13715        mut self,
13716        scopes: I,
13717    ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
13718    where
13719        I: IntoIterator<Item = St>,
13720        St: AsRef<str>,
13721    {
13722        self._scopes
13723            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13724        self
13725    }
13726
13727    /// Removes all scopes, and no default scope will be used either.
13728    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13729    /// for details).
13730    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
13731        self._scopes.clear();
13732        self
13733    }
13734}
13735
13736/// Deletes multiple versions across a repository. The returned operation will complete once the versions have been deleted.
13737///
13738/// A builder for the *locations.repositories.packages.versions.batchDelete* method supported by a *project* resource.
13739/// It is not used directly, but through a [`ProjectMethods`] instance.
13740///
13741/// # Example
13742///
13743/// Instantiate a resource method builder
13744///
13745/// ```test_harness,no_run
13746/// # extern crate hyper;
13747/// # extern crate hyper_rustls;
13748/// # extern crate google_artifactregistry1 as artifactregistry1;
13749/// use artifactregistry1::api::BatchDeleteVersionsRequest;
13750/// # async fn dox() {
13751/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13752///
13753/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13754/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13755/// #     .with_native_roots()
13756/// #     .unwrap()
13757/// #     .https_only()
13758/// #     .enable_http2()
13759/// #     .build();
13760///
13761/// # let executor = hyper_util::rt::TokioExecutor::new();
13762/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13763/// #     secret,
13764/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13765/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13766/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13767/// #     ),
13768/// # ).build().await.unwrap();
13769///
13770/// # let client = hyper_util::client::legacy::Client::builder(
13771/// #     hyper_util::rt::TokioExecutor::new()
13772/// # )
13773/// # .build(
13774/// #     hyper_rustls::HttpsConnectorBuilder::new()
13775/// #         .with_native_roots()
13776/// #         .unwrap()
13777/// #         .https_or_http()
13778/// #         .enable_http2()
13779/// #         .build()
13780/// # );
13781/// # let mut hub = ArtifactRegistry::new(client, auth);
13782/// // As the method needs a request, you would usually fill it with the desired information
13783/// // into the respective structure. Some of the parts shown here might not be applicable !
13784/// // Values shown here are possibly random and not representative !
13785/// let mut req = BatchDeleteVersionsRequest::default();
13786///
13787/// // You can configure optional parameters by calling the respective setters at will, and
13788/// // execute the final call using `doit()`.
13789/// // Values shown here are possibly random and not representative !
13790/// let result = hub.projects().locations_repositories_packages_versions_batch_delete(req, "parent")
13791///              .doit().await;
13792/// # }
13793/// ```
13794pub struct ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C>
13795where
13796    C: 'a,
13797{
13798    hub: &'a ArtifactRegistry<C>,
13799    _request: BatchDeleteVersionsRequest,
13800    _parent: String,
13801    _delegate: Option<&'a mut dyn common::Delegate>,
13802    _additional_params: HashMap<String, String>,
13803    _scopes: BTreeSet<String>,
13804}
13805
13806impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C> {}
13807
13808impl<'a, C> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C>
13809where
13810    C: common::Connector,
13811{
13812    /// Perform the operation you have build so far.
13813    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13814        use std::borrow::Cow;
13815        use std::io::{Read, Seek};
13816
13817        use common::{url::Params, ToParts};
13818        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13819
13820        let mut dd = common::DefaultDelegate;
13821        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13822        dlg.begin(common::MethodInfo {
13823            id: "artifactregistry.projects.locations.repositories.packages.versions.batchDelete",
13824            http_method: hyper::Method::POST,
13825        });
13826
13827        for &field in ["alt", "parent"].iter() {
13828            if self._additional_params.contains_key(field) {
13829                dlg.finished(false);
13830                return Err(common::Error::FieldClash(field));
13831            }
13832        }
13833
13834        let mut params = Params::with_capacity(4 + self._additional_params.len());
13835        params.push("parent", self._parent);
13836
13837        params.extend(self._additional_params.iter());
13838
13839        params.push("alt", "json");
13840        let mut url = self.hub._base_url.clone() + "v1/{+parent}/versions:batchDelete";
13841        if self._scopes.is_empty() {
13842            self._scopes
13843                .insert(Scope::CloudPlatform.as_ref().to_string());
13844        }
13845
13846        #[allow(clippy::single_element_loop)]
13847        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13848            url = params.uri_replacement(url, param_name, find_this, true);
13849        }
13850        {
13851            let to_remove = ["parent"];
13852            params.remove_params(&to_remove);
13853        }
13854
13855        let url = params.parse_with_url(&url);
13856
13857        let mut json_mime_type = mime::APPLICATION_JSON;
13858        let mut request_value_reader = {
13859            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13860            common::remove_json_null_values(&mut value);
13861            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13862            serde_json::to_writer(&mut dst, &value).unwrap();
13863            dst
13864        };
13865        let request_size = request_value_reader
13866            .seek(std::io::SeekFrom::End(0))
13867            .unwrap();
13868        request_value_reader
13869            .seek(std::io::SeekFrom::Start(0))
13870            .unwrap();
13871
13872        loop {
13873            let token = match self
13874                .hub
13875                .auth
13876                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13877                .await
13878            {
13879                Ok(token) => token,
13880                Err(e) => match dlg.token(e) {
13881                    Ok(token) => token,
13882                    Err(e) => {
13883                        dlg.finished(false);
13884                        return Err(common::Error::MissingToken(e));
13885                    }
13886                },
13887            };
13888            request_value_reader
13889                .seek(std::io::SeekFrom::Start(0))
13890                .unwrap();
13891            let mut req_result = {
13892                let client = &self.hub.client;
13893                dlg.pre_request();
13894                let mut req_builder = hyper::Request::builder()
13895                    .method(hyper::Method::POST)
13896                    .uri(url.as_str())
13897                    .header(USER_AGENT, self.hub._user_agent.clone());
13898
13899                if let Some(token) = token.as_ref() {
13900                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13901                }
13902
13903                let request = req_builder
13904                    .header(CONTENT_TYPE, json_mime_type.to_string())
13905                    .header(CONTENT_LENGTH, request_size as u64)
13906                    .body(common::to_body(
13907                        request_value_reader.get_ref().clone().into(),
13908                    ));
13909
13910                client.request(request.unwrap()).await
13911            };
13912
13913            match req_result {
13914                Err(err) => {
13915                    if let common::Retry::After(d) = dlg.http_error(&err) {
13916                        sleep(d).await;
13917                        continue;
13918                    }
13919                    dlg.finished(false);
13920                    return Err(common::Error::HttpError(err));
13921                }
13922                Ok(res) => {
13923                    let (mut parts, body) = res.into_parts();
13924                    let mut body = common::Body::new(body);
13925                    if !parts.status.is_success() {
13926                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13927                        let error = serde_json::from_str(&common::to_string(&bytes));
13928                        let response = common::to_response(parts, bytes.into());
13929
13930                        if let common::Retry::After(d) =
13931                            dlg.http_failure(&response, error.as_ref().ok())
13932                        {
13933                            sleep(d).await;
13934                            continue;
13935                        }
13936
13937                        dlg.finished(false);
13938
13939                        return Err(match error {
13940                            Ok(value) => common::Error::BadRequest(value),
13941                            _ => common::Error::Failure(response),
13942                        });
13943                    }
13944                    let response = {
13945                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13946                        let encoded = common::to_string(&bytes);
13947                        match serde_json::from_str(&encoded) {
13948                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13949                            Err(error) => {
13950                                dlg.response_json_decode_error(&encoded, &error);
13951                                return Err(common::Error::JsonDecodeError(
13952                                    encoded.to_string(),
13953                                    error,
13954                                ));
13955                            }
13956                        }
13957                    };
13958
13959                    dlg.finished(true);
13960                    return Ok(response);
13961                }
13962            }
13963        }
13964    }
13965
13966    ///
13967    /// Sets the *request* property to the given value.
13968    ///
13969    /// Even though the property as already been set when instantiating this call,
13970    /// we provide this method for API completeness.
13971    pub fn request(
13972        mut self,
13973        new_value: BatchDeleteVersionsRequest,
13974    ) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C> {
13975        self._request = new_value;
13976        self
13977    }
13978    /// The name of the repository holding all requested versions.
13979    ///
13980    /// Sets the *parent* path property to the given value.
13981    ///
13982    /// Even though the property as already been set when instantiating this call,
13983    /// we provide this method for API completeness.
13984    pub fn parent(
13985        mut self,
13986        new_value: &str,
13987    ) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C> {
13988        self._parent = new_value.to_string();
13989        self
13990    }
13991    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13992    /// while executing the actual API request.
13993    ///
13994    /// ````text
13995    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13996    /// ````
13997    ///
13998    /// Sets the *delegate* property to the given value.
13999    pub fn delegate(
14000        mut self,
14001        new_value: &'a mut dyn common::Delegate,
14002    ) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C> {
14003        self._delegate = Some(new_value);
14004        self
14005    }
14006
14007    /// Set any additional parameter of the query string used in the request.
14008    /// It should be used to set parameters which are not yet available through their own
14009    /// setters.
14010    ///
14011    /// Please note that this method must not be used to set any of the known parameters
14012    /// which have their own setter method. If done anyway, the request will fail.
14013    ///
14014    /// # Additional Parameters
14015    ///
14016    /// * *$.xgafv* (query-string) - V1 error format.
14017    /// * *access_token* (query-string) - OAuth access token.
14018    /// * *alt* (query-string) - Data format for response.
14019    /// * *callback* (query-string) - JSONP
14020    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14021    /// * *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.
14022    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14023    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14024    /// * *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.
14025    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14026    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14027    pub fn param<T>(
14028        mut self,
14029        name: T,
14030        value: T,
14031    ) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C>
14032    where
14033        T: AsRef<str>,
14034    {
14035        self._additional_params
14036            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14037        self
14038    }
14039
14040    /// Identifies the authorization scope for the method you are building.
14041    ///
14042    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14043    /// [`Scope::CloudPlatform`].
14044    ///
14045    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14046    /// tokens for more than one scope.
14047    ///
14048    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14049    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14050    /// sufficient, a read-write scope will do as well.
14051    pub fn add_scope<St>(
14052        mut self,
14053        scope: St,
14054    ) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C>
14055    where
14056        St: AsRef<str>,
14057    {
14058        self._scopes.insert(String::from(scope.as_ref()));
14059        self
14060    }
14061    /// Identifies the authorization scope(s) for the method you are building.
14062    ///
14063    /// See [`Self::add_scope()`] for details.
14064    pub fn add_scopes<I, St>(
14065        mut self,
14066        scopes: I,
14067    ) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C>
14068    where
14069        I: IntoIterator<Item = St>,
14070        St: AsRef<str>,
14071    {
14072        self._scopes
14073            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14074        self
14075    }
14076
14077    /// Removes all scopes, and no default scope will be used either.
14078    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14079    /// for details).
14080    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionBatchDeleteCall<'a, C> {
14081        self._scopes.clear();
14082        self
14083    }
14084}
14085
14086/// Deletes a version and all of its content. The returned operation will complete once the version has been deleted.
14087///
14088/// A builder for the *locations.repositories.packages.versions.delete* method supported by a *project* resource.
14089/// It is not used directly, but through a [`ProjectMethods`] instance.
14090///
14091/// # Example
14092///
14093/// Instantiate a resource method builder
14094///
14095/// ```test_harness,no_run
14096/// # extern crate hyper;
14097/// # extern crate hyper_rustls;
14098/// # extern crate google_artifactregistry1 as artifactregistry1;
14099/// # async fn dox() {
14100/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14101///
14102/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14103/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14104/// #     .with_native_roots()
14105/// #     .unwrap()
14106/// #     .https_only()
14107/// #     .enable_http2()
14108/// #     .build();
14109///
14110/// # let executor = hyper_util::rt::TokioExecutor::new();
14111/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14112/// #     secret,
14113/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14114/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14115/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14116/// #     ),
14117/// # ).build().await.unwrap();
14118///
14119/// # let client = hyper_util::client::legacy::Client::builder(
14120/// #     hyper_util::rt::TokioExecutor::new()
14121/// # )
14122/// # .build(
14123/// #     hyper_rustls::HttpsConnectorBuilder::new()
14124/// #         .with_native_roots()
14125/// #         .unwrap()
14126/// #         .https_or_http()
14127/// #         .enable_http2()
14128/// #         .build()
14129/// # );
14130/// # let mut hub = ArtifactRegistry::new(client, auth);
14131/// // You can configure optional parameters by calling the respective setters at will, and
14132/// // execute the final call using `doit()`.
14133/// // Values shown here are possibly random and not representative !
14134/// let result = hub.projects().locations_repositories_packages_versions_delete("name")
14135///              .force(false)
14136///              .doit().await;
14137/// # }
14138/// ```
14139pub struct ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
14140where
14141    C: 'a,
14142{
14143    hub: &'a ArtifactRegistry<C>,
14144    _name: String,
14145    _force: Option<bool>,
14146    _delegate: Option<&'a mut dyn common::Delegate>,
14147    _additional_params: HashMap<String, String>,
14148    _scopes: BTreeSet<String>,
14149}
14150
14151impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {}
14152
14153impl<'a, C> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
14154where
14155    C: common::Connector,
14156{
14157    /// Perform the operation you have build so far.
14158    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14159        use std::borrow::Cow;
14160        use std::io::{Read, Seek};
14161
14162        use common::{url::Params, ToParts};
14163        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14164
14165        let mut dd = common::DefaultDelegate;
14166        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14167        dlg.begin(common::MethodInfo {
14168            id: "artifactregistry.projects.locations.repositories.packages.versions.delete",
14169            http_method: hyper::Method::DELETE,
14170        });
14171
14172        for &field in ["alt", "name", "force"].iter() {
14173            if self._additional_params.contains_key(field) {
14174                dlg.finished(false);
14175                return Err(common::Error::FieldClash(field));
14176            }
14177        }
14178
14179        let mut params = Params::with_capacity(4 + self._additional_params.len());
14180        params.push("name", self._name);
14181        if let Some(value) = self._force.as_ref() {
14182            params.push("force", value.to_string());
14183        }
14184
14185        params.extend(self._additional_params.iter());
14186
14187        params.push("alt", "json");
14188        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14189        if self._scopes.is_empty() {
14190            self._scopes
14191                .insert(Scope::CloudPlatform.as_ref().to_string());
14192        }
14193
14194        #[allow(clippy::single_element_loop)]
14195        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14196            url = params.uri_replacement(url, param_name, find_this, true);
14197        }
14198        {
14199            let to_remove = ["name"];
14200            params.remove_params(&to_remove);
14201        }
14202
14203        let url = params.parse_with_url(&url);
14204
14205        loop {
14206            let token = match self
14207                .hub
14208                .auth
14209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14210                .await
14211            {
14212                Ok(token) => token,
14213                Err(e) => match dlg.token(e) {
14214                    Ok(token) => token,
14215                    Err(e) => {
14216                        dlg.finished(false);
14217                        return Err(common::Error::MissingToken(e));
14218                    }
14219                },
14220            };
14221            let mut req_result = {
14222                let client = &self.hub.client;
14223                dlg.pre_request();
14224                let mut req_builder = hyper::Request::builder()
14225                    .method(hyper::Method::DELETE)
14226                    .uri(url.as_str())
14227                    .header(USER_AGENT, self.hub._user_agent.clone());
14228
14229                if let Some(token) = token.as_ref() {
14230                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14231                }
14232
14233                let request = req_builder
14234                    .header(CONTENT_LENGTH, 0_u64)
14235                    .body(common::to_body::<String>(None));
14236
14237                client.request(request.unwrap()).await
14238            };
14239
14240            match req_result {
14241                Err(err) => {
14242                    if let common::Retry::After(d) = dlg.http_error(&err) {
14243                        sleep(d).await;
14244                        continue;
14245                    }
14246                    dlg.finished(false);
14247                    return Err(common::Error::HttpError(err));
14248                }
14249                Ok(res) => {
14250                    let (mut parts, body) = res.into_parts();
14251                    let mut body = common::Body::new(body);
14252                    if !parts.status.is_success() {
14253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14254                        let error = serde_json::from_str(&common::to_string(&bytes));
14255                        let response = common::to_response(parts, bytes.into());
14256
14257                        if let common::Retry::After(d) =
14258                            dlg.http_failure(&response, error.as_ref().ok())
14259                        {
14260                            sleep(d).await;
14261                            continue;
14262                        }
14263
14264                        dlg.finished(false);
14265
14266                        return Err(match error {
14267                            Ok(value) => common::Error::BadRequest(value),
14268                            _ => common::Error::Failure(response),
14269                        });
14270                    }
14271                    let response = {
14272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14273                        let encoded = common::to_string(&bytes);
14274                        match serde_json::from_str(&encoded) {
14275                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14276                            Err(error) => {
14277                                dlg.response_json_decode_error(&encoded, &error);
14278                                return Err(common::Error::JsonDecodeError(
14279                                    encoded.to_string(),
14280                                    error,
14281                                ));
14282                            }
14283                        }
14284                    };
14285
14286                    dlg.finished(true);
14287                    return Ok(response);
14288                }
14289            }
14290        }
14291    }
14292
14293    /// The name of the version to delete.
14294    ///
14295    /// Sets the *name* path property to the given value.
14296    ///
14297    /// Even though the property as already been set when instantiating this call,
14298    /// we provide this method for API completeness.
14299    pub fn name(
14300        mut self,
14301        new_value: &str,
14302    ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
14303        self._name = new_value.to_string();
14304        self
14305    }
14306    /// By default, a version that is tagged may not be deleted. If force=true, the version and any tags pointing to the version are deleted.
14307    ///
14308    /// Sets the *force* query property to the given value.
14309    pub fn force(
14310        mut self,
14311        new_value: bool,
14312    ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
14313        self._force = Some(new_value);
14314        self
14315    }
14316    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14317    /// while executing the actual API request.
14318    ///
14319    /// ````text
14320    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14321    /// ````
14322    ///
14323    /// Sets the *delegate* property to the given value.
14324    pub fn delegate(
14325        mut self,
14326        new_value: &'a mut dyn common::Delegate,
14327    ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
14328        self._delegate = Some(new_value);
14329        self
14330    }
14331
14332    /// Set any additional parameter of the query string used in the request.
14333    /// It should be used to set parameters which are not yet available through their own
14334    /// setters.
14335    ///
14336    /// Please note that this method must not be used to set any of the known parameters
14337    /// which have their own setter method. If done anyway, the request will fail.
14338    ///
14339    /// # Additional Parameters
14340    ///
14341    /// * *$.xgafv* (query-string) - V1 error format.
14342    /// * *access_token* (query-string) - OAuth access token.
14343    /// * *alt* (query-string) - Data format for response.
14344    /// * *callback* (query-string) - JSONP
14345    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14346    /// * *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.
14347    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14348    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14349    /// * *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.
14350    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14351    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14352    pub fn param<T>(
14353        mut self,
14354        name: T,
14355        value: T,
14356    ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
14357    where
14358        T: AsRef<str>,
14359    {
14360        self._additional_params
14361            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14362        self
14363    }
14364
14365    /// Identifies the authorization scope for the method you are building.
14366    ///
14367    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14368    /// [`Scope::CloudPlatform`].
14369    ///
14370    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14371    /// tokens for more than one scope.
14372    ///
14373    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14374    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14375    /// sufficient, a read-write scope will do as well.
14376    pub fn add_scope<St>(
14377        mut self,
14378        scope: St,
14379    ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
14380    where
14381        St: AsRef<str>,
14382    {
14383        self._scopes.insert(String::from(scope.as_ref()));
14384        self
14385    }
14386    /// Identifies the authorization scope(s) for the method you are building.
14387    ///
14388    /// See [`Self::add_scope()`] for details.
14389    pub fn add_scopes<I, St>(
14390        mut self,
14391        scopes: I,
14392    ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
14393    where
14394        I: IntoIterator<Item = St>,
14395        St: AsRef<str>,
14396    {
14397        self._scopes
14398            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14399        self
14400    }
14401
14402    /// Removes all scopes, and no default scope will be used either.
14403    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14404    /// for details).
14405    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
14406        self._scopes.clear();
14407        self
14408    }
14409}
14410
14411/// Gets a version
14412///
14413/// A builder for the *locations.repositories.packages.versions.get* method supported by a *project* resource.
14414/// It is not used directly, but through a [`ProjectMethods`] instance.
14415///
14416/// # Example
14417///
14418/// Instantiate a resource method builder
14419///
14420/// ```test_harness,no_run
14421/// # extern crate hyper;
14422/// # extern crate hyper_rustls;
14423/// # extern crate google_artifactregistry1 as artifactregistry1;
14424/// # async fn dox() {
14425/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14426///
14427/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14428/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14429/// #     .with_native_roots()
14430/// #     .unwrap()
14431/// #     .https_only()
14432/// #     .enable_http2()
14433/// #     .build();
14434///
14435/// # let executor = hyper_util::rt::TokioExecutor::new();
14436/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14437/// #     secret,
14438/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14439/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14440/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14441/// #     ),
14442/// # ).build().await.unwrap();
14443///
14444/// # let client = hyper_util::client::legacy::Client::builder(
14445/// #     hyper_util::rt::TokioExecutor::new()
14446/// # )
14447/// # .build(
14448/// #     hyper_rustls::HttpsConnectorBuilder::new()
14449/// #         .with_native_roots()
14450/// #         .unwrap()
14451/// #         .https_or_http()
14452/// #         .enable_http2()
14453/// #         .build()
14454/// # );
14455/// # let mut hub = ArtifactRegistry::new(client, auth);
14456/// // You can configure optional parameters by calling the respective setters at will, and
14457/// // execute the final call using `doit()`.
14458/// // Values shown here are possibly random and not representative !
14459/// let result = hub.projects().locations_repositories_packages_versions_get("name")
14460///              .view("dolor")
14461///              .doit().await;
14462/// # }
14463/// ```
14464pub struct ProjectLocationRepositoryPackageVersionGetCall<'a, C>
14465where
14466    C: 'a,
14467{
14468    hub: &'a ArtifactRegistry<C>,
14469    _name: String,
14470    _view: Option<String>,
14471    _delegate: Option<&'a mut dyn common::Delegate>,
14472    _additional_params: HashMap<String, String>,
14473    _scopes: BTreeSet<String>,
14474}
14475
14476impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionGetCall<'a, C> {}
14477
14478impl<'a, C> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
14479where
14480    C: common::Connector,
14481{
14482    /// Perform the operation you have build so far.
14483    pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
14484        use std::borrow::Cow;
14485        use std::io::{Read, Seek};
14486
14487        use common::{url::Params, ToParts};
14488        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14489
14490        let mut dd = common::DefaultDelegate;
14491        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14492        dlg.begin(common::MethodInfo {
14493            id: "artifactregistry.projects.locations.repositories.packages.versions.get",
14494            http_method: hyper::Method::GET,
14495        });
14496
14497        for &field in ["alt", "name", "view"].iter() {
14498            if self._additional_params.contains_key(field) {
14499                dlg.finished(false);
14500                return Err(common::Error::FieldClash(field));
14501            }
14502        }
14503
14504        let mut params = Params::with_capacity(4 + self._additional_params.len());
14505        params.push("name", self._name);
14506        if let Some(value) = self._view.as_ref() {
14507            params.push("view", value);
14508        }
14509
14510        params.extend(self._additional_params.iter());
14511
14512        params.push("alt", "json");
14513        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14514        if self._scopes.is_empty() {
14515            self._scopes
14516                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
14517        }
14518
14519        #[allow(clippy::single_element_loop)]
14520        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14521            url = params.uri_replacement(url, param_name, find_this, true);
14522        }
14523        {
14524            let to_remove = ["name"];
14525            params.remove_params(&to_remove);
14526        }
14527
14528        let url = params.parse_with_url(&url);
14529
14530        loop {
14531            let token = match self
14532                .hub
14533                .auth
14534                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14535                .await
14536            {
14537                Ok(token) => token,
14538                Err(e) => match dlg.token(e) {
14539                    Ok(token) => token,
14540                    Err(e) => {
14541                        dlg.finished(false);
14542                        return Err(common::Error::MissingToken(e));
14543                    }
14544                },
14545            };
14546            let mut req_result = {
14547                let client = &self.hub.client;
14548                dlg.pre_request();
14549                let mut req_builder = hyper::Request::builder()
14550                    .method(hyper::Method::GET)
14551                    .uri(url.as_str())
14552                    .header(USER_AGENT, self.hub._user_agent.clone());
14553
14554                if let Some(token) = token.as_ref() {
14555                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14556                }
14557
14558                let request = req_builder
14559                    .header(CONTENT_LENGTH, 0_u64)
14560                    .body(common::to_body::<String>(None));
14561
14562                client.request(request.unwrap()).await
14563            };
14564
14565            match req_result {
14566                Err(err) => {
14567                    if let common::Retry::After(d) = dlg.http_error(&err) {
14568                        sleep(d).await;
14569                        continue;
14570                    }
14571                    dlg.finished(false);
14572                    return Err(common::Error::HttpError(err));
14573                }
14574                Ok(res) => {
14575                    let (mut parts, body) = res.into_parts();
14576                    let mut body = common::Body::new(body);
14577                    if !parts.status.is_success() {
14578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14579                        let error = serde_json::from_str(&common::to_string(&bytes));
14580                        let response = common::to_response(parts, bytes.into());
14581
14582                        if let common::Retry::After(d) =
14583                            dlg.http_failure(&response, error.as_ref().ok())
14584                        {
14585                            sleep(d).await;
14586                            continue;
14587                        }
14588
14589                        dlg.finished(false);
14590
14591                        return Err(match error {
14592                            Ok(value) => common::Error::BadRequest(value),
14593                            _ => common::Error::Failure(response),
14594                        });
14595                    }
14596                    let response = {
14597                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14598                        let encoded = common::to_string(&bytes);
14599                        match serde_json::from_str(&encoded) {
14600                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14601                            Err(error) => {
14602                                dlg.response_json_decode_error(&encoded, &error);
14603                                return Err(common::Error::JsonDecodeError(
14604                                    encoded.to_string(),
14605                                    error,
14606                                ));
14607                            }
14608                        }
14609                    };
14610
14611                    dlg.finished(true);
14612                    return Ok(response);
14613                }
14614            }
14615        }
14616    }
14617
14618    /// The name of the version to retrieve.
14619    ///
14620    /// Sets the *name* path property to the given value.
14621    ///
14622    /// Even though the property as already been set when instantiating this call,
14623    /// we provide this method for API completeness.
14624    pub fn name(
14625        mut self,
14626        new_value: &str,
14627    ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
14628        self._name = new_value.to_string();
14629        self
14630    }
14631    /// The view that should be returned in the response.
14632    ///
14633    /// Sets the *view* query property to the given value.
14634    pub fn view(
14635        mut self,
14636        new_value: &str,
14637    ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
14638        self._view = Some(new_value.to_string());
14639        self
14640    }
14641    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14642    /// while executing the actual API request.
14643    ///
14644    /// ````text
14645    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14646    /// ````
14647    ///
14648    /// Sets the *delegate* property to the given value.
14649    pub fn delegate(
14650        mut self,
14651        new_value: &'a mut dyn common::Delegate,
14652    ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
14653        self._delegate = Some(new_value);
14654        self
14655    }
14656
14657    /// Set any additional parameter of the query string used in the request.
14658    /// It should be used to set parameters which are not yet available through their own
14659    /// setters.
14660    ///
14661    /// Please note that this method must not be used to set any of the known parameters
14662    /// which have their own setter method. If done anyway, the request will fail.
14663    ///
14664    /// # Additional Parameters
14665    ///
14666    /// * *$.xgafv* (query-string) - V1 error format.
14667    /// * *access_token* (query-string) - OAuth access token.
14668    /// * *alt* (query-string) - Data format for response.
14669    /// * *callback* (query-string) - JSONP
14670    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14671    /// * *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.
14672    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14673    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14674    /// * *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.
14675    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14676    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14677    pub fn param<T>(
14678        mut self,
14679        name: T,
14680        value: T,
14681    ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
14682    where
14683        T: AsRef<str>,
14684    {
14685        self._additional_params
14686            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14687        self
14688    }
14689
14690    /// Identifies the authorization scope for the method you are building.
14691    ///
14692    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14693    /// [`Scope::CloudPlatformReadOnly`].
14694    ///
14695    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14696    /// tokens for more than one scope.
14697    ///
14698    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14699    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14700    /// sufficient, a read-write scope will do as well.
14701    pub fn add_scope<St>(
14702        mut self,
14703        scope: St,
14704    ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
14705    where
14706        St: AsRef<str>,
14707    {
14708        self._scopes.insert(String::from(scope.as_ref()));
14709        self
14710    }
14711    /// Identifies the authorization scope(s) for the method you are building.
14712    ///
14713    /// See [`Self::add_scope()`] for details.
14714    pub fn add_scopes<I, St>(
14715        mut self,
14716        scopes: I,
14717    ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
14718    where
14719        I: IntoIterator<Item = St>,
14720        St: AsRef<str>,
14721    {
14722        self._scopes
14723            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14724        self
14725    }
14726
14727    /// Removes all scopes, and no default scope will be used either.
14728    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14729    /// for details).
14730    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
14731        self._scopes.clear();
14732        self
14733    }
14734}
14735
14736/// Lists versions.
14737///
14738/// A builder for the *locations.repositories.packages.versions.list* method supported by a *project* resource.
14739/// It is not used directly, but through a [`ProjectMethods`] instance.
14740///
14741/// # Example
14742///
14743/// Instantiate a resource method builder
14744///
14745/// ```test_harness,no_run
14746/// # extern crate hyper;
14747/// # extern crate hyper_rustls;
14748/// # extern crate google_artifactregistry1 as artifactregistry1;
14749/// # async fn dox() {
14750/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14751///
14752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14753/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14754/// #     .with_native_roots()
14755/// #     .unwrap()
14756/// #     .https_only()
14757/// #     .enable_http2()
14758/// #     .build();
14759///
14760/// # let executor = hyper_util::rt::TokioExecutor::new();
14761/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14762/// #     secret,
14763/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14764/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14765/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14766/// #     ),
14767/// # ).build().await.unwrap();
14768///
14769/// # let client = hyper_util::client::legacy::Client::builder(
14770/// #     hyper_util::rt::TokioExecutor::new()
14771/// # )
14772/// # .build(
14773/// #     hyper_rustls::HttpsConnectorBuilder::new()
14774/// #         .with_native_roots()
14775/// #         .unwrap()
14776/// #         .https_or_http()
14777/// #         .enable_http2()
14778/// #         .build()
14779/// # );
14780/// # let mut hub = ArtifactRegistry::new(client, auth);
14781/// // You can configure optional parameters by calling the respective setters at will, and
14782/// // execute the final call using `doit()`.
14783/// // Values shown here are possibly random and not representative !
14784/// let result = hub.projects().locations_repositories_packages_versions_list("parent")
14785///              .view("et")
14786///              .page_token("sadipscing")
14787///              .page_size(-15)
14788///              .order_by("dolor")
14789///              .filter("duo")
14790///              .doit().await;
14791/// # }
14792/// ```
14793pub struct ProjectLocationRepositoryPackageVersionListCall<'a, C>
14794where
14795    C: 'a,
14796{
14797    hub: &'a ArtifactRegistry<C>,
14798    _parent: String,
14799    _view: Option<String>,
14800    _page_token: Option<String>,
14801    _page_size: Option<i32>,
14802    _order_by: Option<String>,
14803    _filter: Option<String>,
14804    _delegate: Option<&'a mut dyn common::Delegate>,
14805    _additional_params: HashMap<String, String>,
14806    _scopes: BTreeSet<String>,
14807}
14808
14809impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionListCall<'a, C> {}
14810
14811impl<'a, C> ProjectLocationRepositoryPackageVersionListCall<'a, C>
14812where
14813    C: common::Connector,
14814{
14815    /// Perform the operation you have build so far.
14816    pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
14817        use std::borrow::Cow;
14818        use std::io::{Read, Seek};
14819
14820        use common::{url::Params, ToParts};
14821        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14822
14823        let mut dd = common::DefaultDelegate;
14824        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14825        dlg.begin(common::MethodInfo {
14826            id: "artifactregistry.projects.locations.repositories.packages.versions.list",
14827            http_method: hyper::Method::GET,
14828        });
14829
14830        for &field in [
14831            "alt",
14832            "parent",
14833            "view",
14834            "pageToken",
14835            "pageSize",
14836            "orderBy",
14837            "filter",
14838        ]
14839        .iter()
14840        {
14841            if self._additional_params.contains_key(field) {
14842                dlg.finished(false);
14843                return Err(common::Error::FieldClash(field));
14844            }
14845        }
14846
14847        let mut params = Params::with_capacity(8 + self._additional_params.len());
14848        params.push("parent", self._parent);
14849        if let Some(value) = self._view.as_ref() {
14850            params.push("view", value);
14851        }
14852        if let Some(value) = self._page_token.as_ref() {
14853            params.push("pageToken", value);
14854        }
14855        if let Some(value) = self._page_size.as_ref() {
14856            params.push("pageSize", value.to_string());
14857        }
14858        if let Some(value) = self._order_by.as_ref() {
14859            params.push("orderBy", value);
14860        }
14861        if let Some(value) = self._filter.as_ref() {
14862            params.push("filter", value);
14863        }
14864
14865        params.extend(self._additional_params.iter());
14866
14867        params.push("alt", "json");
14868        let mut url = self.hub._base_url.clone() + "v1/{+parent}/versions";
14869        if self._scopes.is_empty() {
14870            self._scopes
14871                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
14872        }
14873
14874        #[allow(clippy::single_element_loop)]
14875        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14876            url = params.uri_replacement(url, param_name, find_this, true);
14877        }
14878        {
14879            let to_remove = ["parent"];
14880            params.remove_params(&to_remove);
14881        }
14882
14883        let url = params.parse_with_url(&url);
14884
14885        loop {
14886            let token = match self
14887                .hub
14888                .auth
14889                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14890                .await
14891            {
14892                Ok(token) => token,
14893                Err(e) => match dlg.token(e) {
14894                    Ok(token) => token,
14895                    Err(e) => {
14896                        dlg.finished(false);
14897                        return Err(common::Error::MissingToken(e));
14898                    }
14899                },
14900            };
14901            let mut req_result = {
14902                let client = &self.hub.client;
14903                dlg.pre_request();
14904                let mut req_builder = hyper::Request::builder()
14905                    .method(hyper::Method::GET)
14906                    .uri(url.as_str())
14907                    .header(USER_AGENT, self.hub._user_agent.clone());
14908
14909                if let Some(token) = token.as_ref() {
14910                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14911                }
14912
14913                let request = req_builder
14914                    .header(CONTENT_LENGTH, 0_u64)
14915                    .body(common::to_body::<String>(None));
14916
14917                client.request(request.unwrap()).await
14918            };
14919
14920            match req_result {
14921                Err(err) => {
14922                    if let common::Retry::After(d) = dlg.http_error(&err) {
14923                        sleep(d).await;
14924                        continue;
14925                    }
14926                    dlg.finished(false);
14927                    return Err(common::Error::HttpError(err));
14928                }
14929                Ok(res) => {
14930                    let (mut parts, body) = res.into_parts();
14931                    let mut body = common::Body::new(body);
14932                    if !parts.status.is_success() {
14933                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14934                        let error = serde_json::from_str(&common::to_string(&bytes));
14935                        let response = common::to_response(parts, bytes.into());
14936
14937                        if let common::Retry::After(d) =
14938                            dlg.http_failure(&response, error.as_ref().ok())
14939                        {
14940                            sleep(d).await;
14941                            continue;
14942                        }
14943
14944                        dlg.finished(false);
14945
14946                        return Err(match error {
14947                            Ok(value) => common::Error::BadRequest(value),
14948                            _ => common::Error::Failure(response),
14949                        });
14950                    }
14951                    let response = {
14952                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14953                        let encoded = common::to_string(&bytes);
14954                        match serde_json::from_str(&encoded) {
14955                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14956                            Err(error) => {
14957                                dlg.response_json_decode_error(&encoded, &error);
14958                                return Err(common::Error::JsonDecodeError(
14959                                    encoded.to_string(),
14960                                    error,
14961                                ));
14962                            }
14963                        }
14964                    };
14965
14966                    dlg.finished(true);
14967                    return Ok(response);
14968                }
14969            }
14970        }
14971    }
14972
14973    /// The name of the parent resource whose versions will be listed.
14974    ///
14975    /// Sets the *parent* path property to the given value.
14976    ///
14977    /// Even though the property as already been set when instantiating this call,
14978    /// we provide this method for API completeness.
14979    pub fn parent(
14980        mut self,
14981        new_value: &str,
14982    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
14983        self._parent = new_value.to_string();
14984        self
14985    }
14986    /// The view that should be returned in the response.
14987    ///
14988    /// Sets the *view* query property to the given value.
14989    pub fn view(
14990        mut self,
14991        new_value: &str,
14992    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
14993        self._view = Some(new_value.to_string());
14994        self
14995    }
14996    /// The next_page_token value returned from a previous list request, if any.
14997    ///
14998    /// Sets the *page token* query property to the given value.
14999    pub fn page_token(
15000        mut self,
15001        new_value: &str,
15002    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
15003        self._page_token = Some(new_value.to_string());
15004        self
15005    }
15006    /// The maximum number of versions to return. Maximum page size is 1,000.
15007    ///
15008    /// Sets the *page size* query property to the given value.
15009    pub fn page_size(
15010        mut self,
15011        new_value: i32,
15012    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
15013        self._page_size = Some(new_value);
15014        self
15015    }
15016    /// Optional. The field to order the results by.
15017    ///
15018    /// Sets the *order by* query property to the given value.
15019    pub fn order_by(
15020        mut self,
15021        new_value: &str,
15022    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
15023        self._order_by = Some(new_value.to_string());
15024        self
15025    }
15026    /// Optional. An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: * `name` * `annotations` Examples of using a filter: To filter the results of your request to versions with the name `my-version` in project `my-project` in the `us-central` region, in repository `my-repo`, append the following filter expression to your request: * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/versions/my-version"` You can also use wildcards to match any number of characters before or after the value: * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/versions/*version"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/versions/my*"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package/versions/*version*"` To filter the results of your request to versions with the annotation key-value pair [`external_link`: `external_link_value`], append the following filter expression to your request: * `"annotations.external_link:external_link_value"` To filter just for a specific annotation key `external_link`, append the following filter expression to your request: * `"annotations.external_link"` If the annotation key or value contains special characters, you can escape them by surrounding the value with backticks. For example, to filter the results of your request to versions with the annotation key-value pair [`external.link`:`https://example.com/my-version`], append the following filter expression to your request: * `` "annotations.`external.link`:`https://example.com/my-version`" `` You can also filter with annotations with a wildcard to match any number of characters before or after the value: * `` "annotations.*_link:`*example.com*`" ``
15027    ///
15028    /// Sets the *filter* query property to the given value.
15029    pub fn filter(
15030        mut self,
15031        new_value: &str,
15032    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
15033        self._filter = Some(new_value.to_string());
15034        self
15035    }
15036    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15037    /// while executing the actual API request.
15038    ///
15039    /// ````text
15040    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15041    /// ````
15042    ///
15043    /// Sets the *delegate* property to the given value.
15044    pub fn delegate(
15045        mut self,
15046        new_value: &'a mut dyn common::Delegate,
15047    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
15048        self._delegate = Some(new_value);
15049        self
15050    }
15051
15052    /// Set any additional parameter of the query string used in the request.
15053    /// It should be used to set parameters which are not yet available through their own
15054    /// setters.
15055    ///
15056    /// Please note that this method must not be used to set any of the known parameters
15057    /// which have their own setter method. If done anyway, the request will fail.
15058    ///
15059    /// # Additional Parameters
15060    ///
15061    /// * *$.xgafv* (query-string) - V1 error format.
15062    /// * *access_token* (query-string) - OAuth access token.
15063    /// * *alt* (query-string) - Data format for response.
15064    /// * *callback* (query-string) - JSONP
15065    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15066    /// * *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.
15067    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15068    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15069    /// * *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.
15070    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15071    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15072    pub fn param<T>(
15073        mut self,
15074        name: T,
15075        value: T,
15076    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C>
15077    where
15078        T: AsRef<str>,
15079    {
15080        self._additional_params
15081            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15082        self
15083    }
15084
15085    /// Identifies the authorization scope for the method you are building.
15086    ///
15087    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15088    /// [`Scope::CloudPlatformReadOnly`].
15089    ///
15090    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15091    /// tokens for more than one scope.
15092    ///
15093    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15094    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15095    /// sufficient, a read-write scope will do as well.
15096    pub fn add_scope<St>(
15097        mut self,
15098        scope: St,
15099    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C>
15100    where
15101        St: AsRef<str>,
15102    {
15103        self._scopes.insert(String::from(scope.as_ref()));
15104        self
15105    }
15106    /// Identifies the authorization scope(s) for the method you are building.
15107    ///
15108    /// See [`Self::add_scope()`] for details.
15109    pub fn add_scopes<I, St>(
15110        mut self,
15111        scopes: I,
15112    ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C>
15113    where
15114        I: IntoIterator<Item = St>,
15115        St: AsRef<str>,
15116    {
15117        self._scopes
15118            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15119        self
15120    }
15121
15122    /// Removes all scopes, and no default scope will be used either.
15123    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15124    /// for details).
15125    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
15126        self._scopes.clear();
15127        self
15128    }
15129}
15130
15131/// Updates a version.
15132///
15133/// A builder for the *locations.repositories.packages.versions.patch* method supported by a *project* resource.
15134/// It is not used directly, but through a [`ProjectMethods`] instance.
15135///
15136/// # Example
15137///
15138/// Instantiate a resource method builder
15139///
15140/// ```test_harness,no_run
15141/// # extern crate hyper;
15142/// # extern crate hyper_rustls;
15143/// # extern crate google_artifactregistry1 as artifactregistry1;
15144/// use artifactregistry1::api::Version;
15145/// # async fn dox() {
15146/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15147///
15148/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15149/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15150/// #     .with_native_roots()
15151/// #     .unwrap()
15152/// #     .https_only()
15153/// #     .enable_http2()
15154/// #     .build();
15155///
15156/// # let executor = hyper_util::rt::TokioExecutor::new();
15157/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15158/// #     secret,
15159/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15160/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15161/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15162/// #     ),
15163/// # ).build().await.unwrap();
15164///
15165/// # let client = hyper_util::client::legacy::Client::builder(
15166/// #     hyper_util::rt::TokioExecutor::new()
15167/// # )
15168/// # .build(
15169/// #     hyper_rustls::HttpsConnectorBuilder::new()
15170/// #         .with_native_roots()
15171/// #         .unwrap()
15172/// #         .https_or_http()
15173/// #         .enable_http2()
15174/// #         .build()
15175/// # );
15176/// # let mut hub = ArtifactRegistry::new(client, auth);
15177/// // As the method needs a request, you would usually fill it with the desired information
15178/// // into the respective structure. Some of the parts shown here might not be applicable !
15179/// // Values shown here are possibly random and not representative !
15180/// let mut req = Version::default();
15181///
15182/// // You can configure optional parameters by calling the respective setters at will, and
15183/// // execute the final call using `doit()`.
15184/// // Values shown here are possibly random and not representative !
15185/// let result = hub.projects().locations_repositories_packages_versions_patch(req, "name")
15186///              .update_mask(FieldMask::new::<&str>(&[]))
15187///              .doit().await;
15188/// # }
15189/// ```
15190pub struct ProjectLocationRepositoryPackageVersionPatchCall<'a, C>
15191where
15192    C: 'a,
15193{
15194    hub: &'a ArtifactRegistry<C>,
15195    _request: Version,
15196    _name: String,
15197    _update_mask: Option<common::FieldMask>,
15198    _delegate: Option<&'a mut dyn common::Delegate>,
15199    _additional_params: HashMap<String, String>,
15200    _scopes: BTreeSet<String>,
15201}
15202
15203impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionPatchCall<'a, C> {}
15204
15205impl<'a, C> ProjectLocationRepositoryPackageVersionPatchCall<'a, C>
15206where
15207    C: common::Connector,
15208{
15209    /// Perform the operation you have build so far.
15210    pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
15211        use std::borrow::Cow;
15212        use std::io::{Read, Seek};
15213
15214        use common::{url::Params, ToParts};
15215        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15216
15217        let mut dd = common::DefaultDelegate;
15218        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15219        dlg.begin(common::MethodInfo {
15220            id: "artifactregistry.projects.locations.repositories.packages.versions.patch",
15221            http_method: hyper::Method::PATCH,
15222        });
15223
15224        for &field in ["alt", "name", "updateMask"].iter() {
15225            if self._additional_params.contains_key(field) {
15226                dlg.finished(false);
15227                return Err(common::Error::FieldClash(field));
15228            }
15229        }
15230
15231        let mut params = Params::with_capacity(5 + self._additional_params.len());
15232        params.push("name", self._name);
15233        if let Some(value) = self._update_mask.as_ref() {
15234            params.push("updateMask", value.to_string());
15235        }
15236
15237        params.extend(self._additional_params.iter());
15238
15239        params.push("alt", "json");
15240        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15241        if self._scopes.is_empty() {
15242            self._scopes
15243                .insert(Scope::CloudPlatform.as_ref().to_string());
15244        }
15245
15246        #[allow(clippy::single_element_loop)]
15247        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15248            url = params.uri_replacement(url, param_name, find_this, true);
15249        }
15250        {
15251            let to_remove = ["name"];
15252            params.remove_params(&to_remove);
15253        }
15254
15255        let url = params.parse_with_url(&url);
15256
15257        let mut json_mime_type = mime::APPLICATION_JSON;
15258        let mut request_value_reader = {
15259            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15260            common::remove_json_null_values(&mut value);
15261            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15262            serde_json::to_writer(&mut dst, &value).unwrap();
15263            dst
15264        };
15265        let request_size = request_value_reader
15266            .seek(std::io::SeekFrom::End(0))
15267            .unwrap();
15268        request_value_reader
15269            .seek(std::io::SeekFrom::Start(0))
15270            .unwrap();
15271
15272        loop {
15273            let token = match self
15274                .hub
15275                .auth
15276                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15277                .await
15278            {
15279                Ok(token) => token,
15280                Err(e) => match dlg.token(e) {
15281                    Ok(token) => token,
15282                    Err(e) => {
15283                        dlg.finished(false);
15284                        return Err(common::Error::MissingToken(e));
15285                    }
15286                },
15287            };
15288            request_value_reader
15289                .seek(std::io::SeekFrom::Start(0))
15290                .unwrap();
15291            let mut req_result = {
15292                let client = &self.hub.client;
15293                dlg.pre_request();
15294                let mut req_builder = hyper::Request::builder()
15295                    .method(hyper::Method::PATCH)
15296                    .uri(url.as_str())
15297                    .header(USER_AGENT, self.hub._user_agent.clone());
15298
15299                if let Some(token) = token.as_ref() {
15300                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15301                }
15302
15303                let request = req_builder
15304                    .header(CONTENT_TYPE, json_mime_type.to_string())
15305                    .header(CONTENT_LENGTH, request_size as u64)
15306                    .body(common::to_body(
15307                        request_value_reader.get_ref().clone().into(),
15308                    ));
15309
15310                client.request(request.unwrap()).await
15311            };
15312
15313            match req_result {
15314                Err(err) => {
15315                    if let common::Retry::After(d) = dlg.http_error(&err) {
15316                        sleep(d).await;
15317                        continue;
15318                    }
15319                    dlg.finished(false);
15320                    return Err(common::Error::HttpError(err));
15321                }
15322                Ok(res) => {
15323                    let (mut parts, body) = res.into_parts();
15324                    let mut body = common::Body::new(body);
15325                    if !parts.status.is_success() {
15326                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15327                        let error = serde_json::from_str(&common::to_string(&bytes));
15328                        let response = common::to_response(parts, bytes.into());
15329
15330                        if let common::Retry::After(d) =
15331                            dlg.http_failure(&response, error.as_ref().ok())
15332                        {
15333                            sleep(d).await;
15334                            continue;
15335                        }
15336
15337                        dlg.finished(false);
15338
15339                        return Err(match error {
15340                            Ok(value) => common::Error::BadRequest(value),
15341                            _ => common::Error::Failure(response),
15342                        });
15343                    }
15344                    let response = {
15345                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15346                        let encoded = common::to_string(&bytes);
15347                        match serde_json::from_str(&encoded) {
15348                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15349                            Err(error) => {
15350                                dlg.response_json_decode_error(&encoded, &error);
15351                                return Err(common::Error::JsonDecodeError(
15352                                    encoded.to_string(),
15353                                    error,
15354                                ));
15355                            }
15356                        }
15357                    };
15358
15359                    dlg.finished(true);
15360                    return Ok(response);
15361                }
15362            }
15363        }
15364    }
15365
15366    ///
15367    /// Sets the *request* property to the given value.
15368    ///
15369    /// Even though the property as already been set when instantiating this call,
15370    /// we provide this method for API completeness.
15371    pub fn request(
15372        mut self,
15373        new_value: Version,
15374    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C> {
15375        self._request = new_value;
15376        self
15377    }
15378    /// The name of the version, for example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1`. If the package or version ID parts contain slashes, the slashes are escaped.
15379    ///
15380    /// Sets the *name* path property to the given value.
15381    ///
15382    /// Even though the property as already been set when instantiating this call,
15383    /// we provide this method for API completeness.
15384    pub fn name(
15385        mut self,
15386        new_value: &str,
15387    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C> {
15388        self._name = new_value.to_string();
15389        self
15390    }
15391    /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
15392    ///
15393    /// Sets the *update mask* query property to the given value.
15394    pub fn update_mask(
15395        mut self,
15396        new_value: common::FieldMask,
15397    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C> {
15398        self._update_mask = Some(new_value);
15399        self
15400    }
15401    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15402    /// while executing the actual API request.
15403    ///
15404    /// ````text
15405    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15406    /// ````
15407    ///
15408    /// Sets the *delegate* property to the given value.
15409    pub fn delegate(
15410        mut self,
15411        new_value: &'a mut dyn common::Delegate,
15412    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C> {
15413        self._delegate = Some(new_value);
15414        self
15415    }
15416
15417    /// Set any additional parameter of the query string used in the request.
15418    /// It should be used to set parameters which are not yet available through their own
15419    /// setters.
15420    ///
15421    /// Please note that this method must not be used to set any of the known parameters
15422    /// which have their own setter method. If done anyway, the request will fail.
15423    ///
15424    /// # Additional Parameters
15425    ///
15426    /// * *$.xgafv* (query-string) - V1 error format.
15427    /// * *access_token* (query-string) - OAuth access token.
15428    /// * *alt* (query-string) - Data format for response.
15429    /// * *callback* (query-string) - JSONP
15430    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15431    /// * *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.
15432    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15433    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15434    /// * *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.
15435    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15436    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15437    pub fn param<T>(
15438        mut self,
15439        name: T,
15440        value: T,
15441    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C>
15442    where
15443        T: AsRef<str>,
15444    {
15445        self._additional_params
15446            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15447        self
15448    }
15449
15450    /// Identifies the authorization scope for the method you are building.
15451    ///
15452    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15453    /// [`Scope::CloudPlatform`].
15454    ///
15455    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15456    /// tokens for more than one scope.
15457    ///
15458    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15459    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15460    /// sufficient, a read-write scope will do as well.
15461    pub fn add_scope<St>(
15462        mut self,
15463        scope: St,
15464    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C>
15465    where
15466        St: AsRef<str>,
15467    {
15468        self._scopes.insert(String::from(scope.as_ref()));
15469        self
15470    }
15471    /// Identifies the authorization scope(s) for the method you are building.
15472    ///
15473    /// See [`Self::add_scope()`] for details.
15474    pub fn add_scopes<I, St>(
15475        mut self,
15476        scopes: I,
15477    ) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C>
15478    where
15479        I: IntoIterator<Item = St>,
15480        St: AsRef<str>,
15481    {
15482        self._scopes
15483            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15484        self
15485    }
15486
15487    /// Removes all scopes, and no default scope will be used either.
15488    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15489    /// for details).
15490    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionPatchCall<'a, C> {
15491        self._scopes.clear();
15492        self
15493    }
15494}
15495
15496/// Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.
15497///
15498/// A builder for the *locations.repositories.packages.delete* method supported by a *project* resource.
15499/// It is not used directly, but through a [`ProjectMethods`] instance.
15500///
15501/// # Example
15502///
15503/// Instantiate a resource method builder
15504///
15505/// ```test_harness,no_run
15506/// # extern crate hyper;
15507/// # extern crate hyper_rustls;
15508/// # extern crate google_artifactregistry1 as artifactregistry1;
15509/// # async fn dox() {
15510/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15511///
15512/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15513/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15514/// #     .with_native_roots()
15515/// #     .unwrap()
15516/// #     .https_only()
15517/// #     .enable_http2()
15518/// #     .build();
15519///
15520/// # let executor = hyper_util::rt::TokioExecutor::new();
15521/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15522/// #     secret,
15523/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15524/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15525/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15526/// #     ),
15527/// # ).build().await.unwrap();
15528///
15529/// # let client = hyper_util::client::legacy::Client::builder(
15530/// #     hyper_util::rt::TokioExecutor::new()
15531/// # )
15532/// # .build(
15533/// #     hyper_rustls::HttpsConnectorBuilder::new()
15534/// #         .with_native_roots()
15535/// #         .unwrap()
15536/// #         .https_or_http()
15537/// #         .enable_http2()
15538/// #         .build()
15539/// # );
15540/// # let mut hub = ArtifactRegistry::new(client, auth);
15541/// // You can configure optional parameters by calling the respective setters at will, and
15542/// // execute the final call using `doit()`.
15543/// // Values shown here are possibly random and not representative !
15544/// let result = hub.projects().locations_repositories_packages_delete("name")
15545///              .doit().await;
15546/// # }
15547/// ```
15548pub struct ProjectLocationRepositoryPackageDeleteCall<'a, C>
15549where
15550    C: 'a,
15551{
15552    hub: &'a ArtifactRegistry<C>,
15553    _name: String,
15554    _delegate: Option<&'a mut dyn common::Delegate>,
15555    _additional_params: HashMap<String, String>,
15556    _scopes: BTreeSet<String>,
15557}
15558
15559impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageDeleteCall<'a, C> {}
15560
15561impl<'a, C> ProjectLocationRepositoryPackageDeleteCall<'a, C>
15562where
15563    C: common::Connector,
15564{
15565    /// Perform the operation you have build so far.
15566    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15567        use std::borrow::Cow;
15568        use std::io::{Read, Seek};
15569
15570        use common::{url::Params, ToParts};
15571        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15572
15573        let mut dd = common::DefaultDelegate;
15574        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15575        dlg.begin(common::MethodInfo {
15576            id: "artifactregistry.projects.locations.repositories.packages.delete",
15577            http_method: hyper::Method::DELETE,
15578        });
15579
15580        for &field in ["alt", "name"].iter() {
15581            if self._additional_params.contains_key(field) {
15582                dlg.finished(false);
15583                return Err(common::Error::FieldClash(field));
15584            }
15585        }
15586
15587        let mut params = Params::with_capacity(3 + self._additional_params.len());
15588        params.push("name", self._name);
15589
15590        params.extend(self._additional_params.iter());
15591
15592        params.push("alt", "json");
15593        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15594        if self._scopes.is_empty() {
15595            self._scopes
15596                .insert(Scope::CloudPlatform.as_ref().to_string());
15597        }
15598
15599        #[allow(clippy::single_element_loop)]
15600        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15601            url = params.uri_replacement(url, param_name, find_this, true);
15602        }
15603        {
15604            let to_remove = ["name"];
15605            params.remove_params(&to_remove);
15606        }
15607
15608        let url = params.parse_with_url(&url);
15609
15610        loop {
15611            let token = match self
15612                .hub
15613                .auth
15614                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15615                .await
15616            {
15617                Ok(token) => token,
15618                Err(e) => match dlg.token(e) {
15619                    Ok(token) => token,
15620                    Err(e) => {
15621                        dlg.finished(false);
15622                        return Err(common::Error::MissingToken(e));
15623                    }
15624                },
15625            };
15626            let mut req_result = {
15627                let client = &self.hub.client;
15628                dlg.pre_request();
15629                let mut req_builder = hyper::Request::builder()
15630                    .method(hyper::Method::DELETE)
15631                    .uri(url.as_str())
15632                    .header(USER_AGENT, self.hub._user_agent.clone());
15633
15634                if let Some(token) = token.as_ref() {
15635                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15636                }
15637
15638                let request = req_builder
15639                    .header(CONTENT_LENGTH, 0_u64)
15640                    .body(common::to_body::<String>(None));
15641
15642                client.request(request.unwrap()).await
15643            };
15644
15645            match req_result {
15646                Err(err) => {
15647                    if let common::Retry::After(d) = dlg.http_error(&err) {
15648                        sleep(d).await;
15649                        continue;
15650                    }
15651                    dlg.finished(false);
15652                    return Err(common::Error::HttpError(err));
15653                }
15654                Ok(res) => {
15655                    let (mut parts, body) = res.into_parts();
15656                    let mut body = common::Body::new(body);
15657                    if !parts.status.is_success() {
15658                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15659                        let error = serde_json::from_str(&common::to_string(&bytes));
15660                        let response = common::to_response(parts, bytes.into());
15661
15662                        if let common::Retry::After(d) =
15663                            dlg.http_failure(&response, error.as_ref().ok())
15664                        {
15665                            sleep(d).await;
15666                            continue;
15667                        }
15668
15669                        dlg.finished(false);
15670
15671                        return Err(match error {
15672                            Ok(value) => common::Error::BadRequest(value),
15673                            _ => common::Error::Failure(response),
15674                        });
15675                    }
15676                    let response = {
15677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15678                        let encoded = common::to_string(&bytes);
15679                        match serde_json::from_str(&encoded) {
15680                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15681                            Err(error) => {
15682                                dlg.response_json_decode_error(&encoded, &error);
15683                                return Err(common::Error::JsonDecodeError(
15684                                    encoded.to_string(),
15685                                    error,
15686                                ));
15687                            }
15688                        }
15689                    };
15690
15691                    dlg.finished(true);
15692                    return Ok(response);
15693                }
15694            }
15695        }
15696    }
15697
15698    /// Required. The name of the package to delete.
15699    ///
15700    /// Sets the *name* path property to the given value.
15701    ///
15702    /// Even though the property as already been set when instantiating this call,
15703    /// we provide this method for API completeness.
15704    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
15705        self._name = new_value.to_string();
15706        self
15707    }
15708    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15709    /// while executing the actual API request.
15710    ///
15711    /// ````text
15712    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15713    /// ````
15714    ///
15715    /// Sets the *delegate* property to the given value.
15716    pub fn delegate(
15717        mut self,
15718        new_value: &'a mut dyn common::Delegate,
15719    ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
15720        self._delegate = Some(new_value);
15721        self
15722    }
15723
15724    /// Set any additional parameter of the query string used in the request.
15725    /// It should be used to set parameters which are not yet available through their own
15726    /// setters.
15727    ///
15728    /// Please note that this method must not be used to set any of the known parameters
15729    /// which have their own setter method. If done anyway, the request will fail.
15730    ///
15731    /// # Additional Parameters
15732    ///
15733    /// * *$.xgafv* (query-string) - V1 error format.
15734    /// * *access_token* (query-string) - OAuth access token.
15735    /// * *alt* (query-string) - Data format for response.
15736    /// * *callback* (query-string) - JSONP
15737    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15738    /// * *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.
15739    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15740    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15741    /// * *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.
15742    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15743    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15744    pub fn param<T>(
15745        mut self,
15746        name: T,
15747        value: T,
15748    ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C>
15749    where
15750        T: AsRef<str>,
15751    {
15752        self._additional_params
15753            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15754        self
15755    }
15756
15757    /// Identifies the authorization scope for the method you are building.
15758    ///
15759    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15760    /// [`Scope::CloudPlatform`].
15761    ///
15762    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15763    /// tokens for more than one scope.
15764    ///
15765    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15766    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15767    /// sufficient, a read-write scope will do as well.
15768    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageDeleteCall<'a, C>
15769    where
15770        St: AsRef<str>,
15771    {
15772        self._scopes.insert(String::from(scope.as_ref()));
15773        self
15774    }
15775    /// Identifies the authorization scope(s) for the method you are building.
15776    ///
15777    /// See [`Self::add_scope()`] for details.
15778    pub fn add_scopes<I, St>(
15779        mut self,
15780        scopes: I,
15781    ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C>
15782    where
15783        I: IntoIterator<Item = St>,
15784        St: AsRef<str>,
15785    {
15786        self._scopes
15787            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15788        self
15789    }
15790
15791    /// Removes all scopes, and no default scope will be used either.
15792    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15793    /// for details).
15794    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
15795        self._scopes.clear();
15796        self
15797    }
15798}
15799
15800/// Gets a package.
15801///
15802/// A builder for the *locations.repositories.packages.get* method supported by a *project* resource.
15803/// It is not used directly, but through a [`ProjectMethods`] instance.
15804///
15805/// # Example
15806///
15807/// Instantiate a resource method builder
15808///
15809/// ```test_harness,no_run
15810/// # extern crate hyper;
15811/// # extern crate hyper_rustls;
15812/// # extern crate google_artifactregistry1 as artifactregistry1;
15813/// # async fn dox() {
15814/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15815///
15816/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15817/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15818/// #     .with_native_roots()
15819/// #     .unwrap()
15820/// #     .https_only()
15821/// #     .enable_http2()
15822/// #     .build();
15823///
15824/// # let executor = hyper_util::rt::TokioExecutor::new();
15825/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15826/// #     secret,
15827/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15828/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15829/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15830/// #     ),
15831/// # ).build().await.unwrap();
15832///
15833/// # let client = hyper_util::client::legacy::Client::builder(
15834/// #     hyper_util::rt::TokioExecutor::new()
15835/// # )
15836/// # .build(
15837/// #     hyper_rustls::HttpsConnectorBuilder::new()
15838/// #         .with_native_roots()
15839/// #         .unwrap()
15840/// #         .https_or_http()
15841/// #         .enable_http2()
15842/// #         .build()
15843/// # );
15844/// # let mut hub = ArtifactRegistry::new(client, auth);
15845/// // You can configure optional parameters by calling the respective setters at will, and
15846/// // execute the final call using `doit()`.
15847/// // Values shown here are possibly random and not representative !
15848/// let result = hub.projects().locations_repositories_packages_get("name")
15849///              .doit().await;
15850/// # }
15851/// ```
15852pub struct ProjectLocationRepositoryPackageGetCall<'a, C>
15853where
15854    C: 'a,
15855{
15856    hub: &'a ArtifactRegistry<C>,
15857    _name: String,
15858    _delegate: Option<&'a mut dyn common::Delegate>,
15859    _additional_params: HashMap<String, String>,
15860    _scopes: BTreeSet<String>,
15861}
15862
15863impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageGetCall<'a, C> {}
15864
15865impl<'a, C> ProjectLocationRepositoryPackageGetCall<'a, C>
15866where
15867    C: common::Connector,
15868{
15869    /// Perform the operation you have build so far.
15870    pub async fn doit(mut self) -> common::Result<(common::Response, Package)> {
15871        use std::borrow::Cow;
15872        use std::io::{Read, Seek};
15873
15874        use common::{url::Params, ToParts};
15875        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15876
15877        let mut dd = common::DefaultDelegate;
15878        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15879        dlg.begin(common::MethodInfo {
15880            id: "artifactregistry.projects.locations.repositories.packages.get",
15881            http_method: hyper::Method::GET,
15882        });
15883
15884        for &field in ["alt", "name"].iter() {
15885            if self._additional_params.contains_key(field) {
15886                dlg.finished(false);
15887                return Err(common::Error::FieldClash(field));
15888            }
15889        }
15890
15891        let mut params = Params::with_capacity(3 + self._additional_params.len());
15892        params.push("name", self._name);
15893
15894        params.extend(self._additional_params.iter());
15895
15896        params.push("alt", "json");
15897        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15898        if self._scopes.is_empty() {
15899            self._scopes
15900                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
15901        }
15902
15903        #[allow(clippy::single_element_loop)]
15904        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15905            url = params.uri_replacement(url, param_name, find_this, true);
15906        }
15907        {
15908            let to_remove = ["name"];
15909            params.remove_params(&to_remove);
15910        }
15911
15912        let url = params.parse_with_url(&url);
15913
15914        loop {
15915            let token = match self
15916                .hub
15917                .auth
15918                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15919                .await
15920            {
15921                Ok(token) => token,
15922                Err(e) => match dlg.token(e) {
15923                    Ok(token) => token,
15924                    Err(e) => {
15925                        dlg.finished(false);
15926                        return Err(common::Error::MissingToken(e));
15927                    }
15928                },
15929            };
15930            let mut req_result = {
15931                let client = &self.hub.client;
15932                dlg.pre_request();
15933                let mut req_builder = hyper::Request::builder()
15934                    .method(hyper::Method::GET)
15935                    .uri(url.as_str())
15936                    .header(USER_AGENT, self.hub._user_agent.clone());
15937
15938                if let Some(token) = token.as_ref() {
15939                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15940                }
15941
15942                let request = req_builder
15943                    .header(CONTENT_LENGTH, 0_u64)
15944                    .body(common::to_body::<String>(None));
15945
15946                client.request(request.unwrap()).await
15947            };
15948
15949            match req_result {
15950                Err(err) => {
15951                    if let common::Retry::After(d) = dlg.http_error(&err) {
15952                        sleep(d).await;
15953                        continue;
15954                    }
15955                    dlg.finished(false);
15956                    return Err(common::Error::HttpError(err));
15957                }
15958                Ok(res) => {
15959                    let (mut parts, body) = res.into_parts();
15960                    let mut body = common::Body::new(body);
15961                    if !parts.status.is_success() {
15962                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15963                        let error = serde_json::from_str(&common::to_string(&bytes));
15964                        let response = common::to_response(parts, bytes.into());
15965
15966                        if let common::Retry::After(d) =
15967                            dlg.http_failure(&response, error.as_ref().ok())
15968                        {
15969                            sleep(d).await;
15970                            continue;
15971                        }
15972
15973                        dlg.finished(false);
15974
15975                        return Err(match error {
15976                            Ok(value) => common::Error::BadRequest(value),
15977                            _ => common::Error::Failure(response),
15978                        });
15979                    }
15980                    let response = {
15981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15982                        let encoded = common::to_string(&bytes);
15983                        match serde_json::from_str(&encoded) {
15984                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15985                            Err(error) => {
15986                                dlg.response_json_decode_error(&encoded, &error);
15987                                return Err(common::Error::JsonDecodeError(
15988                                    encoded.to_string(),
15989                                    error,
15990                                ));
15991                            }
15992                        }
15993                    };
15994
15995                    dlg.finished(true);
15996                    return Ok(response);
15997                }
15998            }
15999        }
16000    }
16001
16002    /// Required. The name of the package to retrieve.
16003    ///
16004    /// Sets the *name* path property to the given value.
16005    ///
16006    /// Even though the property as already been set when instantiating this call,
16007    /// we provide this method for API completeness.
16008    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
16009        self._name = new_value.to_string();
16010        self
16011    }
16012    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16013    /// while executing the actual API request.
16014    ///
16015    /// ````text
16016    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16017    /// ````
16018    ///
16019    /// Sets the *delegate* property to the given value.
16020    pub fn delegate(
16021        mut self,
16022        new_value: &'a mut dyn common::Delegate,
16023    ) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
16024        self._delegate = Some(new_value);
16025        self
16026    }
16027
16028    /// Set any additional parameter of the query string used in the request.
16029    /// It should be used to set parameters which are not yet available through their own
16030    /// setters.
16031    ///
16032    /// Please note that this method must not be used to set any of the known parameters
16033    /// which have their own setter method. If done anyway, the request will fail.
16034    ///
16035    /// # Additional Parameters
16036    ///
16037    /// * *$.xgafv* (query-string) - V1 error format.
16038    /// * *access_token* (query-string) - OAuth access token.
16039    /// * *alt* (query-string) - Data format for response.
16040    /// * *callback* (query-string) - JSONP
16041    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16042    /// * *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.
16043    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16044    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16045    /// * *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.
16046    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16047    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16048    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryPackageGetCall<'a, C>
16049    where
16050        T: AsRef<str>,
16051    {
16052        self._additional_params
16053            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16054        self
16055    }
16056
16057    /// Identifies the authorization scope for the method you are building.
16058    ///
16059    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16060    /// [`Scope::CloudPlatformReadOnly`].
16061    ///
16062    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16063    /// tokens for more than one scope.
16064    ///
16065    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16066    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16067    /// sufficient, a read-write scope will do as well.
16068    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageGetCall<'a, C>
16069    where
16070        St: AsRef<str>,
16071    {
16072        self._scopes.insert(String::from(scope.as_ref()));
16073        self
16074    }
16075    /// Identifies the authorization scope(s) for the method you are building.
16076    ///
16077    /// See [`Self::add_scope()`] for details.
16078    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryPackageGetCall<'a, C>
16079    where
16080        I: IntoIterator<Item = St>,
16081        St: AsRef<str>,
16082    {
16083        self._scopes
16084            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16085        self
16086    }
16087
16088    /// Removes all scopes, and no default scope will be used either.
16089    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16090    /// for details).
16091    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
16092        self._scopes.clear();
16093        self
16094    }
16095}
16096
16097/// Lists packages.
16098///
16099/// A builder for the *locations.repositories.packages.list* method supported by a *project* resource.
16100/// It is not used directly, but through a [`ProjectMethods`] instance.
16101///
16102/// # Example
16103///
16104/// Instantiate a resource method builder
16105///
16106/// ```test_harness,no_run
16107/// # extern crate hyper;
16108/// # extern crate hyper_rustls;
16109/// # extern crate google_artifactregistry1 as artifactregistry1;
16110/// # async fn dox() {
16111/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16112///
16113/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16114/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16115/// #     .with_native_roots()
16116/// #     .unwrap()
16117/// #     .https_only()
16118/// #     .enable_http2()
16119/// #     .build();
16120///
16121/// # let executor = hyper_util::rt::TokioExecutor::new();
16122/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16123/// #     secret,
16124/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16125/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16126/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16127/// #     ),
16128/// # ).build().await.unwrap();
16129///
16130/// # let client = hyper_util::client::legacy::Client::builder(
16131/// #     hyper_util::rt::TokioExecutor::new()
16132/// # )
16133/// # .build(
16134/// #     hyper_rustls::HttpsConnectorBuilder::new()
16135/// #         .with_native_roots()
16136/// #         .unwrap()
16137/// #         .https_or_http()
16138/// #         .enable_http2()
16139/// #         .build()
16140/// # );
16141/// # let mut hub = ArtifactRegistry::new(client, auth);
16142/// // You can configure optional parameters by calling the respective setters at will, and
16143/// // execute the final call using `doit()`.
16144/// // Values shown here are possibly random and not representative !
16145/// let result = hub.projects().locations_repositories_packages_list("parent")
16146///              .page_token("vero")
16147///              .page_size(-44)
16148///              .order_by("Lorem")
16149///              .filter("diam")
16150///              .doit().await;
16151/// # }
16152/// ```
16153pub struct ProjectLocationRepositoryPackageListCall<'a, C>
16154where
16155    C: 'a,
16156{
16157    hub: &'a ArtifactRegistry<C>,
16158    _parent: String,
16159    _page_token: Option<String>,
16160    _page_size: Option<i32>,
16161    _order_by: Option<String>,
16162    _filter: Option<String>,
16163    _delegate: Option<&'a mut dyn common::Delegate>,
16164    _additional_params: HashMap<String, String>,
16165    _scopes: BTreeSet<String>,
16166}
16167
16168impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageListCall<'a, C> {}
16169
16170impl<'a, C> ProjectLocationRepositoryPackageListCall<'a, C>
16171where
16172    C: common::Connector,
16173{
16174    /// Perform the operation you have build so far.
16175    pub async fn doit(mut self) -> common::Result<(common::Response, ListPackagesResponse)> {
16176        use std::borrow::Cow;
16177        use std::io::{Read, Seek};
16178
16179        use common::{url::Params, ToParts};
16180        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16181
16182        let mut dd = common::DefaultDelegate;
16183        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16184        dlg.begin(common::MethodInfo {
16185            id: "artifactregistry.projects.locations.repositories.packages.list",
16186            http_method: hyper::Method::GET,
16187        });
16188
16189        for &field in [
16190            "alt",
16191            "parent",
16192            "pageToken",
16193            "pageSize",
16194            "orderBy",
16195            "filter",
16196        ]
16197        .iter()
16198        {
16199            if self._additional_params.contains_key(field) {
16200                dlg.finished(false);
16201                return Err(common::Error::FieldClash(field));
16202            }
16203        }
16204
16205        let mut params = Params::with_capacity(7 + self._additional_params.len());
16206        params.push("parent", self._parent);
16207        if let Some(value) = self._page_token.as_ref() {
16208            params.push("pageToken", value);
16209        }
16210        if let Some(value) = self._page_size.as_ref() {
16211            params.push("pageSize", value.to_string());
16212        }
16213        if let Some(value) = self._order_by.as_ref() {
16214            params.push("orderBy", value);
16215        }
16216        if let Some(value) = self._filter.as_ref() {
16217            params.push("filter", value);
16218        }
16219
16220        params.extend(self._additional_params.iter());
16221
16222        params.push("alt", "json");
16223        let mut url = self.hub._base_url.clone() + "v1/{+parent}/packages";
16224        if self._scopes.is_empty() {
16225            self._scopes
16226                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
16227        }
16228
16229        #[allow(clippy::single_element_loop)]
16230        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16231            url = params.uri_replacement(url, param_name, find_this, true);
16232        }
16233        {
16234            let to_remove = ["parent"];
16235            params.remove_params(&to_remove);
16236        }
16237
16238        let url = params.parse_with_url(&url);
16239
16240        loop {
16241            let token = match self
16242                .hub
16243                .auth
16244                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16245                .await
16246            {
16247                Ok(token) => token,
16248                Err(e) => match dlg.token(e) {
16249                    Ok(token) => token,
16250                    Err(e) => {
16251                        dlg.finished(false);
16252                        return Err(common::Error::MissingToken(e));
16253                    }
16254                },
16255            };
16256            let mut req_result = {
16257                let client = &self.hub.client;
16258                dlg.pre_request();
16259                let mut req_builder = hyper::Request::builder()
16260                    .method(hyper::Method::GET)
16261                    .uri(url.as_str())
16262                    .header(USER_AGENT, self.hub._user_agent.clone());
16263
16264                if let Some(token) = token.as_ref() {
16265                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16266                }
16267
16268                let request = req_builder
16269                    .header(CONTENT_LENGTH, 0_u64)
16270                    .body(common::to_body::<String>(None));
16271
16272                client.request(request.unwrap()).await
16273            };
16274
16275            match req_result {
16276                Err(err) => {
16277                    if let common::Retry::After(d) = dlg.http_error(&err) {
16278                        sleep(d).await;
16279                        continue;
16280                    }
16281                    dlg.finished(false);
16282                    return Err(common::Error::HttpError(err));
16283                }
16284                Ok(res) => {
16285                    let (mut parts, body) = res.into_parts();
16286                    let mut body = common::Body::new(body);
16287                    if !parts.status.is_success() {
16288                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16289                        let error = serde_json::from_str(&common::to_string(&bytes));
16290                        let response = common::to_response(parts, bytes.into());
16291
16292                        if let common::Retry::After(d) =
16293                            dlg.http_failure(&response, error.as_ref().ok())
16294                        {
16295                            sleep(d).await;
16296                            continue;
16297                        }
16298
16299                        dlg.finished(false);
16300
16301                        return Err(match error {
16302                            Ok(value) => common::Error::BadRequest(value),
16303                            _ => common::Error::Failure(response),
16304                        });
16305                    }
16306                    let response = {
16307                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16308                        let encoded = common::to_string(&bytes);
16309                        match serde_json::from_str(&encoded) {
16310                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16311                            Err(error) => {
16312                                dlg.response_json_decode_error(&encoded, &error);
16313                                return Err(common::Error::JsonDecodeError(
16314                                    encoded.to_string(),
16315                                    error,
16316                                ));
16317                            }
16318                        }
16319                    };
16320
16321                    dlg.finished(true);
16322                    return Ok(response);
16323                }
16324            }
16325        }
16326    }
16327
16328    /// Required. The name of the parent resource whose packages will be listed.
16329    ///
16330    /// Sets the *parent* path property to the given value.
16331    ///
16332    /// Even though the property as already been set when instantiating this call,
16333    /// we provide this method for API completeness.
16334    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryPackageListCall<'a, C> {
16335        self._parent = new_value.to_string();
16336        self
16337    }
16338    /// The next_page_token value returned from a previous list request, if any.
16339    ///
16340    /// Sets the *page token* query property to the given value.
16341    pub fn page_token(
16342        mut self,
16343        new_value: &str,
16344    ) -> ProjectLocationRepositoryPackageListCall<'a, C> {
16345        self._page_token = Some(new_value.to_string());
16346        self
16347    }
16348    /// The maximum number of packages to return. Maximum page size is 1,000.
16349    ///
16350    /// Sets the *page size* query property to the given value.
16351    pub fn page_size(mut self, new_value: i32) -> ProjectLocationRepositoryPackageListCall<'a, C> {
16352        self._page_size = Some(new_value);
16353        self
16354    }
16355    /// Optional. The field to order the results by.
16356    ///
16357    /// Sets the *order by* query property to the given value.
16358    pub fn order_by(mut self, new_value: &str) -> ProjectLocationRepositoryPackageListCall<'a, C> {
16359        self._order_by = Some(new_value.to_string());
16360        self
16361    }
16362    /// Optional. An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: * `name` * `annotations` Examples of using a filter: To filter the results of your request to packages with the name `my-package` in project `my-project` in the `us-central` region, in repository `my-repo`, append the following filter expression to your request: * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-package"` You can also use wildcards to match any number of characters before or after the value: * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/my-*"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/*package"` * `name="projects/my-project/locations/us-central1/repositories/my-repo/packages/*pack*"` To filter the results of your request to packages with the annotation key-value pair [`external_link`: `external_link_value`], append the following filter expression to your request": * `"annotations.external_link:external_link_value"` To filter the results just for a specific annotation key `external_link`, append the following filter expression to your request: * `"annotations.external_link"` If the annotation key or value contains special characters, you can escape them by surrounding the value with backticks. For example, to filter the results of your request to packages with the annotation key-value pair [`external.link`:`https://example.com/my-package`], append the following filter expression to your request: * `` "annotations.`external.link`:`https://example.com/my-package`" `` You can also filter with annotations with a wildcard to match any number of characters before or after the value: * `` "annotations.*_link:`*example.com*`" ``
16363    ///
16364    /// Sets the *filter* query property to the given value.
16365    pub fn filter(mut self, new_value: &str) -> ProjectLocationRepositoryPackageListCall<'a, C> {
16366        self._filter = Some(new_value.to_string());
16367        self
16368    }
16369    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16370    /// while executing the actual API request.
16371    ///
16372    /// ````text
16373    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16374    /// ````
16375    ///
16376    /// Sets the *delegate* property to the given value.
16377    pub fn delegate(
16378        mut self,
16379        new_value: &'a mut dyn common::Delegate,
16380    ) -> ProjectLocationRepositoryPackageListCall<'a, C> {
16381        self._delegate = Some(new_value);
16382        self
16383    }
16384
16385    /// Set any additional parameter of the query string used in the request.
16386    /// It should be used to set parameters which are not yet available through their own
16387    /// setters.
16388    ///
16389    /// Please note that this method must not be used to set any of the known parameters
16390    /// which have their own setter method. If done anyway, the request will fail.
16391    ///
16392    /// # Additional Parameters
16393    ///
16394    /// * *$.xgafv* (query-string) - V1 error format.
16395    /// * *access_token* (query-string) - OAuth access token.
16396    /// * *alt* (query-string) - Data format for response.
16397    /// * *callback* (query-string) - JSONP
16398    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16399    /// * *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.
16400    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16401    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16402    /// * *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.
16403    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16404    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16405    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryPackageListCall<'a, C>
16406    where
16407        T: AsRef<str>,
16408    {
16409        self._additional_params
16410            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16411        self
16412    }
16413
16414    /// Identifies the authorization scope for the method you are building.
16415    ///
16416    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16417    /// [`Scope::CloudPlatformReadOnly`].
16418    ///
16419    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16420    /// tokens for more than one scope.
16421    ///
16422    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16423    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16424    /// sufficient, a read-write scope will do as well.
16425    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageListCall<'a, C>
16426    where
16427        St: AsRef<str>,
16428    {
16429        self._scopes.insert(String::from(scope.as_ref()));
16430        self
16431    }
16432    /// Identifies the authorization scope(s) for the method you are building.
16433    ///
16434    /// See [`Self::add_scope()`] for details.
16435    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryPackageListCall<'a, C>
16436    where
16437        I: IntoIterator<Item = St>,
16438        St: AsRef<str>,
16439    {
16440        self._scopes
16441            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16442        self
16443    }
16444
16445    /// Removes all scopes, and no default scope will be used either.
16446    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16447    /// for details).
16448    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageListCall<'a, C> {
16449        self._scopes.clear();
16450        self
16451    }
16452}
16453
16454/// Updates a package.
16455///
16456/// A builder for the *locations.repositories.packages.patch* method supported by a *project* resource.
16457/// It is not used directly, but through a [`ProjectMethods`] instance.
16458///
16459/// # Example
16460///
16461/// Instantiate a resource method builder
16462///
16463/// ```test_harness,no_run
16464/// # extern crate hyper;
16465/// # extern crate hyper_rustls;
16466/// # extern crate google_artifactregistry1 as artifactregistry1;
16467/// use artifactregistry1::api::Package;
16468/// # async fn dox() {
16469/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16470///
16471/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16472/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16473/// #     .with_native_roots()
16474/// #     .unwrap()
16475/// #     .https_only()
16476/// #     .enable_http2()
16477/// #     .build();
16478///
16479/// # let executor = hyper_util::rt::TokioExecutor::new();
16480/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16481/// #     secret,
16482/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16483/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16484/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16485/// #     ),
16486/// # ).build().await.unwrap();
16487///
16488/// # let client = hyper_util::client::legacy::Client::builder(
16489/// #     hyper_util::rt::TokioExecutor::new()
16490/// # )
16491/// # .build(
16492/// #     hyper_rustls::HttpsConnectorBuilder::new()
16493/// #         .with_native_roots()
16494/// #         .unwrap()
16495/// #         .https_or_http()
16496/// #         .enable_http2()
16497/// #         .build()
16498/// # );
16499/// # let mut hub = ArtifactRegistry::new(client, auth);
16500/// // As the method needs a request, you would usually fill it with the desired information
16501/// // into the respective structure. Some of the parts shown here might not be applicable !
16502/// // Values shown here are possibly random and not representative !
16503/// let mut req = Package::default();
16504///
16505/// // You can configure optional parameters by calling the respective setters at will, and
16506/// // execute the final call using `doit()`.
16507/// // Values shown here are possibly random and not representative !
16508/// let result = hub.projects().locations_repositories_packages_patch(req, "name")
16509///              .update_mask(FieldMask::new::<&str>(&[]))
16510///              .doit().await;
16511/// # }
16512/// ```
16513pub struct ProjectLocationRepositoryPackagePatchCall<'a, C>
16514where
16515    C: 'a,
16516{
16517    hub: &'a ArtifactRegistry<C>,
16518    _request: Package,
16519    _name: String,
16520    _update_mask: Option<common::FieldMask>,
16521    _delegate: Option<&'a mut dyn common::Delegate>,
16522    _additional_params: HashMap<String, String>,
16523    _scopes: BTreeSet<String>,
16524}
16525
16526impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackagePatchCall<'a, C> {}
16527
16528impl<'a, C> ProjectLocationRepositoryPackagePatchCall<'a, C>
16529where
16530    C: common::Connector,
16531{
16532    /// Perform the operation you have build so far.
16533    pub async fn doit(mut self) -> common::Result<(common::Response, Package)> {
16534        use std::borrow::Cow;
16535        use std::io::{Read, Seek};
16536
16537        use common::{url::Params, ToParts};
16538        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16539
16540        let mut dd = common::DefaultDelegate;
16541        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16542        dlg.begin(common::MethodInfo {
16543            id: "artifactregistry.projects.locations.repositories.packages.patch",
16544            http_method: hyper::Method::PATCH,
16545        });
16546
16547        for &field in ["alt", "name", "updateMask"].iter() {
16548            if self._additional_params.contains_key(field) {
16549                dlg.finished(false);
16550                return Err(common::Error::FieldClash(field));
16551            }
16552        }
16553
16554        let mut params = Params::with_capacity(5 + self._additional_params.len());
16555        params.push("name", self._name);
16556        if let Some(value) = self._update_mask.as_ref() {
16557            params.push("updateMask", value.to_string());
16558        }
16559
16560        params.extend(self._additional_params.iter());
16561
16562        params.push("alt", "json");
16563        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16564        if self._scopes.is_empty() {
16565            self._scopes
16566                .insert(Scope::CloudPlatform.as_ref().to_string());
16567        }
16568
16569        #[allow(clippy::single_element_loop)]
16570        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16571            url = params.uri_replacement(url, param_name, find_this, true);
16572        }
16573        {
16574            let to_remove = ["name"];
16575            params.remove_params(&to_remove);
16576        }
16577
16578        let url = params.parse_with_url(&url);
16579
16580        let mut json_mime_type = mime::APPLICATION_JSON;
16581        let mut request_value_reader = {
16582            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16583            common::remove_json_null_values(&mut value);
16584            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16585            serde_json::to_writer(&mut dst, &value).unwrap();
16586            dst
16587        };
16588        let request_size = request_value_reader
16589            .seek(std::io::SeekFrom::End(0))
16590            .unwrap();
16591        request_value_reader
16592            .seek(std::io::SeekFrom::Start(0))
16593            .unwrap();
16594
16595        loop {
16596            let token = match self
16597                .hub
16598                .auth
16599                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16600                .await
16601            {
16602                Ok(token) => token,
16603                Err(e) => match dlg.token(e) {
16604                    Ok(token) => token,
16605                    Err(e) => {
16606                        dlg.finished(false);
16607                        return Err(common::Error::MissingToken(e));
16608                    }
16609                },
16610            };
16611            request_value_reader
16612                .seek(std::io::SeekFrom::Start(0))
16613                .unwrap();
16614            let mut req_result = {
16615                let client = &self.hub.client;
16616                dlg.pre_request();
16617                let mut req_builder = hyper::Request::builder()
16618                    .method(hyper::Method::PATCH)
16619                    .uri(url.as_str())
16620                    .header(USER_AGENT, self.hub._user_agent.clone());
16621
16622                if let Some(token) = token.as_ref() {
16623                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16624                }
16625
16626                let request = req_builder
16627                    .header(CONTENT_TYPE, json_mime_type.to_string())
16628                    .header(CONTENT_LENGTH, request_size as u64)
16629                    .body(common::to_body(
16630                        request_value_reader.get_ref().clone().into(),
16631                    ));
16632
16633                client.request(request.unwrap()).await
16634            };
16635
16636            match req_result {
16637                Err(err) => {
16638                    if let common::Retry::After(d) = dlg.http_error(&err) {
16639                        sleep(d).await;
16640                        continue;
16641                    }
16642                    dlg.finished(false);
16643                    return Err(common::Error::HttpError(err));
16644                }
16645                Ok(res) => {
16646                    let (mut parts, body) = res.into_parts();
16647                    let mut body = common::Body::new(body);
16648                    if !parts.status.is_success() {
16649                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16650                        let error = serde_json::from_str(&common::to_string(&bytes));
16651                        let response = common::to_response(parts, bytes.into());
16652
16653                        if let common::Retry::After(d) =
16654                            dlg.http_failure(&response, error.as_ref().ok())
16655                        {
16656                            sleep(d).await;
16657                            continue;
16658                        }
16659
16660                        dlg.finished(false);
16661
16662                        return Err(match error {
16663                            Ok(value) => common::Error::BadRequest(value),
16664                            _ => common::Error::Failure(response),
16665                        });
16666                    }
16667                    let response = {
16668                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16669                        let encoded = common::to_string(&bytes);
16670                        match serde_json::from_str(&encoded) {
16671                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16672                            Err(error) => {
16673                                dlg.response_json_decode_error(&encoded, &error);
16674                                return Err(common::Error::JsonDecodeError(
16675                                    encoded.to_string(),
16676                                    error,
16677                                ));
16678                            }
16679                        }
16680                    };
16681
16682                    dlg.finished(true);
16683                    return Ok(response);
16684                }
16685            }
16686        }
16687    }
16688
16689    ///
16690    /// Sets the *request* property to the given value.
16691    ///
16692    /// Even though the property as already been set when instantiating this call,
16693    /// we provide this method for API completeness.
16694    pub fn request(
16695        mut self,
16696        new_value: Package,
16697    ) -> ProjectLocationRepositoryPackagePatchCall<'a, C> {
16698        self._request = new_value;
16699        self
16700    }
16701    /// The name of the package, for example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1`. If the package ID part contains slashes, the slashes are escaped.
16702    ///
16703    /// Sets the *name* path property to the given value.
16704    ///
16705    /// Even though the property as already been set when instantiating this call,
16706    /// we provide this method for API completeness.
16707    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackagePatchCall<'a, C> {
16708        self._name = new_value.to_string();
16709        self
16710    }
16711    /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
16712    ///
16713    /// Sets the *update mask* query property to the given value.
16714    pub fn update_mask(
16715        mut self,
16716        new_value: common::FieldMask,
16717    ) -> ProjectLocationRepositoryPackagePatchCall<'a, C> {
16718        self._update_mask = Some(new_value);
16719        self
16720    }
16721    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16722    /// while executing the actual API request.
16723    ///
16724    /// ````text
16725    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16726    /// ````
16727    ///
16728    /// Sets the *delegate* property to the given value.
16729    pub fn delegate(
16730        mut self,
16731        new_value: &'a mut dyn common::Delegate,
16732    ) -> ProjectLocationRepositoryPackagePatchCall<'a, C> {
16733        self._delegate = Some(new_value);
16734        self
16735    }
16736
16737    /// Set any additional parameter of the query string used in the request.
16738    /// It should be used to set parameters which are not yet available through their own
16739    /// setters.
16740    ///
16741    /// Please note that this method must not be used to set any of the known parameters
16742    /// which have their own setter method. If done anyway, the request will fail.
16743    ///
16744    /// # Additional Parameters
16745    ///
16746    /// * *$.xgafv* (query-string) - V1 error format.
16747    /// * *access_token* (query-string) - OAuth access token.
16748    /// * *alt* (query-string) - Data format for response.
16749    /// * *callback* (query-string) - JSONP
16750    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16751    /// * *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.
16752    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16753    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16754    /// * *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.
16755    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16756    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16757    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryPackagePatchCall<'a, C>
16758    where
16759        T: AsRef<str>,
16760    {
16761        self._additional_params
16762            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16763        self
16764    }
16765
16766    /// Identifies the authorization scope for the method you are building.
16767    ///
16768    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16769    /// [`Scope::CloudPlatform`].
16770    ///
16771    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16772    /// tokens for more than one scope.
16773    ///
16774    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16775    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16776    /// sufficient, a read-write scope will do as well.
16777    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackagePatchCall<'a, C>
16778    where
16779        St: AsRef<str>,
16780    {
16781        self._scopes.insert(String::from(scope.as_ref()));
16782        self
16783    }
16784    /// Identifies the authorization scope(s) for the method you are building.
16785    ///
16786    /// See [`Self::add_scope()`] for details.
16787    pub fn add_scopes<I, St>(
16788        mut self,
16789        scopes: I,
16790    ) -> ProjectLocationRepositoryPackagePatchCall<'a, C>
16791    where
16792        I: IntoIterator<Item = St>,
16793        St: AsRef<str>,
16794    {
16795        self._scopes
16796            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16797        self
16798    }
16799
16800    /// Removes all scopes, and no default scope will be used either.
16801    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16802    /// for details).
16803    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackagePatchCall<'a, C> {
16804        self._scopes.clear();
16805        self
16806    }
16807}
16808
16809/// Gets a python package.
16810///
16811/// A builder for the *locations.repositories.pythonPackages.get* method supported by a *project* resource.
16812/// It is not used directly, but through a [`ProjectMethods`] instance.
16813///
16814/// # Example
16815///
16816/// Instantiate a resource method builder
16817///
16818/// ```test_harness,no_run
16819/// # extern crate hyper;
16820/// # extern crate hyper_rustls;
16821/// # extern crate google_artifactregistry1 as artifactregistry1;
16822/// # async fn dox() {
16823/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16824///
16825/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16826/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16827/// #     .with_native_roots()
16828/// #     .unwrap()
16829/// #     .https_only()
16830/// #     .enable_http2()
16831/// #     .build();
16832///
16833/// # let executor = hyper_util::rt::TokioExecutor::new();
16834/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16835/// #     secret,
16836/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16837/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16838/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16839/// #     ),
16840/// # ).build().await.unwrap();
16841///
16842/// # let client = hyper_util::client::legacy::Client::builder(
16843/// #     hyper_util::rt::TokioExecutor::new()
16844/// # )
16845/// # .build(
16846/// #     hyper_rustls::HttpsConnectorBuilder::new()
16847/// #         .with_native_roots()
16848/// #         .unwrap()
16849/// #         .https_or_http()
16850/// #         .enable_http2()
16851/// #         .build()
16852/// # );
16853/// # let mut hub = ArtifactRegistry::new(client, auth);
16854/// // You can configure optional parameters by calling the respective setters at will, and
16855/// // execute the final call using `doit()`.
16856/// // Values shown here are possibly random and not representative !
16857/// let result = hub.projects().locations_repositories_python_packages_get("name")
16858///              .doit().await;
16859/// # }
16860/// ```
16861pub struct ProjectLocationRepositoryPythonPackageGetCall<'a, C>
16862where
16863    C: 'a,
16864{
16865    hub: &'a ArtifactRegistry<C>,
16866    _name: String,
16867    _delegate: Option<&'a mut dyn common::Delegate>,
16868    _additional_params: HashMap<String, String>,
16869    _scopes: BTreeSet<String>,
16870}
16871
16872impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPythonPackageGetCall<'a, C> {}
16873
16874impl<'a, C> ProjectLocationRepositoryPythonPackageGetCall<'a, C>
16875where
16876    C: common::Connector,
16877{
16878    /// Perform the operation you have build so far.
16879    pub async fn doit(mut self) -> common::Result<(common::Response, PythonPackage)> {
16880        use std::borrow::Cow;
16881        use std::io::{Read, Seek};
16882
16883        use common::{url::Params, ToParts};
16884        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16885
16886        let mut dd = common::DefaultDelegate;
16887        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16888        dlg.begin(common::MethodInfo {
16889            id: "artifactregistry.projects.locations.repositories.pythonPackages.get",
16890            http_method: hyper::Method::GET,
16891        });
16892
16893        for &field in ["alt", "name"].iter() {
16894            if self._additional_params.contains_key(field) {
16895                dlg.finished(false);
16896                return Err(common::Error::FieldClash(field));
16897            }
16898        }
16899
16900        let mut params = Params::with_capacity(3 + self._additional_params.len());
16901        params.push("name", self._name);
16902
16903        params.extend(self._additional_params.iter());
16904
16905        params.push("alt", "json");
16906        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16907        if self._scopes.is_empty() {
16908            self._scopes
16909                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
16910        }
16911
16912        #[allow(clippy::single_element_loop)]
16913        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16914            url = params.uri_replacement(url, param_name, find_this, true);
16915        }
16916        {
16917            let to_remove = ["name"];
16918            params.remove_params(&to_remove);
16919        }
16920
16921        let url = params.parse_with_url(&url);
16922
16923        loop {
16924            let token = match self
16925                .hub
16926                .auth
16927                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16928                .await
16929            {
16930                Ok(token) => token,
16931                Err(e) => match dlg.token(e) {
16932                    Ok(token) => token,
16933                    Err(e) => {
16934                        dlg.finished(false);
16935                        return Err(common::Error::MissingToken(e));
16936                    }
16937                },
16938            };
16939            let mut req_result = {
16940                let client = &self.hub.client;
16941                dlg.pre_request();
16942                let mut req_builder = hyper::Request::builder()
16943                    .method(hyper::Method::GET)
16944                    .uri(url.as_str())
16945                    .header(USER_AGENT, self.hub._user_agent.clone());
16946
16947                if let Some(token) = token.as_ref() {
16948                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16949                }
16950
16951                let request = req_builder
16952                    .header(CONTENT_LENGTH, 0_u64)
16953                    .body(common::to_body::<String>(None));
16954
16955                client.request(request.unwrap()).await
16956            };
16957
16958            match req_result {
16959                Err(err) => {
16960                    if let common::Retry::After(d) = dlg.http_error(&err) {
16961                        sleep(d).await;
16962                        continue;
16963                    }
16964                    dlg.finished(false);
16965                    return Err(common::Error::HttpError(err));
16966                }
16967                Ok(res) => {
16968                    let (mut parts, body) = res.into_parts();
16969                    let mut body = common::Body::new(body);
16970                    if !parts.status.is_success() {
16971                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16972                        let error = serde_json::from_str(&common::to_string(&bytes));
16973                        let response = common::to_response(parts, bytes.into());
16974
16975                        if let common::Retry::After(d) =
16976                            dlg.http_failure(&response, error.as_ref().ok())
16977                        {
16978                            sleep(d).await;
16979                            continue;
16980                        }
16981
16982                        dlg.finished(false);
16983
16984                        return Err(match error {
16985                            Ok(value) => common::Error::BadRequest(value),
16986                            _ => common::Error::Failure(response),
16987                        });
16988                    }
16989                    let response = {
16990                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16991                        let encoded = common::to_string(&bytes);
16992                        match serde_json::from_str(&encoded) {
16993                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16994                            Err(error) => {
16995                                dlg.response_json_decode_error(&encoded, &error);
16996                                return Err(common::Error::JsonDecodeError(
16997                                    encoded.to_string(),
16998                                    error,
16999                                ));
17000                            }
17001                        }
17002                    };
17003
17004                    dlg.finished(true);
17005                    return Ok(response);
17006                }
17007            }
17008        }
17009    }
17010
17011    /// Required. The name of the python package.
17012    ///
17013    /// Sets the *name* path property to the given value.
17014    ///
17015    /// Even though the property as already been set when instantiating this call,
17016    /// we provide this method for API completeness.
17017    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPythonPackageGetCall<'a, C> {
17018        self._name = new_value.to_string();
17019        self
17020    }
17021    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17022    /// while executing the actual API request.
17023    ///
17024    /// ````text
17025    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17026    /// ````
17027    ///
17028    /// Sets the *delegate* property to the given value.
17029    pub fn delegate(
17030        mut self,
17031        new_value: &'a mut dyn common::Delegate,
17032    ) -> ProjectLocationRepositoryPythonPackageGetCall<'a, C> {
17033        self._delegate = Some(new_value);
17034        self
17035    }
17036
17037    /// Set any additional parameter of the query string used in the request.
17038    /// It should be used to set parameters which are not yet available through their own
17039    /// setters.
17040    ///
17041    /// Please note that this method must not be used to set any of the known parameters
17042    /// which have their own setter method. If done anyway, the request will fail.
17043    ///
17044    /// # Additional Parameters
17045    ///
17046    /// * *$.xgafv* (query-string) - V1 error format.
17047    /// * *access_token* (query-string) - OAuth access token.
17048    /// * *alt* (query-string) - Data format for response.
17049    /// * *callback* (query-string) - JSONP
17050    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17051    /// * *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.
17052    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17053    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17054    /// * *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.
17055    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17056    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17057    pub fn param<T>(
17058        mut self,
17059        name: T,
17060        value: T,
17061    ) -> ProjectLocationRepositoryPythonPackageGetCall<'a, C>
17062    where
17063        T: AsRef<str>,
17064    {
17065        self._additional_params
17066            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17067        self
17068    }
17069
17070    /// Identifies the authorization scope for the method you are building.
17071    ///
17072    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17073    /// [`Scope::CloudPlatformReadOnly`].
17074    ///
17075    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17076    /// tokens for more than one scope.
17077    ///
17078    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17079    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17080    /// sufficient, a read-write scope will do as well.
17081    pub fn add_scope<St>(
17082        mut self,
17083        scope: St,
17084    ) -> ProjectLocationRepositoryPythonPackageGetCall<'a, C>
17085    where
17086        St: AsRef<str>,
17087    {
17088        self._scopes.insert(String::from(scope.as_ref()));
17089        self
17090    }
17091    /// Identifies the authorization scope(s) for the method you are building.
17092    ///
17093    /// See [`Self::add_scope()`] for details.
17094    pub fn add_scopes<I, St>(
17095        mut self,
17096        scopes: I,
17097    ) -> ProjectLocationRepositoryPythonPackageGetCall<'a, C>
17098    where
17099        I: IntoIterator<Item = St>,
17100        St: AsRef<str>,
17101    {
17102        self._scopes
17103            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17104        self
17105    }
17106
17107    /// Removes all scopes, and no default scope will be used either.
17108    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17109    /// for details).
17110    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPythonPackageGetCall<'a, C> {
17111        self._scopes.clear();
17112        self
17113    }
17114}
17115
17116/// Lists python packages.
17117///
17118/// A builder for the *locations.repositories.pythonPackages.list* method supported by a *project* resource.
17119/// It is not used directly, but through a [`ProjectMethods`] instance.
17120///
17121/// # Example
17122///
17123/// Instantiate a resource method builder
17124///
17125/// ```test_harness,no_run
17126/// # extern crate hyper;
17127/// # extern crate hyper_rustls;
17128/// # extern crate google_artifactregistry1 as artifactregistry1;
17129/// # async fn dox() {
17130/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17131///
17132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17133/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17134/// #     .with_native_roots()
17135/// #     .unwrap()
17136/// #     .https_only()
17137/// #     .enable_http2()
17138/// #     .build();
17139///
17140/// # let executor = hyper_util::rt::TokioExecutor::new();
17141/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17142/// #     secret,
17143/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17144/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17145/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17146/// #     ),
17147/// # ).build().await.unwrap();
17148///
17149/// # let client = hyper_util::client::legacy::Client::builder(
17150/// #     hyper_util::rt::TokioExecutor::new()
17151/// # )
17152/// # .build(
17153/// #     hyper_rustls::HttpsConnectorBuilder::new()
17154/// #         .with_native_roots()
17155/// #         .unwrap()
17156/// #         .https_or_http()
17157/// #         .enable_http2()
17158/// #         .build()
17159/// # );
17160/// # let mut hub = ArtifactRegistry::new(client, auth);
17161/// // You can configure optional parameters by calling the respective setters at will, and
17162/// // execute the final call using `doit()`.
17163/// // Values shown here are possibly random and not representative !
17164/// let result = hub.projects().locations_repositories_python_packages_list("parent")
17165///              .page_token("takimata")
17166///              .page_size(-46)
17167///              .doit().await;
17168/// # }
17169/// ```
17170pub struct ProjectLocationRepositoryPythonPackageListCall<'a, C>
17171where
17172    C: 'a,
17173{
17174    hub: &'a ArtifactRegistry<C>,
17175    _parent: String,
17176    _page_token: Option<String>,
17177    _page_size: Option<i32>,
17178    _delegate: Option<&'a mut dyn common::Delegate>,
17179    _additional_params: HashMap<String, String>,
17180    _scopes: BTreeSet<String>,
17181}
17182
17183impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPythonPackageListCall<'a, C> {}
17184
17185impl<'a, C> ProjectLocationRepositoryPythonPackageListCall<'a, C>
17186where
17187    C: common::Connector,
17188{
17189    /// Perform the operation you have build so far.
17190    pub async fn doit(mut self) -> common::Result<(common::Response, ListPythonPackagesResponse)> {
17191        use std::borrow::Cow;
17192        use std::io::{Read, Seek};
17193
17194        use common::{url::Params, ToParts};
17195        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17196
17197        let mut dd = common::DefaultDelegate;
17198        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17199        dlg.begin(common::MethodInfo {
17200            id: "artifactregistry.projects.locations.repositories.pythonPackages.list",
17201            http_method: hyper::Method::GET,
17202        });
17203
17204        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
17205            if self._additional_params.contains_key(field) {
17206                dlg.finished(false);
17207                return Err(common::Error::FieldClash(field));
17208            }
17209        }
17210
17211        let mut params = Params::with_capacity(5 + self._additional_params.len());
17212        params.push("parent", self._parent);
17213        if let Some(value) = self._page_token.as_ref() {
17214            params.push("pageToken", value);
17215        }
17216        if let Some(value) = self._page_size.as_ref() {
17217            params.push("pageSize", value.to_string());
17218        }
17219
17220        params.extend(self._additional_params.iter());
17221
17222        params.push("alt", "json");
17223        let mut url = self.hub._base_url.clone() + "v1/{+parent}/pythonPackages";
17224        if self._scopes.is_empty() {
17225            self._scopes
17226                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
17227        }
17228
17229        #[allow(clippy::single_element_loop)]
17230        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17231            url = params.uri_replacement(url, param_name, find_this, true);
17232        }
17233        {
17234            let to_remove = ["parent"];
17235            params.remove_params(&to_remove);
17236        }
17237
17238        let url = params.parse_with_url(&url);
17239
17240        loop {
17241            let token = match self
17242                .hub
17243                .auth
17244                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17245                .await
17246            {
17247                Ok(token) => token,
17248                Err(e) => match dlg.token(e) {
17249                    Ok(token) => token,
17250                    Err(e) => {
17251                        dlg.finished(false);
17252                        return Err(common::Error::MissingToken(e));
17253                    }
17254                },
17255            };
17256            let mut req_result = {
17257                let client = &self.hub.client;
17258                dlg.pre_request();
17259                let mut req_builder = hyper::Request::builder()
17260                    .method(hyper::Method::GET)
17261                    .uri(url.as_str())
17262                    .header(USER_AGENT, self.hub._user_agent.clone());
17263
17264                if let Some(token) = token.as_ref() {
17265                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17266                }
17267
17268                let request = req_builder
17269                    .header(CONTENT_LENGTH, 0_u64)
17270                    .body(common::to_body::<String>(None));
17271
17272                client.request(request.unwrap()).await
17273            };
17274
17275            match req_result {
17276                Err(err) => {
17277                    if let common::Retry::After(d) = dlg.http_error(&err) {
17278                        sleep(d).await;
17279                        continue;
17280                    }
17281                    dlg.finished(false);
17282                    return Err(common::Error::HttpError(err));
17283                }
17284                Ok(res) => {
17285                    let (mut parts, body) = res.into_parts();
17286                    let mut body = common::Body::new(body);
17287                    if !parts.status.is_success() {
17288                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17289                        let error = serde_json::from_str(&common::to_string(&bytes));
17290                        let response = common::to_response(parts, bytes.into());
17291
17292                        if let common::Retry::After(d) =
17293                            dlg.http_failure(&response, error.as_ref().ok())
17294                        {
17295                            sleep(d).await;
17296                            continue;
17297                        }
17298
17299                        dlg.finished(false);
17300
17301                        return Err(match error {
17302                            Ok(value) => common::Error::BadRequest(value),
17303                            _ => common::Error::Failure(response),
17304                        });
17305                    }
17306                    let response = {
17307                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17308                        let encoded = common::to_string(&bytes);
17309                        match serde_json::from_str(&encoded) {
17310                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17311                            Err(error) => {
17312                                dlg.response_json_decode_error(&encoded, &error);
17313                                return Err(common::Error::JsonDecodeError(
17314                                    encoded.to_string(),
17315                                    error,
17316                                ));
17317                            }
17318                        }
17319                    };
17320
17321                    dlg.finished(true);
17322                    return Ok(response);
17323                }
17324            }
17325        }
17326    }
17327
17328    /// Required. The name of the parent resource whose python packages will be listed.
17329    ///
17330    /// Sets the *parent* path property to the given value.
17331    ///
17332    /// Even though the property as already been set when instantiating this call,
17333    /// we provide this method for API completeness.
17334    pub fn parent(
17335        mut self,
17336        new_value: &str,
17337    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C> {
17338        self._parent = new_value.to_string();
17339        self
17340    }
17341    /// The next_page_token value returned from a previous list request, if any.
17342    ///
17343    /// Sets the *page token* query property to the given value.
17344    pub fn page_token(
17345        mut self,
17346        new_value: &str,
17347    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C> {
17348        self._page_token = Some(new_value.to_string());
17349        self
17350    }
17351    /// The maximum number of artifacts to return. Maximum page size is 1,000.
17352    ///
17353    /// Sets the *page size* query property to the given value.
17354    pub fn page_size(
17355        mut self,
17356        new_value: i32,
17357    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C> {
17358        self._page_size = Some(new_value);
17359        self
17360    }
17361    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17362    /// while executing the actual API request.
17363    ///
17364    /// ````text
17365    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17366    /// ````
17367    ///
17368    /// Sets the *delegate* property to the given value.
17369    pub fn delegate(
17370        mut self,
17371        new_value: &'a mut dyn common::Delegate,
17372    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C> {
17373        self._delegate = Some(new_value);
17374        self
17375    }
17376
17377    /// Set any additional parameter of the query string used in the request.
17378    /// It should be used to set parameters which are not yet available through their own
17379    /// setters.
17380    ///
17381    /// Please note that this method must not be used to set any of the known parameters
17382    /// which have their own setter method. If done anyway, the request will fail.
17383    ///
17384    /// # Additional Parameters
17385    ///
17386    /// * *$.xgafv* (query-string) - V1 error format.
17387    /// * *access_token* (query-string) - OAuth access token.
17388    /// * *alt* (query-string) - Data format for response.
17389    /// * *callback* (query-string) - JSONP
17390    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17391    /// * *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.
17392    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17393    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17394    /// * *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.
17395    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17396    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17397    pub fn param<T>(
17398        mut self,
17399        name: T,
17400        value: T,
17401    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C>
17402    where
17403        T: AsRef<str>,
17404    {
17405        self._additional_params
17406            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17407        self
17408    }
17409
17410    /// Identifies the authorization scope for the method you are building.
17411    ///
17412    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17413    /// [`Scope::CloudPlatformReadOnly`].
17414    ///
17415    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17416    /// tokens for more than one scope.
17417    ///
17418    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17419    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17420    /// sufficient, a read-write scope will do as well.
17421    pub fn add_scope<St>(
17422        mut self,
17423        scope: St,
17424    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C>
17425    where
17426        St: AsRef<str>,
17427    {
17428        self._scopes.insert(String::from(scope.as_ref()));
17429        self
17430    }
17431    /// Identifies the authorization scope(s) for the method you are building.
17432    ///
17433    /// See [`Self::add_scope()`] for details.
17434    pub fn add_scopes<I, St>(
17435        mut self,
17436        scopes: I,
17437    ) -> ProjectLocationRepositoryPythonPackageListCall<'a, C>
17438    where
17439        I: IntoIterator<Item = St>,
17440        St: AsRef<str>,
17441    {
17442        self._scopes
17443            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17444        self
17445    }
17446
17447    /// Removes all scopes, and no default scope will be used either.
17448    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17449    /// for details).
17450    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPythonPackageListCall<'a, C> {
17451        self._scopes.clear();
17452        self
17453    }
17454}
17455
17456/// Creates a rule.
17457///
17458/// A builder for the *locations.repositories.rules.create* method supported by a *project* resource.
17459/// It is not used directly, but through a [`ProjectMethods`] instance.
17460///
17461/// # Example
17462///
17463/// Instantiate a resource method builder
17464///
17465/// ```test_harness,no_run
17466/// # extern crate hyper;
17467/// # extern crate hyper_rustls;
17468/// # extern crate google_artifactregistry1 as artifactregistry1;
17469/// use artifactregistry1::api::GoogleDevtoolsArtifactregistryV1Rule;
17470/// # async fn dox() {
17471/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17472///
17473/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17474/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17475/// #     .with_native_roots()
17476/// #     .unwrap()
17477/// #     .https_only()
17478/// #     .enable_http2()
17479/// #     .build();
17480///
17481/// # let executor = hyper_util::rt::TokioExecutor::new();
17482/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17483/// #     secret,
17484/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17485/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17486/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17487/// #     ),
17488/// # ).build().await.unwrap();
17489///
17490/// # let client = hyper_util::client::legacy::Client::builder(
17491/// #     hyper_util::rt::TokioExecutor::new()
17492/// # )
17493/// # .build(
17494/// #     hyper_rustls::HttpsConnectorBuilder::new()
17495/// #         .with_native_roots()
17496/// #         .unwrap()
17497/// #         .https_or_http()
17498/// #         .enable_http2()
17499/// #         .build()
17500/// # );
17501/// # let mut hub = ArtifactRegistry::new(client, auth);
17502/// // As the method needs a request, you would usually fill it with the desired information
17503/// // into the respective structure. Some of the parts shown here might not be applicable !
17504/// // Values shown here are possibly random and not representative !
17505/// let mut req = GoogleDevtoolsArtifactregistryV1Rule::default();
17506///
17507/// // You can configure optional parameters by calling the respective setters at will, and
17508/// // execute the final call using `doit()`.
17509/// // Values shown here are possibly random and not representative !
17510/// let result = hub.projects().locations_repositories_rules_create(req, "parent")
17511///              .rule_id("et")
17512///              .doit().await;
17513/// # }
17514/// ```
17515pub struct ProjectLocationRepositoryRuleCreateCall<'a, C>
17516where
17517    C: 'a,
17518{
17519    hub: &'a ArtifactRegistry<C>,
17520    _request: GoogleDevtoolsArtifactregistryV1Rule,
17521    _parent: String,
17522    _rule_id: Option<String>,
17523    _delegate: Option<&'a mut dyn common::Delegate>,
17524    _additional_params: HashMap<String, String>,
17525    _scopes: BTreeSet<String>,
17526}
17527
17528impl<'a, C> common::CallBuilder for ProjectLocationRepositoryRuleCreateCall<'a, C> {}
17529
17530impl<'a, C> ProjectLocationRepositoryRuleCreateCall<'a, C>
17531where
17532    C: common::Connector,
17533{
17534    /// Perform the operation you have build so far.
17535    pub async fn doit(
17536        mut self,
17537    ) -> common::Result<(common::Response, GoogleDevtoolsArtifactregistryV1Rule)> {
17538        use std::borrow::Cow;
17539        use std::io::{Read, Seek};
17540
17541        use common::{url::Params, ToParts};
17542        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17543
17544        let mut dd = common::DefaultDelegate;
17545        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17546        dlg.begin(common::MethodInfo {
17547            id: "artifactregistry.projects.locations.repositories.rules.create",
17548            http_method: hyper::Method::POST,
17549        });
17550
17551        for &field in ["alt", "parent", "ruleId"].iter() {
17552            if self._additional_params.contains_key(field) {
17553                dlg.finished(false);
17554                return Err(common::Error::FieldClash(field));
17555            }
17556        }
17557
17558        let mut params = Params::with_capacity(5 + self._additional_params.len());
17559        params.push("parent", self._parent);
17560        if let Some(value) = self._rule_id.as_ref() {
17561            params.push("ruleId", value);
17562        }
17563
17564        params.extend(self._additional_params.iter());
17565
17566        params.push("alt", "json");
17567        let mut url = self.hub._base_url.clone() + "v1/{+parent}/rules";
17568        if self._scopes.is_empty() {
17569            self._scopes
17570                .insert(Scope::CloudPlatform.as_ref().to_string());
17571        }
17572
17573        #[allow(clippy::single_element_loop)]
17574        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17575            url = params.uri_replacement(url, param_name, find_this, true);
17576        }
17577        {
17578            let to_remove = ["parent"];
17579            params.remove_params(&to_remove);
17580        }
17581
17582        let url = params.parse_with_url(&url);
17583
17584        let mut json_mime_type = mime::APPLICATION_JSON;
17585        let mut request_value_reader = {
17586            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17587            common::remove_json_null_values(&mut value);
17588            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17589            serde_json::to_writer(&mut dst, &value).unwrap();
17590            dst
17591        };
17592        let request_size = request_value_reader
17593            .seek(std::io::SeekFrom::End(0))
17594            .unwrap();
17595        request_value_reader
17596            .seek(std::io::SeekFrom::Start(0))
17597            .unwrap();
17598
17599        loop {
17600            let token = match self
17601                .hub
17602                .auth
17603                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17604                .await
17605            {
17606                Ok(token) => token,
17607                Err(e) => match dlg.token(e) {
17608                    Ok(token) => token,
17609                    Err(e) => {
17610                        dlg.finished(false);
17611                        return Err(common::Error::MissingToken(e));
17612                    }
17613                },
17614            };
17615            request_value_reader
17616                .seek(std::io::SeekFrom::Start(0))
17617                .unwrap();
17618            let mut req_result = {
17619                let client = &self.hub.client;
17620                dlg.pre_request();
17621                let mut req_builder = hyper::Request::builder()
17622                    .method(hyper::Method::POST)
17623                    .uri(url.as_str())
17624                    .header(USER_AGENT, self.hub._user_agent.clone());
17625
17626                if let Some(token) = token.as_ref() {
17627                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17628                }
17629
17630                let request = req_builder
17631                    .header(CONTENT_TYPE, json_mime_type.to_string())
17632                    .header(CONTENT_LENGTH, request_size as u64)
17633                    .body(common::to_body(
17634                        request_value_reader.get_ref().clone().into(),
17635                    ));
17636
17637                client.request(request.unwrap()).await
17638            };
17639
17640            match req_result {
17641                Err(err) => {
17642                    if let common::Retry::After(d) = dlg.http_error(&err) {
17643                        sleep(d).await;
17644                        continue;
17645                    }
17646                    dlg.finished(false);
17647                    return Err(common::Error::HttpError(err));
17648                }
17649                Ok(res) => {
17650                    let (mut parts, body) = res.into_parts();
17651                    let mut body = common::Body::new(body);
17652                    if !parts.status.is_success() {
17653                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17654                        let error = serde_json::from_str(&common::to_string(&bytes));
17655                        let response = common::to_response(parts, bytes.into());
17656
17657                        if let common::Retry::After(d) =
17658                            dlg.http_failure(&response, error.as_ref().ok())
17659                        {
17660                            sleep(d).await;
17661                            continue;
17662                        }
17663
17664                        dlg.finished(false);
17665
17666                        return Err(match error {
17667                            Ok(value) => common::Error::BadRequest(value),
17668                            _ => common::Error::Failure(response),
17669                        });
17670                    }
17671                    let response = {
17672                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17673                        let encoded = common::to_string(&bytes);
17674                        match serde_json::from_str(&encoded) {
17675                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17676                            Err(error) => {
17677                                dlg.response_json_decode_error(&encoded, &error);
17678                                return Err(common::Error::JsonDecodeError(
17679                                    encoded.to_string(),
17680                                    error,
17681                                ));
17682                            }
17683                        }
17684                    };
17685
17686                    dlg.finished(true);
17687                    return Ok(response);
17688                }
17689            }
17690        }
17691    }
17692
17693    ///
17694    /// Sets the *request* property to the given value.
17695    ///
17696    /// Even though the property as already been set when instantiating this call,
17697    /// we provide this method for API completeness.
17698    pub fn request(
17699        mut self,
17700        new_value: GoogleDevtoolsArtifactregistryV1Rule,
17701    ) -> ProjectLocationRepositoryRuleCreateCall<'a, C> {
17702        self._request = new_value;
17703        self
17704    }
17705    /// Required. The name of the parent resource where the rule will be created.
17706    ///
17707    /// Sets the *parent* path property to the given value.
17708    ///
17709    /// Even though the property as already been set when instantiating this call,
17710    /// we provide this method for API completeness.
17711    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryRuleCreateCall<'a, C> {
17712        self._parent = new_value.to_string();
17713        self
17714    }
17715    /// The rule id to use for this repository.
17716    ///
17717    /// Sets the *rule id* query property to the given value.
17718    pub fn rule_id(mut self, new_value: &str) -> ProjectLocationRepositoryRuleCreateCall<'a, C> {
17719        self._rule_id = Some(new_value.to_string());
17720        self
17721    }
17722    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17723    /// while executing the actual API request.
17724    ///
17725    /// ````text
17726    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17727    /// ````
17728    ///
17729    /// Sets the *delegate* property to the given value.
17730    pub fn delegate(
17731        mut self,
17732        new_value: &'a mut dyn common::Delegate,
17733    ) -> ProjectLocationRepositoryRuleCreateCall<'a, C> {
17734        self._delegate = Some(new_value);
17735        self
17736    }
17737
17738    /// Set any additional parameter of the query string used in the request.
17739    /// It should be used to set parameters which are not yet available through their own
17740    /// setters.
17741    ///
17742    /// Please note that this method must not be used to set any of the known parameters
17743    /// which have their own setter method. If done anyway, the request will fail.
17744    ///
17745    /// # Additional Parameters
17746    ///
17747    /// * *$.xgafv* (query-string) - V1 error format.
17748    /// * *access_token* (query-string) - OAuth access token.
17749    /// * *alt* (query-string) - Data format for response.
17750    /// * *callback* (query-string) - JSONP
17751    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17752    /// * *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.
17753    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17754    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17755    /// * *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.
17756    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17757    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17758    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryRuleCreateCall<'a, C>
17759    where
17760        T: AsRef<str>,
17761    {
17762        self._additional_params
17763            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17764        self
17765    }
17766
17767    /// Identifies the authorization scope for the method you are building.
17768    ///
17769    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17770    /// [`Scope::CloudPlatform`].
17771    ///
17772    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17773    /// tokens for more than one scope.
17774    ///
17775    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17776    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17777    /// sufficient, a read-write scope will do as well.
17778    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryRuleCreateCall<'a, C>
17779    where
17780        St: AsRef<str>,
17781    {
17782        self._scopes.insert(String::from(scope.as_ref()));
17783        self
17784    }
17785    /// Identifies the authorization scope(s) for the method you are building.
17786    ///
17787    /// See [`Self::add_scope()`] for details.
17788    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryRuleCreateCall<'a, C>
17789    where
17790        I: IntoIterator<Item = St>,
17791        St: AsRef<str>,
17792    {
17793        self._scopes
17794            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17795        self
17796    }
17797
17798    /// Removes all scopes, and no default scope will be used either.
17799    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17800    /// for details).
17801    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryRuleCreateCall<'a, C> {
17802        self._scopes.clear();
17803        self
17804    }
17805}
17806
17807/// Deletes a rule.
17808///
17809/// A builder for the *locations.repositories.rules.delete* method supported by a *project* resource.
17810/// It is not used directly, but through a [`ProjectMethods`] instance.
17811///
17812/// # Example
17813///
17814/// Instantiate a resource method builder
17815///
17816/// ```test_harness,no_run
17817/// # extern crate hyper;
17818/// # extern crate hyper_rustls;
17819/// # extern crate google_artifactregistry1 as artifactregistry1;
17820/// # async fn dox() {
17821/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17822///
17823/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17824/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17825/// #     .with_native_roots()
17826/// #     .unwrap()
17827/// #     .https_only()
17828/// #     .enable_http2()
17829/// #     .build();
17830///
17831/// # let executor = hyper_util::rt::TokioExecutor::new();
17832/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17833/// #     secret,
17834/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17835/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17836/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17837/// #     ),
17838/// # ).build().await.unwrap();
17839///
17840/// # let client = hyper_util::client::legacy::Client::builder(
17841/// #     hyper_util::rt::TokioExecutor::new()
17842/// # )
17843/// # .build(
17844/// #     hyper_rustls::HttpsConnectorBuilder::new()
17845/// #         .with_native_roots()
17846/// #         .unwrap()
17847/// #         .https_or_http()
17848/// #         .enable_http2()
17849/// #         .build()
17850/// # );
17851/// # let mut hub = ArtifactRegistry::new(client, auth);
17852/// // You can configure optional parameters by calling the respective setters at will, and
17853/// // execute the final call using `doit()`.
17854/// // Values shown here are possibly random and not representative !
17855/// let result = hub.projects().locations_repositories_rules_delete("name")
17856///              .doit().await;
17857/// # }
17858/// ```
17859pub struct ProjectLocationRepositoryRuleDeleteCall<'a, C>
17860where
17861    C: 'a,
17862{
17863    hub: &'a ArtifactRegistry<C>,
17864    _name: String,
17865    _delegate: Option<&'a mut dyn common::Delegate>,
17866    _additional_params: HashMap<String, String>,
17867    _scopes: BTreeSet<String>,
17868}
17869
17870impl<'a, C> common::CallBuilder for ProjectLocationRepositoryRuleDeleteCall<'a, C> {}
17871
17872impl<'a, C> ProjectLocationRepositoryRuleDeleteCall<'a, C>
17873where
17874    C: common::Connector,
17875{
17876    /// Perform the operation you have build so far.
17877    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
17878        use std::borrow::Cow;
17879        use std::io::{Read, Seek};
17880
17881        use common::{url::Params, ToParts};
17882        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17883
17884        let mut dd = common::DefaultDelegate;
17885        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17886        dlg.begin(common::MethodInfo {
17887            id: "artifactregistry.projects.locations.repositories.rules.delete",
17888            http_method: hyper::Method::DELETE,
17889        });
17890
17891        for &field in ["alt", "name"].iter() {
17892            if self._additional_params.contains_key(field) {
17893                dlg.finished(false);
17894                return Err(common::Error::FieldClash(field));
17895            }
17896        }
17897
17898        let mut params = Params::with_capacity(3 + self._additional_params.len());
17899        params.push("name", self._name);
17900
17901        params.extend(self._additional_params.iter());
17902
17903        params.push("alt", "json");
17904        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17905        if self._scopes.is_empty() {
17906            self._scopes
17907                .insert(Scope::CloudPlatform.as_ref().to_string());
17908        }
17909
17910        #[allow(clippy::single_element_loop)]
17911        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17912            url = params.uri_replacement(url, param_name, find_this, true);
17913        }
17914        {
17915            let to_remove = ["name"];
17916            params.remove_params(&to_remove);
17917        }
17918
17919        let url = params.parse_with_url(&url);
17920
17921        loop {
17922            let token = match self
17923                .hub
17924                .auth
17925                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17926                .await
17927            {
17928                Ok(token) => token,
17929                Err(e) => match dlg.token(e) {
17930                    Ok(token) => token,
17931                    Err(e) => {
17932                        dlg.finished(false);
17933                        return Err(common::Error::MissingToken(e));
17934                    }
17935                },
17936            };
17937            let mut req_result = {
17938                let client = &self.hub.client;
17939                dlg.pre_request();
17940                let mut req_builder = hyper::Request::builder()
17941                    .method(hyper::Method::DELETE)
17942                    .uri(url.as_str())
17943                    .header(USER_AGENT, self.hub._user_agent.clone());
17944
17945                if let Some(token) = token.as_ref() {
17946                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17947                }
17948
17949                let request = req_builder
17950                    .header(CONTENT_LENGTH, 0_u64)
17951                    .body(common::to_body::<String>(None));
17952
17953                client.request(request.unwrap()).await
17954            };
17955
17956            match req_result {
17957                Err(err) => {
17958                    if let common::Retry::After(d) = dlg.http_error(&err) {
17959                        sleep(d).await;
17960                        continue;
17961                    }
17962                    dlg.finished(false);
17963                    return Err(common::Error::HttpError(err));
17964                }
17965                Ok(res) => {
17966                    let (mut parts, body) = res.into_parts();
17967                    let mut body = common::Body::new(body);
17968                    if !parts.status.is_success() {
17969                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17970                        let error = serde_json::from_str(&common::to_string(&bytes));
17971                        let response = common::to_response(parts, bytes.into());
17972
17973                        if let common::Retry::After(d) =
17974                            dlg.http_failure(&response, error.as_ref().ok())
17975                        {
17976                            sleep(d).await;
17977                            continue;
17978                        }
17979
17980                        dlg.finished(false);
17981
17982                        return Err(match error {
17983                            Ok(value) => common::Error::BadRequest(value),
17984                            _ => common::Error::Failure(response),
17985                        });
17986                    }
17987                    let response = {
17988                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17989                        let encoded = common::to_string(&bytes);
17990                        match serde_json::from_str(&encoded) {
17991                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17992                            Err(error) => {
17993                                dlg.response_json_decode_error(&encoded, &error);
17994                                return Err(common::Error::JsonDecodeError(
17995                                    encoded.to_string(),
17996                                    error,
17997                                ));
17998                            }
17999                        }
18000                    };
18001
18002                    dlg.finished(true);
18003                    return Ok(response);
18004                }
18005            }
18006        }
18007    }
18008
18009    /// Required. The name of the rule to delete.
18010    ///
18011    /// Sets the *name* path property to the given value.
18012    ///
18013    /// Even though the property as already been set when instantiating this call,
18014    /// we provide this method for API completeness.
18015    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryRuleDeleteCall<'a, C> {
18016        self._name = new_value.to_string();
18017        self
18018    }
18019    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18020    /// while executing the actual API request.
18021    ///
18022    /// ````text
18023    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18024    /// ````
18025    ///
18026    /// Sets the *delegate* property to the given value.
18027    pub fn delegate(
18028        mut self,
18029        new_value: &'a mut dyn common::Delegate,
18030    ) -> ProjectLocationRepositoryRuleDeleteCall<'a, C> {
18031        self._delegate = Some(new_value);
18032        self
18033    }
18034
18035    /// Set any additional parameter of the query string used in the request.
18036    /// It should be used to set parameters which are not yet available through their own
18037    /// setters.
18038    ///
18039    /// Please note that this method must not be used to set any of the known parameters
18040    /// which have their own setter method. If done anyway, the request will fail.
18041    ///
18042    /// # Additional Parameters
18043    ///
18044    /// * *$.xgafv* (query-string) - V1 error format.
18045    /// * *access_token* (query-string) - OAuth access token.
18046    /// * *alt* (query-string) - Data format for response.
18047    /// * *callback* (query-string) - JSONP
18048    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18049    /// * *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.
18050    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18051    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18052    /// * *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.
18053    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18054    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18055    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryRuleDeleteCall<'a, C>
18056    where
18057        T: AsRef<str>,
18058    {
18059        self._additional_params
18060            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18061        self
18062    }
18063
18064    /// Identifies the authorization scope for the method you are building.
18065    ///
18066    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18067    /// [`Scope::CloudPlatform`].
18068    ///
18069    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18070    /// tokens for more than one scope.
18071    ///
18072    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18073    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18074    /// sufficient, a read-write scope will do as well.
18075    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryRuleDeleteCall<'a, C>
18076    where
18077        St: AsRef<str>,
18078    {
18079        self._scopes.insert(String::from(scope.as_ref()));
18080        self
18081    }
18082    /// Identifies the authorization scope(s) for the method you are building.
18083    ///
18084    /// See [`Self::add_scope()`] for details.
18085    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryRuleDeleteCall<'a, C>
18086    where
18087        I: IntoIterator<Item = St>,
18088        St: AsRef<str>,
18089    {
18090        self._scopes
18091            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18092        self
18093    }
18094
18095    /// Removes all scopes, and no default scope will be used either.
18096    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18097    /// for details).
18098    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryRuleDeleteCall<'a, C> {
18099        self._scopes.clear();
18100        self
18101    }
18102}
18103
18104/// Gets a rule.
18105///
18106/// A builder for the *locations.repositories.rules.get* method supported by a *project* resource.
18107/// It is not used directly, but through a [`ProjectMethods`] instance.
18108///
18109/// # Example
18110///
18111/// Instantiate a resource method builder
18112///
18113/// ```test_harness,no_run
18114/// # extern crate hyper;
18115/// # extern crate hyper_rustls;
18116/// # extern crate google_artifactregistry1 as artifactregistry1;
18117/// # async fn dox() {
18118/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18119///
18120/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18121/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18122/// #     .with_native_roots()
18123/// #     .unwrap()
18124/// #     .https_only()
18125/// #     .enable_http2()
18126/// #     .build();
18127///
18128/// # let executor = hyper_util::rt::TokioExecutor::new();
18129/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18130/// #     secret,
18131/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18132/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18133/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18134/// #     ),
18135/// # ).build().await.unwrap();
18136///
18137/// # let client = hyper_util::client::legacy::Client::builder(
18138/// #     hyper_util::rt::TokioExecutor::new()
18139/// # )
18140/// # .build(
18141/// #     hyper_rustls::HttpsConnectorBuilder::new()
18142/// #         .with_native_roots()
18143/// #         .unwrap()
18144/// #         .https_or_http()
18145/// #         .enable_http2()
18146/// #         .build()
18147/// # );
18148/// # let mut hub = ArtifactRegistry::new(client, auth);
18149/// // You can configure optional parameters by calling the respective setters at will, and
18150/// // execute the final call using `doit()`.
18151/// // Values shown here are possibly random and not representative !
18152/// let result = hub.projects().locations_repositories_rules_get("name")
18153///              .doit().await;
18154/// # }
18155/// ```
18156pub struct ProjectLocationRepositoryRuleGetCall<'a, C>
18157where
18158    C: 'a,
18159{
18160    hub: &'a ArtifactRegistry<C>,
18161    _name: String,
18162    _delegate: Option<&'a mut dyn common::Delegate>,
18163    _additional_params: HashMap<String, String>,
18164    _scopes: BTreeSet<String>,
18165}
18166
18167impl<'a, C> common::CallBuilder for ProjectLocationRepositoryRuleGetCall<'a, C> {}
18168
18169impl<'a, C> ProjectLocationRepositoryRuleGetCall<'a, C>
18170where
18171    C: common::Connector,
18172{
18173    /// Perform the operation you have build so far.
18174    pub async fn doit(
18175        mut self,
18176    ) -> common::Result<(common::Response, GoogleDevtoolsArtifactregistryV1Rule)> {
18177        use std::borrow::Cow;
18178        use std::io::{Read, Seek};
18179
18180        use common::{url::Params, ToParts};
18181        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18182
18183        let mut dd = common::DefaultDelegate;
18184        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18185        dlg.begin(common::MethodInfo {
18186            id: "artifactregistry.projects.locations.repositories.rules.get",
18187            http_method: hyper::Method::GET,
18188        });
18189
18190        for &field in ["alt", "name"].iter() {
18191            if self._additional_params.contains_key(field) {
18192                dlg.finished(false);
18193                return Err(common::Error::FieldClash(field));
18194            }
18195        }
18196
18197        let mut params = Params::with_capacity(3 + self._additional_params.len());
18198        params.push("name", self._name);
18199
18200        params.extend(self._additional_params.iter());
18201
18202        params.push("alt", "json");
18203        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18204        if self._scopes.is_empty() {
18205            self._scopes
18206                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
18207        }
18208
18209        #[allow(clippy::single_element_loop)]
18210        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18211            url = params.uri_replacement(url, param_name, find_this, true);
18212        }
18213        {
18214            let to_remove = ["name"];
18215            params.remove_params(&to_remove);
18216        }
18217
18218        let url = params.parse_with_url(&url);
18219
18220        loop {
18221            let token = match self
18222                .hub
18223                .auth
18224                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18225                .await
18226            {
18227                Ok(token) => token,
18228                Err(e) => match dlg.token(e) {
18229                    Ok(token) => token,
18230                    Err(e) => {
18231                        dlg.finished(false);
18232                        return Err(common::Error::MissingToken(e));
18233                    }
18234                },
18235            };
18236            let mut req_result = {
18237                let client = &self.hub.client;
18238                dlg.pre_request();
18239                let mut req_builder = hyper::Request::builder()
18240                    .method(hyper::Method::GET)
18241                    .uri(url.as_str())
18242                    .header(USER_AGENT, self.hub._user_agent.clone());
18243
18244                if let Some(token) = token.as_ref() {
18245                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18246                }
18247
18248                let request = req_builder
18249                    .header(CONTENT_LENGTH, 0_u64)
18250                    .body(common::to_body::<String>(None));
18251
18252                client.request(request.unwrap()).await
18253            };
18254
18255            match req_result {
18256                Err(err) => {
18257                    if let common::Retry::After(d) = dlg.http_error(&err) {
18258                        sleep(d).await;
18259                        continue;
18260                    }
18261                    dlg.finished(false);
18262                    return Err(common::Error::HttpError(err));
18263                }
18264                Ok(res) => {
18265                    let (mut parts, body) = res.into_parts();
18266                    let mut body = common::Body::new(body);
18267                    if !parts.status.is_success() {
18268                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18269                        let error = serde_json::from_str(&common::to_string(&bytes));
18270                        let response = common::to_response(parts, bytes.into());
18271
18272                        if let common::Retry::After(d) =
18273                            dlg.http_failure(&response, error.as_ref().ok())
18274                        {
18275                            sleep(d).await;
18276                            continue;
18277                        }
18278
18279                        dlg.finished(false);
18280
18281                        return Err(match error {
18282                            Ok(value) => common::Error::BadRequest(value),
18283                            _ => common::Error::Failure(response),
18284                        });
18285                    }
18286                    let response = {
18287                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18288                        let encoded = common::to_string(&bytes);
18289                        match serde_json::from_str(&encoded) {
18290                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18291                            Err(error) => {
18292                                dlg.response_json_decode_error(&encoded, &error);
18293                                return Err(common::Error::JsonDecodeError(
18294                                    encoded.to_string(),
18295                                    error,
18296                                ));
18297                            }
18298                        }
18299                    };
18300
18301                    dlg.finished(true);
18302                    return Ok(response);
18303                }
18304            }
18305        }
18306    }
18307
18308    /// Required. The name of the rule to retrieve.
18309    ///
18310    /// Sets the *name* path property to the given value.
18311    ///
18312    /// Even though the property as already been set when instantiating this call,
18313    /// we provide this method for API completeness.
18314    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryRuleGetCall<'a, C> {
18315        self._name = new_value.to_string();
18316        self
18317    }
18318    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18319    /// while executing the actual API request.
18320    ///
18321    /// ````text
18322    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18323    /// ````
18324    ///
18325    /// Sets the *delegate* property to the given value.
18326    pub fn delegate(
18327        mut self,
18328        new_value: &'a mut dyn common::Delegate,
18329    ) -> ProjectLocationRepositoryRuleGetCall<'a, C> {
18330        self._delegate = Some(new_value);
18331        self
18332    }
18333
18334    /// Set any additional parameter of the query string used in the request.
18335    /// It should be used to set parameters which are not yet available through their own
18336    /// setters.
18337    ///
18338    /// Please note that this method must not be used to set any of the known parameters
18339    /// which have their own setter method. If done anyway, the request will fail.
18340    ///
18341    /// # Additional Parameters
18342    ///
18343    /// * *$.xgafv* (query-string) - V1 error format.
18344    /// * *access_token* (query-string) - OAuth access token.
18345    /// * *alt* (query-string) - Data format for response.
18346    /// * *callback* (query-string) - JSONP
18347    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18348    /// * *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.
18349    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18350    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18351    /// * *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.
18352    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18353    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18354    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryRuleGetCall<'a, C>
18355    where
18356        T: AsRef<str>,
18357    {
18358        self._additional_params
18359            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18360        self
18361    }
18362
18363    /// Identifies the authorization scope for the method you are building.
18364    ///
18365    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18366    /// [`Scope::CloudPlatformReadOnly`].
18367    ///
18368    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18369    /// tokens for more than one scope.
18370    ///
18371    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18372    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18373    /// sufficient, a read-write scope will do as well.
18374    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryRuleGetCall<'a, C>
18375    where
18376        St: AsRef<str>,
18377    {
18378        self._scopes.insert(String::from(scope.as_ref()));
18379        self
18380    }
18381    /// Identifies the authorization scope(s) for the method you are building.
18382    ///
18383    /// See [`Self::add_scope()`] for details.
18384    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryRuleGetCall<'a, C>
18385    where
18386        I: IntoIterator<Item = St>,
18387        St: AsRef<str>,
18388    {
18389        self._scopes
18390            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18391        self
18392    }
18393
18394    /// Removes all scopes, and no default scope will be used either.
18395    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18396    /// for details).
18397    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryRuleGetCall<'a, C> {
18398        self._scopes.clear();
18399        self
18400    }
18401}
18402
18403/// Lists rules.
18404///
18405/// A builder for the *locations.repositories.rules.list* method supported by a *project* resource.
18406/// It is not used directly, but through a [`ProjectMethods`] instance.
18407///
18408/// # Example
18409///
18410/// Instantiate a resource method builder
18411///
18412/// ```test_harness,no_run
18413/// # extern crate hyper;
18414/// # extern crate hyper_rustls;
18415/// # extern crate google_artifactregistry1 as artifactregistry1;
18416/// # async fn dox() {
18417/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18418///
18419/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18420/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18421/// #     .with_native_roots()
18422/// #     .unwrap()
18423/// #     .https_only()
18424/// #     .enable_http2()
18425/// #     .build();
18426///
18427/// # let executor = hyper_util::rt::TokioExecutor::new();
18428/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18429/// #     secret,
18430/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18431/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18432/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18433/// #     ),
18434/// # ).build().await.unwrap();
18435///
18436/// # let client = hyper_util::client::legacy::Client::builder(
18437/// #     hyper_util::rt::TokioExecutor::new()
18438/// # )
18439/// # .build(
18440/// #     hyper_rustls::HttpsConnectorBuilder::new()
18441/// #         .with_native_roots()
18442/// #         .unwrap()
18443/// #         .https_or_http()
18444/// #         .enable_http2()
18445/// #         .build()
18446/// # );
18447/// # let mut hub = ArtifactRegistry::new(client, auth);
18448/// // You can configure optional parameters by calling the respective setters at will, and
18449/// // execute the final call using `doit()`.
18450/// // Values shown here are possibly random and not representative !
18451/// let result = hub.projects().locations_repositories_rules_list("parent")
18452///              .page_token("sed")
18453///              .page_size(-9)
18454///              .doit().await;
18455/// # }
18456/// ```
18457pub struct ProjectLocationRepositoryRuleListCall<'a, C>
18458where
18459    C: 'a,
18460{
18461    hub: &'a ArtifactRegistry<C>,
18462    _parent: String,
18463    _page_token: Option<String>,
18464    _page_size: Option<i32>,
18465    _delegate: Option<&'a mut dyn common::Delegate>,
18466    _additional_params: HashMap<String, String>,
18467    _scopes: BTreeSet<String>,
18468}
18469
18470impl<'a, C> common::CallBuilder for ProjectLocationRepositoryRuleListCall<'a, C> {}
18471
18472impl<'a, C> ProjectLocationRepositoryRuleListCall<'a, C>
18473where
18474    C: common::Connector,
18475{
18476    /// Perform the operation you have build so far.
18477    pub async fn doit(mut self) -> common::Result<(common::Response, ListRulesResponse)> {
18478        use std::borrow::Cow;
18479        use std::io::{Read, Seek};
18480
18481        use common::{url::Params, ToParts};
18482        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18483
18484        let mut dd = common::DefaultDelegate;
18485        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18486        dlg.begin(common::MethodInfo {
18487            id: "artifactregistry.projects.locations.repositories.rules.list",
18488            http_method: hyper::Method::GET,
18489        });
18490
18491        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
18492            if self._additional_params.contains_key(field) {
18493                dlg.finished(false);
18494                return Err(common::Error::FieldClash(field));
18495            }
18496        }
18497
18498        let mut params = Params::with_capacity(5 + self._additional_params.len());
18499        params.push("parent", self._parent);
18500        if let Some(value) = self._page_token.as_ref() {
18501            params.push("pageToken", value);
18502        }
18503        if let Some(value) = self._page_size.as_ref() {
18504            params.push("pageSize", value.to_string());
18505        }
18506
18507        params.extend(self._additional_params.iter());
18508
18509        params.push("alt", "json");
18510        let mut url = self.hub._base_url.clone() + "v1/{+parent}/rules";
18511        if self._scopes.is_empty() {
18512            self._scopes
18513                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
18514        }
18515
18516        #[allow(clippy::single_element_loop)]
18517        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18518            url = params.uri_replacement(url, param_name, find_this, true);
18519        }
18520        {
18521            let to_remove = ["parent"];
18522            params.remove_params(&to_remove);
18523        }
18524
18525        let url = params.parse_with_url(&url);
18526
18527        loop {
18528            let token = match self
18529                .hub
18530                .auth
18531                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18532                .await
18533            {
18534                Ok(token) => token,
18535                Err(e) => match dlg.token(e) {
18536                    Ok(token) => token,
18537                    Err(e) => {
18538                        dlg.finished(false);
18539                        return Err(common::Error::MissingToken(e));
18540                    }
18541                },
18542            };
18543            let mut req_result = {
18544                let client = &self.hub.client;
18545                dlg.pre_request();
18546                let mut req_builder = hyper::Request::builder()
18547                    .method(hyper::Method::GET)
18548                    .uri(url.as_str())
18549                    .header(USER_AGENT, self.hub._user_agent.clone());
18550
18551                if let Some(token) = token.as_ref() {
18552                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18553                }
18554
18555                let request = req_builder
18556                    .header(CONTENT_LENGTH, 0_u64)
18557                    .body(common::to_body::<String>(None));
18558
18559                client.request(request.unwrap()).await
18560            };
18561
18562            match req_result {
18563                Err(err) => {
18564                    if let common::Retry::After(d) = dlg.http_error(&err) {
18565                        sleep(d).await;
18566                        continue;
18567                    }
18568                    dlg.finished(false);
18569                    return Err(common::Error::HttpError(err));
18570                }
18571                Ok(res) => {
18572                    let (mut parts, body) = res.into_parts();
18573                    let mut body = common::Body::new(body);
18574                    if !parts.status.is_success() {
18575                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18576                        let error = serde_json::from_str(&common::to_string(&bytes));
18577                        let response = common::to_response(parts, bytes.into());
18578
18579                        if let common::Retry::After(d) =
18580                            dlg.http_failure(&response, error.as_ref().ok())
18581                        {
18582                            sleep(d).await;
18583                            continue;
18584                        }
18585
18586                        dlg.finished(false);
18587
18588                        return Err(match error {
18589                            Ok(value) => common::Error::BadRequest(value),
18590                            _ => common::Error::Failure(response),
18591                        });
18592                    }
18593                    let response = {
18594                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18595                        let encoded = common::to_string(&bytes);
18596                        match serde_json::from_str(&encoded) {
18597                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18598                            Err(error) => {
18599                                dlg.response_json_decode_error(&encoded, &error);
18600                                return Err(common::Error::JsonDecodeError(
18601                                    encoded.to_string(),
18602                                    error,
18603                                ));
18604                            }
18605                        }
18606                    };
18607
18608                    dlg.finished(true);
18609                    return Ok(response);
18610                }
18611            }
18612        }
18613    }
18614
18615    /// Required. The name of the parent repository whose rules will be listed. For example: `projects/p1/locations/us-central1/repositories/repo1`.
18616    ///
18617    /// Sets the *parent* path property to the given value.
18618    ///
18619    /// Even though the property as already been set when instantiating this call,
18620    /// we provide this method for API completeness.
18621    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryRuleListCall<'a, C> {
18622        self._parent = new_value.to_string();
18623        self
18624    }
18625    /// The next_page_token value returned from a previous list request, if any.
18626    ///
18627    /// Sets the *page token* query property to the given value.
18628    pub fn page_token(mut self, new_value: &str) -> ProjectLocationRepositoryRuleListCall<'a, C> {
18629        self._page_token = Some(new_value.to_string());
18630        self
18631    }
18632    /// The maximum number of rules to return. Maximum page size is 1,000.
18633    ///
18634    /// Sets the *page size* query property to the given value.
18635    pub fn page_size(mut self, new_value: i32) -> ProjectLocationRepositoryRuleListCall<'a, C> {
18636        self._page_size = Some(new_value);
18637        self
18638    }
18639    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18640    /// while executing the actual API request.
18641    ///
18642    /// ````text
18643    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18644    /// ````
18645    ///
18646    /// Sets the *delegate* property to the given value.
18647    pub fn delegate(
18648        mut self,
18649        new_value: &'a mut dyn common::Delegate,
18650    ) -> ProjectLocationRepositoryRuleListCall<'a, C> {
18651        self._delegate = Some(new_value);
18652        self
18653    }
18654
18655    /// Set any additional parameter of the query string used in the request.
18656    /// It should be used to set parameters which are not yet available through their own
18657    /// setters.
18658    ///
18659    /// Please note that this method must not be used to set any of the known parameters
18660    /// which have their own setter method. If done anyway, the request will fail.
18661    ///
18662    /// # Additional Parameters
18663    ///
18664    /// * *$.xgafv* (query-string) - V1 error format.
18665    /// * *access_token* (query-string) - OAuth access token.
18666    /// * *alt* (query-string) - Data format for response.
18667    /// * *callback* (query-string) - JSONP
18668    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18669    /// * *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.
18670    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18671    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18672    /// * *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.
18673    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18674    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18675    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryRuleListCall<'a, C>
18676    where
18677        T: AsRef<str>,
18678    {
18679        self._additional_params
18680            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18681        self
18682    }
18683
18684    /// Identifies the authorization scope for the method you are building.
18685    ///
18686    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18687    /// [`Scope::CloudPlatformReadOnly`].
18688    ///
18689    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18690    /// tokens for more than one scope.
18691    ///
18692    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18693    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18694    /// sufficient, a read-write scope will do as well.
18695    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryRuleListCall<'a, C>
18696    where
18697        St: AsRef<str>,
18698    {
18699        self._scopes.insert(String::from(scope.as_ref()));
18700        self
18701    }
18702    /// Identifies the authorization scope(s) for the method you are building.
18703    ///
18704    /// See [`Self::add_scope()`] for details.
18705    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryRuleListCall<'a, C>
18706    where
18707        I: IntoIterator<Item = St>,
18708        St: AsRef<str>,
18709    {
18710        self._scopes
18711            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18712        self
18713    }
18714
18715    /// Removes all scopes, and no default scope will be used either.
18716    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18717    /// for details).
18718    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryRuleListCall<'a, C> {
18719        self._scopes.clear();
18720        self
18721    }
18722}
18723
18724/// Updates a rule.
18725///
18726/// A builder for the *locations.repositories.rules.patch* method supported by a *project* resource.
18727/// It is not used directly, but through a [`ProjectMethods`] instance.
18728///
18729/// # Example
18730///
18731/// Instantiate a resource method builder
18732///
18733/// ```test_harness,no_run
18734/// # extern crate hyper;
18735/// # extern crate hyper_rustls;
18736/// # extern crate google_artifactregistry1 as artifactregistry1;
18737/// use artifactregistry1::api::GoogleDevtoolsArtifactregistryV1Rule;
18738/// # async fn dox() {
18739/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18740///
18741/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18742/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18743/// #     .with_native_roots()
18744/// #     .unwrap()
18745/// #     .https_only()
18746/// #     .enable_http2()
18747/// #     .build();
18748///
18749/// # let executor = hyper_util::rt::TokioExecutor::new();
18750/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18751/// #     secret,
18752/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18753/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18754/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18755/// #     ),
18756/// # ).build().await.unwrap();
18757///
18758/// # let client = hyper_util::client::legacy::Client::builder(
18759/// #     hyper_util::rt::TokioExecutor::new()
18760/// # )
18761/// # .build(
18762/// #     hyper_rustls::HttpsConnectorBuilder::new()
18763/// #         .with_native_roots()
18764/// #         .unwrap()
18765/// #         .https_or_http()
18766/// #         .enable_http2()
18767/// #         .build()
18768/// # );
18769/// # let mut hub = ArtifactRegistry::new(client, auth);
18770/// // As the method needs a request, you would usually fill it with the desired information
18771/// // into the respective structure. Some of the parts shown here might not be applicable !
18772/// // Values shown here are possibly random and not representative !
18773/// let mut req = GoogleDevtoolsArtifactregistryV1Rule::default();
18774///
18775/// // You can configure optional parameters by calling the respective setters at will, and
18776/// // execute the final call using `doit()`.
18777/// // Values shown here are possibly random and not representative !
18778/// let result = hub.projects().locations_repositories_rules_patch(req, "name")
18779///              .update_mask(FieldMask::new::<&str>(&[]))
18780///              .doit().await;
18781/// # }
18782/// ```
18783pub struct ProjectLocationRepositoryRulePatchCall<'a, C>
18784where
18785    C: 'a,
18786{
18787    hub: &'a ArtifactRegistry<C>,
18788    _request: GoogleDevtoolsArtifactregistryV1Rule,
18789    _name: String,
18790    _update_mask: Option<common::FieldMask>,
18791    _delegate: Option<&'a mut dyn common::Delegate>,
18792    _additional_params: HashMap<String, String>,
18793    _scopes: BTreeSet<String>,
18794}
18795
18796impl<'a, C> common::CallBuilder for ProjectLocationRepositoryRulePatchCall<'a, C> {}
18797
18798impl<'a, C> ProjectLocationRepositoryRulePatchCall<'a, C>
18799where
18800    C: common::Connector,
18801{
18802    /// Perform the operation you have build so far.
18803    pub async fn doit(
18804        mut self,
18805    ) -> common::Result<(common::Response, GoogleDevtoolsArtifactregistryV1Rule)> {
18806        use std::borrow::Cow;
18807        use std::io::{Read, Seek};
18808
18809        use common::{url::Params, ToParts};
18810        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18811
18812        let mut dd = common::DefaultDelegate;
18813        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18814        dlg.begin(common::MethodInfo {
18815            id: "artifactregistry.projects.locations.repositories.rules.patch",
18816            http_method: hyper::Method::PATCH,
18817        });
18818
18819        for &field in ["alt", "name", "updateMask"].iter() {
18820            if self._additional_params.contains_key(field) {
18821                dlg.finished(false);
18822                return Err(common::Error::FieldClash(field));
18823            }
18824        }
18825
18826        let mut params = Params::with_capacity(5 + self._additional_params.len());
18827        params.push("name", self._name);
18828        if let Some(value) = self._update_mask.as_ref() {
18829            params.push("updateMask", value.to_string());
18830        }
18831
18832        params.extend(self._additional_params.iter());
18833
18834        params.push("alt", "json");
18835        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18836        if self._scopes.is_empty() {
18837            self._scopes
18838                .insert(Scope::CloudPlatform.as_ref().to_string());
18839        }
18840
18841        #[allow(clippy::single_element_loop)]
18842        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18843            url = params.uri_replacement(url, param_name, find_this, true);
18844        }
18845        {
18846            let to_remove = ["name"];
18847            params.remove_params(&to_remove);
18848        }
18849
18850        let url = params.parse_with_url(&url);
18851
18852        let mut json_mime_type = mime::APPLICATION_JSON;
18853        let mut request_value_reader = {
18854            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18855            common::remove_json_null_values(&mut value);
18856            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18857            serde_json::to_writer(&mut dst, &value).unwrap();
18858            dst
18859        };
18860        let request_size = request_value_reader
18861            .seek(std::io::SeekFrom::End(0))
18862            .unwrap();
18863        request_value_reader
18864            .seek(std::io::SeekFrom::Start(0))
18865            .unwrap();
18866
18867        loop {
18868            let token = match self
18869                .hub
18870                .auth
18871                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18872                .await
18873            {
18874                Ok(token) => token,
18875                Err(e) => match dlg.token(e) {
18876                    Ok(token) => token,
18877                    Err(e) => {
18878                        dlg.finished(false);
18879                        return Err(common::Error::MissingToken(e));
18880                    }
18881                },
18882            };
18883            request_value_reader
18884                .seek(std::io::SeekFrom::Start(0))
18885                .unwrap();
18886            let mut req_result = {
18887                let client = &self.hub.client;
18888                dlg.pre_request();
18889                let mut req_builder = hyper::Request::builder()
18890                    .method(hyper::Method::PATCH)
18891                    .uri(url.as_str())
18892                    .header(USER_AGENT, self.hub._user_agent.clone());
18893
18894                if let Some(token) = token.as_ref() {
18895                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18896                }
18897
18898                let request = req_builder
18899                    .header(CONTENT_TYPE, json_mime_type.to_string())
18900                    .header(CONTENT_LENGTH, request_size as u64)
18901                    .body(common::to_body(
18902                        request_value_reader.get_ref().clone().into(),
18903                    ));
18904
18905                client.request(request.unwrap()).await
18906            };
18907
18908            match req_result {
18909                Err(err) => {
18910                    if let common::Retry::After(d) = dlg.http_error(&err) {
18911                        sleep(d).await;
18912                        continue;
18913                    }
18914                    dlg.finished(false);
18915                    return Err(common::Error::HttpError(err));
18916                }
18917                Ok(res) => {
18918                    let (mut parts, body) = res.into_parts();
18919                    let mut body = common::Body::new(body);
18920                    if !parts.status.is_success() {
18921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18922                        let error = serde_json::from_str(&common::to_string(&bytes));
18923                        let response = common::to_response(parts, bytes.into());
18924
18925                        if let common::Retry::After(d) =
18926                            dlg.http_failure(&response, error.as_ref().ok())
18927                        {
18928                            sleep(d).await;
18929                            continue;
18930                        }
18931
18932                        dlg.finished(false);
18933
18934                        return Err(match error {
18935                            Ok(value) => common::Error::BadRequest(value),
18936                            _ => common::Error::Failure(response),
18937                        });
18938                    }
18939                    let response = {
18940                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18941                        let encoded = common::to_string(&bytes);
18942                        match serde_json::from_str(&encoded) {
18943                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18944                            Err(error) => {
18945                                dlg.response_json_decode_error(&encoded, &error);
18946                                return Err(common::Error::JsonDecodeError(
18947                                    encoded.to_string(),
18948                                    error,
18949                                ));
18950                            }
18951                        }
18952                    };
18953
18954                    dlg.finished(true);
18955                    return Ok(response);
18956                }
18957            }
18958        }
18959    }
18960
18961    ///
18962    /// Sets the *request* property to the given value.
18963    ///
18964    /// Even though the property as already been set when instantiating this call,
18965    /// we provide this method for API completeness.
18966    pub fn request(
18967        mut self,
18968        new_value: GoogleDevtoolsArtifactregistryV1Rule,
18969    ) -> ProjectLocationRepositoryRulePatchCall<'a, C> {
18970        self._request = new_value;
18971        self
18972    }
18973    /// The name of the rule, for example: `projects/p1/locations/us-central1/repositories/repo1/rules/rule1`.
18974    ///
18975    /// Sets the *name* path property to the given value.
18976    ///
18977    /// Even though the property as already been set when instantiating this call,
18978    /// we provide this method for API completeness.
18979    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryRulePatchCall<'a, C> {
18980        self._name = new_value.to_string();
18981        self
18982    }
18983    /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
18984    ///
18985    /// Sets the *update mask* query property to the given value.
18986    pub fn update_mask(
18987        mut self,
18988        new_value: common::FieldMask,
18989    ) -> ProjectLocationRepositoryRulePatchCall<'a, C> {
18990        self._update_mask = Some(new_value);
18991        self
18992    }
18993    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18994    /// while executing the actual API request.
18995    ///
18996    /// ````text
18997    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18998    /// ````
18999    ///
19000    /// Sets the *delegate* property to the given value.
19001    pub fn delegate(
19002        mut self,
19003        new_value: &'a mut dyn common::Delegate,
19004    ) -> ProjectLocationRepositoryRulePatchCall<'a, C> {
19005        self._delegate = Some(new_value);
19006        self
19007    }
19008
19009    /// Set any additional parameter of the query string used in the request.
19010    /// It should be used to set parameters which are not yet available through their own
19011    /// setters.
19012    ///
19013    /// Please note that this method must not be used to set any of the known parameters
19014    /// which have their own setter method. If done anyway, the request will fail.
19015    ///
19016    /// # Additional Parameters
19017    ///
19018    /// * *$.xgafv* (query-string) - V1 error format.
19019    /// * *access_token* (query-string) - OAuth access token.
19020    /// * *alt* (query-string) - Data format for response.
19021    /// * *callback* (query-string) - JSONP
19022    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19023    /// * *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.
19024    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19025    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19026    /// * *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.
19027    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19028    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19029    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryRulePatchCall<'a, C>
19030    where
19031        T: AsRef<str>,
19032    {
19033        self._additional_params
19034            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19035        self
19036    }
19037
19038    /// Identifies the authorization scope for the method you are building.
19039    ///
19040    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19041    /// [`Scope::CloudPlatform`].
19042    ///
19043    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19044    /// tokens for more than one scope.
19045    ///
19046    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19047    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19048    /// sufficient, a read-write scope will do as well.
19049    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryRulePatchCall<'a, C>
19050    where
19051        St: AsRef<str>,
19052    {
19053        self._scopes.insert(String::from(scope.as_ref()));
19054        self
19055    }
19056    /// Identifies the authorization scope(s) for the method you are building.
19057    ///
19058    /// See [`Self::add_scope()`] for details.
19059    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryRulePatchCall<'a, C>
19060    where
19061        I: IntoIterator<Item = St>,
19062        St: AsRef<str>,
19063    {
19064        self._scopes
19065            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19066        self
19067    }
19068
19069    /// Removes all scopes, and no default scope will be used either.
19070    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19071    /// for details).
19072    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryRulePatchCall<'a, C> {
19073        self._scopes.clear();
19074        self
19075    }
19076}
19077
19078/// Imports Yum (RPM) artifacts. The returned Operation will complete once the resources are imported. Package, Version, and File resources are created based on the imported artifacts. Imported artifacts that conflict with existing resources are ignored.
19079///
19080/// A builder for the *locations.repositories.yumArtifacts.import* method supported by a *project* resource.
19081/// It is not used directly, but through a [`ProjectMethods`] instance.
19082///
19083/// # Example
19084///
19085/// Instantiate a resource method builder
19086///
19087/// ```test_harness,no_run
19088/// # extern crate hyper;
19089/// # extern crate hyper_rustls;
19090/// # extern crate google_artifactregistry1 as artifactregistry1;
19091/// use artifactregistry1::api::ImportYumArtifactsRequest;
19092/// # async fn dox() {
19093/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19094///
19095/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19096/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19097/// #     .with_native_roots()
19098/// #     .unwrap()
19099/// #     .https_only()
19100/// #     .enable_http2()
19101/// #     .build();
19102///
19103/// # let executor = hyper_util::rt::TokioExecutor::new();
19104/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19105/// #     secret,
19106/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19107/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19108/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19109/// #     ),
19110/// # ).build().await.unwrap();
19111///
19112/// # let client = hyper_util::client::legacy::Client::builder(
19113/// #     hyper_util::rt::TokioExecutor::new()
19114/// # )
19115/// # .build(
19116/// #     hyper_rustls::HttpsConnectorBuilder::new()
19117/// #         .with_native_roots()
19118/// #         .unwrap()
19119/// #         .https_or_http()
19120/// #         .enable_http2()
19121/// #         .build()
19122/// # );
19123/// # let mut hub = ArtifactRegistry::new(client, auth);
19124/// // As the method needs a request, you would usually fill it with the desired information
19125/// // into the respective structure. Some of the parts shown here might not be applicable !
19126/// // Values shown here are possibly random and not representative !
19127/// let mut req = ImportYumArtifactsRequest::default();
19128///
19129/// // You can configure optional parameters by calling the respective setters at will, and
19130/// // execute the final call using `doit()`.
19131/// // Values shown here are possibly random and not representative !
19132/// let result = hub.projects().locations_repositories_yum_artifacts_import(req, "parent")
19133///              .doit().await;
19134/// # }
19135/// ```
19136pub struct ProjectLocationRepositoryYumArtifactImportCall<'a, C>
19137where
19138    C: 'a,
19139{
19140    hub: &'a ArtifactRegistry<C>,
19141    _request: ImportYumArtifactsRequest,
19142    _parent: String,
19143    _delegate: Option<&'a mut dyn common::Delegate>,
19144    _additional_params: HashMap<String, String>,
19145    _scopes: BTreeSet<String>,
19146}
19147
19148impl<'a, C> common::CallBuilder for ProjectLocationRepositoryYumArtifactImportCall<'a, C> {}
19149
19150impl<'a, C> ProjectLocationRepositoryYumArtifactImportCall<'a, C>
19151where
19152    C: common::Connector,
19153{
19154    /// Perform the operation you have build so far.
19155    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19156        use std::borrow::Cow;
19157        use std::io::{Read, Seek};
19158
19159        use common::{url::Params, ToParts};
19160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19161
19162        let mut dd = common::DefaultDelegate;
19163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19164        dlg.begin(common::MethodInfo {
19165            id: "artifactregistry.projects.locations.repositories.yumArtifacts.import",
19166            http_method: hyper::Method::POST,
19167        });
19168
19169        for &field in ["alt", "parent"].iter() {
19170            if self._additional_params.contains_key(field) {
19171                dlg.finished(false);
19172                return Err(common::Error::FieldClash(field));
19173            }
19174        }
19175
19176        let mut params = Params::with_capacity(4 + self._additional_params.len());
19177        params.push("parent", self._parent);
19178
19179        params.extend(self._additional_params.iter());
19180
19181        params.push("alt", "json");
19182        let mut url = self.hub._base_url.clone() + "v1/{+parent}/yumArtifacts:import";
19183        if self._scopes.is_empty() {
19184            self._scopes
19185                .insert(Scope::CloudPlatform.as_ref().to_string());
19186        }
19187
19188        #[allow(clippy::single_element_loop)]
19189        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19190            url = params.uri_replacement(url, param_name, find_this, true);
19191        }
19192        {
19193            let to_remove = ["parent"];
19194            params.remove_params(&to_remove);
19195        }
19196
19197        let url = params.parse_with_url(&url);
19198
19199        let mut json_mime_type = mime::APPLICATION_JSON;
19200        let mut request_value_reader = {
19201            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19202            common::remove_json_null_values(&mut value);
19203            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19204            serde_json::to_writer(&mut dst, &value).unwrap();
19205            dst
19206        };
19207        let request_size = request_value_reader
19208            .seek(std::io::SeekFrom::End(0))
19209            .unwrap();
19210        request_value_reader
19211            .seek(std::io::SeekFrom::Start(0))
19212            .unwrap();
19213
19214        loop {
19215            let token = match self
19216                .hub
19217                .auth
19218                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19219                .await
19220            {
19221                Ok(token) => token,
19222                Err(e) => match dlg.token(e) {
19223                    Ok(token) => token,
19224                    Err(e) => {
19225                        dlg.finished(false);
19226                        return Err(common::Error::MissingToken(e));
19227                    }
19228                },
19229            };
19230            request_value_reader
19231                .seek(std::io::SeekFrom::Start(0))
19232                .unwrap();
19233            let mut req_result = {
19234                let client = &self.hub.client;
19235                dlg.pre_request();
19236                let mut req_builder = hyper::Request::builder()
19237                    .method(hyper::Method::POST)
19238                    .uri(url.as_str())
19239                    .header(USER_AGENT, self.hub._user_agent.clone());
19240
19241                if let Some(token) = token.as_ref() {
19242                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19243                }
19244
19245                let request = req_builder
19246                    .header(CONTENT_TYPE, json_mime_type.to_string())
19247                    .header(CONTENT_LENGTH, request_size as u64)
19248                    .body(common::to_body(
19249                        request_value_reader.get_ref().clone().into(),
19250                    ));
19251
19252                client.request(request.unwrap()).await
19253            };
19254
19255            match req_result {
19256                Err(err) => {
19257                    if let common::Retry::After(d) = dlg.http_error(&err) {
19258                        sleep(d).await;
19259                        continue;
19260                    }
19261                    dlg.finished(false);
19262                    return Err(common::Error::HttpError(err));
19263                }
19264                Ok(res) => {
19265                    let (mut parts, body) = res.into_parts();
19266                    let mut body = common::Body::new(body);
19267                    if !parts.status.is_success() {
19268                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19269                        let error = serde_json::from_str(&common::to_string(&bytes));
19270                        let response = common::to_response(parts, bytes.into());
19271
19272                        if let common::Retry::After(d) =
19273                            dlg.http_failure(&response, error.as_ref().ok())
19274                        {
19275                            sleep(d).await;
19276                            continue;
19277                        }
19278
19279                        dlg.finished(false);
19280
19281                        return Err(match error {
19282                            Ok(value) => common::Error::BadRequest(value),
19283                            _ => common::Error::Failure(response),
19284                        });
19285                    }
19286                    let response = {
19287                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19288                        let encoded = common::to_string(&bytes);
19289                        match serde_json::from_str(&encoded) {
19290                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19291                            Err(error) => {
19292                                dlg.response_json_decode_error(&encoded, &error);
19293                                return Err(common::Error::JsonDecodeError(
19294                                    encoded.to_string(),
19295                                    error,
19296                                ));
19297                            }
19298                        }
19299                    };
19300
19301                    dlg.finished(true);
19302                    return Ok(response);
19303                }
19304            }
19305        }
19306    }
19307
19308    ///
19309    /// Sets the *request* property to the given value.
19310    ///
19311    /// Even though the property as already been set when instantiating this call,
19312    /// we provide this method for API completeness.
19313    pub fn request(
19314        mut self,
19315        new_value: ImportYumArtifactsRequest,
19316    ) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C> {
19317        self._request = new_value;
19318        self
19319    }
19320    /// The name of the parent resource where the artifacts will be imported.
19321    ///
19322    /// Sets the *parent* path property to the given value.
19323    ///
19324    /// Even though the property as already been set when instantiating this call,
19325    /// we provide this method for API completeness.
19326    pub fn parent(
19327        mut self,
19328        new_value: &str,
19329    ) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C> {
19330        self._parent = new_value.to_string();
19331        self
19332    }
19333    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19334    /// while executing the actual API request.
19335    ///
19336    /// ````text
19337    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19338    /// ````
19339    ///
19340    /// Sets the *delegate* property to the given value.
19341    pub fn delegate(
19342        mut self,
19343        new_value: &'a mut dyn common::Delegate,
19344    ) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C> {
19345        self._delegate = Some(new_value);
19346        self
19347    }
19348
19349    /// Set any additional parameter of the query string used in the request.
19350    /// It should be used to set parameters which are not yet available through their own
19351    /// setters.
19352    ///
19353    /// Please note that this method must not be used to set any of the known parameters
19354    /// which have their own setter method. If done anyway, the request will fail.
19355    ///
19356    /// # Additional Parameters
19357    ///
19358    /// * *$.xgafv* (query-string) - V1 error format.
19359    /// * *access_token* (query-string) - OAuth access token.
19360    /// * *alt* (query-string) - Data format for response.
19361    /// * *callback* (query-string) - JSONP
19362    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19363    /// * *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.
19364    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19365    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19366    /// * *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.
19367    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19368    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19369    pub fn param<T>(
19370        mut self,
19371        name: T,
19372        value: T,
19373    ) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C>
19374    where
19375        T: AsRef<str>,
19376    {
19377        self._additional_params
19378            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19379        self
19380    }
19381
19382    /// Identifies the authorization scope for the method you are building.
19383    ///
19384    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19385    /// [`Scope::CloudPlatform`].
19386    ///
19387    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19388    /// tokens for more than one scope.
19389    ///
19390    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19391    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19392    /// sufficient, a read-write scope will do as well.
19393    pub fn add_scope<St>(
19394        mut self,
19395        scope: St,
19396    ) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C>
19397    where
19398        St: AsRef<str>,
19399    {
19400        self._scopes.insert(String::from(scope.as_ref()));
19401        self
19402    }
19403    /// Identifies the authorization scope(s) for the method you are building.
19404    ///
19405    /// See [`Self::add_scope()`] for details.
19406    pub fn add_scopes<I, St>(
19407        mut self,
19408        scopes: I,
19409    ) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C>
19410    where
19411        I: IntoIterator<Item = St>,
19412        St: AsRef<str>,
19413    {
19414        self._scopes
19415            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19416        self
19417    }
19418
19419    /// Removes all scopes, and no default scope will be used either.
19420    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19421    /// for details).
19422    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryYumArtifactImportCall<'a, C> {
19423        self._scopes.clear();
19424        self
19425    }
19426}
19427
19428/// Directly uploads a Yum artifact. The returned Operation will complete once the resources are uploaded. Package, Version, and File resources are created based on the imported artifact. Imported artifacts that conflict with existing resources are ignored.
19429///
19430/// A builder for the *locations.repositories.yumArtifacts.upload* method supported by a *project* resource.
19431/// It is not used directly, but through a [`ProjectMethods`] instance.
19432///
19433/// # Example
19434///
19435/// Instantiate a resource method builder
19436///
19437/// ```test_harness,no_run
19438/// # extern crate hyper;
19439/// # extern crate hyper_rustls;
19440/// # extern crate google_artifactregistry1 as artifactregistry1;
19441/// use artifactregistry1::api::UploadYumArtifactRequest;
19442/// use std::fs;
19443/// # async fn dox() {
19444/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19445///
19446/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19447/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19448/// #     .with_native_roots()
19449/// #     .unwrap()
19450/// #     .https_only()
19451/// #     .enable_http2()
19452/// #     .build();
19453///
19454/// # let executor = hyper_util::rt::TokioExecutor::new();
19455/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19456/// #     secret,
19457/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19458/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19459/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19460/// #     ),
19461/// # ).build().await.unwrap();
19462///
19463/// # let client = hyper_util::client::legacy::Client::builder(
19464/// #     hyper_util::rt::TokioExecutor::new()
19465/// # )
19466/// # .build(
19467/// #     hyper_rustls::HttpsConnectorBuilder::new()
19468/// #         .with_native_roots()
19469/// #         .unwrap()
19470/// #         .https_or_http()
19471/// #         .enable_http2()
19472/// #         .build()
19473/// # );
19474/// # let mut hub = ArtifactRegistry::new(client, auth);
19475/// // As the method needs a request, you would usually fill it with the desired information
19476/// // into the respective structure. Some of the parts shown here might not be applicable !
19477/// // Values shown here are possibly random and not representative !
19478/// let mut req = UploadYumArtifactRequest::default();
19479///
19480/// // You can configure optional parameters by calling the respective setters at will, and
19481/// // execute the final call using `upload(...)`.
19482/// // Values shown here are possibly random and not representative !
19483/// let result = hub.projects().locations_repositories_yum_artifacts_upload(req, "parent")
19484///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
19485/// # }
19486/// ```
19487pub struct ProjectLocationRepositoryYumArtifactUploadCall<'a, C>
19488where
19489    C: 'a,
19490{
19491    hub: &'a ArtifactRegistry<C>,
19492    _request: UploadYumArtifactRequest,
19493    _parent: String,
19494    _delegate: Option<&'a mut dyn common::Delegate>,
19495    _additional_params: HashMap<String, String>,
19496    _scopes: BTreeSet<String>,
19497}
19498
19499impl<'a, C> common::CallBuilder for ProjectLocationRepositoryYumArtifactUploadCall<'a, C> {}
19500
19501impl<'a, C> ProjectLocationRepositoryYumArtifactUploadCall<'a, C>
19502where
19503    C: common::Connector,
19504{
19505    /// Perform the operation you have build so far.
19506    async fn doit<RS>(
19507        mut self,
19508        mut reader: RS,
19509        reader_mime_type: mime::Mime,
19510        protocol: common::UploadProtocol,
19511    ) -> common::Result<(common::Response, UploadYumArtifactMediaResponse)>
19512    where
19513        RS: common::ReadSeek,
19514    {
19515        use std::borrow::Cow;
19516        use std::io::{Read, Seek};
19517
19518        use common::{url::Params, ToParts};
19519        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19520
19521        let mut dd = common::DefaultDelegate;
19522        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19523        dlg.begin(common::MethodInfo {
19524            id: "artifactregistry.projects.locations.repositories.yumArtifacts.upload",
19525            http_method: hyper::Method::POST,
19526        });
19527
19528        for &field in ["alt", "parent"].iter() {
19529            if self._additional_params.contains_key(field) {
19530                dlg.finished(false);
19531                return Err(common::Error::FieldClash(field));
19532            }
19533        }
19534
19535        let mut params = Params::with_capacity(4 + self._additional_params.len());
19536        params.push("parent", self._parent);
19537
19538        params.extend(self._additional_params.iter());
19539
19540        params.push("alt", "json");
19541        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
19542            (
19543                self.hub._root_url.clone() + "upload/v1/{+parent}/yumArtifacts:create",
19544                "multipart",
19545            )
19546        } else {
19547            unreachable!()
19548        };
19549        params.push("uploadType", upload_type);
19550        if self._scopes.is_empty() {
19551            self._scopes
19552                .insert(Scope::CloudPlatform.as_ref().to_string());
19553        }
19554
19555        #[allow(clippy::single_element_loop)]
19556        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19557            url = params.uri_replacement(url, param_name, find_this, true);
19558        }
19559        {
19560            let to_remove = ["parent"];
19561            params.remove_params(&to_remove);
19562        }
19563
19564        let url = params.parse_with_url(&url);
19565
19566        let mut json_mime_type = mime::APPLICATION_JSON;
19567        let mut request_value_reader = {
19568            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19569            common::remove_json_null_values(&mut value);
19570            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19571            serde_json::to_writer(&mut dst, &value).unwrap();
19572            dst
19573        };
19574        let request_size = request_value_reader
19575            .seek(std::io::SeekFrom::End(0))
19576            .unwrap();
19577        request_value_reader
19578            .seek(std::io::SeekFrom::Start(0))
19579            .unwrap();
19580
19581        loop {
19582            let token = match self
19583                .hub
19584                .auth
19585                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19586                .await
19587            {
19588                Ok(token) => token,
19589                Err(e) => match dlg.token(e) {
19590                    Ok(token) => token,
19591                    Err(e) => {
19592                        dlg.finished(false);
19593                        return Err(common::Error::MissingToken(e));
19594                    }
19595                },
19596            };
19597            request_value_reader
19598                .seek(std::io::SeekFrom::Start(0))
19599                .unwrap();
19600            let mut req_result = {
19601                let mut mp_reader: common::MultiPartReader = Default::default();
19602                let (mut body_reader, content_type) = match protocol {
19603                    common::UploadProtocol::Simple => {
19604                        mp_reader.reserve_exact(2);
19605                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
19606                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
19607
19608                        mp_reader
19609                            .add_part(
19610                                &mut request_value_reader,
19611                                request_size,
19612                                json_mime_type.clone(),
19613                            )
19614                            .add_part(&mut reader, size, reader_mime_type.clone());
19615                        (
19616                            &mut mp_reader as &mut (dyn std::io::Read + Send),
19617                            common::MultiPartReader::mime_type(),
19618                        )
19619                    }
19620                    _ => (
19621                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
19622                        json_mime_type.clone(),
19623                    ),
19624                };
19625                let client = &self.hub.client;
19626                dlg.pre_request();
19627                let mut req_builder = hyper::Request::builder()
19628                    .method(hyper::Method::POST)
19629                    .uri(url.as_str())
19630                    .header(USER_AGENT, self.hub._user_agent.clone());
19631
19632                if let Some(token) = token.as_ref() {
19633                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19634                }
19635
19636                let mut body_reader_bytes = vec![];
19637                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
19638                let request = req_builder
19639                    .header(CONTENT_TYPE, content_type.to_string())
19640                    .body(common::to_body(body_reader_bytes.into()));
19641
19642                client.request(request.unwrap()).await
19643            };
19644
19645            match req_result {
19646                Err(err) => {
19647                    if let common::Retry::After(d) = dlg.http_error(&err) {
19648                        sleep(d).await;
19649                        continue;
19650                    }
19651                    dlg.finished(false);
19652                    return Err(common::Error::HttpError(err));
19653                }
19654                Ok(res) => {
19655                    let (mut parts, body) = res.into_parts();
19656                    let mut body = common::Body::new(body);
19657                    if !parts.status.is_success() {
19658                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19659                        let error = serde_json::from_str(&common::to_string(&bytes));
19660                        let response = common::to_response(parts, bytes.into());
19661
19662                        if let common::Retry::After(d) =
19663                            dlg.http_failure(&response, error.as_ref().ok())
19664                        {
19665                            sleep(d).await;
19666                            continue;
19667                        }
19668
19669                        dlg.finished(false);
19670
19671                        return Err(match error {
19672                            Ok(value) => common::Error::BadRequest(value),
19673                            _ => common::Error::Failure(response),
19674                        });
19675                    }
19676                    let response = {
19677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19678                        let encoded = common::to_string(&bytes);
19679                        match serde_json::from_str(&encoded) {
19680                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19681                            Err(error) => {
19682                                dlg.response_json_decode_error(&encoded, &error);
19683                                return Err(common::Error::JsonDecodeError(
19684                                    encoded.to_string(),
19685                                    error,
19686                                ));
19687                            }
19688                        }
19689                    };
19690
19691                    dlg.finished(true);
19692                    return Ok(response);
19693                }
19694            }
19695        }
19696    }
19697
19698    /// Upload media all at once.
19699    /// If the upload fails for whichever reason, all progress is lost.
19700    ///
19701    /// * *multipart*: yes
19702    /// * *max size*: 0kb
19703    /// * *valid mime types*: '*/*'
19704    pub async fn upload<RS>(
19705        self,
19706        stream: RS,
19707        mime_type: mime::Mime,
19708    ) -> common::Result<(common::Response, UploadYumArtifactMediaResponse)>
19709    where
19710        RS: common::ReadSeek,
19711    {
19712        self.doit(stream, mime_type, common::UploadProtocol::Simple)
19713            .await
19714    }
19715
19716    ///
19717    /// Sets the *request* property to the given value.
19718    ///
19719    /// Even though the property as already been set when instantiating this call,
19720    /// we provide this method for API completeness.
19721    pub fn request(
19722        mut self,
19723        new_value: UploadYumArtifactRequest,
19724    ) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C> {
19725        self._request = new_value;
19726        self
19727    }
19728    /// The name of the parent resource where the artifacts will be uploaded.
19729    ///
19730    /// Sets the *parent* path property to the given value.
19731    ///
19732    /// Even though the property as already been set when instantiating this call,
19733    /// we provide this method for API completeness.
19734    pub fn parent(
19735        mut self,
19736        new_value: &str,
19737    ) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C> {
19738        self._parent = new_value.to_string();
19739        self
19740    }
19741    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19742    /// while executing the actual API request.
19743    ///
19744    /// ````text
19745    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19746    /// ````
19747    ///
19748    /// Sets the *delegate* property to the given value.
19749    pub fn delegate(
19750        mut self,
19751        new_value: &'a mut dyn common::Delegate,
19752    ) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C> {
19753        self._delegate = Some(new_value);
19754        self
19755    }
19756
19757    /// Set any additional parameter of the query string used in the request.
19758    /// It should be used to set parameters which are not yet available through their own
19759    /// setters.
19760    ///
19761    /// Please note that this method must not be used to set any of the known parameters
19762    /// which have their own setter method. If done anyway, the request will fail.
19763    ///
19764    /// # Additional Parameters
19765    ///
19766    /// * *$.xgafv* (query-string) - V1 error format.
19767    /// * *access_token* (query-string) - OAuth access token.
19768    /// * *alt* (query-string) - Data format for response.
19769    /// * *callback* (query-string) - JSONP
19770    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19771    /// * *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.
19772    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19773    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19774    /// * *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.
19775    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19776    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19777    pub fn param<T>(
19778        mut self,
19779        name: T,
19780        value: T,
19781    ) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C>
19782    where
19783        T: AsRef<str>,
19784    {
19785        self._additional_params
19786            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19787        self
19788    }
19789
19790    /// Identifies the authorization scope for the method you are building.
19791    ///
19792    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19793    /// [`Scope::CloudPlatform`].
19794    ///
19795    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19796    /// tokens for more than one scope.
19797    ///
19798    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19799    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19800    /// sufficient, a read-write scope will do as well.
19801    pub fn add_scope<St>(
19802        mut self,
19803        scope: St,
19804    ) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C>
19805    where
19806        St: AsRef<str>,
19807    {
19808        self._scopes.insert(String::from(scope.as_ref()));
19809        self
19810    }
19811    /// Identifies the authorization scope(s) for the method you are building.
19812    ///
19813    /// See [`Self::add_scope()`] for details.
19814    pub fn add_scopes<I, St>(
19815        mut self,
19816        scopes: I,
19817    ) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C>
19818    where
19819        I: IntoIterator<Item = St>,
19820        St: AsRef<str>,
19821    {
19822        self._scopes
19823            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19824        self
19825    }
19826
19827    /// Removes all scopes, and no default scope will be used either.
19828    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19829    /// for details).
19830    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryYumArtifactUploadCall<'a, C> {
19831        self._scopes.clear();
19832        self
19833    }
19834}
19835
19836/// Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.
19837///
19838/// A builder for the *locations.repositories.create* method supported by a *project* resource.
19839/// It is not used directly, but through a [`ProjectMethods`] instance.
19840///
19841/// # Example
19842///
19843/// Instantiate a resource method builder
19844///
19845/// ```test_harness,no_run
19846/// # extern crate hyper;
19847/// # extern crate hyper_rustls;
19848/// # extern crate google_artifactregistry1 as artifactregistry1;
19849/// use artifactregistry1::api::Repository;
19850/// # async fn dox() {
19851/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19852///
19853/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19854/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19855/// #     .with_native_roots()
19856/// #     .unwrap()
19857/// #     .https_only()
19858/// #     .enable_http2()
19859/// #     .build();
19860///
19861/// # let executor = hyper_util::rt::TokioExecutor::new();
19862/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19863/// #     secret,
19864/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19865/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19866/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19867/// #     ),
19868/// # ).build().await.unwrap();
19869///
19870/// # let client = hyper_util::client::legacy::Client::builder(
19871/// #     hyper_util::rt::TokioExecutor::new()
19872/// # )
19873/// # .build(
19874/// #     hyper_rustls::HttpsConnectorBuilder::new()
19875/// #         .with_native_roots()
19876/// #         .unwrap()
19877/// #         .https_or_http()
19878/// #         .enable_http2()
19879/// #         .build()
19880/// # );
19881/// # let mut hub = ArtifactRegistry::new(client, auth);
19882/// // As the method needs a request, you would usually fill it with the desired information
19883/// // into the respective structure. Some of the parts shown here might not be applicable !
19884/// // Values shown here are possibly random and not representative !
19885/// let mut req = Repository::default();
19886///
19887/// // You can configure optional parameters by calling the respective setters at will, and
19888/// // execute the final call using `doit()`.
19889/// // Values shown here are possibly random and not representative !
19890/// let result = hub.projects().locations_repositories_create(req, "parent")
19891///              .repository_id("voluptua.")
19892///              .doit().await;
19893/// # }
19894/// ```
19895pub struct ProjectLocationRepositoryCreateCall<'a, C>
19896where
19897    C: 'a,
19898{
19899    hub: &'a ArtifactRegistry<C>,
19900    _request: Repository,
19901    _parent: String,
19902    _repository_id: Option<String>,
19903    _delegate: Option<&'a mut dyn common::Delegate>,
19904    _additional_params: HashMap<String, String>,
19905    _scopes: BTreeSet<String>,
19906}
19907
19908impl<'a, C> common::CallBuilder for ProjectLocationRepositoryCreateCall<'a, C> {}
19909
19910impl<'a, C> ProjectLocationRepositoryCreateCall<'a, C>
19911where
19912    C: common::Connector,
19913{
19914    /// Perform the operation you have build so far.
19915    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19916        use std::borrow::Cow;
19917        use std::io::{Read, Seek};
19918
19919        use common::{url::Params, ToParts};
19920        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19921
19922        let mut dd = common::DefaultDelegate;
19923        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19924        dlg.begin(common::MethodInfo {
19925            id: "artifactregistry.projects.locations.repositories.create",
19926            http_method: hyper::Method::POST,
19927        });
19928
19929        for &field in ["alt", "parent", "repositoryId"].iter() {
19930            if self._additional_params.contains_key(field) {
19931                dlg.finished(false);
19932                return Err(common::Error::FieldClash(field));
19933            }
19934        }
19935
19936        let mut params = Params::with_capacity(5 + self._additional_params.len());
19937        params.push("parent", self._parent);
19938        if let Some(value) = self._repository_id.as_ref() {
19939            params.push("repositoryId", value);
19940        }
19941
19942        params.extend(self._additional_params.iter());
19943
19944        params.push("alt", "json");
19945        let mut url = self.hub._base_url.clone() + "v1/{+parent}/repositories";
19946        if self._scopes.is_empty() {
19947            self._scopes
19948                .insert(Scope::CloudPlatform.as_ref().to_string());
19949        }
19950
19951        #[allow(clippy::single_element_loop)]
19952        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19953            url = params.uri_replacement(url, param_name, find_this, true);
19954        }
19955        {
19956            let to_remove = ["parent"];
19957            params.remove_params(&to_remove);
19958        }
19959
19960        let url = params.parse_with_url(&url);
19961
19962        let mut json_mime_type = mime::APPLICATION_JSON;
19963        let mut request_value_reader = {
19964            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19965            common::remove_json_null_values(&mut value);
19966            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19967            serde_json::to_writer(&mut dst, &value).unwrap();
19968            dst
19969        };
19970        let request_size = request_value_reader
19971            .seek(std::io::SeekFrom::End(0))
19972            .unwrap();
19973        request_value_reader
19974            .seek(std::io::SeekFrom::Start(0))
19975            .unwrap();
19976
19977        loop {
19978            let token = match self
19979                .hub
19980                .auth
19981                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19982                .await
19983            {
19984                Ok(token) => token,
19985                Err(e) => match dlg.token(e) {
19986                    Ok(token) => token,
19987                    Err(e) => {
19988                        dlg.finished(false);
19989                        return Err(common::Error::MissingToken(e));
19990                    }
19991                },
19992            };
19993            request_value_reader
19994                .seek(std::io::SeekFrom::Start(0))
19995                .unwrap();
19996            let mut req_result = {
19997                let client = &self.hub.client;
19998                dlg.pre_request();
19999                let mut req_builder = hyper::Request::builder()
20000                    .method(hyper::Method::POST)
20001                    .uri(url.as_str())
20002                    .header(USER_AGENT, self.hub._user_agent.clone());
20003
20004                if let Some(token) = token.as_ref() {
20005                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20006                }
20007
20008                let request = req_builder
20009                    .header(CONTENT_TYPE, json_mime_type.to_string())
20010                    .header(CONTENT_LENGTH, request_size as u64)
20011                    .body(common::to_body(
20012                        request_value_reader.get_ref().clone().into(),
20013                    ));
20014
20015                client.request(request.unwrap()).await
20016            };
20017
20018            match req_result {
20019                Err(err) => {
20020                    if let common::Retry::After(d) = dlg.http_error(&err) {
20021                        sleep(d).await;
20022                        continue;
20023                    }
20024                    dlg.finished(false);
20025                    return Err(common::Error::HttpError(err));
20026                }
20027                Ok(res) => {
20028                    let (mut parts, body) = res.into_parts();
20029                    let mut body = common::Body::new(body);
20030                    if !parts.status.is_success() {
20031                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20032                        let error = serde_json::from_str(&common::to_string(&bytes));
20033                        let response = common::to_response(parts, bytes.into());
20034
20035                        if let common::Retry::After(d) =
20036                            dlg.http_failure(&response, error.as_ref().ok())
20037                        {
20038                            sleep(d).await;
20039                            continue;
20040                        }
20041
20042                        dlg.finished(false);
20043
20044                        return Err(match error {
20045                            Ok(value) => common::Error::BadRequest(value),
20046                            _ => common::Error::Failure(response),
20047                        });
20048                    }
20049                    let response = {
20050                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20051                        let encoded = common::to_string(&bytes);
20052                        match serde_json::from_str(&encoded) {
20053                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20054                            Err(error) => {
20055                                dlg.response_json_decode_error(&encoded, &error);
20056                                return Err(common::Error::JsonDecodeError(
20057                                    encoded.to_string(),
20058                                    error,
20059                                ));
20060                            }
20061                        }
20062                    };
20063
20064                    dlg.finished(true);
20065                    return Ok(response);
20066                }
20067            }
20068        }
20069    }
20070
20071    ///
20072    /// Sets the *request* property to the given value.
20073    ///
20074    /// Even though the property as already been set when instantiating this call,
20075    /// we provide this method for API completeness.
20076    pub fn request(mut self, new_value: Repository) -> ProjectLocationRepositoryCreateCall<'a, C> {
20077        self._request = new_value;
20078        self
20079    }
20080    /// Required. The name of the parent resource where the repository will be created.
20081    ///
20082    /// Sets the *parent* path property to the given value.
20083    ///
20084    /// Even though the property as already been set when instantiating this call,
20085    /// we provide this method for API completeness.
20086    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryCreateCall<'a, C> {
20087        self._parent = new_value.to_string();
20088        self
20089    }
20090    /// Required. The repository id to use for this repository.
20091    ///
20092    /// Sets the *repository id* query property to the given value.
20093    pub fn repository_id(mut self, new_value: &str) -> ProjectLocationRepositoryCreateCall<'a, C> {
20094        self._repository_id = Some(new_value.to_string());
20095        self
20096    }
20097    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20098    /// while executing the actual API request.
20099    ///
20100    /// ````text
20101    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20102    /// ````
20103    ///
20104    /// Sets the *delegate* property to the given value.
20105    pub fn delegate(
20106        mut self,
20107        new_value: &'a mut dyn common::Delegate,
20108    ) -> ProjectLocationRepositoryCreateCall<'a, C> {
20109        self._delegate = Some(new_value);
20110        self
20111    }
20112
20113    /// Set any additional parameter of the query string used in the request.
20114    /// It should be used to set parameters which are not yet available through their own
20115    /// setters.
20116    ///
20117    /// Please note that this method must not be used to set any of the known parameters
20118    /// which have their own setter method. If done anyway, the request will fail.
20119    ///
20120    /// # Additional Parameters
20121    ///
20122    /// * *$.xgafv* (query-string) - V1 error format.
20123    /// * *access_token* (query-string) - OAuth access token.
20124    /// * *alt* (query-string) - Data format for response.
20125    /// * *callback* (query-string) - JSONP
20126    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20127    /// * *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.
20128    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20129    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20130    /// * *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.
20131    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20132    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20133    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryCreateCall<'a, C>
20134    where
20135        T: AsRef<str>,
20136    {
20137        self._additional_params
20138            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20139        self
20140    }
20141
20142    /// Identifies the authorization scope for the method you are building.
20143    ///
20144    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20145    /// [`Scope::CloudPlatform`].
20146    ///
20147    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20148    /// tokens for more than one scope.
20149    ///
20150    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20151    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20152    /// sufficient, a read-write scope will do as well.
20153    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryCreateCall<'a, C>
20154    where
20155        St: AsRef<str>,
20156    {
20157        self._scopes.insert(String::from(scope.as_ref()));
20158        self
20159    }
20160    /// Identifies the authorization scope(s) for the method you are building.
20161    ///
20162    /// See [`Self::add_scope()`] for details.
20163    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryCreateCall<'a, C>
20164    where
20165        I: IntoIterator<Item = St>,
20166        St: AsRef<str>,
20167    {
20168        self._scopes
20169            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20170        self
20171    }
20172
20173    /// Removes all scopes, and no default scope will be used either.
20174    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20175    /// for details).
20176    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryCreateCall<'a, C> {
20177        self._scopes.clear();
20178        self
20179    }
20180}
20181
20182/// Deletes a repository and all of its contents. The returned Operation will finish once the repository has been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response.
20183///
20184/// A builder for the *locations.repositories.delete* method supported by a *project* resource.
20185/// It is not used directly, but through a [`ProjectMethods`] instance.
20186///
20187/// # Example
20188///
20189/// Instantiate a resource method builder
20190///
20191/// ```test_harness,no_run
20192/// # extern crate hyper;
20193/// # extern crate hyper_rustls;
20194/// # extern crate google_artifactregistry1 as artifactregistry1;
20195/// # async fn dox() {
20196/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20197///
20198/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20199/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20200/// #     .with_native_roots()
20201/// #     .unwrap()
20202/// #     .https_only()
20203/// #     .enable_http2()
20204/// #     .build();
20205///
20206/// # let executor = hyper_util::rt::TokioExecutor::new();
20207/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20208/// #     secret,
20209/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20210/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20211/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20212/// #     ),
20213/// # ).build().await.unwrap();
20214///
20215/// # let client = hyper_util::client::legacy::Client::builder(
20216/// #     hyper_util::rt::TokioExecutor::new()
20217/// # )
20218/// # .build(
20219/// #     hyper_rustls::HttpsConnectorBuilder::new()
20220/// #         .with_native_roots()
20221/// #         .unwrap()
20222/// #         .https_or_http()
20223/// #         .enable_http2()
20224/// #         .build()
20225/// # );
20226/// # let mut hub = ArtifactRegistry::new(client, auth);
20227/// // You can configure optional parameters by calling the respective setters at will, and
20228/// // execute the final call using `doit()`.
20229/// // Values shown here are possibly random and not representative !
20230/// let result = hub.projects().locations_repositories_delete("name")
20231///              .doit().await;
20232/// # }
20233/// ```
20234pub struct ProjectLocationRepositoryDeleteCall<'a, C>
20235where
20236    C: 'a,
20237{
20238    hub: &'a ArtifactRegistry<C>,
20239    _name: String,
20240    _delegate: Option<&'a mut dyn common::Delegate>,
20241    _additional_params: HashMap<String, String>,
20242    _scopes: BTreeSet<String>,
20243}
20244
20245impl<'a, C> common::CallBuilder for ProjectLocationRepositoryDeleteCall<'a, C> {}
20246
20247impl<'a, C> ProjectLocationRepositoryDeleteCall<'a, C>
20248where
20249    C: common::Connector,
20250{
20251    /// Perform the operation you have build so far.
20252    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20253        use std::borrow::Cow;
20254        use std::io::{Read, Seek};
20255
20256        use common::{url::Params, ToParts};
20257        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20258
20259        let mut dd = common::DefaultDelegate;
20260        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20261        dlg.begin(common::MethodInfo {
20262            id: "artifactregistry.projects.locations.repositories.delete",
20263            http_method: hyper::Method::DELETE,
20264        });
20265
20266        for &field in ["alt", "name"].iter() {
20267            if self._additional_params.contains_key(field) {
20268                dlg.finished(false);
20269                return Err(common::Error::FieldClash(field));
20270            }
20271        }
20272
20273        let mut params = Params::with_capacity(3 + self._additional_params.len());
20274        params.push("name", self._name);
20275
20276        params.extend(self._additional_params.iter());
20277
20278        params.push("alt", "json");
20279        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20280        if self._scopes.is_empty() {
20281            self._scopes
20282                .insert(Scope::CloudPlatform.as_ref().to_string());
20283        }
20284
20285        #[allow(clippy::single_element_loop)]
20286        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20287            url = params.uri_replacement(url, param_name, find_this, true);
20288        }
20289        {
20290            let to_remove = ["name"];
20291            params.remove_params(&to_remove);
20292        }
20293
20294        let url = params.parse_with_url(&url);
20295
20296        loop {
20297            let token = match self
20298                .hub
20299                .auth
20300                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20301                .await
20302            {
20303                Ok(token) => token,
20304                Err(e) => match dlg.token(e) {
20305                    Ok(token) => token,
20306                    Err(e) => {
20307                        dlg.finished(false);
20308                        return Err(common::Error::MissingToken(e));
20309                    }
20310                },
20311            };
20312            let mut req_result = {
20313                let client = &self.hub.client;
20314                dlg.pre_request();
20315                let mut req_builder = hyper::Request::builder()
20316                    .method(hyper::Method::DELETE)
20317                    .uri(url.as_str())
20318                    .header(USER_AGENT, self.hub._user_agent.clone());
20319
20320                if let Some(token) = token.as_ref() {
20321                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20322                }
20323
20324                let request = req_builder
20325                    .header(CONTENT_LENGTH, 0_u64)
20326                    .body(common::to_body::<String>(None));
20327
20328                client.request(request.unwrap()).await
20329            };
20330
20331            match req_result {
20332                Err(err) => {
20333                    if let common::Retry::After(d) = dlg.http_error(&err) {
20334                        sleep(d).await;
20335                        continue;
20336                    }
20337                    dlg.finished(false);
20338                    return Err(common::Error::HttpError(err));
20339                }
20340                Ok(res) => {
20341                    let (mut parts, body) = res.into_parts();
20342                    let mut body = common::Body::new(body);
20343                    if !parts.status.is_success() {
20344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20345                        let error = serde_json::from_str(&common::to_string(&bytes));
20346                        let response = common::to_response(parts, bytes.into());
20347
20348                        if let common::Retry::After(d) =
20349                            dlg.http_failure(&response, error.as_ref().ok())
20350                        {
20351                            sleep(d).await;
20352                            continue;
20353                        }
20354
20355                        dlg.finished(false);
20356
20357                        return Err(match error {
20358                            Ok(value) => common::Error::BadRequest(value),
20359                            _ => common::Error::Failure(response),
20360                        });
20361                    }
20362                    let response = {
20363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20364                        let encoded = common::to_string(&bytes);
20365                        match serde_json::from_str(&encoded) {
20366                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20367                            Err(error) => {
20368                                dlg.response_json_decode_error(&encoded, &error);
20369                                return Err(common::Error::JsonDecodeError(
20370                                    encoded.to_string(),
20371                                    error,
20372                                ));
20373                            }
20374                        }
20375                    };
20376
20377                    dlg.finished(true);
20378                    return Ok(response);
20379                }
20380            }
20381        }
20382    }
20383
20384    /// Required. The name of the repository to delete.
20385    ///
20386    /// Sets the *name* path property to the given value.
20387    ///
20388    /// Even though the property as already been set when instantiating this call,
20389    /// we provide this method for API completeness.
20390    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryDeleteCall<'a, C> {
20391        self._name = new_value.to_string();
20392        self
20393    }
20394    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20395    /// while executing the actual API request.
20396    ///
20397    /// ````text
20398    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20399    /// ````
20400    ///
20401    /// Sets the *delegate* property to the given value.
20402    pub fn delegate(
20403        mut self,
20404        new_value: &'a mut dyn common::Delegate,
20405    ) -> ProjectLocationRepositoryDeleteCall<'a, C> {
20406        self._delegate = Some(new_value);
20407        self
20408    }
20409
20410    /// Set any additional parameter of the query string used in the request.
20411    /// It should be used to set parameters which are not yet available through their own
20412    /// setters.
20413    ///
20414    /// Please note that this method must not be used to set any of the known parameters
20415    /// which have their own setter method. If done anyway, the request will fail.
20416    ///
20417    /// # Additional Parameters
20418    ///
20419    /// * *$.xgafv* (query-string) - V1 error format.
20420    /// * *access_token* (query-string) - OAuth access token.
20421    /// * *alt* (query-string) - Data format for response.
20422    /// * *callback* (query-string) - JSONP
20423    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20424    /// * *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.
20425    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20426    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20427    /// * *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.
20428    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20429    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20430    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryDeleteCall<'a, C>
20431    where
20432        T: AsRef<str>,
20433    {
20434        self._additional_params
20435            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20436        self
20437    }
20438
20439    /// Identifies the authorization scope for the method you are building.
20440    ///
20441    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20442    /// [`Scope::CloudPlatform`].
20443    ///
20444    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20445    /// tokens for more than one scope.
20446    ///
20447    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20448    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20449    /// sufficient, a read-write scope will do as well.
20450    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryDeleteCall<'a, C>
20451    where
20452        St: AsRef<str>,
20453    {
20454        self._scopes.insert(String::from(scope.as_ref()));
20455        self
20456    }
20457    /// Identifies the authorization scope(s) for the method you are building.
20458    ///
20459    /// See [`Self::add_scope()`] for details.
20460    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryDeleteCall<'a, C>
20461    where
20462        I: IntoIterator<Item = St>,
20463        St: AsRef<str>,
20464    {
20465        self._scopes
20466            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20467        self
20468    }
20469
20470    /// Removes all scopes, and no default scope will be used either.
20471    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20472    /// for details).
20473    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryDeleteCall<'a, C> {
20474        self._scopes.clear();
20475        self
20476    }
20477}
20478
20479/// Exports an artifact to a Cloud Storage bucket.
20480///
20481/// A builder for the *locations.repositories.exportArtifact* method supported by a *project* resource.
20482/// It is not used directly, but through a [`ProjectMethods`] instance.
20483///
20484/// # Example
20485///
20486/// Instantiate a resource method builder
20487///
20488/// ```test_harness,no_run
20489/// # extern crate hyper;
20490/// # extern crate hyper_rustls;
20491/// # extern crate google_artifactregistry1 as artifactregistry1;
20492/// use artifactregistry1::api::ExportArtifactRequest;
20493/// # async fn dox() {
20494/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20495///
20496/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20497/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20498/// #     .with_native_roots()
20499/// #     .unwrap()
20500/// #     .https_only()
20501/// #     .enable_http2()
20502/// #     .build();
20503///
20504/// # let executor = hyper_util::rt::TokioExecutor::new();
20505/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20506/// #     secret,
20507/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20508/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20509/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20510/// #     ),
20511/// # ).build().await.unwrap();
20512///
20513/// # let client = hyper_util::client::legacy::Client::builder(
20514/// #     hyper_util::rt::TokioExecutor::new()
20515/// # )
20516/// # .build(
20517/// #     hyper_rustls::HttpsConnectorBuilder::new()
20518/// #         .with_native_roots()
20519/// #         .unwrap()
20520/// #         .https_or_http()
20521/// #         .enable_http2()
20522/// #         .build()
20523/// # );
20524/// # let mut hub = ArtifactRegistry::new(client, auth);
20525/// // As the method needs a request, you would usually fill it with the desired information
20526/// // into the respective structure. Some of the parts shown here might not be applicable !
20527/// // Values shown here are possibly random and not representative !
20528/// let mut req = ExportArtifactRequest::default();
20529///
20530/// // You can configure optional parameters by calling the respective setters at will, and
20531/// // execute the final call using `doit()`.
20532/// // Values shown here are possibly random and not representative !
20533/// let result = hub.projects().locations_repositories_export_artifact(req, "repository")
20534///              .doit().await;
20535/// # }
20536/// ```
20537pub struct ProjectLocationRepositoryExportArtifactCall<'a, C>
20538where
20539    C: 'a,
20540{
20541    hub: &'a ArtifactRegistry<C>,
20542    _request: ExportArtifactRequest,
20543    _repository: String,
20544    _delegate: Option<&'a mut dyn common::Delegate>,
20545    _additional_params: HashMap<String, String>,
20546    _scopes: BTreeSet<String>,
20547}
20548
20549impl<'a, C> common::CallBuilder for ProjectLocationRepositoryExportArtifactCall<'a, C> {}
20550
20551impl<'a, C> ProjectLocationRepositoryExportArtifactCall<'a, C>
20552where
20553    C: common::Connector,
20554{
20555    /// Perform the operation you have build so far.
20556    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20557        use std::borrow::Cow;
20558        use std::io::{Read, Seek};
20559
20560        use common::{url::Params, ToParts};
20561        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20562
20563        let mut dd = common::DefaultDelegate;
20564        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20565        dlg.begin(common::MethodInfo {
20566            id: "artifactregistry.projects.locations.repositories.exportArtifact",
20567            http_method: hyper::Method::POST,
20568        });
20569
20570        for &field in ["alt", "repository"].iter() {
20571            if self._additional_params.contains_key(field) {
20572                dlg.finished(false);
20573                return Err(common::Error::FieldClash(field));
20574            }
20575        }
20576
20577        let mut params = Params::with_capacity(4 + self._additional_params.len());
20578        params.push("repository", self._repository);
20579
20580        params.extend(self._additional_params.iter());
20581
20582        params.push("alt", "json");
20583        let mut url = self.hub._base_url.clone() + "v1/{+repository}:exportArtifact";
20584        if self._scopes.is_empty() {
20585            self._scopes
20586                .insert(Scope::CloudPlatform.as_ref().to_string());
20587        }
20588
20589        #[allow(clippy::single_element_loop)]
20590        for &(find_this, param_name) in [("{+repository}", "repository")].iter() {
20591            url = params.uri_replacement(url, param_name, find_this, true);
20592        }
20593        {
20594            let to_remove = ["repository"];
20595            params.remove_params(&to_remove);
20596        }
20597
20598        let url = params.parse_with_url(&url);
20599
20600        let mut json_mime_type = mime::APPLICATION_JSON;
20601        let mut request_value_reader = {
20602            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20603            common::remove_json_null_values(&mut value);
20604            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20605            serde_json::to_writer(&mut dst, &value).unwrap();
20606            dst
20607        };
20608        let request_size = request_value_reader
20609            .seek(std::io::SeekFrom::End(0))
20610            .unwrap();
20611        request_value_reader
20612            .seek(std::io::SeekFrom::Start(0))
20613            .unwrap();
20614
20615        loop {
20616            let token = match self
20617                .hub
20618                .auth
20619                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20620                .await
20621            {
20622                Ok(token) => token,
20623                Err(e) => match dlg.token(e) {
20624                    Ok(token) => token,
20625                    Err(e) => {
20626                        dlg.finished(false);
20627                        return Err(common::Error::MissingToken(e));
20628                    }
20629                },
20630            };
20631            request_value_reader
20632                .seek(std::io::SeekFrom::Start(0))
20633                .unwrap();
20634            let mut req_result = {
20635                let client = &self.hub.client;
20636                dlg.pre_request();
20637                let mut req_builder = hyper::Request::builder()
20638                    .method(hyper::Method::POST)
20639                    .uri(url.as_str())
20640                    .header(USER_AGENT, self.hub._user_agent.clone());
20641
20642                if let Some(token) = token.as_ref() {
20643                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20644                }
20645
20646                let request = req_builder
20647                    .header(CONTENT_TYPE, json_mime_type.to_string())
20648                    .header(CONTENT_LENGTH, request_size as u64)
20649                    .body(common::to_body(
20650                        request_value_reader.get_ref().clone().into(),
20651                    ));
20652
20653                client.request(request.unwrap()).await
20654            };
20655
20656            match req_result {
20657                Err(err) => {
20658                    if let common::Retry::After(d) = dlg.http_error(&err) {
20659                        sleep(d).await;
20660                        continue;
20661                    }
20662                    dlg.finished(false);
20663                    return Err(common::Error::HttpError(err));
20664                }
20665                Ok(res) => {
20666                    let (mut parts, body) = res.into_parts();
20667                    let mut body = common::Body::new(body);
20668                    if !parts.status.is_success() {
20669                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20670                        let error = serde_json::from_str(&common::to_string(&bytes));
20671                        let response = common::to_response(parts, bytes.into());
20672
20673                        if let common::Retry::After(d) =
20674                            dlg.http_failure(&response, error.as_ref().ok())
20675                        {
20676                            sleep(d).await;
20677                            continue;
20678                        }
20679
20680                        dlg.finished(false);
20681
20682                        return Err(match error {
20683                            Ok(value) => common::Error::BadRequest(value),
20684                            _ => common::Error::Failure(response),
20685                        });
20686                    }
20687                    let response = {
20688                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20689                        let encoded = common::to_string(&bytes);
20690                        match serde_json::from_str(&encoded) {
20691                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20692                            Err(error) => {
20693                                dlg.response_json_decode_error(&encoded, &error);
20694                                return Err(common::Error::JsonDecodeError(
20695                                    encoded.to_string(),
20696                                    error,
20697                                ));
20698                            }
20699                        }
20700                    };
20701
20702                    dlg.finished(true);
20703                    return Ok(response);
20704                }
20705            }
20706        }
20707    }
20708
20709    ///
20710    /// Sets the *request* property to the given value.
20711    ///
20712    /// Even though the property as already been set when instantiating this call,
20713    /// we provide this method for API completeness.
20714    pub fn request(
20715        mut self,
20716        new_value: ExportArtifactRequest,
20717    ) -> ProjectLocationRepositoryExportArtifactCall<'a, C> {
20718        self._request = new_value;
20719        self
20720    }
20721    /// Required. The repository of the artifact to export. Format: projects/{project}/locations/{location}/repositories/{repository}
20722    ///
20723    /// Sets the *repository* path property to the given value.
20724    ///
20725    /// Even though the property as already been set when instantiating this call,
20726    /// we provide this method for API completeness.
20727    pub fn repository(
20728        mut self,
20729        new_value: &str,
20730    ) -> ProjectLocationRepositoryExportArtifactCall<'a, C> {
20731        self._repository = new_value.to_string();
20732        self
20733    }
20734    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20735    /// while executing the actual API request.
20736    ///
20737    /// ````text
20738    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20739    /// ````
20740    ///
20741    /// Sets the *delegate* property to the given value.
20742    pub fn delegate(
20743        mut self,
20744        new_value: &'a mut dyn common::Delegate,
20745    ) -> ProjectLocationRepositoryExportArtifactCall<'a, C> {
20746        self._delegate = Some(new_value);
20747        self
20748    }
20749
20750    /// Set any additional parameter of the query string used in the request.
20751    /// It should be used to set parameters which are not yet available through their own
20752    /// setters.
20753    ///
20754    /// Please note that this method must not be used to set any of the known parameters
20755    /// which have their own setter method. If done anyway, the request will fail.
20756    ///
20757    /// # Additional Parameters
20758    ///
20759    /// * *$.xgafv* (query-string) - V1 error format.
20760    /// * *access_token* (query-string) - OAuth access token.
20761    /// * *alt* (query-string) - Data format for response.
20762    /// * *callback* (query-string) - JSONP
20763    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20764    /// * *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.
20765    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20766    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20767    /// * *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.
20768    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20769    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20770    pub fn param<T>(
20771        mut self,
20772        name: T,
20773        value: T,
20774    ) -> ProjectLocationRepositoryExportArtifactCall<'a, C>
20775    where
20776        T: AsRef<str>,
20777    {
20778        self._additional_params
20779            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20780        self
20781    }
20782
20783    /// Identifies the authorization scope for the method you are building.
20784    ///
20785    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20786    /// [`Scope::CloudPlatform`].
20787    ///
20788    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20789    /// tokens for more than one scope.
20790    ///
20791    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20792    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20793    /// sufficient, a read-write scope will do as well.
20794    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryExportArtifactCall<'a, C>
20795    where
20796        St: AsRef<str>,
20797    {
20798        self._scopes.insert(String::from(scope.as_ref()));
20799        self
20800    }
20801    /// Identifies the authorization scope(s) for the method you are building.
20802    ///
20803    /// See [`Self::add_scope()`] for details.
20804    pub fn add_scopes<I, St>(
20805        mut self,
20806        scopes: I,
20807    ) -> ProjectLocationRepositoryExportArtifactCall<'a, C>
20808    where
20809        I: IntoIterator<Item = St>,
20810        St: AsRef<str>,
20811    {
20812        self._scopes
20813            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20814        self
20815    }
20816
20817    /// Removes all scopes, and no default scope will be used either.
20818    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20819    /// for details).
20820    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryExportArtifactCall<'a, C> {
20821        self._scopes.clear();
20822        self
20823    }
20824}
20825
20826/// Gets a repository.
20827///
20828/// A builder for the *locations.repositories.get* method supported by a *project* resource.
20829/// It is not used directly, but through a [`ProjectMethods`] instance.
20830///
20831/// # Example
20832///
20833/// Instantiate a resource method builder
20834///
20835/// ```test_harness,no_run
20836/// # extern crate hyper;
20837/// # extern crate hyper_rustls;
20838/// # extern crate google_artifactregistry1 as artifactregistry1;
20839/// # async fn dox() {
20840/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20841///
20842/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20843/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20844/// #     .with_native_roots()
20845/// #     .unwrap()
20846/// #     .https_only()
20847/// #     .enable_http2()
20848/// #     .build();
20849///
20850/// # let executor = hyper_util::rt::TokioExecutor::new();
20851/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20852/// #     secret,
20853/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20854/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20855/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20856/// #     ),
20857/// # ).build().await.unwrap();
20858///
20859/// # let client = hyper_util::client::legacy::Client::builder(
20860/// #     hyper_util::rt::TokioExecutor::new()
20861/// # )
20862/// # .build(
20863/// #     hyper_rustls::HttpsConnectorBuilder::new()
20864/// #         .with_native_roots()
20865/// #         .unwrap()
20866/// #         .https_or_http()
20867/// #         .enable_http2()
20868/// #         .build()
20869/// # );
20870/// # let mut hub = ArtifactRegistry::new(client, auth);
20871/// // You can configure optional parameters by calling the respective setters at will, and
20872/// // execute the final call using `doit()`.
20873/// // Values shown here are possibly random and not representative !
20874/// let result = hub.projects().locations_repositories_get("name")
20875///              .doit().await;
20876/// # }
20877/// ```
20878pub struct ProjectLocationRepositoryGetCall<'a, C>
20879where
20880    C: 'a,
20881{
20882    hub: &'a ArtifactRegistry<C>,
20883    _name: String,
20884    _delegate: Option<&'a mut dyn common::Delegate>,
20885    _additional_params: HashMap<String, String>,
20886    _scopes: BTreeSet<String>,
20887}
20888
20889impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGetCall<'a, C> {}
20890
20891impl<'a, C> ProjectLocationRepositoryGetCall<'a, C>
20892where
20893    C: common::Connector,
20894{
20895    /// Perform the operation you have build so far.
20896    pub async fn doit(mut self) -> common::Result<(common::Response, Repository)> {
20897        use std::borrow::Cow;
20898        use std::io::{Read, Seek};
20899
20900        use common::{url::Params, ToParts};
20901        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20902
20903        let mut dd = common::DefaultDelegate;
20904        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20905        dlg.begin(common::MethodInfo {
20906            id: "artifactregistry.projects.locations.repositories.get",
20907            http_method: hyper::Method::GET,
20908        });
20909
20910        for &field in ["alt", "name"].iter() {
20911            if self._additional_params.contains_key(field) {
20912                dlg.finished(false);
20913                return Err(common::Error::FieldClash(field));
20914            }
20915        }
20916
20917        let mut params = Params::with_capacity(3 + self._additional_params.len());
20918        params.push("name", self._name);
20919
20920        params.extend(self._additional_params.iter());
20921
20922        params.push("alt", "json");
20923        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20924        if self._scopes.is_empty() {
20925            self._scopes
20926                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
20927        }
20928
20929        #[allow(clippy::single_element_loop)]
20930        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20931            url = params.uri_replacement(url, param_name, find_this, true);
20932        }
20933        {
20934            let to_remove = ["name"];
20935            params.remove_params(&to_remove);
20936        }
20937
20938        let url = params.parse_with_url(&url);
20939
20940        loop {
20941            let token = match self
20942                .hub
20943                .auth
20944                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20945                .await
20946            {
20947                Ok(token) => token,
20948                Err(e) => match dlg.token(e) {
20949                    Ok(token) => token,
20950                    Err(e) => {
20951                        dlg.finished(false);
20952                        return Err(common::Error::MissingToken(e));
20953                    }
20954                },
20955            };
20956            let mut req_result = {
20957                let client = &self.hub.client;
20958                dlg.pre_request();
20959                let mut req_builder = hyper::Request::builder()
20960                    .method(hyper::Method::GET)
20961                    .uri(url.as_str())
20962                    .header(USER_AGENT, self.hub._user_agent.clone());
20963
20964                if let Some(token) = token.as_ref() {
20965                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20966                }
20967
20968                let request = req_builder
20969                    .header(CONTENT_LENGTH, 0_u64)
20970                    .body(common::to_body::<String>(None));
20971
20972                client.request(request.unwrap()).await
20973            };
20974
20975            match req_result {
20976                Err(err) => {
20977                    if let common::Retry::After(d) = dlg.http_error(&err) {
20978                        sleep(d).await;
20979                        continue;
20980                    }
20981                    dlg.finished(false);
20982                    return Err(common::Error::HttpError(err));
20983                }
20984                Ok(res) => {
20985                    let (mut parts, body) = res.into_parts();
20986                    let mut body = common::Body::new(body);
20987                    if !parts.status.is_success() {
20988                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20989                        let error = serde_json::from_str(&common::to_string(&bytes));
20990                        let response = common::to_response(parts, bytes.into());
20991
20992                        if let common::Retry::After(d) =
20993                            dlg.http_failure(&response, error.as_ref().ok())
20994                        {
20995                            sleep(d).await;
20996                            continue;
20997                        }
20998
20999                        dlg.finished(false);
21000
21001                        return Err(match error {
21002                            Ok(value) => common::Error::BadRequest(value),
21003                            _ => common::Error::Failure(response),
21004                        });
21005                    }
21006                    let response = {
21007                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21008                        let encoded = common::to_string(&bytes);
21009                        match serde_json::from_str(&encoded) {
21010                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21011                            Err(error) => {
21012                                dlg.response_json_decode_error(&encoded, &error);
21013                                return Err(common::Error::JsonDecodeError(
21014                                    encoded.to_string(),
21015                                    error,
21016                                ));
21017                            }
21018                        }
21019                    };
21020
21021                    dlg.finished(true);
21022                    return Ok(response);
21023                }
21024            }
21025        }
21026    }
21027
21028    /// Required. The name of the repository to retrieve.
21029    ///
21030    /// Sets the *name* path property to the given value.
21031    ///
21032    /// Even though the property as already been set when instantiating this call,
21033    /// we provide this method for API completeness.
21034    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryGetCall<'a, C> {
21035        self._name = new_value.to_string();
21036        self
21037    }
21038    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21039    /// while executing the actual API request.
21040    ///
21041    /// ````text
21042    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21043    /// ````
21044    ///
21045    /// Sets the *delegate* property to the given value.
21046    pub fn delegate(
21047        mut self,
21048        new_value: &'a mut dyn common::Delegate,
21049    ) -> ProjectLocationRepositoryGetCall<'a, C> {
21050        self._delegate = Some(new_value);
21051        self
21052    }
21053
21054    /// Set any additional parameter of the query string used in the request.
21055    /// It should be used to set parameters which are not yet available through their own
21056    /// setters.
21057    ///
21058    /// Please note that this method must not be used to set any of the known parameters
21059    /// which have their own setter method. If done anyway, the request will fail.
21060    ///
21061    /// # Additional Parameters
21062    ///
21063    /// * *$.xgafv* (query-string) - V1 error format.
21064    /// * *access_token* (query-string) - OAuth access token.
21065    /// * *alt* (query-string) - Data format for response.
21066    /// * *callback* (query-string) - JSONP
21067    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21068    /// * *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.
21069    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21070    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21071    /// * *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.
21072    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21073    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21074    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryGetCall<'a, C>
21075    where
21076        T: AsRef<str>,
21077    {
21078        self._additional_params
21079            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21080        self
21081    }
21082
21083    /// Identifies the authorization scope for the method you are building.
21084    ///
21085    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21086    /// [`Scope::CloudPlatformReadOnly`].
21087    ///
21088    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21089    /// tokens for more than one scope.
21090    ///
21091    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21092    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21093    /// sufficient, a read-write scope will do as well.
21094    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryGetCall<'a, C>
21095    where
21096        St: AsRef<str>,
21097    {
21098        self._scopes.insert(String::from(scope.as_ref()));
21099        self
21100    }
21101    /// Identifies the authorization scope(s) for the method you are building.
21102    ///
21103    /// See [`Self::add_scope()`] for details.
21104    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryGetCall<'a, C>
21105    where
21106        I: IntoIterator<Item = St>,
21107        St: AsRef<str>,
21108    {
21109        self._scopes
21110            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21111        self
21112    }
21113
21114    /// Removes all scopes, and no default scope will be used either.
21115    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21116    /// for details).
21117    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGetCall<'a, C> {
21118        self._scopes.clear();
21119        self
21120    }
21121}
21122
21123/// Gets the IAM policy for a given resource.
21124///
21125/// A builder for the *locations.repositories.getIamPolicy* method supported by a *project* resource.
21126/// It is not used directly, but through a [`ProjectMethods`] instance.
21127///
21128/// # Example
21129///
21130/// Instantiate a resource method builder
21131///
21132/// ```test_harness,no_run
21133/// # extern crate hyper;
21134/// # extern crate hyper_rustls;
21135/// # extern crate google_artifactregistry1 as artifactregistry1;
21136/// # async fn dox() {
21137/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21138///
21139/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21140/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21141/// #     .with_native_roots()
21142/// #     .unwrap()
21143/// #     .https_only()
21144/// #     .enable_http2()
21145/// #     .build();
21146///
21147/// # let executor = hyper_util::rt::TokioExecutor::new();
21148/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21149/// #     secret,
21150/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21151/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21152/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21153/// #     ),
21154/// # ).build().await.unwrap();
21155///
21156/// # let client = hyper_util::client::legacy::Client::builder(
21157/// #     hyper_util::rt::TokioExecutor::new()
21158/// # )
21159/// # .build(
21160/// #     hyper_rustls::HttpsConnectorBuilder::new()
21161/// #         .with_native_roots()
21162/// #         .unwrap()
21163/// #         .https_or_http()
21164/// #         .enable_http2()
21165/// #         .build()
21166/// # );
21167/// # let mut hub = ArtifactRegistry::new(client, auth);
21168/// // You can configure optional parameters by calling the respective setters at will, and
21169/// // execute the final call using `doit()`.
21170/// // Values shown here are possibly random and not representative !
21171/// let result = hub.projects().locations_repositories_get_iam_policy("resource")
21172///              .options_requested_policy_version(-2)
21173///              .doit().await;
21174/// # }
21175/// ```
21176pub struct ProjectLocationRepositoryGetIamPolicyCall<'a, C>
21177where
21178    C: 'a,
21179{
21180    hub: &'a ArtifactRegistry<C>,
21181    _resource: String,
21182    _options_requested_policy_version: Option<i32>,
21183    _delegate: Option<&'a mut dyn common::Delegate>,
21184    _additional_params: HashMap<String, String>,
21185    _scopes: BTreeSet<String>,
21186}
21187
21188impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGetIamPolicyCall<'a, C> {}
21189
21190impl<'a, C> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
21191where
21192    C: common::Connector,
21193{
21194    /// Perform the operation you have build so far.
21195    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
21196        use std::borrow::Cow;
21197        use std::io::{Read, Seek};
21198
21199        use common::{url::Params, ToParts};
21200        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21201
21202        let mut dd = common::DefaultDelegate;
21203        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21204        dlg.begin(common::MethodInfo {
21205            id: "artifactregistry.projects.locations.repositories.getIamPolicy",
21206            http_method: hyper::Method::GET,
21207        });
21208
21209        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
21210            if self._additional_params.contains_key(field) {
21211                dlg.finished(false);
21212                return Err(common::Error::FieldClash(field));
21213            }
21214        }
21215
21216        let mut params = Params::with_capacity(4 + self._additional_params.len());
21217        params.push("resource", self._resource);
21218        if let Some(value) = self._options_requested_policy_version.as_ref() {
21219            params.push("options.requestedPolicyVersion", value.to_string());
21220        }
21221
21222        params.extend(self._additional_params.iter());
21223
21224        params.push("alt", "json");
21225        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
21226        if self._scopes.is_empty() {
21227            self._scopes
21228                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
21229        }
21230
21231        #[allow(clippy::single_element_loop)]
21232        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
21233            url = params.uri_replacement(url, param_name, find_this, true);
21234        }
21235        {
21236            let to_remove = ["resource"];
21237            params.remove_params(&to_remove);
21238        }
21239
21240        let url = params.parse_with_url(&url);
21241
21242        loop {
21243            let token = match self
21244                .hub
21245                .auth
21246                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21247                .await
21248            {
21249                Ok(token) => token,
21250                Err(e) => match dlg.token(e) {
21251                    Ok(token) => token,
21252                    Err(e) => {
21253                        dlg.finished(false);
21254                        return Err(common::Error::MissingToken(e));
21255                    }
21256                },
21257            };
21258            let mut req_result = {
21259                let client = &self.hub.client;
21260                dlg.pre_request();
21261                let mut req_builder = hyper::Request::builder()
21262                    .method(hyper::Method::GET)
21263                    .uri(url.as_str())
21264                    .header(USER_AGENT, self.hub._user_agent.clone());
21265
21266                if let Some(token) = token.as_ref() {
21267                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21268                }
21269
21270                let request = req_builder
21271                    .header(CONTENT_LENGTH, 0_u64)
21272                    .body(common::to_body::<String>(None));
21273
21274                client.request(request.unwrap()).await
21275            };
21276
21277            match req_result {
21278                Err(err) => {
21279                    if let common::Retry::After(d) = dlg.http_error(&err) {
21280                        sleep(d).await;
21281                        continue;
21282                    }
21283                    dlg.finished(false);
21284                    return Err(common::Error::HttpError(err));
21285                }
21286                Ok(res) => {
21287                    let (mut parts, body) = res.into_parts();
21288                    let mut body = common::Body::new(body);
21289                    if !parts.status.is_success() {
21290                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21291                        let error = serde_json::from_str(&common::to_string(&bytes));
21292                        let response = common::to_response(parts, bytes.into());
21293
21294                        if let common::Retry::After(d) =
21295                            dlg.http_failure(&response, error.as_ref().ok())
21296                        {
21297                            sleep(d).await;
21298                            continue;
21299                        }
21300
21301                        dlg.finished(false);
21302
21303                        return Err(match error {
21304                            Ok(value) => common::Error::BadRequest(value),
21305                            _ => common::Error::Failure(response),
21306                        });
21307                    }
21308                    let response = {
21309                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21310                        let encoded = common::to_string(&bytes);
21311                        match serde_json::from_str(&encoded) {
21312                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21313                            Err(error) => {
21314                                dlg.response_json_decode_error(&encoded, &error);
21315                                return Err(common::Error::JsonDecodeError(
21316                                    encoded.to_string(),
21317                                    error,
21318                                ));
21319                            }
21320                        }
21321                    };
21322
21323                    dlg.finished(true);
21324                    return Ok(response);
21325                }
21326            }
21327        }
21328    }
21329
21330    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
21331    ///
21332    /// Sets the *resource* path property to the given value.
21333    ///
21334    /// Even though the property as already been set when instantiating this call,
21335    /// we provide this method for API completeness.
21336    pub fn resource(mut self, new_value: &str) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
21337        self._resource = new_value.to_string();
21338        self
21339    }
21340    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
21341    ///
21342    /// Sets the *options.requested policy version* query property to the given value.
21343    pub fn options_requested_policy_version(
21344        mut self,
21345        new_value: i32,
21346    ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
21347        self._options_requested_policy_version = Some(new_value);
21348        self
21349    }
21350    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21351    /// while executing the actual API request.
21352    ///
21353    /// ````text
21354    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21355    /// ````
21356    ///
21357    /// Sets the *delegate* property to the given value.
21358    pub fn delegate(
21359        mut self,
21360        new_value: &'a mut dyn common::Delegate,
21361    ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
21362        self._delegate = Some(new_value);
21363        self
21364    }
21365
21366    /// Set any additional parameter of the query string used in the request.
21367    /// It should be used to set parameters which are not yet available through their own
21368    /// setters.
21369    ///
21370    /// Please note that this method must not be used to set any of the known parameters
21371    /// which have their own setter method. If done anyway, the request will fail.
21372    ///
21373    /// # Additional Parameters
21374    ///
21375    /// * *$.xgafv* (query-string) - V1 error format.
21376    /// * *access_token* (query-string) - OAuth access token.
21377    /// * *alt* (query-string) - Data format for response.
21378    /// * *callback* (query-string) - JSONP
21379    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21380    /// * *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.
21381    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21382    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21383    /// * *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.
21384    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21385    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21386    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
21387    where
21388        T: AsRef<str>,
21389    {
21390        self._additional_params
21391            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21392        self
21393    }
21394
21395    /// Identifies the authorization scope for the method you are building.
21396    ///
21397    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21398    /// [`Scope::CloudPlatformReadOnly`].
21399    ///
21400    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21401    /// tokens for more than one scope.
21402    ///
21403    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21404    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21405    /// sufficient, a read-write scope will do as well.
21406    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
21407    where
21408        St: AsRef<str>,
21409    {
21410        self._scopes.insert(String::from(scope.as_ref()));
21411        self
21412    }
21413    /// Identifies the authorization scope(s) for the method you are building.
21414    ///
21415    /// See [`Self::add_scope()`] for details.
21416    pub fn add_scopes<I, St>(
21417        mut self,
21418        scopes: I,
21419    ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
21420    where
21421        I: IntoIterator<Item = St>,
21422        St: AsRef<str>,
21423    {
21424        self._scopes
21425            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21426        self
21427    }
21428
21429    /// Removes all scopes, and no default scope will be used either.
21430    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21431    /// for details).
21432    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
21433        self._scopes.clear();
21434        self
21435    }
21436}
21437
21438/// Lists repositories.
21439///
21440/// A builder for the *locations.repositories.list* method supported by a *project* resource.
21441/// It is not used directly, but through a [`ProjectMethods`] instance.
21442///
21443/// # Example
21444///
21445/// Instantiate a resource method builder
21446///
21447/// ```test_harness,no_run
21448/// # extern crate hyper;
21449/// # extern crate hyper_rustls;
21450/// # extern crate google_artifactregistry1 as artifactregistry1;
21451/// # async fn dox() {
21452/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21453///
21454/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21455/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21456/// #     .with_native_roots()
21457/// #     .unwrap()
21458/// #     .https_only()
21459/// #     .enable_http2()
21460/// #     .build();
21461///
21462/// # let executor = hyper_util::rt::TokioExecutor::new();
21463/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21464/// #     secret,
21465/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21466/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21467/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21468/// #     ),
21469/// # ).build().await.unwrap();
21470///
21471/// # let client = hyper_util::client::legacy::Client::builder(
21472/// #     hyper_util::rt::TokioExecutor::new()
21473/// # )
21474/// # .build(
21475/// #     hyper_rustls::HttpsConnectorBuilder::new()
21476/// #         .with_native_roots()
21477/// #         .unwrap()
21478/// #         .https_or_http()
21479/// #         .enable_http2()
21480/// #         .build()
21481/// # );
21482/// # let mut hub = ArtifactRegistry::new(client, auth);
21483/// // You can configure optional parameters by calling the respective setters at will, and
21484/// // execute the final call using `doit()`.
21485/// // Values shown here are possibly random and not representative !
21486/// let result = hub.projects().locations_repositories_list("parent")
21487///              .page_token("sadipscing")
21488///              .page_size(-6)
21489///              .order_by("invidunt")
21490///              .filter("no")
21491///              .doit().await;
21492/// # }
21493/// ```
21494pub struct ProjectLocationRepositoryListCall<'a, C>
21495where
21496    C: 'a,
21497{
21498    hub: &'a ArtifactRegistry<C>,
21499    _parent: String,
21500    _page_token: Option<String>,
21501    _page_size: Option<i32>,
21502    _order_by: Option<String>,
21503    _filter: Option<String>,
21504    _delegate: Option<&'a mut dyn common::Delegate>,
21505    _additional_params: HashMap<String, String>,
21506    _scopes: BTreeSet<String>,
21507}
21508
21509impl<'a, C> common::CallBuilder for ProjectLocationRepositoryListCall<'a, C> {}
21510
21511impl<'a, C> ProjectLocationRepositoryListCall<'a, C>
21512where
21513    C: common::Connector,
21514{
21515    /// Perform the operation you have build so far.
21516    pub async fn doit(mut self) -> common::Result<(common::Response, ListRepositoriesResponse)> {
21517        use std::borrow::Cow;
21518        use std::io::{Read, Seek};
21519
21520        use common::{url::Params, ToParts};
21521        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21522
21523        let mut dd = common::DefaultDelegate;
21524        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21525        dlg.begin(common::MethodInfo {
21526            id: "artifactregistry.projects.locations.repositories.list",
21527            http_method: hyper::Method::GET,
21528        });
21529
21530        for &field in [
21531            "alt",
21532            "parent",
21533            "pageToken",
21534            "pageSize",
21535            "orderBy",
21536            "filter",
21537        ]
21538        .iter()
21539        {
21540            if self._additional_params.contains_key(field) {
21541                dlg.finished(false);
21542                return Err(common::Error::FieldClash(field));
21543            }
21544        }
21545
21546        let mut params = Params::with_capacity(7 + self._additional_params.len());
21547        params.push("parent", self._parent);
21548        if let Some(value) = self._page_token.as_ref() {
21549            params.push("pageToken", value);
21550        }
21551        if let Some(value) = self._page_size.as_ref() {
21552            params.push("pageSize", value.to_string());
21553        }
21554        if let Some(value) = self._order_by.as_ref() {
21555            params.push("orderBy", value);
21556        }
21557        if let Some(value) = self._filter.as_ref() {
21558            params.push("filter", value);
21559        }
21560
21561        params.extend(self._additional_params.iter());
21562
21563        params.push("alt", "json");
21564        let mut url = self.hub._base_url.clone() + "v1/{+parent}/repositories";
21565        if self._scopes.is_empty() {
21566            self._scopes
21567                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
21568        }
21569
21570        #[allow(clippy::single_element_loop)]
21571        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21572            url = params.uri_replacement(url, param_name, find_this, true);
21573        }
21574        {
21575            let to_remove = ["parent"];
21576            params.remove_params(&to_remove);
21577        }
21578
21579        let url = params.parse_with_url(&url);
21580
21581        loop {
21582            let token = match self
21583                .hub
21584                .auth
21585                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21586                .await
21587            {
21588                Ok(token) => token,
21589                Err(e) => match dlg.token(e) {
21590                    Ok(token) => token,
21591                    Err(e) => {
21592                        dlg.finished(false);
21593                        return Err(common::Error::MissingToken(e));
21594                    }
21595                },
21596            };
21597            let mut req_result = {
21598                let client = &self.hub.client;
21599                dlg.pre_request();
21600                let mut req_builder = hyper::Request::builder()
21601                    .method(hyper::Method::GET)
21602                    .uri(url.as_str())
21603                    .header(USER_AGENT, self.hub._user_agent.clone());
21604
21605                if let Some(token) = token.as_ref() {
21606                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21607                }
21608
21609                let request = req_builder
21610                    .header(CONTENT_LENGTH, 0_u64)
21611                    .body(common::to_body::<String>(None));
21612
21613                client.request(request.unwrap()).await
21614            };
21615
21616            match req_result {
21617                Err(err) => {
21618                    if let common::Retry::After(d) = dlg.http_error(&err) {
21619                        sleep(d).await;
21620                        continue;
21621                    }
21622                    dlg.finished(false);
21623                    return Err(common::Error::HttpError(err));
21624                }
21625                Ok(res) => {
21626                    let (mut parts, body) = res.into_parts();
21627                    let mut body = common::Body::new(body);
21628                    if !parts.status.is_success() {
21629                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21630                        let error = serde_json::from_str(&common::to_string(&bytes));
21631                        let response = common::to_response(parts, bytes.into());
21632
21633                        if let common::Retry::After(d) =
21634                            dlg.http_failure(&response, error.as_ref().ok())
21635                        {
21636                            sleep(d).await;
21637                            continue;
21638                        }
21639
21640                        dlg.finished(false);
21641
21642                        return Err(match error {
21643                            Ok(value) => common::Error::BadRequest(value),
21644                            _ => common::Error::Failure(response),
21645                        });
21646                    }
21647                    let response = {
21648                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21649                        let encoded = common::to_string(&bytes);
21650                        match serde_json::from_str(&encoded) {
21651                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21652                            Err(error) => {
21653                                dlg.response_json_decode_error(&encoded, &error);
21654                                return Err(common::Error::JsonDecodeError(
21655                                    encoded.to_string(),
21656                                    error,
21657                                ));
21658                            }
21659                        }
21660                    };
21661
21662                    dlg.finished(true);
21663                    return Ok(response);
21664                }
21665            }
21666        }
21667    }
21668
21669    /// Required. The name of the parent resource whose repositories will be listed.
21670    ///
21671    /// Sets the *parent* path property to the given value.
21672    ///
21673    /// Even though the property as already been set when instantiating this call,
21674    /// we provide this method for API completeness.
21675    pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryListCall<'a, C> {
21676        self._parent = new_value.to_string();
21677        self
21678    }
21679    /// The next_page_token value returned from a previous list request, if any.
21680    ///
21681    /// Sets the *page token* query property to the given value.
21682    pub fn page_token(mut self, new_value: &str) -> ProjectLocationRepositoryListCall<'a, C> {
21683        self._page_token = Some(new_value.to_string());
21684        self
21685    }
21686    /// The maximum number of repositories to return. Maximum page size is 1,000.
21687    ///
21688    /// Sets the *page size* query property to the given value.
21689    pub fn page_size(mut self, new_value: i32) -> ProjectLocationRepositoryListCall<'a, C> {
21690        self._page_size = Some(new_value);
21691        self
21692    }
21693    /// Optional. The field to order the results by.
21694    ///
21695    /// Sets the *order by* query property to the given value.
21696    pub fn order_by(mut self, new_value: &str) -> ProjectLocationRepositoryListCall<'a, C> {
21697        self._order_by = Some(new_value.to_string());
21698        self
21699    }
21700    /// Optional. An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are: * `name` Examples of using a filter: To filter the results of your request to repositories with the name `my-repo` in project `my-project` in the `us-central` region, append the following filter expression to your request: * `name="projects/my-project/locations/us-central1/repositories/my-repo"` You can also use wildcards to match any number of characters before or after the value: * `name="projects/my-project/locations/us-central1/repositories/my-*"` * `name="projects/my-project/locations/us-central1/repositories/*repo"` * `name="projects/my-project/locations/us-central1/repositories/*repo*"`
21701    ///
21702    /// Sets the *filter* query property to the given value.
21703    pub fn filter(mut self, new_value: &str) -> ProjectLocationRepositoryListCall<'a, C> {
21704        self._filter = Some(new_value.to_string());
21705        self
21706    }
21707    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21708    /// while executing the actual API request.
21709    ///
21710    /// ````text
21711    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21712    /// ````
21713    ///
21714    /// Sets the *delegate* property to the given value.
21715    pub fn delegate(
21716        mut self,
21717        new_value: &'a mut dyn common::Delegate,
21718    ) -> ProjectLocationRepositoryListCall<'a, C> {
21719        self._delegate = Some(new_value);
21720        self
21721    }
21722
21723    /// Set any additional parameter of the query string used in the request.
21724    /// It should be used to set parameters which are not yet available through their own
21725    /// setters.
21726    ///
21727    /// Please note that this method must not be used to set any of the known parameters
21728    /// which have their own setter method. If done anyway, the request will fail.
21729    ///
21730    /// # Additional Parameters
21731    ///
21732    /// * *$.xgafv* (query-string) - V1 error format.
21733    /// * *access_token* (query-string) - OAuth access token.
21734    /// * *alt* (query-string) - Data format for response.
21735    /// * *callback* (query-string) - JSONP
21736    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21737    /// * *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.
21738    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21739    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21740    /// * *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.
21741    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21742    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21743    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryListCall<'a, C>
21744    where
21745        T: AsRef<str>,
21746    {
21747        self._additional_params
21748            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21749        self
21750    }
21751
21752    /// Identifies the authorization scope for the method you are building.
21753    ///
21754    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21755    /// [`Scope::CloudPlatformReadOnly`].
21756    ///
21757    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21758    /// tokens for more than one scope.
21759    ///
21760    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21761    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21762    /// sufficient, a read-write scope will do as well.
21763    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryListCall<'a, C>
21764    where
21765        St: AsRef<str>,
21766    {
21767        self._scopes.insert(String::from(scope.as_ref()));
21768        self
21769    }
21770    /// Identifies the authorization scope(s) for the method you are building.
21771    ///
21772    /// See [`Self::add_scope()`] for details.
21773    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryListCall<'a, C>
21774    where
21775        I: IntoIterator<Item = St>,
21776        St: AsRef<str>,
21777    {
21778        self._scopes
21779            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21780        self
21781    }
21782
21783    /// Removes all scopes, and no default scope will be used either.
21784    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21785    /// for details).
21786    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryListCall<'a, C> {
21787        self._scopes.clear();
21788        self
21789    }
21790}
21791
21792/// Updates a repository.
21793///
21794/// A builder for the *locations.repositories.patch* method supported by a *project* resource.
21795/// It is not used directly, but through a [`ProjectMethods`] instance.
21796///
21797/// # Example
21798///
21799/// Instantiate a resource method builder
21800///
21801/// ```test_harness,no_run
21802/// # extern crate hyper;
21803/// # extern crate hyper_rustls;
21804/// # extern crate google_artifactregistry1 as artifactregistry1;
21805/// use artifactregistry1::api::Repository;
21806/// # async fn dox() {
21807/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21808///
21809/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21810/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21811/// #     .with_native_roots()
21812/// #     .unwrap()
21813/// #     .https_only()
21814/// #     .enable_http2()
21815/// #     .build();
21816///
21817/// # let executor = hyper_util::rt::TokioExecutor::new();
21818/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21819/// #     secret,
21820/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21821/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21822/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21823/// #     ),
21824/// # ).build().await.unwrap();
21825///
21826/// # let client = hyper_util::client::legacy::Client::builder(
21827/// #     hyper_util::rt::TokioExecutor::new()
21828/// # )
21829/// # .build(
21830/// #     hyper_rustls::HttpsConnectorBuilder::new()
21831/// #         .with_native_roots()
21832/// #         .unwrap()
21833/// #         .https_or_http()
21834/// #         .enable_http2()
21835/// #         .build()
21836/// # );
21837/// # let mut hub = ArtifactRegistry::new(client, auth);
21838/// // As the method needs a request, you would usually fill it with the desired information
21839/// // into the respective structure. Some of the parts shown here might not be applicable !
21840/// // Values shown here are possibly random and not representative !
21841/// let mut req = Repository::default();
21842///
21843/// // You can configure optional parameters by calling the respective setters at will, and
21844/// // execute the final call using `doit()`.
21845/// // Values shown here are possibly random and not representative !
21846/// let result = hub.projects().locations_repositories_patch(req, "name")
21847///              .update_mask(FieldMask::new::<&str>(&[]))
21848///              .doit().await;
21849/// # }
21850/// ```
21851pub struct ProjectLocationRepositoryPatchCall<'a, C>
21852where
21853    C: 'a,
21854{
21855    hub: &'a ArtifactRegistry<C>,
21856    _request: Repository,
21857    _name: String,
21858    _update_mask: Option<common::FieldMask>,
21859    _delegate: Option<&'a mut dyn common::Delegate>,
21860    _additional_params: HashMap<String, String>,
21861    _scopes: BTreeSet<String>,
21862}
21863
21864impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPatchCall<'a, C> {}
21865
21866impl<'a, C> ProjectLocationRepositoryPatchCall<'a, C>
21867where
21868    C: common::Connector,
21869{
21870    /// Perform the operation you have build so far.
21871    pub async fn doit(mut self) -> common::Result<(common::Response, Repository)> {
21872        use std::borrow::Cow;
21873        use std::io::{Read, Seek};
21874
21875        use common::{url::Params, ToParts};
21876        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21877
21878        let mut dd = common::DefaultDelegate;
21879        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21880        dlg.begin(common::MethodInfo {
21881            id: "artifactregistry.projects.locations.repositories.patch",
21882            http_method: hyper::Method::PATCH,
21883        });
21884
21885        for &field in ["alt", "name", "updateMask"].iter() {
21886            if self._additional_params.contains_key(field) {
21887                dlg.finished(false);
21888                return Err(common::Error::FieldClash(field));
21889            }
21890        }
21891
21892        let mut params = Params::with_capacity(5 + self._additional_params.len());
21893        params.push("name", self._name);
21894        if let Some(value) = self._update_mask.as_ref() {
21895            params.push("updateMask", value.to_string());
21896        }
21897
21898        params.extend(self._additional_params.iter());
21899
21900        params.push("alt", "json");
21901        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21902        if self._scopes.is_empty() {
21903            self._scopes
21904                .insert(Scope::CloudPlatform.as_ref().to_string());
21905        }
21906
21907        #[allow(clippy::single_element_loop)]
21908        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21909            url = params.uri_replacement(url, param_name, find_this, true);
21910        }
21911        {
21912            let to_remove = ["name"];
21913            params.remove_params(&to_remove);
21914        }
21915
21916        let url = params.parse_with_url(&url);
21917
21918        let mut json_mime_type = mime::APPLICATION_JSON;
21919        let mut request_value_reader = {
21920            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21921            common::remove_json_null_values(&mut value);
21922            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21923            serde_json::to_writer(&mut dst, &value).unwrap();
21924            dst
21925        };
21926        let request_size = request_value_reader
21927            .seek(std::io::SeekFrom::End(0))
21928            .unwrap();
21929        request_value_reader
21930            .seek(std::io::SeekFrom::Start(0))
21931            .unwrap();
21932
21933        loop {
21934            let token = match self
21935                .hub
21936                .auth
21937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21938                .await
21939            {
21940                Ok(token) => token,
21941                Err(e) => match dlg.token(e) {
21942                    Ok(token) => token,
21943                    Err(e) => {
21944                        dlg.finished(false);
21945                        return Err(common::Error::MissingToken(e));
21946                    }
21947                },
21948            };
21949            request_value_reader
21950                .seek(std::io::SeekFrom::Start(0))
21951                .unwrap();
21952            let mut req_result = {
21953                let client = &self.hub.client;
21954                dlg.pre_request();
21955                let mut req_builder = hyper::Request::builder()
21956                    .method(hyper::Method::PATCH)
21957                    .uri(url.as_str())
21958                    .header(USER_AGENT, self.hub._user_agent.clone());
21959
21960                if let Some(token) = token.as_ref() {
21961                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21962                }
21963
21964                let request = req_builder
21965                    .header(CONTENT_TYPE, json_mime_type.to_string())
21966                    .header(CONTENT_LENGTH, request_size as u64)
21967                    .body(common::to_body(
21968                        request_value_reader.get_ref().clone().into(),
21969                    ));
21970
21971                client.request(request.unwrap()).await
21972            };
21973
21974            match req_result {
21975                Err(err) => {
21976                    if let common::Retry::After(d) = dlg.http_error(&err) {
21977                        sleep(d).await;
21978                        continue;
21979                    }
21980                    dlg.finished(false);
21981                    return Err(common::Error::HttpError(err));
21982                }
21983                Ok(res) => {
21984                    let (mut parts, body) = res.into_parts();
21985                    let mut body = common::Body::new(body);
21986                    if !parts.status.is_success() {
21987                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21988                        let error = serde_json::from_str(&common::to_string(&bytes));
21989                        let response = common::to_response(parts, bytes.into());
21990
21991                        if let common::Retry::After(d) =
21992                            dlg.http_failure(&response, error.as_ref().ok())
21993                        {
21994                            sleep(d).await;
21995                            continue;
21996                        }
21997
21998                        dlg.finished(false);
21999
22000                        return Err(match error {
22001                            Ok(value) => common::Error::BadRequest(value),
22002                            _ => common::Error::Failure(response),
22003                        });
22004                    }
22005                    let response = {
22006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22007                        let encoded = common::to_string(&bytes);
22008                        match serde_json::from_str(&encoded) {
22009                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22010                            Err(error) => {
22011                                dlg.response_json_decode_error(&encoded, &error);
22012                                return Err(common::Error::JsonDecodeError(
22013                                    encoded.to_string(),
22014                                    error,
22015                                ));
22016                            }
22017                        }
22018                    };
22019
22020                    dlg.finished(true);
22021                    return Ok(response);
22022                }
22023            }
22024        }
22025    }
22026
22027    ///
22028    /// Sets the *request* property to the given value.
22029    ///
22030    /// Even though the property as already been set when instantiating this call,
22031    /// we provide this method for API completeness.
22032    pub fn request(mut self, new_value: Repository) -> ProjectLocationRepositoryPatchCall<'a, C> {
22033        self._request = new_value;
22034        self
22035    }
22036    /// The name of the repository, for example: `projects/p1/locations/us-central1/repositories/repo1`. For each location in a project, repository names must be unique.
22037    ///
22038    /// Sets the *name* path property to the given value.
22039    ///
22040    /// Even though the property as already been set when instantiating this call,
22041    /// we provide this method for API completeness.
22042    pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPatchCall<'a, C> {
22043        self._name = new_value.to_string();
22044        self
22045    }
22046    /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
22047    ///
22048    /// Sets the *update mask* query property to the given value.
22049    pub fn update_mask(
22050        mut self,
22051        new_value: common::FieldMask,
22052    ) -> ProjectLocationRepositoryPatchCall<'a, C> {
22053        self._update_mask = Some(new_value);
22054        self
22055    }
22056    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22057    /// while executing the actual API request.
22058    ///
22059    /// ````text
22060    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22061    /// ````
22062    ///
22063    /// Sets the *delegate* property to the given value.
22064    pub fn delegate(
22065        mut self,
22066        new_value: &'a mut dyn common::Delegate,
22067    ) -> ProjectLocationRepositoryPatchCall<'a, C> {
22068        self._delegate = Some(new_value);
22069        self
22070    }
22071
22072    /// Set any additional parameter of the query string used in the request.
22073    /// It should be used to set parameters which are not yet available through their own
22074    /// setters.
22075    ///
22076    /// Please note that this method must not be used to set any of the known parameters
22077    /// which have their own setter method. If done anyway, the request will fail.
22078    ///
22079    /// # Additional Parameters
22080    ///
22081    /// * *$.xgafv* (query-string) - V1 error format.
22082    /// * *access_token* (query-string) - OAuth access token.
22083    /// * *alt* (query-string) - Data format for response.
22084    /// * *callback* (query-string) - JSONP
22085    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22086    /// * *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.
22087    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22088    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22089    /// * *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.
22090    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22091    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22092    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryPatchCall<'a, C>
22093    where
22094        T: AsRef<str>,
22095    {
22096        self._additional_params
22097            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22098        self
22099    }
22100
22101    /// Identifies the authorization scope for the method you are building.
22102    ///
22103    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22104    /// [`Scope::CloudPlatform`].
22105    ///
22106    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22107    /// tokens for more than one scope.
22108    ///
22109    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22110    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22111    /// sufficient, a read-write scope will do as well.
22112    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPatchCall<'a, C>
22113    where
22114        St: AsRef<str>,
22115    {
22116        self._scopes.insert(String::from(scope.as_ref()));
22117        self
22118    }
22119    /// Identifies the authorization scope(s) for the method you are building.
22120    ///
22121    /// See [`Self::add_scope()`] for details.
22122    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryPatchCall<'a, C>
22123    where
22124        I: IntoIterator<Item = St>,
22125        St: AsRef<str>,
22126    {
22127        self._scopes
22128            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22129        self
22130    }
22131
22132    /// Removes all scopes, and no default scope will be used either.
22133    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22134    /// for details).
22135    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPatchCall<'a, C> {
22136        self._scopes.clear();
22137        self
22138    }
22139}
22140
22141/// Updates the IAM policy for a given resource.
22142///
22143/// A builder for the *locations.repositories.setIamPolicy* method supported by a *project* resource.
22144/// It is not used directly, but through a [`ProjectMethods`] instance.
22145///
22146/// # Example
22147///
22148/// Instantiate a resource method builder
22149///
22150/// ```test_harness,no_run
22151/// # extern crate hyper;
22152/// # extern crate hyper_rustls;
22153/// # extern crate google_artifactregistry1 as artifactregistry1;
22154/// use artifactregistry1::api::SetIamPolicyRequest;
22155/// # async fn dox() {
22156/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22157///
22158/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22159/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22160/// #     .with_native_roots()
22161/// #     .unwrap()
22162/// #     .https_only()
22163/// #     .enable_http2()
22164/// #     .build();
22165///
22166/// # let executor = hyper_util::rt::TokioExecutor::new();
22167/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22168/// #     secret,
22169/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22170/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22171/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22172/// #     ),
22173/// # ).build().await.unwrap();
22174///
22175/// # let client = hyper_util::client::legacy::Client::builder(
22176/// #     hyper_util::rt::TokioExecutor::new()
22177/// # )
22178/// # .build(
22179/// #     hyper_rustls::HttpsConnectorBuilder::new()
22180/// #         .with_native_roots()
22181/// #         .unwrap()
22182/// #         .https_or_http()
22183/// #         .enable_http2()
22184/// #         .build()
22185/// # );
22186/// # let mut hub = ArtifactRegistry::new(client, auth);
22187/// // As the method needs a request, you would usually fill it with the desired information
22188/// // into the respective structure. Some of the parts shown here might not be applicable !
22189/// // Values shown here are possibly random and not representative !
22190/// let mut req = SetIamPolicyRequest::default();
22191///
22192/// // You can configure optional parameters by calling the respective setters at will, and
22193/// // execute the final call using `doit()`.
22194/// // Values shown here are possibly random and not representative !
22195/// let result = hub.projects().locations_repositories_set_iam_policy(req, "resource")
22196///              .doit().await;
22197/// # }
22198/// ```
22199pub struct ProjectLocationRepositorySetIamPolicyCall<'a, C>
22200where
22201    C: 'a,
22202{
22203    hub: &'a ArtifactRegistry<C>,
22204    _request: SetIamPolicyRequest,
22205    _resource: String,
22206    _delegate: Option<&'a mut dyn common::Delegate>,
22207    _additional_params: HashMap<String, String>,
22208    _scopes: BTreeSet<String>,
22209}
22210
22211impl<'a, C> common::CallBuilder for ProjectLocationRepositorySetIamPolicyCall<'a, C> {}
22212
22213impl<'a, C> ProjectLocationRepositorySetIamPolicyCall<'a, C>
22214where
22215    C: common::Connector,
22216{
22217    /// Perform the operation you have build so far.
22218    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22219        use std::borrow::Cow;
22220        use std::io::{Read, Seek};
22221
22222        use common::{url::Params, ToParts};
22223        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22224
22225        let mut dd = common::DefaultDelegate;
22226        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22227        dlg.begin(common::MethodInfo {
22228            id: "artifactregistry.projects.locations.repositories.setIamPolicy",
22229            http_method: hyper::Method::POST,
22230        });
22231
22232        for &field in ["alt", "resource"].iter() {
22233            if self._additional_params.contains_key(field) {
22234                dlg.finished(false);
22235                return Err(common::Error::FieldClash(field));
22236            }
22237        }
22238
22239        let mut params = Params::with_capacity(4 + self._additional_params.len());
22240        params.push("resource", self._resource);
22241
22242        params.extend(self._additional_params.iter());
22243
22244        params.push("alt", "json");
22245        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
22246        if self._scopes.is_empty() {
22247            self._scopes
22248                .insert(Scope::CloudPlatform.as_ref().to_string());
22249        }
22250
22251        #[allow(clippy::single_element_loop)]
22252        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22253            url = params.uri_replacement(url, param_name, find_this, true);
22254        }
22255        {
22256            let to_remove = ["resource"];
22257            params.remove_params(&to_remove);
22258        }
22259
22260        let url = params.parse_with_url(&url);
22261
22262        let mut json_mime_type = mime::APPLICATION_JSON;
22263        let mut request_value_reader = {
22264            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22265            common::remove_json_null_values(&mut value);
22266            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22267            serde_json::to_writer(&mut dst, &value).unwrap();
22268            dst
22269        };
22270        let request_size = request_value_reader
22271            .seek(std::io::SeekFrom::End(0))
22272            .unwrap();
22273        request_value_reader
22274            .seek(std::io::SeekFrom::Start(0))
22275            .unwrap();
22276
22277        loop {
22278            let token = match self
22279                .hub
22280                .auth
22281                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22282                .await
22283            {
22284                Ok(token) => token,
22285                Err(e) => match dlg.token(e) {
22286                    Ok(token) => token,
22287                    Err(e) => {
22288                        dlg.finished(false);
22289                        return Err(common::Error::MissingToken(e));
22290                    }
22291                },
22292            };
22293            request_value_reader
22294                .seek(std::io::SeekFrom::Start(0))
22295                .unwrap();
22296            let mut req_result = {
22297                let client = &self.hub.client;
22298                dlg.pre_request();
22299                let mut req_builder = hyper::Request::builder()
22300                    .method(hyper::Method::POST)
22301                    .uri(url.as_str())
22302                    .header(USER_AGENT, self.hub._user_agent.clone());
22303
22304                if let Some(token) = token.as_ref() {
22305                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22306                }
22307
22308                let request = req_builder
22309                    .header(CONTENT_TYPE, json_mime_type.to_string())
22310                    .header(CONTENT_LENGTH, request_size as u64)
22311                    .body(common::to_body(
22312                        request_value_reader.get_ref().clone().into(),
22313                    ));
22314
22315                client.request(request.unwrap()).await
22316            };
22317
22318            match req_result {
22319                Err(err) => {
22320                    if let common::Retry::After(d) = dlg.http_error(&err) {
22321                        sleep(d).await;
22322                        continue;
22323                    }
22324                    dlg.finished(false);
22325                    return Err(common::Error::HttpError(err));
22326                }
22327                Ok(res) => {
22328                    let (mut parts, body) = res.into_parts();
22329                    let mut body = common::Body::new(body);
22330                    if !parts.status.is_success() {
22331                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22332                        let error = serde_json::from_str(&common::to_string(&bytes));
22333                        let response = common::to_response(parts, bytes.into());
22334
22335                        if let common::Retry::After(d) =
22336                            dlg.http_failure(&response, error.as_ref().ok())
22337                        {
22338                            sleep(d).await;
22339                            continue;
22340                        }
22341
22342                        dlg.finished(false);
22343
22344                        return Err(match error {
22345                            Ok(value) => common::Error::BadRequest(value),
22346                            _ => common::Error::Failure(response),
22347                        });
22348                    }
22349                    let response = {
22350                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22351                        let encoded = common::to_string(&bytes);
22352                        match serde_json::from_str(&encoded) {
22353                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22354                            Err(error) => {
22355                                dlg.response_json_decode_error(&encoded, &error);
22356                                return Err(common::Error::JsonDecodeError(
22357                                    encoded.to_string(),
22358                                    error,
22359                                ));
22360                            }
22361                        }
22362                    };
22363
22364                    dlg.finished(true);
22365                    return Ok(response);
22366                }
22367            }
22368        }
22369    }
22370
22371    ///
22372    /// Sets the *request* property to the given value.
22373    ///
22374    /// Even though the property as already been set when instantiating this call,
22375    /// we provide this method for API completeness.
22376    pub fn request(
22377        mut self,
22378        new_value: SetIamPolicyRequest,
22379    ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
22380        self._request = new_value;
22381        self
22382    }
22383    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
22384    ///
22385    /// Sets the *resource* path property to the given value.
22386    ///
22387    /// Even though the property as already been set when instantiating this call,
22388    /// we provide this method for API completeness.
22389    pub fn resource(mut self, new_value: &str) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
22390        self._resource = new_value.to_string();
22391        self
22392    }
22393    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22394    /// while executing the actual API request.
22395    ///
22396    /// ````text
22397    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22398    /// ````
22399    ///
22400    /// Sets the *delegate* property to the given value.
22401    pub fn delegate(
22402        mut self,
22403        new_value: &'a mut dyn common::Delegate,
22404    ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
22405        self._delegate = Some(new_value);
22406        self
22407    }
22408
22409    /// Set any additional parameter of the query string used in the request.
22410    /// It should be used to set parameters which are not yet available through their own
22411    /// setters.
22412    ///
22413    /// Please note that this method must not be used to set any of the known parameters
22414    /// which have their own setter method. If done anyway, the request will fail.
22415    ///
22416    /// # Additional Parameters
22417    ///
22418    /// * *$.xgafv* (query-string) - V1 error format.
22419    /// * *access_token* (query-string) - OAuth access token.
22420    /// * *alt* (query-string) - Data format for response.
22421    /// * *callback* (query-string) - JSONP
22422    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22423    /// * *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.
22424    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22425    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22426    /// * *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.
22427    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22428    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22429    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositorySetIamPolicyCall<'a, C>
22430    where
22431        T: AsRef<str>,
22432    {
22433        self._additional_params
22434            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22435        self
22436    }
22437
22438    /// Identifies the authorization scope for the method you are building.
22439    ///
22440    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22441    /// [`Scope::CloudPlatform`].
22442    ///
22443    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22444    /// tokens for more than one scope.
22445    ///
22446    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22447    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22448    /// sufficient, a read-write scope will do as well.
22449    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositorySetIamPolicyCall<'a, C>
22450    where
22451        St: AsRef<str>,
22452    {
22453        self._scopes.insert(String::from(scope.as_ref()));
22454        self
22455    }
22456    /// Identifies the authorization scope(s) for the method you are building.
22457    ///
22458    /// See [`Self::add_scope()`] for details.
22459    pub fn add_scopes<I, St>(
22460        mut self,
22461        scopes: I,
22462    ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C>
22463    where
22464        I: IntoIterator<Item = St>,
22465        St: AsRef<str>,
22466    {
22467        self._scopes
22468            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22469        self
22470    }
22471
22472    /// Removes all scopes, and no default scope will be used either.
22473    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22474    /// for details).
22475    pub fn clear_scopes(mut self) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
22476        self._scopes.clear();
22477        self
22478    }
22479}
22480
22481/// Tests if the caller has a list of permissions on a resource.
22482///
22483/// A builder for the *locations.repositories.testIamPermissions* method supported by a *project* resource.
22484/// It is not used directly, but through a [`ProjectMethods`] instance.
22485///
22486/// # Example
22487///
22488/// Instantiate a resource method builder
22489///
22490/// ```test_harness,no_run
22491/// # extern crate hyper;
22492/// # extern crate hyper_rustls;
22493/// # extern crate google_artifactregistry1 as artifactregistry1;
22494/// use artifactregistry1::api::TestIamPermissionsRequest;
22495/// # async fn dox() {
22496/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22497///
22498/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22499/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22500/// #     .with_native_roots()
22501/// #     .unwrap()
22502/// #     .https_only()
22503/// #     .enable_http2()
22504/// #     .build();
22505///
22506/// # let executor = hyper_util::rt::TokioExecutor::new();
22507/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22508/// #     secret,
22509/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22510/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22511/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22512/// #     ),
22513/// # ).build().await.unwrap();
22514///
22515/// # let client = hyper_util::client::legacy::Client::builder(
22516/// #     hyper_util::rt::TokioExecutor::new()
22517/// # )
22518/// # .build(
22519/// #     hyper_rustls::HttpsConnectorBuilder::new()
22520/// #         .with_native_roots()
22521/// #         .unwrap()
22522/// #         .https_or_http()
22523/// #         .enable_http2()
22524/// #         .build()
22525/// # );
22526/// # let mut hub = ArtifactRegistry::new(client, auth);
22527/// // As the method needs a request, you would usually fill it with the desired information
22528/// // into the respective structure. Some of the parts shown here might not be applicable !
22529/// // Values shown here are possibly random and not representative !
22530/// let mut req = TestIamPermissionsRequest::default();
22531///
22532/// // You can configure optional parameters by calling the respective setters at will, and
22533/// // execute the final call using `doit()`.
22534/// // Values shown here are possibly random and not representative !
22535/// let result = hub.projects().locations_repositories_test_iam_permissions(req, "resource")
22536///              .doit().await;
22537/// # }
22538/// ```
22539pub struct ProjectLocationRepositoryTestIamPermissionCall<'a, C>
22540where
22541    C: 'a,
22542{
22543    hub: &'a ArtifactRegistry<C>,
22544    _request: TestIamPermissionsRequest,
22545    _resource: String,
22546    _delegate: Option<&'a mut dyn common::Delegate>,
22547    _additional_params: HashMap<String, String>,
22548    _scopes: BTreeSet<String>,
22549}
22550
22551impl<'a, C> common::CallBuilder for ProjectLocationRepositoryTestIamPermissionCall<'a, C> {}
22552
22553impl<'a, C> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
22554where
22555    C: common::Connector,
22556{
22557    /// Perform the operation you have build so far.
22558    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
22559        use std::borrow::Cow;
22560        use std::io::{Read, Seek};
22561
22562        use common::{url::Params, ToParts};
22563        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22564
22565        let mut dd = common::DefaultDelegate;
22566        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22567        dlg.begin(common::MethodInfo {
22568            id: "artifactregistry.projects.locations.repositories.testIamPermissions",
22569            http_method: hyper::Method::POST,
22570        });
22571
22572        for &field in ["alt", "resource"].iter() {
22573            if self._additional_params.contains_key(field) {
22574                dlg.finished(false);
22575                return Err(common::Error::FieldClash(field));
22576            }
22577        }
22578
22579        let mut params = Params::with_capacity(4 + self._additional_params.len());
22580        params.push("resource", self._resource);
22581
22582        params.extend(self._additional_params.iter());
22583
22584        params.push("alt", "json");
22585        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
22586        if self._scopes.is_empty() {
22587            self._scopes
22588                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
22589        }
22590
22591        #[allow(clippy::single_element_loop)]
22592        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22593            url = params.uri_replacement(url, param_name, find_this, true);
22594        }
22595        {
22596            let to_remove = ["resource"];
22597            params.remove_params(&to_remove);
22598        }
22599
22600        let url = params.parse_with_url(&url);
22601
22602        let mut json_mime_type = mime::APPLICATION_JSON;
22603        let mut request_value_reader = {
22604            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22605            common::remove_json_null_values(&mut value);
22606            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22607            serde_json::to_writer(&mut dst, &value).unwrap();
22608            dst
22609        };
22610        let request_size = request_value_reader
22611            .seek(std::io::SeekFrom::End(0))
22612            .unwrap();
22613        request_value_reader
22614            .seek(std::io::SeekFrom::Start(0))
22615            .unwrap();
22616
22617        loop {
22618            let token = match self
22619                .hub
22620                .auth
22621                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22622                .await
22623            {
22624                Ok(token) => token,
22625                Err(e) => match dlg.token(e) {
22626                    Ok(token) => token,
22627                    Err(e) => {
22628                        dlg.finished(false);
22629                        return Err(common::Error::MissingToken(e));
22630                    }
22631                },
22632            };
22633            request_value_reader
22634                .seek(std::io::SeekFrom::Start(0))
22635                .unwrap();
22636            let mut req_result = {
22637                let client = &self.hub.client;
22638                dlg.pre_request();
22639                let mut req_builder = hyper::Request::builder()
22640                    .method(hyper::Method::POST)
22641                    .uri(url.as_str())
22642                    .header(USER_AGENT, self.hub._user_agent.clone());
22643
22644                if let Some(token) = token.as_ref() {
22645                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22646                }
22647
22648                let request = req_builder
22649                    .header(CONTENT_TYPE, json_mime_type.to_string())
22650                    .header(CONTENT_LENGTH, request_size as u64)
22651                    .body(common::to_body(
22652                        request_value_reader.get_ref().clone().into(),
22653                    ));
22654
22655                client.request(request.unwrap()).await
22656            };
22657
22658            match req_result {
22659                Err(err) => {
22660                    if let common::Retry::After(d) = dlg.http_error(&err) {
22661                        sleep(d).await;
22662                        continue;
22663                    }
22664                    dlg.finished(false);
22665                    return Err(common::Error::HttpError(err));
22666                }
22667                Ok(res) => {
22668                    let (mut parts, body) = res.into_parts();
22669                    let mut body = common::Body::new(body);
22670                    if !parts.status.is_success() {
22671                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22672                        let error = serde_json::from_str(&common::to_string(&bytes));
22673                        let response = common::to_response(parts, bytes.into());
22674
22675                        if let common::Retry::After(d) =
22676                            dlg.http_failure(&response, error.as_ref().ok())
22677                        {
22678                            sleep(d).await;
22679                            continue;
22680                        }
22681
22682                        dlg.finished(false);
22683
22684                        return Err(match error {
22685                            Ok(value) => common::Error::BadRequest(value),
22686                            _ => common::Error::Failure(response),
22687                        });
22688                    }
22689                    let response = {
22690                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22691                        let encoded = common::to_string(&bytes);
22692                        match serde_json::from_str(&encoded) {
22693                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22694                            Err(error) => {
22695                                dlg.response_json_decode_error(&encoded, &error);
22696                                return Err(common::Error::JsonDecodeError(
22697                                    encoded.to_string(),
22698                                    error,
22699                                ));
22700                            }
22701                        }
22702                    };
22703
22704                    dlg.finished(true);
22705                    return Ok(response);
22706                }
22707            }
22708        }
22709    }
22710
22711    ///
22712    /// Sets the *request* property to the given value.
22713    ///
22714    /// Even though the property as already been set when instantiating this call,
22715    /// we provide this method for API completeness.
22716    pub fn request(
22717        mut self,
22718        new_value: TestIamPermissionsRequest,
22719    ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
22720        self._request = new_value;
22721        self
22722    }
22723    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
22724    ///
22725    /// Sets the *resource* path property to the given value.
22726    ///
22727    /// Even though the property as already been set when instantiating this call,
22728    /// we provide this method for API completeness.
22729    pub fn resource(
22730        mut self,
22731        new_value: &str,
22732    ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
22733        self._resource = new_value.to_string();
22734        self
22735    }
22736    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22737    /// while executing the actual API request.
22738    ///
22739    /// ````text
22740    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22741    /// ````
22742    ///
22743    /// Sets the *delegate* property to the given value.
22744    pub fn delegate(
22745        mut self,
22746        new_value: &'a mut dyn common::Delegate,
22747    ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
22748        self._delegate = Some(new_value);
22749        self
22750    }
22751
22752    /// Set any additional parameter of the query string used in the request.
22753    /// It should be used to set parameters which are not yet available through their own
22754    /// setters.
22755    ///
22756    /// Please note that this method must not be used to set any of the known parameters
22757    /// which have their own setter method. If done anyway, the request will fail.
22758    ///
22759    /// # Additional Parameters
22760    ///
22761    /// * *$.xgafv* (query-string) - V1 error format.
22762    /// * *access_token* (query-string) - OAuth access token.
22763    /// * *alt* (query-string) - Data format for response.
22764    /// * *callback* (query-string) - JSONP
22765    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22766    /// * *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.
22767    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22768    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22769    /// * *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.
22770    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22771    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22772    pub fn param<T>(
22773        mut self,
22774        name: T,
22775        value: T,
22776    ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
22777    where
22778        T: AsRef<str>,
22779    {
22780        self._additional_params
22781            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22782        self
22783    }
22784
22785    /// Identifies the authorization scope for the method you are building.
22786    ///
22787    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22788    /// [`Scope::CloudPlatformReadOnly`].
22789    ///
22790    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22791    /// tokens for more than one scope.
22792    ///
22793    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22794    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22795    /// sufficient, a read-write scope will do as well.
22796    pub fn add_scope<St>(
22797        mut self,
22798        scope: St,
22799    ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
22800    where
22801        St: AsRef<str>,
22802    {
22803        self._scopes.insert(String::from(scope.as_ref()));
22804        self
22805    }
22806    /// Identifies the authorization scope(s) for the method you are building.
22807    ///
22808    /// See [`Self::add_scope()`] for details.
22809    pub fn add_scopes<I, St>(
22810        mut self,
22811        scopes: I,
22812    ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
22813    where
22814        I: IntoIterator<Item = St>,
22815        St: AsRef<str>,
22816    {
22817        self._scopes
22818            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22819        self
22820    }
22821
22822    /// Removes all scopes, and no default scope will be used either.
22823    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22824    /// for details).
22825    pub fn clear_scopes(mut self) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
22826        self._scopes.clear();
22827        self
22828    }
22829}
22830
22831/// Gets information about a location.
22832///
22833/// A builder for the *locations.get* method supported by a *project* resource.
22834/// It is not used directly, but through a [`ProjectMethods`] instance.
22835///
22836/// # Example
22837///
22838/// Instantiate a resource method builder
22839///
22840/// ```test_harness,no_run
22841/// # extern crate hyper;
22842/// # extern crate hyper_rustls;
22843/// # extern crate google_artifactregistry1 as artifactregistry1;
22844/// # async fn dox() {
22845/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22846///
22847/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22848/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22849/// #     .with_native_roots()
22850/// #     .unwrap()
22851/// #     .https_only()
22852/// #     .enable_http2()
22853/// #     .build();
22854///
22855/// # let executor = hyper_util::rt::TokioExecutor::new();
22856/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22857/// #     secret,
22858/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22859/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22860/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22861/// #     ),
22862/// # ).build().await.unwrap();
22863///
22864/// # let client = hyper_util::client::legacy::Client::builder(
22865/// #     hyper_util::rt::TokioExecutor::new()
22866/// # )
22867/// # .build(
22868/// #     hyper_rustls::HttpsConnectorBuilder::new()
22869/// #         .with_native_roots()
22870/// #         .unwrap()
22871/// #         .https_or_http()
22872/// #         .enable_http2()
22873/// #         .build()
22874/// # );
22875/// # let mut hub = ArtifactRegistry::new(client, auth);
22876/// // You can configure optional parameters by calling the respective setters at will, and
22877/// // execute the final call using `doit()`.
22878/// // Values shown here are possibly random and not representative !
22879/// let result = hub.projects().locations_get("name")
22880///              .doit().await;
22881/// # }
22882/// ```
22883pub struct ProjectLocationGetCall<'a, C>
22884where
22885    C: 'a,
22886{
22887    hub: &'a ArtifactRegistry<C>,
22888    _name: String,
22889    _delegate: Option<&'a mut dyn common::Delegate>,
22890    _additional_params: HashMap<String, String>,
22891    _scopes: BTreeSet<String>,
22892}
22893
22894impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
22895
22896impl<'a, C> ProjectLocationGetCall<'a, C>
22897where
22898    C: common::Connector,
22899{
22900    /// Perform the operation you have build so far.
22901    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
22902        use std::borrow::Cow;
22903        use std::io::{Read, Seek};
22904
22905        use common::{url::Params, ToParts};
22906        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22907
22908        let mut dd = common::DefaultDelegate;
22909        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22910        dlg.begin(common::MethodInfo {
22911            id: "artifactregistry.projects.locations.get",
22912            http_method: hyper::Method::GET,
22913        });
22914
22915        for &field in ["alt", "name"].iter() {
22916            if self._additional_params.contains_key(field) {
22917                dlg.finished(false);
22918                return Err(common::Error::FieldClash(field));
22919            }
22920        }
22921
22922        let mut params = Params::with_capacity(3 + self._additional_params.len());
22923        params.push("name", self._name);
22924
22925        params.extend(self._additional_params.iter());
22926
22927        params.push("alt", "json");
22928        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22929        if self._scopes.is_empty() {
22930            self._scopes
22931                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
22932        }
22933
22934        #[allow(clippy::single_element_loop)]
22935        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22936            url = params.uri_replacement(url, param_name, find_this, true);
22937        }
22938        {
22939            let to_remove = ["name"];
22940            params.remove_params(&to_remove);
22941        }
22942
22943        let url = params.parse_with_url(&url);
22944
22945        loop {
22946            let token = match self
22947                .hub
22948                .auth
22949                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22950                .await
22951            {
22952                Ok(token) => token,
22953                Err(e) => match dlg.token(e) {
22954                    Ok(token) => token,
22955                    Err(e) => {
22956                        dlg.finished(false);
22957                        return Err(common::Error::MissingToken(e));
22958                    }
22959                },
22960            };
22961            let mut req_result = {
22962                let client = &self.hub.client;
22963                dlg.pre_request();
22964                let mut req_builder = hyper::Request::builder()
22965                    .method(hyper::Method::GET)
22966                    .uri(url.as_str())
22967                    .header(USER_AGENT, self.hub._user_agent.clone());
22968
22969                if let Some(token) = token.as_ref() {
22970                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22971                }
22972
22973                let request = req_builder
22974                    .header(CONTENT_LENGTH, 0_u64)
22975                    .body(common::to_body::<String>(None));
22976
22977                client.request(request.unwrap()).await
22978            };
22979
22980            match req_result {
22981                Err(err) => {
22982                    if let common::Retry::After(d) = dlg.http_error(&err) {
22983                        sleep(d).await;
22984                        continue;
22985                    }
22986                    dlg.finished(false);
22987                    return Err(common::Error::HttpError(err));
22988                }
22989                Ok(res) => {
22990                    let (mut parts, body) = res.into_parts();
22991                    let mut body = common::Body::new(body);
22992                    if !parts.status.is_success() {
22993                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22994                        let error = serde_json::from_str(&common::to_string(&bytes));
22995                        let response = common::to_response(parts, bytes.into());
22996
22997                        if let common::Retry::After(d) =
22998                            dlg.http_failure(&response, error.as_ref().ok())
22999                        {
23000                            sleep(d).await;
23001                            continue;
23002                        }
23003
23004                        dlg.finished(false);
23005
23006                        return Err(match error {
23007                            Ok(value) => common::Error::BadRequest(value),
23008                            _ => common::Error::Failure(response),
23009                        });
23010                    }
23011                    let response = {
23012                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23013                        let encoded = common::to_string(&bytes);
23014                        match serde_json::from_str(&encoded) {
23015                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23016                            Err(error) => {
23017                                dlg.response_json_decode_error(&encoded, &error);
23018                                return Err(common::Error::JsonDecodeError(
23019                                    encoded.to_string(),
23020                                    error,
23021                                ));
23022                            }
23023                        }
23024                    };
23025
23026                    dlg.finished(true);
23027                    return Ok(response);
23028                }
23029            }
23030        }
23031    }
23032
23033    /// Resource name for the location.
23034    ///
23035    /// Sets the *name* path property to the given value.
23036    ///
23037    /// Even though the property as already been set when instantiating this call,
23038    /// we provide this method for API completeness.
23039    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
23040        self._name = new_value.to_string();
23041        self
23042    }
23043    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23044    /// while executing the actual API request.
23045    ///
23046    /// ````text
23047    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23048    /// ````
23049    ///
23050    /// Sets the *delegate* property to the given value.
23051    pub fn delegate(
23052        mut self,
23053        new_value: &'a mut dyn common::Delegate,
23054    ) -> ProjectLocationGetCall<'a, C> {
23055        self._delegate = Some(new_value);
23056        self
23057    }
23058
23059    /// Set any additional parameter of the query string used in the request.
23060    /// It should be used to set parameters which are not yet available through their own
23061    /// setters.
23062    ///
23063    /// Please note that this method must not be used to set any of the known parameters
23064    /// which have their own setter method. If done anyway, the request will fail.
23065    ///
23066    /// # Additional Parameters
23067    ///
23068    /// * *$.xgafv* (query-string) - V1 error format.
23069    /// * *access_token* (query-string) - OAuth access token.
23070    /// * *alt* (query-string) - Data format for response.
23071    /// * *callback* (query-string) - JSONP
23072    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23073    /// * *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.
23074    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23075    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23076    /// * *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.
23077    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23078    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23079    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
23080    where
23081        T: AsRef<str>,
23082    {
23083        self._additional_params
23084            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23085        self
23086    }
23087
23088    /// Identifies the authorization scope for the method you are building.
23089    ///
23090    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23091    /// [`Scope::CloudPlatformReadOnly`].
23092    ///
23093    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23094    /// tokens for more than one scope.
23095    ///
23096    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23097    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23098    /// sufficient, a read-write scope will do as well.
23099    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
23100    where
23101        St: AsRef<str>,
23102    {
23103        self._scopes.insert(String::from(scope.as_ref()));
23104        self
23105    }
23106    /// Identifies the authorization scope(s) for the method you are building.
23107    ///
23108    /// See [`Self::add_scope()`] for details.
23109    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
23110    where
23111        I: IntoIterator<Item = St>,
23112        St: AsRef<str>,
23113    {
23114        self._scopes
23115            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23116        self
23117    }
23118
23119    /// Removes all scopes, and no default scope will be used either.
23120    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23121    /// for details).
23122    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
23123        self._scopes.clear();
23124        self
23125    }
23126}
23127
23128/// Retrieves the VPCSC Config for the Project.
23129///
23130/// A builder for the *locations.getVpcscConfig* method supported by a *project* resource.
23131/// It is not used directly, but through a [`ProjectMethods`] instance.
23132///
23133/// # Example
23134///
23135/// Instantiate a resource method builder
23136///
23137/// ```test_harness,no_run
23138/// # extern crate hyper;
23139/// # extern crate hyper_rustls;
23140/// # extern crate google_artifactregistry1 as artifactregistry1;
23141/// # async fn dox() {
23142/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23143///
23144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23145/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23146/// #     .with_native_roots()
23147/// #     .unwrap()
23148/// #     .https_only()
23149/// #     .enable_http2()
23150/// #     .build();
23151///
23152/// # let executor = hyper_util::rt::TokioExecutor::new();
23153/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23154/// #     secret,
23155/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23156/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23157/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23158/// #     ),
23159/// # ).build().await.unwrap();
23160///
23161/// # let client = hyper_util::client::legacy::Client::builder(
23162/// #     hyper_util::rt::TokioExecutor::new()
23163/// # )
23164/// # .build(
23165/// #     hyper_rustls::HttpsConnectorBuilder::new()
23166/// #         .with_native_roots()
23167/// #         .unwrap()
23168/// #         .https_or_http()
23169/// #         .enable_http2()
23170/// #         .build()
23171/// # );
23172/// # let mut hub = ArtifactRegistry::new(client, auth);
23173/// // You can configure optional parameters by calling the respective setters at will, and
23174/// // execute the final call using `doit()`.
23175/// // Values shown here are possibly random and not representative !
23176/// let result = hub.projects().locations_get_vpcsc_config("name")
23177///              .doit().await;
23178/// # }
23179/// ```
23180pub struct ProjectLocationGetVpcscConfigCall<'a, C>
23181where
23182    C: 'a,
23183{
23184    hub: &'a ArtifactRegistry<C>,
23185    _name: String,
23186    _delegate: Option<&'a mut dyn common::Delegate>,
23187    _additional_params: HashMap<String, String>,
23188    _scopes: BTreeSet<String>,
23189}
23190
23191impl<'a, C> common::CallBuilder for ProjectLocationGetVpcscConfigCall<'a, C> {}
23192
23193impl<'a, C> ProjectLocationGetVpcscConfigCall<'a, C>
23194where
23195    C: common::Connector,
23196{
23197    /// Perform the operation you have build so far.
23198    pub async fn doit(mut self) -> common::Result<(common::Response, VPCSCConfig)> {
23199        use std::borrow::Cow;
23200        use std::io::{Read, Seek};
23201
23202        use common::{url::Params, ToParts};
23203        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23204
23205        let mut dd = common::DefaultDelegate;
23206        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23207        dlg.begin(common::MethodInfo {
23208            id: "artifactregistry.projects.locations.getVpcscConfig",
23209            http_method: hyper::Method::GET,
23210        });
23211
23212        for &field in ["alt", "name"].iter() {
23213            if self._additional_params.contains_key(field) {
23214                dlg.finished(false);
23215                return Err(common::Error::FieldClash(field));
23216            }
23217        }
23218
23219        let mut params = Params::with_capacity(3 + self._additional_params.len());
23220        params.push("name", self._name);
23221
23222        params.extend(self._additional_params.iter());
23223
23224        params.push("alt", "json");
23225        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23226        if self._scopes.is_empty() {
23227            self._scopes
23228                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
23229        }
23230
23231        #[allow(clippy::single_element_loop)]
23232        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23233            url = params.uri_replacement(url, param_name, find_this, true);
23234        }
23235        {
23236            let to_remove = ["name"];
23237            params.remove_params(&to_remove);
23238        }
23239
23240        let url = params.parse_with_url(&url);
23241
23242        loop {
23243            let token = match self
23244                .hub
23245                .auth
23246                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23247                .await
23248            {
23249                Ok(token) => token,
23250                Err(e) => match dlg.token(e) {
23251                    Ok(token) => token,
23252                    Err(e) => {
23253                        dlg.finished(false);
23254                        return Err(common::Error::MissingToken(e));
23255                    }
23256                },
23257            };
23258            let mut req_result = {
23259                let client = &self.hub.client;
23260                dlg.pre_request();
23261                let mut req_builder = hyper::Request::builder()
23262                    .method(hyper::Method::GET)
23263                    .uri(url.as_str())
23264                    .header(USER_AGENT, self.hub._user_agent.clone());
23265
23266                if let Some(token) = token.as_ref() {
23267                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23268                }
23269
23270                let request = req_builder
23271                    .header(CONTENT_LENGTH, 0_u64)
23272                    .body(common::to_body::<String>(None));
23273
23274                client.request(request.unwrap()).await
23275            };
23276
23277            match req_result {
23278                Err(err) => {
23279                    if let common::Retry::After(d) = dlg.http_error(&err) {
23280                        sleep(d).await;
23281                        continue;
23282                    }
23283                    dlg.finished(false);
23284                    return Err(common::Error::HttpError(err));
23285                }
23286                Ok(res) => {
23287                    let (mut parts, body) = res.into_parts();
23288                    let mut body = common::Body::new(body);
23289                    if !parts.status.is_success() {
23290                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23291                        let error = serde_json::from_str(&common::to_string(&bytes));
23292                        let response = common::to_response(parts, bytes.into());
23293
23294                        if let common::Retry::After(d) =
23295                            dlg.http_failure(&response, error.as_ref().ok())
23296                        {
23297                            sleep(d).await;
23298                            continue;
23299                        }
23300
23301                        dlg.finished(false);
23302
23303                        return Err(match error {
23304                            Ok(value) => common::Error::BadRequest(value),
23305                            _ => common::Error::Failure(response),
23306                        });
23307                    }
23308                    let response = {
23309                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23310                        let encoded = common::to_string(&bytes);
23311                        match serde_json::from_str(&encoded) {
23312                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23313                            Err(error) => {
23314                                dlg.response_json_decode_error(&encoded, &error);
23315                                return Err(common::Error::JsonDecodeError(
23316                                    encoded.to_string(),
23317                                    error,
23318                                ));
23319                            }
23320                        }
23321                    };
23322
23323                    dlg.finished(true);
23324                    return Ok(response);
23325                }
23326            }
23327        }
23328    }
23329
23330    /// Required. The name of the VPCSCConfig resource.
23331    ///
23332    /// Sets the *name* path property to the given value.
23333    ///
23334    /// Even though the property as already been set when instantiating this call,
23335    /// we provide this method for API completeness.
23336    pub fn name(mut self, new_value: &str) -> ProjectLocationGetVpcscConfigCall<'a, C> {
23337        self._name = new_value.to_string();
23338        self
23339    }
23340    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23341    /// while executing the actual API request.
23342    ///
23343    /// ````text
23344    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23345    /// ````
23346    ///
23347    /// Sets the *delegate* property to the given value.
23348    pub fn delegate(
23349        mut self,
23350        new_value: &'a mut dyn common::Delegate,
23351    ) -> ProjectLocationGetVpcscConfigCall<'a, C> {
23352        self._delegate = Some(new_value);
23353        self
23354    }
23355
23356    /// Set any additional parameter of the query string used in the request.
23357    /// It should be used to set parameters which are not yet available through their own
23358    /// setters.
23359    ///
23360    /// Please note that this method must not be used to set any of the known parameters
23361    /// which have their own setter method. If done anyway, the request will fail.
23362    ///
23363    /// # Additional Parameters
23364    ///
23365    /// * *$.xgafv* (query-string) - V1 error format.
23366    /// * *access_token* (query-string) - OAuth access token.
23367    /// * *alt* (query-string) - Data format for response.
23368    /// * *callback* (query-string) - JSONP
23369    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23370    /// * *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.
23371    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23372    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23373    /// * *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.
23374    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23375    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23376    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetVpcscConfigCall<'a, C>
23377    where
23378        T: AsRef<str>,
23379    {
23380        self._additional_params
23381            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23382        self
23383    }
23384
23385    /// Identifies the authorization scope for the method you are building.
23386    ///
23387    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23388    /// [`Scope::CloudPlatformReadOnly`].
23389    ///
23390    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23391    /// tokens for more than one scope.
23392    ///
23393    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23394    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23395    /// sufficient, a read-write scope will do as well.
23396    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetVpcscConfigCall<'a, C>
23397    where
23398        St: AsRef<str>,
23399    {
23400        self._scopes.insert(String::from(scope.as_ref()));
23401        self
23402    }
23403    /// Identifies the authorization scope(s) for the method you are building.
23404    ///
23405    /// See [`Self::add_scope()`] for details.
23406    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetVpcscConfigCall<'a, C>
23407    where
23408        I: IntoIterator<Item = St>,
23409        St: AsRef<str>,
23410    {
23411        self._scopes
23412            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23413        self
23414    }
23415
23416    /// Removes all scopes, and no default scope will be used either.
23417    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23418    /// for details).
23419    pub fn clear_scopes(mut self) -> ProjectLocationGetVpcscConfigCall<'a, C> {
23420        self._scopes.clear();
23421        self
23422    }
23423}
23424
23425/// Lists information about the supported locations for this service.
23426///
23427/// A builder for the *locations.list* method supported by a *project* resource.
23428/// It is not used directly, but through a [`ProjectMethods`] instance.
23429///
23430/// # Example
23431///
23432/// Instantiate a resource method builder
23433///
23434/// ```test_harness,no_run
23435/// # extern crate hyper;
23436/// # extern crate hyper_rustls;
23437/// # extern crate google_artifactregistry1 as artifactregistry1;
23438/// # async fn dox() {
23439/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23440///
23441/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23442/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23443/// #     .with_native_roots()
23444/// #     .unwrap()
23445/// #     .https_only()
23446/// #     .enable_http2()
23447/// #     .build();
23448///
23449/// # let executor = hyper_util::rt::TokioExecutor::new();
23450/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23451/// #     secret,
23452/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23453/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23454/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23455/// #     ),
23456/// # ).build().await.unwrap();
23457///
23458/// # let client = hyper_util::client::legacy::Client::builder(
23459/// #     hyper_util::rt::TokioExecutor::new()
23460/// # )
23461/// # .build(
23462/// #     hyper_rustls::HttpsConnectorBuilder::new()
23463/// #         .with_native_roots()
23464/// #         .unwrap()
23465/// #         .https_or_http()
23466/// #         .enable_http2()
23467/// #         .build()
23468/// # );
23469/// # let mut hub = ArtifactRegistry::new(client, auth);
23470/// // You can configure optional parameters by calling the respective setters at will, and
23471/// // execute the final call using `doit()`.
23472/// // Values shown here are possibly random and not representative !
23473/// let result = hub.projects().locations_list("name")
23474///              .page_token("aliquyam")
23475///              .page_size(-5)
23476///              .filter("et")
23477///              .add_extra_location_types("sanctus")
23478///              .doit().await;
23479/// # }
23480/// ```
23481pub struct ProjectLocationListCall<'a, C>
23482where
23483    C: 'a,
23484{
23485    hub: &'a ArtifactRegistry<C>,
23486    _name: String,
23487    _page_token: Option<String>,
23488    _page_size: Option<i32>,
23489    _filter: Option<String>,
23490    _extra_location_types: Vec<String>,
23491    _delegate: Option<&'a mut dyn common::Delegate>,
23492    _additional_params: HashMap<String, String>,
23493    _scopes: BTreeSet<String>,
23494}
23495
23496impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
23497
23498impl<'a, C> ProjectLocationListCall<'a, C>
23499where
23500    C: common::Connector,
23501{
23502    /// Perform the operation you have build so far.
23503    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
23504        use std::borrow::Cow;
23505        use std::io::{Read, Seek};
23506
23507        use common::{url::Params, ToParts};
23508        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23509
23510        let mut dd = common::DefaultDelegate;
23511        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23512        dlg.begin(common::MethodInfo {
23513            id: "artifactregistry.projects.locations.list",
23514            http_method: hyper::Method::GET,
23515        });
23516
23517        for &field in [
23518            "alt",
23519            "name",
23520            "pageToken",
23521            "pageSize",
23522            "filter",
23523            "extraLocationTypes",
23524        ]
23525        .iter()
23526        {
23527            if self._additional_params.contains_key(field) {
23528                dlg.finished(false);
23529                return Err(common::Error::FieldClash(field));
23530            }
23531        }
23532
23533        let mut params = Params::with_capacity(7 + self._additional_params.len());
23534        params.push("name", self._name);
23535        if let Some(value) = self._page_token.as_ref() {
23536            params.push("pageToken", value);
23537        }
23538        if let Some(value) = self._page_size.as_ref() {
23539            params.push("pageSize", value.to_string());
23540        }
23541        if let Some(value) = self._filter.as_ref() {
23542            params.push("filter", value);
23543        }
23544        if !self._extra_location_types.is_empty() {
23545            for f in self._extra_location_types.iter() {
23546                params.push("extraLocationTypes", f);
23547            }
23548        }
23549
23550        params.extend(self._additional_params.iter());
23551
23552        params.push("alt", "json");
23553        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
23554        if self._scopes.is_empty() {
23555            self._scopes
23556                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
23557        }
23558
23559        #[allow(clippy::single_element_loop)]
23560        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23561            url = params.uri_replacement(url, param_name, find_this, true);
23562        }
23563        {
23564            let to_remove = ["name"];
23565            params.remove_params(&to_remove);
23566        }
23567
23568        let url = params.parse_with_url(&url);
23569
23570        loop {
23571            let token = match self
23572                .hub
23573                .auth
23574                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23575                .await
23576            {
23577                Ok(token) => token,
23578                Err(e) => match dlg.token(e) {
23579                    Ok(token) => token,
23580                    Err(e) => {
23581                        dlg.finished(false);
23582                        return Err(common::Error::MissingToken(e));
23583                    }
23584                },
23585            };
23586            let mut req_result = {
23587                let client = &self.hub.client;
23588                dlg.pre_request();
23589                let mut req_builder = hyper::Request::builder()
23590                    .method(hyper::Method::GET)
23591                    .uri(url.as_str())
23592                    .header(USER_AGENT, self.hub._user_agent.clone());
23593
23594                if let Some(token) = token.as_ref() {
23595                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23596                }
23597
23598                let request = req_builder
23599                    .header(CONTENT_LENGTH, 0_u64)
23600                    .body(common::to_body::<String>(None));
23601
23602                client.request(request.unwrap()).await
23603            };
23604
23605            match req_result {
23606                Err(err) => {
23607                    if let common::Retry::After(d) = dlg.http_error(&err) {
23608                        sleep(d).await;
23609                        continue;
23610                    }
23611                    dlg.finished(false);
23612                    return Err(common::Error::HttpError(err));
23613                }
23614                Ok(res) => {
23615                    let (mut parts, body) = res.into_parts();
23616                    let mut body = common::Body::new(body);
23617                    if !parts.status.is_success() {
23618                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23619                        let error = serde_json::from_str(&common::to_string(&bytes));
23620                        let response = common::to_response(parts, bytes.into());
23621
23622                        if let common::Retry::After(d) =
23623                            dlg.http_failure(&response, error.as_ref().ok())
23624                        {
23625                            sleep(d).await;
23626                            continue;
23627                        }
23628
23629                        dlg.finished(false);
23630
23631                        return Err(match error {
23632                            Ok(value) => common::Error::BadRequest(value),
23633                            _ => common::Error::Failure(response),
23634                        });
23635                    }
23636                    let response = {
23637                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23638                        let encoded = common::to_string(&bytes);
23639                        match serde_json::from_str(&encoded) {
23640                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23641                            Err(error) => {
23642                                dlg.response_json_decode_error(&encoded, &error);
23643                                return Err(common::Error::JsonDecodeError(
23644                                    encoded.to_string(),
23645                                    error,
23646                                ));
23647                            }
23648                        }
23649                    };
23650
23651                    dlg.finished(true);
23652                    return Ok(response);
23653                }
23654            }
23655        }
23656    }
23657
23658    /// The resource that owns the locations collection, if applicable.
23659    ///
23660    /// Sets the *name* path property to the given value.
23661    ///
23662    /// Even though the property as already been set when instantiating this call,
23663    /// we provide this method for API completeness.
23664    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
23665        self._name = new_value.to_string();
23666        self
23667    }
23668    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
23669    ///
23670    /// Sets the *page token* query property to the given value.
23671    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
23672        self._page_token = Some(new_value.to_string());
23673        self
23674    }
23675    /// The maximum number of results to return. If not set, the service selects a default.
23676    ///
23677    /// Sets the *page size* query property to the given value.
23678    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
23679        self._page_size = Some(new_value);
23680        self
23681    }
23682    /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
23683    ///
23684    /// Sets the *filter* query property to the given value.
23685    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
23686        self._filter = Some(new_value.to_string());
23687        self
23688    }
23689    /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
23690    ///
23691    /// Append the given value to the *extra location types* query property.
23692    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
23693    pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
23694        self._extra_location_types.push(new_value.to_string());
23695        self
23696    }
23697    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23698    /// while executing the actual API request.
23699    ///
23700    /// ````text
23701    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23702    /// ````
23703    ///
23704    /// Sets the *delegate* property to the given value.
23705    pub fn delegate(
23706        mut self,
23707        new_value: &'a mut dyn common::Delegate,
23708    ) -> ProjectLocationListCall<'a, C> {
23709        self._delegate = Some(new_value);
23710        self
23711    }
23712
23713    /// Set any additional parameter of the query string used in the request.
23714    /// It should be used to set parameters which are not yet available through their own
23715    /// setters.
23716    ///
23717    /// Please note that this method must not be used to set any of the known parameters
23718    /// which have their own setter method. If done anyway, the request will fail.
23719    ///
23720    /// # Additional Parameters
23721    ///
23722    /// * *$.xgafv* (query-string) - V1 error format.
23723    /// * *access_token* (query-string) - OAuth access token.
23724    /// * *alt* (query-string) - Data format for response.
23725    /// * *callback* (query-string) - JSONP
23726    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23727    /// * *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.
23728    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23729    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23730    /// * *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.
23731    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23732    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23733    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
23734    where
23735        T: AsRef<str>,
23736    {
23737        self._additional_params
23738            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23739        self
23740    }
23741
23742    /// Identifies the authorization scope for the method you are building.
23743    ///
23744    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23745    /// [`Scope::CloudPlatformReadOnly`].
23746    ///
23747    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23748    /// tokens for more than one scope.
23749    ///
23750    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23751    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23752    /// sufficient, a read-write scope will do as well.
23753    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
23754    where
23755        St: AsRef<str>,
23756    {
23757        self._scopes.insert(String::from(scope.as_ref()));
23758        self
23759    }
23760    /// Identifies the authorization scope(s) for the method you are building.
23761    ///
23762    /// See [`Self::add_scope()`] for details.
23763    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
23764    where
23765        I: IntoIterator<Item = St>,
23766        St: AsRef<str>,
23767    {
23768        self._scopes
23769            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23770        self
23771    }
23772
23773    /// Removes all scopes, and no default scope will be used either.
23774    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23775    /// for details).
23776    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
23777        self._scopes.clear();
23778        self
23779    }
23780}
23781
23782/// Updates the VPCSC Config for the Project.
23783///
23784/// A builder for the *locations.updateVpcscConfig* method supported by a *project* resource.
23785/// It is not used directly, but through a [`ProjectMethods`] instance.
23786///
23787/// # Example
23788///
23789/// Instantiate a resource method builder
23790///
23791/// ```test_harness,no_run
23792/// # extern crate hyper;
23793/// # extern crate hyper_rustls;
23794/// # extern crate google_artifactregistry1 as artifactregistry1;
23795/// use artifactregistry1::api::VPCSCConfig;
23796/// # async fn dox() {
23797/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23798///
23799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23800/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23801/// #     .with_native_roots()
23802/// #     .unwrap()
23803/// #     .https_only()
23804/// #     .enable_http2()
23805/// #     .build();
23806///
23807/// # let executor = hyper_util::rt::TokioExecutor::new();
23808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23809/// #     secret,
23810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23811/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23812/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23813/// #     ),
23814/// # ).build().await.unwrap();
23815///
23816/// # let client = hyper_util::client::legacy::Client::builder(
23817/// #     hyper_util::rt::TokioExecutor::new()
23818/// # )
23819/// # .build(
23820/// #     hyper_rustls::HttpsConnectorBuilder::new()
23821/// #         .with_native_roots()
23822/// #         .unwrap()
23823/// #         .https_or_http()
23824/// #         .enable_http2()
23825/// #         .build()
23826/// # );
23827/// # let mut hub = ArtifactRegistry::new(client, auth);
23828/// // As the method needs a request, you would usually fill it with the desired information
23829/// // into the respective structure. Some of the parts shown here might not be applicable !
23830/// // Values shown here are possibly random and not representative !
23831/// let mut req = VPCSCConfig::default();
23832///
23833/// // You can configure optional parameters by calling the respective setters at will, and
23834/// // execute the final call using `doit()`.
23835/// // Values shown here are possibly random and not representative !
23836/// let result = hub.projects().locations_update_vpcsc_config(req, "name")
23837///              .update_mask(FieldMask::new::<&str>(&[]))
23838///              .doit().await;
23839/// # }
23840/// ```
23841pub struct ProjectLocationUpdateVpcscConfigCall<'a, C>
23842where
23843    C: 'a,
23844{
23845    hub: &'a ArtifactRegistry<C>,
23846    _request: VPCSCConfig,
23847    _name: String,
23848    _update_mask: Option<common::FieldMask>,
23849    _delegate: Option<&'a mut dyn common::Delegate>,
23850    _additional_params: HashMap<String, String>,
23851    _scopes: BTreeSet<String>,
23852}
23853
23854impl<'a, C> common::CallBuilder for ProjectLocationUpdateVpcscConfigCall<'a, C> {}
23855
23856impl<'a, C> ProjectLocationUpdateVpcscConfigCall<'a, C>
23857where
23858    C: common::Connector,
23859{
23860    /// Perform the operation you have build so far.
23861    pub async fn doit(mut self) -> common::Result<(common::Response, VPCSCConfig)> {
23862        use std::borrow::Cow;
23863        use std::io::{Read, Seek};
23864
23865        use common::{url::Params, ToParts};
23866        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23867
23868        let mut dd = common::DefaultDelegate;
23869        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23870        dlg.begin(common::MethodInfo {
23871            id: "artifactregistry.projects.locations.updateVpcscConfig",
23872            http_method: hyper::Method::PATCH,
23873        });
23874
23875        for &field in ["alt", "name", "updateMask"].iter() {
23876            if self._additional_params.contains_key(field) {
23877                dlg.finished(false);
23878                return Err(common::Error::FieldClash(field));
23879            }
23880        }
23881
23882        let mut params = Params::with_capacity(5 + self._additional_params.len());
23883        params.push("name", self._name);
23884        if let Some(value) = self._update_mask.as_ref() {
23885            params.push("updateMask", value.to_string());
23886        }
23887
23888        params.extend(self._additional_params.iter());
23889
23890        params.push("alt", "json");
23891        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23892        if self._scopes.is_empty() {
23893            self._scopes
23894                .insert(Scope::CloudPlatform.as_ref().to_string());
23895        }
23896
23897        #[allow(clippy::single_element_loop)]
23898        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23899            url = params.uri_replacement(url, param_name, find_this, true);
23900        }
23901        {
23902            let to_remove = ["name"];
23903            params.remove_params(&to_remove);
23904        }
23905
23906        let url = params.parse_with_url(&url);
23907
23908        let mut json_mime_type = mime::APPLICATION_JSON;
23909        let mut request_value_reader = {
23910            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23911            common::remove_json_null_values(&mut value);
23912            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23913            serde_json::to_writer(&mut dst, &value).unwrap();
23914            dst
23915        };
23916        let request_size = request_value_reader
23917            .seek(std::io::SeekFrom::End(0))
23918            .unwrap();
23919        request_value_reader
23920            .seek(std::io::SeekFrom::Start(0))
23921            .unwrap();
23922
23923        loop {
23924            let token = match self
23925                .hub
23926                .auth
23927                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23928                .await
23929            {
23930                Ok(token) => token,
23931                Err(e) => match dlg.token(e) {
23932                    Ok(token) => token,
23933                    Err(e) => {
23934                        dlg.finished(false);
23935                        return Err(common::Error::MissingToken(e));
23936                    }
23937                },
23938            };
23939            request_value_reader
23940                .seek(std::io::SeekFrom::Start(0))
23941                .unwrap();
23942            let mut req_result = {
23943                let client = &self.hub.client;
23944                dlg.pre_request();
23945                let mut req_builder = hyper::Request::builder()
23946                    .method(hyper::Method::PATCH)
23947                    .uri(url.as_str())
23948                    .header(USER_AGENT, self.hub._user_agent.clone());
23949
23950                if let Some(token) = token.as_ref() {
23951                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23952                }
23953
23954                let request = req_builder
23955                    .header(CONTENT_TYPE, json_mime_type.to_string())
23956                    .header(CONTENT_LENGTH, request_size as u64)
23957                    .body(common::to_body(
23958                        request_value_reader.get_ref().clone().into(),
23959                    ));
23960
23961                client.request(request.unwrap()).await
23962            };
23963
23964            match req_result {
23965                Err(err) => {
23966                    if let common::Retry::After(d) = dlg.http_error(&err) {
23967                        sleep(d).await;
23968                        continue;
23969                    }
23970                    dlg.finished(false);
23971                    return Err(common::Error::HttpError(err));
23972                }
23973                Ok(res) => {
23974                    let (mut parts, body) = res.into_parts();
23975                    let mut body = common::Body::new(body);
23976                    if !parts.status.is_success() {
23977                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23978                        let error = serde_json::from_str(&common::to_string(&bytes));
23979                        let response = common::to_response(parts, bytes.into());
23980
23981                        if let common::Retry::After(d) =
23982                            dlg.http_failure(&response, error.as_ref().ok())
23983                        {
23984                            sleep(d).await;
23985                            continue;
23986                        }
23987
23988                        dlg.finished(false);
23989
23990                        return Err(match error {
23991                            Ok(value) => common::Error::BadRequest(value),
23992                            _ => common::Error::Failure(response),
23993                        });
23994                    }
23995                    let response = {
23996                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23997                        let encoded = common::to_string(&bytes);
23998                        match serde_json::from_str(&encoded) {
23999                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24000                            Err(error) => {
24001                                dlg.response_json_decode_error(&encoded, &error);
24002                                return Err(common::Error::JsonDecodeError(
24003                                    encoded.to_string(),
24004                                    error,
24005                                ));
24006                            }
24007                        }
24008                    };
24009
24010                    dlg.finished(true);
24011                    return Ok(response);
24012                }
24013            }
24014        }
24015    }
24016
24017    ///
24018    /// Sets the *request* property to the given value.
24019    ///
24020    /// Even though the property as already been set when instantiating this call,
24021    /// we provide this method for API completeness.
24022    pub fn request(
24023        mut self,
24024        new_value: VPCSCConfig,
24025    ) -> ProjectLocationUpdateVpcscConfigCall<'a, C> {
24026        self._request = new_value;
24027        self
24028    }
24029    /// The name of the project's VPC SC Config. Always of the form: projects/{projectID}/locations/{location}/vpcscConfig In update request: never set In response: always set
24030    ///
24031    /// Sets the *name* path property to the given value.
24032    ///
24033    /// Even though the property as already been set when instantiating this call,
24034    /// we provide this method for API completeness.
24035    pub fn name(mut self, new_value: &str) -> ProjectLocationUpdateVpcscConfigCall<'a, C> {
24036        self._name = new_value.to_string();
24037        self
24038    }
24039    /// Field mask to support partial updates.
24040    ///
24041    /// Sets the *update mask* query property to the given value.
24042    pub fn update_mask(
24043        mut self,
24044        new_value: common::FieldMask,
24045    ) -> ProjectLocationUpdateVpcscConfigCall<'a, C> {
24046        self._update_mask = Some(new_value);
24047        self
24048    }
24049    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24050    /// while executing the actual API request.
24051    ///
24052    /// ````text
24053    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24054    /// ````
24055    ///
24056    /// Sets the *delegate* property to the given value.
24057    pub fn delegate(
24058        mut self,
24059        new_value: &'a mut dyn common::Delegate,
24060    ) -> ProjectLocationUpdateVpcscConfigCall<'a, C> {
24061        self._delegate = Some(new_value);
24062        self
24063    }
24064
24065    /// Set any additional parameter of the query string used in the request.
24066    /// It should be used to set parameters which are not yet available through their own
24067    /// setters.
24068    ///
24069    /// Please note that this method must not be used to set any of the known parameters
24070    /// which have their own setter method. If done anyway, the request will fail.
24071    ///
24072    /// # Additional Parameters
24073    ///
24074    /// * *$.xgafv* (query-string) - V1 error format.
24075    /// * *access_token* (query-string) - OAuth access token.
24076    /// * *alt* (query-string) - Data format for response.
24077    /// * *callback* (query-string) - JSONP
24078    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24079    /// * *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.
24080    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24081    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24082    /// * *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.
24083    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24084    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24085    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationUpdateVpcscConfigCall<'a, C>
24086    where
24087        T: AsRef<str>,
24088    {
24089        self._additional_params
24090            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24091        self
24092    }
24093
24094    /// Identifies the authorization scope for the method you are building.
24095    ///
24096    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24097    /// [`Scope::CloudPlatform`].
24098    ///
24099    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24100    /// tokens for more than one scope.
24101    ///
24102    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24103    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24104    /// sufficient, a read-write scope will do as well.
24105    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationUpdateVpcscConfigCall<'a, C>
24106    where
24107        St: AsRef<str>,
24108    {
24109        self._scopes.insert(String::from(scope.as_ref()));
24110        self
24111    }
24112    /// Identifies the authorization scope(s) for the method you are building.
24113    ///
24114    /// See [`Self::add_scope()`] for details.
24115    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationUpdateVpcscConfigCall<'a, C>
24116    where
24117        I: IntoIterator<Item = St>,
24118        St: AsRef<str>,
24119    {
24120        self._scopes
24121            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24122        self
24123    }
24124
24125    /// Removes all scopes, and no default scope will be used either.
24126    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24127    /// for details).
24128    pub fn clear_scopes(mut self) -> ProjectLocationUpdateVpcscConfigCall<'a, C> {
24129        self._scopes.clear();
24130        self
24131    }
24132}
24133
24134/// Retrieves the Settings for the Project.
24135///
24136/// A builder for the *getProjectSettings* method supported by a *project* resource.
24137/// It is not used directly, but through a [`ProjectMethods`] instance.
24138///
24139/// # Example
24140///
24141/// Instantiate a resource method builder
24142///
24143/// ```test_harness,no_run
24144/// # extern crate hyper;
24145/// # extern crate hyper_rustls;
24146/// # extern crate google_artifactregistry1 as artifactregistry1;
24147/// # async fn dox() {
24148/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24149///
24150/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24151/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24152/// #     .with_native_roots()
24153/// #     .unwrap()
24154/// #     .https_only()
24155/// #     .enable_http2()
24156/// #     .build();
24157///
24158/// # let executor = hyper_util::rt::TokioExecutor::new();
24159/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24160/// #     secret,
24161/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24162/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24163/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24164/// #     ),
24165/// # ).build().await.unwrap();
24166///
24167/// # let client = hyper_util::client::legacy::Client::builder(
24168/// #     hyper_util::rt::TokioExecutor::new()
24169/// # )
24170/// # .build(
24171/// #     hyper_rustls::HttpsConnectorBuilder::new()
24172/// #         .with_native_roots()
24173/// #         .unwrap()
24174/// #         .https_or_http()
24175/// #         .enable_http2()
24176/// #         .build()
24177/// # );
24178/// # let mut hub = ArtifactRegistry::new(client, auth);
24179/// // You can configure optional parameters by calling the respective setters at will, and
24180/// // execute the final call using `doit()`.
24181/// // Values shown here are possibly random and not representative !
24182/// let result = hub.projects().get_project_settings("name")
24183///              .doit().await;
24184/// # }
24185/// ```
24186pub struct ProjectGetProjectSettingCall<'a, C>
24187where
24188    C: 'a,
24189{
24190    hub: &'a ArtifactRegistry<C>,
24191    _name: String,
24192    _delegate: Option<&'a mut dyn common::Delegate>,
24193    _additional_params: HashMap<String, String>,
24194    _scopes: BTreeSet<String>,
24195}
24196
24197impl<'a, C> common::CallBuilder for ProjectGetProjectSettingCall<'a, C> {}
24198
24199impl<'a, C> ProjectGetProjectSettingCall<'a, C>
24200where
24201    C: common::Connector,
24202{
24203    /// Perform the operation you have build so far.
24204    pub async fn doit(mut self) -> common::Result<(common::Response, ProjectSettings)> {
24205        use std::borrow::Cow;
24206        use std::io::{Read, Seek};
24207
24208        use common::{url::Params, ToParts};
24209        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24210
24211        let mut dd = common::DefaultDelegate;
24212        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24213        dlg.begin(common::MethodInfo {
24214            id: "artifactregistry.projects.getProjectSettings",
24215            http_method: hyper::Method::GET,
24216        });
24217
24218        for &field in ["alt", "name"].iter() {
24219            if self._additional_params.contains_key(field) {
24220                dlg.finished(false);
24221                return Err(common::Error::FieldClash(field));
24222            }
24223        }
24224
24225        let mut params = Params::with_capacity(3 + self._additional_params.len());
24226        params.push("name", self._name);
24227
24228        params.extend(self._additional_params.iter());
24229
24230        params.push("alt", "json");
24231        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24232        if self._scopes.is_empty() {
24233            self._scopes
24234                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
24235        }
24236
24237        #[allow(clippy::single_element_loop)]
24238        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24239            url = params.uri_replacement(url, param_name, find_this, true);
24240        }
24241        {
24242            let to_remove = ["name"];
24243            params.remove_params(&to_remove);
24244        }
24245
24246        let url = params.parse_with_url(&url);
24247
24248        loop {
24249            let token = match self
24250                .hub
24251                .auth
24252                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24253                .await
24254            {
24255                Ok(token) => token,
24256                Err(e) => match dlg.token(e) {
24257                    Ok(token) => token,
24258                    Err(e) => {
24259                        dlg.finished(false);
24260                        return Err(common::Error::MissingToken(e));
24261                    }
24262                },
24263            };
24264            let mut req_result = {
24265                let client = &self.hub.client;
24266                dlg.pre_request();
24267                let mut req_builder = hyper::Request::builder()
24268                    .method(hyper::Method::GET)
24269                    .uri(url.as_str())
24270                    .header(USER_AGENT, self.hub._user_agent.clone());
24271
24272                if let Some(token) = token.as_ref() {
24273                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24274                }
24275
24276                let request = req_builder
24277                    .header(CONTENT_LENGTH, 0_u64)
24278                    .body(common::to_body::<String>(None));
24279
24280                client.request(request.unwrap()).await
24281            };
24282
24283            match req_result {
24284                Err(err) => {
24285                    if let common::Retry::After(d) = dlg.http_error(&err) {
24286                        sleep(d).await;
24287                        continue;
24288                    }
24289                    dlg.finished(false);
24290                    return Err(common::Error::HttpError(err));
24291                }
24292                Ok(res) => {
24293                    let (mut parts, body) = res.into_parts();
24294                    let mut body = common::Body::new(body);
24295                    if !parts.status.is_success() {
24296                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24297                        let error = serde_json::from_str(&common::to_string(&bytes));
24298                        let response = common::to_response(parts, bytes.into());
24299
24300                        if let common::Retry::After(d) =
24301                            dlg.http_failure(&response, error.as_ref().ok())
24302                        {
24303                            sleep(d).await;
24304                            continue;
24305                        }
24306
24307                        dlg.finished(false);
24308
24309                        return Err(match error {
24310                            Ok(value) => common::Error::BadRequest(value),
24311                            _ => common::Error::Failure(response),
24312                        });
24313                    }
24314                    let response = {
24315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24316                        let encoded = common::to_string(&bytes);
24317                        match serde_json::from_str(&encoded) {
24318                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24319                            Err(error) => {
24320                                dlg.response_json_decode_error(&encoded, &error);
24321                                return Err(common::Error::JsonDecodeError(
24322                                    encoded.to_string(),
24323                                    error,
24324                                ));
24325                            }
24326                        }
24327                    };
24328
24329                    dlg.finished(true);
24330                    return Ok(response);
24331                }
24332            }
24333        }
24334    }
24335
24336    /// Required. The name of the projectSettings resource.
24337    ///
24338    /// Sets the *name* path property to the given value.
24339    ///
24340    /// Even though the property as already been set when instantiating this call,
24341    /// we provide this method for API completeness.
24342    pub fn name(mut self, new_value: &str) -> ProjectGetProjectSettingCall<'a, C> {
24343        self._name = new_value.to_string();
24344        self
24345    }
24346    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24347    /// while executing the actual API request.
24348    ///
24349    /// ````text
24350    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24351    /// ````
24352    ///
24353    /// Sets the *delegate* property to the given value.
24354    pub fn delegate(
24355        mut self,
24356        new_value: &'a mut dyn common::Delegate,
24357    ) -> ProjectGetProjectSettingCall<'a, C> {
24358        self._delegate = Some(new_value);
24359        self
24360    }
24361
24362    /// Set any additional parameter of the query string used in the request.
24363    /// It should be used to set parameters which are not yet available through their own
24364    /// setters.
24365    ///
24366    /// Please note that this method must not be used to set any of the known parameters
24367    /// which have their own setter method. If done anyway, the request will fail.
24368    ///
24369    /// # Additional Parameters
24370    ///
24371    /// * *$.xgafv* (query-string) - V1 error format.
24372    /// * *access_token* (query-string) - OAuth access token.
24373    /// * *alt* (query-string) - Data format for response.
24374    /// * *callback* (query-string) - JSONP
24375    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24376    /// * *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.
24377    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24378    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24379    /// * *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.
24380    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24381    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24382    pub fn param<T>(mut self, name: T, value: T) -> ProjectGetProjectSettingCall<'a, C>
24383    where
24384        T: AsRef<str>,
24385    {
24386        self._additional_params
24387            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24388        self
24389    }
24390
24391    /// Identifies the authorization scope for the method you are building.
24392    ///
24393    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24394    /// [`Scope::CloudPlatformReadOnly`].
24395    ///
24396    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24397    /// tokens for more than one scope.
24398    ///
24399    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24400    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24401    /// sufficient, a read-write scope will do as well.
24402    pub fn add_scope<St>(mut self, scope: St) -> ProjectGetProjectSettingCall<'a, C>
24403    where
24404        St: AsRef<str>,
24405    {
24406        self._scopes.insert(String::from(scope.as_ref()));
24407        self
24408    }
24409    /// Identifies the authorization scope(s) for the method you are building.
24410    ///
24411    /// See [`Self::add_scope()`] for details.
24412    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetProjectSettingCall<'a, C>
24413    where
24414        I: IntoIterator<Item = St>,
24415        St: AsRef<str>,
24416    {
24417        self._scopes
24418            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24419        self
24420    }
24421
24422    /// Removes all scopes, and no default scope will be used either.
24423    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24424    /// for details).
24425    pub fn clear_scopes(mut self) -> ProjectGetProjectSettingCall<'a, C> {
24426        self._scopes.clear();
24427        self
24428    }
24429}
24430
24431/// Updates the Settings for the Project.
24432///
24433/// A builder for the *updateProjectSettings* method supported by a *project* resource.
24434/// It is not used directly, but through a [`ProjectMethods`] instance.
24435///
24436/// # Example
24437///
24438/// Instantiate a resource method builder
24439///
24440/// ```test_harness,no_run
24441/// # extern crate hyper;
24442/// # extern crate hyper_rustls;
24443/// # extern crate google_artifactregistry1 as artifactregistry1;
24444/// use artifactregistry1::api::ProjectSettings;
24445/// # async fn dox() {
24446/// # use artifactregistry1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24447///
24448/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24449/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24450/// #     .with_native_roots()
24451/// #     .unwrap()
24452/// #     .https_only()
24453/// #     .enable_http2()
24454/// #     .build();
24455///
24456/// # let executor = hyper_util::rt::TokioExecutor::new();
24457/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24458/// #     secret,
24459/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24460/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24461/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24462/// #     ),
24463/// # ).build().await.unwrap();
24464///
24465/// # let client = hyper_util::client::legacy::Client::builder(
24466/// #     hyper_util::rt::TokioExecutor::new()
24467/// # )
24468/// # .build(
24469/// #     hyper_rustls::HttpsConnectorBuilder::new()
24470/// #         .with_native_roots()
24471/// #         .unwrap()
24472/// #         .https_or_http()
24473/// #         .enable_http2()
24474/// #         .build()
24475/// # );
24476/// # let mut hub = ArtifactRegistry::new(client, auth);
24477/// // As the method needs a request, you would usually fill it with the desired information
24478/// // into the respective structure. Some of the parts shown here might not be applicable !
24479/// // Values shown here are possibly random and not representative !
24480/// let mut req = ProjectSettings::default();
24481///
24482/// // You can configure optional parameters by calling the respective setters at will, and
24483/// // execute the final call using `doit()`.
24484/// // Values shown here are possibly random and not representative !
24485/// let result = hub.projects().update_project_settings(req, "name")
24486///              .update_mask(FieldMask::new::<&str>(&[]))
24487///              .doit().await;
24488/// # }
24489/// ```
24490pub struct ProjectUpdateProjectSettingCall<'a, C>
24491where
24492    C: 'a,
24493{
24494    hub: &'a ArtifactRegistry<C>,
24495    _request: ProjectSettings,
24496    _name: String,
24497    _update_mask: Option<common::FieldMask>,
24498    _delegate: Option<&'a mut dyn common::Delegate>,
24499    _additional_params: HashMap<String, String>,
24500    _scopes: BTreeSet<String>,
24501}
24502
24503impl<'a, C> common::CallBuilder for ProjectUpdateProjectSettingCall<'a, C> {}
24504
24505impl<'a, C> ProjectUpdateProjectSettingCall<'a, C>
24506where
24507    C: common::Connector,
24508{
24509    /// Perform the operation you have build so far.
24510    pub async fn doit(mut self) -> common::Result<(common::Response, ProjectSettings)> {
24511        use std::borrow::Cow;
24512        use std::io::{Read, Seek};
24513
24514        use common::{url::Params, ToParts};
24515        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24516
24517        let mut dd = common::DefaultDelegate;
24518        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24519        dlg.begin(common::MethodInfo {
24520            id: "artifactregistry.projects.updateProjectSettings",
24521            http_method: hyper::Method::PATCH,
24522        });
24523
24524        for &field in ["alt", "name", "updateMask"].iter() {
24525            if self._additional_params.contains_key(field) {
24526                dlg.finished(false);
24527                return Err(common::Error::FieldClash(field));
24528            }
24529        }
24530
24531        let mut params = Params::with_capacity(5 + self._additional_params.len());
24532        params.push("name", self._name);
24533        if let Some(value) = self._update_mask.as_ref() {
24534            params.push("updateMask", value.to_string());
24535        }
24536
24537        params.extend(self._additional_params.iter());
24538
24539        params.push("alt", "json");
24540        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24541        if self._scopes.is_empty() {
24542            self._scopes
24543                .insert(Scope::CloudPlatform.as_ref().to_string());
24544        }
24545
24546        #[allow(clippy::single_element_loop)]
24547        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24548            url = params.uri_replacement(url, param_name, find_this, true);
24549        }
24550        {
24551            let to_remove = ["name"];
24552            params.remove_params(&to_remove);
24553        }
24554
24555        let url = params.parse_with_url(&url);
24556
24557        let mut json_mime_type = mime::APPLICATION_JSON;
24558        let mut request_value_reader = {
24559            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24560            common::remove_json_null_values(&mut value);
24561            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24562            serde_json::to_writer(&mut dst, &value).unwrap();
24563            dst
24564        };
24565        let request_size = request_value_reader
24566            .seek(std::io::SeekFrom::End(0))
24567            .unwrap();
24568        request_value_reader
24569            .seek(std::io::SeekFrom::Start(0))
24570            .unwrap();
24571
24572        loop {
24573            let token = match self
24574                .hub
24575                .auth
24576                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24577                .await
24578            {
24579                Ok(token) => token,
24580                Err(e) => match dlg.token(e) {
24581                    Ok(token) => token,
24582                    Err(e) => {
24583                        dlg.finished(false);
24584                        return Err(common::Error::MissingToken(e));
24585                    }
24586                },
24587            };
24588            request_value_reader
24589                .seek(std::io::SeekFrom::Start(0))
24590                .unwrap();
24591            let mut req_result = {
24592                let client = &self.hub.client;
24593                dlg.pre_request();
24594                let mut req_builder = hyper::Request::builder()
24595                    .method(hyper::Method::PATCH)
24596                    .uri(url.as_str())
24597                    .header(USER_AGENT, self.hub._user_agent.clone());
24598
24599                if let Some(token) = token.as_ref() {
24600                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24601                }
24602
24603                let request = req_builder
24604                    .header(CONTENT_TYPE, json_mime_type.to_string())
24605                    .header(CONTENT_LENGTH, request_size as u64)
24606                    .body(common::to_body(
24607                        request_value_reader.get_ref().clone().into(),
24608                    ));
24609
24610                client.request(request.unwrap()).await
24611            };
24612
24613            match req_result {
24614                Err(err) => {
24615                    if let common::Retry::After(d) = dlg.http_error(&err) {
24616                        sleep(d).await;
24617                        continue;
24618                    }
24619                    dlg.finished(false);
24620                    return Err(common::Error::HttpError(err));
24621                }
24622                Ok(res) => {
24623                    let (mut parts, body) = res.into_parts();
24624                    let mut body = common::Body::new(body);
24625                    if !parts.status.is_success() {
24626                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24627                        let error = serde_json::from_str(&common::to_string(&bytes));
24628                        let response = common::to_response(parts, bytes.into());
24629
24630                        if let common::Retry::After(d) =
24631                            dlg.http_failure(&response, error.as_ref().ok())
24632                        {
24633                            sleep(d).await;
24634                            continue;
24635                        }
24636
24637                        dlg.finished(false);
24638
24639                        return Err(match error {
24640                            Ok(value) => common::Error::BadRequest(value),
24641                            _ => common::Error::Failure(response),
24642                        });
24643                    }
24644                    let response = {
24645                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24646                        let encoded = common::to_string(&bytes);
24647                        match serde_json::from_str(&encoded) {
24648                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24649                            Err(error) => {
24650                                dlg.response_json_decode_error(&encoded, &error);
24651                                return Err(common::Error::JsonDecodeError(
24652                                    encoded.to_string(),
24653                                    error,
24654                                ));
24655                            }
24656                        }
24657                    };
24658
24659                    dlg.finished(true);
24660                    return Ok(response);
24661                }
24662            }
24663        }
24664    }
24665
24666    ///
24667    /// Sets the *request* property to the given value.
24668    ///
24669    /// Even though the property as already been set when instantiating this call,
24670    /// we provide this method for API completeness.
24671    pub fn request(mut self, new_value: ProjectSettings) -> ProjectUpdateProjectSettingCall<'a, C> {
24672        self._request = new_value;
24673        self
24674    }
24675    /// The name of the project's settings. Always of the form: projects/{project-id}/projectSettings In update request: never set In response: always set
24676    ///
24677    /// Sets the *name* path property to the given value.
24678    ///
24679    /// Even though the property as already been set when instantiating this call,
24680    /// we provide this method for API completeness.
24681    pub fn name(mut self, new_value: &str) -> ProjectUpdateProjectSettingCall<'a, C> {
24682        self._name = new_value.to_string();
24683        self
24684    }
24685    /// Field mask to support partial updates.
24686    ///
24687    /// Sets the *update mask* query property to the given value.
24688    pub fn update_mask(
24689        mut self,
24690        new_value: common::FieldMask,
24691    ) -> ProjectUpdateProjectSettingCall<'a, C> {
24692        self._update_mask = Some(new_value);
24693        self
24694    }
24695    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24696    /// while executing the actual API request.
24697    ///
24698    /// ````text
24699    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24700    /// ````
24701    ///
24702    /// Sets the *delegate* property to the given value.
24703    pub fn delegate(
24704        mut self,
24705        new_value: &'a mut dyn common::Delegate,
24706    ) -> ProjectUpdateProjectSettingCall<'a, C> {
24707        self._delegate = Some(new_value);
24708        self
24709    }
24710
24711    /// Set any additional parameter of the query string used in the request.
24712    /// It should be used to set parameters which are not yet available through their own
24713    /// setters.
24714    ///
24715    /// Please note that this method must not be used to set any of the known parameters
24716    /// which have their own setter method. If done anyway, the request will fail.
24717    ///
24718    /// # Additional Parameters
24719    ///
24720    /// * *$.xgafv* (query-string) - V1 error format.
24721    /// * *access_token* (query-string) - OAuth access token.
24722    /// * *alt* (query-string) - Data format for response.
24723    /// * *callback* (query-string) - JSONP
24724    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24725    /// * *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.
24726    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24727    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24728    /// * *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.
24729    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24730    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24731    pub fn param<T>(mut self, name: T, value: T) -> ProjectUpdateProjectSettingCall<'a, C>
24732    where
24733        T: AsRef<str>,
24734    {
24735        self._additional_params
24736            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24737        self
24738    }
24739
24740    /// Identifies the authorization scope for the method you are building.
24741    ///
24742    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24743    /// [`Scope::CloudPlatform`].
24744    ///
24745    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24746    /// tokens for more than one scope.
24747    ///
24748    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24749    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24750    /// sufficient, a read-write scope will do as well.
24751    pub fn add_scope<St>(mut self, scope: St) -> ProjectUpdateProjectSettingCall<'a, C>
24752    where
24753        St: AsRef<str>,
24754    {
24755        self._scopes.insert(String::from(scope.as_ref()));
24756        self
24757    }
24758    /// Identifies the authorization scope(s) for the method you are building.
24759    ///
24760    /// See [`Self::add_scope()`] for details.
24761    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectUpdateProjectSettingCall<'a, C>
24762    where
24763        I: IntoIterator<Item = St>,
24764        St: AsRef<str>,
24765    {
24766        self._scopes
24767            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24768        self
24769    }
24770
24771    /// Removes all scopes, and no default scope will be used either.
24772    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24773    /// for details).
24774    pub fn clear_scopes(mut self) -> ProjectUpdateProjectSettingCall<'a, C> {
24775        self._scopes.clear();
24776        self
24777    }
24778}