diff --git a/sdk/core/src/error/http_error.rs b/sdk/core/src/error/http_error.rs index bd647ff5a9..5218554601 100644 --- a/sdk/core/src/error/http_error.rs +++ b/sdk/core/src/error/http_error.rs @@ -18,12 +18,11 @@ impl HttpError { pub async fn new(response: Response) -> Self { let status = response.status(); let mut error_code = get_error_code_from_header(&response); - let mut headers = HashMap::new(); - - for (name, value) in response.headers().iter() { - headers.insert(name.as_str().to_string(), value.as_str().to_string()); - } - + let headers: HashMap = response + .headers() + .iter() + .map(|(name, value)| (name.as_str().to_owned(), value.as_str().to_owned())) + .collect(); let body = response.into_body().await; error_code = error_code.or_else(|| get_error_code_from_body(&body)); HttpError { diff --git a/sdk/core/src/error/hyperium_http.rs b/sdk/core/src/error/hyperium_http.rs deleted file mode 100644 index b47e5bfbe5..0000000000 --- a/sdk/core/src/error/hyperium_http.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::{Error, ErrorKind}; -use http::method::InvalidMethod; -use http::status::InvalidStatusCode; -use http::uri::{InvalidUri, InvalidUriParts}; - -impl From for super::Error { - fn from(err: http::Error) -> super::Error { - Error::new(ErrorKind::DataConversion, err) - } -} - -impl From for super::Error { - fn from(err: InvalidMethod) -> super::Error { - Error::new(ErrorKind::DataConversion, err) - } -} - -impl From for super::Error { - fn from(err: InvalidStatusCode) -> super::Error { - Error::new(ErrorKind::DataConversion, err) - } -} - -impl From for super::Error { - fn from(err: InvalidUri) -> super::Error { - Error::new(ErrorKind::DataConversion, err) - } -} - -impl From for super::Error { - fn from(err: InvalidUriParts) -> super::Error { - Error::new(ErrorKind::DataConversion, err) - } -} diff --git a/sdk/core/src/error/mod.rs b/sdk/core/src/error/mod.rs index 0b2f19d492..c20bb1a688 100644 --- a/sdk/core/src/error/mod.rs +++ b/sdk/core/src/error/mod.rs @@ -1,7 +1,6 @@ use std::borrow::Cow; use std::fmt::{Debug, Display}; mod http_error; -mod hyperium_http; mod macros; pub use http_error::HttpError; diff --git a/sdk/core/src/headers/mod.rs b/sdk/core/src/headers/mod.rs index 1aa68519fe..9a1d8c1eb5 100644 --- a/sdk/core/src/headers/mod.rs +++ b/sdk/core/src/headers/mod.rs @@ -2,7 +2,7 @@ mod utilities; use crate::error::{Error, ErrorKind, ResultExt}; -use std::{collections::HashMap, fmt::Debug, str::FromStr}; +use std::{fmt::Debug, str::FromStr}; pub use utilities::*; /// A trait for converting a type into request headers @@ -152,22 +152,6 @@ impl From> for Headers { } } -impl From<&http::HeaderMap> for Headers { - fn from(map: &http::HeaderMap) -> Self { - let map = map - .into_iter() - .map(|(k, v)| { - let key = k.as_str().to_owned(); - let value = std::str::from_utf8(v.as_bytes()) - .expect("non-UTF8 header value") - .to_owned(); - (key.into(), value.into()) - }) - .collect::>(); - Self(map) - } -} - /// A header name #[derive(Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] pub struct HeaderName(std::borrow::Cow<'static, str>); diff --git a/sdk/core/src/http_client.rs b/sdk/core/src/http_client/mod.rs similarity index 52% rename from sdk/core/src/http_client.rs rename to sdk/core/src/http_client/mod.rs index fdf37d6ac5..0d2f4b9a78 100644 --- a/sdk/core/src/http_client.rs +++ b/sdk/core/src/http_client/mod.rs @@ -1,3 +1,10 @@ +#[cfg(any(feature = "enable_reqwest", feature = "enable_reqwest_rustls"))] +#[cfg(not(target_arch = "wasm32"))] +mod reqwest; + +#[cfg(any(feature = "enable_reqwest", feature = "enable_reqwest_rustls"))] +#[cfg(not(target_arch = "wasm32"))] +pub use self::reqwest::*; #[allow(unused_imports)] use crate::error::{Error, ErrorKind, ResultExt}; #[allow(unused_imports)] @@ -10,13 +17,6 @@ use bytes::Bytes; use futures::TryStreamExt; use serde::Serialize; -/// Construct a new `HttpClient` with the `reqwest` backend. -#[cfg(any(feature = "enable_reqwest", feature = "enable_reqwest_rustls"))] -#[cfg(not(target_arch = "wasm32"))] -pub fn new_http_client() -> std::sync::Arc { - std::sync::Arc::new(reqwest::Client::new()) -} - /// An HTTP client which can send requests. #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait)] @@ -45,53 +45,6 @@ pub trait HttpClient: Send + Sync + std::fmt::Debug { } } -#[cfg(any(feature = "enable_reqwest", feature = "enable_reqwest_rustls"))] -#[cfg(not(target_arch = "wasm32"))] -#[async_trait] -impl HttpClient for reqwest::Client { - async fn execute_request(&self, request: &crate::Request) -> crate::Result { - let url = request.url().clone(); - let mut reqwest_request = self.request(request.method().clone(), url); - for (name, value) in request.headers().iter() { - reqwest_request = reqwest_request.header(name.as_str(), value.as_str()); - } - - let body = request.body().clone(); - - let reqwest_request = match body { - Body::Bytes(bytes) => reqwest_request - .body(bytes) - .build() - .context(ErrorKind::Other, "failed to build request")?, - Body::SeekableStream(mut seekable_stream) => { - seekable_stream.reset().await.unwrap(); // TODO: remove unwrap when `HttpError` has been removed - - reqwest_request - .body(reqwest::Body::wrap_stream(seekable_stream)) - .build() - .context(ErrorKind::Other, "failed to build request")? - } - }; - - let reqwest_response = self - .execute(reqwest_request) - .await - .context(ErrorKind::Io, "failed to execute request")?; - - let status = reqwest_response.status(); - let headers = Headers::from(reqwest_response.headers()); - let body: PinnedStream = Box::pin(reqwest_response.bytes_stream().map_err(|error| { - Error::full( - ErrorKind::Io, - error, - "error converting `reqwest` request into a byte stream", - ) - })); - - Ok(crate::Response::new(status, headers, body)) - } -} - /// Serialize a type to json. pub fn to_json(value: &T) -> crate::Result where diff --git a/sdk/core/src/http_client/reqwest.rs b/sdk/core/src/http_client/reqwest.rs new file mode 100644 index 0000000000..04e0d2c821 --- /dev/null +++ b/sdk/core/src/http_client/reqwest.rs @@ -0,0 +1,67 @@ +use super::*; +use std::collections::HashMap; + +/// Construct a new `HttpClient` with the `reqwest` backend. +pub fn new_http_client() -> std::sync::Arc { + std::sync::Arc::new(::reqwest::Client::new()) +} + +#[async_trait] +impl HttpClient for ::reqwest::Client { + async fn execute_request(&self, request: &crate::Request) -> crate::Result { + let url = request.url().clone(); + let mut req = self.request(request.method().clone(), url); + for (name, value) in request.headers().iter() { + req = req.header(name.as_str(), value.as_str()); + } + + let body = request.body().clone(); + + let reqwest_request = match body { + Body::Bytes(bytes) => req.body(bytes).build(), + Body::SeekableStream(mut seekable_stream) => { + seekable_stream.reset().await.unwrap(); // TODO: remove unwrap when `HttpError` has been removed + req.body(::reqwest::Body::wrap_stream(seekable_stream)) + .build() + } + } + .context(ErrorKind::Other, "failed to build `reqwest` request")?; + + let rsp = self + .execute(reqwest_request) + .await + .context(ErrorKind::Io, "failed to execute `reqwest` request")?; + + let status = rsp.status(); + let headers = to_headers(rsp.headers())?; + let body: PinnedStream = Box::pin(rsp.bytes_stream().map_err(|error| { + Error::full( + ErrorKind::Io, + error, + "error converting `reqwest` request into a byte stream", + ) + })); + + Ok(crate::Response::new(status, headers, body)) + } +} + +fn to_headers(map: &::reqwest::header::HeaderMap) -> crate::Result { + let map = map + .iter() + .filter_map(|(k, v)| { + let key = k.as_str(); + match std::str::from_utf8(v.as_bytes()) { + Ok(value) => Some(( + crate::headers::HeaderName::from(key.to_owned()), + crate::headers::HeaderValue::from(value.to_owned()), + )), + Err(_) => { + log::warn!("header value for `{key}` is not utf8"); + None + } + } + }) + .collect::>(); + Ok(crate::headers::Headers::from(map)) +} diff --git a/sdk/core/src/lib.rs b/sdk/core/src/lib.rs index 53ad4e3eda..644902e256 100644 --- a/sdk/core/src/lib.rs +++ b/sdk/core/src/lib.rs @@ -57,6 +57,9 @@ pub use response::*; pub use seekable_stream::*; pub use sleep::sleep; +// re-export important types at crate level +pub use http::Method; +pub use http::StatusCode; pub use url::Url; /// A unique identifier for a request. diff --git a/sdk/core/src/mock/mock_request.rs b/sdk/core/src/mock/mock_request.rs index 45af91f6a8..883f9c42a0 100644 --- a/sdk/core/src/mock/mock_request.rs +++ b/sdk/core/src/mock/mock_request.rs @@ -1,5 +1,5 @@ +use crate::Method; use crate::{Body, Request}; -use http::Method; use serde::de::Visitor; use serde::ser::{Serialize, SerializeStruct, Serializer}; use serde::{Deserialize, Deserializer}; diff --git a/sdk/core/src/mock/mock_response.rs b/sdk/core/src/mock/mock_response.rs index 5b03c19c76..b9a2e47f44 100644 --- a/sdk/core/src/mock/mock_response.rs +++ b/sdk/core/src/mock/mock_response.rs @@ -1,13 +1,11 @@ -use bytes::Bytes; -use http::StatusCode; -use serde::{Deserialize, Serialize}; -use std::collections::BTreeMap; - use crate::{ collect_pinned_stream, error, headers::{HeaderName, HeaderValue, Headers}, - BytesStream, Response, + BytesStream, Response, StatusCode, }; +use bytes::Bytes; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; #[derive(Debug, Clone, PartialEq)] pub(crate) struct MockResponse { diff --git a/sdk/core/src/policies/retry_policies/retry_policy.rs b/sdk/core/src/policies/retry_policies/retry_policy.rs index 143a8b8214..b2c7921738 100644 --- a/sdk/core/src/policies/retry_policies/retry_policy.rs +++ b/sdk/core/src/policies/retry_policies/retry_policy.rs @@ -1,10 +1,8 @@ use crate::error::{Error, ErrorKind, HttpError}; use crate::policies::{Policy, PolicyResult, Request}; use crate::sleep::sleep; -use crate::Context; - +use crate::{Context, StatusCode}; use chrono::{DateTime, Local}; -use http::StatusCode; use std::sync::Arc; use std::time::Duration; diff --git a/sdk/core/src/request.rs b/sdk/core/src/request.rs index 8afe53a585..9c5ee1886f 100644 --- a/sdk/core/src/request.rs +++ b/sdk/core/src/request.rs @@ -1,7 +1,6 @@ use crate::headers::{AsHeaders, Headers}; -use crate::SeekableStream; +use crate::{Method, SeekableStream}; use bytes::Bytes; -use http::Method; use std::fmt::Debug; use url::Url; diff --git a/sdk/core/src/response.rs b/sdk/core/src/response.rs index ecd62f6828..0081cb5c8e 100644 --- a/sdk/core/src/response.rs +++ b/sdk/core/src/response.rs @@ -1,8 +1,8 @@ use crate::headers::Headers; +use crate::StatusCode; use bytes::Bytes; use futures::Stream; use futures::StreamExt; -use http::StatusCode; use std::pin::Pin; pub type PinnedStream = Pin> + Send + Sync>>; diff --git a/sdk/data_cosmos/Cargo.toml b/sdk/data_cosmos/Cargo.toml index dd8efb6e23..6ef490978e 100644 --- a/sdk/data_cosmos/Cargo.toml +++ b/sdk/data_cosmos/Cargo.toml @@ -19,7 +19,6 @@ async-trait = "0.1" azure_core = { path = "../core", version = "0.3" } base64 = "0.13" chrono = "0.4" -http = "0.2" futures = "0.3" log = "0.4" serde = { version = "1.0", features = ["derive"] } diff --git a/sdk/data_cosmos/src/authorization_policy.rs b/sdk/data_cosmos/src/authorization_policy.rs index 5bf0582641..c88f4cef85 100644 --- a/sdk/data_cosmos/src/authorization_policy.rs +++ b/sdk/data_cosmos/src/authorization_policy.rs @@ -141,7 +141,7 @@ fn generate_resource_link(request: &Request) -> String { /// In the second case, the signature is just the resource key. fn generate_authorization( auth_token: &AuthorizationToken, - http_method: &http::Method, + http_method: &azure_core::Method, resource_type: &ResourceType, resource_link: &str, time_nonce: TimeNonce, @@ -174,7 +174,7 @@ fn generate_authorization( /// In case of authorization problems we can compare the string_to_sign generated by Azure against /// our own. fn string_to_sign( - http_method: &http::Method, + http_method: &azure_core::Method, rt: &ResourceType, resource_link: &str, time_nonce: TimeNonce, @@ -191,15 +191,15 @@ fn string_to_sign( format!( "{}\n{}\n{}\n{}\n\n", match *http_method { - http::Method::GET => "get", - http::Method::PUT => "put", - http::Method::POST => "post", - http::Method::DELETE => "delete", - http::Method::HEAD => "head", - http::Method::TRACE => "trace", - http::Method::OPTIONS => "options", - http::Method::CONNECT => "connect", - http::Method::PATCH => "patch", + azure_core::Method::GET => "get", + azure_core::Method::PUT => "put", + azure_core::Method::POST => "post", + azure_core::Method::DELETE => "delete", + azure_core::Method::HEAD => "head", + azure_core::Method::TRACE => "trace", + azure_core::Method::OPTIONS => "options", + azure_core::Method::CONNECT => "connect", + azure_core::Method::PATCH => "patch", _ => "extension", }, match rt { @@ -242,7 +242,7 @@ mod tests { let time = time.with_timezone(&chrono::Utc).into(); let ret = string_to_sign( - &http::Method::GET, + &azure_core::Method::GET, &ResourceType::Databases, "dbs/MyDatabase/colls/MyCollection", time, @@ -271,7 +271,7 @@ mon, 01 jan 1900 01:00:00 gmt let ret = generate_authorization( &auth_token, - &http::Method::GET, + &azure_core::Method::GET, &ResourceType::Databases, "dbs/MyDatabase/colls/MyCollection", time, @@ -295,7 +295,7 @@ mon, 01 jan 1900 01:00:00 gmt let ret = generate_authorization( &auth_token, - &http::Method::GET, + &azure_core::Method::GET, &ResourceType::Databases, "dbs/ToDoList", time, @@ -316,7 +316,7 @@ mon, 01 jan 1900 01:00:00 gmt fn generate_resource_link_00() { let request = Request::new( reqwest::Url::parse("https://.documents.azure.com/dbs/second").unwrap(), - http::Method::GET, + azure_core::Method::GET, ); assert_eq!(&generate_resource_link(&request), "dbs/second"); } @@ -325,7 +325,7 @@ mon, 01 jan 1900 01:00:00 gmt fn generate_resource_link_01() { let request = Request::new( reqwest::Url::parse("https://.documents.azure.com/dbs").unwrap(), - http::Method::GET, + azure_core::Method::GET, ); assert_eq!(&generate_resource_link(&request), ""); } @@ -334,7 +334,7 @@ mon, 01 jan 1900 01:00:00 gmt fn generate_resource_link_02() { let request = Request::new( reqwest::Url::parse("https://.documents.azure.com/colls/second/third").unwrap(), - http::Method::GET, + azure_core::Method::GET, ); assert_eq!(&generate_resource_link(&request), "colls/second/third"); } @@ -343,7 +343,7 @@ mon, 01 jan 1900 01:00:00 gmt fn generate_resource_link_03() { let request = Request::new( reqwest::Url::parse("https://.documents.azure.com/dbs/test_db/colls").unwrap(), - http::Method::GET, + azure_core::Method::GET, ); assert_eq!(&generate_resource_link(&request), "dbs/test_db"); } diff --git a/sdk/data_cosmos/src/clients/attachment.rs b/sdk/data_cosmos/src/clients/attachment.rs index 5c4ee8e67d..ebb0d8d55c 100644 --- a/sdk/data_cosmos/src/clients/attachment.rs +++ b/sdk/data_cosmos/src/clients/attachment.rs @@ -99,7 +99,7 @@ impl AttachmentClient { &self.attachment_name } - pub(crate) fn attachments_request(&self, method: http::Method) -> Request { + pub(crate) fn attachments_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/docs/{}/attachments", @@ -111,7 +111,7 @@ impl AttachmentClient { ) } - pub(crate) fn attachment_request(&self, method: http::Method) -> Request { + pub(crate) fn attachment_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/docs/{}/attachments/{}", diff --git a/sdk/data_cosmos/src/clients/collection.rs b/sdk/data_cosmos/src/clients/collection.rs index c5af60699a..17341c851e 100644 --- a/sdk/data_cosmos/src/clients/collection.rs +++ b/sdk/data_cosmos/src/clients/collection.rs @@ -127,7 +127,7 @@ impl CollectionClient { &self.collection_name } - pub(crate) fn collection_request(&self, http_method: http::Method) -> Request { + pub(crate) fn collection_request(&self, http_method: azure_core::Method) -> Request { let path = &format!( "dbs/{}/colls/{}", self.database_client().database_name(), @@ -136,7 +136,7 @@ impl CollectionClient { self.cosmos_client().request(path, http_method) } - pub(crate) fn docs_request(&self, http_method: http::Method) -> Request { + pub(crate) fn docs_request(&self, http_method: azure_core::Method) -> Request { let path = &format!( "dbs/{}/colls/{}/docs", self.database_client().database_name(), diff --git a/sdk/data_cosmos/src/clients/cosmos.rs b/sdk/data_cosmos/src/clients/cosmos.rs index 9177e89d7f..e7c2fe585a 100644 --- a/sdk/data_cosmos/src/clients/cosmos.rs +++ b/sdk/data_cosmos/src/clients/cosmos.rs @@ -121,7 +121,7 @@ impl CosmosClient { /// This function will add the cloud location to the URI suffix and generate /// a Request with the specified HTTP Method. It will also set the body /// to an empty `Bytes` instance. - pub(crate) fn request(&self, uri_path: &str, http_method: http::Method) -> Request { + pub(crate) fn request(&self, uri_path: &str, http_method: azure_core::Method) -> Request { let uri = format!("{}/{}", self.cloud_location.url(), uri_path); Request::new(uri.parse().unwrap(), http_method) } diff --git a/sdk/data_cosmos/src/clients/database.rs b/sdk/data_cosmos/src/clients/database.rs index ff967d6ad7..015bb234d2 100644 --- a/sdk/data_cosmos/src/clients/database.rs +++ b/sdk/data_cosmos/src/clients/database.rs @@ -2,8 +2,8 @@ use crate::clients::*; use crate::operations::*; use crate::resources::collection::PartitionKey; use crate::ReadonlyString; +use azure_core::Method; use azure_core::Request; -use http::Method; /// A client for Cosmos database resources. #[derive(Debug, Clone)] diff --git a/sdk/data_cosmos/src/clients/document.rs b/sdk/data_cosmos/src/clients/document.rs index 4acf1dee32..83bc9855b1 100644 --- a/sdk/data_cosmos/src/clients/document.rs +++ b/sdk/data_cosmos/src/clients/document.rs @@ -85,7 +85,7 @@ impl DocumentClient { &self.partition_key_serialized } - pub(crate) fn document_request(&self, method: http::Method) -> Request { + pub(crate) fn document_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/docs/{}", diff --git a/sdk/data_cosmos/src/clients/permission.rs b/sdk/data_cosmos/src/clients/permission.rs index 9597ff8727..3a63702b3e 100644 --- a/sdk/data_cosmos/src/clients/permission.rs +++ b/sdk/data_cosmos/src/clients/permission.rs @@ -59,7 +59,7 @@ impl PermissionClient { &self.permission_name } - pub(crate) fn permission_request(&self, method: http::Method) -> Request { + pub(crate) fn permission_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/users/{}/permissions/{}", diff --git a/sdk/data_cosmos/src/clients/stored_procedure.rs b/sdk/data_cosmos/src/clients/stored_procedure.rs index 5a97afee66..fe30615203 100644 --- a/sdk/data_cosmos/src/clients/stored_procedure.rs +++ b/sdk/data_cosmos/src/clients/stored_procedure.rs @@ -70,7 +70,7 @@ impl StoredProcedureClient { &self.stored_procedure_name } - pub(crate) fn stored_procedure_request(&self, method: http::Method) -> Request { + pub(crate) fn stored_procedure_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/sprocs/{}", @@ -82,7 +82,7 @@ impl StoredProcedureClient { ) } - pub(crate) fn stored_procedures_request(&self, method: http::Method) -> Request { + pub(crate) fn stored_procedures_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/sprocs", diff --git a/sdk/data_cosmos/src/clients/trigger.rs b/sdk/data_cosmos/src/clients/trigger.rs index c2be6ae636..2ecd03f2f9 100644 --- a/sdk/data_cosmos/src/clients/trigger.rs +++ b/sdk/data_cosmos/src/clients/trigger.rs @@ -91,7 +91,7 @@ impl TriggerClient { } /// Create a request for a specific collection trigger - pub(crate) fn trigger_request(&self, method: http::Method) -> Request { + pub(crate) fn trigger_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/triggers/{}", @@ -104,7 +104,7 @@ impl TriggerClient { } /// Create a request for collection triggers - pub(crate) fn triggers_request(&self, method: http::Method) -> Request { + pub(crate) fn triggers_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/triggers", diff --git a/sdk/data_cosmos/src/clients/user.rs b/sdk/data_cosmos/src/clients/user.rs index 1463cda7d2..21e4fc0611 100644 --- a/sdk/data_cosmos/src/clients/user.rs +++ b/sdk/data_cosmos/src/clients/user.rs @@ -66,7 +66,7 @@ impl UserClient { &self.user_name } - pub(crate) fn user_request(&self, method: http::Method) -> Request { + pub(crate) fn user_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/users/{}", diff --git a/sdk/data_cosmos/src/clients/user_defined_function.rs b/sdk/data_cosmos/src/clients/user_defined_function.rs index 8dd6a242d6..0bc2651543 100644 --- a/sdk/data_cosmos/src/clients/user_defined_function.rs +++ b/sdk/data_cosmos/src/clients/user_defined_function.rs @@ -68,7 +68,7 @@ impl UserDefinedFunctionClient { &self.user_defined_function_name } - pub(crate) fn udfs_request(&self, method: http::Method) -> Request { + pub(crate) fn udfs_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/udfs", @@ -79,7 +79,7 @@ impl UserDefinedFunctionClient { ) } - pub(crate) fn udf_request(&self, method: http::Method) -> Request { + pub(crate) fn udf_request(&self, method: azure_core::Method) -> Request { self.cosmos_client().request( &format!( "dbs/{}/colls/{}/udfs/{}", diff --git a/sdk/data_cosmos/src/operations/create_collection.rs b/sdk/data_cosmos/src/operations/create_collection.rs index dc7e71fe59..8a7117e8be 100644 --- a/sdk/data_cosmos/src/operations/create_collection.rs +++ b/sdk/data_cosmos/src/operations/create_collection.rs @@ -42,7 +42,7 @@ impl CreateCollectionBuilder { pub fn into_future(self) -> CreateCollection { Box::pin(async move { - let mut request = self.client.collections_request(http::Method::POST); + let mut request = self.client.collections_request(azure_core::Method::POST); request.insert_headers(&self.offer); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/create_database.rs b/sdk/data_cosmos/src/operations/create_database.rs index 89f474d16d..5607e4b6f3 100644 --- a/sdk/data_cosmos/src/operations/create_database.rs +++ b/sdk/data_cosmos/src/operations/create_database.rs @@ -36,7 +36,7 @@ impl CreateDatabaseBuilder { pub fn into_future(self) -> CreateDatabase { Box::pin(async move { - let mut request = self.client.request("dbs", http::Method::POST); + let mut request = self.client.request("dbs", azure_core::Method::POST); let body = CreateDatabaseBody { id: self.database_name.as_str(), diff --git a/sdk/data_cosmos/src/operations/create_document.rs b/sdk/data_cosmos/src/operations/create_document.rs index f24967ad6e..153d0afa98 100644 --- a/sdk/data_cosmos/src/operations/create_document.rs +++ b/sdk/data_cosmos/src/operations/create_document.rs @@ -4,9 +4,8 @@ use crate::prelude::*; use crate::resources::document::DocumentAttributes; use crate::ResourceQuota; use azure_core::headers::{etag_from_headers, session_token_from_headers}; -use azure_core::prelude::*; +use azure_core::{prelude::*, StatusCode}; use chrono::{DateTime, Utc}; -use http::StatusCode; use serde::Serialize; use std::convert::TryFrom; @@ -65,7 +64,7 @@ impl CreateDocumentBuilder { Some(s) => s, None => serialize_partition_key(&document.partition_key())?, }; - let mut request = self.client.docs_request(http::Method::POST); + let mut request = self.client.docs_request(azure_core::Method::POST); add_as_partition_key_header_serialized(&partition_key, &mut request); request.insert_headers(&self.if_match_condition); diff --git a/sdk/data_cosmos/src/operations/create_or_replace_attachment.rs b/sdk/data_cosmos/src/operations/create_or_replace_attachment.rs index f6bf07916a..bc2cf316f6 100644 --- a/sdk/data_cosmos/src/operations/create_or_replace_attachment.rs +++ b/sdk/data_cosmos/src/operations/create_or_replace_attachment.rs @@ -43,9 +43,9 @@ impl CreateOrReplaceAttachmentBuilder { pub fn into_future(self) -> CreateOrReplaceAttachment { Box::pin(async move { let mut req = if self.is_create { - self.client.attachments_request(http::Method::POST) + self.client.attachments_request(azure_core::Method::POST) } else { - self.client.attachment_request(http::Method::PUT) + self.client.attachment_request(azure_core::Method::PUT) }; if let Some(cl) = &self.consistency_level { diff --git a/sdk/data_cosmos/src/operations/create_or_replace_slug_attachment.rs b/sdk/data_cosmos/src/operations/create_or_replace_slug_attachment.rs index 2a8c8e6420..9bd45c273b 100644 --- a/sdk/data_cosmos/src/operations/create_or_replace_slug_attachment.rs +++ b/sdk/data_cosmos/src/operations/create_or_replace_slug_attachment.rs @@ -5,13 +5,13 @@ use crate::ResourceQuota; use azure_core::headers::{ date_from_headers, etag_from_headers, session_token_from_headers, HeaderValue, }; +use azure_core::Method; use azure_core::Response as HttpResponse; use azure_core::SessionToken; use azure_core::{collect_pinned_stream, headers}; use azure_core::{content_type, prelude::*}; use bytes::Bytes; use chrono::{DateTime, Utc}; -use http::Method; #[derive(Debug, Clone)] pub struct CreateOrReplaceSlugAttachmentBuilder { diff --git a/sdk/data_cosmos/src/operations/create_or_replace_trigger.rs b/sdk/data_cosmos/src/operations/create_or_replace_trigger.rs index 6ddd39dfe3..35c0aa078f 100644 --- a/sdk/data_cosmos/src/operations/create_or_replace_trigger.rs +++ b/sdk/data_cosmos/src/operations/create_or_replace_trigger.rs @@ -47,9 +47,9 @@ impl CreateOrReplaceTriggerBuilder { pub fn into_future(self) -> CreateOrReplaceTrigger { Box::pin(async move { let mut request = if self.is_create { - self.client.triggers_request(http::Method::POST) + self.client.triggers_request(azure_core::Method::POST) } else { - self.client.trigger_request(http::Method::PUT) + self.client.trigger_request(azure_core::Method::PUT) }; if let Some(cl) = &self.consistency_level { diff --git a/sdk/data_cosmos/src/operations/create_or_replace_user_defined_function.rs b/sdk/data_cosmos/src/operations/create_or_replace_user_defined_function.rs index 6ac806df31..cb88955fa1 100644 --- a/sdk/data_cosmos/src/operations/create_or_replace_user_defined_function.rs +++ b/sdk/data_cosmos/src/operations/create_or_replace_user_defined_function.rs @@ -36,8 +36,8 @@ impl CreateOrReplaceUserDefinedFunctionBuilder { pub fn into_future(self) -> CreateOrReplaceUserDefinedFunction { Box::pin(async move { let mut request = match self.is_create { - true => self.client.udfs_request(http::Method::POST), - false => self.client.udf_request(http::Method::PUT), + true => self.client.udfs_request(azure_core::Method::POST), + false => self.client.udf_request(azure_core::Method::PUT), }; if let Some(cl) = &self.consistency_level { diff --git a/sdk/data_cosmos/src/operations/create_permission.rs b/sdk/data_cosmos/src/operations/create_permission.rs index 3e786b3071..f541b007aa 100644 --- a/sdk/data_cosmos/src/operations/create_permission.rs +++ b/sdk/data_cosmos/src/operations/create_permission.rs @@ -37,7 +37,7 @@ impl CreatePermissionBuilder { self.client.database_client().database_name(), self.client.user_client().user_name() ), - http::Method::POST, + azure_core::Method::POST, ); if let Some(cl) = &self.consistency_level { diff --git a/sdk/data_cosmos/src/operations/create_stored_procedure.rs b/sdk/data_cosmos/src/operations/create_stored_procedure.rs index 37faa7c652..83bc7be27d 100644 --- a/sdk/data_cosmos/src/operations/create_stored_procedure.rs +++ b/sdk/data_cosmos/src/operations/create_stored_procedure.rs @@ -31,7 +31,9 @@ impl CreateStoredProcedureBuilder { pub fn into_future(self) -> CreateStoredProcedure { Box::pin(async move { - let mut req = self.client.stored_procedures_request(http::Method::POST); + let mut req = self + .client + .stored_procedures_request(azure_core::Method::POST); if let Some(cl) = &self.consistency_level { req.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/create_user.rs b/sdk/data_cosmos/src/operations/create_user.rs index b534740156..615531b858 100644 --- a/sdk/data_cosmos/src/operations/create_user.rs +++ b/sdk/data_cosmos/src/operations/create_user.rs @@ -29,7 +29,7 @@ impl CreateUserBuilder { "dbs/{}/users", self.client.database_client().database_name() ), - http::Method::POST, + azure_core::Method::POST, ); if let Some(cl) = &self.consistency_level { diff --git a/sdk/data_cosmos/src/operations/delete_attachment.rs b/sdk/data_cosmos/src/operations/delete_attachment.rs index 2fe561d12b..585cabf738 100644 --- a/sdk/data_cosmos/src/operations/delete_attachment.rs +++ b/sdk/data_cosmos/src/operations/delete_attachment.rs @@ -34,7 +34,7 @@ impl DeleteAttachmentBuilder { pub fn into_future(self) -> DeleteAttachment { Box::pin(async move { - let mut request = self.client.attachment_request(http::Method::DELETE); + let mut request = self.client.attachment_request(azure_core::Method::DELETE); request.insert_headers(&self.if_match_condition); if let Some(cl) = &self.consistency_level { diff --git a/sdk/data_cosmos/src/operations/delete_collection.rs b/sdk/data_cosmos/src/operations/delete_collection.rs index b818ff894a..af58446fea 100644 --- a/sdk/data_cosmos/src/operations/delete_collection.rs +++ b/sdk/data_cosmos/src/operations/delete_collection.rs @@ -27,7 +27,7 @@ impl DeleteCollectionBuilder { pub fn into_future(self) -> DeleteCollection { Box::pin(async move { - let mut request = self.client.collection_request(http::Method::DELETE); + let mut request = self.client.collection_request(azure_core::Method::DELETE); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/delete_database.rs b/sdk/data_cosmos/src/operations/delete_database.rs index da81661118..0909788a75 100644 --- a/sdk/data_cosmos/src/operations/delete_database.rs +++ b/sdk/data_cosmos/src/operations/delete_database.rs @@ -28,7 +28,7 @@ impl DeleteDatabaseBuilder { pub fn into_future(self) -> DeleteDatabase { Box::pin(async move { - let mut request = self.client.database_request(http::Method::DELETE); + let mut request = self.client.database_request(azure_core::Method::DELETE); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); } diff --git a/sdk/data_cosmos/src/operations/delete_document.rs b/sdk/data_cosmos/src/operations/delete_document.rs index ad9d90c8ce..d391f14a87 100644 --- a/sdk/data_cosmos/src/operations/delete_document.rs +++ b/sdk/data_cosmos/src/operations/delete_document.rs @@ -38,7 +38,7 @@ impl DeleteDocumentBuilder { pub fn into_future(self) -> DeleteDocument { Box::pin(async move { - let mut request = self.client.document_request(http::Method::DELETE); + let mut request = self.client.document_request(azure_core::Method::DELETE); request.insert_headers(&self.if_match_condition); request.insert_headers(&self.if_modified_since); diff --git a/sdk/data_cosmos/src/operations/delete_permission.rs b/sdk/data_cosmos/src/operations/delete_permission.rs index 0aa6569840..5d31a2b692 100644 --- a/sdk/data_cosmos/src/operations/delete_permission.rs +++ b/sdk/data_cosmos/src/operations/delete_permission.rs @@ -28,7 +28,7 @@ impl DeletePermissionBuilder { pub fn into_future(self) -> DeletePermission { Box::pin(async move { - let mut request = self.client.permission_request(http::Method::DELETE); + let mut request = self.client.permission_request(azure_core::Method::DELETE); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/delete_stored_procedure.rs b/sdk/data_cosmos/src/operations/delete_stored_procedure.rs index 26a7e2b531..5a35228615 100644 --- a/sdk/data_cosmos/src/operations/delete_stored_procedure.rs +++ b/sdk/data_cosmos/src/operations/delete_stored_procedure.rs @@ -28,7 +28,9 @@ impl DeleteStoredProcedureBuilder { pub fn into_future(self) -> DeleteStoredProcedure { Box::pin(async move { - let mut request = self.client.stored_procedure_request(http::Method::DELETE); + let mut request = self + .client + .stored_procedure_request(azure_core::Method::DELETE); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/delete_trigger.rs b/sdk/data_cosmos/src/operations/delete_trigger.rs index d0cad2d1ee..908f430cfb 100644 --- a/sdk/data_cosmos/src/operations/delete_trigger.rs +++ b/sdk/data_cosmos/src/operations/delete_trigger.rs @@ -30,7 +30,7 @@ impl DeleteTriggerBuilder { pub fn into_future(self) -> DeleteTrigger { Box::pin(async move { - let mut request = self.client.trigger_request(http::Method::DELETE); + let mut request = self.client.trigger_request(azure_core::Method::DELETE); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/delete_user.rs b/sdk/data_cosmos/src/operations/delete_user.rs index c269bc1c31..ae5f6af663 100644 --- a/sdk/data_cosmos/src/operations/delete_user.rs +++ b/sdk/data_cosmos/src/operations/delete_user.rs @@ -25,7 +25,7 @@ impl DeleteUserBuilder { pub fn into_future(self) -> DeleteUser { Box::pin(async move { - let mut request = self.client.user_request(http::Method::DELETE); + let mut request = self.client.user_request(azure_core::Method::DELETE); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); } diff --git a/sdk/data_cosmos/src/operations/delete_user_defined_function.rs b/sdk/data_cosmos/src/operations/delete_user_defined_function.rs index 58c665708b..d36f38c63e 100644 --- a/sdk/data_cosmos/src/operations/delete_user_defined_function.rs +++ b/sdk/data_cosmos/src/operations/delete_user_defined_function.rs @@ -30,7 +30,7 @@ impl DeleteUserDefinedFunctionBuilder { pub fn into_future(self) -> DeleteUserDefinedFunction { Box::pin(async move { - let mut request = self.client.udf_request(http::Method::DELETE); + let mut request = self.client.udf_request(azure_core::Method::DELETE); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/execute_stored_procedure.rs b/sdk/data_cosmos/src/operations/execute_stored_procedure.rs index debe92d4df..b05d1f5ed3 100644 --- a/sdk/data_cosmos/src/operations/execute_stored_procedure.rs +++ b/sdk/data_cosmos/src/operations/execute_stored_procedure.rs @@ -53,7 +53,9 @@ impl ExecuteStoredProcedureBuilder { pub fn into_future(self) -> ExecuteStoredProcedure { Box::pin(async move { - let mut request = self.client.stored_procedure_request(http::Method::POST); + let mut request = self + .client + .stored_procedure_request(azure_core::Method::POST); if let Some(pk) = self.partition_key.as_ref() { crate::cosmos_entity::add_as_partition_key_header_serialized(pk, &mut request) diff --git a/sdk/data_cosmos/src/operations/get_attachment.rs b/sdk/data_cosmos/src/operations/get_attachment.rs index fce96e4649..1dd60aec4d 100644 --- a/sdk/data_cosmos/src/operations/get_attachment.rs +++ b/sdk/data_cosmos/src/operations/get_attachment.rs @@ -36,7 +36,7 @@ impl GetAttachmentBuilder { pub fn into_future(self) -> GetAttachment { Box::pin(async move { - let mut request = self.client.attachment_request(http::Method::GET); + let mut request = self.client.attachment_request(azure_core::Method::GET); request.insert_headers(&self.if_match_condition); if let Some(cl) = &self.consistency_level { diff --git a/sdk/data_cosmos/src/operations/get_collection.rs b/sdk/data_cosmos/src/operations/get_collection.rs index 0d5a76b5de..44d8129bc6 100644 --- a/sdk/data_cosmos/src/operations/get_collection.rs +++ b/sdk/data_cosmos/src/operations/get_collection.rs @@ -30,7 +30,7 @@ impl GetCollectionBuilder { pub fn into_future(self) -> GetCollection { Box::pin(async move { - let mut request = self.client.collection_request(http::Method::GET); + let mut request = self.client.collection_request(azure_core::Method::GET); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/get_database.rs b/sdk/data_cosmos/src/operations/get_database.rs index ad2658874e..c61c23ca95 100644 --- a/sdk/data_cosmos/src/operations/get_database.rs +++ b/sdk/data_cosmos/src/operations/get_database.rs @@ -30,7 +30,7 @@ impl GetDatabaseBuilder { pub fn into_future(self) -> GetDatabase { Box::pin(async move { - let mut request = self.client.database_request(http::Method::GET); + let mut request = self.client.database_request(azure_core::Method::GET); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); } diff --git a/sdk/data_cosmos/src/operations/get_document.rs b/sdk/data_cosmos/src/operations/get_document.rs index 521ce0c5dd..a8e8af98bc 100644 --- a/sdk/data_cosmos/src/operations/get_document.rs +++ b/sdk/data_cosmos/src/operations/get_document.rs @@ -5,10 +5,9 @@ use crate::prelude::*; use crate::resources::Document; use crate::ResourceQuota; use azure_core::headers::{etag_from_headers, session_token_from_headers, Headers}; -use azure_core::prelude::*; use azure_core::{collect_pinned_stream, Response as HttpResponse, SessionToken}; +use azure_core::{prelude::*, StatusCode}; use chrono::{DateTime, Utc}; -use http::StatusCode; use serde::de::DeserializeOwned; #[derive(Debug, Clone)] @@ -47,7 +46,7 @@ impl GetDocumentBuilder { /// generic associated types (GATs) stabilize, this will become possible. pub fn into_future(self) -> GetDocument { Box::pin(async move { - let mut request = self.client.document_request(http::Method::GET); + let mut request = self.client.document_request(azure_core::Method::GET); request.insert_headers(&self.if_match_condition); request.insert_headers(&self.if_modified_since); diff --git a/sdk/data_cosmos/src/operations/get_partition_key_ranges.rs b/sdk/data_cosmos/src/operations/get_partition_key_ranges.rs index f6953fec9b..435aca726d 100644 --- a/sdk/data_cosmos/src/operations/get_partition_key_ranges.rs +++ b/sdk/data_cosmos/src/operations/get_partition_key_ranges.rs @@ -40,7 +40,7 @@ impl GetPartitionKeyRangesBuilder { self.client.database_client().database_name(), self.client.collection_name() ), - http::Method::GET, + azure_core::Method::GET, ); request.insert_headers(&self.if_match_condition); diff --git a/sdk/data_cosmos/src/operations/get_permission.rs b/sdk/data_cosmos/src/operations/get_permission.rs index 4c0dbdb5c7..0e6aefd3fe 100644 --- a/sdk/data_cosmos/src/operations/get_permission.rs +++ b/sdk/data_cosmos/src/operations/get_permission.rs @@ -25,7 +25,7 @@ impl GetPermissionBuilder { pub fn into_future(self) -> GetPermission { Box::pin(async move { - let mut request = self.client.permission_request(http::Method::GET); + let mut request = self.client.permission_request(azure_core::Method::GET); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/get_user.rs b/sdk/data_cosmos/src/operations/get_user.rs index 6546c571bc..c589aa8570 100644 --- a/sdk/data_cosmos/src/operations/get_user.rs +++ b/sdk/data_cosmos/src/operations/get_user.rs @@ -24,7 +24,7 @@ impl GetUserBuilder { pub fn into_future(self) -> GetUser { Box::pin(async move { - let mut request = self.client.user_request(http::Method::GET); + let mut request = self.client.user_request(azure_core::Method::GET); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/list_attachments.rs b/sdk/data_cosmos/src/operations/list_attachments.rs index 6903e42707..47a72114cc 100644 --- a/sdk/data_cosmos/src/operations/list_attachments.rs +++ b/sdk/data_cosmos/src/operations/list_attachments.rs @@ -53,7 +53,7 @@ impl ListAttachmentsBuilder { this.client.collection_client().collection_name(), this.client.document_name() ), - http::Method::GET, + azure_core::Method::GET, ); request.insert_headers(&this.if_match_condition); diff --git a/sdk/data_cosmos/src/operations/list_collections.rs b/sdk/data_cosmos/src/operations/list_collections.rs index 697c0e89fc..ae40590f23 100644 --- a/sdk/data_cosmos/src/operations/list_collections.rs +++ b/sdk/data_cosmos/src/operations/list_collections.rs @@ -37,7 +37,7 @@ impl ListCollectionsBuilder { let this = self.clone(); let ctx = self.context.clone(); async move { - let mut request = this.client.collections_request(http::Method::GET); + let mut request = this.client.collections_request(azure_core::Method::GET); if let Some(cl) = &this.consistency_level { request.insert_headers(cl); } diff --git a/sdk/data_cosmos/src/operations/list_databases.rs b/sdk/data_cosmos/src/operations/list_databases.rs index a9f23e3743..731ef5b7b1 100644 --- a/sdk/data_cosmos/src/operations/list_databases.rs +++ b/sdk/data_cosmos/src/operations/list_databases.rs @@ -36,7 +36,7 @@ impl ListDatabasesBuilder { let this = self.clone(); let ctx = self.context.clone(); async move { - let mut request = this.client.request("dbs", http::Method::GET); + let mut request = this.client.request("dbs", azure_core::Method::GET); if let Some(cl) = &this.consistency_level { request.insert_headers(cl); } diff --git a/sdk/data_cosmos/src/operations/list_documents.rs b/sdk/data_cosmos/src/operations/list_documents.rs index f2649eb34c..594da766eb 100644 --- a/sdk/data_cosmos/src/operations/list_documents.rs +++ b/sdk/data_cosmos/src/operations/list_documents.rs @@ -57,7 +57,7 @@ impl ListDocumentsBuilder { this.client.database_client().database_name(), this.client.collection_name() ), - http::Method::GET, + azure_core::Method::GET, ); req.insert_headers(&this.if_match_condition); diff --git a/sdk/data_cosmos/src/operations/list_permissions.rs b/sdk/data_cosmos/src/operations/list_permissions.rs index 937f37e275..94beebcc0e 100644 --- a/sdk/data_cosmos/src/operations/list_permissions.rs +++ b/sdk/data_cosmos/src/operations/list_permissions.rs @@ -42,7 +42,7 @@ impl ListPermissionsBuilder { this.client.database_client().database_name(), this.client.user_name() ), - http::Method::GET, + azure_core::Method::GET, ); if let Some(cl) = &this.consistency_level { diff --git a/sdk/data_cosmos/src/operations/list_stored_procedures.rs b/sdk/data_cosmos/src/operations/list_stored_procedures.rs index 449847739f..b18b5035c3 100644 --- a/sdk/data_cosmos/src/operations/list_stored_procedures.rs +++ b/sdk/data_cosmos/src/operations/list_stored_procedures.rs @@ -44,7 +44,7 @@ impl ListStoredProceduresBuilder { this.client.database_client().database_name(), this.client.collection_name(), ), - http::Method::GET, + azure_core::Method::GET, ); if let Some(cl) = &this.consistency_level { diff --git a/sdk/data_cosmos/src/operations/list_triggers.rs b/sdk/data_cosmos/src/operations/list_triggers.rs index c6b58fbc2d..aa645149d1 100644 --- a/sdk/data_cosmos/src/operations/list_triggers.rs +++ b/sdk/data_cosmos/src/operations/list_triggers.rs @@ -47,7 +47,7 @@ impl ListTriggersBuilder { this.client.database_client().database_name(), this.client.collection_name() ), - http::Method::GET, + azure_core::Method::GET, ); request.insert_headers(&this.if_match_condition); diff --git a/sdk/data_cosmos/src/operations/list_user_defined_functions.rs b/sdk/data_cosmos/src/operations/list_user_defined_functions.rs index 52ae1efe5f..7b4d8c6637 100644 --- a/sdk/data_cosmos/src/operations/list_user_defined_functions.rs +++ b/sdk/data_cosmos/src/operations/list_user_defined_functions.rs @@ -48,7 +48,7 @@ impl ListUserDefinedFunctionsBuilder { this.client.database_client().database_name(), this.client.collection_name() ), - http::Method::GET, + azure_core::Method::GET, ); request.insert_headers(&this.if_match_condition); diff --git a/sdk/data_cosmos/src/operations/list_users.rs b/sdk/data_cosmos/src/operations/list_users.rs index 4155399da1..e11d81ac35 100644 --- a/sdk/data_cosmos/src/operations/list_users.rs +++ b/sdk/data_cosmos/src/operations/list_users.rs @@ -41,7 +41,7 @@ impl ListUsersBuilder { async move { let mut request = this.client.cosmos_client().request( &format!("dbs/{}/users", this.client.database_name()), - http::Method::GET, + azure_core::Method::GET, ); if let Some(cl) = &this.consistency_level { diff --git a/sdk/data_cosmos/src/operations/query_documents.rs b/sdk/data_cosmos/src/operations/query_documents.rs index 61173e989a..b0c3eec936 100644 --- a/sdk/data_cosmos/src/operations/query_documents.rs +++ b/sdk/data_cosmos/src/operations/query_documents.rs @@ -12,11 +12,11 @@ use azure_core::headers::{ }; use azure_core::prelude::*; use azure_core::CollectedResponse; +use azure_core::Method; use azure_core::Pageable; use azure_core::Response as HttpResponse; use azure_core::SessionToken; use chrono::{DateTime, Utc}; -use http::Method; use serde::de::DeserializeOwned; use serde_json::Value; use std::convert::TryInto; diff --git a/sdk/data_cosmos/src/operations/replace_collection.rs b/sdk/data_cosmos/src/operations/replace_collection.rs index 1df0c18e84..14c79ac4fd 100644 --- a/sdk/data_cosmos/src/operations/replace_collection.rs +++ b/sdk/data_cosmos/src/operations/replace_collection.rs @@ -35,7 +35,7 @@ impl ReplaceCollectionBuilder { pub fn into_future(self) -> ReplaceCollection { Box::pin(async move { - let mut request = self.client.collection_request(http::Method::PUT); + let mut request = self.client.collection_request(azure_core::Method::PUT); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/replace_document.rs b/sdk/data_cosmos/src/operations/replace_document.rs index 499e3aa4a3..71e4355e0b 100644 --- a/sdk/data_cosmos/src/operations/replace_document.rs +++ b/sdk/data_cosmos/src/operations/replace_document.rs @@ -55,7 +55,7 @@ impl ReplaceDocumentBuilder { pub fn into_future(self) -> ReplaceDocument { Box::pin(async move { - let mut request = self.client.document_request(http::Method::PUT); + let mut request = self.client.document_request(azure_core::Method::PUT); let partition_key = self .partition_key diff --git a/sdk/data_cosmos/src/operations/replace_permission.rs b/sdk/data_cosmos/src/operations/replace_permission.rs index 2189a8d434..5ac9675ed7 100644 --- a/sdk/data_cosmos/src/operations/replace_permission.rs +++ b/sdk/data_cosmos/src/operations/replace_permission.rs @@ -31,7 +31,7 @@ impl ReplacePermissionBuilder { pub fn into_future(self) -> ReplacePermission { Box::pin(async move { - let mut request = self.client.permission_request(http::Method::PUT); + let mut request = self.client.permission_request(azure_core::Method::PUT); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/replace_stored_procedure.rs b/sdk/data_cosmos/src/operations/replace_stored_procedure.rs index 878798773b..b4c8a126cb 100644 --- a/sdk/data_cosmos/src/operations/replace_stored_procedure.rs +++ b/sdk/data_cosmos/src/operations/replace_stored_procedure.rs @@ -28,7 +28,9 @@ impl ReplaceStoredProcedureBuilder { pub fn into_future(self) -> ReplaceStoredProcedure { Box::pin(async move { - let mut req = self.client.stored_procedure_request(http::Method::PUT); + let mut req = self + .client + .stored_procedure_request(azure_core::Method::PUT); if let Some(cl) = &self.consistency_level { req.insert_headers(cl); diff --git a/sdk/data_cosmos/src/operations/replace_user.rs b/sdk/data_cosmos/src/operations/replace_user.rs index 62c3455d06..ac76a984a4 100644 --- a/sdk/data_cosmos/src/operations/replace_user.rs +++ b/sdk/data_cosmos/src/operations/replace_user.rs @@ -26,7 +26,7 @@ impl ReplaceUserBuilder { pub fn into_future(self) -> ReplaceUser { Box::pin(async move { - let mut request = self.client.user_request(http::Method::PUT); + let mut request = self.client.user_request(azure_core::Method::PUT); if let Some(cl) = &self.consistency_level { request.insert_headers(cl); diff --git a/sdk/data_tables/Cargo.toml b/sdk/data_tables/Cargo.toml index d7eb155199..a8d70f67e7 100644 --- a/sdk/data_tables/Cargo.toml +++ b/sdk/data_tables/Cargo.toml @@ -18,7 +18,6 @@ azure_storage = { path = "../storage", version = "0.4", default-features=false, bytes = "1.0" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -http = "0.2" log = "0.4" once_cell = "1.0" serde = { version = "1.0" } diff --git a/sdk/data_tables/src/clients/entity_client.rs b/sdk/data_tables/src/clients/entity_client.rs index d94fd82faf..e6851f6c6d 100644 --- a/sdk/data_tables/src/clients/entity_client.rs +++ b/sdk/data_tables/src/clients/entity_client.rs @@ -1,10 +1,10 @@ use crate::{prelude::*, requests::*}; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind}, Request, }; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; use url::Url; diff --git a/sdk/data_tables/src/clients/partition_key_client.rs b/sdk/data_tables/src/clients/partition_key_client.rs index 3cb478553d..83e1e5f81f 100644 --- a/sdk/data_tables/src/clients/partition_key_client.rs +++ b/sdk/data_tables/src/clients/partition_key_client.rs @@ -1,9 +1,9 @@ use crate::{prelude::*, requests::*}; +use azure_core::Method; use azure_core::Request; use azure_storage::core::clients::StorageAccountClient; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; pub trait AsPartitionKeyClient> { diff --git a/sdk/data_tables/src/clients/table_client.rs b/sdk/data_tables/src/clients/table_client.rs index 175cb0a389..bb21aaf0bd 100644 --- a/sdk/data_tables/src/clients/table_client.rs +++ b/sdk/data_tables/src/clients/table_client.rs @@ -1,8 +1,8 @@ use crate::{clients::TableServiceClient, requests::*}; +use azure_core::Method; use azure_core::Request; use azure_storage::core::clients::StorageAccountClient; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; pub trait AsTableClient> { diff --git a/sdk/data_tables/src/clients/table_service_client.rs b/sdk/data_tables/src/clients/table_service_client.rs index e70b796151..9d34fb4fe0 100644 --- a/sdk/data_tables/src/clients/table_service_client.rs +++ b/sdk/data_tables/src/clients/table_service_client.rs @@ -1,9 +1,9 @@ use crate::requests::ListTablesBuilder; use azure_core::error::{ErrorKind, ResultExt}; +use azure_core::Method; use azure_core::Request; use azure_storage::core::clients::{StorageAccountClient, StorageClient}; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; use url::Url; diff --git a/sdk/data_tables/src/lib.rs b/sdk/data_tables/src/lib.rs index 6d69872a45..84ec8d2daf 100644 --- a/sdk/data_tables/src/lib.rs +++ b/sdk/data_tables/src/lib.rs @@ -21,6 +21,7 @@ mod select; mod top; mod transaction; mod transaction_operation; +use azure_core::Method; pub use continuation_next_partition_and_row_key::ContinuationNextPartitionAndRowKey; pub use continuation_next_table_name::ContinuationNextTableName; pub use entity_metadata::EntityMetadata; @@ -36,4 +37,4 @@ pub use transaction::Transaction; pub use transaction_operation::TransactionOperation; // we need this since the http::Method does not have the MERGE verb. The unwrap is safe here. -static MERGE: Lazy = Lazy::new(|| http::Method::from_bytes(b"MERGE").unwrap()); +static MERGE: Lazy = Lazy::new(|| Method::from_bytes(b"MERGE").unwrap()); diff --git a/sdk/data_tables/src/requests/create_table_builder.rs b/sdk/data_tables/src/requests/create_table_builder.rs index bbcf5e1308..37da45f47b 100644 --- a/sdk/data_tables/src/requests/create_table_builder.rs +++ b/sdk/data_tables/src/requests/create_table_builder.rs @@ -1,6 +1,6 @@ use crate::{prelude::*, responses::*}; use azure_core::prelude::*; -use http::method::Method; +use azure_core::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/data_tables/src/requests/delete_entity_builder.rs b/sdk/data_tables/src/requests/delete_entity_builder.rs index ab3ca9ebdc..055b8c66a9 100644 --- a/sdk/data_tables/src/requests/delete_entity_builder.rs +++ b/sdk/data_tables/src/requests/delete_entity_builder.rs @@ -3,8 +3,8 @@ use crate::{ responses::*, TransactionOperation, }; +use azure_core::Method; use azure_core::{prelude::*, Request}; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/data_tables/src/requests/delete_table_builder.rs b/sdk/data_tables/src/requests/delete_table_builder.rs index 8fcb132091..9fa0b12a74 100644 --- a/sdk/data_tables/src/requests/delete_table_builder.rs +++ b/sdk/data_tables/src/requests/delete_table_builder.rs @@ -1,9 +1,9 @@ use crate::{prelude::*, responses::*}; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind}, prelude::*, }; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/data_tables/src/requests/get_entity_builder.rs b/sdk/data_tables/src/requests/get_entity_builder.rs index 1af6402ece..e1214e814f 100644 --- a/sdk/data_tables/src/requests/get_entity_builder.rs +++ b/sdk/data_tables/src/requests/get_entity_builder.rs @@ -1,6 +1,6 @@ use crate::{prelude::*, responses::*}; +use azure_core::Method; use azure_core::{error::Result, prelude::*, AppendToUrlQuery}; -use http::method::Method; use serde::de::DeserializeOwned; use std::convert::TryInto; diff --git a/sdk/data_tables/src/requests/insert_entity_builder.rs b/sdk/data_tables/src/requests/insert_entity_builder.rs index 1c35c466b4..818f4a2303 100644 --- a/sdk/data_tables/src/requests/insert_entity_builder.rs +++ b/sdk/data_tables/src/requests/insert_entity_builder.rs @@ -1,10 +1,10 @@ use crate::{prelude::*, responses::*, TransactionOperation}; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind}, prelude::*, Request, }; -use http::method::Method; use serde::{de::DeserializeOwned, Serialize}; use std::convert::TryInto; diff --git a/sdk/data_tables/src/requests/insert_or_replace_or_merge_entity_builder.rs b/sdk/data_tables/src/requests/insert_or_replace_or_merge_entity_builder.rs index b638ac9739..a1bb8c90d5 100644 --- a/sdk/data_tables/src/requests/insert_or_replace_or_merge_entity_builder.rs +++ b/sdk/data_tables/src/requests/insert_or_replace_or_merge_entity_builder.rs @@ -1,6 +1,6 @@ use crate::{prelude::*, responses::*, TransactionOperation}; +use azure_core::Method; use azure_core::{prelude::*, Request}; -use http::method::Method; use serde::Serialize; use std::convert::TryInto; diff --git a/sdk/data_tables/src/requests/list_tables_builder.rs b/sdk/data_tables/src/requests/list_tables_builder.rs index 707ebf836b..94ecedcb22 100644 --- a/sdk/data_tables/src/requests/list_tables_builder.rs +++ b/sdk/data_tables/src/requests/list_tables_builder.rs @@ -1,7 +1,7 @@ use crate::{prelude::*, responses::*, ContinuationNextTableName}; +use azure_core::Method; use azure_core::{prelude::*, AppendToUrlQuery}; use futures::stream::{unfold, Stream}; -use http::method::Method; use std::convert::TryInto; #[cfg(test)] diff --git a/sdk/data_tables/src/requests/query_entity_builder.rs b/sdk/data_tables/src/requests/query_entity_builder.rs index ef74dcaa0c..ea4d458422 100644 --- a/sdk/data_tables/src/requests/query_entity_builder.rs +++ b/sdk/data_tables/src/requests/query_entity_builder.rs @@ -1,11 +1,11 @@ use crate::{prelude::*, responses::*, ContinuationNextPartitionAndRowKey}; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind}, prelude::*, AppendToUrlQuery, }; use futures::stream::{unfold, Stream}; -use http::method::Method; use serde::de::DeserializeOwned; use std::convert::TryInto; diff --git a/sdk/data_tables/src/requests/submit_transaction_builder.rs b/sdk/data_tables/src/requests/submit_transaction_builder.rs index 4dd458a5e6..d3e4b1071f 100644 --- a/sdk/data_tables/src/requests/submit_transaction_builder.rs +++ b/sdk/data_tables/src/requests/submit_transaction_builder.rs @@ -1,9 +1,9 @@ use crate::{prelude::*, responses::*}; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind, ResultExt}, prelude::*, }; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/data_tables/src/requests/update_or_merge_entity_builder.rs b/sdk/data_tables/src/requests/update_or_merge_entity_builder.rs index a16d2928cb..21af9ef1e8 100644 --- a/sdk/data_tables/src/requests/update_or_merge_entity_builder.rs +++ b/sdk/data_tables/src/requests/update_or_merge_entity_builder.rs @@ -1,6 +1,6 @@ use crate::{prelude::*, responses::*, IfMatchCondition, TransactionOperation}; +use azure_core::Method; use azure_core::{prelude::*, Request}; -use http::method::Method; use serde::Serialize; use std::convert::TryInto; diff --git a/sdk/data_tables/src/responses/submit_transaction_response.rs b/sdk/data_tables/src/responses/submit_transaction_response.rs index c2dbf2b4e2..d36f8a2bb4 100644 --- a/sdk/data_tables/src/responses/submit_transaction_response.rs +++ b/sdk/data_tables/src/responses/submit_transaction_response.rs @@ -1,9 +1,8 @@ use azure_core::{ - error::{Error, ErrorKind}, - CollectedResponse, Etag, + error::{Error, ErrorKind, ResultExt}, + CollectedResponse, Etag, StatusCode, }; use azure_storage::core::headers::CommonStorageResponseHeaders; -use http::StatusCode; use std::convert::{TryFrom, TryInto}; use url::Url; @@ -40,13 +39,16 @@ impl TryFrom for SubmitTransactionResponse { for line in change_set_response.lines() { if line.starts_with("HTTP/1.1") { - operation_response.status_code = line - .split_whitespace() - .nth(1) - .ok_or_else(|| { - Error::message(ErrorKind::Other, "missing HTTP status code") - })? - .parse()?; + let status_code = line.split_whitespace().nth(1).ok_or_else(|| { + Error::message(ErrorKind::Other, "missing HTTP status code") + })?; + let status_code = status_code.parse::().map_err(|_| { + Error::with_message(ErrorKind::DataConversion, || { + format!("invalid HTTP status code `{status_code}`") + }) + })?; + operation_response.status_code = + StatusCode::from_u16(status_code).map_kind(ErrorKind::DataConversion)?; } else if line.starts_with("Location:") { operation_response.location = Some( line.split_whitespace() diff --git a/sdk/identity/Cargo.toml b/sdk/identity/Cargo.toml index f05410a253..74f977a95e 100644 --- a/sdk/identity/Cargo.toml +++ b/sdk/identity/Cargo.toml @@ -27,7 +27,6 @@ async-trait = "0.1" openssl = { version = "0.10", optional=true } base64 = "0.13.0" uuid = { version = "1.0", features = ["v4"] } -http = "0.2" # work around https://github.com/rust-lang/rust/issues/63033 fix-hidden-lifetime-bug = "0.2" diff --git a/sdk/identity/src/client_credentials_flow/mod.rs b/sdk/identity/src/client_credentials_flow/mod.rs index 77ad99363a..25d82ff8d3 100644 --- a/sdk/identity/src/client_credentials_flow/mod.rs +++ b/sdk/identity/src/client_credentials_flow/mod.rs @@ -39,12 +39,12 @@ mod login_response; +use azure_core::Method; use azure_core::{ content_type, error::{ErrorKind, ResultExt}, headers, HttpClient, Request, }; -use http::Method; use login_response::LoginResponse; use std::sync::Arc; use url::{form_urlencoded, Url}; diff --git a/sdk/identity/src/device_code_flow/mod.rs b/sdk/identity/src/device_code_flow/mod.rs index fcd086adb5..67857d6b14 100644 --- a/sdk/identity/src/device_code_flow/mod.rs +++ b/sdk/identity/src/device_code_flow/mod.rs @@ -6,6 +6,7 @@ mod device_code_responses; use async_timer::timer::new_timer; +use azure_core::Method; use azure_core::{ content_type, error::{Error, ErrorKind}, @@ -13,7 +14,6 @@ use azure_core::{ }; pub use device_code_responses::*; use futures::stream::unfold; -use http::Method; use oauth2::ClientId; use serde::Deserialize; use std::{borrow::Cow, sync::Arc, time::Duration}; diff --git a/sdk/identity/src/refresh_token.rs b/sdk/identity/src/refresh_token.rs index 52f16075ad..0b33151dee 100644 --- a/sdk/identity/src/refresh_token.rs +++ b/sdk/identity/src/refresh_token.rs @@ -1,12 +1,12 @@ //! Refresh token utilities +use azure_core::Method; use azure_core::{ auth::AccessToken, content_type, error::{Error, ErrorKind, ResultExt}, headers, HttpClient, Request, }; -use http::Method; use oauth2::{ClientId, ClientSecret}; use serde::Deserialize; use std::fmt; @@ -48,7 +48,6 @@ pub async fn exchange( req.set_body(encoded); let rsp = http_client.execute_request(&req).await?; - let rsp_status = rsp.status(); let rsp_body = rsp.into_body().await; diff --git a/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs b/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs index e35c0fead6..3de8836dcd 100644 --- a/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs +++ b/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs @@ -1,8 +1,8 @@ use azure_core::auth::{AccessToken, TokenCredential, TokenResponse}; use azure_core::error::{Error, ErrorKind, ResultExt}; +use azure_core::Method; use azure_core::{HttpClient, Request}; use chrono::{DateTime, TimeZone, Utc}; -use http::Method; use serde::{ de::{self, Deserializer}, Deserialize, @@ -138,10 +138,9 @@ impl TokenCredential for ImdsManagedIdentityCredential { "the request failed due to a gateway error", )) } - _ => { + rsp_status => { return Err( - ErrorKind::http_response_from_body(rsp_status.as_u16(), &rsp_body) - .into_error(), + ErrorKind::http_response_from_body(rsp_status, &rsp_body).into_error() ) .map_kind(ErrorKind::Credential) } diff --git a/sdk/iot_hub/Cargo.toml b/sdk/iot_hub/Cargo.toml index 4168a2a1e0..3568078b84 100644 --- a/sdk/iot_hub/Cargo.toml +++ b/sdk/iot_hub/Cargo.toml @@ -12,7 +12,6 @@ base64 = "0.13" bytes = "1.0" chrono = "0.4" hmac = "0.12" -http = "0.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_derive = "1.0" diff --git a/sdk/iot_hub/src/service/mod.rs b/sdk/iot_hub/src/service/mod.rs index 458ccb1ac1..cf5d25adeb 100644 --- a/sdk/iot_hub/src/service/mod.rs +++ b/sdk/iot_hub/src/service/mod.rs @@ -1,8 +1,8 @@ use azure_core::error::{Error, ErrorKind, ResultExt}; +use azure_core::Method; use azure_core::{content_type, headers, CollectedResponse, HttpClient, Request, Url}; use base64::{decode, encode_config}; use hmac::{Hmac, Mac}; -use http::Method; use sha2::Sha256; use std::sync::Arc; @@ -871,7 +871,7 @@ mod tests { let builder = service_client.update_module_twin("deviceid", "moduleid"); assert_eq!(builder.device_id, "deviceid".to_string()); assert_eq!(builder.module_id, Some("moduleid".to_string())); - assert_eq!(builder.method, http::Method::PATCH); + assert_eq!(builder.method, azure_core::Method::PATCH); Ok(()) } @@ -888,7 +888,7 @@ mod tests { let builder = service_client.replace_module_twin("deviceid", "moduleid"); assert_eq!(builder.device_id, "deviceid".to_string()); assert_eq!(builder.module_id, Some("moduleid".to_string())); - assert_eq!(builder.method, http::Method::PUT); + assert_eq!(builder.method, azure_core::Method::PUT); Ok(()) } @@ -905,7 +905,7 @@ mod tests { let builder = service_client.update_device_twin("deviceid"); assert_eq!(builder.device_id, "deviceid".to_string()); assert_eq!(builder.module_id, None); - assert_eq!(builder.method, http::Method::PATCH); + assert_eq!(builder.method, azure_core::Method::PATCH); Ok(()) } @@ -922,7 +922,7 @@ mod tests { let builder = service_client.replace_device_twin("deviceid"); assert_eq!(builder.device_id, "deviceid".to_string()); assert_eq!(builder.module_id, None); - assert_eq!(builder.method, http::Method::PUT); + assert_eq!(builder.method, azure_core::Method::PUT); Ok(()) } diff --git a/sdk/iot_hub/src/service/requests/apply_on_edge_device_builder.rs b/sdk/iot_hub/src/service/requests/apply_on_edge_device_builder.rs index 39084ebe05..a74194359c 100644 --- a/sdk/iot_hub/src/service/requests/apply_on_edge_device_builder.rs +++ b/sdk/iot_hub/src/service/requests/apply_on_edge_device_builder.rs @@ -1,6 +1,6 @@ use crate::service::{ServiceClient, API_VERSION}; -use http::Method; +use azure_core::Method; use serde::Serialize; /// The ApplyOnEdgeDeviceBuilder is used to construct a new device identity /// or the update an existing one. diff --git a/sdk/iot_hub/src/service/requests/create_or_update_configuration_builder.rs b/sdk/iot_hub/src/service/requests/create_or_update_configuration_builder.rs index 82a6dfcb02..905a311df1 100644 --- a/sdk/iot_hub/src/service/requests/create_or_update_configuration_builder.rs +++ b/sdk/iot_hub/src/service/requests/create_or_update_configuration_builder.rs @@ -1,5 +1,5 @@ use azure_core::headers; -use http::Method; +use azure_core::Method; use serde::Serialize; use std::collections::HashMap; use std::convert::TryInto; diff --git a/sdk/iot_hub/src/service/requests/create_or_update_device_identity_builder.rs b/sdk/iot_hub/src/service/requests/create_or_update_device_identity_builder.rs index 93d35124dd..395320d23c 100644 --- a/sdk/iot_hub/src/service/requests/create_or_update_device_identity_builder.rs +++ b/sdk/iot_hub/src/service/requests/create_or_update_device_identity_builder.rs @@ -6,7 +6,7 @@ use crate::service::responses::DeviceIdentityResponse; use crate::service::{ServiceClient, API_VERSION}; use azure_core::error::{Error, ErrorKind}; use azure_core::headers; -use http::Method; +use azure_core::Method; use serde::Serialize; use std::convert::TryInto; diff --git a/sdk/iot_hub/src/service/requests/create_or_update_module_identity_builder.rs b/sdk/iot_hub/src/service/requests/create_or_update_module_identity_builder.rs index 5815ba6445..5848b98793 100644 --- a/sdk/iot_hub/src/service/requests/create_or_update_module_identity_builder.rs +++ b/sdk/iot_hub/src/service/requests/create_or_update_module_identity_builder.rs @@ -3,7 +3,7 @@ use crate::service::responses::ModuleIdentityResponse; use crate::service::{ServiceClient, API_VERSION}; use azure_core::error::{Error, ErrorKind}; use azure_core::headers; -use http::Method; +use azure_core::Method; use serde::Serialize; use std::convert::TryInto; diff --git a/sdk/iot_hub/src/service/requests/delete_configuration_builder.rs b/sdk/iot_hub/src/service/requests/delete_configuration_builder.rs index d94eafeda1..8d3368404f 100644 --- a/sdk/iot_hub/src/service/requests/delete_configuration_builder.rs +++ b/sdk/iot_hub/src/service/requests/delete_configuration_builder.rs @@ -1,7 +1,7 @@ use crate::service::{ServiceClient, API_VERSION}; use azure_core::headers; -use http::Method; +use azure_core::Method; /// The DeleteConfigurationBuilder is used to construct a request to delete a configuration. pub struct DeleteConfigurationBuilder<'a> { diff --git a/sdk/iot_hub/src/service/requests/delete_identity_builder.rs b/sdk/iot_hub/src/service/requests/delete_identity_builder.rs index 2de4837aa2..31c6639710 100644 --- a/sdk/iot_hub/src/service/requests/delete_identity_builder.rs +++ b/sdk/iot_hub/src/service/requests/delete_identity_builder.rs @@ -1,6 +1,6 @@ use crate::service::{ServiceClient, API_VERSION}; use azure_core::headers; -use http::Method; +use azure_core::Method; /// The DeleteIdentityBuilder is used to construct a request to delete a module or device identity. pub struct DeleteIdentityBuilder<'a> { diff --git a/sdk/iot_hub/src/service/requests/get_configuration.rs b/sdk/iot_hub/src/service/requests/get_configuration.rs index 5b109cd1ec..8f60584070 100644 --- a/sdk/iot_hub/src/service/requests/get_configuration.rs +++ b/sdk/iot_hub/src/service/requests/get_configuration.rs @@ -1,6 +1,6 @@ use crate::service::{ServiceClient, API_VERSION}; use azure_core::error::Error; -use http::Method; +use azure_core::Method; use std::convert::{TryFrom, TryInto}; /// Execute the request to get the configuration of a given identifier. diff --git a/sdk/iot_hub/src/service/requests/get_identity.rs b/sdk/iot_hub/src/service/requests/get_identity.rs index 09f0463353..e2c684741f 100644 --- a/sdk/iot_hub/src/service/requests/get_identity.rs +++ b/sdk/iot_hub/src/service/requests/get_identity.rs @@ -1,6 +1,6 @@ use crate::service::{ServiceClient, API_VERSION}; use azure_core::error::Error; -use http::Method; +use azure_core::Method; use std::convert::{TryFrom, TryInto}; /// Execute the request to get the identity of a device or module. diff --git a/sdk/iot_hub/src/service/requests/get_twin.rs b/sdk/iot_hub/src/service/requests/get_twin.rs index 220e63a58f..b4e5a7adda 100644 --- a/sdk/iot_hub/src/service/requests/get_twin.rs +++ b/sdk/iot_hub/src/service/requests/get_twin.rs @@ -1,6 +1,6 @@ use crate::service::{ServiceClient, API_VERSION}; use azure_core::error::Error; -use http::Method; +use azure_core::Method; use std::convert::TryFrom; use std::convert::TryInto; diff --git a/sdk/iot_hub/src/service/requests/invoke_method_builder.rs b/sdk/iot_hub/src/service/requests/invoke_method_builder.rs index e8ea2d88e2..e592dc21c0 100644 --- a/sdk/iot_hub/src/service/requests/invoke_method_builder.rs +++ b/sdk/iot_hub/src/service/requests/invoke_method_builder.rs @@ -1,6 +1,6 @@ use crate::service::responses::InvokeMethodResponse; use crate::service::{ServiceClient, API_VERSION}; -use http::Method; +use azure_core::Method; use serde::Serialize; use std::convert::TryInto; diff --git a/sdk/iot_hub/src/service/requests/query_builder.rs b/sdk/iot_hub/src/service/requests/query_builder.rs index bc4a8cc664..a0482f604e 100644 --- a/sdk/iot_hub/src/service/requests/query_builder.rs +++ b/sdk/iot_hub/src/service/requests/query_builder.rs @@ -3,7 +3,7 @@ use crate::service::{responses::QueryResponse, ServiceClient, API_VERSION}; use azure_core::prelude::*; use azure_core::setters; -use http::Method; +use azure_core::Method; use serde::Serialize; use std::convert::TryInto; diff --git a/sdk/iot_hub/src/service/requests/update_or_replace_twin_builder.rs b/sdk/iot_hub/src/service/requests/update_or_replace_twin_builder.rs index 06ffdf9b66..e6c1be8292 100644 --- a/sdk/iot_hub/src/service/requests/update_or_replace_twin_builder.rs +++ b/sdk/iot_hub/src/service/requests/update_or_replace_twin_builder.rs @@ -1,6 +1,6 @@ use azure_core::error::Error; use azure_core::headers; -use http::Method; +use azure_core::Method; use serde::Serialize; use std::collections::HashMap; use std::convert::TryFrom; diff --git a/sdk/messaging_eventgrid/Cargo.toml b/sdk/messaging_eventgrid/Cargo.toml index 09c830c0b5..3818623c78 100644 --- a/sdk/messaging_eventgrid/Cargo.toml +++ b/sdk/messaging_eventgrid/Cargo.toml @@ -15,7 +15,6 @@ edition = "2021" [dependencies] azure_core = { path = "../core", version = "0.3" } chrono = { version = "0.4", features = ["serde"] } -http = "0.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" uuid = { version = "1.0", features = ["v4"] } diff --git a/sdk/messaging_servicebus/Cargo.toml b/sdk/messaging_servicebus/Cargo.toml index cae387aac1..73b4c66c07 100644 --- a/sdk/messaging_servicebus/Cargo.toml +++ b/sdk/messaging_servicebus/Cargo.toml @@ -23,7 +23,6 @@ url = "2.2" hmac = "0.12" sha2 = "0.10" ring = "0.16" -http = "0.2" bytes = "1.0" [dev-dependencies] diff --git a/sdk/messaging_servicebus/src/service_bus/mod.rs b/sdk/messaging_servicebus/src/service_bus/mod.rs index e64d3f9ea9..1105b12029 100644 --- a/sdk/messaging_servicebus/src/service_bus/mod.rs +++ b/sdk/messaging_servicebus/src/service_bus/mod.rs @@ -1,6 +1,6 @@ use azure_core::{error::Error, headers, CollectedResponse, HttpClient, Request, Url}; +use azure_core::{Method, StatusCode}; use chrono::Duration; -use http::Method; use ring::hmac; use std::{ops::Add, sync::Arc}; use url::form_urlencoded::{self, Serializer}; @@ -17,7 +17,7 @@ const DEFAULT_SAS_DURATION: i64 = 1; /// Prepares an HTTP request fn prepare_request( url: &str, - method: http::Method, + method: azure_core::Method, body: Option, policy_name: &str, signing_key: &hmac::Key, @@ -191,7 +191,7 @@ async fn peek_lock_message2( pub struct PeekLockResponse { body: String, lock_location: String, - status: http::StatusCode, + status: StatusCode, http_client: Arc, policy_name: String, signing_key: hmac::Key, @@ -204,8 +204,8 @@ impl PeekLockResponse { } /// Get the status of the peek - pub fn status(&self) -> http::StatusCode { - self.status + pub fn status(&self) -> &StatusCode { + &self.status } /// Delete message in the lock diff --git a/sdk/storage/Cargo.toml b/sdk/storage/Cargo.toml index 5c828a074f..8907cf4dcb 100644 --- a/sdk/storage/Cargo.toml +++ b/sdk/storage/Cargo.toml @@ -17,7 +17,6 @@ async-trait = "0.1" azure_core = { path = "../core", version = "0.3", default-features=false } base64 = "0.13" chrono = "0.4" -http = "0.2" futures = "0.3" log = "0.4" serde = "1.0" diff --git a/sdk/storage/src/account/operations/find_blobs_by_tags.rs b/sdk/storage/src/account/operations/find_blobs_by_tags.rs index f97127b178..0411cf6a9e 100644 --- a/sdk/storage/src/account/operations/find_blobs_by_tags.rs +++ b/sdk/storage/src/account/operations/find_blobs_by_tags.rs @@ -41,7 +41,7 @@ impl FindBlobsByTagsBuilder { let mut request = self .client .storage_account_client() - .blob_storage_request(http::Method::GET); + .blob_storage_request(azure_core::Method::GET); self.timeout.append_to_url_query(request.url_mut()); request diff --git a/sdk/storage/src/account/operations/get_account_information.rs b/sdk/storage/src/account/operations/get_account_information.rs index c7173101b0..be1c57b38d 100644 --- a/sdk/storage/src/account/operations/get_account_information.rs +++ b/sdk/storage/src/account/operations/get_account_information.rs @@ -29,7 +29,7 @@ impl GetAccountInformationBuilder { let mut request = self .client .storage_account_client() - .blob_storage_request(http::Method::GET); + .blob_storage_request(azure_core::Method::GET); for (k, v) in [("restype", "account"), ("comp", "properties")].iter() { request.url_mut().query_pairs_mut().append_pair(k, v); diff --git a/sdk/storage/src/authorization_policy.rs b/sdk/storage/src/authorization_policy.rs index c1c5b96c62..7aa6eaadea 100644 --- a/sdk/storage/src/authorization_policy.rs +++ b/sdk/storage/src/authorization_policy.rs @@ -1,7 +1,7 @@ use crate::clients::{ServiceType, StorageCredentials}; use azure_core::error::{ErrorKind, ResultExt}; +use azure_core::Method; use azure_core::{headers::*, Context, Policy, PolicyResult, Request}; -use http::Method; use std::borrow::Cow; use std::sync::Arc; use url::Url; diff --git a/sdk/storage/src/core/clients/storage_account_client.rs b/sdk/storage/src/core/clients/storage_account_client.rs index 8d993607ae..a95ddefa8b 100644 --- a/sdk/storage/src/core/clients/storage_account_client.rs +++ b/sdk/storage/src/core/clients/storage_account_client.rs @@ -7,6 +7,7 @@ use crate::{ AccountSharedAccessSignatureBuilder, ClientAccountSharedAccessSignature, }, }; +use azure_core::Method; use azure_core::{ auth::TokenCredential, error::{Error, ErrorKind, ResultExt}, @@ -14,7 +15,6 @@ use azure_core::{ ClientOptions, Context, HttpClient, Pipeline, Request, Response, }; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; use url::Url; @@ -509,7 +509,7 @@ impl StorageAccountClient { } /// Prepares' an `azure_core::Request`. - pub(crate) fn blob_storage_request(&self, http_method: http::Method) -> Request { + pub(crate) fn blob_storage_request(&self, http_method: azure_core::Method) -> Request { Request::new(self.blob_storage_url().clone(), http_method) } } diff --git a/sdk/storage/src/core/clients/storage_client.rs b/sdk/storage/src/core/clients/storage_client.rs index db1d0861a8..11d6e3697b 100644 --- a/sdk/storage/src/core/clients/storage_client.rs +++ b/sdk/storage/src/core/clients/storage_client.rs @@ -1,11 +1,11 @@ use crate::core::clients::{ServiceType, StorageAccountClient}; use crate::operations::*; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind}, Context, Request, Response, }; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; pub trait AsStorageClient { diff --git a/sdk/storage_blobs/Cargo.toml b/sdk/storage_blobs/Cargo.toml index 3705aebacc..5669895af0 100644 --- a/sdk/storage_blobs/Cargo.toml +++ b/sdk/storage_blobs/Cargo.toml @@ -21,7 +21,6 @@ base64 = "0.13" bytes = "1.0" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -http = "0.2" log = "0.4" md5 = "0.7" RustyXML = "0.3" diff --git a/sdk/storage_blobs/src/blob/operations/acquire_lease.rs b/sdk/storage_blobs/src/blob/operations/acquire_lease.rs index 099b894f52..935a5497a4 100644 --- a/sdk/storage_blobs/src/blob/operations/acquire_lease.rs +++ b/sdk/storage_blobs/src/blob/operations/acquire_lease.rs @@ -46,7 +46,7 @@ impl AcquireLeaseBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.insert_header(LEASE_ACTION, "acquire"); request.add_mandatory_header(&self.lease_duration); request.add_optional_header(&self.proposed_lease_id); diff --git a/sdk/storage_blobs/src/blob/operations/append_block.rs b/sdk/storage_blobs/src/blob/operations/append_block.rs index b801e8330a..3ce593a7d7 100644 --- a/sdk/storage_blobs/src/blob/operations/append_block.rs +++ b/sdk/storage_blobs/src/blob/operations/append_block.rs @@ -45,7 +45,7 @@ impl AppendBlockBuilder { let mut request = self.blob_client.prepare_request( url.as_str(), - http::Method::PUT, + azure_core::Method::PUT, Some(self.body.clone()), )?; request.add_optional_header(&self.hash); diff --git a/sdk/storage_blobs/src/blob/operations/break_lease.rs b/sdk/storage_blobs/src/blob/operations/break_lease.rs index 5a33684bc8..6626e70e0b 100644 --- a/sdk/storage_blobs/src/blob/operations/break_lease.rs +++ b/sdk/storage_blobs/src/blob/operations/break_lease.rs @@ -37,7 +37,7 @@ impl BreakLeaseBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.insert_header(LEASE_ACTION, "break"); request.add_optional_header(&self.lease_break_period); request.add_optional_header(&self.lease_id); diff --git a/sdk/storage_blobs/src/blob/operations/change_lease.rs b/sdk/storage_blobs/src/blob/operations/change_lease.rs index d903e6d23e..3394645dec 100644 --- a/sdk/storage_blobs/src/blob/operations/change_lease.rs +++ b/sdk/storage_blobs/src/blob/operations/change_lease.rs @@ -34,9 +34,11 @@ impl ChangeLeaseBuilder { url.query_pairs_mut().append_pair("comp", "lease"); self.timeout.append_to_url_query(&mut url); - let mut request = - self.blob_lease_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + let mut request = self.blob_lease_client.prepare_request( + url.as_str(), + azure_core::Method::PUT, + None, + )?; request.insert_header(LEASE_ACTION, "change"); request.add_mandatory_header(self.blob_lease_client.lease_id()); request.add_mandatory_header(&self.proposed_lease_id); diff --git a/sdk/storage_blobs/src/blob/operations/clear_page.rs b/sdk/storage_blobs/src/blob/operations/clear_page.rs index 9d15713883..20bbd06490 100644 --- a/sdk/storage_blobs/src/blob/operations/clear_page.rs +++ b/sdk/storage_blobs/src/blob/operations/clear_page.rs @@ -49,7 +49,7 @@ impl ClearPageBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.insert_header(PAGE_WRITE, "clear"); request.insert_header(BLOB_TYPE, "PageBlob"); diff --git a/sdk/storage_blobs/src/blob/operations/copy_blob.rs b/sdk/storage_blobs/src/blob/operations/copy_blob.rs index bda5708edb..ff16267d62 100644 --- a/sdk/storage_blobs/src/blob/operations/copy_blob.rs +++ b/sdk/storage_blobs/src/blob/operations/copy_blob.rs @@ -68,7 +68,7 @@ impl CopyBlobBuilder { self.timeout.append_to_url_query(&mut url); let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.insert_header(COPY_SOURCE, self.source_url.as_str().to_owned()); if let Some(metadata) = &self.metadata { for m in metadata.iter() { diff --git a/sdk/storage_blobs/src/blob/operations/copy_blob_from_url.rs b/sdk/storage_blobs/src/blob/operations/copy_blob_from_url.rs index 7035b2d7b8..fb9f8ac602 100644 --- a/sdk/storage_blobs/src/blob/operations/copy_blob_from_url.rs +++ b/sdk/storage_blobs/src/blob/operations/copy_blob_from_url.rs @@ -72,7 +72,7 @@ impl CopyBlobFromUrlBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.insert_header(COPY_SOURCE, self.source_url.to_string()); request.insert_header(REQUIRES_SYNC, format!("{}", self.is_synchronous)); if let Some(metadata) = &self.metadata { diff --git a/sdk/storage_blobs/src/blob/operations/delete_blob.rs b/sdk/storage_blobs/src/blob/operations/delete_blob.rs index 6d808377d1..f879a1e373 100644 --- a/sdk/storage_blobs/src/blob/operations/delete_blob.rs +++ b/sdk/storage_blobs/src/blob/operations/delete_blob.rs @@ -36,7 +36,7 @@ impl DeleteBlobBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::DELETE, None)?; + .prepare_request(url.as_str(), azure_core::Method::DELETE, None)?; request.add_optional_header(&self.lease_id); request.add_mandatory_header(&self.delete_snapshots_method); diff --git a/sdk/storage_blobs/src/blob/operations/delete_blob_snapshot.rs b/sdk/storage_blobs/src/blob/operations/delete_blob_snapshot.rs index ab6b65598a..abec3fd295 100644 --- a/sdk/storage_blobs/src/blob/operations/delete_blob_snapshot.rs +++ b/sdk/storage_blobs/src/blob/operations/delete_blob_snapshot.rs @@ -41,7 +41,7 @@ impl DeleteBlobSnapshotBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::DELETE, None)?; + .prepare_request(url.as_str(), azure_core::Method::DELETE, None)?; request.add_optional_header(&self.lease_id); let response = self diff --git a/sdk/storage_blobs/src/blob/operations/delete_blob_version.rs b/sdk/storage_blobs/src/blob/operations/delete_blob_version.rs index b9c9e26244..8706137cb3 100644 --- a/sdk/storage_blobs/src/blob/operations/delete_blob_version.rs +++ b/sdk/storage_blobs/src/blob/operations/delete_blob_version.rs @@ -41,7 +41,7 @@ impl DeleteBlobVersionBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::DELETE, None)?; + .prepare_request(url.as_str(), azure_core::Method::DELETE, None)?; request.add_optional_header(&self.lease_id); let response = self diff --git a/sdk/storage_blobs/src/blob/operations/get_blob.rs b/sdk/storage_blobs/src/blob/operations/get_blob.rs index d426796f9c..d816d5bdea 100644 --- a/sdk/storage_blobs/src/blob/operations/get_blob.rs +++ b/sdk/storage_blobs/src/blob/operations/get_blob.rs @@ -58,9 +58,11 @@ impl GetBlobBuilder { this.blob_versioning.append_to_url_query(&mut url); this.timeout.append_to_url_query(&mut url); - let mut request = - this.blob_client - .prepare_request(url.as_str(), http::Method::GET, None)?; + let mut request = this.blob_client.prepare_request( + url.as_str(), + azure_core::Method::GET, + None, + )?; for (name, value) in range.as_headers() { request.insert_header(name, value); diff --git a/sdk/storage_blobs/src/blob/operations/get_block_list.rs b/sdk/storage_blobs/src/blob/operations/get_block_list.rs index 4e6be5ee6f..24f682e752 100644 --- a/sdk/storage_blobs/src/blob/operations/get_block_list.rs +++ b/sdk/storage_blobs/src/blob/operations/get_block_list.rs @@ -45,7 +45,7 @@ impl GetBlockListBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::GET, None)?; + .prepare_request(url.as_str(), azure_core::Method::GET, None)?; request.add_optional_header(&self.lease_id); let response = self diff --git a/sdk/storage_blobs/src/blob/operations/get_metadata.rs b/sdk/storage_blobs/src/blob/operations/get_metadata.rs index d6f6301b59..9efd347d2b 100644 --- a/sdk/storage_blobs/src/blob/operations/get_metadata.rs +++ b/sdk/storage_blobs/src/blob/operations/get_metadata.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use azure_core::{headers::*, prelude::*, RequestId}; +use azure_core::{headers::*, prelude::*, Method, RequestId}; use chrono::{DateTime, Utc}; use std::convert::{TryFrom, TryInto}; @@ -37,9 +37,9 @@ impl GetMetadataBuilder { self.blob_versioning.append_to_url_query(&mut url); self.timeout.append_to_url_query(&mut url); - let mut request = - self.blob_client - .prepare_request(url.as_str(), http::Method::GET, None)?; + let mut request = self + .blob_client + .prepare_request(url.as_str(), Method::GET, None)?; request.add_optional_header(&self.lease_id); let response = self diff --git a/sdk/storage_blobs/src/blob/operations/get_page_ranges.rs b/sdk/storage_blobs/src/blob/operations/get_page_ranges.rs index ee730df7a3..62de9d53d3 100644 --- a/sdk/storage_blobs/src/blob/operations/get_page_ranges.rs +++ b/sdk/storage_blobs/src/blob/operations/get_page_ranges.rs @@ -38,7 +38,7 @@ impl<'a> GetPageRangesBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::GET, None)?; + .prepare_request(url.as_str(), azure_core::Method::GET, None)?; request.add_optional_header(&self.lease_id); let response = self diff --git a/sdk/storage_blobs/src/blob/operations/get_properties.rs b/sdk/storage_blobs/src/blob/operations/get_properties.rs index da56703400..1020bbd4c5 100644 --- a/sdk/storage_blobs/src/blob/operations/get_properties.rs +++ b/sdk/storage_blobs/src/blob/operations/get_properties.rs @@ -37,7 +37,7 @@ impl GetPropertiesBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::HEAD, None)?; + .prepare_request(url.as_str(), azure_core::Method::HEAD, None)?; request.add_optional_header(&self.lease_id); let response = self diff --git a/sdk/storage_blobs/src/blob/operations/put_append_blob.rs b/sdk/storage_blobs/src/blob/operations/put_append_blob.rs index 756eb78cb6..7dbabcef34 100644 --- a/sdk/storage_blobs/src/blob/operations/put_append_blob.rs +++ b/sdk/storage_blobs/src/blob/operations/put_append_blob.rs @@ -50,7 +50,7 @@ impl PutAppendBlobBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.insert_header(BLOB_TYPE, "AppendBlob"); request.add_optional_header(&self.content_type); request.add_optional_header(&self.content_encoding); diff --git a/sdk/storage_blobs/src/blob/operations/put_block.rs b/sdk/storage_blobs/src/blob/operations/put_block.rs index 91ef4f3228..482cca4d02 100644 --- a/sdk/storage_blobs/src/blob/operations/put_block.rs +++ b/sdk/storage_blobs/src/blob/operations/put_block.rs @@ -49,7 +49,7 @@ impl<'a> PutBlockBuilder { let mut request = self.blob_client.prepare_request( url.as_str(), - http::Method::PUT, + azure_core::Method::PUT, Some(self.body.clone()), )?; request.add_optional_header(&self.lease_id); diff --git a/sdk/storage_blobs/src/blob/operations/put_block_blob.rs b/sdk/storage_blobs/src/blob/operations/put_block_blob.rs index 5b42842c91..adfa19c0a7 100644 --- a/sdk/storage_blobs/src/blob/operations/put_block_blob.rs +++ b/sdk/storage_blobs/src/blob/operations/put_block_blob.rs @@ -64,7 +64,7 @@ impl PutBlockBlobBuilder { let mut request = self.blob_client.prepare_request( url.as_str(), - http::Method::PUT, + azure_core::Method::PUT, Some(self.body.clone()), )?; request.insert_header(BLOB_TYPE, "BlockBlob"); diff --git a/sdk/storage_blobs/src/blob/operations/put_block_list.rs b/sdk/storage_blobs/src/blob/operations/put_block_list.rs index 122a725b2f..0ee933f314 100644 --- a/sdk/storage_blobs/src/blob/operations/put_block_list.rs +++ b/sdk/storage_blobs/src/blob/operations/put_block_list.rs @@ -75,7 +75,7 @@ impl PutBlockListBuilder { let mut request = self.blob_client.prepare_request( url.as_str(), - http::Method::PUT, + azure_core::Method::PUT, Some(body_bytes), )?; request.insert_header("Content-MD5", &md5); diff --git a/sdk/storage_blobs/src/blob/operations/put_page_blob.rs b/sdk/storage_blobs/src/blob/operations/put_page_blob.rs index f267813808..585a2f2883 100644 --- a/sdk/storage_blobs/src/blob/operations/put_page_blob.rs +++ b/sdk/storage_blobs/src/blob/operations/put_page_blob.rs @@ -57,7 +57,7 @@ impl PutPageBlobBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.insert_header(BLOB_TYPE, "PageBlob"); request.insert_header(BLOB_CONTENT_LENGTH, &format!("{}", self.length)); request.add_optional_header(&self.content_type); diff --git a/sdk/storage_blobs/src/blob/operations/release_lease.rs b/sdk/storage_blobs/src/blob/operations/release_lease.rs index 8658e50398..02bee87540 100644 --- a/sdk/storage_blobs/src/blob/operations/release_lease.rs +++ b/sdk/storage_blobs/src/blob/operations/release_lease.rs @@ -34,9 +34,11 @@ impl ReleaseLeaseBuilder { url.query_pairs_mut().append_pair("comp", "lease"); self.timeout.append_to_url_query(&mut url); - let mut request = - self.blob_lease_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + let mut request = self.blob_lease_client.prepare_request( + url.as_str(), + azure_core::Method::PUT, + None, + )?; request.insert_header(LEASE_ACTION, "release"); request.add_mandatory_header(self.blob_lease_client.lease_id()); diff --git a/sdk/storage_blobs/src/blob/operations/renew_lease.rs b/sdk/storage_blobs/src/blob/operations/renew_lease.rs index 509547c013..87533d0d8d 100644 --- a/sdk/storage_blobs/src/blob/operations/renew_lease.rs +++ b/sdk/storage_blobs/src/blob/operations/renew_lease.rs @@ -34,9 +34,11 @@ impl RenewLeaseBuilder { url.query_pairs_mut().append_pair("comp", "lease"); self.timeout.append_to_url_query(&mut url); - let mut request = - self.blob_lease_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + let mut request = self.blob_lease_client.prepare_request( + url.as_str(), + azure_core::Method::PUT, + None, + )?; request.insert_header(LEASE_ACTION, "renew"); request.add_mandatory_header(self.blob_lease_client.lease_id()); diff --git a/sdk/storage_blobs/src/blob/operations/set_blob_tier.rs b/sdk/storage_blobs/src/blob/operations/set_blob_tier.rs index 4415d3a876..24d268070e 100644 --- a/sdk/storage_blobs/src/blob/operations/set_blob_tier.rs +++ b/sdk/storage_blobs/src/blob/operations/set_blob_tier.rs @@ -42,7 +42,7 @@ impl SetBlobTierBuilder { let mut request = self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + .prepare_request(url.as_str(), azure_core::Method::PUT, None)?; request.add_mandatory_header(&self.access_tier); request.add_optional_header(&self.rehydrate_priority); diff --git a/sdk/storage_blobs/src/blob/operations/set_metadata.rs b/sdk/storage_blobs/src/blob/operations/set_metadata.rs index 9513ca4e94..9b43cd1485 100644 --- a/sdk/storage_blobs/src/blob/operations/set_metadata.rs +++ b/sdk/storage_blobs/src/blob/operations/set_metadata.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use azure_core::{headers::*, prelude::*, RequestId}; +use azure_core::{headers::*, prelude::*, Method, RequestId}; use chrono::{DateTime, Utc}; use std::convert::{TryFrom, TryInto}; @@ -37,9 +37,9 @@ impl SetMetadataBuilder { url.query_pairs_mut().append_pair("comp", "metadata"); self.timeout.append_to_url_query(&mut url); - let mut request = - self.blob_client - .prepare_request(url.as_str(), http::Method::PUT, None)?; + let mut request = self + .blob_client + .prepare_request(url.as_str(), Method::PUT, None)?; request.add_optional_header(&self.lease_id); if let Some(metadata) = &self.metadata { for m in metadata.iter() { diff --git a/sdk/storage_blobs/src/blob/operations/update_page.rs b/sdk/storage_blobs/src/blob/operations/update_page.rs index f8f4b7bd15..916099849d 100644 --- a/sdk/storage_blobs/src/blob/operations/update_page.rs +++ b/sdk/storage_blobs/src/blob/operations/update_page.rs @@ -57,7 +57,7 @@ impl UpdatePageBuilder { let mut request = self.blob_client.prepare_request( url.as_str(), - http::Method::PUT, + azure_core::Method::PUT, Some(self.content.clone()), )?; request.insert_header(PAGE_WRITE, "update"); diff --git a/sdk/storage_blobs/src/clients/blob_client.rs b/sdk/storage_blobs/src/clients/blob_client.rs index 5e83907fba..de8e2f6d60 100644 --- a/sdk/storage_blobs/src/clients/blob_client.rs +++ b/sdk/storage_blobs/src/clients/blob_client.rs @@ -1,4 +1,5 @@ use crate::{blob::operations::*, prelude::*, BA512Range}; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind}, prelude::*, @@ -14,7 +15,6 @@ use azure_storage::core::{ }; use bytes::Bytes; use futures::StreamExt; -use http::method::Method; use std::sync::Arc; use url::Url; diff --git a/sdk/storage_blobs/src/clients/blob_lease_client.rs b/sdk/storage_blobs/src/clients/blob_lease_client.rs index 20632bde58..86dad77d32 100644 --- a/sdk/storage_blobs/src/clients/blob_lease_client.rs +++ b/sdk/storage_blobs/src/clients/blob_lease_client.rs @@ -1,8 +1,7 @@ use crate::{blob::operations::*, prelude::*}; -use azure_core::{prelude::*, Context, Request, Response}; +use azure_core::{prelude::*, Context, Method, Request, Response}; use azure_storage::core::prelude::*; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; pub trait AsBlobLeaseClient { diff --git a/sdk/storage_blobs/src/clients/container_client.rs b/sdk/storage_blobs/src/clients/container_client.rs index f0b8e8cffa..005dc3e078 100644 --- a/sdk/storage_blobs/src/clients/container_client.rs +++ b/sdk/storage_blobs/src/clients/container_client.rs @@ -1,4 +1,5 @@ use crate::{container::operations::*, prelude::PublicAccess}; +use azure_core::Method; use azure_core::{ error::{Error, ErrorKind}, prelude::*, @@ -14,7 +15,6 @@ use azure_storage::{ }, }; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; pub trait AsContainerClient> { diff --git a/sdk/storage_blobs/src/clients/container_lease_client.rs b/sdk/storage_blobs/src/clients/container_lease_client.rs index 21dc45e896..e5fa24d9e3 100644 --- a/sdk/storage_blobs/src/clients/container_lease_client.rs +++ b/sdk/storage_blobs/src/clients/container_lease_client.rs @@ -1,8 +1,7 @@ use crate::{container::operations::*, prelude::*}; -use azure_core::{prelude::*, Context, Request, Response}; +use azure_core::{prelude::*, Context, Method, Request, Response}; use azure_storage::core::prelude::*; use bytes::Bytes; -use http::method::Method; use std::sync::Arc; pub trait AsContainerLeaseClient { diff --git a/sdk/storage_blobs/src/container/operations/acquire_lease.rs b/sdk/storage_blobs/src/container/operations/acquire_lease.rs index fd42deb7a8..a6433537ee 100644 --- a/sdk/storage_blobs/src/container/operations/acquire_lease.rs +++ b/sdk/storage_blobs/src/container/operations/acquire_lease.rs @@ -1,7 +1,7 @@ use crate::prelude::*; +use azure_core::Method; use azure_core::{headers::*, prelude::*, RequestId}; use chrono::{DateTime, Utc}; -use http::method::Method; #[derive(Debug, Clone)] pub struct AcquireLeaseBuilder { diff --git a/sdk/storage_blobs/src/container/operations/break_lease.rs b/sdk/storage_blobs/src/container/operations/break_lease.rs index 24b175a783..45e1b34854 100644 --- a/sdk/storage_blobs/src/container/operations/break_lease.rs +++ b/sdk/storage_blobs/src/container/operations/break_lease.rs @@ -1,11 +1,11 @@ use crate::prelude::*; +use azure_core::Method; use azure_core::{ headers::{LEASE_ACTION, *}, prelude::*, RequestId, }; use chrono::{DateTime, Utc}; -use http::method::Method; #[derive(Debug, Clone)] pub struct BreakLeaseBuilder { diff --git a/sdk/storage_blobs/src/container/operations/create.rs b/sdk/storage_blobs/src/container/operations/create.rs index 233df33929..1af8502414 100644 --- a/sdk/storage_blobs/src/container/operations/create.rs +++ b/sdk/storage_blobs/src/container/operations/create.rs @@ -1,6 +1,6 @@ use crate::{container::PublicAccess, prelude::*}; +use azure_core::Method; use azure_core::{headers::AsHeaders, prelude::*}; -use http::method::Method; #[derive(Debug, Clone)] pub struct CreateBuilder { diff --git a/sdk/storage_blobs/src/container/operations/delete.rs b/sdk/storage_blobs/src/container/operations/delete.rs index f26564517b..5d1d085ff1 100644 --- a/sdk/storage_blobs/src/container/operations/delete.rs +++ b/sdk/storage_blobs/src/container/operations/delete.rs @@ -1,6 +1,6 @@ use crate::prelude::*; use azure_core::prelude::*; -use http::method::Method; +use azure_core::Method; #[derive(Debug, Clone)] pub struct DeleteBuilder { diff --git a/sdk/storage_blobs/src/container/operations/get_acl.rs b/sdk/storage_blobs/src/container/operations/get_acl.rs index 41a94d8ed1..6bc5c57a36 100644 --- a/sdk/storage_blobs/src/container/operations/get_acl.rs +++ b/sdk/storage_blobs/src/container/operations/get_acl.rs @@ -2,6 +2,7 @@ use crate::{ container::{public_access_from_header, PublicAccess}, prelude::*, }; +use azure_core::Method; use azure_core::{ collect_pinned_stream, error::{ErrorKind, ResultExt}, @@ -12,7 +13,6 @@ use azure_core::{ use azure_storage::core::StoredAccessPolicyList; use bytes::Bytes; use chrono::{DateTime, FixedOffset}; -use http::Method; use std::convert::TryFrom; #[derive(Debug, Clone)] diff --git a/sdk/storage_blobs/src/container/operations/get_properties.rs b/sdk/storage_blobs/src/container/operations/get_properties.rs index 1e89a0a883..9f2f38adcb 100644 --- a/sdk/storage_blobs/src/container/operations/get_properties.rs +++ b/sdk/storage_blobs/src/container/operations/get_properties.rs @@ -1,4 +1,5 @@ use crate::{container::Container, prelude::*}; +use azure_core::Method; use azure_core::{ error::{ErrorKind, ResultExt}, headers::{self, Headers}, @@ -6,7 +7,6 @@ use azure_core::{ RequestId, }; use chrono::{DateTime, FixedOffset}; -use http::method::Method; use std::convert::{TryFrom, TryInto}; #[derive(Debug, Clone)] diff --git a/sdk/storage_blobs/src/container/operations/list_blobs.rs b/sdk/storage_blobs/src/container/operations/list_blobs.rs index ef73476abd..da3706ca3b 100644 --- a/sdk/storage_blobs/src/container/operations/list_blobs.rs +++ b/sdk/storage_blobs/src/container/operations/list_blobs.rs @@ -1,4 +1,5 @@ use crate::{blob::Blob, prelude::*}; +use azure_core::Method; use azure_core::{ collect_pinned_stream, error::{Error, ErrorKind, ResultExt}, @@ -8,7 +9,6 @@ use azure_core::{ }; use azure_storage::xml::read_xml; use chrono::{DateTime, Utc}; -use http::method::Method; #[derive(Debug, Clone)] pub struct ListBlobsBuilder { diff --git a/sdk/storage_blobs/src/container/operations/list_containers.rs b/sdk/storage_blobs/src/container/operations/list_containers.rs index 79b4e79a59..2023183869 100644 --- a/sdk/storage_blobs/src/container/operations/list_containers.rs +++ b/sdk/storage_blobs/src/container/operations/list_containers.rs @@ -3,10 +3,9 @@ use crate::container::Container; use azure_core::{ error::{Error, ErrorKind, ResultExt}, prelude::*, - Pageable, Response, + Method, Pageable, Response, }; use azure_storage::parsing_xml::{cast_optional, traverse}; -use http::method::Method; use xml::Element; #[derive(Debug, Clone)] diff --git a/sdk/storage_blobs/src/container/operations/release_lease.rs b/sdk/storage_blobs/src/container/operations/release_lease.rs index 2c5a798c3c..b705c77d90 100644 --- a/sdk/storage_blobs/src/container/operations/release_lease.rs +++ b/sdk/storage_blobs/src/container/operations/release_lease.rs @@ -1,11 +1,11 @@ use crate::prelude::*; +use azure_core::Method; use azure_core::{ headers::{LEASE_ACTION, *}, prelude::*, RequestId, }; use chrono::{DateTime, Utc}; -use http::method::Method; #[derive(Debug, Clone)] pub struct ReleaseLeaseBuilder { diff --git a/sdk/storage_blobs/src/container/operations/renew_lease.rs b/sdk/storage_blobs/src/container/operations/renew_lease.rs index 626060d986..43284d6db5 100644 --- a/sdk/storage_blobs/src/container/operations/renew_lease.rs +++ b/sdk/storage_blobs/src/container/operations/renew_lease.rs @@ -1,6 +1,6 @@ use crate::{container::operations::AcquireLeaseResponse, prelude::*}; +use azure_core::Method; use azure_core::{headers::LEASE_ACTION, prelude::*}; -use http::method::Method; pub type RenewLeaseResponse = AcquireLeaseResponse; diff --git a/sdk/storage_blobs/src/container/operations/set_acl.rs b/sdk/storage_blobs/src/container/operations/set_acl.rs index ad51b6e0f8..2a98a7afc1 100644 --- a/sdk/storage_blobs/src/container/operations/set_acl.rs +++ b/sdk/storage_blobs/src/container/operations/set_acl.rs @@ -1,8 +1,8 @@ use crate::{container::public_access_from_header, prelude::*}; +use azure_core::Method; use azure_core::{headers::AsHeaders, prelude::*}; use azure_storage::core::StoredAccessPolicyList; use bytes::Bytes; -use http::method::Method; #[derive(Debug, Clone)] pub struct SetACLBuilder { diff --git a/sdk/storage_datalake/Cargo.toml b/sdk/storage_datalake/Cargo.toml index c689676d40..3e37629ffb 100644 --- a/sdk/storage_datalake/Cargo.toml +++ b/sdk/storage_datalake/Cargo.toml @@ -20,7 +20,6 @@ base64 = "0.13" bytes = "1.0" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -http = "0.2" log = "0.4" serde = { version = "1.0" } serde_derive = "1.0" diff --git a/sdk/storage_datalake/src/authorization_policies/shared_key.rs b/sdk/storage_datalake/src/authorization_policies/shared_key.rs index d3e59336f0..a84abeac09 100644 --- a/sdk/storage_datalake/src/authorization_policies/shared_key.rs +++ b/sdk/storage_datalake/src/authorization_policies/shared_key.rs @@ -1,7 +1,7 @@ use azure_core::headers::{self, HeaderName, HeaderValue, Headers}; +use azure_core::Method; use azure_core::{Context, Policy, PolicyResult, Request}; use azure_storage::{core::storage_shared_key_credential::StorageSharedKeyCredential, hmac::sign}; -use http::Method; use std::sync::Arc; #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/sdk/storage_datalake/src/clients/data_lake_client.rs b/sdk/storage_datalake/src/clients/data_lake_client.rs index 020cb48d50..a44afcab36 100644 --- a/sdk/storage_datalake/src/clients/data_lake_client.rs +++ b/sdk/storage_datalake/src/clients/data_lake_client.rs @@ -113,7 +113,7 @@ impl DataLakeClient { // pub(crate) fn prepare_request( // &self, // url: Url, - // http_method: http::Method, + // http_method: azure_core::Method, // ) -> azure_core::Request { // Request::new() // Builder::new() diff --git a/sdk/storage_datalake/src/clients/file_system_client.rs b/sdk/storage_datalake/src/clients/file_system_client.rs index 0cb707010f..c095755be3 100644 --- a/sdk/storage_datalake/src/clients/file_system_client.rs +++ b/sdk/storage_datalake/src/clients/file_system_client.rs @@ -91,7 +91,7 @@ impl FileSystemClient { // pub(crate) fn prepare_request( // &self, // uri: &str, - // http_method: http::Method, + // http_method: azure_core::Method, // ) -> azure_core::Request { // self.data_lake_client.prepare_request(uri, http_method) // } diff --git a/sdk/storage_datalake/src/operations/file_system_create.rs b/sdk/storage_datalake/src/operations/file_system_create.rs index 0f2bc78ba3..0bf51ae9cf 100644 --- a/sdk/storage_datalake/src/operations/file_system_create.rs +++ b/sdk/storage_datalake/src/operations/file_system_create.rs @@ -48,7 +48,7 @@ impl CreateFileSystemBuilder { url.query_pairs_mut().append_pair("resource", "filesystem"); self.timeout.append_to_url_query(&mut url); - let mut request = Request::new(url, http::Method::PUT); + let mut request = Request::new(url, azure_core::Method::PUT); request.insert_headers(&this.client_request_id); request.insert_headers(&this.properties); diff --git a/sdk/storage_datalake/src/operations/file_system_delete.rs b/sdk/storage_datalake/src/operations/file_system_delete.rs index 35792421cc..b3b98c170c 100644 --- a/sdk/storage_datalake/src/operations/file_system_delete.rs +++ b/sdk/storage_datalake/src/operations/file_system_delete.rs @@ -41,7 +41,7 @@ impl DeleteFileSystemBuilder { self.timeout.append_to_url_query(&mut url); url.query_pairs_mut().append_pair("resource", "filesystem"); - let mut request = Request::new(url, http::Method::DELETE); + let mut request = Request::new(url, azure_core::Method::DELETE); request.insert_headers(&this.client_request_id); request.insert_headers(&this.if_modified_since_condition); diff --git a/sdk/storage_datalake/src/operations/file_system_get_properties.rs b/sdk/storage_datalake/src/operations/file_system_get_properties.rs index a32cb81946..ac47639b88 100644 --- a/sdk/storage_datalake/src/operations/file_system_get_properties.rs +++ b/sdk/storage_datalake/src/operations/file_system_get_properties.rs @@ -45,7 +45,7 @@ impl GetFileSystemPropertiesBuilder { self.timeout.append_to_url_query(&mut url); url.query_pairs_mut().append_pair("resource", "filesystem"); - let mut request = Request::new(url, http::Method::HEAD); + let mut request = Request::new(url, azure_core::Method::HEAD); request.insert_headers(&this.client_request_id); request.insert_headers(&ContentLength::new(0)); diff --git a/sdk/storage_datalake/src/operations/file_system_set_properties.rs b/sdk/storage_datalake/src/operations/file_system_set_properties.rs index 5d14c87a0c..c313df0a59 100644 --- a/sdk/storage_datalake/src/operations/file_system_set_properties.rs +++ b/sdk/storage_datalake/src/operations/file_system_set_properties.rs @@ -49,7 +49,7 @@ impl SetFileSystemPropertiesBuilder { self.timeout.append_to_url_query(&mut url); url.query_pairs_mut().append_pair("resource", "filesystem"); - let mut request = Request::new(url, http::Method::PATCH); + let mut request = Request::new(url, azure_core::Method::PATCH); request.insert_headers(&this.client_request_id); request.insert_headers(&this.if_modified_since_condition); diff --git a/sdk/storage_datalake/src/operations/file_systems_list.rs b/sdk/storage_datalake/src/operations/file_systems_list.rs index beb0663aec..d946a677d6 100644 --- a/sdk/storage_datalake/src/operations/file_systems_list.rs +++ b/sdk/storage_datalake/src/operations/file_systems_list.rs @@ -65,7 +65,7 @@ impl ListFileSystemsBuilder { this.next_marker.append_to_url_query(&mut url); }; - let mut request = Request::new(url, http::Method::GET); + let mut request = Request::new(url, azure_core::Method::GET); request.insert_headers(&this.client_request_id); diff --git a/sdk/storage_datalake/src/operations/path_delete.rs b/sdk/storage_datalake/src/operations/path_delete.rs index e4b7217257..77a346918f 100644 --- a/sdk/storage_datalake/src/operations/path_delete.rs +++ b/sdk/storage_datalake/src/operations/path_delete.rs @@ -60,7 +60,7 @@ impl DeletePathBuilder { self.recursive.append_to_url_query(&mut url); self.timeout.append_to_url_query(&mut url); - let mut request = Request::new(url, http::Method::DELETE); + let mut request = Request::new(url, azure_core::Method::DELETE); request.insert_headers(&this.client_request_id); request.insert_headers(&this.if_match_condition); diff --git a/sdk/storage_datalake/src/operations/path_get.rs b/sdk/storage_datalake/src/operations/path_get.rs index 0458c77bbe..35b9671d4a 100644 --- a/sdk/storage_datalake/src/operations/path_get.rs +++ b/sdk/storage_datalake/src/operations/path_get.rs @@ -55,7 +55,7 @@ impl GetFileBuilder { self.timeout.append_to_url_query(&mut url); - let mut request = Request::new(url, http::Method::GET); + let mut request = Request::new(url, azure_core::Method::GET); let requested_range = self.range.unwrap_or_else(|| Range::new(0, u64::MAX)); request.insert_headers(&requested_range); diff --git a/sdk/storage_datalake/src/operations/path_head.rs b/sdk/storage_datalake/src/operations/path_head.rs index ccd9240223..b8aff8a57c 100644 --- a/sdk/storage_datalake/src/operations/path_head.rs +++ b/sdk/storage_datalake/src/operations/path_head.rs @@ -62,7 +62,7 @@ impl HeadPathBuilder { self.upn.append_to_url_query(&mut url); self.timeout.append_to_url_query(&mut url); - let mut request = Request::new(url, http::Method::HEAD); + let mut request = Request::new(url, azure_core::Method::HEAD); request.insert_headers(&this.client_request_id); request.insert_headers(&this.if_match_condition); diff --git a/sdk/storage_datalake/src/operations/path_list.rs b/sdk/storage_datalake/src/operations/path_list.rs index c265f2dccc..02c5aec671 100644 --- a/sdk/storage_datalake/src/operations/path_list.rs +++ b/sdk/storage_datalake/src/operations/path_list.rs @@ -72,7 +72,7 @@ impl ListPathsBuilder { this.continuation.append_to_url_query(&mut url); }; - let mut request = Request::new(url, http::Method::GET); + let mut request = Request::new(url, azure_core::Method::GET); request.insert_headers(&this.client_request_id); diff --git a/sdk/storage_datalake/src/operations/path_patch.rs b/sdk/storage_datalake/src/operations/path_patch.rs index 0408ba3649..fb86bb6781 100644 --- a/sdk/storage_datalake/src/operations/path_patch.rs +++ b/sdk/storage_datalake/src/operations/path_patch.rs @@ -84,7 +84,7 @@ impl PatchPathBuilder { self.retain_uncommitted_data.append_to_url_query(&mut url); self.timeout.append_to_url_query(&mut url); - let mut request = Request::new(url, http::Method::PATCH); + let mut request = Request::new(url, azure_core::Method::PATCH); request.insert_headers(&this.client_request_id); request.insert_headers(&this.properties); diff --git a/sdk/storage_datalake/src/operations/path_put.rs b/sdk/storage_datalake/src/operations/path_put.rs index 22bfd205e3..22bfd89464 100644 --- a/sdk/storage_datalake/src/operations/path_put.rs +++ b/sdk/storage_datalake/src/operations/path_put.rs @@ -72,7 +72,7 @@ impl PutPathBuilder { self.mode.append_to_url_query(&mut url); self.timeout.append_to_url_query(&mut url); - let mut request = Request::new(url, http::Method::PUT); + let mut request = Request::new(url, azure_core::Method::PUT); request.insert_headers(&this.client_request_id); request.insert_headers(&this.properties); @@ -149,7 +149,7 @@ impl RenamePathBuilder { self.mode.append_to_url_query(&mut url); self.timeout.append_to_url_query(&mut url); - let mut request = Request::new(url, http::Method::PUT); + let mut request = Request::new(url, azure_core::Method::PUT); request.insert_headers(&this.client_request_id); request.insert_headers(&this.properties); diff --git a/sdk/storage_queues/Cargo.toml b/sdk/storage_queues/Cargo.toml index 249013081f..88dd29467c 100644 --- a/sdk/storage_queues/Cargo.toml +++ b/sdk/storage_queues/Cargo.toml @@ -18,7 +18,6 @@ azure_storage = { path = "../storage", version = "0.4", default-features=false, bytes = "1.0" chrono = { version = "0.4", features = ["serde"] } futures = "0.3" -http = "0.2" log = "0.4" serde = { version = "1.0" } serde_derive = "1.0" diff --git a/sdk/storage_queues/src/operations/clear_messages.rs b/sdk/storage_queues/src/operations/clear_messages.rs index 0df4aa2131..61cae9b94e 100644 --- a/sdk/storage_queues/src/operations/clear_messages.rs +++ b/sdk/storage_queues/src/operations/clear_messages.rs @@ -1,5 +1,5 @@ use crate::clients::QueueClient; -use azure_core::{error::Error, prelude::*, Response as AzureResponse}; +use azure_core::{error::Error, prelude::*, Method, Response as AzureResponse}; use azure_storage::core::headers::CommonStorageResponseHeaders; use std::convert::TryInto; @@ -31,7 +31,7 @@ impl ClearMessagesBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::DELETE, + Method::DELETE, None, )?; diff --git a/sdk/storage_queues/src/operations/create_queue.rs b/sdk/storage_queues/src/operations/create_queue.rs index 5eab1b3ee4..2e4a5d7d66 100644 --- a/sdk/storage_queues/src/operations/create_queue.rs +++ b/sdk/storage_queues/src/operations/create_queue.rs @@ -1,5 +1,5 @@ use crate::clients::QueueClient; -use azure_core::{error::Error, prelude::*, Response as AzureResponse}; +use azure_core::{error::Error, prelude::*, Method, Response as AzureResponse}; use azure_storage::core::headers::CommonStorageResponseHeaders; use std::convert::TryInto; @@ -34,7 +34,7 @@ impl CreateQueueBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::PUT, + Method::PUT, None, )?; diff --git a/sdk/storage_queues/src/operations/delete_message.rs b/sdk/storage_queues/src/operations/delete_message.rs index 7a39aed811..7a71c47381 100644 --- a/sdk/storage_queues/src/operations/delete_message.rs +++ b/sdk/storage_queues/src/operations/delete_message.rs @@ -1,5 +1,5 @@ use crate::clients::PopReceiptClient; -use azure_core::{error::Error, prelude::*, Context, Response as AzureResponse}; +use azure_core::{error::Error, prelude::*, Context, Method, Response as AzureResponse}; use azure_storage::core::headers::CommonStorageResponseHeaders; use std::convert::TryInto; @@ -31,7 +31,7 @@ impl DeleteMessageBuilder { let mut request = self.pop_receipt_client.storage_client().prepare_request( url.as_str(), - http::method::Method::DELETE, + Method::DELETE, None, )?; diff --git a/sdk/storage_queues/src/operations/delete_queue.rs b/sdk/storage_queues/src/operations/delete_queue.rs index 26c45b29fa..72585dc615 100644 --- a/sdk/storage_queues/src/operations/delete_queue.rs +++ b/sdk/storage_queues/src/operations/delete_queue.rs @@ -1,5 +1,5 @@ use crate::clients::QueueClient; -use azure_core::{error::Error, prelude::*, Context, Response as AzureResponse}; +use azure_core::{error::Error, prelude::*, Context, Method, Response as AzureResponse}; use azure_storage::core::headers::CommonStorageResponseHeaders; use std::convert::TryInto; @@ -31,7 +31,7 @@ impl DeleteQueueBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::DELETE, + Method::DELETE, None, )?; diff --git a/sdk/storage_queues/src/operations/get_messages.rs b/sdk/storage_queues/src/operations/get_messages.rs index 54c725b77a..046138b5db 100644 --- a/sdk/storage_queues/src/operations/get_messages.rs +++ b/sdk/storage_queues/src/operations/get_messages.rs @@ -4,7 +4,7 @@ use azure_core::{ error::{ErrorKind, ResultExt}, headers::utc_date_from_rfc2822, prelude::*, - Context, Response as AzureResponse, + Context, Method, Response as AzureResponse, }; use azure_storage::core::{headers::CommonStorageResponseHeaders, xml::read_xml}; use chrono::{DateTime, Utc}; @@ -47,7 +47,7 @@ impl GetMessagesBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::GET, + Method::GET, None, )?; diff --git a/sdk/storage_queues/src/operations/get_queue_acl.rs b/sdk/storage_queues/src/operations/get_queue_acl.rs index 114abeb6f0..32068d03ce 100644 --- a/sdk/storage_queues/src/operations/get_queue_acl.rs +++ b/sdk/storage_queues/src/operations/get_queue_acl.rs @@ -3,10 +3,9 @@ use azure_core::{ collect_pinned_stream, error::{ErrorKind, ResultExt}, prelude::*, - Context, Response as AzureResponse, + Context, Method, Response as AzureResponse, }; use azure_storage::{core::headers::CommonStorageResponseHeaders, StoredAccessPolicyList}; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/storage_queues/src/operations/get_queue_metadata.rs b/sdk/storage_queues/src/operations/get_queue_metadata.rs index 95632a313a..473e1214cd 100644 --- a/sdk/storage_queues/src/operations/get_queue_metadata.rs +++ b/sdk/storage_queues/src/operations/get_queue_metadata.rs @@ -1,7 +1,6 @@ use crate::clients::QueueClient; -use azure_core::{error::Error, prelude::*, Context, Response as AzureResponse}; +use azure_core::{error::Error, prelude::*, Context, Method, Response as AzureResponse}; use azure_storage::core::headers::CommonStorageResponseHeaders; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/storage_queues/src/operations/get_queue_service_properties.rs b/sdk/storage_queues/src/operations/get_queue_service_properties.rs index d06cae8371..682b295b4b 100644 --- a/sdk/storage_queues/src/operations/get_queue_service_properties.rs +++ b/sdk/storage_queues/src/operations/get_queue_service_properties.rs @@ -3,10 +3,9 @@ use azure_core::{ collect_pinned_stream, error::{ErrorKind, ResultExt}, prelude::*, - Context, Response as AzureResponse, + Context, Method, Response as AzureResponse, }; use azure_storage::core::{headers::CommonStorageResponseHeaders, xml::read_xml}; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/storage_queues/src/operations/get_queue_service_stats.rs b/sdk/storage_queues/src/operations/get_queue_service_stats.rs index ee3f386ca6..cfd87a4b00 100644 --- a/sdk/storage_queues/src/operations/get_queue_service_stats.rs +++ b/sdk/storage_queues/src/operations/get_queue_service_stats.rs @@ -3,11 +3,10 @@ use azure_core::{ collect_pinned_stream, error::{ErrorKind, ResultExt}, prelude::*, - Response as AzureResponse, + Method, Response as AzureResponse, }; use azure_storage::core::{headers::CommonStorageResponseHeaders, xml::read_xml}; use chrono::{DateTime, Utc}; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/storage_queues/src/operations/list_queues.rs b/sdk/storage_queues/src/operations/list_queues.rs index ca9da301e4..950ded297a 100644 --- a/sdk/storage_queues/src/operations/list_queues.rs +++ b/sdk/storage_queues/src/operations/list_queues.rs @@ -3,10 +3,9 @@ use azure_core::{ collect_pinned_stream, error::{Error, ErrorKind, ResultExt}, prelude::*, - Context, Pageable, Response as AzureResponse, + Context, Method, Pageable, Response as AzureResponse, }; use azure_storage::{core::headers::CommonStorageResponseHeaders, xml::read_xml}; -use http::method::Method; use std::convert::TryInto; #[derive(Debug, Clone)] diff --git a/sdk/storage_queues/src/operations/peek_messages.rs b/sdk/storage_queues/src/operations/peek_messages.rs index aca3ffa331..b68c8aca9d 100644 --- a/sdk/storage_queues/src/operations/peek_messages.rs +++ b/sdk/storage_queues/src/operations/peek_messages.rs @@ -4,7 +4,7 @@ use azure_core::{ error::{ErrorKind, ResultExt}, headers::utc_date_from_rfc2822, prelude::*, - Context, Response as AzureResponse, + Context, Method, Response as AzureResponse, }; use azure_storage::core::{headers::CommonStorageResponseHeaders, xml::read_xml}; use chrono::{DateTime, Utc}; @@ -43,7 +43,7 @@ impl PeekMessagesBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::GET, + Method::GET, None, )?; diff --git a/sdk/storage_queues/src/operations/put_message.rs b/sdk/storage_queues/src/operations/put_message.rs index 42683d6d42..c0f6e79f0a 100644 --- a/sdk/storage_queues/src/operations/put_message.rs +++ b/sdk/storage_queues/src/operations/put_message.rs @@ -4,7 +4,7 @@ use azure_core::{ error::{ErrorKind, ResultExt}, headers::utc_date_from_rfc2822, prelude::*, - Context, Response as AzureResponse, + Context, Method, Response as AzureResponse, }; use azure_storage::{core::headers::CommonStorageResponseHeaders, xml::read_xml}; use chrono::{DateTime, Utc}; @@ -56,7 +56,7 @@ impl PutMessageBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::POST, + Method::POST, Some(message.into()), )?; diff --git a/sdk/storage_queues/src/operations/set_queue_acl.rs b/sdk/storage_queues/src/operations/set_queue_acl.rs index dc8d7f4c2f..c8f855f0f6 100644 --- a/sdk/storage_queues/src/operations/set_queue_acl.rs +++ b/sdk/storage_queues/src/operations/set_queue_acl.rs @@ -1,5 +1,5 @@ use crate::{clients::QueueClient, QueueStoredAccessPolicy}; -use azure_core::{error::Error, prelude::*, Response as AzureResponse}; +use azure_core::{error::Error, prelude::*, Method, Response as AzureResponse}; use azure_storage::{core::headers::CommonStorageResponseHeaders, StoredAccessPolicyList}; use std::convert::TryInto; @@ -46,7 +46,7 @@ impl SetQueueACLBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::PUT, + Method::PUT, Some(xml_body.into()), )?; diff --git a/sdk/storage_queues/src/operations/set_queue_metadata.rs b/sdk/storage_queues/src/operations/set_queue_metadata.rs index d6f51a562b..f9e3045e3f 100644 --- a/sdk/storage_queues/src/operations/set_queue_metadata.rs +++ b/sdk/storage_queues/src/operations/set_queue_metadata.rs @@ -1,5 +1,5 @@ use crate::clients::QueueClient; -use azure_core::{error::Error, prelude::*, Context, Response as AzureResponse}; +use azure_core::{error::Error, prelude::*, Context, Method, Response as AzureResponse}; use azure_storage::core::headers::CommonStorageResponseHeaders; use std::convert::TryInto; @@ -34,7 +34,7 @@ impl SetQueueMetadataBuilder { let mut request = self.queue_client.storage_client().prepare_request( url.as_str(), - http::method::Method::PUT, + Method::PUT, None, )?; for m in self.metadata.iter() { diff --git a/sdk/storage_queues/src/operations/set_queue_service_properties.rs b/sdk/storage_queues/src/operations/set_queue_service_properties.rs index 7ec7c1071d..0e985f617a 100644 --- a/sdk/storage_queues/src/operations/set_queue_service_properties.rs +++ b/sdk/storage_queues/src/operations/set_queue_service_properties.rs @@ -2,7 +2,7 @@ use crate::{QueueServiceClient, QueueServiceProperties}; use azure_core::{ error::{Error, ErrorKind, ResultExt}, prelude::*, - Context, Response as AzureResponse, + Context, Method, Response as AzureResponse, }; use azure_storage::core::headers::CommonStorageResponseHeaders; use std::convert::TryInto; @@ -50,7 +50,7 @@ impl SetQueueServicePropertiesBuilder { let mut request = self.service_client.storage_client.prepare_request( url.as_str(), - http::method::Method::PUT, + Method::PUT, Some(xml_body.into()), )?; diff --git a/sdk/storage_queues/src/operations/update_message.rs b/sdk/storage_queues/src/operations/update_message.rs index 123adabc78..748d2eb994 100644 --- a/sdk/storage_queues/src/operations/update_message.rs +++ b/sdk/storage_queues/src/operations/update_message.rs @@ -3,7 +3,7 @@ use azure_core::{ error::Error, headers::{rfc2822_from_headers_mandatory, HeaderName}, prelude::*, - Context, Response as AzureResponse, + Context, Method, Response as AzureResponse, }; use azure_storage::core::headers::CommonStorageResponseHeaders; use chrono::{DateTime, Utc}; @@ -54,7 +54,7 @@ impl UpdateMessageBuilder { let mut request = self.pop_receipt_client.storage_client().prepare_request( url.as_str(), - http::method::Method::PUT, + Method::PUT, Some(message.into()), )?;