make regen-apis

This commit is contained in:
OMGeeky
2023-10-21 23:50:27 +02:00
parent b09392b768
commit ec6083f22f
1959 changed files with 911619 additions and 913545 deletions

View File

@@ -1,489 +1,4 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
// ##############
// UTILITIES ###
// ############
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug)]
pub enum Scope {
/// View and manage G Suite licenses for your domain
AppLicensing,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::AppLicensing => "https://www.googleapis.com/auth/apps.licensing",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::AppLicensing
}
}
// ########
// HUB ###
// ######
/// Central instance to access all Licensing related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_licensing1 as licensing1;
/// use licensing1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use licensing1::{Licensing, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Licensing::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.license_assignments().list_for_product_and_sku("productId", "skuId", "customerId")
/// .page_token("gubergren")
/// .max_results(50)
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct Licensing<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, S> client::Hub for Licensing<S> {}
impl<'a, S> Licensing<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Licensing<S> {
Licensing {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://licensing.googleapis.com/".to_string(),
_root_url: "https://licensing.googleapis.com/".to_string(),
}
}
pub fn license_assignments(&'a self) -> LicenseAssignmentMethods<'a, S> {
LicenseAssignmentMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://licensing.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://licensing.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// 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); }
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [delete license assignments](LicenseAssignmentDeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// Representation of a license assignment.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [delete license assignments](LicenseAssignmentDeleteCall) (none)
/// * [get license assignments](LicenseAssignmentGetCall) (response)
/// * [insert license assignments](LicenseAssignmentInsertCall) (response)
/// * [list for product license assignments](LicenseAssignmentListForProductCall) (none)
/// * [list for product and sku license assignments](LicenseAssignmentListForProductAndSkuCall) (none)
/// * [patch license assignments](LicenseAssignmentPatchCall) (request|response)
/// * [update license assignments](LicenseAssignmentUpdateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct LicenseAssignment {
/// ETag of the resource.
pub etags: Option<String>,
/// Identifies the resource as a LicenseAssignment, which is `licensing#licenseAssignment`.
pub kind: Option<String>,
/// A product's unique identifier. For more information about products in this version of the API, see Product and SKU IDs.
#[serde(rename="productId")]
pub product_id: Option<String>,
/// Display Name of the product.
#[serde(rename="productName")]
pub product_name: Option<String>,
/// Link to this page.
#[serde(rename="selfLink")]
pub self_link: Option<String>,
/// A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
#[serde(rename="skuId")]
pub sku_id: Option<String>,
/// Display Name of the sku of the product.
#[serde(rename="skuName")]
pub sku_name: Option<String>,
/// The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
#[serde(rename="userId")]
pub user_id: Option<String>,
}
impl client::RequestValue for LicenseAssignment {}
impl client::Resource for LicenseAssignment {}
impl client::ResponseResult for LicenseAssignment {}
/// Representation of a license assignment.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [insert license assignments](LicenseAssignmentInsertCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct LicenseAssignmentInsert {
/// Email id of the user
#[serde(rename="userId")]
pub user_id: Option<String>,
}
impl client::RequestValue for LicenseAssignmentInsert {}
/// There is no detailed description.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [list for product license assignments](LicenseAssignmentListForProductCall) (response)
/// * [list for product and sku license assignments](LicenseAssignmentListForProductAndSkuCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct LicenseAssignmentList {
/// ETag of the resource.
pub etag: Option<String>,
/// The LicenseAssignments in this page of results.
pub items: Option<Vec<LicenseAssignment>>,
/// Identifies the resource as a collection of LicenseAssignments.
pub kind: Option<String>,
/// The token that you must submit in a subsequent request to retrieve additional license results matching your query parameters. The `maxResults` query string is related to the `nextPageToken` since `maxResults` determines how many entries are returned on each next page.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for LicenseAssignmentList {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *licenseAssignment* resources.
/// It is not used directly, but through the [`Licensing`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_licensing1 as licensing1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use licensing1::{Licensing, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Licensing::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `delete(...)`, `get(...)`, `insert(...)`, `list_for_product(...)`, `list_for_product_and_sku(...)`, `patch(...)` and `update(...)`
/// // to build up your call.
/// let rb = hub.license_assignments();
/// # }
/// ```
pub struct LicenseAssignmentMethods<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
}
impl<'a, S> client::MethodsBuilder for LicenseAssignmentMethods<'a, S> {}
impl<'a, S> LicenseAssignmentMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Revoke a license.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn delete(&self, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentDeleteCall<'a, S> {
LicenseAssignmentDeleteCall {
hub: self.hub,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get a specific user's license by product SKU.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn get(&self, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentGetCall<'a, S> {
LicenseAssignmentGetCall {
hub: self.hub,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Assign a license.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
pub fn insert(&self, request: LicenseAssignmentInsert, product_id: &str, sku_id: &str) -> LicenseAssignmentInsertCall<'a, S> {
LicenseAssignmentInsertCall {
hub: self.hub,
_request: request,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all users assigned licenses for a specific product SKU.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `customerId` - The customer's unique ID as defined in the Admin console, such as `C00000000`. If the customer is suspended, the server returns an error.
pub fn list_for_product(&self, product_id: &str, customer_id: &str) -> LicenseAssignmentListForProductCall<'a, S> {
LicenseAssignmentListForProductCall {
hub: self.hub,
_product_id: product_id.to_string(),
_customer_id: customer_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all users assigned licenses for a specific product SKU.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `customerId` - The customer's unique ID as defined in the Admin console, such as `C00000000`. If the customer is suspended, the server returns an error.
pub fn list_for_product_and_sku(&self, product_id: &str, sku_id: &str, customer_id: &str) -> LicenseAssignmentListForProductAndSkuCall<'a, S> {
LicenseAssignmentListForProductAndSkuCall {
hub: self.hub,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_customer_id: customer_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Reassign a user's product SKU with a different SKU in the same product. This method supports patch semantics.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn patch(&self, request: LicenseAssignment, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentPatchCall<'a, S> {
LicenseAssignmentPatchCall {
hub: self.hub,
_request: request,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Reassign a user's product SKU with a different SKU in the same product.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn update(&self, request: LicenseAssignment, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentUpdateCall<'a, S> {
LicenseAssignmentUpdateCall {
hub: self.hub,
_request: request,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
use super::*;
/// Revoke a license.
///
/// A builder for the *delete* method supported by a *licenseAssignment* resource.
@@ -517,13 +32,13 @@ impl<'a, S> LicenseAssignmentMethods<'a, S> {
pub struct LicenseAssignmentDeleteCall<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
_product_id: String,
_sku_id: String,
_user_id: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a Licensing<S>,
pub(super) _product_id: String,
pub(super) _sku_id: String,
pub(super) _user_id: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for LicenseAssignmentDeleteCall<'a, S> {}
@@ -803,13 +318,13 @@ where
pub struct LicenseAssignmentGetCall<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
_product_id: String,
_sku_id: String,
_user_id: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a Licensing<S>,
pub(super) _product_id: String,
pub(super) _sku_id: String,
pub(super) _user_id: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for LicenseAssignmentGetCall<'a, S> {}
@@ -1095,13 +610,13 @@ where
pub struct LicenseAssignmentInsertCall<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
_request: LicenseAssignmentInsert,
_product_id: String,
_sku_id: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a Licensing<S>,
pub(super) _request: LicenseAssignmentInsert,
pub(super) _product_id: String,
pub(super) _sku_id: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for LicenseAssignmentInsertCall<'a, S> {}
@@ -1395,14 +910,14 @@ where
pub struct LicenseAssignmentListForProductCall<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
_product_id: String,
_customer_id: String,
_page_token: Option<String>,
_max_results: Option<u32>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a Licensing<S>,
pub(super) _product_id: String,
pub(super) _customer_id: String,
pub(super) _page_token: Option<String>,
pub(super) _max_results: Option<u32>,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for LicenseAssignmentListForProductCall<'a, S> {}
@@ -1693,15 +1208,15 @@ where
pub struct LicenseAssignmentListForProductAndSkuCall<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
_product_id: String,
_sku_id: String,
_customer_id: String,
_page_token: Option<String>,
_max_results: Option<u32>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a Licensing<S>,
pub(super) _product_id: String,
pub(super) _sku_id: String,
pub(super) _customer_id: String,
pub(super) _page_token: Option<String>,
pub(super) _max_results: Option<u32>,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for LicenseAssignmentListForProductAndSkuCall<'a, S> {}
@@ -2007,14 +1522,14 @@ where
pub struct LicenseAssignmentPatchCall<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
_request: LicenseAssignment,
_product_id: String,
_sku_id: String,
_user_id: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a Licensing<S>,
pub(super) _request: LicenseAssignment,
pub(super) _product_id: String,
pub(super) _sku_id: String,
pub(super) _user_id: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for LicenseAssignmentPatchCall<'a, S> {}
@@ -2323,14 +1838,14 @@ where
pub struct LicenseAssignmentUpdateCall<'a, S>
where S: 'a {
hub: &'a Licensing<S>,
_request: LicenseAssignment,
_product_id: String,
_sku_id: String,
_user_id: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a Licensing<S>,
pub(super) _request: LicenseAssignment,
pub(super) _product_id: String,
pub(super) _sku_id: String,
pub(super) _user_id: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for LicenseAssignmentUpdateCall<'a, S> {}

View File

@@ -0,0 +1,108 @@
use super::*;
/// Central instance to access all Licensing related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_licensing1 as licensing1;
/// use licensing1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use licensing1::{Licensing, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Licensing::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.license_assignments().list_for_product_and_sku("productId", "skuId", "customerId")
/// .page_token("gubergren")
/// .max_results(50)
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct Licensing<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for Licensing<S> {}
impl<'a, S> Licensing<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Licensing<S> {
Licensing {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://licensing.googleapis.com/".to_string(),
_root_url: "https://licensing.googleapis.com/".to_string(),
}
}
pub fn license_assignments(&'a self) -> LicenseAssignmentMethods<'a, S> {
LicenseAssignmentMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://licensing.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://licensing.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -0,0 +1,195 @@
use super::*;
/// A builder providing access to all methods supported on *licenseAssignment* resources.
/// It is not used directly, but through the [`Licensing`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_licensing1 as licensing1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use licensing1::{Licensing, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Licensing::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `delete(...)`, `get(...)`, `insert(...)`, `list_for_product(...)`, `list_for_product_and_sku(...)`, `patch(...)` and `update(...)`
/// // to build up your call.
/// let rb = hub.license_assignments();
/// # }
/// ```
pub struct LicenseAssignmentMethods<'a, S>
where S: 'a {
pub(super) hub: &'a Licensing<S>,
}
impl<'a, S> client::MethodsBuilder for LicenseAssignmentMethods<'a, S> {}
impl<'a, S> LicenseAssignmentMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Revoke a license.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn delete(&self, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentDeleteCall<'a, S> {
LicenseAssignmentDeleteCall {
hub: self.hub,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get a specific user's license by product SKU.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn get(&self, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentGetCall<'a, S> {
LicenseAssignmentGetCall {
hub: self.hub,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Assign a license.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
pub fn insert(&self, request: LicenseAssignmentInsert, product_id: &str, sku_id: &str) -> LicenseAssignmentInsertCall<'a, S> {
LicenseAssignmentInsertCall {
hub: self.hub,
_request: request,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all users assigned licenses for a specific product SKU.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `customerId` - The customer's unique ID as defined in the Admin console, such as `C00000000`. If the customer is suspended, the server returns an error.
pub fn list_for_product(&self, product_id: &str, customer_id: &str) -> LicenseAssignmentListForProductCall<'a, S> {
LicenseAssignmentListForProductCall {
hub: self.hub,
_product_id: product_id.to_string(),
_customer_id: customer_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all users assigned licenses for a specific product SKU.
///
/// # Arguments
///
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `customerId` - The customer's unique ID as defined in the Admin console, such as `C00000000`. If the customer is suspended, the server returns an error.
pub fn list_for_product_and_sku(&self, product_id: &str, sku_id: &str, customer_id: &str) -> LicenseAssignmentListForProductAndSkuCall<'a, S> {
LicenseAssignmentListForProductAndSkuCall {
hub: self.hub,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_customer_id: customer_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Reassign a user's product SKU with a different SKU in the same product. This method supports patch semantics.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn patch(&self, request: LicenseAssignment, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentPatchCall<'a, S> {
LicenseAssignmentPatchCall {
hub: self.hub,
_request: request,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Reassign a user's product SKU with a different SKU in the same product.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `productId` - A product's unique identifier. For more information about products in this version of the API, see Products and SKUs.
/// * `skuId` - A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
/// * `userId` - The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
pub fn update(&self, request: LicenseAssignment, product_id: &str, sku_id: &str, user_id: &str) -> LicenseAssignmentUpdateCall<'a, S> {
LicenseAssignmentUpdateCall {
hub: self.hub,
_request: request,
_product_id: product_id.to_string(),
_sku_id: sku_id.to_string(),
_user_id: user_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,120 @@
use super::*;
/// 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); }
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [delete license assignments](LicenseAssignmentDeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// Representation of a license assignment.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [delete license assignments](LicenseAssignmentDeleteCall) (none)
/// * [get license assignments](LicenseAssignmentGetCall) (response)
/// * [insert license assignments](LicenseAssignmentInsertCall) (response)
/// * [list for product license assignments](LicenseAssignmentListForProductCall) (none)
/// * [list for product and sku license assignments](LicenseAssignmentListForProductAndSkuCall) (none)
/// * [patch license assignments](LicenseAssignmentPatchCall) (request|response)
/// * [update license assignments](LicenseAssignmentUpdateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct LicenseAssignment {
/// ETag of the resource.
pub etags: Option<String>,
/// Identifies the resource as a LicenseAssignment, which is `licensing#licenseAssignment`.
pub kind: Option<String>,
/// A product's unique identifier. For more information about products in this version of the API, see Product and SKU IDs.
#[serde(rename="productId")]
pub product_id: Option<String>,
/// Display Name of the product.
#[serde(rename="productName")]
pub product_name: Option<String>,
/// Link to this page.
#[serde(rename="selfLink")]
pub self_link: Option<String>,
/// A product SKU's unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
#[serde(rename="skuId")]
pub sku_id: Option<String>,
/// Display Name of the sku of the product.
#[serde(rename="skuName")]
pub sku_name: Option<String>,
/// The user's current primary email address. If the user's email address changes, use the new email address in your API requests. Since a `userId` is subject to change, do not use a `userId` value as a key for persistent data. This key could break if the current user's email address changes. If the `userId` is suspended, the license status changes.
#[serde(rename="userId")]
pub user_id: Option<String>,
}
impl client::RequestValue for LicenseAssignment {}
impl client::Resource for LicenseAssignment {}
impl client::ResponseResult for LicenseAssignment {}
/// Representation of a license assignment.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [insert license assignments](LicenseAssignmentInsertCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct LicenseAssignmentInsert {
/// Email id of the user
#[serde(rename="userId")]
pub user_id: Option<String>,
}
impl client::RequestValue for LicenseAssignmentInsert {}
/// There is no detailed description.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [list for product license assignments](LicenseAssignmentListForProductCall) (response)
/// * [list for product and sku license assignments](LicenseAssignmentListForProductAndSkuCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct LicenseAssignmentList {
/// ETag of the resource.
pub etag: Option<String>,
/// The LicenseAssignments in this page of results.
pub items: Option<Vec<LicenseAssignment>>,
/// Identifies the resource as a collection of LicenseAssignments.
pub kind: Option<String>,
/// The token that you must submit in a subsequent request to retrieve additional license results matching your query parameters. The `maxResults` query string is related to the `nextPageToken` since `maxResults` determines how many entries are returned on each next page.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for LicenseAssignmentList {}

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// View and manage G Suite licenses for your domain
AppLicensing,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::AppLicensing => "https://www.googleapis.com/auth/apps.licensing",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::AppLicensing
}
}