Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

Commit b7cea13

Browse files
authored
Merge branch 'master' into ring
2 parents 9a61d67 + 1fe3c9a commit b7cea13

File tree

13 files changed

+79
-104
lines changed

13 files changed

+79
-104
lines changed

Cargo.toml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "azure_sdk_for_rust"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
description = "Rust wrappers around Microsoft Azure REST APIs"
55
readme = "README.md"
66
authors = ["Francesco Cogno <[email protected]>", "Dong Liu <[email protected]>"]
@@ -13,25 +13,26 @@ keywords = ["sdk", "azure", "rest", "iot", "cloud"]
1313
categories = ["api-bindings"]
1414

1515
[dependencies]
16-
RustyXML = "0.1.1"
17-
base64 = "0.7.0"
18-
chrono = "0.4.0"
19-
env_logger = "0.4.3"
20-
futures = "0.1.17"
21-
hyper = "0.11.6"
22-
hyper-tls = "0.1.2"
23-
log = "0.3.8"
24-
mime = "0.3.5"
25-
native-tls = "0.1.4"
26-
quick-error = "1.2.1"
27-
ring = "0.12.1"
28-
serde = "1.0.19"
29-
serde_derive = "1.0.19"
30-
serde_json = "1.0.6"
31-
time = "0.1.38"
32-
tokio-core = "0.1.10"
33-
url = "1.6.0"
34-
uuid = "0.5.1"
16+
ring = "0.12.1"
17+
RustyXML = "0.1.1"
18+
base64 = "0.9.1"
19+
chrono = "0.4.2"
20+
env_logger = "0.5.10"
21+
futures = "0.1.21"
22+
hyper = "0.11.26"
23+
hyper-tls = "0.1.3"
24+
log = "0.4.1"
25+
mime = "0.3.7"
26+
native-tls = "0.1.5"
27+
quick-error = "1.2.1"
28+
rust-crypto = "0.2.36"
29+
serde = "1.0.54"
30+
serde_derive = "1.0.54"
31+
serde_json = "1.0.17"
32+
time = "0.1.40"
33+
tokio-core = "0.1.17"
34+
url = "1.7.0"
35+
uuid = "0.6.3"
3536

3637
[features]
3738
test_e2e = []

examples/blob00.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use std::error::Error;
1313
use futures::future::*;
1414
use tokio_core::reactor::Core;
1515

16-
use azure_sdk_for_rust::azure::storage::client::Client;
1716
use azure_sdk_for_rust::azure::storage::blob::Blob;
17+
use azure_sdk_for_rust::azure::storage::client::Client;
1818

1919
fn main() {
20-
env_logger::init().unwrap();
20+
env_logger::init();
2121
code().unwrap();
2222
}
2323

