-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pipeline to storage_account_client #811
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3ee7c65
Add pipeline to storage_account_client
rylev 5e75e9c
Add Authorization policy
rylev 14e13c9
Update tests
rylev 87dccdc
Fix clippy warnings
rylev f9f6946
Switch to url crate
rylev 3ed2196
PR feedback
rylev 002a635
Fix mock tests
rylev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod operations; | ||
pub mod requests; | ||
pub mod responses; | ||
|
||
|
87 changes: 87 additions & 0 deletions
87
sdk/storage/src/account/operations/get_account_information.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
use crate::core::prelude::*; | ||
use azure_core::error::Result; | ||
use azure_core::headers::{ | ||
account_kind_from_headers, date_from_headers, request_id_from_headers, sku_name_from_headers, | ||
}; | ||
|
||
use azure_core::{Context, RequestId}; | ||
use chrono::{DateTime, Utc}; | ||
use http::HeaderMap; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct GetAccountInformationBuilder { | ||
storage_client: StorageClient, | ||
context: Context, | ||
} | ||
|
||
impl GetAccountInformationBuilder { | ||
pub(crate) fn new(storage_client: StorageClient) -> Self { | ||
Self { | ||
storage_client, | ||
context: Context::new(), | ||
} | ||
} | ||
|
||
setters! { | ||
context: Context => context, | ||
} | ||
|
||
pub fn into_future(mut self) -> GetAccountInformation { | ||
Box::pin(async move { | ||
let mut request = self | ||
.storage_client | ||
.storage_account_client() | ||
.blob_storage_request("", http::Method::GET); | ||
|
||
for (k, v) in [("restype", "account"), ("comp", "properties")].iter() { | ||
request.url_mut().query_pairs_mut().append_pair(k, v); | ||
} | ||
|
||
let response = self | ||
.storage_client | ||
.storage_account_client() | ||
.pipeline() | ||
.send(&mut self.context, &mut request) | ||
.await?; | ||
|
||
GetAccountInformationResponse::try_from(response.headers()) | ||
}) | ||
} | ||
} | ||
|
||
/// The future returned by calling `into_future` on the builder. | ||
pub type GetAccountInformation = | ||
futures::future::BoxFuture<'static, azure_core::error::Result<GetAccountInformationResponse>>; | ||
|
||
#[cfg(feature = "into_future")] | ||
impl std::future::IntoFuture for GetAccountInformationBuilder { | ||
type IntoFuture = GetAccountInformation; | ||
type Output = <GetAccountInformation as std::future::Future>::Output; | ||
fn into_future(self) -> Self::IntoFuture { | ||
Self::into_future(self) | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct GetAccountInformationResponse { | ||
pub request_id: RequestId, | ||
pub date: DateTime<Utc>, | ||
pub sku_name: String, | ||
pub account_kind: String, | ||
} | ||
|
||
impl GetAccountInformationResponse { | ||
pub(crate) fn try_from(headers: &HeaderMap) -> Result<GetAccountInformationResponse> { | ||
let request_id = request_id_from_headers(headers)?; | ||
let date = date_from_headers(headers)?; | ||
let sku_name = sku_name_from_headers(headers)?; | ||
let account_kind = account_kind_from_headers(headers)?; | ||
|
||
Ok(GetAccountInformationResponse { | ||
request_id, | ||
date, | ||
sku_name, | ||
account_kind, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod get_account_information; | ||
|
||
pub use get_account_information::*; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #809