Skip to content

Commit 9483c78

Browse files
committed
clippy and lint fixes
1 parent 94c7c11 commit 9483c78

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

sdk/cosmosdb/azure_data_cosmos/src/authorization_policy.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum Credential {
4343

4444
/// The credential is a key to be used to sign the HTTP request (a shared key)
4545
#[cfg(feature = "key-auth")]
46-
SigningKey(Secret),
46+
PrimaryKey(Secret),
4747
}
4848

4949
#[cfg(feature = "key-auth")]
@@ -86,7 +86,7 @@ impl AuthorizationPolicy {
8686
#[cfg(feature = "key-auth")]
8787
pub(crate) fn from_shared_key(key: Secret) -> Self {
8888
Self {
89-
credential: Credential::SigningKey(key),
89+
credential: Credential::PrimaryKey(key),
9090
}
9191
}
9292
}
@@ -188,16 +188,18 @@ fn generate_resource_link(request: &Request) -> String {
188188
}
189189
}
190190

191-
/// The `CosmosDB` authorization can either be:
192-
/// - "primary": one of the two service-level tokens
193-
/// - "resource": e.g. a single database
194-
/// - "aad": Azure Active Directory token
191+
/// Generates the 'Authorization' header value based on the provided values.
192+
///
193+
/// The specific result format depends on the type of the auth token provided.
194+
/// - "primary": one of the two service-level tokens
195+
/// - "aad": Azure Active Directory token
196+
///
195197
/// In the "primary" case the signature must be constructed by signing the HTTP method,
196198
/// resource type, resource link (the relative URI) and the current time.
197199
///
198-
/// In the "resource" case, the signature is just the resource key.
199-
///
200200
/// In the "aad" case, the signature is the AAD token.
201+
///
202+
/// NOTE: Resource tokens are not yet supported.
201203
async fn generate_authorization<'a>(
202204
auth_token: &Credential,
203205
url: &Url,
@@ -215,7 +217,7 @@ async fn generate_authorization<'a>(
215217
),
216218

217219
#[cfg(feature = "key-auth")]
218-
Credential::SigningKey(key) => {
220+
Credential::PrimaryKey(key) => {
219221
let string_to_sign = string_to_sign(signature_target);
220222
("master", hmac_sha256(&string_to_sign, key)?)
221223
}
@@ -310,7 +312,7 @@ mon, 01 jan 1900 01:00:00 gmt
310312
async fn generate_authorization_00() {
311313
let time = date::parse_rfc3339("1900-01-01T01:00:00.000000000+00:00").unwrap();
312314

313-
let auth_token = Credential::SigningKey(
315+
let auth_token = Credential::PrimaryKey(
314316
"8F8xXXOptJxkblM1DBXW7a6NMI5oE8NnwPGYBmwxLCKfejOK7B7yhcCHMGvN3PBrlMLIOeol1Hv9RCdzAZR5sg==".into(),
315317
)
316318
.unwrap();
@@ -341,7 +343,7 @@ mon, 01 jan 1900 01:00:00 gmt
341343
async fn generate_authorization_01() {
342344
let time = date::parse_rfc3339("2017-04-27T00:51:12.000000000+00:00").unwrap();
343345

344-
let auth_token = Credential::SigningKey(
346+
let auth_token = Credential::PrimaryKey(
345347
"dsZQi3KtZmCv1ljt3VNWNm7sQUF1y5rJfC6kv5JiwvW0EndXdDku/dkKBp8/ufDToSxL".into(),
346348
)
347349
.unwrap();

sdk/cosmosdb/azure_data_cosmos/src/clients/database_client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use azure_core::{Context, Request};
55
use url::Url;
66

77
pub trait DatabaseClientMethods {
8-
async fn read(
8+
fn read(
99
&self,
1010
options: Option<ReadDatabaseOptions>,
11-
) -> azure_core::Result<azure_core::Response<DatabaseProperties>>;
11+
) -> impl std::future::Future<Output = azure_core::Result<azure_core::Response<DatabaseProperties>>>;
1212
}
1313

1414
pub struct DatabaseClient {

0 commit comments

Comments
 (0)