examples/blob01.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use azure_sdk_for_rust::azure::storage::blob::{Blob, BlobType, PUT_OPTIONS_DEFAU
2020
use azure_sdk_for_rust::azure::storage::client::Client;
2121

2222
fn main() {
23-
env_logger::init().unwrap();
23+
env_logger::init();
2424
code().unwrap();
2525
}
2626

examples/collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn code() -> Result<(), Box<Error>> {
6666
// Each Cosmos' database contains so or more collections. We can enumerate them using the
6767
// list_collection method.
6868
for db in databases {
69-
v.push(client.list_collections(&db).map(move |collections| {
69+
v.push(client.list_collections(&db.id).map(move |collections| {
7070
println!("database {} has {} collection(s)", db.id, collections.len());
7171

7272
for collection in collections {

examples/document00.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn code() -> Result<(), Box<Error>> {
8686
// we will create it. The collection creation is more complex and
8787
// has many options (such as indexing and so on).
8888
let collection = {
89-
let collections = core.run(client.list_collections(&database))?;
89+
let collections = core.run(client.list_collections(&database.id))?;
9090

9191
if let Some(collection) = collections.into_iter().find(|coll| coll.id == COLLECTION) {
9292
collection
@@ -115,7 +115,7 @@ fn code() -> Result<(), Box<Error>> {
115115
// Performance levels have price impact. Also, higher
116116
// performance levels force you to specify an indexing
117117
// strategy. Consult the documentation for more details.
118-
core.run(client.create_collection(&database, 400, &coll))?
118+
core.run(client.create_collection(&database.id, 400, &coll))?
119119
}
120120
};
121121

@@ -136,8 +136,8 @@ fn code() -> Result<(), Box<Error>> {
136136
// The method create_document will return, upon success,
137137
// the document attributes.
138138
let document_attributes = core.run(client.create_document_as_entity(
139-
&database,
140-
&collection,
139+
&database.id,
140+
&collection.id,
141141
false,
142142
None,
143143
&PartitionKey::default(),

examples/lease_blob.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use std::error::Error;
1212
use futures::future::*;
1313
use tokio_core::reactor::Core;
1414

15-
use azure_sdk_for_rust::azure::storage::client::Client;
16-
use azure_sdk_for_rust::azure::storage::blob::{Blob, BlobType, LEASE_BLOB_OPTIONS_DEFAULT};
1715
use azure_sdk_for_rust::azure::core::lease::{LeaseAction, LeaseState, LeaseStatus};
16+
use azure_sdk_for_rust::azure::storage::blob::{Blob, BlobType, LEASE_BLOB_OPTIONS_DEFAULT};
17+
use azure_sdk_for_rust::azure::storage::client::Client;
1818

1919
use hyper::mime::Mime;
2020

2121
fn main() {
22-
env_logger::init().unwrap();
22+
env_logger::init();
2323
code().unwrap();
2424
}
2525

examples/put_blob.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ use std::error::Error;
1212
use futures::future::*;
1313
use tokio_core::reactor::Core;
1414

15-
use azure_sdk_for_rust::azure::storage::client::Client;
16-
use azure_sdk_for_rust::azure::storage::blob::{Blob, BlobType, LEASE_BLOB_OPTIONS_DEFAULT,
17-
LIST_BLOB_OPTIONS_DEFAULT, PUT_OPTIONS_DEFAULT};
1815
use azure_sdk_for_rust::azure::core::lease::{LeaseAction, LeaseState, LeaseStatus};
16+
use azure_sdk_for_rust::azure::storage::blob::{
17+
Blob, BlobType, LEASE_BLOB_OPTIONS_DEFAULT, LIST_BLOB_OPTIONS_DEFAULT, PUT_OPTIONS_DEFAULT,
18+
};
19+
use azure_sdk_for_rust::azure::storage::client::Client;
1920

2021
use azure_sdk_for_rust::azure::core::errors::AzureError;
2122

@@ -27,7 +28,7 @@ use hyper::mime::Mime;
2728
use std::io::Read;
2829

2930
fn main() {
30-
env_logger::init().unwrap();
31+
env_logger::init();
3132
code().unwrap();
3233
}
3334

@@ -110,7 +111,6 @@ fn code() -> Result<(), Box<Error>> {
110111

111112
core.run(future)?;
112113

113-
114114
println!("Leasing the blob...");
115115

116116
let mut lbo = LEASE_BLOB_OPTIONS_DEFAULT.clone();
@@ -125,17 +125,17 @@ fn code() -> Result<(), Box<Error>> {
125125
let lease_id = core.run(future)?;
126126
println!("lease id == {:?}", lease_id);
127127

128-
let future = Blob::list(&client, &container_name, &LIST_BLOB_OPTIONS_DEFAULT).map(
129-
|blobs| match blobs.iter().find(|blob| blob.name == name) {
128+
let future = Blob::list(&client, &container_name, &LIST_BLOB_OPTIONS_DEFAULT).map(|blobs| {
129+
match blobs.iter().find(|blob| blob.name == name) {
130130
Some(retrieved_blob) => {
131131
let sc = (*retrieved_blob).clone();
132132
Ok(sc)
133133
}
134134
None => Err(AzureError::GenericErrorWithText(
135135
"our blob should be here... where is it?".to_owned(),
136136
)),
137-
},
138-
);
137+
}
138+
});
139139

140140
let retrieved_blob = core.run(future)??;
141141
println!("retrieved_blob == {:?}", retrieved_blob);

src/azure/cosmos/client.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ use azure::cosmos::collection::Collection;
44
use azure::cosmos::database::Database;
55
use azure::cosmos::document::{DocumentAttributes, IndexingDirective};
66

7-
use azure::core::errors::{check_status_extract_body, check_status_extract_headers_and_body,
8-
extract_status_headers_and_body, AzureError, UnexpectedHTTPResult};
7+
use azure::core::errors::{
8+
check_status_extract_body, check_status_extract_headers_and_body,
9+
extract_status_headers_and_body, AzureError, UnexpectedHTTPResult,
10+
};
911

1012
use azure::core::COMPLETE_ENCODE_SET;
11-
use azure::cosmos::request_response::{CreateDatabaseRequest, Document,
12-
GetDocumentAdditionalHeaders, GetDocumentResponse,
13-
ListCollectionsResponse, ListDatabasesResponse,
14-
ListDocumentsResponse,
15-
ListDocumentsResponseAdditionalHeaders,
16-
ListDocumentsResponseAttributes,
17-
ListDocumentsResponseEntities, QueryDocumentResponse,
18-
QueryDocumentResponseAdditonalHeaders, QueryResponseMeta,
19-
QueryResult};
13+
use azure::cosmos::request_response::{
14+
CreateDatabaseRequest, Document, GetDocumentAdditionalHeaders, GetDocumentResponse,
15+
ListCollectionsResponse, ListDatabasesResponse, ListDocumentsResponse,
16+
ListDocumentsResponseAdditionalHeaders, ListDocumentsResponseAttributes,
17+
ListDocumentsResponseEntities, QueryDocumentResponse, QueryDocumentResponseAdditonalHeaders,
18+
QueryResponseMeta, QueryResult,
19+
};
2020

2121
use azure::core::incompletevector::ContinuationToken;
2222
use azure::cosmos::get_document::GetDocumentOptions;
@@ -845,13 +845,13 @@ impl<'a> Client {
845845
&self,
846846
database: S1,
847847
collection: S2,
848-
query: &Query<'b>,
848+
query: &Query,
849849
options: &QueryDocumentOptions,
850-
) -> impl Future<Item = QueryDocumentResponse<T>, Error = AzureError> + 'b
850+
) -> impl Future<Item = QueryDocumentResponse<T>, Error = AzureError>
851851
where
852-
T: DeserializeOwned + 'b,
853-
S1: AsRef<str> + 'b,
854-
S2: AsRef<str> + 'b,
852+
T: DeserializeOwned,
853+
S1: AsRef<str>,
854+
S2: AsRef<str>,
855855
{
856856
self.query_document_json(database, collection, query, options)
857857
.and_then(move |qdr_json| done(convert_query_document_type(qdr_json)))

src/azure/cosmos/collection.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::ops::Deref;
2-
31
#[derive(Serialize, Deserialize, Debug)]
42
pub enum KeyKind {
53
Hash,
@@ -112,17 +110,3 @@ impl Collection {
112110
}
113111
}
114112
}
115-
116-
impl Deref for Collection {
117-
type Target = str;
118-
119-
fn deref(&self) -> &str {
120-
&self.id
121-
}
122-
}
123-
124-
impl AsRef<str> for Collection {
125-
fn as_ref(&self) -> &str {
126-
&self.id
127-
}
128-
}

src/azure/cosmos/database.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::ops::Deref;
2-
31
#[derive(Serialize, Deserialize, Debug)]
42
pub struct Database {
53
pub id: String,
@@ -16,17 +14,3 @@ pub struct Database {
1614
#[serde(rename = "_users")]
1715
pub users: String,
1816
}
19-
20-
impl Deref for Database {
21-
type Target = str;
22-
23-
fn deref(&self) -> &str {
24-
&self.id
25-
}
26-
}
27-
28-
impl AsRef<str> for Database {
29-
fn as_ref(&self) -> &str {
30-
&self.id
31-
}
32-
}

0 commit comments

Comments
 (0)