chore(code): updated to latest state

This commit is contained in:
Sebastian Thiel
2016-01-30 14:08:25 +01:00
parent 5cba22f0c6
commit 75076acf16
1164 changed files with 241839 additions and 123033 deletions

View File

@@ -4,7 +4,7 @@
[package]
name = "google-logging2_beta1"
version = "0.1.10+20151007"
version = "0.1.11+20160104"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with logging (protocol v2beta1)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1"
@@ -20,7 +20,7 @@ hyper = "0.7"
mime = "0.1.0"
serde = ">= 0.6.0"
serde_json = ">= 0.6.0"
yup-oauth2 = "0.5"
yup-oauth2 = ">= 0.5.4"
url = ">= 0.5"
[build-dependencies]

View File

@@ -6,7 +6,7 @@ DO NOT EDIT !
The MIT License (MIT)
=====================
Copyright © `2015` `Sebastian Thiel`
Copyright © `2015-2016` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View File

@@ -5,14 +5,20 @@ DO NOT EDIT !
-->
The `google-logging2_beta1` library allows access to all features of the *Google logging* service.
This documentation was generated from *logging* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*.
This documentation was generated from *logging* crate version *0.1.11+20160104*, where *20160104* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*.
Everything else about the *logging* *v2_beta1* API can be found at the
[official documentation site](https://cloud.google.com/logging/docs/).
# Features
It seems there is nothing you can do here ... .
Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.Logging.html) ...
* entries
* [*list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.EntryListCall.html) and [*write*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.EntryWriteCall.html)
* [monitored resource descriptors](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.MonitoredResourceDescriptor.html)
* [*list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.MonitoredResourceDescriptorListCall.html)
* projects
* [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectLogDeleteCall.html), [*metrics create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkUpdateCall.html)
@@ -42,6 +48,13 @@ Generally speaking, you can invoke *Activities* like this:
let r = hub.resource().activity(...).doit()
```
Or specifically ...
```ignore
let r = hub.projects().sinks_get(...).doit()
let r = hub.projects().sinks_update(...).doit()
let r = hub.projects().sinks_create(...).doit()
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
@@ -65,7 +78,8 @@ google-logging2_beta1 = "*"
extern crate hyper;
extern crate yup_oauth2 as oauth2;
extern crate google_logging2_beta1 as logging2_beta1;
use logging2_beta1::LogSink;
use logging2_beta1::{Result, Error};
use std::default::Default;
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
use logging2_beta1::Logging;
@@ -82,9 +96,35 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
hyper::Client::new(),
<MemoryStorage as Default>::default(), None);
let mut hub = Logging::new(hyper::Client::new(), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = LogSink::default();
// 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.projects().sinks_update(req, "sinkName")
.doit();
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::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_logging2_beta1/enum.Result.html) enumeration as return value of

View File

