chore(json-update): update json and regen all code

This commit is contained in:
Sebastian Thiel
2015-06-26 16:08:25 +02:00
parent 615ac64ec1
commit 7d58d66025
596 changed files with 35453 additions and 5854 deletions

View File

@@ -12,7 +12,7 @@ use oauth2::{TokenType, Retry, self};
use hyper;
use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header,
HeaderFormat};
use hyper::http::LINE_ENDING;
use hyper::http::h1::LINE_ENDING;
use hyper::method::Method;
use hyper::status::StatusCode;
@@ -504,7 +504,7 @@ impl ::std::ops::DerefMut for XUploadContentType {
}
impl Header for XUploadContentType {
fn header_name() -> &'static str { "X-Upload-Content-Type" }
fn parse_header(raw: &[Vec<u8>]) -> Option<Self> {
fn parse_header(raw: &[Vec<u8>]) -> hyper::error::Result<Self> {
hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType)
}
}
@@ -569,8 +569,8 @@ impl Header for ContentRange {
}
/// We are not parsable, as parsing is done by the `Range` header
fn parse_header(_: &[Vec<u8>]) -> Option<Self> {
None
fn parse_header(_: &[Vec<u8>]) -> hyper::error::Result<Self> {
Err(hyper::error::Error::Method)
}
}
@@ -595,19 +595,19 @@ impl Header for RangeResponseHeader {
"Range"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<Self> {
fn parse_header(raw: &[Vec<u8>]) -> hyper::error::Result<Self> {
if raw.len() > 0 {
let v = &raw[0];
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes ";
if s.starts_with(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
return Some(RangeResponseHeader(c))
return Ok(RangeResponseHeader(c))
}
}
}
}
None
Err(hyper::error::Error::Method)
}
}

View File

@@ -2,7 +2,7 @@
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *bigquery* crate version *0.1.8+20150326*, where *20150326* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.8*.
//! This documentation was generated from *bigquery* crate version *0.1.8+20150526*, where *20150526* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.8*.
//!
//! Everything else about the *bigquery* *v2* API can be found at the
//! [official documentation site](https://cloud.google.com/bigquery/).
@@ -14,7 +14,7 @@
//! * [datasets](struct.Dataset.html)
//! * [*delete*](struct.DatasetDeleteCall.html), [*get*](struct.DatasetGetCall.html), [*insert*](struct.DatasetInsertCall.html), [*list*](struct.DatasetListCall.html), [*patch*](struct.DatasetPatchCall.html) and [*update*](struct.DatasetUpdateCall.html)
//! * [jobs](struct.Job.html)
//! * [*get*](struct.JobGetCall.html), [*get query results*](struct.JobGetQueryResultCall.html), [*insert*](struct.JobInsertCall.html), [*list*](struct.JobListCall.html) and [*query*](struct.JobQueryCall.html)
//! * [*cancel*](struct.JobCancelCall.html), [*get*](struct.JobGetCall.html), [*get query results*](struct.JobGetQueryResultCall.html), [*insert*](struct.JobInsertCall.html), [*list*](struct.JobListCall.html) and [*query*](struct.JobQueryCall.html)
//! * projects
//! * [*list*](struct.ProjectListCall.html)
//! * tabledata

View File

