google_artifactregistry1_beta1/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_beta1 as artifactregistry1_beta1;
55/// use artifactregistry1_beta1::api::Repository;
56/// use artifactregistry1_beta1::{Result, Error};
57/// # async fn dox() {
58/// use artifactregistry1_beta1::{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 = Repository::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_create(req, "parent")
105/// .repository_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/// Associates `members`, or principals, with a `role`.
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 Binding {
192 /// 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).
193 pub condition: Option<Expr>,
194 /// 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`.
195 pub members: Option<Vec<String>>,
196 /// 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).
197 pub role: Option<String>,
198}
199
200impl common::Part for Binding {}
201
202/// 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); }
203///
204/// # Activities
205///
206/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
207/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
208///
209/// * [locations repositories packages tags delete projects](ProjectLocationRepositoryPackageTagDeleteCall) (response)
210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
211#[serde_with::serde_as]
212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
213pub struct Empty {
214 _never_set: Option<bool>,
215}
216
217impl common::ResponseResult for Empty {}
218
219/// 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.
220///
221/// This type is not used in any activity, and only used as *part* of another schema.
222///
223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
224#[serde_with::serde_as]
225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
226pub struct Expr {
227 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
228 pub description: Option<String>,
229 /// Textual representation of an expression in Common Expression Language syntax.
230 pub expression: Option<String>,
231 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
232 pub location: Option<String>,
233 /// 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.
234 pub title: Option<String>,
235}
236
237impl common::Part for Expr {}
238
239/// Files store content that is potentially associated with Packages or Versions.
240///
241/// # Activities
242///
243/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
244/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
245///
246/// * [locations repositories files get projects](ProjectLocationRepositoryFileGetCall) (response)
247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
248#[serde_with::serde_as]
249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
250pub struct File {
251 /// Output only. The time when the File was created.
252 #[serde(rename = "createTime")]
253 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
254 /// The hashes of the file content.
255 pub hashes: Option<Vec<Hash>>,
256 /// 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.
257 pub name: Option<String>,
258 /// The name of the Package or Version that owns this file, if any.
259 pub owner: Option<String>,
260 /// The size of the File in bytes.
261 #[serde(rename = "sizeBytes")]
262 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
263 pub size_bytes: Option<i64>,
264 /// Output only. The time when the File was last updated.
265 #[serde(rename = "updateTime")]
266 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
267}
268
269impl common::ResponseResult for File {}
270
271/// A hash of file content.
272///
273/// This type is not used in any activity, and only used as *part* of another schema.
274///
275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
276#[serde_with::serde_as]
277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
278pub struct Hash {
279 /// The algorithm used to compute the hash value.
280 #[serde(rename = "type")]
281 pub type_: Option<String>,
282 /// The hash value.
283 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
284 pub value: Option<Vec<u8>>,
285}
286
287impl common::Part for Hash {}
288
289/// The response from listing files.
290///
291/// # Activities
292///
293/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
294/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
295///
296/// * [locations repositories files list projects](ProjectLocationRepositoryFileListCall) (response)
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct ListFilesResponse {
301 /// The files returned.
302 pub files: Option<Vec<File>>,
303 /// The token to retrieve the next page of files, or empty if there are no more files to return.
304 #[serde(rename = "nextPageToken")]
305 pub next_page_token: Option<String>,
306}
307
308impl common::ResponseResult for ListFilesResponse {}
309
310/// The response message for Locations.ListLocations.
311///
312/// # Activities
313///
314/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
315/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
316///
317/// * [locations list projects](ProjectLocationListCall) (response)
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct ListLocationsResponse {
322 /// A list of locations that matches the specified filter in the request.
323 pub locations: Option<Vec<Location>>,
324 /// The standard List next-page token.
325 #[serde(rename = "nextPageToken")]
326 pub next_page_token: Option<String>,
327}
328
329impl common::ResponseResult for ListLocationsResponse {}
330
331/// The response from listing packages.
332///
333/// # Activities
334///
335/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
336/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
337///
338/// * [locations repositories packages list projects](ProjectLocationRepositoryPackageListCall) (response)
339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
340#[serde_with::serde_as]
341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
342pub struct ListPackagesResponse {
343 /// The token to retrieve the next page of packages, or empty if there are no more packages to return.
344 #[serde(rename = "nextPageToken")]
345 pub next_page_token: Option<String>,
346 /// The packages returned.
347 pub packages: Option<Vec<Package>>,
348}
349
350impl common::ResponseResult for ListPackagesResponse {}
351
352/// The response from listing repositories.
353///
354/// # Activities
355///
356/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
357/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
358///
359/// * [locations repositories list projects](ProjectLocationRepositoryListCall) (response)
360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
361#[serde_with::serde_as]
362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
363pub struct ListRepositoriesResponse {
364 /// The token to retrieve the next page of repositories, or empty if there are no more repositories to return.
365 #[serde(rename = "nextPageToken")]
366 pub next_page_token: Option<String>,
367 /// The repositories returned.
368 pub repositories: Option<Vec<Repository>>,
369}
370
371impl common::ResponseResult for ListRepositoriesResponse {}
372
373/// The response from listing tags.
374///
375/// # Activities
376///
377/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
378/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
379///
380/// * [locations repositories packages tags list projects](ProjectLocationRepositoryPackageTagListCall) (response)
381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
382#[serde_with::serde_as]
383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
384pub struct ListTagsResponse {
385 /// The token to retrieve the next page of tags, or empty if there are no more tags to return.
386 #[serde(rename = "nextPageToken")]
387 pub next_page_token: Option<String>,
388 /// The tags returned.
389 pub tags: Option<Vec<Tag>>,
390}
391
392impl common::ResponseResult for ListTagsResponse {}
393
394/// The response from listing versions.
395///
396/// # Activities
397///
398/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
399/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
400///
401/// * [locations repositories packages versions list projects](ProjectLocationRepositoryPackageVersionListCall) (response)
402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
403#[serde_with::serde_as]
404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
405pub struct ListVersionsResponse {
406 /// The token to retrieve the next page of versions, or empty if there are no more versions to return.
407 #[serde(rename = "nextPageToken")]
408 pub next_page_token: Option<String>,
409 /// The versions returned.
410 pub versions: Option<Vec<Version>>,
411}
412
413impl common::ResponseResult for ListVersionsResponse {}
414
415/// A resource that represents a Google Cloud location.
416///
417/// # Activities
418///
419/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
420/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
421///
422/// * [locations get projects](ProjectLocationGetCall) (response)
423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
424#[serde_with::serde_as]
425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
426pub struct Location {
427 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
428 #[serde(rename = "displayName")]
429 pub display_name: Option<String>,
430 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
431 pub labels: Option<HashMap<String, String>>,
432 /// The canonical id for this location. For example: `"us-east1"`.
433 #[serde(rename = "locationId")]
434 pub location_id: Option<String>,
435 /// Service-specific metadata. For example the available capacity at the given location.
436 pub metadata: Option<HashMap<String, serde_json::Value>>,
437 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
438 pub name: Option<String>,
439}
440
441impl common::ResponseResult for Location {}
442
443/// This resource represents a long-running operation that is the result of a network API call.
444///
445/// # Activities
446///
447/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
448/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
449///
450/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
451/// * [locations repositories packages versions delete projects](ProjectLocationRepositoryPackageVersionDeleteCall) (response)
452/// * [locations repositories packages delete projects](ProjectLocationRepositoryPackageDeleteCall) (response)
453/// * [locations repositories create projects](ProjectLocationRepositoryCreateCall) (response)
454/// * [locations repositories delete projects](ProjectLocationRepositoryDeleteCall) (response)
455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
456#[serde_with::serde_as]
457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
458pub struct Operation {
459 /// 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.
460 pub done: Option<bool>,
461 /// The error result of the operation in case of failure or cancellation.
462 pub error: Option<Status>,
463 /// 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.
464 pub metadata: Option<HashMap<String, serde_json::Value>>,
465 /// 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}`.
466 pub name: Option<String>,
467 /// 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`.
468 pub response: Option<HashMap<String, serde_json::Value>>,
469}
470
471impl common::ResponseResult for Operation {}
472
473/// Packages are named collections of versions.
474///
475/// # Activities
476///
477/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
478/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
479///
480/// * [locations repositories packages get projects](ProjectLocationRepositoryPackageGetCall) (response)
481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
482#[serde_with::serde_as]
483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
484pub struct Package {
485 /// The time when the package was created.
486 #[serde(rename = "createTime")]
487 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
488 /// The display name of the package.
489 #[serde(rename = "displayName")]
490 pub display_name: Option<String>,
491 /// 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.
492 pub name: Option<String>,
493 /// The time when the package was last updated. This includes publishing a new version of the package.
494 #[serde(rename = "updateTime")]
495 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
496}
497
498impl common::ResponseResult for Package {}
499
500/// 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/).
501///
502/// # Activities
503///
504/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
505/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
506///
507/// * [locations repositories get iam policy projects](ProjectLocationRepositoryGetIamPolicyCall) (response)
508/// * [locations repositories set iam policy projects](ProjectLocationRepositorySetIamPolicyCall) (response)
509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
510#[serde_with::serde_as]
511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
512pub struct Policy {
513 /// 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`.
514 pub bindings: Option<Vec<Binding>>,
515 /// `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.
516 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
517 pub etag: Option<Vec<u8>>,
518 /// 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).
519 pub version: Option<i32>,
520}
521
522impl common::ResponseResult for Policy {}
523
524/// A Repository for storing artifacts with a specific format.
525///
526/// # Activities
527///
528/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
529/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
530///
531/// * [locations repositories create projects](ProjectLocationRepositoryCreateCall) (request)
532/// * [locations repositories get projects](ProjectLocationRepositoryGetCall) (response)
533/// * [locations repositories patch projects](ProjectLocationRepositoryPatchCall) (request|response)
534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
535#[serde_with::serde_as]
536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
537pub struct Repository {
538 /// Output only. The time when the repository was created.
539 #[serde(rename = "createTime")]
540 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
541 /// The user-provided description of the repository.
542 pub description: Option<String>,
543 /// Optional. The format of packages that are stored in the repository.
544 pub format: Option<String>,
545 /// 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.
546 #[serde(rename = "kmsKeyName")]
547 pub kms_key_name: Option<String>,
548 /// 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.
549 pub labels: Option<HashMap<String, String>>,
550 /// 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.
551 pub name: Option<String>,
552 /// Output only. Whether or not this repository satisfies PZI.
553 #[serde(rename = "satisfiesPzi")]
554 pub satisfies_pzi: Option<bool>,
555 /// Output only. Whether or not this repository satisfies PZS.
556 #[serde(rename = "satisfiesPzs")]
557 pub satisfies_pzs: Option<bool>,
558 /// 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.
559 #[serde(rename = "sizeBytes")]
560 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
561 pub size_bytes: Option<i64>,
562 /// Output only. The time when the repository was last updated.
563 #[serde(rename = "updateTime")]
564 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
565}
566
567impl common::RequestValue for Repository {}
568impl common::ResponseResult for Repository {}
569
570/// Request message for `SetIamPolicy` method.
571///
572/// # Activities
573///
574/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
575/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
576///
577/// * [locations repositories set iam policy projects](ProjectLocationRepositorySetIamPolicyCall) (request)
578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
579#[serde_with::serde_as]
580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
581pub struct SetIamPolicyRequest {
582 /// 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.
583 pub policy: Option<Policy>,
584}
585
586impl common::RequestValue for SetIamPolicyRequest {}
587
588/// 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).
589///
590/// This type is not used in any activity, and only used as *part* of another schema.
591///
592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
593#[serde_with::serde_as]
594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
595pub struct Status {
596 /// The status code, which should be an enum value of google.rpc.Code.
597 pub code: Option<i32>,
598 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
599 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
600 /// 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.
601 pub message: Option<String>,
602}
603
604impl common::Part for Status {}
605
606/// Tags point to a version and represent an alternative name that can be used to access the version.
607///
608/// # Activities
609///
610/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
611/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
612///
613/// * [locations repositories packages tags create projects](ProjectLocationRepositoryPackageTagCreateCall) (request|response)
614/// * [locations repositories packages tags get projects](ProjectLocationRepositoryPackageTagGetCall) (response)
615/// * [locations repositories packages tags patch projects](ProjectLocationRepositoryPackageTagPatchCall) (request|response)
616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
617#[serde_with::serde_as]
618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
619pub struct Tag {
620 /// 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.
621 pub name: Option<String>,
622 /// 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.
623 pub version: Option<String>,
624}
625
626impl common::RequestValue for Tag {}
627impl common::ResponseResult for Tag {}
628
629/// Request message for `TestIamPermissions` method.
630///
631/// # Activities
632///
633/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
634/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
635///
636/// * [locations repositories test iam permissions projects](ProjectLocationRepositoryTestIamPermissionCall) (request)
637#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
638#[serde_with::serde_as]
639#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
640pub struct TestIamPermissionsRequest {
641 /// 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).
642 pub permissions: Option<Vec<String>>,
643}
644
645impl common::RequestValue for TestIamPermissionsRequest {}
646
647/// Response message for `TestIamPermissions` method.
648///
649/// # Activities
650///
651/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
652/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
653///
654/// * [locations repositories test iam permissions projects](ProjectLocationRepositoryTestIamPermissionCall) (response)
655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
656#[serde_with::serde_as]
657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
658pub struct TestIamPermissionsResponse {
659 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
660 pub permissions: Option<Vec<String>>,
661}
662
663impl common::ResponseResult for TestIamPermissionsResponse {}
664
665/// 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.
666///
667/// # Activities
668///
669/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
670/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
671///
672/// * [locations repositories packages versions get projects](ProjectLocationRepositoryPackageVersionGetCall) (response)
673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
674#[serde_with::serde_as]
675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
676pub struct Version {
677 /// The time when the version was created.
678 #[serde(rename = "createTime")]
679 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
680 /// Optional. Description of the version, as specified in its metadata.
681 pub description: Option<String>,
682 /// 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.
683 pub name: Option<String>,
684 /// Output only. A list of related tags. Will contain up to 100 tags that reference this version.
685 #[serde(rename = "relatedTags")]
686 pub related_tags: Option<Vec<Tag>>,
687 /// The time when the version was last updated.
688 #[serde(rename = "updateTime")]
689 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
690}
691
692impl common::ResponseResult for Version {}
693
694// ###################
695// MethodBuilders ###
696// #################
697
698/// A builder providing access to all methods supported on *project* resources.
699/// It is not used directly, but through the [`ArtifactRegistry`] hub.
700///
701/// # Example
702///
703/// Instantiate a resource builder
704///
705/// ```test_harness,no_run
706/// extern crate hyper;
707/// extern crate hyper_rustls;
708/// extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
709///
710/// # async fn dox() {
711/// use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
712///
713/// let secret: yup_oauth2::ApplicationSecret = Default::default();
714/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
715/// .with_native_roots()
716/// .unwrap()
717/// .https_only()
718/// .enable_http2()
719/// .build();
720///
721/// let executor = hyper_util::rt::TokioExecutor::new();
722/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
723/// secret,
724/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
725/// yup_oauth2::client::CustomHyperClientBuilder::from(
726/// hyper_util::client::legacy::Client::builder(executor).build(connector),
727/// ),
728/// ).build().await.unwrap();
729///
730/// let client = hyper_util::client::legacy::Client::builder(
731/// hyper_util::rt::TokioExecutor::new()
732/// )
733/// .build(
734/// hyper_rustls::HttpsConnectorBuilder::new()
735/// .with_native_roots()
736/// .unwrap()
737/// .https_or_http()
738/// .enable_http2()
739/// .build()
740/// );
741/// let mut hub = ArtifactRegistry::new(client, auth);
742/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
743/// // like `locations_get(...)`, `locations_list(...)`, `locations_operations_get(...)`, `locations_repositories_create(...)`, `locations_repositories_delete(...)`, `locations_repositories_files_get(...)`, `locations_repositories_files_list(...)`, `locations_repositories_get(...)`, `locations_repositories_get_iam_policy(...)`, `locations_repositories_list(...)`, `locations_repositories_packages_delete(...)`, `locations_repositories_packages_get(...)`, `locations_repositories_packages_list(...)`, `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_delete(...)`, `locations_repositories_packages_versions_get(...)`, `locations_repositories_packages_versions_list(...)`, `locations_repositories_patch(...)`, `locations_repositories_set_iam_policy(...)` and `locations_repositories_test_iam_permissions(...)`
744/// // to build up your call.
745/// let rb = hub.projects();
746/// # }
747/// ```
748pub struct ProjectMethods<'a, C>
749where
750 C: 'a,
751{
752 hub: &'a ArtifactRegistry<C>,
753}
754
755impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
756
757impl<'a, C> ProjectMethods<'a, C> {
758 /// Create a builder to help you perform the following task:
759 ///
760 /// 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.
761 ///
762 /// # Arguments
763 ///
764 /// * `name` - The name of the operation resource.
765 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
766 ProjectLocationOperationGetCall {
767 hub: self.hub,
768 _name: name.to_string(),
769 _delegate: Default::default(),
770 _additional_params: Default::default(),
771 _scopes: Default::default(),
772 }
773 }
774
775 /// Create a builder to help you perform the following task:
776 ///
777 /// Gets a file.
778 ///
779 /// # Arguments
780 ///
781 /// * `name` - Required. The name of the file to retrieve.
782 pub fn locations_repositories_files_get(
783 &self,
784 name: &str,
785 ) -> ProjectLocationRepositoryFileGetCall<'a, C> {
786 ProjectLocationRepositoryFileGetCall {
787 hub: self.hub,
788 _name: name.to_string(),
789 _delegate: Default::default(),
790 _additional_params: Default::default(),
791 _scopes: Default::default(),
792 }
793 }
794
795 /// Create a builder to help you perform the following task:
796 ///
797 /// Lists files.
798 ///
799 /// # Arguments
800 ///
801 /// * `parent` - Required. The name of the repository whose files will be listed. For example: "projects/p1/locations/us-central1/repositories/repo1
802 pub fn locations_repositories_files_list(
803 &self,
804 parent: &str,
805 ) -> ProjectLocationRepositoryFileListCall<'a, C> {
806 ProjectLocationRepositoryFileListCall {
807 hub: self.hub,
808 _parent: parent.to_string(),
809 _page_token: Default::default(),
810 _page_size: Default::default(),
811 _filter: Default::default(),
812 _delegate: Default::default(),
813 _additional_params: Default::default(),
814 _scopes: Default::default(),
815 }
816 }
817
818 /// Create a builder to help you perform the following task:
819 ///
820 /// Creates a tag.
821 ///
822 /// # Arguments
823 ///
824 /// * `request` - No description provided.
825 /// * `parent` - The name of the parent resource where the tag will be created.
826 pub fn locations_repositories_packages_tags_create(
827 &self,
828 request: Tag,
829 parent: &str,
830 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
831 ProjectLocationRepositoryPackageTagCreateCall {
832 hub: self.hub,
833 _request: request,
834 _parent: parent.to_string(),
835 _tag_id: Default::default(),
836 _delegate: Default::default(),
837 _additional_params: Default::default(),
838 _scopes: Default::default(),
839 }
840 }
841
842 /// Create a builder to help you perform the following task:
843 ///
844 /// Deletes a tag.
845 ///
846 /// # Arguments
847 ///
848 /// * `name` - The name of the tag to delete.
849 pub fn locations_repositories_packages_tags_delete(
850 &self,
851 name: &str,
852 ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
853 ProjectLocationRepositoryPackageTagDeleteCall {
854 hub: self.hub,
855 _name: name.to_string(),
856 _delegate: Default::default(),
857 _additional_params: Default::default(),
858 _scopes: Default::default(),
859 }
860 }
861
862 /// Create a builder to help you perform the following task:
863 ///
864 /// Gets a tag.
865 ///
866 /// # Arguments
867 ///
868 /// * `name` - The name of the tag to retrieve.
869 pub fn locations_repositories_packages_tags_get(
870 &self,
871 name: &str,
872 ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
873 ProjectLocationRepositoryPackageTagGetCall {
874 hub: self.hub,
875 _name: name.to_string(),
876 _delegate: Default::default(),
877 _additional_params: Default::default(),
878 _scopes: Default::default(),
879 }
880 }
881
882 /// Create a builder to help you perform the following task:
883 ///
884 /// Lists tags.
885 ///
886 /// # Arguments
887 ///
888 /// * `parent` - The name of the parent package whose tags will be listed. For example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1`.
889 pub fn locations_repositories_packages_tags_list(
890 &self,
891 parent: &str,
892 ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
893 ProjectLocationRepositoryPackageTagListCall {
894 hub: self.hub,
895 _parent: parent.to_string(),
896 _page_token: Default::default(),
897 _page_size: Default::default(),
898 _filter: Default::default(),
899 _delegate: Default::default(),
900 _additional_params: Default::default(),
901 _scopes: Default::default(),
902 }
903 }
904
905 /// Create a builder to help you perform the following task:
906 ///
907 /// Updates a tag.
908 ///
909 /// # Arguments
910 ///
911 /// * `request` - No description provided.
912 /// * `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.
913 pub fn locations_repositories_packages_tags_patch(
914 &self,
915 request: Tag,
916 name: &str,
917 ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
918 ProjectLocationRepositoryPackageTagPatchCall {
919 hub: self.hub,
920 _request: request,
921 _name: name.to_string(),
922 _update_mask: Default::default(),
923 _delegate: Default::default(),
924 _additional_params: Default::default(),
925 _scopes: Default::default(),
926 }
927 }
928
929 /// Create a builder to help you perform the following task:
930 ///
931 /// Deletes a version and all of its content. The returned operation will complete once the version has been deleted.
932 ///
933 /// # Arguments
934 ///
935 /// * `name` - The name of the version to delete.
936 pub fn locations_repositories_packages_versions_delete(
937 &self,
938 name: &str,
939 ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
940 ProjectLocationRepositoryPackageVersionDeleteCall {
941 hub: self.hub,
942 _name: name.to_string(),
943 _force: Default::default(),
944 _delegate: Default::default(),
945 _additional_params: Default::default(),
946 _scopes: Default::default(),
947 }
948 }
949
950 /// Create a builder to help you perform the following task:
951 ///
952 /// Gets a version
953 ///
954 /// # Arguments
955 ///
956 /// * `name` - The name of the version to retrieve.
957 pub fn locations_repositories_packages_versions_get(
958 &self,
959 name: &str,
960 ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
961 ProjectLocationRepositoryPackageVersionGetCall {
962 hub: self.hub,
963 _name: name.to_string(),
964 _view: Default::default(),
965 _delegate: Default::default(),
966 _additional_params: Default::default(),
967 _scopes: Default::default(),
968 }
969 }
970
971 /// Create a builder to help you perform the following task:
972 ///
973 /// Lists versions.
974 ///
975 /// # Arguments
976 ///
977 /// * `parent` - The name of the parent resource whose versions will be listed.
978 pub fn locations_repositories_packages_versions_list(
979 &self,
980 parent: &str,
981 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
982 ProjectLocationRepositoryPackageVersionListCall {
983 hub: self.hub,
984 _parent: parent.to_string(),
985 _view: Default::default(),
986 _page_token: Default::default(),
987 _page_size: Default::default(),
988 _order_by: Default::default(),
989 _delegate: Default::default(),
990 _additional_params: Default::default(),
991 _scopes: Default::default(),
992 }
993 }
994
995 /// Create a builder to help you perform the following task:
996 ///
997 /// Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.
998 ///
999 /// # Arguments
1000 ///
1001 /// * `name` - Required. The name of the package to delete.
1002 pub fn locations_repositories_packages_delete(
1003 &self,
1004 name: &str,
1005 ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
1006 ProjectLocationRepositoryPackageDeleteCall {
1007 hub: self.hub,
1008 _name: name.to_string(),
1009 _delegate: Default::default(),
1010 _additional_params: Default::default(),
1011 _scopes: Default::default(),
1012 }
1013 }
1014
1015 /// Create a builder to help you perform the following task:
1016 ///
1017 /// Gets a package.
1018 ///
1019 /// # Arguments
1020 ///
1021 /// * `name` - Required. The name of the package to retrieve.
1022 pub fn locations_repositories_packages_get(
1023 &self,
1024 name: &str,
1025 ) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
1026 ProjectLocationRepositoryPackageGetCall {
1027 hub: self.hub,
1028 _name: name.to_string(),
1029 _delegate: Default::default(),
1030 _additional_params: Default::default(),
1031 _scopes: Default::default(),
1032 }
1033 }
1034
1035 /// Create a builder to help you perform the following task:
1036 ///
1037 /// Lists packages.
1038 ///
1039 /// # Arguments
1040 ///
1041 /// * `parent` - Required. The name of the parent resource whose packages will be listed.
1042 pub fn locations_repositories_packages_list(
1043 &self,
1044 parent: &str,
1045 ) -> ProjectLocationRepositoryPackageListCall<'a, C> {
1046 ProjectLocationRepositoryPackageListCall {
1047 hub: self.hub,
1048 _parent: parent.to_string(),
1049 _page_token: Default::default(),
1050 _page_size: Default::default(),
1051 _order_by: Default::default(),
1052 _delegate: Default::default(),
1053 _additional_params: Default::default(),
1054 _scopes: Default::default(),
1055 }
1056 }
1057
1058 /// Create a builder to help you perform the following task:
1059 ///
1060 /// Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.
1061 ///
1062 /// # Arguments
1063 ///
1064 /// * `request` - No description provided.
1065 /// * `parent` - Required. The name of the parent resource where the repository will be created.
1066 pub fn locations_repositories_create(
1067 &self,
1068 request: Repository,
1069 parent: &str,
1070 ) -> ProjectLocationRepositoryCreateCall<'a, C> {
1071 ProjectLocationRepositoryCreateCall {
1072 hub: self.hub,
1073 _request: request,
1074 _parent: parent.to_string(),
1075 _repository_id: Default::default(),
1076 _delegate: Default::default(),
1077 _additional_params: Default::default(),
1078 _scopes: Default::default(),
1079 }
1080 }
1081
1082 /// Create a builder to help you perform the following task:
1083 ///
1084 /// 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.
1085 ///
1086 /// # Arguments
1087 ///
1088 /// * `name` - Required. The name of the repository to delete.
1089 pub fn locations_repositories_delete(
1090 &self,
1091 name: &str,
1092 ) -> ProjectLocationRepositoryDeleteCall<'a, C> {
1093 ProjectLocationRepositoryDeleteCall {
1094 hub: self.hub,
1095 _name: name.to_string(),
1096 _delegate: Default::default(),
1097 _additional_params: Default::default(),
1098 _scopes: Default::default(),
1099 }
1100 }
1101
1102 /// Create a builder to help you perform the following task:
1103 ///
1104 /// Gets a repository.
1105 ///
1106 /// # Arguments
1107 ///
1108 /// * `name` - Required. The name of the repository to retrieve.
1109 pub fn locations_repositories_get(
1110 &self,
1111 name: &str,
1112 ) -> ProjectLocationRepositoryGetCall<'a, C> {
1113 ProjectLocationRepositoryGetCall {
1114 hub: self.hub,
1115 _name: name.to_string(),
1116 _delegate: Default::default(),
1117 _additional_params: Default::default(),
1118 _scopes: Default::default(),
1119 }
1120 }
1121
1122 /// Create a builder to help you perform the following task:
1123 ///
1124 /// Gets the IAM policy for a given resource.
1125 ///
1126 /// # Arguments
1127 ///
1128 /// * `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.
1129 pub fn locations_repositories_get_iam_policy(
1130 &self,
1131 resource: &str,
1132 ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
1133 ProjectLocationRepositoryGetIamPolicyCall {
1134 hub: self.hub,
1135 _resource: resource.to_string(),
1136 _options_requested_policy_version: Default::default(),
1137 _delegate: Default::default(),
1138 _additional_params: Default::default(),
1139 _scopes: Default::default(),
1140 }
1141 }
1142
1143 /// Create a builder to help you perform the following task:
1144 ///
1145 /// Lists repositories.
1146 ///
1147 /// # Arguments
1148 ///
1149 /// * `parent` - Required. The name of the parent resource whose repositories will be listed.
1150 pub fn locations_repositories_list(
1151 &self,
1152 parent: &str,
1153 ) -> ProjectLocationRepositoryListCall<'a, C> {
1154 ProjectLocationRepositoryListCall {
1155 hub: self.hub,
1156 _parent: parent.to_string(),
1157 _page_token: Default::default(),
1158 _page_size: Default::default(),
1159 _order_by: Default::default(),
1160 _delegate: Default::default(),
1161 _additional_params: Default::default(),
1162 _scopes: Default::default(),
1163 }
1164 }
1165
1166 /// Create a builder to help you perform the following task:
1167 ///
1168 /// Updates a repository.
1169 ///
1170 /// # Arguments
1171 ///
1172 /// * `request` - No description provided.
1173 /// * `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.
1174 pub fn locations_repositories_patch(
1175 &self,
1176 request: Repository,
1177 name: &str,
1178 ) -> ProjectLocationRepositoryPatchCall<'a, C> {
1179 ProjectLocationRepositoryPatchCall {
1180 hub: self.hub,
1181 _request: request,
1182 _name: name.to_string(),
1183 _update_mask: Default::default(),
1184 _delegate: Default::default(),
1185 _additional_params: Default::default(),
1186 _scopes: Default::default(),
1187 }
1188 }
1189
1190 /// Create a builder to help you perform the following task:
1191 ///
1192 /// Updates the IAM policy for a given resource.
1193 ///
1194 /// # Arguments
1195 ///
1196 /// * `request` - No description provided.
1197 /// * `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.
1198 pub fn locations_repositories_set_iam_policy(
1199 &self,
1200 request: SetIamPolicyRequest,
1201 resource: &str,
1202 ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
1203 ProjectLocationRepositorySetIamPolicyCall {
1204 hub: self.hub,
1205 _request: request,
1206 _resource: resource.to_string(),
1207 _delegate: Default::default(),
1208 _additional_params: Default::default(),
1209 _scopes: Default::default(),
1210 }
1211 }
1212
1213 /// Create a builder to help you perform the following task:
1214 ///
1215 /// Tests if the caller has a list of permissions on a resource.
1216 ///
1217 /// # Arguments
1218 ///
1219 /// * `request` - No description provided.
1220 /// * `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.
1221 pub fn locations_repositories_test_iam_permissions(
1222 &self,
1223 request: TestIamPermissionsRequest,
1224 resource: &str,
1225 ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
1226 ProjectLocationRepositoryTestIamPermissionCall {
1227 hub: self.hub,
1228 _request: request,
1229 _resource: resource.to_string(),
1230 _delegate: Default::default(),
1231 _additional_params: Default::default(),
1232 _scopes: Default::default(),
1233 }
1234 }
1235
1236 /// Create a builder to help you perform the following task:
1237 ///
1238 /// Gets information about a location.
1239 ///
1240 /// # Arguments
1241 ///
1242 /// * `name` - Resource name for the location.
1243 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
1244 ProjectLocationGetCall {
1245 hub: self.hub,
1246 _name: name.to_string(),
1247 _delegate: Default::default(),
1248 _additional_params: Default::default(),
1249 _scopes: Default::default(),
1250 }
1251 }
1252
1253 /// Create a builder to help you perform the following task:
1254 ///
1255 /// Lists information about the supported locations for this service.
1256 ///
1257 /// # Arguments
1258 ///
1259 /// * `name` - The resource that owns the locations collection, if applicable.
1260 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1261 ProjectLocationListCall {
1262 hub: self.hub,
1263 _name: name.to_string(),
1264 _page_token: Default::default(),
1265 _page_size: Default::default(),
1266 _filter: Default::default(),
1267 _extra_location_types: Default::default(),
1268 _delegate: Default::default(),
1269 _additional_params: Default::default(),
1270 _scopes: Default::default(),
1271 }
1272 }
1273}
1274
1275// ###################
1276// CallBuilders ###
1277// #################
1278
1279/// 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.
1280///
1281/// A builder for the *locations.operations.get* method supported by a *project* resource.
1282/// It is not used directly, but through a [`ProjectMethods`] instance.
1283///
1284/// # Example
1285///
1286/// Instantiate a resource method builder
1287///
1288/// ```test_harness,no_run
1289/// # extern crate hyper;
1290/// # extern crate hyper_rustls;
1291/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
1292/// # async fn dox() {
1293/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1294///
1295/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1296/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1297/// # .with_native_roots()
1298/// # .unwrap()
1299/// # .https_only()
1300/// # .enable_http2()
1301/// # .build();
1302///
1303/// # let executor = hyper_util::rt::TokioExecutor::new();
1304/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1305/// # secret,
1306/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1307/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1308/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1309/// # ),
1310/// # ).build().await.unwrap();
1311///
1312/// # let client = hyper_util::client::legacy::Client::builder(
1313/// # hyper_util::rt::TokioExecutor::new()
1314/// # )
1315/// # .build(
1316/// # hyper_rustls::HttpsConnectorBuilder::new()
1317/// # .with_native_roots()
1318/// # .unwrap()
1319/// # .https_or_http()
1320/// # .enable_http2()
1321/// # .build()
1322/// # );
1323/// # let mut hub = ArtifactRegistry::new(client, auth);
1324/// // You can configure optional parameters by calling the respective setters at will, and
1325/// // execute the final call using `doit()`.
1326/// // Values shown here are possibly random and not representative !
1327/// let result = hub.projects().locations_operations_get("name")
1328/// .doit().await;
1329/// # }
1330/// ```
1331pub struct ProjectLocationOperationGetCall<'a, C>
1332where
1333 C: 'a,
1334{
1335 hub: &'a ArtifactRegistry<C>,
1336 _name: String,
1337 _delegate: Option<&'a mut dyn common::Delegate>,
1338 _additional_params: HashMap<String, String>,
1339 _scopes: BTreeSet<String>,
1340}
1341
1342impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
1343
1344impl<'a, C> ProjectLocationOperationGetCall<'a, C>
1345where
1346 C: common::Connector,
1347{
1348 /// Perform the operation you have build so far.
1349 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1350 use std::borrow::Cow;
1351 use std::io::{Read, Seek};
1352
1353 use common::{url::Params, ToParts};
1354 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1355
1356 let mut dd = common::DefaultDelegate;
1357 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1358 dlg.begin(common::MethodInfo {
1359 id: "artifactregistry.projects.locations.operations.get",
1360 http_method: hyper::Method::GET,
1361 });
1362
1363 for &field in ["alt", "name"].iter() {
1364 if self._additional_params.contains_key(field) {
1365 dlg.finished(false);
1366 return Err(common::Error::FieldClash(field));
1367 }
1368 }
1369
1370 let mut params = Params::with_capacity(3 + self._additional_params.len());
1371 params.push("name", self._name);
1372
1373 params.extend(self._additional_params.iter());
1374
1375 params.push("alt", "json");
1376 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
1377 if self._scopes.is_empty() {
1378 self._scopes
1379 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1380 }
1381
1382 #[allow(clippy::single_element_loop)]
1383 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1384 url = params.uri_replacement(url, param_name, find_this, true);
1385 }
1386 {
1387 let to_remove = ["name"];
1388 params.remove_params(&to_remove);
1389 }
1390
1391 let url = params.parse_with_url(&url);
1392
1393 loop {
1394 let token = match self
1395 .hub
1396 .auth
1397 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1398 .await
1399 {
1400 Ok(token) => token,
1401 Err(e) => match dlg.token(e) {
1402 Ok(token) => token,
1403 Err(e) => {
1404 dlg.finished(false);
1405 return Err(common::Error::MissingToken(e));
1406 }
1407 },
1408 };
1409 let mut req_result = {
1410 let client = &self.hub.client;
1411 dlg.pre_request();
1412 let mut req_builder = hyper::Request::builder()
1413 .method(hyper::Method::GET)
1414 .uri(url.as_str())
1415 .header(USER_AGENT, self.hub._user_agent.clone());
1416
1417 if let Some(token) = token.as_ref() {
1418 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1419 }
1420
1421 let request = req_builder
1422 .header(CONTENT_LENGTH, 0_u64)
1423 .body(common::to_body::<String>(None));
1424
1425 client.request(request.unwrap()).await
1426 };
1427
1428 match req_result {
1429 Err(err) => {
1430 if let common::Retry::After(d) = dlg.http_error(&err) {
1431 sleep(d).await;
1432 continue;
1433 }
1434 dlg.finished(false);
1435 return Err(common::Error::HttpError(err));
1436 }
1437 Ok(res) => {
1438 let (mut parts, body) = res.into_parts();
1439 let mut body = common::Body::new(body);
1440 if !parts.status.is_success() {
1441 let bytes = common::to_bytes(body).await.unwrap_or_default();
1442 let error = serde_json::from_str(&common::to_string(&bytes));
1443 let response = common::to_response(parts, bytes.into());
1444
1445 if let common::Retry::After(d) =
1446 dlg.http_failure(&response, error.as_ref().ok())
1447 {
1448 sleep(d).await;
1449 continue;
1450 }
1451
1452 dlg.finished(false);
1453
1454 return Err(match error {
1455 Ok(value) => common::Error::BadRequest(value),
1456 _ => common::Error::Failure(response),
1457 });
1458 }
1459 let response = {
1460 let bytes = common::to_bytes(body).await.unwrap_or_default();
1461 let encoded = common::to_string(&bytes);
1462 match serde_json::from_str(&encoded) {
1463 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1464 Err(error) => {
1465 dlg.response_json_decode_error(&encoded, &error);
1466 return Err(common::Error::JsonDecodeError(
1467 encoded.to_string(),
1468 error,
1469 ));
1470 }
1471 }
1472 };
1473
1474 dlg.finished(true);
1475 return Ok(response);
1476 }
1477 }
1478 }
1479 }
1480
1481 /// The name of the operation resource.
1482 ///
1483 /// Sets the *name* path property to the given value.
1484 ///
1485 /// Even though the property as already been set when instantiating this call,
1486 /// we provide this method for API completeness.
1487 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
1488 self._name = new_value.to_string();
1489 self
1490 }
1491 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1492 /// while executing the actual API request.
1493 ///
1494 /// ````text
1495 /// It should be used to handle progress information, and to implement a certain level of resilience.
1496 /// ````
1497 ///
1498 /// Sets the *delegate* property to the given value.
1499 pub fn delegate(
1500 mut self,
1501 new_value: &'a mut dyn common::Delegate,
1502 ) -> ProjectLocationOperationGetCall<'a, C> {
1503 self._delegate = Some(new_value);
1504 self
1505 }
1506
1507 /// Set any additional parameter of the query string used in the request.
1508 /// It should be used to set parameters which are not yet available through their own
1509 /// setters.
1510 ///
1511 /// Please note that this method must not be used to set any of the known parameters
1512 /// which have their own setter method. If done anyway, the request will fail.
1513 ///
1514 /// # Additional Parameters
1515 ///
1516 /// * *$.xgafv* (query-string) - V1 error format.
1517 /// * *access_token* (query-string) - OAuth access token.
1518 /// * *alt* (query-string) - Data format for response.
1519 /// * *callback* (query-string) - JSONP
1520 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1521 /// * *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.
1522 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1523 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1524 /// * *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.
1525 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1526 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1527 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
1528 where
1529 T: AsRef<str>,
1530 {
1531 self._additional_params
1532 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1533 self
1534 }
1535
1536 /// Identifies the authorization scope for the method you are building.
1537 ///
1538 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1539 /// [`Scope::CloudPlatformReadOnly`].
1540 ///
1541 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1542 /// tokens for more than one scope.
1543 ///
1544 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1545 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1546 /// sufficient, a read-write scope will do as well.
1547 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
1548 where
1549 St: AsRef<str>,
1550 {
1551 self._scopes.insert(String::from(scope.as_ref()));
1552 self
1553 }
1554 /// Identifies the authorization scope(s) for the method you are building.
1555 ///
1556 /// See [`Self::add_scope()`] for details.
1557 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
1558 where
1559 I: IntoIterator<Item = St>,
1560 St: AsRef<str>,
1561 {
1562 self._scopes
1563 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1564 self
1565 }
1566
1567 /// Removes all scopes, and no default scope will be used either.
1568 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1569 /// for details).
1570 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
1571 self._scopes.clear();
1572 self
1573 }
1574}
1575
1576/// Gets a file.
1577///
1578/// A builder for the *locations.repositories.files.get* method supported by a *project* resource.
1579/// It is not used directly, but through a [`ProjectMethods`] instance.
1580///
1581/// # Example
1582///
1583/// Instantiate a resource method builder
1584///
1585/// ```test_harness,no_run
1586/// # extern crate hyper;
1587/// # extern crate hyper_rustls;
1588/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
1589/// # async fn dox() {
1590/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1591///
1592/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1593/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1594/// # .with_native_roots()
1595/// # .unwrap()
1596/// # .https_only()
1597/// # .enable_http2()
1598/// # .build();
1599///
1600/// # let executor = hyper_util::rt::TokioExecutor::new();
1601/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1602/// # secret,
1603/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1604/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1605/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1606/// # ),
1607/// # ).build().await.unwrap();
1608///
1609/// # let client = hyper_util::client::legacy::Client::builder(
1610/// # hyper_util::rt::TokioExecutor::new()
1611/// # )
1612/// # .build(
1613/// # hyper_rustls::HttpsConnectorBuilder::new()
1614/// # .with_native_roots()
1615/// # .unwrap()
1616/// # .https_or_http()
1617/// # .enable_http2()
1618/// # .build()
1619/// # );
1620/// # let mut hub = ArtifactRegistry::new(client, auth);
1621/// // You can configure optional parameters by calling the respective setters at will, and
1622/// // execute the final call using `doit()`.
1623/// // Values shown here are possibly random and not representative !
1624/// let result = hub.projects().locations_repositories_files_get("name")
1625/// .doit().await;
1626/// # }
1627/// ```
1628pub struct ProjectLocationRepositoryFileGetCall<'a, C>
1629where
1630 C: 'a,
1631{
1632 hub: &'a ArtifactRegistry<C>,
1633 _name: String,
1634 _delegate: Option<&'a mut dyn common::Delegate>,
1635 _additional_params: HashMap<String, String>,
1636 _scopes: BTreeSet<String>,
1637}
1638
1639impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFileGetCall<'a, C> {}
1640
1641impl<'a, C> ProjectLocationRepositoryFileGetCall<'a, C>
1642where
1643 C: common::Connector,
1644{
1645 /// Perform the operation you have build so far.
1646 pub async fn doit(mut self) -> common::Result<(common::Response, File)> {
1647 use std::borrow::Cow;
1648 use std::io::{Read, Seek};
1649
1650 use common::{url::Params, ToParts};
1651 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1652
1653 let mut dd = common::DefaultDelegate;
1654 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1655 dlg.begin(common::MethodInfo {
1656 id: "artifactregistry.projects.locations.repositories.files.get",
1657 http_method: hyper::Method::GET,
1658 });
1659
1660 for &field in ["alt", "name"].iter() {
1661 if self._additional_params.contains_key(field) {
1662 dlg.finished(false);
1663 return Err(common::Error::FieldClash(field));
1664 }
1665 }
1666
1667 let mut params = Params::with_capacity(3 + self._additional_params.len());
1668 params.push("name", self._name);
1669
1670 params.extend(self._additional_params.iter());
1671
1672 params.push("alt", "json");
1673 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
1674 if self._scopes.is_empty() {
1675 self._scopes
1676 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1677 }
1678
1679 #[allow(clippy::single_element_loop)]
1680 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1681 url = params.uri_replacement(url, param_name, find_this, true);
1682 }
1683 {
1684 let to_remove = ["name"];
1685 params.remove_params(&to_remove);
1686 }
1687
1688 let url = params.parse_with_url(&url);
1689
1690 loop {
1691 let token = match self
1692 .hub
1693 .auth
1694 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1695 .await
1696 {
1697 Ok(token) => token,
1698 Err(e) => match dlg.token(e) {
1699 Ok(token) => token,
1700 Err(e) => {
1701 dlg.finished(false);
1702 return Err(common::Error::MissingToken(e));
1703 }
1704 },
1705 };
1706 let mut req_result = {
1707 let client = &self.hub.client;
1708 dlg.pre_request();
1709 let mut req_builder = hyper::Request::builder()
1710 .method(hyper::Method::GET)
1711 .uri(url.as_str())
1712 .header(USER_AGENT, self.hub._user_agent.clone());
1713
1714 if let Some(token) = token.as_ref() {
1715 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1716 }
1717
1718 let request = req_builder
1719 .header(CONTENT_LENGTH, 0_u64)
1720 .body(common::to_body::<String>(None));
1721
1722 client.request(request.unwrap()).await
1723 };
1724
1725 match req_result {
1726 Err(err) => {
1727 if let common::Retry::After(d) = dlg.http_error(&err) {
1728 sleep(d).await;
1729 continue;
1730 }
1731 dlg.finished(false);
1732 return Err(common::Error::HttpError(err));
1733 }
1734 Ok(res) => {
1735 let (mut parts, body) = res.into_parts();
1736 let mut body = common::Body::new(body);
1737 if !parts.status.is_success() {
1738 let bytes = common::to_bytes(body).await.unwrap_or_default();
1739 let error = serde_json::from_str(&common::to_string(&bytes));
1740 let response = common::to_response(parts, bytes.into());
1741
1742 if let common::Retry::After(d) =
1743 dlg.http_failure(&response, error.as_ref().ok())
1744 {
1745 sleep(d).await;
1746 continue;
1747 }
1748
1749 dlg.finished(false);
1750
1751 return Err(match error {
1752 Ok(value) => common::Error::BadRequest(value),
1753 _ => common::Error::Failure(response),
1754 });
1755 }
1756 let response = {
1757 let bytes = common::to_bytes(body).await.unwrap_or_default();
1758 let encoded = common::to_string(&bytes);
1759 match serde_json::from_str(&encoded) {
1760 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1761 Err(error) => {
1762 dlg.response_json_decode_error(&encoded, &error);
1763 return Err(common::Error::JsonDecodeError(
1764 encoded.to_string(),
1765 error,
1766 ));
1767 }
1768 }
1769 };
1770
1771 dlg.finished(true);
1772 return Ok(response);
1773 }
1774 }
1775 }
1776 }
1777
1778 /// Required. The name of the file to retrieve.
1779 ///
1780 /// Sets the *name* path property to the given value.
1781 ///
1782 /// Even though the property as already been set when instantiating this call,
1783 /// we provide this method for API completeness.
1784 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryFileGetCall<'a, C> {
1785 self._name = new_value.to_string();
1786 self
1787 }
1788 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1789 /// while executing the actual API request.
1790 ///
1791 /// ````text
1792 /// It should be used to handle progress information, and to implement a certain level of resilience.
1793 /// ````
1794 ///
1795 /// Sets the *delegate* property to the given value.
1796 pub fn delegate(
1797 mut self,
1798 new_value: &'a mut dyn common::Delegate,
1799 ) -> ProjectLocationRepositoryFileGetCall<'a, C> {
1800 self._delegate = Some(new_value);
1801 self
1802 }
1803
1804 /// Set any additional parameter of the query string used in the request.
1805 /// It should be used to set parameters which are not yet available through their own
1806 /// setters.
1807 ///
1808 /// Please note that this method must not be used to set any of the known parameters
1809 /// which have their own setter method. If done anyway, the request will fail.
1810 ///
1811 /// # Additional Parameters
1812 ///
1813 /// * *$.xgafv* (query-string) - V1 error format.
1814 /// * *access_token* (query-string) - OAuth access token.
1815 /// * *alt* (query-string) - Data format for response.
1816 /// * *callback* (query-string) - JSONP
1817 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1818 /// * *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.
1819 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1820 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1821 /// * *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.
1822 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1823 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1824 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFileGetCall<'a, C>
1825 where
1826 T: AsRef<str>,
1827 {
1828 self._additional_params
1829 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1830 self
1831 }
1832
1833 /// Identifies the authorization scope for the method you are building.
1834 ///
1835 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1836 /// [`Scope::CloudPlatformReadOnly`].
1837 ///
1838 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1839 /// tokens for more than one scope.
1840 ///
1841 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1842 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1843 /// sufficient, a read-write scope will do as well.
1844 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFileGetCall<'a, C>
1845 where
1846 St: AsRef<str>,
1847 {
1848 self._scopes.insert(String::from(scope.as_ref()));
1849 self
1850 }
1851 /// Identifies the authorization scope(s) for the method you are building.
1852 ///
1853 /// See [`Self::add_scope()`] for details.
1854 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryFileGetCall<'a, C>
1855 where
1856 I: IntoIterator<Item = St>,
1857 St: AsRef<str>,
1858 {
1859 self._scopes
1860 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1861 self
1862 }
1863
1864 /// Removes all scopes, and no default scope will be used either.
1865 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1866 /// for details).
1867 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFileGetCall<'a, C> {
1868 self._scopes.clear();
1869 self
1870 }
1871}
1872
1873/// Lists files.
1874///
1875/// A builder for the *locations.repositories.files.list* method supported by a *project* resource.
1876/// It is not used directly, but through a [`ProjectMethods`] instance.
1877///
1878/// # Example
1879///
1880/// Instantiate a resource method builder
1881///
1882/// ```test_harness,no_run
1883/// # extern crate hyper;
1884/// # extern crate hyper_rustls;
1885/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
1886/// # async fn dox() {
1887/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1888///
1889/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1890/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1891/// # .with_native_roots()
1892/// # .unwrap()
1893/// # .https_only()
1894/// # .enable_http2()
1895/// # .build();
1896///
1897/// # let executor = hyper_util::rt::TokioExecutor::new();
1898/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1899/// # secret,
1900/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1901/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1902/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1903/// # ),
1904/// # ).build().await.unwrap();
1905///
1906/// # let client = hyper_util::client::legacy::Client::builder(
1907/// # hyper_util::rt::TokioExecutor::new()
1908/// # )
1909/// # .build(
1910/// # hyper_rustls::HttpsConnectorBuilder::new()
1911/// # .with_native_roots()
1912/// # .unwrap()
1913/// # .https_or_http()
1914/// # .enable_http2()
1915/// # .build()
1916/// # );
1917/// # let mut hub = ArtifactRegistry::new(client, auth);
1918/// // You can configure optional parameters by calling the respective setters at will, and
1919/// // execute the final call using `doit()`.
1920/// // Values shown here are possibly random and not representative !
1921/// let result = hub.projects().locations_repositories_files_list("parent")
1922/// .page_token("takimata")
1923/// .page_size(-52)
1924/// .filter("duo")
1925/// .doit().await;
1926/// # }
1927/// ```
1928pub struct ProjectLocationRepositoryFileListCall<'a, C>
1929where
1930 C: 'a,
1931{
1932 hub: &'a ArtifactRegistry<C>,
1933 _parent: String,
1934 _page_token: Option<String>,
1935 _page_size: Option<i32>,
1936 _filter: Option<String>,
1937 _delegate: Option<&'a mut dyn common::Delegate>,
1938 _additional_params: HashMap<String, String>,
1939 _scopes: BTreeSet<String>,
1940}
1941
1942impl<'a, C> common::CallBuilder for ProjectLocationRepositoryFileListCall<'a, C> {}
1943
1944impl<'a, C> ProjectLocationRepositoryFileListCall<'a, C>
1945where
1946 C: common::Connector,
1947{
1948 /// Perform the operation you have build so far.
1949 pub async fn doit(mut self) -> common::Result<(common::Response, ListFilesResponse)> {
1950 use std::borrow::Cow;
1951 use std::io::{Read, Seek};
1952
1953 use common::{url::Params, ToParts};
1954 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1955
1956 let mut dd = common::DefaultDelegate;
1957 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1958 dlg.begin(common::MethodInfo {
1959 id: "artifactregistry.projects.locations.repositories.files.list",
1960 http_method: hyper::Method::GET,
1961 });
1962
1963 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
1964 if self._additional_params.contains_key(field) {
1965 dlg.finished(false);
1966 return Err(common::Error::FieldClash(field));
1967 }
1968 }
1969
1970 let mut params = Params::with_capacity(6 + self._additional_params.len());
1971 params.push("parent", self._parent);
1972 if let Some(value) = self._page_token.as_ref() {
1973 params.push("pageToken", value);
1974 }
1975 if let Some(value) = self._page_size.as_ref() {
1976 params.push("pageSize", value.to_string());
1977 }
1978 if let Some(value) = self._filter.as_ref() {
1979 params.push("filter", value);
1980 }
1981
1982 params.extend(self._additional_params.iter());
1983
1984 params.push("alt", "json");
1985 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/files";
1986 if self._scopes.is_empty() {
1987 self._scopes
1988 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1989 }
1990
1991 #[allow(clippy::single_element_loop)]
1992 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1993 url = params.uri_replacement(url, param_name, find_this, true);
1994 }
1995 {
1996 let to_remove = ["parent"];
1997 params.remove_params(&to_remove);
1998 }
1999
2000 let url = params.parse_with_url(&url);
2001
2002 loop {
2003 let token = match self
2004 .hub
2005 .auth
2006 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2007 .await
2008 {
2009 Ok(token) => token,
2010 Err(e) => match dlg.token(e) {
2011 Ok(token) => token,
2012 Err(e) => {
2013 dlg.finished(false);
2014 return Err(common::Error::MissingToken(e));
2015 }
2016 },
2017 };
2018 let mut req_result = {
2019 let client = &self.hub.client;
2020 dlg.pre_request();
2021 let mut req_builder = hyper::Request::builder()
2022 .method(hyper::Method::GET)
2023 .uri(url.as_str())
2024 .header(USER_AGENT, self.hub._user_agent.clone());
2025
2026 if let Some(token) = token.as_ref() {
2027 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2028 }
2029
2030 let request = req_builder
2031 .header(CONTENT_LENGTH, 0_u64)
2032 .body(common::to_body::<String>(None));
2033
2034 client.request(request.unwrap()).await
2035 };
2036
2037 match req_result {
2038 Err(err) => {
2039 if let common::Retry::After(d) = dlg.http_error(&err) {
2040 sleep(d).await;
2041 continue;
2042 }
2043 dlg.finished(false);
2044 return Err(common::Error::HttpError(err));
2045 }
2046 Ok(res) => {
2047 let (mut parts, body) = res.into_parts();
2048 let mut body = common::Body::new(body);
2049 if !parts.status.is_success() {
2050 let bytes = common::to_bytes(body).await.unwrap_or_default();
2051 let error = serde_json::from_str(&common::to_string(&bytes));
2052 let response = common::to_response(parts, bytes.into());
2053
2054 if let common::Retry::After(d) =
2055 dlg.http_failure(&response, error.as_ref().ok())
2056 {
2057 sleep(d).await;
2058 continue;
2059 }
2060
2061 dlg.finished(false);
2062
2063 return Err(match error {
2064 Ok(value) => common::Error::BadRequest(value),
2065 _ => common::Error::Failure(response),
2066 });
2067 }
2068 let response = {
2069 let bytes = common::to_bytes(body).await.unwrap_or_default();
2070 let encoded = common::to_string(&bytes);
2071 match serde_json::from_str(&encoded) {
2072 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2073 Err(error) => {
2074 dlg.response_json_decode_error(&encoded, &error);
2075 return Err(common::Error::JsonDecodeError(
2076 encoded.to_string(),
2077 error,
2078 ));
2079 }
2080 }
2081 };
2082
2083 dlg.finished(true);
2084 return Ok(response);
2085 }
2086 }
2087 }
2088 }
2089
2090 /// Required. The name of the repository whose files will be listed. For example: "projects/p1/locations/us-central1/repositories/repo1
2091 ///
2092 /// Sets the *parent* path property to the given value.
2093 ///
2094 /// Even though the property as already been set when instantiating this call,
2095 /// we provide this method for API completeness.
2096 pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryFileListCall<'a, C> {
2097 self._parent = new_value.to_string();
2098 self
2099 }
2100 /// The next_page_token value returned from a previous list request, if any.
2101 ///
2102 /// Sets the *page token* query property to the given value.
2103 pub fn page_token(mut self, new_value: &str) -> ProjectLocationRepositoryFileListCall<'a, C> {
2104 self._page_token = Some(new_value.to_string());
2105 self
2106 }
2107 /// The maximum number of files to return. Maximum page size is 1,000.
2108 ///
2109 /// Sets the *page size* query property to the given value.
2110 pub fn page_size(mut self, new_value: i32) -> ProjectLocationRepositoryFileListCall<'a, C> {
2111 self._page_size = Some(new_value);
2112 self
2113 }
2114 /// 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*`" ``
2115 ///
2116 /// Sets the *filter* query property to the given value.
2117 pub fn filter(mut self, new_value: &str) -> ProjectLocationRepositoryFileListCall<'a, C> {
2118 self._filter = Some(new_value.to_string());
2119 self
2120 }
2121 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2122 /// while executing the actual API request.
2123 ///
2124 /// ````text
2125 /// It should be used to handle progress information, and to implement a certain level of resilience.
2126 /// ````
2127 ///
2128 /// Sets the *delegate* property to the given value.
2129 pub fn delegate(
2130 mut self,
2131 new_value: &'a mut dyn common::Delegate,
2132 ) -> ProjectLocationRepositoryFileListCall<'a, C> {
2133 self._delegate = Some(new_value);
2134 self
2135 }
2136
2137 /// Set any additional parameter of the query string used in the request.
2138 /// It should be used to set parameters which are not yet available through their own
2139 /// setters.
2140 ///
2141 /// Please note that this method must not be used to set any of the known parameters
2142 /// which have their own setter method. If done anyway, the request will fail.
2143 ///
2144 /// # Additional Parameters
2145 ///
2146 /// * *$.xgafv* (query-string) - V1 error format.
2147 /// * *access_token* (query-string) - OAuth access token.
2148 /// * *alt* (query-string) - Data format for response.
2149 /// * *callback* (query-string) - JSONP
2150 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2151 /// * *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.
2152 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2153 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2154 /// * *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.
2155 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2156 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2157 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryFileListCall<'a, C>
2158 where
2159 T: AsRef<str>,
2160 {
2161 self._additional_params
2162 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2163 self
2164 }
2165
2166 /// Identifies the authorization scope for the method you are building.
2167 ///
2168 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2169 /// [`Scope::CloudPlatformReadOnly`].
2170 ///
2171 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2172 /// tokens for more than one scope.
2173 ///
2174 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2175 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2176 /// sufficient, a read-write scope will do as well.
2177 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryFileListCall<'a, C>
2178 where
2179 St: AsRef<str>,
2180 {
2181 self._scopes.insert(String::from(scope.as_ref()));
2182 self
2183 }
2184 /// Identifies the authorization scope(s) for the method you are building.
2185 ///
2186 /// See [`Self::add_scope()`] for details.
2187 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryFileListCall<'a, C>
2188 where
2189 I: IntoIterator<Item = St>,
2190 St: AsRef<str>,
2191 {
2192 self._scopes
2193 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2194 self
2195 }
2196
2197 /// Removes all scopes, and no default scope will be used either.
2198 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2199 /// for details).
2200 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryFileListCall<'a, C> {
2201 self._scopes.clear();
2202 self
2203 }
2204}
2205
2206/// Creates a tag.
2207///
2208/// A builder for the *locations.repositories.packages.tags.create* method supported by a *project* resource.
2209/// It is not used directly, but through a [`ProjectMethods`] instance.
2210///
2211/// # Example
2212///
2213/// Instantiate a resource method builder
2214///
2215/// ```test_harness,no_run
2216/// # extern crate hyper;
2217/// # extern crate hyper_rustls;
2218/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
2219/// use artifactregistry1_beta1::api::Tag;
2220/// # async fn dox() {
2221/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2222///
2223/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2224/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2225/// # .with_native_roots()
2226/// # .unwrap()
2227/// # .https_only()
2228/// # .enable_http2()
2229/// # .build();
2230///
2231/// # let executor = hyper_util::rt::TokioExecutor::new();
2232/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2233/// # secret,
2234/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2235/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2236/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2237/// # ),
2238/// # ).build().await.unwrap();
2239///
2240/// # let client = hyper_util::client::legacy::Client::builder(
2241/// # hyper_util::rt::TokioExecutor::new()
2242/// # )
2243/// # .build(
2244/// # hyper_rustls::HttpsConnectorBuilder::new()
2245/// # .with_native_roots()
2246/// # .unwrap()
2247/// # .https_or_http()
2248/// # .enable_http2()
2249/// # .build()
2250/// # );
2251/// # let mut hub = ArtifactRegistry::new(client, auth);
2252/// // As the method needs a request, you would usually fill it with the desired information
2253/// // into the respective structure. Some of the parts shown here might not be applicable !
2254/// // Values shown here are possibly random and not representative !
2255/// let mut req = Tag::default();
2256///
2257/// // You can configure optional parameters by calling the respective setters at will, and
2258/// // execute the final call using `doit()`.
2259/// // Values shown here are possibly random and not representative !
2260/// let result = hub.projects().locations_repositories_packages_tags_create(req, "parent")
2261/// .tag_id("gubergren")
2262/// .doit().await;
2263/// # }
2264/// ```
2265pub struct ProjectLocationRepositoryPackageTagCreateCall<'a, C>
2266where
2267 C: 'a,
2268{
2269 hub: &'a ArtifactRegistry<C>,
2270 _request: Tag,
2271 _parent: String,
2272 _tag_id: Option<String>,
2273 _delegate: Option<&'a mut dyn common::Delegate>,
2274 _additional_params: HashMap<String, String>,
2275 _scopes: BTreeSet<String>,
2276}
2277
2278impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagCreateCall<'a, C> {}
2279
2280impl<'a, C> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
2281where
2282 C: common::Connector,
2283{
2284 /// Perform the operation you have build so far.
2285 pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
2286 use std::borrow::Cow;
2287 use std::io::{Read, Seek};
2288
2289 use common::{url::Params, ToParts};
2290 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2291
2292 let mut dd = common::DefaultDelegate;
2293 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2294 dlg.begin(common::MethodInfo {
2295 id: "artifactregistry.projects.locations.repositories.packages.tags.create",
2296 http_method: hyper::Method::POST,
2297 });
2298
2299 for &field in ["alt", "parent", "tagId"].iter() {
2300 if self._additional_params.contains_key(field) {
2301 dlg.finished(false);
2302 return Err(common::Error::FieldClash(field));
2303 }
2304 }
2305
2306 let mut params = Params::with_capacity(5 + self._additional_params.len());
2307 params.push("parent", self._parent);
2308 if let Some(value) = self._tag_id.as_ref() {
2309 params.push("tagId", value);
2310 }
2311
2312 params.extend(self._additional_params.iter());
2313
2314 params.push("alt", "json");
2315 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/tags";
2316 if self._scopes.is_empty() {
2317 self._scopes
2318 .insert(Scope::CloudPlatform.as_ref().to_string());
2319 }
2320
2321 #[allow(clippy::single_element_loop)]
2322 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2323 url = params.uri_replacement(url, param_name, find_this, true);
2324 }
2325 {
2326 let to_remove = ["parent"];
2327 params.remove_params(&to_remove);
2328 }
2329
2330 let url = params.parse_with_url(&url);
2331
2332 let mut json_mime_type = mime::APPLICATION_JSON;
2333 let mut request_value_reader = {
2334 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2335 common::remove_json_null_values(&mut value);
2336 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2337 serde_json::to_writer(&mut dst, &value).unwrap();
2338 dst
2339 };
2340 let request_size = request_value_reader
2341 .seek(std::io::SeekFrom::End(0))
2342 .unwrap();
2343 request_value_reader
2344 .seek(std::io::SeekFrom::Start(0))
2345 .unwrap();
2346
2347 loop {
2348 let token = match self
2349 .hub
2350 .auth
2351 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2352 .await
2353 {
2354 Ok(token) => token,
2355 Err(e) => match dlg.token(e) {
2356 Ok(token) => token,
2357 Err(e) => {
2358 dlg.finished(false);
2359 return Err(common::Error::MissingToken(e));
2360 }
2361 },
2362 };
2363 request_value_reader
2364 .seek(std::io::SeekFrom::Start(0))
2365 .unwrap();
2366 let mut req_result = {
2367 let client = &self.hub.client;
2368 dlg.pre_request();
2369 let mut req_builder = hyper::Request::builder()
2370 .method(hyper::Method::POST)
2371 .uri(url.as_str())
2372 .header(USER_AGENT, self.hub._user_agent.clone());
2373
2374 if let Some(token) = token.as_ref() {
2375 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2376 }
2377
2378 let request = req_builder
2379 .header(CONTENT_TYPE, json_mime_type.to_string())
2380 .header(CONTENT_LENGTH, request_size as u64)
2381 .body(common::to_body(
2382 request_value_reader.get_ref().clone().into(),
2383 ));
2384
2385 client.request(request.unwrap()).await
2386 };
2387
2388 match req_result {
2389 Err(err) => {
2390 if let common::Retry::After(d) = dlg.http_error(&err) {
2391 sleep(d).await;
2392 continue;
2393 }
2394 dlg.finished(false);
2395 return Err(common::Error::HttpError(err));
2396 }
2397 Ok(res) => {
2398 let (mut parts, body) = res.into_parts();
2399 let mut body = common::Body::new(body);
2400 if !parts.status.is_success() {
2401 let bytes = common::to_bytes(body).await.unwrap_or_default();
2402 let error = serde_json::from_str(&common::to_string(&bytes));
2403 let response = common::to_response(parts, bytes.into());
2404
2405 if let common::Retry::After(d) =
2406 dlg.http_failure(&response, error.as_ref().ok())
2407 {
2408 sleep(d).await;
2409 continue;
2410 }
2411
2412 dlg.finished(false);
2413
2414 return Err(match error {
2415 Ok(value) => common::Error::BadRequest(value),
2416 _ => common::Error::Failure(response),
2417 });
2418 }
2419 let response = {
2420 let bytes = common::to_bytes(body).await.unwrap_or_default();
2421 let encoded = common::to_string(&bytes);
2422 match serde_json::from_str(&encoded) {
2423 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2424 Err(error) => {
2425 dlg.response_json_decode_error(&encoded, &error);
2426 return Err(common::Error::JsonDecodeError(
2427 encoded.to_string(),
2428 error,
2429 ));
2430 }
2431 }
2432 };
2433
2434 dlg.finished(true);
2435 return Ok(response);
2436 }
2437 }
2438 }
2439 }
2440
2441 ///
2442 /// Sets the *request* property to the given value.
2443 ///
2444 /// Even though the property as already been set when instantiating this call,
2445 /// we provide this method for API completeness.
2446 pub fn request(
2447 mut self,
2448 new_value: Tag,
2449 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
2450 self._request = new_value;
2451 self
2452 }
2453 /// The name of the parent resource where the tag will be created.
2454 ///
2455 /// Sets the *parent* path property to the given value.
2456 ///
2457 /// Even though the property as already been set when instantiating this call,
2458 /// we provide this method for API completeness.
2459 pub fn parent(
2460 mut self,
2461 new_value: &str,
2462 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
2463 self._parent = new_value.to_string();
2464 self
2465 }
2466 /// The tag id to use for this repository.
2467 ///
2468 /// Sets the *tag id* query property to the given value.
2469 pub fn tag_id(
2470 mut self,
2471 new_value: &str,
2472 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
2473 self._tag_id = Some(new_value.to_string());
2474 self
2475 }
2476 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2477 /// while executing the actual API request.
2478 ///
2479 /// ````text
2480 /// It should be used to handle progress information, and to implement a certain level of resilience.
2481 /// ````
2482 ///
2483 /// Sets the *delegate* property to the given value.
2484 pub fn delegate(
2485 mut self,
2486 new_value: &'a mut dyn common::Delegate,
2487 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
2488 self._delegate = Some(new_value);
2489 self
2490 }
2491
2492 /// Set any additional parameter of the query string used in the request.
2493 /// It should be used to set parameters which are not yet available through their own
2494 /// setters.
2495 ///
2496 /// Please note that this method must not be used to set any of the known parameters
2497 /// which have their own setter method. If done anyway, the request will fail.
2498 ///
2499 /// # Additional Parameters
2500 ///
2501 /// * *$.xgafv* (query-string) - V1 error format.
2502 /// * *access_token* (query-string) - OAuth access token.
2503 /// * *alt* (query-string) - Data format for response.
2504 /// * *callback* (query-string) - JSONP
2505 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2506 /// * *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.
2507 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2508 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2509 /// * *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.
2510 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2511 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2512 pub fn param<T>(
2513 mut self,
2514 name: T,
2515 value: T,
2516 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
2517 where
2518 T: AsRef<str>,
2519 {
2520 self._additional_params
2521 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2522 self
2523 }
2524
2525 /// Identifies the authorization scope for the method you are building.
2526 ///
2527 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2528 /// [`Scope::CloudPlatform`].
2529 ///
2530 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2531 /// tokens for more than one scope.
2532 ///
2533 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2534 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2535 /// sufficient, a read-write scope will do as well.
2536 pub fn add_scope<St>(
2537 mut self,
2538 scope: St,
2539 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
2540 where
2541 St: AsRef<str>,
2542 {
2543 self._scopes.insert(String::from(scope.as_ref()));
2544 self
2545 }
2546 /// Identifies the authorization scope(s) for the method you are building.
2547 ///
2548 /// See [`Self::add_scope()`] for details.
2549 pub fn add_scopes<I, St>(
2550 mut self,
2551 scopes: I,
2552 ) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C>
2553 where
2554 I: IntoIterator<Item = St>,
2555 St: AsRef<str>,
2556 {
2557 self._scopes
2558 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2559 self
2560 }
2561
2562 /// Removes all scopes, and no default scope will be used either.
2563 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2564 /// for details).
2565 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagCreateCall<'a, C> {
2566 self._scopes.clear();
2567 self
2568 }
2569}
2570
2571/// Deletes a tag.
2572///
2573/// A builder for the *locations.repositories.packages.tags.delete* method supported by a *project* resource.
2574/// It is not used directly, but through a [`ProjectMethods`] instance.
2575///
2576/// # Example
2577///
2578/// Instantiate a resource method builder
2579///
2580/// ```test_harness,no_run
2581/// # extern crate hyper;
2582/// # extern crate hyper_rustls;
2583/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
2584/// # async fn dox() {
2585/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2586///
2587/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2588/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2589/// # .with_native_roots()
2590/// # .unwrap()
2591/// # .https_only()
2592/// # .enable_http2()
2593/// # .build();
2594///
2595/// # let executor = hyper_util::rt::TokioExecutor::new();
2596/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2597/// # secret,
2598/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2599/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2600/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2601/// # ),
2602/// # ).build().await.unwrap();
2603///
2604/// # let client = hyper_util::client::legacy::Client::builder(
2605/// # hyper_util::rt::TokioExecutor::new()
2606/// # )
2607/// # .build(
2608/// # hyper_rustls::HttpsConnectorBuilder::new()
2609/// # .with_native_roots()
2610/// # .unwrap()
2611/// # .https_or_http()
2612/// # .enable_http2()
2613/// # .build()
2614/// # );
2615/// # let mut hub = ArtifactRegistry::new(client, auth);
2616/// // You can configure optional parameters by calling the respective setters at will, and
2617/// // execute the final call using `doit()`.
2618/// // Values shown here are possibly random and not representative !
2619/// let result = hub.projects().locations_repositories_packages_tags_delete("name")
2620/// .doit().await;
2621/// # }
2622/// ```
2623pub struct ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
2624where
2625 C: 'a,
2626{
2627 hub: &'a ArtifactRegistry<C>,
2628 _name: String,
2629 _delegate: Option<&'a mut dyn common::Delegate>,
2630 _additional_params: HashMap<String, String>,
2631 _scopes: BTreeSet<String>,
2632}
2633
2634impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {}
2635
2636impl<'a, C> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
2637where
2638 C: common::Connector,
2639{
2640 /// Perform the operation you have build so far.
2641 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2642 use std::borrow::Cow;
2643 use std::io::{Read, Seek};
2644
2645 use common::{url::Params, ToParts};
2646 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2647
2648 let mut dd = common::DefaultDelegate;
2649 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2650 dlg.begin(common::MethodInfo {
2651 id: "artifactregistry.projects.locations.repositories.packages.tags.delete",
2652 http_method: hyper::Method::DELETE,
2653 });
2654
2655 for &field in ["alt", "name"].iter() {
2656 if self._additional_params.contains_key(field) {
2657 dlg.finished(false);
2658 return Err(common::Error::FieldClash(field));
2659 }
2660 }
2661
2662 let mut params = Params::with_capacity(3 + self._additional_params.len());
2663 params.push("name", self._name);
2664
2665 params.extend(self._additional_params.iter());
2666
2667 params.push("alt", "json");
2668 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2669 if self._scopes.is_empty() {
2670 self._scopes
2671 .insert(Scope::CloudPlatform.as_ref().to_string());
2672 }
2673
2674 #[allow(clippy::single_element_loop)]
2675 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2676 url = params.uri_replacement(url, param_name, find_this, true);
2677 }
2678 {
2679 let to_remove = ["name"];
2680 params.remove_params(&to_remove);
2681 }
2682
2683 let url = params.parse_with_url(&url);
2684
2685 loop {
2686 let token = match self
2687 .hub
2688 .auth
2689 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2690 .await
2691 {
2692 Ok(token) => token,
2693 Err(e) => match dlg.token(e) {
2694 Ok(token) => token,
2695 Err(e) => {
2696 dlg.finished(false);
2697 return Err(common::Error::MissingToken(e));
2698 }
2699 },
2700 };
2701 let mut req_result = {
2702 let client = &self.hub.client;
2703 dlg.pre_request();
2704 let mut req_builder = hyper::Request::builder()
2705 .method(hyper::Method::DELETE)
2706 .uri(url.as_str())
2707 .header(USER_AGENT, self.hub._user_agent.clone());
2708
2709 if let Some(token) = token.as_ref() {
2710 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2711 }
2712
2713 let request = req_builder
2714 .header(CONTENT_LENGTH, 0_u64)
2715 .body(common::to_body::<String>(None));
2716
2717 client.request(request.unwrap()).await
2718 };
2719
2720 match req_result {
2721 Err(err) => {
2722 if let common::Retry::After(d) = dlg.http_error(&err) {
2723 sleep(d).await;
2724 continue;
2725 }
2726 dlg.finished(false);
2727 return Err(common::Error::HttpError(err));
2728 }
2729 Ok(res) => {
2730 let (mut parts, body) = res.into_parts();
2731 let mut body = common::Body::new(body);
2732 if !parts.status.is_success() {
2733 let bytes = common::to_bytes(body).await.unwrap_or_default();
2734 let error = serde_json::from_str(&common::to_string(&bytes));
2735 let response = common::to_response(parts, bytes.into());
2736
2737 if let common::Retry::After(d) =
2738 dlg.http_failure(&response, error.as_ref().ok())
2739 {
2740 sleep(d).await;
2741 continue;
2742 }
2743
2744 dlg.finished(false);
2745
2746 return Err(match error {
2747 Ok(value) => common::Error::BadRequest(value),
2748 _ => common::Error::Failure(response),
2749 });
2750 }
2751 let response = {
2752 let bytes = common::to_bytes(body).await.unwrap_or_default();
2753 let encoded = common::to_string(&bytes);
2754 match serde_json::from_str(&encoded) {
2755 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2756 Err(error) => {
2757 dlg.response_json_decode_error(&encoded, &error);
2758 return Err(common::Error::JsonDecodeError(
2759 encoded.to_string(),
2760 error,
2761 ));
2762 }
2763 }
2764 };
2765
2766 dlg.finished(true);
2767 return Ok(response);
2768 }
2769 }
2770 }
2771 }
2772
2773 /// The name of the tag to delete.
2774 ///
2775 /// Sets the *name* path property to the given value.
2776 ///
2777 /// Even though the property as already been set when instantiating this call,
2778 /// we provide this method for API completeness.
2779 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
2780 self._name = new_value.to_string();
2781 self
2782 }
2783 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2784 /// while executing the actual API request.
2785 ///
2786 /// ````text
2787 /// It should be used to handle progress information, and to implement a certain level of resilience.
2788 /// ````
2789 ///
2790 /// Sets the *delegate* property to the given value.
2791 pub fn delegate(
2792 mut self,
2793 new_value: &'a mut dyn common::Delegate,
2794 ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
2795 self._delegate = Some(new_value);
2796 self
2797 }
2798
2799 /// Set any additional parameter of the query string used in the request.
2800 /// It should be used to set parameters which are not yet available through their own
2801 /// setters.
2802 ///
2803 /// Please note that this method must not be used to set any of the known parameters
2804 /// which have their own setter method. If done anyway, the request will fail.
2805 ///
2806 /// # Additional Parameters
2807 ///
2808 /// * *$.xgafv* (query-string) - V1 error format.
2809 /// * *access_token* (query-string) - OAuth access token.
2810 /// * *alt* (query-string) - Data format for response.
2811 /// * *callback* (query-string) - JSONP
2812 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2813 /// * *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.
2814 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2815 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2816 /// * *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.
2817 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2818 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2819 pub fn param<T>(
2820 mut self,
2821 name: T,
2822 value: T,
2823 ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
2824 where
2825 T: AsRef<str>,
2826 {
2827 self._additional_params
2828 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2829 self
2830 }
2831
2832 /// Identifies the authorization scope for the method you are building.
2833 ///
2834 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2835 /// [`Scope::CloudPlatform`].
2836 ///
2837 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2838 /// tokens for more than one scope.
2839 ///
2840 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2841 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2842 /// sufficient, a read-write scope will do as well.
2843 pub fn add_scope<St>(
2844 mut self,
2845 scope: St,
2846 ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
2847 where
2848 St: AsRef<str>,
2849 {
2850 self._scopes.insert(String::from(scope.as_ref()));
2851 self
2852 }
2853 /// Identifies the authorization scope(s) for the method you are building.
2854 ///
2855 /// See [`Self::add_scope()`] for details.
2856 pub fn add_scopes<I, St>(
2857 mut self,
2858 scopes: I,
2859 ) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C>
2860 where
2861 I: IntoIterator<Item = St>,
2862 St: AsRef<str>,
2863 {
2864 self._scopes
2865 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2866 self
2867 }
2868
2869 /// Removes all scopes, and no default scope will be used either.
2870 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2871 /// for details).
2872 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagDeleteCall<'a, C> {
2873 self._scopes.clear();
2874 self
2875 }
2876}
2877
2878/// Gets a tag.
2879///
2880/// A builder for the *locations.repositories.packages.tags.get* method supported by a *project* resource.
2881/// It is not used directly, but through a [`ProjectMethods`] instance.
2882///
2883/// # Example
2884///
2885/// Instantiate a resource method builder
2886///
2887/// ```test_harness,no_run
2888/// # extern crate hyper;
2889/// # extern crate hyper_rustls;
2890/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
2891/// # async fn dox() {
2892/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2893///
2894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2895/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2896/// # .with_native_roots()
2897/// # .unwrap()
2898/// # .https_only()
2899/// # .enable_http2()
2900/// # .build();
2901///
2902/// # let executor = hyper_util::rt::TokioExecutor::new();
2903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2904/// # secret,
2905/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2906/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2907/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2908/// # ),
2909/// # ).build().await.unwrap();
2910///
2911/// # let client = hyper_util::client::legacy::Client::builder(
2912/// # hyper_util::rt::TokioExecutor::new()
2913/// # )
2914/// # .build(
2915/// # hyper_rustls::HttpsConnectorBuilder::new()
2916/// # .with_native_roots()
2917/// # .unwrap()
2918/// # .https_or_http()
2919/// # .enable_http2()
2920/// # .build()
2921/// # );
2922/// # let mut hub = ArtifactRegistry::new(client, auth);
2923/// // You can configure optional parameters by calling the respective setters at will, and
2924/// // execute the final call using `doit()`.
2925/// // Values shown here are possibly random and not representative !
2926/// let result = hub.projects().locations_repositories_packages_tags_get("name")
2927/// .doit().await;
2928/// # }
2929/// ```
2930pub struct ProjectLocationRepositoryPackageTagGetCall<'a, C>
2931where
2932 C: 'a,
2933{
2934 hub: &'a ArtifactRegistry<C>,
2935 _name: String,
2936 _delegate: Option<&'a mut dyn common::Delegate>,
2937 _additional_params: HashMap<String, String>,
2938 _scopes: BTreeSet<String>,
2939}
2940
2941impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagGetCall<'a, C> {}
2942
2943impl<'a, C> ProjectLocationRepositoryPackageTagGetCall<'a, C>
2944where
2945 C: common::Connector,
2946{
2947 /// Perform the operation you have build so far.
2948 pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
2949 use std::borrow::Cow;
2950 use std::io::{Read, Seek};
2951
2952 use common::{url::Params, ToParts};
2953 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2954
2955 let mut dd = common::DefaultDelegate;
2956 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2957 dlg.begin(common::MethodInfo {
2958 id: "artifactregistry.projects.locations.repositories.packages.tags.get",
2959 http_method: hyper::Method::GET,
2960 });
2961
2962 for &field in ["alt", "name"].iter() {
2963 if self._additional_params.contains_key(field) {
2964 dlg.finished(false);
2965 return Err(common::Error::FieldClash(field));
2966 }
2967 }
2968
2969 let mut params = Params::with_capacity(3 + self._additional_params.len());
2970 params.push("name", self._name);
2971
2972 params.extend(self._additional_params.iter());
2973
2974 params.push("alt", "json");
2975 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2976 if self._scopes.is_empty() {
2977 self._scopes
2978 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
2979 }
2980
2981 #[allow(clippy::single_element_loop)]
2982 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2983 url = params.uri_replacement(url, param_name, find_this, true);
2984 }
2985 {
2986 let to_remove = ["name"];
2987 params.remove_params(&to_remove);
2988 }
2989
2990 let url = params.parse_with_url(&url);
2991
2992 loop {
2993 let token = match self
2994 .hub
2995 .auth
2996 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2997 .await
2998 {
2999 Ok(token) => token,
3000 Err(e) => match dlg.token(e) {
3001 Ok(token) => token,
3002 Err(e) => {
3003 dlg.finished(false);
3004 return Err(common::Error::MissingToken(e));
3005 }
3006 },
3007 };
3008 let mut req_result = {
3009 let client = &self.hub.client;
3010 dlg.pre_request();
3011 let mut req_builder = hyper::Request::builder()
3012 .method(hyper::Method::GET)
3013 .uri(url.as_str())
3014 .header(USER_AGENT, self.hub._user_agent.clone());
3015
3016 if let Some(token) = token.as_ref() {
3017 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3018 }
3019
3020 let request = req_builder
3021 .header(CONTENT_LENGTH, 0_u64)
3022 .body(common::to_body::<String>(None));
3023
3024 client.request(request.unwrap()).await
3025 };
3026
3027 match req_result {
3028 Err(err) => {
3029 if let common::Retry::After(d) = dlg.http_error(&err) {
3030 sleep(d).await;
3031 continue;
3032 }
3033 dlg.finished(false);
3034 return Err(common::Error::HttpError(err));
3035 }
3036 Ok(res) => {
3037 let (mut parts, body) = res.into_parts();
3038 let mut body = common::Body::new(body);
3039 if !parts.status.is_success() {
3040 let bytes = common::to_bytes(body).await.unwrap_or_default();
3041 let error = serde_json::from_str(&common::to_string(&bytes));
3042 let response = common::to_response(parts, bytes.into());
3043
3044 if let common::Retry::After(d) =
3045 dlg.http_failure(&response, error.as_ref().ok())
3046 {
3047 sleep(d).await;
3048 continue;
3049 }
3050
3051 dlg.finished(false);
3052
3053 return Err(match error {
3054 Ok(value) => common::Error::BadRequest(value),
3055 _ => common::Error::Failure(response),
3056 });
3057 }
3058 let response = {
3059 let bytes = common::to_bytes(body).await.unwrap_or_default();
3060 let encoded = common::to_string(&bytes);
3061 match serde_json::from_str(&encoded) {
3062 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3063 Err(error) => {
3064 dlg.response_json_decode_error(&encoded, &error);
3065 return Err(common::Error::JsonDecodeError(
3066 encoded.to_string(),
3067 error,
3068 ));
3069 }
3070 }
3071 };
3072
3073 dlg.finished(true);
3074 return Ok(response);
3075 }
3076 }
3077 }
3078 }
3079
3080 /// The name of the tag to retrieve.
3081 ///
3082 /// Sets the *name* path property to the given value.
3083 ///
3084 /// Even though the property as already been set when instantiating this call,
3085 /// we provide this method for API completeness.
3086 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
3087 self._name = new_value.to_string();
3088 self
3089 }
3090 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3091 /// while executing the actual API request.
3092 ///
3093 /// ````text
3094 /// It should be used to handle progress information, and to implement a certain level of resilience.
3095 /// ````
3096 ///
3097 /// Sets the *delegate* property to the given value.
3098 pub fn delegate(
3099 mut self,
3100 new_value: &'a mut dyn common::Delegate,
3101 ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
3102 self._delegate = Some(new_value);
3103 self
3104 }
3105
3106 /// Set any additional parameter of the query string used in the request.
3107 /// It should be used to set parameters which are not yet available through their own
3108 /// setters.
3109 ///
3110 /// Please note that this method must not be used to set any of the known parameters
3111 /// which have their own setter method. If done anyway, the request will fail.
3112 ///
3113 /// # Additional Parameters
3114 ///
3115 /// * *$.xgafv* (query-string) - V1 error format.
3116 /// * *access_token* (query-string) - OAuth access token.
3117 /// * *alt* (query-string) - Data format for response.
3118 /// * *callback* (query-string) - JSONP
3119 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3120 /// * *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.
3121 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3122 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3123 /// * *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.
3124 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3125 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3126 pub fn param<T>(
3127 mut self,
3128 name: T,
3129 value: T,
3130 ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C>
3131 where
3132 T: AsRef<str>,
3133 {
3134 self._additional_params
3135 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3136 self
3137 }
3138
3139 /// Identifies the authorization scope for the method you are building.
3140 ///
3141 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3142 /// [`Scope::CloudPlatformReadOnly`].
3143 ///
3144 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3145 /// tokens for more than one scope.
3146 ///
3147 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3148 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3149 /// sufficient, a read-write scope will do as well.
3150 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageTagGetCall<'a, C>
3151 where
3152 St: AsRef<str>,
3153 {
3154 self._scopes.insert(String::from(scope.as_ref()));
3155 self
3156 }
3157 /// Identifies the authorization scope(s) for the method you are building.
3158 ///
3159 /// See [`Self::add_scope()`] for details.
3160 pub fn add_scopes<I, St>(
3161 mut self,
3162 scopes: I,
3163 ) -> ProjectLocationRepositoryPackageTagGetCall<'a, C>
3164 where
3165 I: IntoIterator<Item = St>,
3166 St: AsRef<str>,
3167 {
3168 self._scopes
3169 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3170 self
3171 }
3172
3173 /// Removes all scopes, and no default scope will be used either.
3174 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3175 /// for details).
3176 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagGetCall<'a, C> {
3177 self._scopes.clear();
3178 self
3179 }
3180}
3181
3182/// Lists tags.
3183///
3184/// A builder for the *locations.repositories.packages.tags.list* method supported by a *project* resource.
3185/// It is not used directly, but through a [`ProjectMethods`] instance.
3186///
3187/// # Example
3188///
3189/// Instantiate a resource method builder
3190///
3191/// ```test_harness,no_run
3192/// # extern crate hyper;
3193/// # extern crate hyper_rustls;
3194/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
3195/// # async fn dox() {
3196/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3197///
3198/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3199/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3200/// # .with_native_roots()
3201/// # .unwrap()
3202/// # .https_only()
3203/// # .enable_http2()
3204/// # .build();
3205///
3206/// # let executor = hyper_util::rt::TokioExecutor::new();
3207/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3208/// # secret,
3209/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3210/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3211/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3212/// # ),
3213/// # ).build().await.unwrap();
3214///
3215/// # let client = hyper_util::client::legacy::Client::builder(
3216/// # hyper_util::rt::TokioExecutor::new()
3217/// # )
3218/// # .build(
3219/// # hyper_rustls::HttpsConnectorBuilder::new()
3220/// # .with_native_roots()
3221/// # .unwrap()
3222/// # .https_or_http()
3223/// # .enable_http2()
3224/// # .build()
3225/// # );
3226/// # let mut hub = ArtifactRegistry::new(client, auth);
3227/// // You can configure optional parameters by calling the respective setters at will, and
3228/// // execute the final call using `doit()`.
3229/// // Values shown here are possibly random and not representative !
3230/// let result = hub.projects().locations_repositories_packages_tags_list("parent")
3231/// .page_token("dolor")
3232/// .page_size(-17)
3233/// .filter("ipsum")
3234/// .doit().await;
3235/// # }
3236/// ```
3237pub struct ProjectLocationRepositoryPackageTagListCall<'a, C>
3238where
3239 C: 'a,
3240{
3241 hub: &'a ArtifactRegistry<C>,
3242 _parent: String,
3243 _page_token: Option<String>,
3244 _page_size: Option<i32>,
3245 _filter: Option<String>,
3246 _delegate: Option<&'a mut dyn common::Delegate>,
3247 _additional_params: HashMap<String, String>,
3248 _scopes: BTreeSet<String>,
3249}
3250
3251impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagListCall<'a, C> {}
3252
3253impl<'a, C> ProjectLocationRepositoryPackageTagListCall<'a, C>
3254where
3255 C: common::Connector,
3256{
3257 /// Perform the operation you have build so far.
3258 pub async fn doit(mut self) -> common::Result<(common::Response, ListTagsResponse)> {
3259 use std::borrow::Cow;
3260 use std::io::{Read, Seek};
3261
3262 use common::{url::Params, ToParts};
3263 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3264
3265 let mut dd = common::DefaultDelegate;
3266 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3267 dlg.begin(common::MethodInfo {
3268 id: "artifactregistry.projects.locations.repositories.packages.tags.list",
3269 http_method: hyper::Method::GET,
3270 });
3271
3272 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
3273 if self._additional_params.contains_key(field) {
3274 dlg.finished(false);
3275 return Err(common::Error::FieldClash(field));
3276 }
3277 }
3278
3279 let mut params = Params::with_capacity(6 + self._additional_params.len());
3280 params.push("parent", self._parent);
3281 if let Some(value) = self._page_token.as_ref() {
3282 params.push("pageToken", value);
3283 }
3284 if let Some(value) = self._page_size.as_ref() {
3285 params.push("pageSize", value.to_string());
3286 }
3287 if let Some(value) = self._filter.as_ref() {
3288 params.push("filter", value);
3289 }
3290
3291 params.extend(self._additional_params.iter());
3292
3293 params.push("alt", "json");
3294 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/tags";
3295 if self._scopes.is_empty() {
3296 self._scopes
3297 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3298 }
3299
3300 #[allow(clippy::single_element_loop)]
3301 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3302 url = params.uri_replacement(url, param_name, find_this, true);
3303 }
3304 {
3305 let to_remove = ["parent"];
3306 params.remove_params(&to_remove);
3307 }
3308
3309 let url = params.parse_with_url(&url);
3310
3311 loop {
3312 let token = match self
3313 .hub
3314 .auth
3315 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3316 .await
3317 {
3318 Ok(token) => token,
3319 Err(e) => match dlg.token(e) {
3320 Ok(token) => token,
3321 Err(e) => {
3322 dlg.finished(false);
3323 return Err(common::Error::MissingToken(e));
3324 }
3325 },
3326 };
3327 let mut req_result = {
3328 let client = &self.hub.client;
3329 dlg.pre_request();
3330 let mut req_builder = hyper::Request::builder()
3331 .method(hyper::Method::GET)
3332 .uri(url.as_str())
3333 .header(USER_AGENT, self.hub._user_agent.clone());
3334
3335 if let Some(token) = token.as_ref() {
3336 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3337 }
3338
3339 let request = req_builder
3340 .header(CONTENT_LENGTH, 0_u64)
3341 .body(common::to_body::<String>(None));
3342
3343 client.request(request.unwrap()).await
3344 };
3345
3346 match req_result {
3347 Err(err) => {
3348 if let common::Retry::After(d) = dlg.http_error(&err) {
3349 sleep(d).await;
3350 continue;
3351 }
3352 dlg.finished(false);
3353 return Err(common::Error::HttpError(err));
3354 }
3355 Ok(res) => {
3356 let (mut parts, body) = res.into_parts();
3357 let mut body = common::Body::new(body);
3358 if !parts.status.is_success() {
3359 let bytes = common::to_bytes(body).await.unwrap_or_default();
3360 let error = serde_json::from_str(&common::to_string(&bytes));
3361 let response = common::to_response(parts, bytes.into());
3362
3363 if let common::Retry::After(d) =
3364 dlg.http_failure(&response, error.as_ref().ok())
3365 {
3366 sleep(d).await;
3367 continue;
3368 }
3369
3370 dlg.finished(false);
3371
3372 return Err(match error {
3373 Ok(value) => common::Error::BadRequest(value),
3374 _ => common::Error::Failure(response),
3375 });
3376 }
3377 let response = {
3378 let bytes = common::to_bytes(body).await.unwrap_or_default();
3379 let encoded = common::to_string(&bytes);
3380 match serde_json::from_str(&encoded) {
3381 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3382 Err(error) => {
3383 dlg.response_json_decode_error(&encoded, &error);
3384 return Err(common::Error::JsonDecodeError(
3385 encoded.to_string(),
3386 error,
3387 ));
3388 }
3389 }
3390 };
3391
3392 dlg.finished(true);
3393 return Ok(response);
3394 }
3395 }
3396 }
3397 }
3398
3399 /// The name of the parent package whose tags will be listed. For example: `projects/p1/locations/us-central1/repositories/repo1/packages/pkg1`.
3400 ///
3401 /// Sets the *parent* path property to the given value.
3402 ///
3403 /// Even though the property as already been set when instantiating this call,
3404 /// we provide this method for API completeness.
3405 pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
3406 self._parent = new_value.to_string();
3407 self
3408 }
3409 /// The next_page_token value returned from a previous list request, if any.
3410 ///
3411 /// Sets the *page token* query property to the given value.
3412 pub fn page_token(
3413 mut self,
3414 new_value: &str,
3415 ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
3416 self._page_token = Some(new_value.to_string());
3417 self
3418 }
3419 /// The maximum number of tags to return. Maximum page size is 1,000.
3420 ///
3421 /// Sets the *page size* query property to the given value.
3422 pub fn page_size(
3423 mut self,
3424 new_value: i32,
3425 ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
3426 self._page_size = Some(new_value);
3427 self
3428 }
3429 /// 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"`
3430 ///
3431 /// Sets the *filter* query property to the given value.
3432 pub fn filter(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
3433 self._filter = Some(new_value.to_string());
3434 self
3435 }
3436 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3437 /// while executing the actual API request.
3438 ///
3439 /// ````text
3440 /// It should be used to handle progress information, and to implement a certain level of resilience.
3441 /// ````
3442 ///
3443 /// Sets the *delegate* property to the given value.
3444 pub fn delegate(
3445 mut self,
3446 new_value: &'a mut dyn common::Delegate,
3447 ) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
3448 self._delegate = Some(new_value);
3449 self
3450 }
3451
3452 /// Set any additional parameter of the query string used in the request.
3453 /// It should be used to set parameters which are not yet available through their own
3454 /// setters.
3455 ///
3456 /// Please note that this method must not be used to set any of the known parameters
3457 /// which have their own setter method. If done anyway, the request will fail.
3458 ///
3459 /// # Additional Parameters
3460 ///
3461 /// * *$.xgafv* (query-string) - V1 error format.
3462 /// * *access_token* (query-string) - OAuth access token.
3463 /// * *alt* (query-string) - Data format for response.
3464 /// * *callback* (query-string) - JSONP
3465 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3466 /// * *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.
3467 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3468 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3469 /// * *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.
3470 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3471 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3472 pub fn param<T>(
3473 mut self,
3474 name: T,
3475 value: T,
3476 ) -> ProjectLocationRepositoryPackageTagListCall<'a, C>
3477 where
3478 T: AsRef<str>,
3479 {
3480 self._additional_params
3481 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3482 self
3483 }
3484
3485 /// Identifies the authorization scope for the method you are building.
3486 ///
3487 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3488 /// [`Scope::CloudPlatformReadOnly`].
3489 ///
3490 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3491 /// tokens for more than one scope.
3492 ///
3493 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3494 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3495 /// sufficient, a read-write scope will do as well.
3496 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageTagListCall<'a, C>
3497 where
3498 St: AsRef<str>,
3499 {
3500 self._scopes.insert(String::from(scope.as_ref()));
3501 self
3502 }
3503 /// Identifies the authorization scope(s) for the method you are building.
3504 ///
3505 /// See [`Self::add_scope()`] for details.
3506 pub fn add_scopes<I, St>(
3507 mut self,
3508 scopes: I,
3509 ) -> ProjectLocationRepositoryPackageTagListCall<'a, C>
3510 where
3511 I: IntoIterator<Item = St>,
3512 St: AsRef<str>,
3513 {
3514 self._scopes
3515 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3516 self
3517 }
3518
3519 /// Removes all scopes, and no default scope will be used either.
3520 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3521 /// for details).
3522 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagListCall<'a, C> {
3523 self._scopes.clear();
3524 self
3525 }
3526}
3527
3528/// Updates a tag.
3529///
3530/// A builder for the *locations.repositories.packages.tags.patch* method supported by a *project* resource.
3531/// It is not used directly, but through a [`ProjectMethods`] instance.
3532///
3533/// # Example
3534///
3535/// Instantiate a resource method builder
3536///
3537/// ```test_harness,no_run
3538/// # extern crate hyper;
3539/// # extern crate hyper_rustls;
3540/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
3541/// use artifactregistry1_beta1::api::Tag;
3542/// # async fn dox() {
3543/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3544///
3545/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3546/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3547/// # .with_native_roots()
3548/// # .unwrap()
3549/// # .https_only()
3550/// # .enable_http2()
3551/// # .build();
3552///
3553/// # let executor = hyper_util::rt::TokioExecutor::new();
3554/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3555/// # secret,
3556/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3557/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3558/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3559/// # ),
3560/// # ).build().await.unwrap();
3561///
3562/// # let client = hyper_util::client::legacy::Client::builder(
3563/// # hyper_util::rt::TokioExecutor::new()
3564/// # )
3565/// # .build(
3566/// # hyper_rustls::HttpsConnectorBuilder::new()
3567/// # .with_native_roots()
3568/// # .unwrap()
3569/// # .https_or_http()
3570/// # .enable_http2()
3571/// # .build()
3572/// # );
3573/// # let mut hub = ArtifactRegistry::new(client, auth);
3574/// // As the method needs a request, you would usually fill it with the desired information
3575/// // into the respective structure. Some of the parts shown here might not be applicable !
3576/// // Values shown here are possibly random and not representative !
3577/// let mut req = Tag::default();
3578///
3579/// // You can configure optional parameters by calling the respective setters at will, and
3580/// // execute the final call using `doit()`.
3581/// // Values shown here are possibly random and not representative !
3582/// let result = hub.projects().locations_repositories_packages_tags_patch(req, "name")
3583/// .update_mask(FieldMask::new::<&str>(&[]))
3584/// .doit().await;
3585/// # }
3586/// ```
3587pub struct ProjectLocationRepositoryPackageTagPatchCall<'a, C>
3588where
3589 C: 'a,
3590{
3591 hub: &'a ArtifactRegistry<C>,
3592 _request: Tag,
3593 _name: String,
3594 _update_mask: Option<common::FieldMask>,
3595 _delegate: Option<&'a mut dyn common::Delegate>,
3596 _additional_params: HashMap<String, String>,
3597 _scopes: BTreeSet<String>,
3598}
3599
3600impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageTagPatchCall<'a, C> {}
3601
3602impl<'a, C> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
3603where
3604 C: common::Connector,
3605{
3606 /// Perform the operation you have build so far.
3607 pub async fn doit(mut self) -> common::Result<(common::Response, Tag)> {
3608 use std::borrow::Cow;
3609 use std::io::{Read, Seek};
3610
3611 use common::{url::Params, ToParts};
3612 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3613
3614 let mut dd = common::DefaultDelegate;
3615 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3616 dlg.begin(common::MethodInfo {
3617 id: "artifactregistry.projects.locations.repositories.packages.tags.patch",
3618 http_method: hyper::Method::PATCH,
3619 });
3620
3621 for &field in ["alt", "name", "updateMask"].iter() {
3622 if self._additional_params.contains_key(field) {
3623 dlg.finished(false);
3624 return Err(common::Error::FieldClash(field));
3625 }
3626 }
3627
3628 let mut params = Params::with_capacity(5 + self._additional_params.len());
3629 params.push("name", self._name);
3630 if let Some(value) = self._update_mask.as_ref() {
3631 params.push("updateMask", value.to_string());
3632 }
3633
3634 params.extend(self._additional_params.iter());
3635
3636 params.push("alt", "json");
3637 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3638 if self._scopes.is_empty() {
3639 self._scopes
3640 .insert(Scope::CloudPlatform.as_ref().to_string());
3641 }
3642
3643 #[allow(clippy::single_element_loop)]
3644 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3645 url = params.uri_replacement(url, param_name, find_this, true);
3646 }
3647 {
3648 let to_remove = ["name"];
3649 params.remove_params(&to_remove);
3650 }
3651
3652 let url = params.parse_with_url(&url);
3653
3654 let mut json_mime_type = mime::APPLICATION_JSON;
3655 let mut request_value_reader = {
3656 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3657 common::remove_json_null_values(&mut value);
3658 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3659 serde_json::to_writer(&mut dst, &value).unwrap();
3660 dst
3661 };
3662 let request_size = request_value_reader
3663 .seek(std::io::SeekFrom::End(0))
3664 .unwrap();
3665 request_value_reader
3666 .seek(std::io::SeekFrom::Start(0))
3667 .unwrap();
3668
3669 loop {
3670 let token = match self
3671 .hub
3672 .auth
3673 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3674 .await
3675 {
3676 Ok(token) => token,
3677 Err(e) => match dlg.token(e) {
3678 Ok(token) => token,
3679 Err(e) => {
3680 dlg.finished(false);
3681 return Err(common::Error::MissingToken(e));
3682 }
3683 },
3684 };
3685 request_value_reader
3686 .seek(std::io::SeekFrom::Start(0))
3687 .unwrap();
3688 let mut req_result = {
3689 let client = &self.hub.client;
3690 dlg.pre_request();
3691 let mut req_builder = hyper::Request::builder()
3692 .method(hyper::Method::PATCH)
3693 .uri(url.as_str())
3694 .header(USER_AGENT, self.hub._user_agent.clone());
3695
3696 if let Some(token) = token.as_ref() {
3697 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3698 }
3699
3700 let request = req_builder
3701 .header(CONTENT_TYPE, json_mime_type.to_string())
3702 .header(CONTENT_LENGTH, request_size as u64)
3703 .body(common::to_body(
3704 request_value_reader.get_ref().clone().into(),
3705 ));
3706
3707 client.request(request.unwrap()).await
3708 };
3709
3710 match req_result {
3711 Err(err) => {
3712 if let common::Retry::After(d) = dlg.http_error(&err) {
3713 sleep(d).await;
3714 continue;
3715 }
3716 dlg.finished(false);
3717 return Err(common::Error::HttpError(err));
3718 }
3719 Ok(res) => {
3720 let (mut parts, body) = res.into_parts();
3721 let mut body = common::Body::new(body);
3722 if !parts.status.is_success() {
3723 let bytes = common::to_bytes(body).await.unwrap_or_default();
3724 let error = serde_json::from_str(&common::to_string(&bytes));
3725 let response = common::to_response(parts, bytes.into());
3726
3727 if let common::Retry::After(d) =
3728 dlg.http_failure(&response, error.as_ref().ok())
3729 {
3730 sleep(d).await;
3731 continue;
3732 }
3733
3734 dlg.finished(false);
3735
3736 return Err(match error {
3737 Ok(value) => common::Error::BadRequest(value),
3738 _ => common::Error::Failure(response),
3739 });
3740 }
3741 let response = {
3742 let bytes = common::to_bytes(body).await.unwrap_or_default();
3743 let encoded = common::to_string(&bytes);
3744 match serde_json::from_str(&encoded) {
3745 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3746 Err(error) => {
3747 dlg.response_json_decode_error(&encoded, &error);
3748 return Err(common::Error::JsonDecodeError(
3749 encoded.to_string(),
3750 error,
3751 ));
3752 }
3753 }
3754 };
3755
3756 dlg.finished(true);
3757 return Ok(response);
3758 }
3759 }
3760 }
3761 }
3762
3763 ///
3764 /// Sets the *request* property to the given value.
3765 ///
3766 /// Even though the property as already been set when instantiating this call,
3767 /// we provide this method for API completeness.
3768 pub fn request(
3769 mut self,
3770 new_value: Tag,
3771 ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
3772 self._request = new_value;
3773 self
3774 }
3775 /// 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.
3776 ///
3777 /// Sets the *name* path property to the given value.
3778 ///
3779 /// Even though the property as already been set when instantiating this call,
3780 /// we provide this method for API completeness.
3781 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
3782 self._name = new_value.to_string();
3783 self
3784 }
3785 /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
3786 ///
3787 /// Sets the *update mask* query property to the given value.
3788 pub fn update_mask(
3789 mut self,
3790 new_value: common::FieldMask,
3791 ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
3792 self._update_mask = Some(new_value);
3793 self
3794 }
3795 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3796 /// while executing the actual API request.
3797 ///
3798 /// ````text
3799 /// It should be used to handle progress information, and to implement a certain level of resilience.
3800 /// ````
3801 ///
3802 /// Sets the *delegate* property to the given value.
3803 pub fn delegate(
3804 mut self,
3805 new_value: &'a mut dyn common::Delegate,
3806 ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
3807 self._delegate = Some(new_value);
3808 self
3809 }
3810
3811 /// Set any additional parameter of the query string used in the request.
3812 /// It should be used to set parameters which are not yet available through their own
3813 /// setters.
3814 ///
3815 /// Please note that this method must not be used to set any of the known parameters
3816 /// which have their own setter method. If done anyway, the request will fail.
3817 ///
3818 /// # Additional Parameters
3819 ///
3820 /// * *$.xgafv* (query-string) - V1 error format.
3821 /// * *access_token* (query-string) - OAuth access token.
3822 /// * *alt* (query-string) - Data format for response.
3823 /// * *callback* (query-string) - JSONP
3824 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3825 /// * *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.
3826 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3827 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3828 /// * *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.
3829 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3830 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3831 pub fn param<T>(
3832 mut self,
3833 name: T,
3834 value: T,
3835 ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
3836 where
3837 T: AsRef<str>,
3838 {
3839 self._additional_params
3840 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3841 self
3842 }
3843
3844 /// Identifies the authorization scope for the method you are building.
3845 ///
3846 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3847 /// [`Scope::CloudPlatform`].
3848 ///
3849 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3850 /// tokens for more than one scope.
3851 ///
3852 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3853 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3854 /// sufficient, a read-write scope will do as well.
3855 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
3856 where
3857 St: AsRef<str>,
3858 {
3859 self._scopes.insert(String::from(scope.as_ref()));
3860 self
3861 }
3862 /// Identifies the authorization scope(s) for the method you are building.
3863 ///
3864 /// See [`Self::add_scope()`] for details.
3865 pub fn add_scopes<I, St>(
3866 mut self,
3867 scopes: I,
3868 ) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C>
3869 where
3870 I: IntoIterator<Item = St>,
3871 St: AsRef<str>,
3872 {
3873 self._scopes
3874 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3875 self
3876 }
3877
3878 /// Removes all scopes, and no default scope will be used either.
3879 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3880 /// for details).
3881 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageTagPatchCall<'a, C> {
3882 self._scopes.clear();
3883 self
3884 }
3885}
3886
3887/// Deletes a version and all of its content. The returned operation will complete once the version has been deleted.
3888///
3889/// A builder for the *locations.repositories.packages.versions.delete* method supported by a *project* resource.
3890/// It is not used directly, but through a [`ProjectMethods`] instance.
3891///
3892/// # Example
3893///
3894/// Instantiate a resource method builder
3895///
3896/// ```test_harness,no_run
3897/// # extern crate hyper;
3898/// # extern crate hyper_rustls;
3899/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
3900/// # async fn dox() {
3901/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3902///
3903/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3904/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3905/// # .with_native_roots()
3906/// # .unwrap()
3907/// # .https_only()
3908/// # .enable_http2()
3909/// # .build();
3910///
3911/// # let executor = hyper_util::rt::TokioExecutor::new();
3912/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3913/// # secret,
3914/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3915/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3916/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3917/// # ),
3918/// # ).build().await.unwrap();
3919///
3920/// # let client = hyper_util::client::legacy::Client::builder(
3921/// # hyper_util::rt::TokioExecutor::new()
3922/// # )
3923/// # .build(
3924/// # hyper_rustls::HttpsConnectorBuilder::new()
3925/// # .with_native_roots()
3926/// # .unwrap()
3927/// # .https_or_http()
3928/// # .enable_http2()
3929/// # .build()
3930/// # );
3931/// # let mut hub = ArtifactRegistry::new(client, auth);
3932/// // You can configure optional parameters by calling the respective setters at will, and
3933/// // execute the final call using `doit()`.
3934/// // Values shown here are possibly random and not representative !
3935/// let result = hub.projects().locations_repositories_packages_versions_delete("name")
3936/// .force(true)
3937/// .doit().await;
3938/// # }
3939/// ```
3940pub struct ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
3941where
3942 C: 'a,
3943{
3944 hub: &'a ArtifactRegistry<C>,
3945 _name: String,
3946 _force: Option<bool>,
3947 _delegate: Option<&'a mut dyn common::Delegate>,
3948 _additional_params: HashMap<String, String>,
3949 _scopes: BTreeSet<String>,
3950}
3951
3952impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {}
3953
3954impl<'a, C> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
3955where
3956 C: common::Connector,
3957{
3958 /// Perform the operation you have build so far.
3959 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3960 use std::borrow::Cow;
3961 use std::io::{Read, Seek};
3962
3963 use common::{url::Params, ToParts};
3964 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3965
3966 let mut dd = common::DefaultDelegate;
3967 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3968 dlg.begin(common::MethodInfo {
3969 id: "artifactregistry.projects.locations.repositories.packages.versions.delete",
3970 http_method: hyper::Method::DELETE,
3971 });
3972
3973 for &field in ["alt", "name", "force"].iter() {
3974 if self._additional_params.contains_key(field) {
3975 dlg.finished(false);
3976 return Err(common::Error::FieldClash(field));
3977 }
3978 }
3979
3980 let mut params = Params::with_capacity(4 + self._additional_params.len());
3981 params.push("name", self._name);
3982 if let Some(value) = self._force.as_ref() {
3983 params.push("force", value.to_string());
3984 }
3985
3986 params.extend(self._additional_params.iter());
3987
3988 params.push("alt", "json");
3989 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3990 if self._scopes.is_empty() {
3991 self._scopes
3992 .insert(Scope::CloudPlatform.as_ref().to_string());
3993 }
3994
3995 #[allow(clippy::single_element_loop)]
3996 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3997 url = params.uri_replacement(url, param_name, find_this, true);
3998 }
3999 {
4000 let to_remove = ["name"];
4001 params.remove_params(&to_remove);
4002 }
4003
4004 let url = params.parse_with_url(&url);
4005
4006 loop {
4007 let token = match self
4008 .hub
4009 .auth
4010 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4011 .await
4012 {
4013 Ok(token) => token,
4014 Err(e) => match dlg.token(e) {
4015 Ok(token) => token,
4016 Err(e) => {
4017 dlg.finished(false);
4018 return Err(common::Error::MissingToken(e));
4019 }
4020 },
4021 };
4022 let mut req_result = {
4023 let client = &self.hub.client;
4024 dlg.pre_request();
4025 let mut req_builder = hyper::Request::builder()
4026 .method(hyper::Method::DELETE)
4027 .uri(url.as_str())
4028 .header(USER_AGENT, self.hub._user_agent.clone());
4029
4030 if let Some(token) = token.as_ref() {
4031 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4032 }
4033
4034 let request = req_builder
4035 .header(CONTENT_LENGTH, 0_u64)
4036 .body(common::to_body::<String>(None));
4037
4038 client.request(request.unwrap()).await
4039 };
4040
4041 match req_result {
4042 Err(err) => {
4043 if let common::Retry::After(d) = dlg.http_error(&err) {
4044 sleep(d).await;
4045 continue;
4046 }
4047 dlg.finished(false);
4048 return Err(common::Error::HttpError(err));
4049 }
4050 Ok(res) => {
4051 let (mut parts, body) = res.into_parts();
4052 let mut body = common::Body::new(body);
4053 if !parts.status.is_success() {
4054 let bytes = common::to_bytes(body).await.unwrap_or_default();
4055 let error = serde_json::from_str(&common::to_string(&bytes));
4056 let response = common::to_response(parts, bytes.into());
4057
4058 if let common::Retry::After(d) =
4059 dlg.http_failure(&response, error.as_ref().ok())
4060 {
4061 sleep(d).await;
4062 continue;
4063 }
4064
4065 dlg.finished(false);
4066
4067 return Err(match error {
4068 Ok(value) => common::Error::BadRequest(value),
4069 _ => common::Error::Failure(response),
4070 });
4071 }
4072 let response = {
4073 let bytes = common::to_bytes(body).await.unwrap_or_default();
4074 let encoded = common::to_string(&bytes);
4075 match serde_json::from_str(&encoded) {
4076 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4077 Err(error) => {
4078 dlg.response_json_decode_error(&encoded, &error);
4079 return Err(common::Error::JsonDecodeError(
4080 encoded.to_string(),
4081 error,
4082 ));
4083 }
4084 }
4085 };
4086
4087 dlg.finished(true);
4088 return Ok(response);
4089 }
4090 }
4091 }
4092 }
4093
4094 /// The name of the version to delete.
4095 ///
4096 /// Sets the *name* path property to the given value.
4097 ///
4098 /// Even though the property as already been set when instantiating this call,
4099 /// we provide this method for API completeness.
4100 pub fn name(
4101 mut self,
4102 new_value: &str,
4103 ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
4104 self._name = new_value.to_string();
4105 self
4106 }
4107 /// 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.
4108 ///
4109 /// Sets the *force* query property to the given value.
4110 pub fn force(
4111 mut self,
4112 new_value: bool,
4113 ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
4114 self._force = Some(new_value);
4115 self
4116 }
4117 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4118 /// while executing the actual API request.
4119 ///
4120 /// ````text
4121 /// It should be used to handle progress information, and to implement a certain level of resilience.
4122 /// ````
4123 ///
4124 /// Sets the *delegate* property to the given value.
4125 pub fn delegate(
4126 mut self,
4127 new_value: &'a mut dyn common::Delegate,
4128 ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
4129 self._delegate = Some(new_value);
4130 self
4131 }
4132
4133 /// Set any additional parameter of the query string used in the request.
4134 /// It should be used to set parameters which are not yet available through their own
4135 /// setters.
4136 ///
4137 /// Please note that this method must not be used to set any of the known parameters
4138 /// which have their own setter method. If done anyway, the request will fail.
4139 ///
4140 /// # Additional Parameters
4141 ///
4142 /// * *$.xgafv* (query-string) - V1 error format.
4143 /// * *access_token* (query-string) - OAuth access token.
4144 /// * *alt* (query-string) - Data format for response.
4145 /// * *callback* (query-string) - JSONP
4146 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4147 /// * *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.
4148 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4149 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4150 /// * *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.
4151 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4152 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4153 pub fn param<T>(
4154 mut self,
4155 name: T,
4156 value: T,
4157 ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
4158 where
4159 T: AsRef<str>,
4160 {
4161 self._additional_params
4162 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4163 self
4164 }
4165
4166 /// Identifies the authorization scope for the method you are building.
4167 ///
4168 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4169 /// [`Scope::CloudPlatform`].
4170 ///
4171 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4172 /// tokens for more than one scope.
4173 ///
4174 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4175 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4176 /// sufficient, a read-write scope will do as well.
4177 pub fn add_scope<St>(
4178 mut self,
4179 scope: St,
4180 ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
4181 where
4182 St: AsRef<str>,
4183 {
4184 self._scopes.insert(String::from(scope.as_ref()));
4185 self
4186 }
4187 /// Identifies the authorization scope(s) for the method you are building.
4188 ///
4189 /// See [`Self::add_scope()`] for details.
4190 pub fn add_scopes<I, St>(
4191 mut self,
4192 scopes: I,
4193 ) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C>
4194 where
4195 I: IntoIterator<Item = St>,
4196 St: AsRef<str>,
4197 {
4198 self._scopes
4199 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4200 self
4201 }
4202
4203 /// Removes all scopes, and no default scope will be used either.
4204 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4205 /// for details).
4206 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionDeleteCall<'a, C> {
4207 self._scopes.clear();
4208 self
4209 }
4210}
4211
4212/// Gets a version
4213///
4214/// A builder for the *locations.repositories.packages.versions.get* method supported by a *project* resource.
4215/// It is not used directly, but through a [`ProjectMethods`] instance.
4216///
4217/// # Example
4218///
4219/// Instantiate a resource method builder
4220///
4221/// ```test_harness,no_run
4222/// # extern crate hyper;
4223/// # extern crate hyper_rustls;
4224/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
4225/// # async fn dox() {
4226/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4227///
4228/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4229/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4230/// # .with_native_roots()
4231/// # .unwrap()
4232/// # .https_only()
4233/// # .enable_http2()
4234/// # .build();
4235///
4236/// # let executor = hyper_util::rt::TokioExecutor::new();
4237/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4238/// # secret,
4239/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4240/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4241/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4242/// # ),
4243/// # ).build().await.unwrap();
4244///
4245/// # let client = hyper_util::client::legacy::Client::builder(
4246/// # hyper_util::rt::TokioExecutor::new()
4247/// # )
4248/// # .build(
4249/// # hyper_rustls::HttpsConnectorBuilder::new()
4250/// # .with_native_roots()
4251/// # .unwrap()
4252/// # .https_or_http()
4253/// # .enable_http2()
4254/// # .build()
4255/// # );
4256/// # let mut hub = ArtifactRegistry::new(client, auth);
4257/// // You can configure optional parameters by calling the respective setters at will, and
4258/// // execute the final call using `doit()`.
4259/// // Values shown here are possibly random and not representative !
4260/// let result = hub.projects().locations_repositories_packages_versions_get("name")
4261/// .view("ut")
4262/// .doit().await;
4263/// # }
4264/// ```
4265pub struct ProjectLocationRepositoryPackageVersionGetCall<'a, C>
4266where
4267 C: 'a,
4268{
4269 hub: &'a ArtifactRegistry<C>,
4270 _name: String,
4271 _view: Option<String>,
4272 _delegate: Option<&'a mut dyn common::Delegate>,
4273 _additional_params: HashMap<String, String>,
4274 _scopes: BTreeSet<String>,
4275}
4276
4277impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionGetCall<'a, C> {}
4278
4279impl<'a, C> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
4280where
4281 C: common::Connector,
4282{
4283 /// Perform the operation you have build so far.
4284 pub async fn doit(mut self) -> common::Result<(common::Response, Version)> {
4285 use std::borrow::Cow;
4286 use std::io::{Read, Seek};
4287
4288 use common::{url::Params, ToParts};
4289 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4290
4291 let mut dd = common::DefaultDelegate;
4292 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4293 dlg.begin(common::MethodInfo {
4294 id: "artifactregistry.projects.locations.repositories.packages.versions.get",
4295 http_method: hyper::Method::GET,
4296 });
4297
4298 for &field in ["alt", "name", "view"].iter() {
4299 if self._additional_params.contains_key(field) {
4300 dlg.finished(false);
4301 return Err(common::Error::FieldClash(field));
4302 }
4303 }
4304
4305 let mut params = Params::with_capacity(4 + self._additional_params.len());
4306 params.push("name", self._name);
4307 if let Some(value) = self._view.as_ref() {
4308 params.push("view", value);
4309 }
4310
4311 params.extend(self._additional_params.iter());
4312
4313 params.push("alt", "json");
4314 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4315 if self._scopes.is_empty() {
4316 self._scopes
4317 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4318 }
4319
4320 #[allow(clippy::single_element_loop)]
4321 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4322 url = params.uri_replacement(url, param_name, find_this, true);
4323 }
4324 {
4325 let to_remove = ["name"];
4326 params.remove_params(&to_remove);
4327 }
4328
4329 let url = params.parse_with_url(&url);
4330
4331 loop {
4332 let token = match self
4333 .hub
4334 .auth
4335 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4336 .await
4337 {
4338 Ok(token) => token,
4339 Err(e) => match dlg.token(e) {
4340 Ok(token) => token,
4341 Err(e) => {
4342 dlg.finished(false);
4343 return Err(common::Error::MissingToken(e));
4344 }
4345 },
4346 };
4347 let mut req_result = {
4348 let client = &self.hub.client;
4349 dlg.pre_request();
4350 let mut req_builder = hyper::Request::builder()
4351 .method(hyper::Method::GET)
4352 .uri(url.as_str())
4353 .header(USER_AGENT, self.hub._user_agent.clone());
4354
4355 if let Some(token) = token.as_ref() {
4356 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4357 }
4358
4359 let request = req_builder
4360 .header(CONTENT_LENGTH, 0_u64)
4361 .body(common::to_body::<String>(None));
4362
4363 client.request(request.unwrap()).await
4364 };
4365
4366 match req_result {
4367 Err(err) => {
4368 if let common::Retry::After(d) = dlg.http_error(&err) {
4369 sleep(d).await;
4370 continue;
4371 }
4372 dlg.finished(false);
4373 return Err(common::Error::HttpError(err));
4374 }
4375 Ok(res) => {
4376 let (mut parts, body) = res.into_parts();
4377 let mut body = common::Body::new(body);
4378 if !parts.status.is_success() {
4379 let bytes = common::to_bytes(body).await.unwrap_or_default();
4380 let error = serde_json::from_str(&common::to_string(&bytes));
4381 let response = common::to_response(parts, bytes.into());
4382
4383 if let common::Retry::After(d) =
4384 dlg.http_failure(&response, error.as_ref().ok())
4385 {
4386 sleep(d).await;
4387 continue;
4388 }
4389
4390 dlg.finished(false);
4391
4392 return Err(match error {
4393 Ok(value) => common::Error::BadRequest(value),
4394 _ => common::Error::Failure(response),
4395 });
4396 }
4397 let response = {
4398 let bytes = common::to_bytes(body).await.unwrap_or_default();
4399 let encoded = common::to_string(&bytes);
4400 match serde_json::from_str(&encoded) {
4401 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4402 Err(error) => {
4403 dlg.response_json_decode_error(&encoded, &error);
4404 return Err(common::Error::JsonDecodeError(
4405 encoded.to_string(),
4406 error,
4407 ));
4408 }
4409 }
4410 };
4411
4412 dlg.finished(true);
4413 return Ok(response);
4414 }
4415 }
4416 }
4417 }
4418
4419 /// The name of the version to retrieve.
4420 ///
4421 /// Sets the *name* path property to the given value.
4422 ///
4423 /// Even though the property as already been set when instantiating this call,
4424 /// we provide this method for API completeness.
4425 pub fn name(
4426 mut self,
4427 new_value: &str,
4428 ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
4429 self._name = new_value.to_string();
4430 self
4431 }
4432 /// The view that should be returned in the response.
4433 ///
4434 /// Sets the *view* query property to the given value.
4435 pub fn view(
4436 mut self,
4437 new_value: &str,
4438 ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
4439 self._view = Some(new_value.to_string());
4440 self
4441 }
4442 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4443 /// while executing the actual API request.
4444 ///
4445 /// ````text
4446 /// It should be used to handle progress information, and to implement a certain level of resilience.
4447 /// ````
4448 ///
4449 /// Sets the *delegate* property to the given value.
4450 pub fn delegate(
4451 mut self,
4452 new_value: &'a mut dyn common::Delegate,
4453 ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
4454 self._delegate = Some(new_value);
4455 self
4456 }
4457
4458 /// Set any additional parameter of the query string used in the request.
4459 /// It should be used to set parameters which are not yet available through their own
4460 /// setters.
4461 ///
4462 /// Please note that this method must not be used to set any of the known parameters
4463 /// which have their own setter method. If done anyway, the request will fail.
4464 ///
4465 /// # Additional Parameters
4466 ///
4467 /// * *$.xgafv* (query-string) - V1 error format.
4468 /// * *access_token* (query-string) - OAuth access token.
4469 /// * *alt* (query-string) - Data format for response.
4470 /// * *callback* (query-string) - JSONP
4471 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4472 /// * *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.
4473 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4474 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4475 /// * *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.
4476 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4477 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4478 pub fn param<T>(
4479 mut self,
4480 name: T,
4481 value: T,
4482 ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
4483 where
4484 T: AsRef<str>,
4485 {
4486 self._additional_params
4487 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4488 self
4489 }
4490
4491 /// Identifies the authorization scope for the method you are building.
4492 ///
4493 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4494 /// [`Scope::CloudPlatformReadOnly`].
4495 ///
4496 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4497 /// tokens for more than one scope.
4498 ///
4499 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4500 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4501 /// sufficient, a read-write scope will do as well.
4502 pub fn add_scope<St>(
4503 mut self,
4504 scope: St,
4505 ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
4506 where
4507 St: AsRef<str>,
4508 {
4509 self._scopes.insert(String::from(scope.as_ref()));
4510 self
4511 }
4512 /// Identifies the authorization scope(s) for the method you are building.
4513 ///
4514 /// See [`Self::add_scope()`] for details.
4515 pub fn add_scopes<I, St>(
4516 mut self,
4517 scopes: I,
4518 ) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C>
4519 where
4520 I: IntoIterator<Item = St>,
4521 St: AsRef<str>,
4522 {
4523 self._scopes
4524 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4525 self
4526 }
4527
4528 /// Removes all scopes, and no default scope will be used either.
4529 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4530 /// for details).
4531 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionGetCall<'a, C> {
4532 self._scopes.clear();
4533 self
4534 }
4535}
4536
4537/// Lists versions.
4538///
4539/// A builder for the *locations.repositories.packages.versions.list* method supported by a *project* resource.
4540/// It is not used directly, but through a [`ProjectMethods`] instance.
4541///
4542/// # Example
4543///
4544/// Instantiate a resource method builder
4545///
4546/// ```test_harness,no_run
4547/// # extern crate hyper;
4548/// # extern crate hyper_rustls;
4549/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
4550/// # async fn dox() {
4551/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4552///
4553/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4554/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4555/// # .with_native_roots()
4556/// # .unwrap()
4557/// # .https_only()
4558/// # .enable_http2()
4559/// # .build();
4560///
4561/// # let executor = hyper_util::rt::TokioExecutor::new();
4562/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4563/// # secret,
4564/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4565/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4566/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4567/// # ),
4568/// # ).build().await.unwrap();
4569///
4570/// # let client = hyper_util::client::legacy::Client::builder(
4571/// # hyper_util::rt::TokioExecutor::new()
4572/// # )
4573/// # .build(
4574/// # hyper_rustls::HttpsConnectorBuilder::new()
4575/// # .with_native_roots()
4576/// # .unwrap()
4577/// # .https_or_http()
4578/// # .enable_http2()
4579/// # .build()
4580/// # );
4581/// # let mut hub = ArtifactRegistry::new(client, auth);
4582/// // You can configure optional parameters by calling the respective setters at will, and
4583/// // execute the final call using `doit()`.
4584/// // Values shown here are possibly random and not representative !
4585/// let result = hub.projects().locations_repositories_packages_versions_list("parent")
4586/// .view("rebum.")
4587/// .page_token("est")
4588/// .page_size(-50)
4589/// .order_by("ipsum")
4590/// .doit().await;
4591/// # }
4592/// ```
4593pub struct ProjectLocationRepositoryPackageVersionListCall<'a, C>
4594where
4595 C: 'a,
4596{
4597 hub: &'a ArtifactRegistry<C>,
4598 _parent: String,
4599 _view: Option<String>,
4600 _page_token: Option<String>,
4601 _page_size: Option<i32>,
4602 _order_by: Option<String>,
4603 _delegate: Option<&'a mut dyn common::Delegate>,
4604 _additional_params: HashMap<String, String>,
4605 _scopes: BTreeSet<String>,
4606}
4607
4608impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageVersionListCall<'a, C> {}
4609
4610impl<'a, C> ProjectLocationRepositoryPackageVersionListCall<'a, C>
4611where
4612 C: common::Connector,
4613{
4614 /// Perform the operation you have build so far.
4615 pub async fn doit(mut self) -> common::Result<(common::Response, ListVersionsResponse)> {
4616 use std::borrow::Cow;
4617 use std::io::{Read, Seek};
4618
4619 use common::{url::Params, ToParts};
4620 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4621
4622 let mut dd = common::DefaultDelegate;
4623 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4624 dlg.begin(common::MethodInfo {
4625 id: "artifactregistry.projects.locations.repositories.packages.versions.list",
4626 http_method: hyper::Method::GET,
4627 });
4628
4629 for &field in ["alt", "parent", "view", "pageToken", "pageSize", "orderBy"].iter() {
4630 if self._additional_params.contains_key(field) {
4631 dlg.finished(false);
4632 return Err(common::Error::FieldClash(field));
4633 }
4634 }
4635
4636 let mut params = Params::with_capacity(7 + self._additional_params.len());
4637 params.push("parent", self._parent);
4638 if let Some(value) = self._view.as_ref() {
4639 params.push("view", value);
4640 }
4641 if let Some(value) = self._page_token.as_ref() {
4642 params.push("pageToken", value);
4643 }
4644 if let Some(value) = self._page_size.as_ref() {
4645 params.push("pageSize", value.to_string());
4646 }
4647 if let Some(value) = self._order_by.as_ref() {
4648 params.push("orderBy", value);
4649 }
4650
4651 params.extend(self._additional_params.iter());
4652
4653 params.push("alt", "json");
4654 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
4655 if self._scopes.is_empty() {
4656 self._scopes
4657 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4658 }
4659
4660 #[allow(clippy::single_element_loop)]
4661 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4662 url = params.uri_replacement(url, param_name, find_this, true);
4663 }
4664 {
4665 let to_remove = ["parent"];
4666 params.remove_params(&to_remove);
4667 }
4668
4669 let url = params.parse_with_url(&url);
4670
4671 loop {
4672 let token = match self
4673 .hub
4674 .auth
4675 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4676 .await
4677 {
4678 Ok(token) => token,
4679 Err(e) => match dlg.token(e) {
4680 Ok(token) => token,
4681 Err(e) => {
4682 dlg.finished(false);
4683 return Err(common::Error::MissingToken(e));
4684 }
4685 },
4686 };
4687 let mut req_result = {
4688 let client = &self.hub.client;
4689 dlg.pre_request();
4690 let mut req_builder = hyper::Request::builder()
4691 .method(hyper::Method::GET)
4692 .uri(url.as_str())
4693 .header(USER_AGENT, self.hub._user_agent.clone());
4694
4695 if let Some(token) = token.as_ref() {
4696 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4697 }
4698
4699 let request = req_builder
4700 .header(CONTENT_LENGTH, 0_u64)
4701 .body(common::to_body::<String>(None));
4702
4703 client.request(request.unwrap()).await
4704 };
4705
4706 match req_result {
4707 Err(err) => {
4708 if let common::Retry::After(d) = dlg.http_error(&err) {
4709 sleep(d).await;
4710 continue;
4711 }
4712 dlg.finished(false);
4713 return Err(common::Error::HttpError(err));
4714 }
4715 Ok(res) => {
4716 let (mut parts, body) = res.into_parts();
4717 let mut body = common::Body::new(body);
4718 if !parts.status.is_success() {
4719 let bytes = common::to_bytes(body).await.unwrap_or_default();
4720 let error = serde_json::from_str(&common::to_string(&bytes));
4721 let response = common::to_response(parts, bytes.into());
4722
4723 if let common::Retry::After(d) =
4724 dlg.http_failure(&response, error.as_ref().ok())
4725 {
4726 sleep(d).await;
4727 continue;
4728 }
4729
4730 dlg.finished(false);
4731
4732 return Err(match error {
4733 Ok(value) => common::Error::BadRequest(value),
4734 _ => common::Error::Failure(response),
4735 });
4736 }
4737 let response = {
4738 let bytes = common::to_bytes(body).await.unwrap_or_default();
4739 let encoded = common::to_string(&bytes);
4740 match serde_json::from_str(&encoded) {
4741 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4742 Err(error) => {
4743 dlg.response_json_decode_error(&encoded, &error);
4744 return Err(common::Error::JsonDecodeError(
4745 encoded.to_string(),
4746 error,
4747 ));
4748 }
4749 }
4750 };
4751
4752 dlg.finished(true);
4753 return Ok(response);
4754 }
4755 }
4756 }
4757 }
4758
4759 /// The name of the parent resource whose versions will be listed.
4760 ///
4761 /// Sets the *parent* path property to the given value.
4762 ///
4763 /// Even though the property as already been set when instantiating this call,
4764 /// we provide this method for API completeness.
4765 pub fn parent(
4766 mut self,
4767 new_value: &str,
4768 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
4769 self._parent = new_value.to_string();
4770 self
4771 }
4772 /// The view that should be returned in the response.
4773 ///
4774 /// Sets the *view* query property to the given value.
4775 pub fn view(
4776 mut self,
4777 new_value: &str,
4778 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
4779 self._view = Some(new_value.to_string());
4780 self
4781 }
4782 /// The next_page_token value returned from a previous list request, if any.
4783 ///
4784 /// Sets the *page token* query property to the given value.
4785 pub fn page_token(
4786 mut self,
4787 new_value: &str,
4788 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
4789 self._page_token = Some(new_value.to_string());
4790 self
4791 }
4792 /// The maximum number of versions to return. Maximum page size is 1,000.
4793 ///
4794 /// Sets the *page size* query property to the given value.
4795 pub fn page_size(
4796 mut self,
4797 new_value: i32,
4798 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
4799 self._page_size = Some(new_value);
4800 self
4801 }
4802 /// Optional. The field to order the results by.
4803 ///
4804 /// Sets the *order by* query property to the given value.
4805 pub fn order_by(
4806 mut self,
4807 new_value: &str,
4808 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
4809 self._order_by = Some(new_value.to_string());
4810 self
4811 }
4812 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4813 /// while executing the actual API request.
4814 ///
4815 /// ````text
4816 /// It should be used to handle progress information, and to implement a certain level of resilience.
4817 /// ````
4818 ///
4819 /// Sets the *delegate* property to the given value.
4820 pub fn delegate(
4821 mut self,
4822 new_value: &'a mut dyn common::Delegate,
4823 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
4824 self._delegate = Some(new_value);
4825 self
4826 }
4827
4828 /// Set any additional parameter of the query string used in the request.
4829 /// It should be used to set parameters which are not yet available through their own
4830 /// setters.
4831 ///
4832 /// Please note that this method must not be used to set any of the known parameters
4833 /// which have their own setter method. If done anyway, the request will fail.
4834 ///
4835 /// # Additional Parameters
4836 ///
4837 /// * *$.xgafv* (query-string) - V1 error format.
4838 /// * *access_token* (query-string) - OAuth access token.
4839 /// * *alt* (query-string) - Data format for response.
4840 /// * *callback* (query-string) - JSONP
4841 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4842 /// * *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.
4843 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4844 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4845 /// * *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.
4846 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4847 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4848 pub fn param<T>(
4849 mut self,
4850 name: T,
4851 value: T,
4852 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C>
4853 where
4854 T: AsRef<str>,
4855 {
4856 self._additional_params
4857 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4858 self
4859 }
4860
4861 /// Identifies the authorization scope for the method you are building.
4862 ///
4863 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4864 /// [`Scope::CloudPlatformReadOnly`].
4865 ///
4866 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4867 /// tokens for more than one scope.
4868 ///
4869 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4870 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4871 /// sufficient, a read-write scope will do as well.
4872 pub fn add_scope<St>(
4873 mut self,
4874 scope: St,
4875 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C>
4876 where
4877 St: AsRef<str>,
4878 {
4879 self._scopes.insert(String::from(scope.as_ref()));
4880 self
4881 }
4882 /// Identifies the authorization scope(s) for the method you are building.
4883 ///
4884 /// See [`Self::add_scope()`] for details.
4885 pub fn add_scopes<I, St>(
4886 mut self,
4887 scopes: I,
4888 ) -> ProjectLocationRepositoryPackageVersionListCall<'a, C>
4889 where
4890 I: IntoIterator<Item = St>,
4891 St: AsRef<str>,
4892 {
4893 self._scopes
4894 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4895 self
4896 }
4897
4898 /// Removes all scopes, and no default scope will be used either.
4899 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4900 /// for details).
4901 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageVersionListCall<'a, C> {
4902 self._scopes.clear();
4903 self
4904 }
4905}
4906
4907/// Deletes a package and all of its versions and tags. The returned operation will complete once the package has been deleted.
4908///
4909/// A builder for the *locations.repositories.packages.delete* method supported by a *project* resource.
4910/// It is not used directly, but through a [`ProjectMethods`] instance.
4911///
4912/// # Example
4913///
4914/// Instantiate a resource method builder
4915///
4916/// ```test_harness,no_run
4917/// # extern crate hyper;
4918/// # extern crate hyper_rustls;
4919/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
4920/// # async fn dox() {
4921/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4922///
4923/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4924/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4925/// # .with_native_roots()
4926/// # .unwrap()
4927/// # .https_only()
4928/// # .enable_http2()
4929/// # .build();
4930///
4931/// # let executor = hyper_util::rt::TokioExecutor::new();
4932/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4933/// # secret,
4934/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4935/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4936/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4937/// # ),
4938/// # ).build().await.unwrap();
4939///
4940/// # let client = hyper_util::client::legacy::Client::builder(
4941/// # hyper_util::rt::TokioExecutor::new()
4942/// # )
4943/// # .build(
4944/// # hyper_rustls::HttpsConnectorBuilder::new()
4945/// # .with_native_roots()
4946/// # .unwrap()
4947/// # .https_or_http()
4948/// # .enable_http2()
4949/// # .build()
4950/// # );
4951/// # let mut hub = ArtifactRegistry::new(client, auth);
4952/// // You can configure optional parameters by calling the respective setters at will, and
4953/// // execute the final call using `doit()`.
4954/// // Values shown here are possibly random and not representative !
4955/// let result = hub.projects().locations_repositories_packages_delete("name")
4956/// .doit().await;
4957/// # }
4958/// ```
4959pub struct ProjectLocationRepositoryPackageDeleteCall<'a, C>
4960where
4961 C: 'a,
4962{
4963 hub: &'a ArtifactRegistry<C>,
4964 _name: String,
4965 _delegate: Option<&'a mut dyn common::Delegate>,
4966 _additional_params: HashMap<String, String>,
4967 _scopes: BTreeSet<String>,
4968}
4969
4970impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageDeleteCall<'a, C> {}
4971
4972impl<'a, C> ProjectLocationRepositoryPackageDeleteCall<'a, C>
4973where
4974 C: common::Connector,
4975{
4976 /// Perform the operation you have build so far.
4977 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4978 use std::borrow::Cow;
4979 use std::io::{Read, Seek};
4980
4981 use common::{url::Params, ToParts};
4982 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4983
4984 let mut dd = common::DefaultDelegate;
4985 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4986 dlg.begin(common::MethodInfo {
4987 id: "artifactregistry.projects.locations.repositories.packages.delete",
4988 http_method: hyper::Method::DELETE,
4989 });
4990
4991 for &field in ["alt", "name"].iter() {
4992 if self._additional_params.contains_key(field) {
4993 dlg.finished(false);
4994 return Err(common::Error::FieldClash(field));
4995 }
4996 }
4997
4998 let mut params = Params::with_capacity(3 + self._additional_params.len());
4999 params.push("name", self._name);
5000
5001 params.extend(self._additional_params.iter());
5002
5003 params.push("alt", "json");
5004 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5005 if self._scopes.is_empty() {
5006 self._scopes
5007 .insert(Scope::CloudPlatform.as_ref().to_string());
5008 }
5009
5010 #[allow(clippy::single_element_loop)]
5011 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5012 url = params.uri_replacement(url, param_name, find_this, true);
5013 }
5014 {
5015 let to_remove = ["name"];
5016 params.remove_params(&to_remove);
5017 }
5018
5019 let url = params.parse_with_url(&url);
5020
5021 loop {
5022 let token = match self
5023 .hub
5024 .auth
5025 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5026 .await
5027 {
5028 Ok(token) => token,
5029 Err(e) => match dlg.token(e) {
5030 Ok(token) => token,
5031 Err(e) => {
5032 dlg.finished(false);
5033 return Err(common::Error::MissingToken(e));
5034 }
5035 },
5036 };
5037 let mut req_result = {
5038 let client = &self.hub.client;
5039 dlg.pre_request();
5040 let mut req_builder = hyper::Request::builder()
5041 .method(hyper::Method::DELETE)
5042 .uri(url.as_str())
5043 .header(USER_AGENT, self.hub._user_agent.clone());
5044
5045 if let Some(token) = token.as_ref() {
5046 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5047 }
5048
5049 let request = req_builder
5050 .header(CONTENT_LENGTH, 0_u64)
5051 .body(common::to_body::<String>(None));
5052
5053 client.request(request.unwrap()).await
5054 };
5055
5056 match req_result {
5057 Err(err) => {
5058 if let common::Retry::After(d) = dlg.http_error(&err) {
5059 sleep(d).await;
5060 continue;
5061 }
5062 dlg.finished(false);
5063 return Err(common::Error::HttpError(err));
5064 }
5065 Ok(res) => {
5066 let (mut parts, body) = res.into_parts();
5067 let mut body = common::Body::new(body);
5068 if !parts.status.is_success() {
5069 let bytes = common::to_bytes(body).await.unwrap_or_default();
5070 let error = serde_json::from_str(&common::to_string(&bytes));
5071 let response = common::to_response(parts, bytes.into());
5072
5073 if let common::Retry::After(d) =
5074 dlg.http_failure(&response, error.as_ref().ok())
5075 {
5076 sleep(d).await;
5077 continue;
5078 }
5079
5080 dlg.finished(false);
5081
5082 return Err(match error {
5083 Ok(value) => common::Error::BadRequest(value),
5084 _ => common::Error::Failure(response),
5085 });
5086 }
5087 let response = {
5088 let bytes = common::to_bytes(body).await.unwrap_or_default();
5089 let encoded = common::to_string(&bytes);
5090 match serde_json::from_str(&encoded) {
5091 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5092 Err(error) => {
5093 dlg.response_json_decode_error(&encoded, &error);
5094 return Err(common::Error::JsonDecodeError(
5095 encoded.to_string(),
5096 error,
5097 ));
5098 }
5099 }
5100 };
5101
5102 dlg.finished(true);
5103 return Ok(response);
5104 }
5105 }
5106 }
5107 }
5108
5109 /// Required. The name of the package to delete.
5110 ///
5111 /// Sets the *name* path property to the given value.
5112 ///
5113 /// Even though the property as already been set when instantiating this call,
5114 /// we provide this method for API completeness.
5115 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
5116 self._name = new_value.to_string();
5117 self
5118 }
5119 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5120 /// while executing the actual API request.
5121 ///
5122 /// ````text
5123 /// It should be used to handle progress information, and to implement a certain level of resilience.
5124 /// ````
5125 ///
5126 /// Sets the *delegate* property to the given value.
5127 pub fn delegate(
5128 mut self,
5129 new_value: &'a mut dyn common::Delegate,
5130 ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
5131 self._delegate = Some(new_value);
5132 self
5133 }
5134
5135 /// Set any additional parameter of the query string used in the request.
5136 /// It should be used to set parameters which are not yet available through their own
5137 /// setters.
5138 ///
5139 /// Please note that this method must not be used to set any of the known parameters
5140 /// which have their own setter method. If done anyway, the request will fail.
5141 ///
5142 /// # Additional Parameters
5143 ///
5144 /// * *$.xgafv* (query-string) - V1 error format.
5145 /// * *access_token* (query-string) - OAuth access token.
5146 /// * *alt* (query-string) - Data format for response.
5147 /// * *callback* (query-string) - JSONP
5148 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5149 /// * *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.
5150 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5151 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5152 /// * *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.
5153 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5154 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5155 pub fn param<T>(
5156 mut self,
5157 name: T,
5158 value: T,
5159 ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C>
5160 where
5161 T: AsRef<str>,
5162 {
5163 self._additional_params
5164 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5165 self
5166 }
5167
5168 /// Identifies the authorization scope for the method you are building.
5169 ///
5170 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5171 /// [`Scope::CloudPlatform`].
5172 ///
5173 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5174 /// tokens for more than one scope.
5175 ///
5176 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5177 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5178 /// sufficient, a read-write scope will do as well.
5179 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageDeleteCall<'a, C>
5180 where
5181 St: AsRef<str>,
5182 {
5183 self._scopes.insert(String::from(scope.as_ref()));
5184 self
5185 }
5186 /// Identifies the authorization scope(s) for the method you are building.
5187 ///
5188 /// See [`Self::add_scope()`] for details.
5189 pub fn add_scopes<I, St>(
5190 mut self,
5191 scopes: I,
5192 ) -> ProjectLocationRepositoryPackageDeleteCall<'a, C>
5193 where
5194 I: IntoIterator<Item = St>,
5195 St: AsRef<str>,
5196 {
5197 self._scopes
5198 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5199 self
5200 }
5201
5202 /// Removes all scopes, and no default scope will be used either.
5203 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5204 /// for details).
5205 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageDeleteCall<'a, C> {
5206 self._scopes.clear();
5207 self
5208 }
5209}
5210
5211/// Gets a package.
5212///
5213/// A builder for the *locations.repositories.packages.get* method supported by a *project* resource.
5214/// It is not used directly, but through a [`ProjectMethods`] instance.
5215///
5216/// # Example
5217///
5218/// Instantiate a resource method builder
5219///
5220/// ```test_harness,no_run
5221/// # extern crate hyper;
5222/// # extern crate hyper_rustls;
5223/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
5224/// # async fn dox() {
5225/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5226///
5227/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5228/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5229/// # .with_native_roots()
5230/// # .unwrap()
5231/// # .https_only()
5232/// # .enable_http2()
5233/// # .build();
5234///
5235/// # let executor = hyper_util::rt::TokioExecutor::new();
5236/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5237/// # secret,
5238/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5239/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5240/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5241/// # ),
5242/// # ).build().await.unwrap();
5243///
5244/// # let client = hyper_util::client::legacy::Client::builder(
5245/// # hyper_util::rt::TokioExecutor::new()
5246/// # )
5247/// # .build(
5248/// # hyper_rustls::HttpsConnectorBuilder::new()
5249/// # .with_native_roots()
5250/// # .unwrap()
5251/// # .https_or_http()
5252/// # .enable_http2()
5253/// # .build()
5254/// # );
5255/// # let mut hub = ArtifactRegistry::new(client, auth);
5256/// // You can configure optional parameters by calling the respective setters at will, and
5257/// // execute the final call using `doit()`.
5258/// // Values shown here are possibly random and not representative !
5259/// let result = hub.projects().locations_repositories_packages_get("name")
5260/// .doit().await;
5261/// # }
5262/// ```
5263pub struct ProjectLocationRepositoryPackageGetCall<'a, C>
5264where
5265 C: 'a,
5266{
5267 hub: &'a ArtifactRegistry<C>,
5268 _name: String,
5269 _delegate: Option<&'a mut dyn common::Delegate>,
5270 _additional_params: HashMap<String, String>,
5271 _scopes: BTreeSet<String>,
5272}
5273
5274impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageGetCall<'a, C> {}
5275
5276impl<'a, C> ProjectLocationRepositoryPackageGetCall<'a, C>
5277where
5278 C: common::Connector,
5279{
5280 /// Perform the operation you have build so far.
5281 pub async fn doit(mut self) -> common::Result<(common::Response, Package)> {
5282 use std::borrow::Cow;
5283 use std::io::{Read, Seek};
5284
5285 use common::{url::Params, ToParts};
5286 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5287
5288 let mut dd = common::DefaultDelegate;
5289 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5290 dlg.begin(common::MethodInfo {
5291 id: "artifactregistry.projects.locations.repositories.packages.get",
5292 http_method: hyper::Method::GET,
5293 });
5294
5295 for &field in ["alt", "name"].iter() {
5296 if self._additional_params.contains_key(field) {
5297 dlg.finished(false);
5298 return Err(common::Error::FieldClash(field));
5299 }
5300 }
5301
5302 let mut params = Params::with_capacity(3 + self._additional_params.len());
5303 params.push("name", self._name);
5304
5305 params.extend(self._additional_params.iter());
5306
5307 params.push("alt", "json");
5308 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5309 if self._scopes.is_empty() {
5310 self._scopes
5311 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5312 }
5313
5314 #[allow(clippy::single_element_loop)]
5315 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5316 url = params.uri_replacement(url, param_name, find_this, true);
5317 }
5318 {
5319 let to_remove = ["name"];
5320 params.remove_params(&to_remove);
5321 }
5322
5323 let url = params.parse_with_url(&url);
5324
5325 loop {
5326 let token = match self
5327 .hub
5328 .auth
5329 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5330 .await
5331 {
5332 Ok(token) => token,
5333 Err(e) => match dlg.token(e) {
5334 Ok(token) => token,
5335 Err(e) => {
5336 dlg.finished(false);
5337 return Err(common::Error::MissingToken(e));
5338 }
5339 },
5340 };
5341 let mut req_result = {
5342 let client = &self.hub.client;
5343 dlg.pre_request();
5344 let mut req_builder = hyper::Request::builder()
5345 .method(hyper::Method::GET)
5346 .uri(url.as_str())
5347 .header(USER_AGENT, self.hub._user_agent.clone());
5348
5349 if let Some(token) = token.as_ref() {
5350 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5351 }
5352
5353 let request = req_builder
5354 .header(CONTENT_LENGTH, 0_u64)
5355 .body(common::to_body::<String>(None));
5356
5357 client.request(request.unwrap()).await
5358 };
5359
5360 match req_result {
5361 Err(err) => {
5362 if let common::Retry::After(d) = dlg.http_error(&err) {
5363 sleep(d).await;
5364 continue;
5365 }
5366 dlg.finished(false);
5367 return Err(common::Error::HttpError(err));
5368 }
5369 Ok(res) => {
5370 let (mut parts, body) = res.into_parts();
5371 let mut body = common::Body::new(body);
5372 if !parts.status.is_success() {
5373 let bytes = common::to_bytes(body).await.unwrap_or_default();
5374 let error = serde_json::from_str(&common::to_string(&bytes));
5375 let response = common::to_response(parts, bytes.into());
5376
5377 if let common::Retry::After(d) =
5378 dlg.http_failure(&response, error.as_ref().ok())
5379 {
5380 sleep(d).await;
5381 continue;
5382 }
5383
5384 dlg.finished(false);
5385
5386 return Err(match error {
5387 Ok(value) => common::Error::BadRequest(value),
5388 _ => common::Error::Failure(response),
5389 });
5390 }
5391 let response = {
5392 let bytes = common::to_bytes(body).await.unwrap_or_default();
5393 let encoded = common::to_string(&bytes);
5394 match serde_json::from_str(&encoded) {
5395 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5396 Err(error) => {
5397 dlg.response_json_decode_error(&encoded, &error);
5398 return Err(common::Error::JsonDecodeError(
5399 encoded.to_string(),
5400 error,
5401 ));
5402 }
5403 }
5404 };
5405
5406 dlg.finished(true);
5407 return Ok(response);
5408 }
5409 }
5410 }
5411 }
5412
5413 /// Required. The name of the package to retrieve.
5414 ///
5415 /// Sets the *name* path property to the given value.
5416 ///
5417 /// Even though the property as already been set when instantiating this call,
5418 /// we provide this method for API completeness.
5419 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
5420 self._name = new_value.to_string();
5421 self
5422 }
5423 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5424 /// while executing the actual API request.
5425 ///
5426 /// ````text
5427 /// It should be used to handle progress information, and to implement a certain level of resilience.
5428 /// ````
5429 ///
5430 /// Sets the *delegate* property to the given value.
5431 pub fn delegate(
5432 mut self,
5433 new_value: &'a mut dyn common::Delegate,
5434 ) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
5435 self._delegate = Some(new_value);
5436 self
5437 }
5438
5439 /// Set any additional parameter of the query string used in the request.
5440 /// It should be used to set parameters which are not yet available through their own
5441 /// setters.
5442 ///
5443 /// Please note that this method must not be used to set any of the known parameters
5444 /// which have their own setter method. If done anyway, the request will fail.
5445 ///
5446 /// # Additional Parameters
5447 ///
5448 /// * *$.xgafv* (query-string) - V1 error format.
5449 /// * *access_token* (query-string) - OAuth access token.
5450 /// * *alt* (query-string) - Data format for response.
5451 /// * *callback* (query-string) - JSONP
5452 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5453 /// * *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.
5454 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5455 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5456 /// * *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.
5457 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5458 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5459 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryPackageGetCall<'a, C>
5460 where
5461 T: AsRef<str>,
5462 {
5463 self._additional_params
5464 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5465 self
5466 }
5467
5468 /// Identifies the authorization scope for the method you are building.
5469 ///
5470 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5471 /// [`Scope::CloudPlatformReadOnly`].
5472 ///
5473 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5474 /// tokens for more than one scope.
5475 ///
5476 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5477 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5478 /// sufficient, a read-write scope will do as well.
5479 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageGetCall<'a, C>
5480 where
5481 St: AsRef<str>,
5482 {
5483 self._scopes.insert(String::from(scope.as_ref()));
5484 self
5485 }
5486 /// Identifies the authorization scope(s) for the method you are building.
5487 ///
5488 /// See [`Self::add_scope()`] for details.
5489 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryPackageGetCall<'a, C>
5490 where
5491 I: IntoIterator<Item = St>,
5492 St: AsRef<str>,
5493 {
5494 self._scopes
5495 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5496 self
5497 }
5498
5499 /// Removes all scopes, and no default scope will be used either.
5500 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5501 /// for details).
5502 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageGetCall<'a, C> {
5503 self._scopes.clear();
5504 self
5505 }
5506}
5507
5508/// Lists packages.
5509///
5510/// A builder for the *locations.repositories.packages.list* method supported by a *project* resource.
5511/// It is not used directly, but through a [`ProjectMethods`] instance.
5512///
5513/// # Example
5514///
5515/// Instantiate a resource method builder
5516///
5517/// ```test_harness,no_run
5518/// # extern crate hyper;
5519/// # extern crate hyper_rustls;
5520/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
5521/// # async fn dox() {
5522/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5523///
5524/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5525/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5526/// # .with_native_roots()
5527/// # .unwrap()
5528/// # .https_only()
5529/// # .enable_http2()
5530/// # .build();
5531///
5532/// # let executor = hyper_util::rt::TokioExecutor::new();
5533/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5534/// # secret,
5535/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5536/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5537/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5538/// # ),
5539/// # ).build().await.unwrap();
5540///
5541/// # let client = hyper_util::client::legacy::Client::builder(
5542/// # hyper_util::rt::TokioExecutor::new()
5543/// # )
5544/// # .build(
5545/// # hyper_rustls::HttpsConnectorBuilder::new()
5546/// # .with_native_roots()
5547/// # .unwrap()
5548/// # .https_or_http()
5549/// # .enable_http2()
5550/// # .build()
5551/// # );
5552/// # let mut hub = ArtifactRegistry::new(client, auth);
5553/// // You can configure optional parameters by calling the respective setters at will, and
5554/// // execute the final call using `doit()`.
5555/// // Values shown here are possibly random and not representative !
5556/// let result = hub.projects().locations_repositories_packages_list("parent")
5557/// .page_token("dolor")
5558/// .page_size(-56)
5559/// .order_by("eos")
5560/// .doit().await;
5561/// # }
5562/// ```
5563pub struct ProjectLocationRepositoryPackageListCall<'a, C>
5564where
5565 C: 'a,
5566{
5567 hub: &'a ArtifactRegistry<C>,
5568 _parent: String,
5569 _page_token: Option<String>,
5570 _page_size: Option<i32>,
5571 _order_by: Option<String>,
5572 _delegate: Option<&'a mut dyn common::Delegate>,
5573 _additional_params: HashMap<String, String>,
5574 _scopes: BTreeSet<String>,
5575}
5576
5577impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPackageListCall<'a, C> {}
5578
5579impl<'a, C> ProjectLocationRepositoryPackageListCall<'a, C>
5580where
5581 C: common::Connector,
5582{
5583 /// Perform the operation you have build so far.
5584 pub async fn doit(mut self) -> common::Result<(common::Response, ListPackagesResponse)> {
5585 use std::borrow::Cow;
5586 use std::io::{Read, Seek};
5587
5588 use common::{url::Params, ToParts};
5589 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5590
5591 let mut dd = common::DefaultDelegate;
5592 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5593 dlg.begin(common::MethodInfo {
5594 id: "artifactregistry.projects.locations.repositories.packages.list",
5595 http_method: hyper::Method::GET,
5596 });
5597
5598 for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy"].iter() {
5599 if self._additional_params.contains_key(field) {
5600 dlg.finished(false);
5601 return Err(common::Error::FieldClash(field));
5602 }
5603 }
5604
5605 let mut params = Params::with_capacity(6 + self._additional_params.len());
5606 params.push("parent", self._parent);
5607 if let Some(value) = self._page_token.as_ref() {
5608 params.push("pageToken", value);
5609 }
5610 if let Some(value) = self._page_size.as_ref() {
5611 params.push("pageSize", value.to_string());
5612 }
5613 if let Some(value) = self._order_by.as_ref() {
5614 params.push("orderBy", value);
5615 }
5616
5617 params.extend(self._additional_params.iter());
5618
5619 params.push("alt", "json");
5620 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/packages";
5621 if self._scopes.is_empty() {
5622 self._scopes
5623 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5624 }
5625
5626 #[allow(clippy::single_element_loop)]
5627 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5628 url = params.uri_replacement(url, param_name, find_this, true);
5629 }
5630 {
5631 let to_remove = ["parent"];
5632 params.remove_params(&to_remove);
5633 }
5634
5635 let url = params.parse_with_url(&url);
5636
5637 loop {
5638 let token = match self
5639 .hub
5640 .auth
5641 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5642 .await
5643 {
5644 Ok(token) => token,
5645 Err(e) => match dlg.token(e) {
5646 Ok(token) => token,
5647 Err(e) => {
5648 dlg.finished(false);
5649 return Err(common::Error::MissingToken(e));
5650 }
5651 },
5652 };
5653 let mut req_result = {
5654 let client = &self.hub.client;
5655 dlg.pre_request();
5656 let mut req_builder = hyper::Request::builder()
5657 .method(hyper::Method::GET)
5658 .uri(url.as_str())
5659 .header(USER_AGENT, self.hub._user_agent.clone());
5660
5661 if let Some(token) = token.as_ref() {
5662 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5663 }
5664
5665 let request = req_builder
5666 .header(CONTENT_LENGTH, 0_u64)
5667 .body(common::to_body::<String>(None));
5668
5669 client.request(request.unwrap()).await
5670 };
5671
5672 match req_result {
5673 Err(err) => {
5674 if let common::Retry::After(d) = dlg.http_error(&err) {
5675 sleep(d).await;
5676 continue;
5677 }
5678 dlg.finished(false);
5679 return Err(common::Error::HttpError(err));
5680 }
5681 Ok(res) => {
5682 let (mut parts, body) = res.into_parts();
5683 let mut body = common::Body::new(body);
5684 if !parts.status.is_success() {
5685 let bytes = common::to_bytes(body).await.unwrap_or_default();
5686 let error = serde_json::from_str(&common::to_string(&bytes));
5687 let response = common::to_response(parts, bytes.into());
5688
5689 if let common::Retry::After(d) =
5690 dlg.http_failure(&response, error.as_ref().ok())
5691 {
5692 sleep(d).await;
5693 continue;
5694 }
5695
5696 dlg.finished(false);
5697
5698 return Err(match error {
5699 Ok(value) => common::Error::BadRequest(value),
5700 _ => common::Error::Failure(response),
5701 });
5702 }
5703 let response = {
5704 let bytes = common::to_bytes(body).await.unwrap_or_default();
5705 let encoded = common::to_string(&bytes);
5706 match serde_json::from_str(&encoded) {
5707 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5708 Err(error) => {
5709 dlg.response_json_decode_error(&encoded, &error);
5710 return Err(common::Error::JsonDecodeError(
5711 encoded.to_string(),
5712 error,
5713 ));
5714 }
5715 }
5716 };
5717
5718 dlg.finished(true);
5719 return Ok(response);
5720 }
5721 }
5722 }
5723 }
5724
5725 /// Required. The name of the parent resource whose packages will be listed.
5726 ///
5727 /// Sets the *parent* path property to the given value.
5728 ///
5729 /// Even though the property as already been set when instantiating this call,
5730 /// we provide this method for API completeness.
5731 pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryPackageListCall<'a, C> {
5732 self._parent = new_value.to_string();
5733 self
5734 }
5735 /// The next_page_token value returned from a previous list request, if any.
5736 ///
5737 /// Sets the *page token* query property to the given value.
5738 pub fn page_token(
5739 mut self,
5740 new_value: &str,
5741 ) -> ProjectLocationRepositoryPackageListCall<'a, C> {
5742 self._page_token = Some(new_value.to_string());
5743 self
5744 }
5745 /// The maximum number of packages to return. Maximum page size is 1,000.
5746 ///
5747 /// Sets the *page size* query property to the given value.
5748 pub fn page_size(mut self, new_value: i32) -> ProjectLocationRepositoryPackageListCall<'a, C> {
5749 self._page_size = Some(new_value);
5750 self
5751 }
5752 /// Optional. The field to order the results by.
5753 ///
5754 /// Sets the *order by* query property to the given value.
5755 pub fn order_by(mut self, new_value: &str) -> ProjectLocationRepositoryPackageListCall<'a, C> {
5756 self._order_by = Some(new_value.to_string());
5757 self
5758 }
5759 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5760 /// while executing the actual API request.
5761 ///
5762 /// ````text
5763 /// It should be used to handle progress information, and to implement a certain level of resilience.
5764 /// ````
5765 ///
5766 /// Sets the *delegate* property to the given value.
5767 pub fn delegate(
5768 mut self,
5769 new_value: &'a mut dyn common::Delegate,
5770 ) -> ProjectLocationRepositoryPackageListCall<'a, C> {
5771 self._delegate = Some(new_value);
5772 self
5773 }
5774
5775 /// Set any additional parameter of the query string used in the request.
5776 /// It should be used to set parameters which are not yet available through their own
5777 /// setters.
5778 ///
5779 /// Please note that this method must not be used to set any of the known parameters
5780 /// which have their own setter method. If done anyway, the request will fail.
5781 ///
5782 /// # Additional Parameters
5783 ///
5784 /// * *$.xgafv* (query-string) - V1 error format.
5785 /// * *access_token* (query-string) - OAuth access token.
5786 /// * *alt* (query-string) - Data format for response.
5787 /// * *callback* (query-string) - JSONP
5788 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5789 /// * *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.
5790 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5791 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5792 /// * *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.
5793 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5794 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5795 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryPackageListCall<'a, C>
5796 where
5797 T: AsRef<str>,
5798 {
5799 self._additional_params
5800 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5801 self
5802 }
5803
5804 /// Identifies the authorization scope for the method you are building.
5805 ///
5806 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5807 /// [`Scope::CloudPlatformReadOnly`].
5808 ///
5809 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5810 /// tokens for more than one scope.
5811 ///
5812 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5813 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5814 /// sufficient, a read-write scope will do as well.
5815 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPackageListCall<'a, C>
5816 where
5817 St: AsRef<str>,
5818 {
5819 self._scopes.insert(String::from(scope.as_ref()));
5820 self
5821 }
5822 /// Identifies the authorization scope(s) for the method you are building.
5823 ///
5824 /// See [`Self::add_scope()`] for details.
5825 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryPackageListCall<'a, C>
5826 where
5827 I: IntoIterator<Item = St>,
5828 St: AsRef<str>,
5829 {
5830 self._scopes
5831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5832 self
5833 }
5834
5835 /// Removes all scopes, and no default scope will be used either.
5836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5837 /// for details).
5838 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPackageListCall<'a, C> {
5839 self._scopes.clear();
5840 self
5841 }
5842}
5843
5844/// Creates a repository. The returned Operation will finish once the repository has been created. Its response will be the created Repository.
5845///
5846/// A builder for the *locations.repositories.create* method supported by a *project* resource.
5847/// It is not used directly, but through a [`ProjectMethods`] instance.
5848///
5849/// # Example
5850///
5851/// Instantiate a resource method builder
5852///
5853/// ```test_harness,no_run
5854/// # extern crate hyper;
5855/// # extern crate hyper_rustls;
5856/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
5857/// use artifactregistry1_beta1::api::Repository;
5858/// # async fn dox() {
5859/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5860///
5861/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5862/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5863/// # .with_native_roots()
5864/// # .unwrap()
5865/// # .https_only()
5866/// # .enable_http2()
5867/// # .build();
5868///
5869/// # let executor = hyper_util::rt::TokioExecutor::new();
5870/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5871/// # secret,
5872/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5873/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5874/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5875/// # ),
5876/// # ).build().await.unwrap();
5877///
5878/// # let client = hyper_util::client::legacy::Client::builder(
5879/// # hyper_util::rt::TokioExecutor::new()
5880/// # )
5881/// # .build(
5882/// # hyper_rustls::HttpsConnectorBuilder::new()
5883/// # .with_native_roots()
5884/// # .unwrap()
5885/// # .https_or_http()
5886/// # .enable_http2()
5887/// # .build()
5888/// # );
5889/// # let mut hub = ArtifactRegistry::new(client, auth);
5890/// // As the method needs a request, you would usually fill it with the desired information
5891/// // into the respective structure. Some of the parts shown here might not be applicable !
5892/// // Values shown here are possibly random and not representative !
5893/// let mut req = Repository::default();
5894///
5895/// // You can configure optional parameters by calling the respective setters at will, and
5896/// // execute the final call using `doit()`.
5897/// // Values shown here are possibly random and not representative !
5898/// let result = hub.projects().locations_repositories_create(req, "parent")
5899/// .repository_id("sed")
5900/// .doit().await;
5901/// # }
5902/// ```
5903pub struct ProjectLocationRepositoryCreateCall<'a, C>
5904where
5905 C: 'a,
5906{
5907 hub: &'a ArtifactRegistry<C>,
5908 _request: Repository,
5909 _parent: String,
5910 _repository_id: Option<String>,
5911 _delegate: Option<&'a mut dyn common::Delegate>,
5912 _additional_params: HashMap<String, String>,
5913 _scopes: BTreeSet<String>,
5914}
5915
5916impl<'a, C> common::CallBuilder for ProjectLocationRepositoryCreateCall<'a, C> {}
5917
5918impl<'a, C> ProjectLocationRepositoryCreateCall<'a, C>
5919where
5920 C: common::Connector,
5921{
5922 /// Perform the operation you have build so far.
5923 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5924 use std::borrow::Cow;
5925 use std::io::{Read, Seek};
5926
5927 use common::{url::Params, ToParts};
5928 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5929
5930 let mut dd = common::DefaultDelegate;
5931 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5932 dlg.begin(common::MethodInfo {
5933 id: "artifactregistry.projects.locations.repositories.create",
5934 http_method: hyper::Method::POST,
5935 });
5936
5937 for &field in ["alt", "parent", "repositoryId"].iter() {
5938 if self._additional_params.contains_key(field) {
5939 dlg.finished(false);
5940 return Err(common::Error::FieldClash(field));
5941 }
5942 }
5943
5944 let mut params = Params::with_capacity(5 + self._additional_params.len());
5945 params.push("parent", self._parent);
5946 if let Some(value) = self._repository_id.as_ref() {
5947 params.push("repositoryId", value);
5948 }
5949
5950 params.extend(self._additional_params.iter());
5951
5952 params.push("alt", "json");
5953 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/repositories";
5954 if self._scopes.is_empty() {
5955 self._scopes
5956 .insert(Scope::CloudPlatform.as_ref().to_string());
5957 }
5958
5959 #[allow(clippy::single_element_loop)]
5960 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5961 url = params.uri_replacement(url, param_name, find_this, true);
5962 }
5963 {
5964 let to_remove = ["parent"];
5965 params.remove_params(&to_remove);
5966 }
5967
5968 let url = params.parse_with_url(&url);
5969
5970 let mut json_mime_type = mime::APPLICATION_JSON;
5971 let mut request_value_reader = {
5972 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5973 common::remove_json_null_values(&mut value);
5974 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5975 serde_json::to_writer(&mut dst, &value).unwrap();
5976 dst
5977 };
5978 let request_size = request_value_reader
5979 .seek(std::io::SeekFrom::End(0))
5980 .unwrap();
5981 request_value_reader
5982 .seek(std::io::SeekFrom::Start(0))
5983 .unwrap();
5984
5985 loop {
5986 let token = match self
5987 .hub
5988 .auth
5989 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5990 .await
5991 {
5992 Ok(token) => token,
5993 Err(e) => match dlg.token(e) {
5994 Ok(token) => token,
5995 Err(e) => {
5996 dlg.finished(false);
5997 return Err(common::Error::MissingToken(e));
5998 }
5999 },
6000 };
6001 request_value_reader
6002 .seek(std::io::SeekFrom::Start(0))
6003 .unwrap();
6004 let mut req_result = {
6005 let client = &self.hub.client;
6006 dlg.pre_request();
6007 let mut req_builder = hyper::Request::builder()
6008 .method(hyper::Method::POST)
6009 .uri(url.as_str())
6010 .header(USER_AGENT, self.hub._user_agent.clone());
6011
6012 if let Some(token) = token.as_ref() {
6013 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6014 }
6015
6016 let request = req_builder
6017 .header(CONTENT_TYPE, json_mime_type.to_string())
6018 .header(CONTENT_LENGTH, request_size as u64)
6019 .body(common::to_body(
6020 request_value_reader.get_ref().clone().into(),
6021 ));
6022
6023 client.request(request.unwrap()).await
6024 };
6025
6026 match req_result {
6027 Err(err) => {
6028 if let common::Retry::After(d) = dlg.http_error(&err) {
6029 sleep(d).await;
6030 continue;
6031 }
6032 dlg.finished(false);
6033 return Err(common::Error::HttpError(err));
6034 }
6035 Ok(res) => {
6036 let (mut parts, body) = res.into_parts();
6037 let mut body = common::Body::new(body);
6038 if !parts.status.is_success() {
6039 let bytes = common::to_bytes(body).await.unwrap_or_default();
6040 let error = serde_json::from_str(&common::to_string(&bytes));
6041 let response = common::to_response(parts, bytes.into());
6042
6043 if let common::Retry::After(d) =
6044 dlg.http_failure(&response, error.as_ref().ok())
6045 {
6046 sleep(d).await;
6047 continue;
6048 }
6049
6050 dlg.finished(false);
6051
6052 return Err(match error {
6053 Ok(value) => common::Error::BadRequest(value),
6054 _ => common::Error::Failure(response),
6055 });
6056 }
6057 let response = {
6058 let bytes = common::to_bytes(body).await.unwrap_or_default();
6059 let encoded = common::to_string(&bytes);
6060 match serde_json::from_str(&encoded) {
6061 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6062 Err(error) => {
6063 dlg.response_json_decode_error(&encoded, &error);
6064 return Err(common::Error::JsonDecodeError(
6065 encoded.to_string(),
6066 error,
6067 ));
6068 }
6069 }
6070 };
6071
6072 dlg.finished(true);
6073 return Ok(response);
6074 }
6075 }
6076 }
6077 }
6078
6079 ///
6080 /// Sets the *request* property to the given value.
6081 ///
6082 /// Even though the property as already been set when instantiating this call,
6083 /// we provide this method for API completeness.
6084 pub fn request(mut self, new_value: Repository) -> ProjectLocationRepositoryCreateCall<'a, C> {
6085 self._request = new_value;
6086 self
6087 }
6088 /// Required. The name of the parent resource where the repository will be created.
6089 ///
6090 /// Sets the *parent* path property to the given value.
6091 ///
6092 /// Even though the property as already been set when instantiating this call,
6093 /// we provide this method for API completeness.
6094 pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryCreateCall<'a, C> {
6095 self._parent = new_value.to_string();
6096 self
6097 }
6098 /// Required. The repository id to use for this repository.
6099 ///
6100 /// Sets the *repository id* query property to the given value.
6101 pub fn repository_id(mut self, new_value: &str) -> ProjectLocationRepositoryCreateCall<'a, C> {
6102 self._repository_id = Some(new_value.to_string());
6103 self
6104 }
6105 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6106 /// while executing the actual API request.
6107 ///
6108 /// ````text
6109 /// It should be used to handle progress information, and to implement a certain level of resilience.
6110 /// ````
6111 ///
6112 /// Sets the *delegate* property to the given value.
6113 pub fn delegate(
6114 mut self,
6115 new_value: &'a mut dyn common::Delegate,
6116 ) -> ProjectLocationRepositoryCreateCall<'a, C> {
6117 self._delegate = Some(new_value);
6118 self
6119 }
6120
6121 /// Set any additional parameter of the query string used in the request.
6122 /// It should be used to set parameters which are not yet available through their own
6123 /// setters.
6124 ///
6125 /// Please note that this method must not be used to set any of the known parameters
6126 /// which have their own setter method. If done anyway, the request will fail.
6127 ///
6128 /// # Additional Parameters
6129 ///
6130 /// * *$.xgafv* (query-string) - V1 error format.
6131 /// * *access_token* (query-string) - OAuth access token.
6132 /// * *alt* (query-string) - Data format for response.
6133 /// * *callback* (query-string) - JSONP
6134 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6135 /// * *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.
6136 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6137 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6138 /// * *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.
6139 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6140 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6141 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryCreateCall<'a, C>
6142 where
6143 T: AsRef<str>,
6144 {
6145 self._additional_params
6146 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6147 self
6148 }
6149
6150 /// Identifies the authorization scope for the method you are building.
6151 ///
6152 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6153 /// [`Scope::CloudPlatform`].
6154 ///
6155 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6156 /// tokens for more than one scope.
6157 ///
6158 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6159 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6160 /// sufficient, a read-write scope will do as well.
6161 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryCreateCall<'a, C>
6162 where
6163 St: AsRef<str>,
6164 {
6165 self._scopes.insert(String::from(scope.as_ref()));
6166 self
6167 }
6168 /// Identifies the authorization scope(s) for the method you are building.
6169 ///
6170 /// See [`Self::add_scope()`] for details.
6171 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryCreateCall<'a, C>
6172 where
6173 I: IntoIterator<Item = St>,
6174 St: AsRef<str>,
6175 {
6176 self._scopes
6177 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6178 self
6179 }
6180
6181 /// Removes all scopes, and no default scope will be used either.
6182 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6183 /// for details).
6184 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryCreateCall<'a, C> {
6185 self._scopes.clear();
6186 self
6187 }
6188}
6189
6190/// 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.
6191///
6192/// A builder for the *locations.repositories.delete* method supported by a *project* resource.
6193/// It is not used directly, but through a [`ProjectMethods`] instance.
6194///
6195/// # Example
6196///
6197/// Instantiate a resource method builder
6198///
6199/// ```test_harness,no_run
6200/// # extern crate hyper;
6201/// # extern crate hyper_rustls;
6202/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
6203/// # async fn dox() {
6204/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6205///
6206/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6207/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6208/// # .with_native_roots()
6209/// # .unwrap()
6210/// # .https_only()
6211/// # .enable_http2()
6212/// # .build();
6213///
6214/// # let executor = hyper_util::rt::TokioExecutor::new();
6215/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6216/// # secret,
6217/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6218/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6219/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6220/// # ),
6221/// # ).build().await.unwrap();
6222///
6223/// # let client = hyper_util::client::legacy::Client::builder(
6224/// # hyper_util::rt::TokioExecutor::new()
6225/// # )
6226/// # .build(
6227/// # hyper_rustls::HttpsConnectorBuilder::new()
6228/// # .with_native_roots()
6229/// # .unwrap()
6230/// # .https_or_http()
6231/// # .enable_http2()
6232/// # .build()
6233/// # );
6234/// # let mut hub = ArtifactRegistry::new(client, auth);
6235/// // You can configure optional parameters by calling the respective setters at will, and
6236/// // execute the final call using `doit()`.
6237/// // Values shown here are possibly random and not representative !
6238/// let result = hub.projects().locations_repositories_delete("name")
6239/// .doit().await;
6240/// # }
6241/// ```
6242pub struct ProjectLocationRepositoryDeleteCall<'a, C>
6243where
6244 C: 'a,
6245{
6246 hub: &'a ArtifactRegistry<C>,
6247 _name: String,
6248 _delegate: Option<&'a mut dyn common::Delegate>,
6249 _additional_params: HashMap<String, String>,
6250 _scopes: BTreeSet<String>,
6251}
6252
6253impl<'a, C> common::CallBuilder for ProjectLocationRepositoryDeleteCall<'a, C> {}
6254
6255impl<'a, C> ProjectLocationRepositoryDeleteCall<'a, C>
6256where
6257 C: common::Connector,
6258{
6259 /// Perform the operation you have build so far.
6260 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6261 use std::borrow::Cow;
6262 use std::io::{Read, Seek};
6263
6264 use common::{url::Params, ToParts};
6265 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6266
6267 let mut dd = common::DefaultDelegate;
6268 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6269 dlg.begin(common::MethodInfo {
6270 id: "artifactregistry.projects.locations.repositories.delete",
6271 http_method: hyper::Method::DELETE,
6272 });
6273
6274 for &field in ["alt", "name"].iter() {
6275 if self._additional_params.contains_key(field) {
6276 dlg.finished(false);
6277 return Err(common::Error::FieldClash(field));
6278 }
6279 }
6280
6281 let mut params = Params::with_capacity(3 + self._additional_params.len());
6282 params.push("name", self._name);
6283
6284 params.extend(self._additional_params.iter());
6285
6286 params.push("alt", "json");
6287 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6288 if self._scopes.is_empty() {
6289 self._scopes
6290 .insert(Scope::CloudPlatform.as_ref().to_string());
6291 }
6292
6293 #[allow(clippy::single_element_loop)]
6294 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6295 url = params.uri_replacement(url, param_name, find_this, true);
6296 }
6297 {
6298 let to_remove = ["name"];
6299 params.remove_params(&to_remove);
6300 }
6301
6302 let url = params.parse_with_url(&url);
6303
6304 loop {
6305 let token = match self
6306 .hub
6307 .auth
6308 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6309 .await
6310 {
6311 Ok(token) => token,
6312 Err(e) => match dlg.token(e) {
6313 Ok(token) => token,
6314 Err(e) => {
6315 dlg.finished(false);
6316 return Err(common::Error::MissingToken(e));
6317 }
6318 },
6319 };
6320 let mut req_result = {
6321 let client = &self.hub.client;
6322 dlg.pre_request();
6323 let mut req_builder = hyper::Request::builder()
6324 .method(hyper::Method::DELETE)
6325 .uri(url.as_str())
6326 .header(USER_AGENT, self.hub._user_agent.clone());
6327
6328 if let Some(token) = token.as_ref() {
6329 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6330 }
6331
6332 let request = req_builder
6333 .header(CONTENT_LENGTH, 0_u64)
6334 .body(common::to_body::<String>(None));
6335
6336 client.request(request.unwrap()).await
6337 };
6338
6339 match req_result {
6340 Err(err) => {
6341 if let common::Retry::After(d) = dlg.http_error(&err) {
6342 sleep(d).await;
6343 continue;
6344 }
6345 dlg.finished(false);
6346 return Err(common::Error::HttpError(err));
6347 }
6348 Ok(res) => {
6349 let (mut parts, body) = res.into_parts();
6350 let mut body = common::Body::new(body);
6351 if !parts.status.is_success() {
6352 let bytes = common::to_bytes(body).await.unwrap_or_default();
6353 let error = serde_json::from_str(&common::to_string(&bytes));
6354 let response = common::to_response(parts, bytes.into());
6355
6356 if let common::Retry::After(d) =
6357 dlg.http_failure(&response, error.as_ref().ok())
6358 {
6359 sleep(d).await;
6360 continue;
6361 }
6362
6363 dlg.finished(false);
6364
6365 return Err(match error {
6366 Ok(value) => common::Error::BadRequest(value),
6367 _ => common::Error::Failure(response),
6368 });
6369 }
6370 let response = {
6371 let bytes = common::to_bytes(body).await.unwrap_or_default();
6372 let encoded = common::to_string(&bytes);
6373 match serde_json::from_str(&encoded) {
6374 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6375 Err(error) => {
6376 dlg.response_json_decode_error(&encoded, &error);
6377 return Err(common::Error::JsonDecodeError(
6378 encoded.to_string(),
6379 error,
6380 ));
6381 }
6382 }
6383 };
6384
6385 dlg.finished(true);
6386 return Ok(response);
6387 }
6388 }
6389 }
6390 }
6391
6392 /// Required. The name of the repository to delete.
6393 ///
6394 /// Sets the *name* path property to the given value.
6395 ///
6396 /// Even though the property as already been set when instantiating this call,
6397 /// we provide this method for API completeness.
6398 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryDeleteCall<'a, C> {
6399 self._name = new_value.to_string();
6400 self
6401 }
6402 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6403 /// while executing the actual API request.
6404 ///
6405 /// ````text
6406 /// It should be used to handle progress information, and to implement a certain level of resilience.
6407 /// ````
6408 ///
6409 /// Sets the *delegate* property to the given value.
6410 pub fn delegate(
6411 mut self,
6412 new_value: &'a mut dyn common::Delegate,
6413 ) -> ProjectLocationRepositoryDeleteCall<'a, C> {
6414 self._delegate = Some(new_value);
6415 self
6416 }
6417
6418 /// Set any additional parameter of the query string used in the request.
6419 /// It should be used to set parameters which are not yet available through their own
6420 /// setters.
6421 ///
6422 /// Please note that this method must not be used to set any of the known parameters
6423 /// which have their own setter method. If done anyway, the request will fail.
6424 ///
6425 /// # Additional Parameters
6426 ///
6427 /// * *$.xgafv* (query-string) - V1 error format.
6428 /// * *access_token* (query-string) - OAuth access token.
6429 /// * *alt* (query-string) - Data format for response.
6430 /// * *callback* (query-string) - JSONP
6431 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6432 /// * *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.
6433 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6434 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6435 /// * *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.
6436 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6437 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6438 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryDeleteCall<'a, C>
6439 where
6440 T: AsRef<str>,
6441 {
6442 self._additional_params
6443 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6444 self
6445 }
6446
6447 /// Identifies the authorization scope for the method you are building.
6448 ///
6449 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6450 /// [`Scope::CloudPlatform`].
6451 ///
6452 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6453 /// tokens for more than one scope.
6454 ///
6455 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6456 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6457 /// sufficient, a read-write scope will do as well.
6458 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryDeleteCall<'a, C>
6459 where
6460 St: AsRef<str>,
6461 {
6462 self._scopes.insert(String::from(scope.as_ref()));
6463 self
6464 }
6465 /// Identifies the authorization scope(s) for the method you are building.
6466 ///
6467 /// See [`Self::add_scope()`] for details.
6468 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryDeleteCall<'a, C>
6469 where
6470 I: IntoIterator<Item = St>,
6471 St: AsRef<str>,
6472 {
6473 self._scopes
6474 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6475 self
6476 }
6477
6478 /// Removes all scopes, and no default scope will be used either.
6479 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6480 /// for details).
6481 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryDeleteCall<'a, C> {
6482 self._scopes.clear();
6483 self
6484 }
6485}
6486
6487/// Gets a repository.
6488///
6489/// A builder for the *locations.repositories.get* method supported by a *project* resource.
6490/// It is not used directly, but through a [`ProjectMethods`] instance.
6491///
6492/// # Example
6493///
6494/// Instantiate a resource method builder
6495///
6496/// ```test_harness,no_run
6497/// # extern crate hyper;
6498/// # extern crate hyper_rustls;
6499/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
6500/// # async fn dox() {
6501/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6502///
6503/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6504/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6505/// # .with_native_roots()
6506/// # .unwrap()
6507/// # .https_only()
6508/// # .enable_http2()
6509/// # .build();
6510///
6511/// # let executor = hyper_util::rt::TokioExecutor::new();
6512/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6513/// # secret,
6514/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6515/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6516/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6517/// # ),
6518/// # ).build().await.unwrap();
6519///
6520/// # let client = hyper_util::client::legacy::Client::builder(
6521/// # hyper_util::rt::TokioExecutor::new()
6522/// # )
6523/// # .build(
6524/// # hyper_rustls::HttpsConnectorBuilder::new()
6525/// # .with_native_roots()
6526/// # .unwrap()
6527/// # .https_or_http()
6528/// # .enable_http2()
6529/// # .build()
6530/// # );
6531/// # let mut hub = ArtifactRegistry::new(client, auth);
6532/// // You can configure optional parameters by calling the respective setters at will, and
6533/// // execute the final call using `doit()`.
6534/// // Values shown here are possibly random and not representative !
6535/// let result = hub.projects().locations_repositories_get("name")
6536/// .doit().await;
6537/// # }
6538/// ```
6539pub struct ProjectLocationRepositoryGetCall<'a, C>
6540where
6541 C: 'a,
6542{
6543 hub: &'a ArtifactRegistry<C>,
6544 _name: String,
6545 _delegate: Option<&'a mut dyn common::Delegate>,
6546 _additional_params: HashMap<String, String>,
6547 _scopes: BTreeSet<String>,
6548}
6549
6550impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGetCall<'a, C> {}
6551
6552impl<'a, C> ProjectLocationRepositoryGetCall<'a, C>
6553where
6554 C: common::Connector,
6555{
6556 /// Perform the operation you have build so far.
6557 pub async fn doit(mut self) -> common::Result<(common::Response, Repository)> {
6558 use std::borrow::Cow;
6559 use std::io::{Read, Seek};
6560
6561 use common::{url::Params, ToParts};
6562 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6563
6564 let mut dd = common::DefaultDelegate;
6565 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6566 dlg.begin(common::MethodInfo {
6567 id: "artifactregistry.projects.locations.repositories.get",
6568 http_method: hyper::Method::GET,
6569 });
6570
6571 for &field in ["alt", "name"].iter() {
6572 if self._additional_params.contains_key(field) {
6573 dlg.finished(false);
6574 return Err(common::Error::FieldClash(field));
6575 }
6576 }
6577
6578 let mut params = Params::with_capacity(3 + self._additional_params.len());
6579 params.push("name", self._name);
6580
6581 params.extend(self._additional_params.iter());
6582
6583 params.push("alt", "json");
6584 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6585 if self._scopes.is_empty() {
6586 self._scopes
6587 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6588 }
6589
6590 #[allow(clippy::single_element_loop)]
6591 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6592 url = params.uri_replacement(url, param_name, find_this, true);
6593 }
6594 {
6595 let to_remove = ["name"];
6596 params.remove_params(&to_remove);
6597 }
6598
6599 let url = params.parse_with_url(&url);
6600
6601 loop {
6602 let token = match self
6603 .hub
6604 .auth
6605 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6606 .await
6607 {
6608 Ok(token) => token,
6609 Err(e) => match dlg.token(e) {
6610 Ok(token) => token,
6611 Err(e) => {
6612 dlg.finished(false);
6613 return Err(common::Error::MissingToken(e));
6614 }
6615 },
6616 };
6617 let mut req_result = {
6618 let client = &self.hub.client;
6619 dlg.pre_request();
6620 let mut req_builder = hyper::Request::builder()
6621 .method(hyper::Method::GET)
6622 .uri(url.as_str())
6623 .header(USER_AGENT, self.hub._user_agent.clone());
6624
6625 if let Some(token) = token.as_ref() {
6626 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6627 }
6628
6629 let request = req_builder
6630 .header(CONTENT_LENGTH, 0_u64)
6631 .body(common::to_body::<String>(None));
6632
6633 client.request(request.unwrap()).await
6634 };
6635
6636 match req_result {
6637 Err(err) => {
6638 if let common::Retry::After(d) = dlg.http_error(&err) {
6639 sleep(d).await;
6640 continue;
6641 }
6642 dlg.finished(false);
6643 return Err(common::Error::HttpError(err));
6644 }
6645 Ok(res) => {
6646 let (mut parts, body) = res.into_parts();
6647 let mut body = common::Body::new(body);
6648 if !parts.status.is_success() {
6649 let bytes = common::to_bytes(body).await.unwrap_or_default();
6650 let error = serde_json::from_str(&common::to_string(&bytes));
6651 let response = common::to_response(parts, bytes.into());
6652
6653 if let common::Retry::After(d) =
6654 dlg.http_failure(&response, error.as_ref().ok())
6655 {
6656 sleep(d).await;
6657 continue;
6658 }
6659
6660 dlg.finished(false);
6661
6662 return Err(match error {
6663 Ok(value) => common::Error::BadRequest(value),
6664 _ => common::Error::Failure(response),
6665 });
6666 }
6667 let response = {
6668 let bytes = common::to_bytes(body).await.unwrap_or_default();
6669 let encoded = common::to_string(&bytes);
6670 match serde_json::from_str(&encoded) {
6671 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6672 Err(error) => {
6673 dlg.response_json_decode_error(&encoded, &error);
6674 return Err(common::Error::JsonDecodeError(
6675 encoded.to_string(),
6676 error,
6677 ));
6678 }
6679 }
6680 };
6681
6682 dlg.finished(true);
6683 return Ok(response);
6684 }
6685 }
6686 }
6687 }
6688
6689 /// Required. The name of the repository to retrieve.
6690 ///
6691 /// Sets the *name* path property to the given value.
6692 ///
6693 /// Even though the property as already been set when instantiating this call,
6694 /// we provide this method for API completeness.
6695 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryGetCall<'a, C> {
6696 self._name = new_value.to_string();
6697 self
6698 }
6699 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6700 /// while executing the actual API request.
6701 ///
6702 /// ````text
6703 /// It should be used to handle progress information, and to implement a certain level of resilience.
6704 /// ````
6705 ///
6706 /// Sets the *delegate* property to the given value.
6707 pub fn delegate(
6708 mut self,
6709 new_value: &'a mut dyn common::Delegate,
6710 ) -> ProjectLocationRepositoryGetCall<'a, C> {
6711 self._delegate = Some(new_value);
6712 self
6713 }
6714
6715 /// Set any additional parameter of the query string used in the request.
6716 /// It should be used to set parameters which are not yet available through their own
6717 /// setters.
6718 ///
6719 /// Please note that this method must not be used to set any of the known parameters
6720 /// which have their own setter method. If done anyway, the request will fail.
6721 ///
6722 /// # Additional Parameters
6723 ///
6724 /// * *$.xgafv* (query-string) - V1 error format.
6725 /// * *access_token* (query-string) - OAuth access token.
6726 /// * *alt* (query-string) - Data format for response.
6727 /// * *callback* (query-string) - JSONP
6728 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6729 /// * *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.
6730 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6731 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6732 /// * *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.
6733 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6734 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6735 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryGetCall<'a, C>
6736 where
6737 T: AsRef<str>,
6738 {
6739 self._additional_params
6740 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6741 self
6742 }
6743
6744 /// Identifies the authorization scope for the method you are building.
6745 ///
6746 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6747 /// [`Scope::CloudPlatformReadOnly`].
6748 ///
6749 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6750 /// tokens for more than one scope.
6751 ///
6752 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6753 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6754 /// sufficient, a read-write scope will do as well.
6755 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryGetCall<'a, C>
6756 where
6757 St: AsRef<str>,
6758 {
6759 self._scopes.insert(String::from(scope.as_ref()));
6760 self
6761 }
6762 /// Identifies the authorization scope(s) for the method you are building.
6763 ///
6764 /// See [`Self::add_scope()`] for details.
6765 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryGetCall<'a, C>
6766 where
6767 I: IntoIterator<Item = St>,
6768 St: AsRef<str>,
6769 {
6770 self._scopes
6771 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6772 self
6773 }
6774
6775 /// Removes all scopes, and no default scope will be used either.
6776 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6777 /// for details).
6778 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGetCall<'a, C> {
6779 self._scopes.clear();
6780 self
6781 }
6782}
6783
6784/// Gets the IAM policy for a given resource.
6785///
6786/// A builder for the *locations.repositories.getIamPolicy* method supported by a *project* resource.
6787/// It is not used directly, but through a [`ProjectMethods`] instance.
6788///
6789/// # Example
6790///
6791/// Instantiate a resource method builder
6792///
6793/// ```test_harness,no_run
6794/// # extern crate hyper;
6795/// # extern crate hyper_rustls;
6796/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
6797/// # async fn dox() {
6798/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6799///
6800/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6801/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6802/// # .with_native_roots()
6803/// # .unwrap()
6804/// # .https_only()
6805/// # .enable_http2()
6806/// # .build();
6807///
6808/// # let executor = hyper_util::rt::TokioExecutor::new();
6809/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6810/// # secret,
6811/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6812/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6813/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6814/// # ),
6815/// # ).build().await.unwrap();
6816///
6817/// # let client = hyper_util::client::legacy::Client::builder(
6818/// # hyper_util::rt::TokioExecutor::new()
6819/// # )
6820/// # .build(
6821/// # hyper_rustls::HttpsConnectorBuilder::new()
6822/// # .with_native_roots()
6823/// # .unwrap()
6824/// # .https_or_http()
6825/// # .enable_http2()
6826/// # .build()
6827/// # );
6828/// # let mut hub = ArtifactRegistry::new(client, auth);
6829/// // You can configure optional parameters by calling the respective setters at will, and
6830/// // execute the final call using `doit()`.
6831/// // Values shown here are possibly random and not representative !
6832/// let result = hub.projects().locations_repositories_get_iam_policy("resource")
6833/// .options_requested_policy_version(-15)
6834/// .doit().await;
6835/// # }
6836/// ```
6837pub struct ProjectLocationRepositoryGetIamPolicyCall<'a, C>
6838where
6839 C: 'a,
6840{
6841 hub: &'a ArtifactRegistry<C>,
6842 _resource: String,
6843 _options_requested_policy_version: Option<i32>,
6844 _delegate: Option<&'a mut dyn common::Delegate>,
6845 _additional_params: HashMap<String, String>,
6846 _scopes: BTreeSet<String>,
6847}
6848
6849impl<'a, C> common::CallBuilder for ProjectLocationRepositoryGetIamPolicyCall<'a, C> {}
6850
6851impl<'a, C> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
6852where
6853 C: common::Connector,
6854{
6855 /// Perform the operation you have build so far.
6856 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6857 use std::borrow::Cow;
6858 use std::io::{Read, Seek};
6859
6860 use common::{url::Params, ToParts};
6861 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6862
6863 let mut dd = common::DefaultDelegate;
6864 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6865 dlg.begin(common::MethodInfo {
6866 id: "artifactregistry.projects.locations.repositories.getIamPolicy",
6867 http_method: hyper::Method::GET,
6868 });
6869
6870 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
6871 if self._additional_params.contains_key(field) {
6872 dlg.finished(false);
6873 return Err(common::Error::FieldClash(field));
6874 }
6875 }
6876
6877 let mut params = Params::with_capacity(4 + self._additional_params.len());
6878 params.push("resource", self._resource);
6879 if let Some(value) = self._options_requested_policy_version.as_ref() {
6880 params.push("options.requestedPolicyVersion", value.to_string());
6881 }
6882
6883 params.extend(self._additional_params.iter());
6884
6885 params.push("alt", "json");
6886 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
6887 if self._scopes.is_empty() {
6888 self._scopes
6889 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6890 }
6891
6892 #[allow(clippy::single_element_loop)]
6893 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6894 url = params.uri_replacement(url, param_name, find_this, true);
6895 }
6896 {
6897 let to_remove = ["resource"];
6898 params.remove_params(&to_remove);
6899 }
6900
6901 let url = params.parse_with_url(&url);
6902
6903 loop {
6904 let token = match self
6905 .hub
6906 .auth
6907 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6908 .await
6909 {
6910 Ok(token) => token,
6911 Err(e) => match dlg.token(e) {
6912 Ok(token) => token,
6913 Err(e) => {
6914 dlg.finished(false);
6915 return Err(common::Error::MissingToken(e));
6916 }
6917 },
6918 };
6919 let mut req_result = {
6920 let client = &self.hub.client;
6921 dlg.pre_request();
6922 let mut req_builder = hyper::Request::builder()
6923 .method(hyper::Method::GET)
6924 .uri(url.as_str())
6925 .header(USER_AGENT, self.hub._user_agent.clone());
6926
6927 if let Some(token) = token.as_ref() {
6928 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6929 }
6930
6931 let request = req_builder
6932 .header(CONTENT_LENGTH, 0_u64)
6933 .body(common::to_body::<String>(None));
6934
6935 client.request(request.unwrap()).await
6936 };
6937
6938 match req_result {
6939 Err(err) => {
6940 if let common::Retry::After(d) = dlg.http_error(&err) {
6941 sleep(d).await;
6942 continue;
6943 }
6944 dlg.finished(false);
6945 return Err(common::Error::HttpError(err));
6946 }
6947 Ok(res) => {
6948 let (mut parts, body) = res.into_parts();
6949 let mut body = common::Body::new(body);
6950 if !parts.status.is_success() {
6951 let bytes = common::to_bytes(body).await.unwrap_or_default();
6952 let error = serde_json::from_str(&common::to_string(&bytes));
6953 let response = common::to_response(parts, bytes.into());
6954
6955 if let common::Retry::After(d) =
6956 dlg.http_failure(&response, error.as_ref().ok())
6957 {
6958 sleep(d).await;
6959 continue;
6960 }
6961
6962 dlg.finished(false);
6963
6964 return Err(match error {
6965 Ok(value) => common::Error::BadRequest(value),
6966 _ => common::Error::Failure(response),
6967 });
6968 }
6969 let response = {
6970 let bytes = common::to_bytes(body).await.unwrap_or_default();
6971 let encoded = common::to_string(&bytes);
6972 match serde_json::from_str(&encoded) {
6973 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6974 Err(error) => {
6975 dlg.response_json_decode_error(&encoded, &error);
6976 return Err(common::Error::JsonDecodeError(
6977 encoded.to_string(),
6978 error,
6979 ));
6980 }
6981 }
6982 };
6983
6984 dlg.finished(true);
6985 return Ok(response);
6986 }
6987 }
6988 }
6989 }
6990
6991 /// 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.
6992 ///
6993 /// Sets the *resource* path property to the given value.
6994 ///
6995 /// Even though the property as already been set when instantiating this call,
6996 /// we provide this method for API completeness.
6997 pub fn resource(mut self, new_value: &str) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
6998 self._resource = new_value.to_string();
6999 self
7000 }
7001 /// 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).
7002 ///
7003 /// Sets the *options.requested policy version* query property to the given value.
7004 pub fn options_requested_policy_version(
7005 mut self,
7006 new_value: i32,
7007 ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
7008 self._options_requested_policy_version = Some(new_value);
7009 self
7010 }
7011 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7012 /// while executing the actual API request.
7013 ///
7014 /// ````text
7015 /// It should be used to handle progress information, and to implement a certain level of resilience.
7016 /// ````
7017 ///
7018 /// Sets the *delegate* property to the given value.
7019 pub fn delegate(
7020 mut self,
7021 new_value: &'a mut dyn common::Delegate,
7022 ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
7023 self._delegate = Some(new_value);
7024 self
7025 }
7026
7027 /// Set any additional parameter of the query string used in the request.
7028 /// It should be used to set parameters which are not yet available through their own
7029 /// setters.
7030 ///
7031 /// Please note that this method must not be used to set any of the known parameters
7032 /// which have their own setter method. If done anyway, the request will fail.
7033 ///
7034 /// # Additional Parameters
7035 ///
7036 /// * *$.xgafv* (query-string) - V1 error format.
7037 /// * *access_token* (query-string) - OAuth access token.
7038 /// * *alt* (query-string) - Data format for response.
7039 /// * *callback* (query-string) - JSONP
7040 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7041 /// * *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.
7042 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7043 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7044 /// * *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.
7045 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7046 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7047 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
7048 where
7049 T: AsRef<str>,
7050 {
7051 self._additional_params
7052 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7053 self
7054 }
7055
7056 /// Identifies the authorization scope for the method you are building.
7057 ///
7058 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7059 /// [`Scope::CloudPlatformReadOnly`].
7060 ///
7061 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7062 /// tokens for more than one scope.
7063 ///
7064 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7065 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7066 /// sufficient, a read-write scope will do as well.
7067 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
7068 where
7069 St: AsRef<str>,
7070 {
7071 self._scopes.insert(String::from(scope.as_ref()));
7072 self
7073 }
7074 /// Identifies the authorization scope(s) for the method you are building.
7075 ///
7076 /// See [`Self::add_scope()`] for details.
7077 pub fn add_scopes<I, St>(
7078 mut self,
7079 scopes: I,
7080 ) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C>
7081 where
7082 I: IntoIterator<Item = St>,
7083 St: AsRef<str>,
7084 {
7085 self._scopes
7086 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7087 self
7088 }
7089
7090 /// Removes all scopes, and no default scope will be used either.
7091 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7092 /// for details).
7093 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryGetIamPolicyCall<'a, C> {
7094 self._scopes.clear();
7095 self
7096 }
7097}
7098
7099/// Lists repositories.
7100///
7101/// A builder for the *locations.repositories.list* method supported by a *project* resource.
7102/// It is not used directly, but through a [`ProjectMethods`] instance.
7103///
7104/// # Example
7105///
7106/// Instantiate a resource method builder
7107///
7108/// ```test_harness,no_run
7109/// # extern crate hyper;
7110/// # extern crate hyper_rustls;
7111/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
7112/// # async fn dox() {
7113/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7114///
7115/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7116/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7117/// # .with_native_roots()
7118/// # .unwrap()
7119/// # .https_only()
7120/// # .enable_http2()
7121/// # .build();
7122///
7123/// # let executor = hyper_util::rt::TokioExecutor::new();
7124/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7125/// # secret,
7126/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7127/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7128/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7129/// # ),
7130/// # ).build().await.unwrap();
7131///
7132/// # let client = hyper_util::client::legacy::Client::builder(
7133/// # hyper_util::rt::TokioExecutor::new()
7134/// # )
7135/// # .build(
7136/// # hyper_rustls::HttpsConnectorBuilder::new()
7137/// # .with_native_roots()
7138/// # .unwrap()
7139/// # .https_or_http()
7140/// # .enable_http2()
7141/// # .build()
7142/// # );
7143/// # let mut hub = ArtifactRegistry::new(client, auth);
7144/// // You can configure optional parameters by calling the respective setters at will, and
7145/// // execute the final call using `doit()`.
7146/// // Values shown here are possibly random and not representative !
7147/// let result = hub.projects().locations_repositories_list("parent")
7148/// .page_token("et")
7149/// .page_size(-43)
7150/// .order_by("et")
7151/// .doit().await;
7152/// # }
7153/// ```
7154pub struct ProjectLocationRepositoryListCall<'a, C>
7155where
7156 C: 'a,
7157{
7158 hub: &'a ArtifactRegistry<C>,
7159 _parent: String,
7160 _page_token: Option<String>,
7161 _page_size: Option<i32>,
7162 _order_by: Option<String>,
7163 _delegate: Option<&'a mut dyn common::Delegate>,
7164 _additional_params: HashMap<String, String>,
7165 _scopes: BTreeSet<String>,
7166}
7167
7168impl<'a, C> common::CallBuilder for ProjectLocationRepositoryListCall<'a, C> {}
7169
7170impl<'a, C> ProjectLocationRepositoryListCall<'a, C>
7171where
7172 C: common::Connector,
7173{
7174 /// Perform the operation you have build so far.
7175 pub async fn doit(mut self) -> common::Result<(common::Response, ListRepositoriesResponse)> {
7176 use std::borrow::Cow;
7177 use std::io::{Read, Seek};
7178
7179 use common::{url::Params, ToParts};
7180 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7181
7182 let mut dd = common::DefaultDelegate;
7183 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7184 dlg.begin(common::MethodInfo {
7185 id: "artifactregistry.projects.locations.repositories.list",
7186 http_method: hyper::Method::GET,
7187 });
7188
7189 for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy"].iter() {
7190 if self._additional_params.contains_key(field) {
7191 dlg.finished(false);
7192 return Err(common::Error::FieldClash(field));
7193 }
7194 }
7195
7196 let mut params = Params::with_capacity(6 + self._additional_params.len());
7197 params.push("parent", self._parent);
7198 if let Some(value) = self._page_token.as_ref() {
7199 params.push("pageToken", value);
7200 }
7201 if let Some(value) = self._page_size.as_ref() {
7202 params.push("pageSize", value.to_string());
7203 }
7204 if let Some(value) = self._order_by.as_ref() {
7205 params.push("orderBy", value);
7206 }
7207
7208 params.extend(self._additional_params.iter());
7209
7210 params.push("alt", "json");
7211 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/repositories";
7212 if self._scopes.is_empty() {
7213 self._scopes
7214 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7215 }
7216
7217 #[allow(clippy::single_element_loop)]
7218 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7219 url = params.uri_replacement(url, param_name, find_this, true);
7220 }
7221 {
7222 let to_remove = ["parent"];
7223 params.remove_params(&to_remove);
7224 }
7225
7226 let url = params.parse_with_url(&url);
7227
7228 loop {
7229 let token = match self
7230 .hub
7231 .auth
7232 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7233 .await
7234 {
7235 Ok(token) => token,
7236 Err(e) => match dlg.token(e) {
7237 Ok(token) => token,
7238 Err(e) => {
7239 dlg.finished(false);
7240 return Err(common::Error::MissingToken(e));
7241 }
7242 },
7243 };
7244 let mut req_result = {
7245 let client = &self.hub.client;
7246 dlg.pre_request();
7247 let mut req_builder = hyper::Request::builder()
7248 .method(hyper::Method::GET)
7249 .uri(url.as_str())
7250 .header(USER_AGENT, self.hub._user_agent.clone());
7251
7252 if let Some(token) = token.as_ref() {
7253 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7254 }
7255
7256 let request = req_builder
7257 .header(CONTENT_LENGTH, 0_u64)
7258 .body(common::to_body::<String>(None));
7259
7260 client.request(request.unwrap()).await
7261 };
7262
7263 match req_result {
7264 Err(err) => {
7265 if let common::Retry::After(d) = dlg.http_error(&err) {
7266 sleep(d).await;
7267 continue;
7268 }
7269 dlg.finished(false);
7270 return Err(common::Error::HttpError(err));
7271 }
7272 Ok(res) => {
7273 let (mut parts, body) = res.into_parts();
7274 let mut body = common::Body::new(body);
7275 if !parts.status.is_success() {
7276 let bytes = common::to_bytes(body).await.unwrap_or_default();
7277 let error = serde_json::from_str(&common::to_string(&bytes));
7278 let response = common::to_response(parts, bytes.into());
7279
7280 if let common::Retry::After(d) =
7281 dlg.http_failure(&response, error.as_ref().ok())
7282 {
7283 sleep(d).await;
7284 continue;
7285 }
7286
7287 dlg.finished(false);
7288
7289 return Err(match error {
7290 Ok(value) => common::Error::BadRequest(value),
7291 _ => common::Error::Failure(response),
7292 });
7293 }
7294 let response = {
7295 let bytes = common::to_bytes(body).await.unwrap_or_default();
7296 let encoded = common::to_string(&bytes);
7297 match serde_json::from_str(&encoded) {
7298 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7299 Err(error) => {
7300 dlg.response_json_decode_error(&encoded, &error);
7301 return Err(common::Error::JsonDecodeError(
7302 encoded.to_string(),
7303 error,
7304 ));
7305 }
7306 }
7307 };
7308
7309 dlg.finished(true);
7310 return Ok(response);
7311 }
7312 }
7313 }
7314 }
7315
7316 /// Required. The name of the parent resource whose repositories will be listed.
7317 ///
7318 /// Sets the *parent* path property to the given value.
7319 ///
7320 /// Even though the property as already been set when instantiating this call,
7321 /// we provide this method for API completeness.
7322 pub fn parent(mut self, new_value: &str) -> ProjectLocationRepositoryListCall<'a, C> {
7323 self._parent = new_value.to_string();
7324 self
7325 }
7326 /// The next_page_token value returned from a previous list request, if any.
7327 ///
7328 /// Sets the *page token* query property to the given value.
7329 pub fn page_token(mut self, new_value: &str) -> ProjectLocationRepositoryListCall<'a, C> {
7330 self._page_token = Some(new_value.to_string());
7331 self
7332 }
7333 /// The maximum number of repositories to return. Maximum page size is 1,000.
7334 ///
7335 /// Sets the *page size* query property to the given value.
7336 pub fn page_size(mut self, new_value: i32) -> ProjectLocationRepositoryListCall<'a, C> {
7337 self._page_size = Some(new_value);
7338 self
7339 }
7340 /// Optional. The field to order the results by.
7341 ///
7342 /// Sets the *order by* query property to the given value.
7343 pub fn order_by(mut self, new_value: &str) -> ProjectLocationRepositoryListCall<'a, C> {
7344 self._order_by = Some(new_value.to_string());
7345 self
7346 }
7347 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7348 /// while executing the actual API request.
7349 ///
7350 /// ````text
7351 /// It should be used to handle progress information, and to implement a certain level of resilience.
7352 /// ````
7353 ///
7354 /// Sets the *delegate* property to the given value.
7355 pub fn delegate(
7356 mut self,
7357 new_value: &'a mut dyn common::Delegate,
7358 ) -> ProjectLocationRepositoryListCall<'a, C> {
7359 self._delegate = Some(new_value);
7360 self
7361 }
7362
7363 /// Set any additional parameter of the query string used in the request.
7364 /// It should be used to set parameters which are not yet available through their own
7365 /// setters.
7366 ///
7367 /// Please note that this method must not be used to set any of the known parameters
7368 /// which have their own setter method. If done anyway, the request will fail.
7369 ///
7370 /// # Additional Parameters
7371 ///
7372 /// * *$.xgafv* (query-string) - V1 error format.
7373 /// * *access_token* (query-string) - OAuth access token.
7374 /// * *alt* (query-string) - Data format for response.
7375 /// * *callback* (query-string) - JSONP
7376 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7377 /// * *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.
7378 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7379 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7380 /// * *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.
7381 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7382 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7383 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryListCall<'a, C>
7384 where
7385 T: AsRef<str>,
7386 {
7387 self._additional_params
7388 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7389 self
7390 }
7391
7392 /// Identifies the authorization scope for the method you are building.
7393 ///
7394 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7395 /// [`Scope::CloudPlatformReadOnly`].
7396 ///
7397 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7398 /// tokens for more than one scope.
7399 ///
7400 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7401 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7402 /// sufficient, a read-write scope will do as well.
7403 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryListCall<'a, C>
7404 where
7405 St: AsRef<str>,
7406 {
7407 self._scopes.insert(String::from(scope.as_ref()));
7408 self
7409 }
7410 /// Identifies the authorization scope(s) for the method you are building.
7411 ///
7412 /// See [`Self::add_scope()`] for details.
7413 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryListCall<'a, C>
7414 where
7415 I: IntoIterator<Item = St>,
7416 St: AsRef<str>,
7417 {
7418 self._scopes
7419 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7420 self
7421 }
7422
7423 /// Removes all scopes, and no default scope will be used either.
7424 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7425 /// for details).
7426 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryListCall<'a, C> {
7427 self._scopes.clear();
7428 self
7429 }
7430}
7431
7432/// Updates a repository.
7433///
7434/// A builder for the *locations.repositories.patch* method supported by a *project* resource.
7435/// It is not used directly, but through a [`ProjectMethods`] instance.
7436///
7437/// # Example
7438///
7439/// Instantiate a resource method builder
7440///
7441/// ```test_harness,no_run
7442/// # extern crate hyper;
7443/// # extern crate hyper_rustls;
7444/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
7445/// use artifactregistry1_beta1::api::Repository;
7446/// # async fn dox() {
7447/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7448///
7449/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7450/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7451/// # .with_native_roots()
7452/// # .unwrap()
7453/// # .https_only()
7454/// # .enable_http2()
7455/// # .build();
7456///
7457/// # let executor = hyper_util::rt::TokioExecutor::new();
7458/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7459/// # secret,
7460/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7461/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7462/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7463/// # ),
7464/// # ).build().await.unwrap();
7465///
7466/// # let client = hyper_util::client::legacy::Client::builder(
7467/// # hyper_util::rt::TokioExecutor::new()
7468/// # )
7469/// # .build(
7470/// # hyper_rustls::HttpsConnectorBuilder::new()
7471/// # .with_native_roots()
7472/// # .unwrap()
7473/// # .https_or_http()
7474/// # .enable_http2()
7475/// # .build()
7476/// # );
7477/// # let mut hub = ArtifactRegistry::new(client, auth);
7478/// // As the method needs a request, you would usually fill it with the desired information
7479/// // into the respective structure. Some of the parts shown here might not be applicable !
7480/// // Values shown here are possibly random and not representative !
7481/// let mut req = Repository::default();
7482///
7483/// // You can configure optional parameters by calling the respective setters at will, and
7484/// // execute the final call using `doit()`.
7485/// // Values shown here are possibly random and not representative !
7486/// let result = hub.projects().locations_repositories_patch(req, "name")
7487/// .update_mask(FieldMask::new::<&str>(&[]))
7488/// .doit().await;
7489/// # }
7490/// ```
7491pub struct ProjectLocationRepositoryPatchCall<'a, C>
7492where
7493 C: 'a,
7494{
7495 hub: &'a ArtifactRegistry<C>,
7496 _request: Repository,
7497 _name: String,
7498 _update_mask: Option<common::FieldMask>,
7499 _delegate: Option<&'a mut dyn common::Delegate>,
7500 _additional_params: HashMap<String, String>,
7501 _scopes: BTreeSet<String>,
7502}
7503
7504impl<'a, C> common::CallBuilder for ProjectLocationRepositoryPatchCall<'a, C> {}
7505
7506impl<'a, C> ProjectLocationRepositoryPatchCall<'a, C>
7507where
7508 C: common::Connector,
7509{
7510 /// Perform the operation you have build so far.
7511 pub async fn doit(mut self) -> common::Result<(common::Response, Repository)> {
7512 use std::borrow::Cow;
7513 use std::io::{Read, Seek};
7514
7515 use common::{url::Params, ToParts};
7516 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7517
7518 let mut dd = common::DefaultDelegate;
7519 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7520 dlg.begin(common::MethodInfo {
7521 id: "artifactregistry.projects.locations.repositories.patch",
7522 http_method: hyper::Method::PATCH,
7523 });
7524
7525 for &field in ["alt", "name", "updateMask"].iter() {
7526 if self._additional_params.contains_key(field) {
7527 dlg.finished(false);
7528 return Err(common::Error::FieldClash(field));
7529 }
7530 }
7531
7532 let mut params = Params::with_capacity(5 + self._additional_params.len());
7533 params.push("name", self._name);
7534 if let Some(value) = self._update_mask.as_ref() {
7535 params.push("updateMask", value.to_string());
7536 }
7537
7538 params.extend(self._additional_params.iter());
7539
7540 params.push("alt", "json");
7541 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7542 if self._scopes.is_empty() {
7543 self._scopes
7544 .insert(Scope::CloudPlatform.as_ref().to_string());
7545 }
7546
7547 #[allow(clippy::single_element_loop)]
7548 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7549 url = params.uri_replacement(url, param_name, find_this, true);
7550 }
7551 {
7552 let to_remove = ["name"];
7553 params.remove_params(&to_remove);
7554 }
7555
7556 let url = params.parse_with_url(&url);
7557
7558 let mut json_mime_type = mime::APPLICATION_JSON;
7559 let mut request_value_reader = {
7560 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7561 common::remove_json_null_values(&mut value);
7562 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7563 serde_json::to_writer(&mut dst, &value).unwrap();
7564 dst
7565 };
7566 let request_size = request_value_reader
7567 .seek(std::io::SeekFrom::End(0))
7568 .unwrap();
7569 request_value_reader
7570 .seek(std::io::SeekFrom::Start(0))
7571 .unwrap();
7572
7573 loop {
7574 let token = match self
7575 .hub
7576 .auth
7577 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7578 .await
7579 {
7580 Ok(token) => token,
7581 Err(e) => match dlg.token(e) {
7582 Ok(token) => token,
7583 Err(e) => {
7584 dlg.finished(false);
7585 return Err(common::Error::MissingToken(e));
7586 }
7587 },
7588 };
7589 request_value_reader
7590 .seek(std::io::SeekFrom::Start(0))
7591 .unwrap();
7592 let mut req_result = {
7593 let client = &self.hub.client;
7594 dlg.pre_request();
7595 let mut req_builder = hyper::Request::builder()
7596 .method(hyper::Method::PATCH)
7597 .uri(url.as_str())
7598 .header(USER_AGENT, self.hub._user_agent.clone());
7599
7600 if let Some(token) = token.as_ref() {
7601 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7602 }
7603
7604 let request = req_builder
7605 .header(CONTENT_TYPE, json_mime_type.to_string())
7606 .header(CONTENT_LENGTH, request_size as u64)
7607 .body(common::to_body(
7608 request_value_reader.get_ref().clone().into(),
7609 ));
7610
7611 client.request(request.unwrap()).await
7612 };
7613
7614 match req_result {
7615 Err(err) => {
7616 if let common::Retry::After(d) = dlg.http_error(&err) {
7617 sleep(d).await;
7618 continue;
7619 }
7620 dlg.finished(false);
7621 return Err(common::Error::HttpError(err));
7622 }
7623 Ok(res) => {
7624 let (mut parts, body) = res.into_parts();
7625 let mut body = common::Body::new(body);
7626 if !parts.status.is_success() {
7627 let bytes = common::to_bytes(body).await.unwrap_or_default();
7628 let error = serde_json::from_str(&common::to_string(&bytes));
7629 let response = common::to_response(parts, bytes.into());
7630
7631 if let common::Retry::After(d) =
7632 dlg.http_failure(&response, error.as_ref().ok())
7633 {
7634 sleep(d).await;
7635 continue;
7636 }
7637
7638 dlg.finished(false);
7639
7640 return Err(match error {
7641 Ok(value) => common::Error::BadRequest(value),
7642 _ => common::Error::Failure(response),
7643 });
7644 }
7645 let response = {
7646 let bytes = common::to_bytes(body).await.unwrap_or_default();
7647 let encoded = common::to_string(&bytes);
7648 match serde_json::from_str(&encoded) {
7649 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7650 Err(error) => {
7651 dlg.response_json_decode_error(&encoded, &error);
7652 return Err(common::Error::JsonDecodeError(
7653 encoded.to_string(),
7654 error,
7655 ));
7656 }
7657 }
7658 };
7659
7660 dlg.finished(true);
7661 return Ok(response);
7662 }
7663 }
7664 }
7665 }
7666
7667 ///
7668 /// Sets the *request* property to the given value.
7669 ///
7670 /// Even though the property as already been set when instantiating this call,
7671 /// we provide this method for API completeness.
7672 pub fn request(mut self, new_value: Repository) -> ProjectLocationRepositoryPatchCall<'a, C> {
7673 self._request = new_value;
7674 self
7675 }
7676 /// 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.
7677 ///
7678 /// Sets the *name* path property to the given value.
7679 ///
7680 /// Even though the property as already been set when instantiating this call,
7681 /// we provide this method for API completeness.
7682 pub fn name(mut self, new_value: &str) -> ProjectLocationRepositoryPatchCall<'a, C> {
7683 self._name = new_value.to_string();
7684 self
7685 }
7686 /// The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
7687 ///
7688 /// Sets the *update mask* query property to the given value.
7689 pub fn update_mask(
7690 mut self,
7691 new_value: common::FieldMask,
7692 ) -> ProjectLocationRepositoryPatchCall<'a, C> {
7693 self._update_mask = Some(new_value);
7694 self
7695 }
7696 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7697 /// while executing the actual API request.
7698 ///
7699 /// ````text
7700 /// It should be used to handle progress information, and to implement a certain level of resilience.
7701 /// ````
7702 ///
7703 /// Sets the *delegate* property to the given value.
7704 pub fn delegate(
7705 mut self,
7706 new_value: &'a mut dyn common::Delegate,
7707 ) -> ProjectLocationRepositoryPatchCall<'a, C> {
7708 self._delegate = Some(new_value);
7709 self
7710 }
7711
7712 /// Set any additional parameter of the query string used in the request.
7713 /// It should be used to set parameters which are not yet available through their own
7714 /// setters.
7715 ///
7716 /// Please note that this method must not be used to set any of the known parameters
7717 /// which have their own setter method. If done anyway, the request will fail.
7718 ///
7719 /// # Additional Parameters
7720 ///
7721 /// * *$.xgafv* (query-string) - V1 error format.
7722 /// * *access_token* (query-string) - OAuth access token.
7723 /// * *alt* (query-string) - Data format for response.
7724 /// * *callback* (query-string) - JSONP
7725 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7726 /// * *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.
7727 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7728 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7729 /// * *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.
7730 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7731 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7732 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositoryPatchCall<'a, C>
7733 where
7734 T: AsRef<str>,
7735 {
7736 self._additional_params
7737 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7738 self
7739 }
7740
7741 /// Identifies the authorization scope for the method you are building.
7742 ///
7743 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7744 /// [`Scope::CloudPlatform`].
7745 ///
7746 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7747 /// tokens for more than one scope.
7748 ///
7749 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7750 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7751 /// sufficient, a read-write scope will do as well.
7752 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositoryPatchCall<'a, C>
7753 where
7754 St: AsRef<str>,
7755 {
7756 self._scopes.insert(String::from(scope.as_ref()));
7757 self
7758 }
7759 /// Identifies the authorization scope(s) for the method you are building.
7760 ///
7761 /// See [`Self::add_scope()`] for details.
7762 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRepositoryPatchCall<'a, C>
7763 where
7764 I: IntoIterator<Item = St>,
7765 St: AsRef<str>,
7766 {
7767 self._scopes
7768 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7769 self
7770 }
7771
7772 /// Removes all scopes, and no default scope will be used either.
7773 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7774 /// for details).
7775 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryPatchCall<'a, C> {
7776 self._scopes.clear();
7777 self
7778 }
7779}
7780
7781/// Updates the IAM policy for a given resource.
7782///
7783/// A builder for the *locations.repositories.setIamPolicy* method supported by a *project* resource.
7784/// It is not used directly, but through a [`ProjectMethods`] instance.
7785///
7786/// # Example
7787///
7788/// Instantiate a resource method builder
7789///
7790/// ```test_harness,no_run
7791/// # extern crate hyper;
7792/// # extern crate hyper_rustls;
7793/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
7794/// use artifactregistry1_beta1::api::SetIamPolicyRequest;
7795/// # async fn dox() {
7796/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7797///
7798/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7799/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7800/// # .with_native_roots()
7801/// # .unwrap()
7802/// # .https_only()
7803/// # .enable_http2()
7804/// # .build();
7805///
7806/// # let executor = hyper_util::rt::TokioExecutor::new();
7807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7808/// # secret,
7809/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7810/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7811/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7812/// # ),
7813/// # ).build().await.unwrap();
7814///
7815/// # let client = hyper_util::client::legacy::Client::builder(
7816/// # hyper_util::rt::TokioExecutor::new()
7817/// # )
7818/// # .build(
7819/// # hyper_rustls::HttpsConnectorBuilder::new()
7820/// # .with_native_roots()
7821/// # .unwrap()
7822/// # .https_or_http()
7823/// # .enable_http2()
7824/// # .build()
7825/// # );
7826/// # let mut hub = ArtifactRegistry::new(client, auth);
7827/// // As the method needs a request, you would usually fill it with the desired information
7828/// // into the respective structure. Some of the parts shown here might not be applicable !
7829/// // Values shown here are possibly random and not representative !
7830/// let mut req = SetIamPolicyRequest::default();
7831///
7832/// // You can configure optional parameters by calling the respective setters at will, and
7833/// // execute the final call using `doit()`.
7834/// // Values shown here are possibly random and not representative !
7835/// let result = hub.projects().locations_repositories_set_iam_policy(req, "resource")
7836/// .doit().await;
7837/// # }
7838/// ```
7839pub struct ProjectLocationRepositorySetIamPolicyCall<'a, C>
7840where
7841 C: 'a,
7842{
7843 hub: &'a ArtifactRegistry<C>,
7844 _request: SetIamPolicyRequest,
7845 _resource: String,
7846 _delegate: Option<&'a mut dyn common::Delegate>,
7847 _additional_params: HashMap<String, String>,
7848 _scopes: BTreeSet<String>,
7849}
7850
7851impl<'a, C> common::CallBuilder for ProjectLocationRepositorySetIamPolicyCall<'a, C> {}
7852
7853impl<'a, C> ProjectLocationRepositorySetIamPolicyCall<'a, C>
7854where
7855 C: common::Connector,
7856{
7857 /// Perform the operation you have build so far.
7858 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7859 use std::borrow::Cow;
7860 use std::io::{Read, Seek};
7861
7862 use common::{url::Params, ToParts};
7863 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7864
7865 let mut dd = common::DefaultDelegate;
7866 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7867 dlg.begin(common::MethodInfo {
7868 id: "artifactregistry.projects.locations.repositories.setIamPolicy",
7869 http_method: hyper::Method::POST,
7870 });
7871
7872 for &field in ["alt", "resource"].iter() {
7873 if self._additional_params.contains_key(field) {
7874 dlg.finished(false);
7875 return Err(common::Error::FieldClash(field));
7876 }
7877 }
7878
7879 let mut params = Params::with_capacity(4 + self._additional_params.len());
7880 params.push("resource", self._resource);
7881
7882 params.extend(self._additional_params.iter());
7883
7884 params.push("alt", "json");
7885 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
7886 if self._scopes.is_empty() {
7887 self._scopes
7888 .insert(Scope::CloudPlatform.as_ref().to_string());
7889 }
7890
7891 #[allow(clippy::single_element_loop)]
7892 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7893 url = params.uri_replacement(url, param_name, find_this, true);
7894 }
7895 {
7896 let to_remove = ["resource"];
7897 params.remove_params(&to_remove);
7898 }
7899
7900 let url = params.parse_with_url(&url);
7901
7902 let mut json_mime_type = mime::APPLICATION_JSON;
7903 let mut request_value_reader = {
7904 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7905 common::remove_json_null_values(&mut value);
7906 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7907 serde_json::to_writer(&mut dst, &value).unwrap();
7908 dst
7909 };
7910 let request_size = request_value_reader
7911 .seek(std::io::SeekFrom::End(0))
7912 .unwrap();
7913 request_value_reader
7914 .seek(std::io::SeekFrom::Start(0))
7915 .unwrap();
7916
7917 loop {
7918 let token = match self
7919 .hub
7920 .auth
7921 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7922 .await
7923 {
7924 Ok(token) => token,
7925 Err(e) => match dlg.token(e) {
7926 Ok(token) => token,
7927 Err(e) => {
7928 dlg.finished(false);
7929 return Err(common::Error::MissingToken(e));
7930 }
7931 },
7932 };
7933 request_value_reader
7934 .seek(std::io::SeekFrom::Start(0))
7935 .unwrap();
7936 let mut req_result = {
7937 let client = &self.hub.client;
7938 dlg.pre_request();
7939 let mut req_builder = hyper::Request::builder()
7940 .method(hyper::Method::POST)
7941 .uri(url.as_str())
7942 .header(USER_AGENT, self.hub._user_agent.clone());
7943
7944 if let Some(token) = token.as_ref() {
7945 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7946 }
7947
7948 let request = req_builder
7949 .header(CONTENT_TYPE, json_mime_type.to_string())
7950 .header(CONTENT_LENGTH, request_size as u64)
7951 .body(common::to_body(
7952 request_value_reader.get_ref().clone().into(),
7953 ));
7954
7955 client.request(request.unwrap()).await
7956 };
7957
7958 match req_result {
7959 Err(err) => {
7960 if let common::Retry::After(d) = dlg.http_error(&err) {
7961 sleep(d).await;
7962 continue;
7963 }
7964 dlg.finished(false);
7965 return Err(common::Error::HttpError(err));
7966 }
7967 Ok(res) => {
7968 let (mut parts, body) = res.into_parts();
7969 let mut body = common::Body::new(body);
7970 if !parts.status.is_success() {
7971 let bytes = common::to_bytes(body).await.unwrap_or_default();
7972 let error = serde_json::from_str(&common::to_string(&bytes));
7973 let response = common::to_response(parts, bytes.into());
7974
7975 if let common::Retry::After(d) =
7976 dlg.http_failure(&response, error.as_ref().ok())
7977 {
7978 sleep(d).await;
7979 continue;
7980 }
7981
7982 dlg.finished(false);
7983
7984 return Err(match error {
7985 Ok(value) => common::Error::BadRequest(value),
7986 _ => common::Error::Failure(response),
7987 });
7988 }
7989 let response = {
7990 let bytes = common::to_bytes(body).await.unwrap_or_default();
7991 let encoded = common::to_string(&bytes);
7992 match serde_json::from_str(&encoded) {
7993 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7994 Err(error) => {
7995 dlg.response_json_decode_error(&encoded, &error);
7996 return Err(common::Error::JsonDecodeError(
7997 encoded.to_string(),
7998 error,
7999 ));
8000 }
8001 }
8002 };
8003
8004 dlg.finished(true);
8005 return Ok(response);
8006 }
8007 }
8008 }
8009 }
8010
8011 ///
8012 /// Sets the *request* property to the given value.
8013 ///
8014 /// Even though the property as already been set when instantiating this call,
8015 /// we provide this method for API completeness.
8016 pub fn request(
8017 mut self,
8018 new_value: SetIamPolicyRequest,
8019 ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
8020 self._request = new_value;
8021 self
8022 }
8023 /// 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.
8024 ///
8025 /// Sets the *resource* path property to the given value.
8026 ///
8027 /// Even though the property as already been set when instantiating this call,
8028 /// we provide this method for API completeness.
8029 pub fn resource(mut self, new_value: &str) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
8030 self._resource = new_value.to_string();
8031 self
8032 }
8033 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8034 /// while executing the actual API request.
8035 ///
8036 /// ````text
8037 /// It should be used to handle progress information, and to implement a certain level of resilience.
8038 /// ````
8039 ///
8040 /// Sets the *delegate* property to the given value.
8041 pub fn delegate(
8042 mut self,
8043 new_value: &'a mut dyn common::Delegate,
8044 ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
8045 self._delegate = Some(new_value);
8046 self
8047 }
8048
8049 /// Set any additional parameter of the query string used in the request.
8050 /// It should be used to set parameters which are not yet available through their own
8051 /// setters.
8052 ///
8053 /// Please note that this method must not be used to set any of the known parameters
8054 /// which have their own setter method. If done anyway, the request will fail.
8055 ///
8056 /// # Additional Parameters
8057 ///
8058 /// * *$.xgafv* (query-string) - V1 error format.
8059 /// * *access_token* (query-string) - OAuth access token.
8060 /// * *alt* (query-string) - Data format for response.
8061 /// * *callback* (query-string) - JSONP
8062 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8063 /// * *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.
8064 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8065 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8066 /// * *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.
8067 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8068 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8069 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRepositorySetIamPolicyCall<'a, C>
8070 where
8071 T: AsRef<str>,
8072 {
8073 self._additional_params
8074 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8075 self
8076 }
8077
8078 /// Identifies the authorization scope for the method you are building.
8079 ///
8080 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8081 /// [`Scope::CloudPlatform`].
8082 ///
8083 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8084 /// tokens for more than one scope.
8085 ///
8086 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8087 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8088 /// sufficient, a read-write scope will do as well.
8089 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRepositorySetIamPolicyCall<'a, C>
8090 where
8091 St: AsRef<str>,
8092 {
8093 self._scopes.insert(String::from(scope.as_ref()));
8094 self
8095 }
8096 /// Identifies the authorization scope(s) for the method you are building.
8097 ///
8098 /// See [`Self::add_scope()`] for details.
8099 pub fn add_scopes<I, St>(
8100 mut self,
8101 scopes: I,
8102 ) -> ProjectLocationRepositorySetIamPolicyCall<'a, C>
8103 where
8104 I: IntoIterator<Item = St>,
8105 St: AsRef<str>,
8106 {
8107 self._scopes
8108 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8109 self
8110 }
8111
8112 /// Removes all scopes, and no default scope will be used either.
8113 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8114 /// for details).
8115 pub fn clear_scopes(mut self) -> ProjectLocationRepositorySetIamPolicyCall<'a, C> {
8116 self._scopes.clear();
8117 self
8118 }
8119}
8120
8121/// Tests if the caller has a list of permissions on a resource.
8122///
8123/// A builder for the *locations.repositories.testIamPermissions* method supported by a *project* resource.
8124/// It is not used directly, but through a [`ProjectMethods`] instance.
8125///
8126/// # Example
8127///
8128/// Instantiate a resource method builder
8129///
8130/// ```test_harness,no_run
8131/// # extern crate hyper;
8132/// # extern crate hyper_rustls;
8133/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
8134/// use artifactregistry1_beta1::api::TestIamPermissionsRequest;
8135/// # async fn dox() {
8136/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8137///
8138/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8139/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8140/// # .with_native_roots()
8141/// # .unwrap()
8142/// # .https_only()
8143/// # .enable_http2()
8144/// # .build();
8145///
8146/// # let executor = hyper_util::rt::TokioExecutor::new();
8147/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8148/// # secret,
8149/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8150/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8151/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8152/// # ),
8153/// # ).build().await.unwrap();
8154///
8155/// # let client = hyper_util::client::legacy::Client::builder(
8156/// # hyper_util::rt::TokioExecutor::new()
8157/// # )
8158/// # .build(
8159/// # hyper_rustls::HttpsConnectorBuilder::new()
8160/// # .with_native_roots()
8161/// # .unwrap()
8162/// # .https_or_http()
8163/// # .enable_http2()
8164/// # .build()
8165/// # );
8166/// # let mut hub = ArtifactRegistry::new(client, auth);
8167/// // As the method needs a request, you would usually fill it with the desired information
8168/// // into the respective structure. Some of the parts shown here might not be applicable !
8169/// // Values shown here are possibly random and not representative !
8170/// let mut req = TestIamPermissionsRequest::default();
8171///
8172/// // You can configure optional parameters by calling the respective setters at will, and
8173/// // execute the final call using `doit()`.
8174/// // Values shown here are possibly random and not representative !
8175/// let result = hub.projects().locations_repositories_test_iam_permissions(req, "resource")
8176/// .doit().await;
8177/// # }
8178/// ```
8179pub struct ProjectLocationRepositoryTestIamPermissionCall<'a, C>
8180where
8181 C: 'a,
8182{
8183 hub: &'a ArtifactRegistry<C>,
8184 _request: TestIamPermissionsRequest,
8185 _resource: String,
8186 _delegate: Option<&'a mut dyn common::Delegate>,
8187 _additional_params: HashMap<String, String>,
8188 _scopes: BTreeSet<String>,
8189}
8190
8191impl<'a, C> common::CallBuilder for ProjectLocationRepositoryTestIamPermissionCall<'a, C> {}
8192
8193impl<'a, C> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
8194where
8195 C: common::Connector,
8196{
8197 /// Perform the operation you have build so far.
8198 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
8199 use std::borrow::Cow;
8200 use std::io::{Read, Seek};
8201
8202 use common::{url::Params, ToParts};
8203 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8204
8205 let mut dd = common::DefaultDelegate;
8206 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8207 dlg.begin(common::MethodInfo {
8208 id: "artifactregistry.projects.locations.repositories.testIamPermissions",
8209 http_method: hyper::Method::POST,
8210 });
8211
8212 for &field in ["alt", "resource"].iter() {
8213 if self._additional_params.contains_key(field) {
8214 dlg.finished(false);
8215 return Err(common::Error::FieldClash(field));
8216 }
8217 }
8218
8219 let mut params = Params::with_capacity(4 + self._additional_params.len());
8220 params.push("resource", self._resource);
8221
8222 params.extend(self._additional_params.iter());
8223
8224 params.push("alt", "json");
8225 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
8226 if self._scopes.is_empty() {
8227 self._scopes
8228 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8229 }
8230
8231 #[allow(clippy::single_element_loop)]
8232 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8233 url = params.uri_replacement(url, param_name, find_this, true);
8234 }
8235 {
8236 let to_remove = ["resource"];
8237 params.remove_params(&to_remove);
8238 }
8239
8240 let url = params.parse_with_url(&url);
8241
8242 let mut json_mime_type = mime::APPLICATION_JSON;
8243 let mut request_value_reader = {
8244 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8245 common::remove_json_null_values(&mut value);
8246 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8247 serde_json::to_writer(&mut dst, &value).unwrap();
8248 dst
8249 };
8250 let request_size = request_value_reader
8251 .seek(std::io::SeekFrom::End(0))
8252 .unwrap();
8253 request_value_reader
8254 .seek(std::io::SeekFrom::Start(0))
8255 .unwrap();
8256
8257 loop {
8258 let token = match self
8259 .hub
8260 .auth
8261 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8262 .await
8263 {
8264 Ok(token) => token,
8265 Err(e) => match dlg.token(e) {
8266 Ok(token) => token,
8267 Err(e) => {
8268 dlg.finished(false);
8269 return Err(common::Error::MissingToken(e));
8270 }
8271 },
8272 };
8273 request_value_reader
8274 .seek(std::io::SeekFrom::Start(0))
8275 .unwrap();
8276 let mut req_result = {
8277 let client = &self.hub.client;
8278 dlg.pre_request();
8279 let mut req_builder = hyper::Request::builder()
8280 .method(hyper::Method::POST)
8281 .uri(url.as_str())
8282 .header(USER_AGENT, self.hub._user_agent.clone());
8283
8284 if let Some(token) = token.as_ref() {
8285 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8286 }
8287
8288 let request = req_builder
8289 .header(CONTENT_TYPE, json_mime_type.to_string())
8290 .header(CONTENT_LENGTH, request_size as u64)
8291 .body(common::to_body(
8292 request_value_reader.get_ref().clone().into(),
8293 ));
8294
8295 client.request(request.unwrap()).await
8296 };
8297
8298 match req_result {
8299 Err(err) => {
8300 if let common::Retry::After(d) = dlg.http_error(&err) {
8301 sleep(d).await;
8302 continue;
8303 }
8304 dlg.finished(false);
8305 return Err(common::Error::HttpError(err));
8306 }
8307 Ok(res) => {
8308 let (mut parts, body) = res.into_parts();
8309 let mut body = common::Body::new(body);
8310 if !parts.status.is_success() {
8311 let bytes = common::to_bytes(body).await.unwrap_or_default();
8312 let error = serde_json::from_str(&common::to_string(&bytes));
8313 let response = common::to_response(parts, bytes.into());
8314
8315 if let common::Retry::After(d) =
8316 dlg.http_failure(&response, error.as_ref().ok())
8317 {
8318 sleep(d).await;
8319 continue;
8320 }
8321
8322 dlg.finished(false);
8323
8324 return Err(match error {
8325 Ok(value) => common::Error::BadRequest(value),
8326 _ => common::Error::Failure(response),
8327 });
8328 }
8329 let response = {
8330 let bytes = common::to_bytes(body).await.unwrap_or_default();
8331 let encoded = common::to_string(&bytes);
8332 match serde_json::from_str(&encoded) {
8333 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8334 Err(error) => {
8335 dlg.response_json_decode_error(&encoded, &error);
8336 return Err(common::Error::JsonDecodeError(
8337 encoded.to_string(),
8338 error,
8339 ));
8340 }
8341 }
8342 };
8343
8344 dlg.finished(true);
8345 return Ok(response);
8346 }
8347 }
8348 }
8349 }
8350
8351 ///
8352 /// Sets the *request* property to the given value.
8353 ///
8354 /// Even though the property as already been set when instantiating this call,
8355 /// we provide this method for API completeness.
8356 pub fn request(
8357 mut self,
8358 new_value: TestIamPermissionsRequest,
8359 ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
8360 self._request = new_value;
8361 self
8362 }
8363 /// 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.
8364 ///
8365 /// Sets the *resource* path property to the given value.
8366 ///
8367 /// Even though the property as already been set when instantiating this call,
8368 /// we provide this method for API completeness.
8369 pub fn resource(
8370 mut self,
8371 new_value: &str,
8372 ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
8373 self._resource = new_value.to_string();
8374 self
8375 }
8376 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8377 /// while executing the actual API request.
8378 ///
8379 /// ````text
8380 /// It should be used to handle progress information, and to implement a certain level of resilience.
8381 /// ````
8382 ///
8383 /// Sets the *delegate* property to the given value.
8384 pub fn delegate(
8385 mut self,
8386 new_value: &'a mut dyn common::Delegate,
8387 ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
8388 self._delegate = Some(new_value);
8389 self
8390 }
8391
8392 /// Set any additional parameter of the query string used in the request.
8393 /// It should be used to set parameters which are not yet available through their own
8394 /// setters.
8395 ///
8396 /// Please note that this method must not be used to set any of the known parameters
8397 /// which have their own setter method. If done anyway, the request will fail.
8398 ///
8399 /// # Additional Parameters
8400 ///
8401 /// * *$.xgafv* (query-string) - V1 error format.
8402 /// * *access_token* (query-string) - OAuth access token.
8403 /// * *alt* (query-string) - Data format for response.
8404 /// * *callback* (query-string) - JSONP
8405 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8406 /// * *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.
8407 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8408 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8409 /// * *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.
8410 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8411 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8412 pub fn param<T>(
8413 mut self,
8414 name: T,
8415 value: T,
8416 ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
8417 where
8418 T: AsRef<str>,
8419 {
8420 self._additional_params
8421 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8422 self
8423 }
8424
8425 /// Identifies the authorization scope for the method you are building.
8426 ///
8427 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8428 /// [`Scope::CloudPlatformReadOnly`].
8429 ///
8430 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8431 /// tokens for more than one scope.
8432 ///
8433 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8434 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8435 /// sufficient, a read-write scope will do as well.
8436 pub fn add_scope<St>(
8437 mut self,
8438 scope: St,
8439 ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
8440 where
8441 St: AsRef<str>,
8442 {
8443 self._scopes.insert(String::from(scope.as_ref()));
8444 self
8445 }
8446 /// Identifies the authorization scope(s) for the method you are building.
8447 ///
8448 /// See [`Self::add_scope()`] for details.
8449 pub fn add_scopes<I, St>(
8450 mut self,
8451 scopes: I,
8452 ) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C>
8453 where
8454 I: IntoIterator<Item = St>,
8455 St: AsRef<str>,
8456 {
8457 self._scopes
8458 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8459 self
8460 }
8461
8462 /// Removes all scopes, and no default scope will be used either.
8463 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8464 /// for details).
8465 pub fn clear_scopes(mut self) -> ProjectLocationRepositoryTestIamPermissionCall<'a, C> {
8466 self._scopes.clear();
8467 self
8468 }
8469}
8470
8471/// Gets information about a location.
8472///
8473/// A builder for the *locations.get* method supported by a *project* resource.
8474/// It is not used directly, but through a [`ProjectMethods`] instance.
8475///
8476/// # Example
8477///
8478/// Instantiate a resource method builder
8479///
8480/// ```test_harness,no_run
8481/// # extern crate hyper;
8482/// # extern crate hyper_rustls;
8483/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
8484/// # async fn dox() {
8485/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8486///
8487/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8488/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8489/// # .with_native_roots()
8490/// # .unwrap()
8491/// # .https_only()
8492/// # .enable_http2()
8493/// # .build();
8494///
8495/// # let executor = hyper_util::rt::TokioExecutor::new();
8496/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8497/// # secret,
8498/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8499/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8500/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8501/// # ),
8502/// # ).build().await.unwrap();
8503///
8504/// # let client = hyper_util::client::legacy::Client::builder(
8505/// # hyper_util::rt::TokioExecutor::new()
8506/// # )
8507/// # .build(
8508/// # hyper_rustls::HttpsConnectorBuilder::new()
8509/// # .with_native_roots()
8510/// # .unwrap()
8511/// # .https_or_http()
8512/// # .enable_http2()
8513/// # .build()
8514/// # );
8515/// # let mut hub = ArtifactRegistry::new(client, auth);
8516/// // You can configure optional parameters by calling the respective setters at will, and
8517/// // execute the final call using `doit()`.
8518/// // Values shown here are possibly random and not representative !
8519/// let result = hub.projects().locations_get("name")
8520/// .doit().await;
8521/// # }
8522/// ```
8523pub struct ProjectLocationGetCall<'a, C>
8524where
8525 C: 'a,
8526{
8527 hub: &'a ArtifactRegistry<C>,
8528 _name: String,
8529 _delegate: Option<&'a mut dyn common::Delegate>,
8530 _additional_params: HashMap<String, String>,
8531 _scopes: BTreeSet<String>,
8532}
8533
8534impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
8535
8536impl<'a, C> ProjectLocationGetCall<'a, C>
8537where
8538 C: common::Connector,
8539{
8540 /// Perform the operation you have build so far.
8541 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
8542 use std::borrow::Cow;
8543 use std::io::{Read, Seek};
8544
8545 use common::{url::Params, ToParts};
8546 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8547
8548 let mut dd = common::DefaultDelegate;
8549 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8550 dlg.begin(common::MethodInfo {
8551 id: "artifactregistry.projects.locations.get",
8552 http_method: hyper::Method::GET,
8553 });
8554
8555 for &field in ["alt", "name"].iter() {
8556 if self._additional_params.contains_key(field) {
8557 dlg.finished(false);
8558 return Err(common::Error::FieldClash(field));
8559 }
8560 }
8561
8562 let mut params = Params::with_capacity(3 + self._additional_params.len());
8563 params.push("name", self._name);
8564
8565 params.extend(self._additional_params.iter());
8566
8567 params.push("alt", "json");
8568 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8569 if self._scopes.is_empty() {
8570 self._scopes
8571 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8572 }
8573
8574 #[allow(clippy::single_element_loop)]
8575 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8576 url = params.uri_replacement(url, param_name, find_this, true);
8577 }
8578 {
8579 let to_remove = ["name"];
8580 params.remove_params(&to_remove);
8581 }
8582
8583 let url = params.parse_with_url(&url);
8584
8585 loop {
8586 let token = match self
8587 .hub
8588 .auth
8589 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8590 .await
8591 {
8592 Ok(token) => token,
8593 Err(e) => match dlg.token(e) {
8594 Ok(token) => token,
8595 Err(e) => {
8596 dlg.finished(false);
8597 return Err(common::Error::MissingToken(e));
8598 }
8599 },
8600 };
8601 let mut req_result = {
8602 let client = &self.hub.client;
8603 dlg.pre_request();
8604 let mut req_builder = hyper::Request::builder()
8605 .method(hyper::Method::GET)
8606 .uri(url.as_str())
8607 .header(USER_AGENT, self.hub._user_agent.clone());
8608
8609 if let Some(token) = token.as_ref() {
8610 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8611 }
8612
8613 let request = req_builder
8614 .header(CONTENT_LENGTH, 0_u64)
8615 .body(common::to_body::<String>(None));
8616
8617 client.request(request.unwrap()).await
8618 };
8619
8620 match req_result {
8621 Err(err) => {
8622 if let common::Retry::After(d) = dlg.http_error(&err) {
8623 sleep(d).await;
8624 continue;
8625 }
8626 dlg.finished(false);
8627 return Err(common::Error::HttpError(err));
8628 }
8629 Ok(res) => {
8630 let (mut parts, body) = res.into_parts();
8631 let mut body = common::Body::new(body);
8632 if !parts.status.is_success() {
8633 let bytes = common::to_bytes(body).await.unwrap_or_default();
8634 let error = serde_json::from_str(&common::to_string(&bytes));
8635 let response = common::to_response(parts, bytes.into());
8636
8637 if let common::Retry::After(d) =
8638 dlg.http_failure(&response, error.as_ref().ok())
8639 {
8640 sleep(d).await;
8641 continue;
8642 }
8643
8644 dlg.finished(false);
8645
8646 return Err(match error {
8647 Ok(value) => common::Error::BadRequest(value),
8648 _ => common::Error::Failure(response),
8649 });
8650 }
8651 let response = {
8652 let bytes = common::to_bytes(body).await.unwrap_or_default();
8653 let encoded = common::to_string(&bytes);
8654 match serde_json::from_str(&encoded) {
8655 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8656 Err(error) => {
8657 dlg.response_json_decode_error(&encoded, &error);
8658 return Err(common::Error::JsonDecodeError(
8659 encoded.to_string(),
8660 error,
8661 ));
8662 }
8663 }
8664 };
8665
8666 dlg.finished(true);
8667 return Ok(response);
8668 }
8669 }
8670 }
8671 }
8672
8673 /// Resource name for the location.
8674 ///
8675 /// Sets the *name* path property to the given value.
8676 ///
8677 /// Even though the property as already been set when instantiating this call,
8678 /// we provide this method for API completeness.
8679 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
8680 self._name = new_value.to_string();
8681 self
8682 }
8683 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8684 /// while executing the actual API request.
8685 ///
8686 /// ````text
8687 /// It should be used to handle progress information, and to implement a certain level of resilience.
8688 /// ````
8689 ///
8690 /// Sets the *delegate* property to the given value.
8691 pub fn delegate(
8692 mut self,
8693 new_value: &'a mut dyn common::Delegate,
8694 ) -> ProjectLocationGetCall<'a, C> {
8695 self._delegate = Some(new_value);
8696 self
8697 }
8698
8699 /// Set any additional parameter of the query string used in the request.
8700 /// It should be used to set parameters which are not yet available through their own
8701 /// setters.
8702 ///
8703 /// Please note that this method must not be used to set any of the known parameters
8704 /// which have their own setter method. If done anyway, the request will fail.
8705 ///
8706 /// # Additional Parameters
8707 ///
8708 /// * *$.xgafv* (query-string) - V1 error format.
8709 /// * *access_token* (query-string) - OAuth access token.
8710 /// * *alt* (query-string) - Data format for response.
8711 /// * *callback* (query-string) - JSONP
8712 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8713 /// * *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.
8714 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8715 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8716 /// * *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.
8717 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8718 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8719 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
8720 where
8721 T: AsRef<str>,
8722 {
8723 self._additional_params
8724 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8725 self
8726 }
8727
8728 /// Identifies the authorization scope for the method you are building.
8729 ///
8730 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8731 /// [`Scope::CloudPlatformReadOnly`].
8732 ///
8733 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8734 /// tokens for more than one scope.
8735 ///
8736 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8737 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8738 /// sufficient, a read-write scope will do as well.
8739 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
8740 where
8741 St: AsRef<str>,
8742 {
8743 self._scopes.insert(String::from(scope.as_ref()));
8744 self
8745 }
8746 /// Identifies the authorization scope(s) for the method you are building.
8747 ///
8748 /// See [`Self::add_scope()`] for details.
8749 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
8750 where
8751 I: IntoIterator<Item = St>,
8752 St: AsRef<str>,
8753 {
8754 self._scopes
8755 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8756 self
8757 }
8758
8759 /// Removes all scopes, and no default scope will be used either.
8760 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8761 /// for details).
8762 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
8763 self._scopes.clear();
8764 self
8765 }
8766}
8767
8768/// Lists information about the supported locations for this service.
8769///
8770/// A builder for the *locations.list* method supported by a *project* resource.
8771/// It is not used directly, but through a [`ProjectMethods`] instance.
8772///
8773/// # Example
8774///
8775/// Instantiate a resource method builder
8776///
8777/// ```test_harness,no_run
8778/// # extern crate hyper;
8779/// # extern crate hyper_rustls;
8780/// # extern crate google_artifactregistry1_beta1 as artifactregistry1_beta1;
8781/// # async fn dox() {
8782/// # use artifactregistry1_beta1::{ArtifactRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8783///
8784/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8785/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8786/// # .with_native_roots()
8787/// # .unwrap()
8788/// # .https_only()
8789/// # .enable_http2()
8790/// # .build();
8791///
8792/// # let executor = hyper_util::rt::TokioExecutor::new();
8793/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8794/// # secret,
8795/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8796/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8797/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8798/// # ),
8799/// # ).build().await.unwrap();
8800///
8801/// # let client = hyper_util::client::legacy::Client::builder(
8802/// # hyper_util::rt::TokioExecutor::new()
8803/// # )
8804/// # .build(
8805/// # hyper_rustls::HttpsConnectorBuilder::new()
8806/// # .with_native_roots()
8807/// # .unwrap()
8808/// # .https_or_http()
8809/// # .enable_http2()
8810/// # .build()
8811/// # );
8812/// # let mut hub = ArtifactRegistry::new(client, auth);
8813/// // You can configure optional parameters by calling the respective setters at will, and
8814/// // execute the final call using `doit()`.
8815/// // Values shown here are possibly random and not representative !
8816/// let result = hub.projects().locations_list("name")
8817/// .page_token("dolore")
8818/// .page_size(-22)
8819/// .filter("voluptua.")
8820/// .add_extra_location_types("amet.")
8821/// .doit().await;
8822/// # }
8823/// ```
8824pub struct ProjectLocationListCall<'a, C>
8825where
8826 C: 'a,
8827{
8828 hub: &'a ArtifactRegistry<C>,
8829 _name: String,
8830 _page_token: Option<String>,
8831 _page_size: Option<i32>,
8832 _filter: Option<String>,
8833 _extra_location_types: Vec<String>,
8834 _delegate: Option<&'a mut dyn common::Delegate>,
8835 _additional_params: HashMap<String, String>,
8836 _scopes: BTreeSet<String>,
8837}
8838
8839impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
8840
8841impl<'a, C> ProjectLocationListCall<'a, C>
8842where
8843 C: common::Connector,
8844{
8845 /// Perform the operation you have build so far.
8846 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
8847 use std::borrow::Cow;
8848 use std::io::{Read, Seek};
8849
8850 use common::{url::Params, ToParts};
8851 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8852
8853 let mut dd = common::DefaultDelegate;
8854 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8855 dlg.begin(common::MethodInfo {
8856 id: "artifactregistry.projects.locations.list",
8857 http_method: hyper::Method::GET,
8858 });
8859
8860 for &field in [
8861 "alt",
8862 "name",
8863 "pageToken",
8864 "pageSize",
8865 "filter",
8866 "extraLocationTypes",
8867 ]
8868 .iter()
8869 {
8870 if self._additional_params.contains_key(field) {
8871 dlg.finished(false);
8872 return Err(common::Error::FieldClash(field));
8873 }
8874 }
8875
8876 let mut params = Params::with_capacity(7 + self._additional_params.len());
8877 params.push("name", self._name);
8878 if let Some(value) = self._page_token.as_ref() {
8879 params.push("pageToken", value);
8880 }
8881 if let Some(value) = self._page_size.as_ref() {
8882 params.push("pageSize", value.to_string());
8883 }
8884 if let Some(value) = self._filter.as_ref() {
8885 params.push("filter", value);
8886 }
8887 if !self._extra_location_types.is_empty() {
8888 for f in self._extra_location_types.iter() {
8889 params.push("extraLocationTypes", f);
8890 }
8891 }
8892
8893 params.extend(self._additional_params.iter());
8894
8895 params.push("alt", "json");
8896 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations";
8897 if self._scopes.is_empty() {
8898 self._scopes
8899 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8900 }
8901
8902 #[allow(clippy::single_element_loop)]
8903 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8904 url = params.uri_replacement(url, param_name, find_this, true);
8905 }
8906 {
8907 let to_remove = ["name"];
8908 params.remove_params(&to_remove);
8909 }
8910
8911 let url = params.parse_with_url(&url);
8912
8913 loop {
8914 let token = match self
8915 .hub
8916 .auth
8917 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8918 .await
8919 {
8920 Ok(token) => token,
8921 Err(e) => match dlg.token(e) {
8922 Ok(token) => token,
8923 Err(e) => {
8924 dlg.finished(false);
8925 return Err(common::Error::MissingToken(e));
8926 }
8927 },
8928 };
8929 let mut req_result = {
8930 let client = &self.hub.client;
8931 dlg.pre_request();
8932 let mut req_builder = hyper::Request::builder()
8933 .method(hyper::Method::GET)
8934 .uri(url.as_str())
8935 .header(USER_AGENT, self.hub._user_agent.clone());
8936
8937 if let Some(token) = token.as_ref() {
8938 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8939 }
8940
8941 let request = req_builder
8942 .header(CONTENT_LENGTH, 0_u64)
8943 .body(common::to_body::<String>(None));
8944
8945 client.request(request.unwrap()).await
8946 };
8947
8948 match req_result {
8949 Err(err) => {
8950 if let common::Retry::After(d) = dlg.http_error(&err) {
8951 sleep(d).await;
8952 continue;
8953 }
8954 dlg.finished(false);
8955 return Err(common::Error::HttpError(err));
8956 }
8957 Ok(res) => {
8958 let (mut parts, body) = res.into_parts();
8959 let mut body = common::Body::new(body);
8960 if !parts.status.is_success() {
8961 let bytes = common::to_bytes(body).await.unwrap_or_default();
8962 let error = serde_json::from_str(&common::to_string(&bytes));
8963 let response = common::to_response(parts, bytes.into());
8964
8965 if let common::Retry::After(d) =
8966 dlg.http_failure(&response, error.as_ref().ok())
8967 {
8968 sleep(d).await;
8969 continue;
8970 }
8971
8972 dlg.finished(false);
8973
8974 return Err(match error {
8975 Ok(value) => common::Error::BadRequest(value),
8976 _ => common::Error::Failure(response),
8977 });
8978 }
8979 let response = {
8980 let bytes = common::to_bytes(body).await.unwrap_or_default();
8981 let encoded = common::to_string(&bytes);
8982 match serde_json::from_str(&encoded) {
8983 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8984 Err(error) => {
8985 dlg.response_json_decode_error(&encoded, &error);
8986 return Err(common::Error::JsonDecodeError(
8987 encoded.to_string(),
8988 error,
8989 ));
8990 }
8991 }
8992 };
8993
8994 dlg.finished(true);
8995 return Ok(response);
8996 }
8997 }
8998 }
8999 }
9000
9001 /// The resource that owns the locations collection, if applicable.
9002 ///
9003 /// Sets the *name* path property to the given value.
9004 ///
9005 /// Even though the property as already been set when instantiating this call,
9006 /// we provide this method for API completeness.
9007 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9008 self._name = new_value.to_string();
9009 self
9010 }
9011 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
9012 ///
9013 /// Sets the *page token* query property to the given value.
9014 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9015 self._page_token = Some(new_value.to_string());
9016 self
9017 }
9018 /// The maximum number of results to return. If not set, the service selects a default.
9019 ///
9020 /// Sets the *page size* query property to the given value.
9021 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
9022 self._page_size = Some(new_value);
9023 self
9024 }
9025 /// 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).
9026 ///
9027 /// Sets the *filter* query property to the given value.
9028 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9029 self._filter = Some(new_value.to_string());
9030 self
9031 }
9032 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
9033 ///
9034 /// Append the given value to the *extra location types* query property.
9035 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9036 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9037 self._extra_location_types.push(new_value.to_string());
9038 self
9039 }
9040 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9041 /// while executing the actual API request.
9042 ///
9043 /// ````text
9044 /// It should be used to handle progress information, and to implement a certain level of resilience.
9045 /// ````
9046 ///
9047 /// Sets the *delegate* property to the given value.
9048 pub fn delegate(
9049 mut self,
9050 new_value: &'a mut dyn common::Delegate,
9051 ) -> ProjectLocationListCall<'a, C> {
9052 self._delegate = Some(new_value);
9053 self
9054 }
9055
9056 /// Set any additional parameter of the query string used in the request.
9057 /// It should be used to set parameters which are not yet available through their own
9058 /// setters.
9059 ///
9060 /// Please note that this method must not be used to set any of the known parameters
9061 /// which have their own setter method. If done anyway, the request will fail.
9062 ///
9063 /// # Additional Parameters
9064 ///
9065 /// * *$.xgafv* (query-string) - V1 error format.
9066 /// * *access_token* (query-string) - OAuth access token.
9067 /// * *alt* (query-string) - Data format for response.
9068 /// * *callback* (query-string) - JSONP
9069 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9070 /// * *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.
9071 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9072 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9073 /// * *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.
9074 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9075 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9076 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
9077 where
9078 T: AsRef<str>,
9079 {
9080 self._additional_params
9081 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9082 self
9083 }
9084
9085 /// Identifies the authorization scope for the method you are building.
9086 ///
9087 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9088 /// [`Scope::CloudPlatformReadOnly`].
9089 ///
9090 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9091 /// tokens for more than one scope.
9092 ///
9093 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9094 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9095 /// sufficient, a read-write scope will do as well.
9096 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
9097 where
9098 St: AsRef<str>,
9099 {
9100 self._scopes.insert(String::from(scope.as_ref()));
9101 self
9102 }
9103 /// Identifies the authorization scope(s) for the method you are building.
9104 ///
9105 /// See [`Self::add_scope()`] for details.
9106 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
9107 where
9108 I: IntoIterator<Item = St>,
9109 St: AsRef<str>,
9110 {
9111 self._scopes
9112 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9113 self
9114 }
9115
9116 /// Removes all scopes, and no default scope will be used either.
9117 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9118 /// for details).
9119 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
9120 self._scopes.clear();
9121 self
9122 }
9123}