@@ -5,7 +5,8 @@ use std;
use std::fmt::{self, Display};
use std::str::FromStr;
use std::error;
use std::thread::sleep_ms;
use std::thread::sleep;
use std::time::Duration;
use mime::{Mime, TopLevel, SubLevel, Attr, Value};
use oauth2::{TokenType, Retry, self};
@@ -43,7 +44,7 @@ pub trait RequestValue {}
/// This might be a bug within the google API schema.
pub trait UnusedType {}
/// Identifies types which are only used as part of other types, which
/// Identifies types which are only used as part of other types, which
/// usually are carrying the `Resource` trait.
pub trait Part {}
@@ -78,7 +79,7 @@ pub struct ErrorResponse {
pub struct ServerError {
errors: Vec<ServerMessage>,
code: u16,
message: String,
message: String,
}
#[derive(Deserialize, Serialize, Debug)]
@@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream {
Ok("127.0.0.1:1337".parse().unwrap())
}
fn set_read_timeout(&self, _dur: Option<std::time::Duration>) -> io::Result<()> {
fn set_read_timeout(&self, _dur: Option<Duration>) -> io::Result<()> {
Ok(())
}
fn set_write_timeout(&self, _dur: Option<std::time::Duration>) -> io::Result<()> {
fn set_write_timeout(&self, _dur: Option<Duration>) -> io::Result<()> {
Ok(())
}
}
@@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream {
/// A trait specifying functionality to help controlling any request performed by the API.
/// The trait has a conservative default implementation.
///
/// It contains methods to deal with all common issues, as well with the ones related to
/// It contains methods to deal with all common issues, as well with the ones related to
/// uploading media
pub trait Delegate {
@@ -136,12 +137,12 @@ pub trait Delegate {
/// information if he is interesting in knowing more context when further calls to it
/// are made.
/// The matching `finished()` call will always be made, no matter whether or not the API
/// request was successful. That way, the delegate may easily maintain a clean state
/// request was successful. That way, the delegate may easily maintain a clean state
/// between various API calls.
fn begin(&mut self, MethodInfo) {}
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
///
///
/// If you choose to retry after a duration, the duration should be chosen using the
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
///
@@ -150,7 +151,7 @@ pub trait Delegate {
Retry::Abort
}
/// Called whenever there is the need for your applications API key after
/// Called whenever there is the need for your applications API key after
/// the official authenticator implementation didn't provide one, for some reason.
/// If this method returns None as well, the underlying operation will fail
fn api_key(&mut self) -> Option<String> {
@@ -179,7 +180,7 @@ pub trait Delegate {
}
/// Called after we have retrieved a new upload URL for a resumable upload to store it
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
/// see `upload_url()`.
/// It will also be called with None after a successful upload, which allows the delegate
/// to forget the URL. That way, we will not attempt to resume an upload that has already
@@ -191,7 +192,7 @@ pub trait Delegate {
/// Called whenever a server response could not be decoded from json.
/// It's for informational purposes only, the caller will return with an error
/// accordingly.
///
///
/// # Arguments
///
/// * `json_encoded_value` - The json-encoded value which failed to decode.
@@ -202,7 +203,7 @@ pub trait Delegate {
}
/// Called whenever the http request returns with a non-success status code.
/// This can involve authentication issues, or anything else that very much
/// This can involve authentication issues, or anything else that very much
/// depends on the used API method.
/// The delegate should check the status, header and decoded json error to decide
/// whether to retry or not. In the latter case, the underlying call will fail.
@@ -213,7 +214,7 @@ pub trait Delegate {
Retry::Abort
}
/// Called prior to sending the main request of the given method. It can be used to time
/// Called prior to sending the main request of the given method. It can be used to time
/// the call or to print progress information.
/// It's also useful as you can be sure that a request will definitely be made.
fn pre_request(&mut self) { }
@@ -232,14 +233,14 @@ pub trait Delegate {
fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool {
let _ = chunk;
false
}
}
/// Called before the API request method returns, in every case. It can be used to clean up
/// internal state between calls to the API.
/// This call always has a matching call to `begin(...)`.
///
/// # Arguments
///
///
/// * `is_success` - a true value indicates the operation was successful. If false, you should
/// discard all values stored during `store_upload_url`.
fn finished(&mut self, is_success: bool) {
@@ -304,9 +305,9 @@ impl Display for Error {
Error::BadRequest(ref err) => {
try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message));
for err in err.error.errors.iter() {
try!(writeln!(f, " {}: {}, {}{}",
err.domain,
err.message,
try!(writeln!(f, " {}: {}, {}{}",
err.domain,
err.message,
err.reason,
match &err.location {
&Some(ref loc) => format!("@{}", loc),
@@ -317,13 +318,13 @@ impl Display for Error {
},
Error::MissingToken(ref err) =>
writeln!(f, "Token retrieval failed with error: {}", err),
Error::Cancelled =>
Error::Cancelled =>
writeln!(f, "Operation cancelled by delegate"),
Error::FieldClash(field) =>
writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field),
Error::JsonDecodeError(ref json_str, ref err)
Error::JsonDecodeError(ref json_str, ref err)
=> writeln!(f, "{}: {}", err, json_str),
Error::Failure(ref response) =>
Error::Failure(ref response) =>
writeln!(f, "Http status indicates failure: {:?}", response),
}
}
@@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> {
impl<'a> Read for MultiPartReader<'a> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
match (self.raw_parts.len(),
self.current_part.is_none(),
match (self.raw_parts.len(),
self.current_part.is_none(),
self.last_part_boundary.is_none()) {
(_, _, false) => {
let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0);
@@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> {
(n, true, _) if n > 0 => {
let (headers, reader) = self.raw_parts.remove(0);
let mut c = Cursor::new(Vec::<u8>::new());
(write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING,
(write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING,
headers, LINE_ENDING)).unwrap();
c.seek(SeekFrom::Start(0)).unwrap();
self.current_part = Some((c, reader));
@@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> {
let b = c.read(buf).unwrap_or(0);
(b, reader.read(&mut buf[b..]))
};
match rr {
Ok(bytes_read) => {
if hb < buf.len() && bytes_read == 0 {
if self.is_last_part() {
// before clearing the last part, we will add the boundary that
// before clearing the last part, we will add the boundary that
// will be written last
self.last_part_boundary = Some(Cursor::new(
format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes()))
@@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> {
/// The `X-Upload-Content-Type` header.
///
/// Generated via rustc --pretty expanded -Z unstable-options, and manually
/// Generated via rustc --pretty expanded -Z unstable-options, and manually
/// processed to be more readable.
#[derive(PartialEq, Debug, Clone)]
pub struct XUploadContentType(pub Mime);
@@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
Some(hh) if r.status == StatusCode::PermanentRedirect => hh,
None|Some(_) => {
if let Retry::After(d) = self.delegate.http_failure(&r, None, None) {
sleep_ms(d.num_milliseconds() as u32);
sleep(d);
continue;
}
return Err(Ok(r))
@@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
}
Err(err) => {
if let Retry::After(d) = self.delegate.http_error(&err) {
sleep_ms(d.num_milliseconds() as u32);
sleep(d);
continue;
}
return Err(Err(err))
@@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A>
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let Retry::After(d) = self.delegate.http_failure(&res,
if let Retry::After(d) = self.delegate.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
sleep(d);
continue;
}
}
@@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
},
Err(err) => {
if let Retry::After(d) = self.delegate.http_error(&err) {
sleep_ms(d.num_milliseconds() as u32);
sleep(d);
continue;
}
return Some(Err(err))

View File

@@ -2,15 +2,21 @@
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *logging* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*.
//! This documentation was generated from *logging* crate version *0.1.11+20160104*, where *20160104* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*.
//!
//! Everything else about the *logging* *v2_beta1* API can be found at the
//! [official documentation site](https://cloud.google.com/logging/docs/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1).
//! # Features
//!
//! It seems there is nothing you can do here ... .
//! Handle the following *Resources* with ease from the central [hub](struct.Logging.html) ...
//!
//! * entries
//! * [*list*](struct.EntryListCall.html) and [*write*](struct.EntryWriteCall.html)
//! * [monitored resource descriptors](struct.MonitoredResourceDescriptor.html)
//! * [*list*](struct.MonitoredResourceDescriptorListCall.html)
//! * projects
//! * [*logs delete*](struct.ProjectLogDeleteCall.html), [*metrics create*](struct.ProjectMetricCreateCall.html), [*metrics delete*](struct.ProjectMetricDeleteCall.html), [*metrics get*](struct.ProjectMetricGetCall.html), [*metrics list*](struct.ProjectMetricListCall.html), [*metrics update*](struct.ProjectMetricUpdateCall.html), [*sinks create*](struct.ProjectSinkCreateCall.html), [*sinks delete*](struct.ProjectSinkDeleteCall.html), [*sinks get*](struct.ProjectSinkGetCall.html), [*sinks list*](struct.ProjectSinkListCall.html) and [*sinks update*](struct.ProjectSinkUpdateCall.html)
//!
//!
//!
@@ -42,6 +48,13 @@
//! let r = hub.resource().activity(...).doit()
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.projects().sinks_get(...).doit()
//! let r = hub.projects().sinks_update(...).doit()
//! let r = hub.projects().sinks_create(...).doit()
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
@@ -65,7 +78,8 @@
//! extern crate hyper;
//! extern crate yup_oauth2 as oauth2;
//! extern crate google_logging2_beta1 as logging2_beta1;
//!
//! use logging2_beta1::LogSink;
//! use logging2_beta1::{Result, Error};
//! # #[test] fn egal() {
//! use std::default::Default;
//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
@@ -83,9 +97,35 @@
//! hyper::Client::new(),
//! <MemoryStorage as Default>::default(), None);
//! let mut hub = Logging::new(hyper::Client::new(), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = LogSink::default();
//!
//! // 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.projects().sinks_update(req, "sinkName")
//! .doit();
//!
//! 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::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//!
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of

File diff suppressed because it is too large Load Diff