@@ -388,6 +388,8 @@ pub struct Dataset {
pub default_table_expiration_ms: Option<String>,
/// [Output-only] A hash of the resource.
pub etag: Option<String>,
/// [Experimental] The location where the data resides. If not present, the data will be stored in the US.
pub location: Option<String>,
/// [Optional] A descriptive name for the dataset.
#[serde(rename="friendlyName")]
pub friendly_name: Option<String>,
@@ -422,7 +424,7 @@ impl NestedType for TableDataInsertAllResponseInsertErrors {}
impl Part for TableDataInsertAllResponseInsertErrors {}
/// Represents a single cell in the result set. Users of the java client can detect whether their value result is null by calling 'com.google.api.client.util.Data.isNull(cell.getV())'.
/// There is no detailed description.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
@@ -576,11 +578,12 @@ impl ResponseResult for TableDataList {}
/// 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 jobs](struct.JobInsertCall.html) (request|response)
/// * [query jobs](struct.JobQueryCall.html) (none)
/// * [cancel jobs](struct.JobCancelCall.html) (none)
/// * [list jobs](struct.JobListCall.html) (none)
/// * [get query results jobs](struct.JobGetQueryResultCall.html) (none)
/// * [query jobs](struct.JobQueryCall.html) (none)
/// * [get jobs](struct.JobGetCall.html) (response)
/// * [insert jobs](struct.JobInsertCall.html) (request|response)
///
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Job {
@@ -680,7 +683,7 @@ pub struct JobConfigurationLoad {
/// [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
#[serde(rename="ignoreUnknownValues")]
pub ignore_unknown_values: Option<bool>,
/// [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
/// [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
#[serde(rename="writeDisposition")]
pub write_disposition: Option<String>,
/// [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
@@ -716,9 +719,6 @@ pub struct JobList {
/// A token to request the next page of results.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// Total number of jobs in this collection.
#[serde(rename="totalItems")]
pub total_items: Option<i32>,
/// The resource type of the response.
pub kind: Option<String>,
/// A hash of this page of results.
@@ -1081,7 +1081,7 @@ pub struct JobConfigurationQuery {
/// [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
#[serde(rename="flattenResults")]
pub flatten_results: Option<bool>,
/// [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified.
/// [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.
#[serde(rename="useQueryCache")]
pub use_query_cache: Option<bool>,
/// [Optional] Specifies the default dataset to use for unqualified table names in the query.
@@ -1131,13 +1131,13 @@ pub struct DatasetReference {
impl Part for DatasetReference {}
/// Represents a single row in the result set, consisting of one or more fields.
/// There is no detailed description.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TableRow {
/// no description provided
/// Represents a single row in the result set, consisting of one or more fields.
pub f: Option<Vec<TableCell>>,
}
@@ -1193,6 +1193,26 @@ impl NestedType for ProjectListProjects {}
impl Part for ProjectListProjects {}
/// 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*).
///
/// * [cancel jobs](struct.JobCancelCall.html) (response)
///
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct JobCancelResponse {
/// The final state of the job.
pub job: Option<Job>,
/// The resource type of the response.
pub kind: Option<String>,
}
impl ResponseResult for JobCancelResponse {}
/// There is no detailed description.
///
/// This type is not used in any activity, and only used as *part* of another schema.
@@ -1722,7 +1742,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> {
/// <MemoryStorage as Default>::default(), None);
/// let mut hub = Bigquery::new(hyper::Client::new(), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `get(...)`, `get_query_results(...)`, `insert(...)`, `list(...)` and `query(...)`
/// // like `cancel(...)`, `get(...)`, `get_query_results(...)`, `insert(...)`, `list(...)` and `query(...)`
/// // to build up your call.
/// let rb = hub.jobs();
/// # }
@@ -1737,6 +1757,25 @@ impl<'a, C, A> MethodsBuilder for JobMethods<'a, C, A> {}
impl<'a, C, A> JobMethods<'a, C, A> {
/// Create a builder to help you perform the following task:
///
/// Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully.
///
/// # Arguments
///
/// * `projectId` - Project ID of the job to cancel
/// * `jobId` - Job ID of the job to cancel
pub fn cancel(&self, project_id: &str, job_id: &str) -> JobCancelCall<'a, C, A> {
JobCancelCall {
hub: self.hub,
_project_id: project_id.to_string(),
_job_id: job_id.to_string(),
_delegate: Default::default(),
_scopes: Default::default(),
_additional_params: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
@@ -5227,6 +5266,254 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
}
/// Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully.
///
/// A builder for the *cancel* method supported by a *job* resource.
/// It is not used directly, but through a `JobMethods` instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate yup_oauth2 as oauth2;
/// # extern crate google_bigquery2 as bigquery2;
/// # #[test] fn egal() {
/// # use std::default::Default;
/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
/// # use bigquery2::Bigquery;
///
/// # let secret: ApplicationSecret = Default::default();
/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
/// # hyper::Client::new(),
/// # <MemoryStorage as Default>::default(), None);
/// # let mut hub = Bigquery::new(hyper::Client::new(), 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.jobs().cancel("projectId", "jobId")
/// .doit();
/// # }
/// ```
pub struct JobCancelCall<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Bigquery<C, A>,
_project_id: String,
_job_id: String,
_delegate: Option<&'a mut Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C, A> CallBuilder for JobCancelCall<'a, C, A> {}
impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
/// Perform the operation you have build so far.
pub fn doit(mut self) -> Result<(hyper::client::Response, JobCancelResponse)> {
use std::io::{Read, Seek};
use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location};
let mut dd = DefaultDelegate;
let mut dlg: &mut Delegate = match self._delegate {
Some(d) => d,
None => &mut dd
};
dlg.begin(MethodInfo { id: "bigquery.jobs.cancel",
http_method: hyper::method::Method::Post });
let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len()));
params.push(("projectId", self._project_id.to_string()));
params.push(("jobId", self._job_id.to_string()));
for &field in ["alt", "projectId", "jobId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(Error::FieldClash(field));
}
}
for (name, value) in self._additional_params.iter() {
params.push((&name, value.clone()));
}
params.push(("alt", "json".to_string()));
let mut url = "https://www.googleapis.com/bigquery/v2/project/{projectId}/jobs/{jobId}/cancel".to_string();
if self._scopes.len() == 0 {
self._scopes.insert(Scope::Full.as_ref().to_string(), ());
}
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{jobId}", "jobId")].iter() {
let mut replace_with: Option<&str> = None;
for &(name, ref value) in params.iter() {
if name == param_name {
replace_with = Some(value);
break;
}
}
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
}
{
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
for param_name in ["jobId", "projectId"].iter() {
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
indices_for_removal.push(index);
}
}
for &index in indices_for_removal.iter() {
params.remove(index);
}
}
if params.len() > 0 {
url.push('?');
url.push_str(&url::form_urlencoded::serialize(params));
}
loop {
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
Ok(token) => token,
Err(err) => {
match dlg.token(&*err) {
Some(token) => token,
None => {
dlg.finished(false);
return Err(Error::MissingToken(err))
}
}
}
};
let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer,
access_token: token.access_token });
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone());
dlg.pre_request();
req.send()
};
match req_result {
Err(err) => {
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::HttpError(err))
}
Ok(mut res) => {
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
res.read_to_string(&mut json_response).unwrap();
match json::from_str(&json_response) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
/// Project ID of the job to cancel
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> JobCancelCall<'a, C, A> {
self._project_id = new_value.to_string();
self
}
/// Job ID of the job to cancel
///
/// Sets the *job id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn job_id(mut self, new_value: &str) -> JobCancelCall<'a, C, A> {
self._job_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// It should be used to handle progress information, and to implement a certain level of resilience.
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut Delegate) -> JobCancelCall<'a, C, A> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known paramters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *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. Overrides userIp if both are provided.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *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.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *alt* (query-string) - Data format for the response.
pub fn param<T>(mut self, name: T, value: T) -> JobCancelCall<'a, C, A>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead the default `Scope` variant
/// `Scope::Full`.
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<T>(mut self, scope: T) -> JobCancelCall<'a, C, A>
where T: AsRef<str> {
self._scopes.insert(scope.as_ref().to_string(), ());
self
}
}
/// Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
///
/// A builder for the *query* method supported by a *job* resource.
@@ -5521,10 +5808,10 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oaut
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.jobs().get_query_results("projectId", "jobId")
/// .timeout_ms(65)
/// .start_index("eirmod")
/// .page_token("dolore")
/// .max_results(64)
/// .timeout_ms(68)
/// .start_index("invidunt")
/// .page_token("aliquyam")
/// .max_results(28)
/// .doit();
/// # }
/// ```
@@ -5817,11 +6104,11 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut<hyper::Client>
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.jobs().list("projectId")
/// .add_state_filter("accusam")
/// .projection("Lorem")
/// .page_token("sea")
/// .add_state_filter("sea")
/// .projection("et")
/// .page_token("duo")
/// .max_results(80)
/// .all_users(false)
/// .all_users(true)
/// .doit();
/// # }
/// ```
@@ -7037,9 +7324,9 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut<hyper::Client
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.tabledata().list("projectId", "datasetId", "tableId")
/// .start_index("sed")
/// .start_index("dolor")
/// .page_token("dolor")
/// .max_results(53)
/// .max_results(78)
/// .doit();
/// # }
/// ```
@@ -7333,8 +7620,8 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().list()
/// .page_token("dolor")
/// .max_results(78)
/// .page_token("consetetur")
/// .max_results(49)
/// .doit();
/// # }
/// ```