Skip to content

Commit 7226ec0

Browse files
committed
GetPermission::into_future
1 parent bb52874 commit 7226ec0

16 files changed

+83
-51
lines changed

sdk/data_cosmos/examples/permission_00.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,11 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
101101
);
102102

103103
let get_permission_response = permission_client
104-
.get_permission(
105-
Context::new(),
106-
GetPermissionOptions::new().consistency_level(ConsistencyLevel::Session(
107-
list_permissions_response.session_token,
108-
)),
109-
)
104+
.get_permission()
105+
.consistency_level(ConsistencyLevel::Session(
106+
list_permissions_response.session_token,
107+
))
108+
.into_future()
110109
.await
111110
.unwrap();
112111
println!("get_permission_response == {:#?}", get_permission_response);

sdk/data_cosmos/src/clients/permission_client.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,8 @@ impl PermissionClient {
6868
}
6969

7070
/// Get the permission
71-
pub async fn get_permission(
72-
&self,
73-
ctx: Context,
74-
options: GetPermissionOptions,
75-
) -> crate::Result<PermissionResponse> {
76-
let mut request = self.prepare_request_with_permission_name(http::Method::GET);
77-
78-
options.decorate_request(&mut request)?;
79-
80-
let response = self
81-
.pipeline()
82-
.send(ctx.clone().insert(ResourceType::Permissions), &mut request)
83-
.await?;
84-
85-
Ok(PermissionResponse::try_from(response).await?)
71+
pub fn get_permission(&self) -> GetPermissionBuilder {
72+
GetPermissionBuilder::new(self.clone())
8673
}
8774

8875
/// Delete the permission

sdk/data_cosmos/src/operations/create_collection.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ impl std::future::IntoFuture for CreateCollectionBuilder {
8080
}
8181
}
8282

83-
type CreateCollection =
83+
/// The future returned by calling `into_future` on the builder.
84+
pub type CreateCollection =
8485
futures::future::BoxFuture<'static, crate::Result<CreateCollectionResponse>>;
8586

8687
/// Body for the create collection request

sdk/data_cosmos/src/operations/create_database.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ impl std::future::IntoFuture for CreateDatabaseBuilder {
7373
}
7474
}
7575

76-
type CreateDatabase =
76+
/// The future returned by calling `into_future` on the builder.
77+
pub type CreateDatabase =
7778
futures::future::BoxFuture<'static, azure_core::error::Result<CreateDatabaseResponse>>;
7879

7980
#[derive(Serialize)]

sdk/data_cosmos/src/operations/create_document.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ impl<D: Serialize + CosmosEntity + Send + 'static> CreateDocumentBuilder<D> {
9393
}
9494
}
9595

96-
type CreateDocument = futures::future::BoxFuture<'static, crate::Result<CreateDocumentResponse>>;
96+
/// The future returned by calling `into_future` on the builder.
97+
pub type CreateDocument =
98+
futures::future::BoxFuture<'static, crate::Result<CreateDocumentResponse>>;
9799

98100
#[cfg(feature = "into_future")]
99101
impl<D: Serialize + CosmosEntity + Send + 'static> std::future::IntoFuture

sdk/data_cosmos/src/operations/create_permission.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ impl CreatePermissionBuilder {
7272
}
7373
}
7474

75-
type CreatePermission = futures::future::BoxFuture<'static, crate::Result<PermissionResponse>>;
75+
/// The future returned by calling `into_future` on the builder.
76+
pub type CreatePermission = futures::future::BoxFuture<'static, crate::Result<PermissionResponse>>;
7677

7778
#[cfg(feature = "into_future")]
7879
impl std::future::IntoFuture for CreatePermissionBuilder {

sdk/data_cosmos/src/operations/create_user.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ impl CreateUserBuilder {
5151
}
5252
}
5353

54-
type CreateUser = futures::future::BoxFuture<'static, crate::Result<UserResponse>>;
54+
/// The future returned by calling `into_future` on the builder.
55+
pub type CreateUser = futures::future::BoxFuture<'static, crate::Result<UserResponse>>;
5556

5657
#[cfg(feature = "into_future")]
5758
impl std::future::IntoFuture for CreateUserBuilder {

sdk/data_cosmos/src/operations/delete_collection.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ impl DeleteCollectionBuilder {
4747
}
4848
}
4949

50-
type DeleteCollection =
50+
/// The future returned by calling `into_future` on the builder.
51+
pub type DeleteCollection =
5152
futures::future::BoxFuture<'static, crate::Result<DeleteCollectionResponse>>;
5253

5354
#[cfg(feature = "into_future")]

sdk/data_cosmos/src/operations/delete_database.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ impl DeleteDatabaseBuilder {
4848
}
4949
}
5050

51-
type DeleteDatabase = futures::future::BoxFuture<'static, crate::Result<DeleteDatabaseResponse>>;
51+
/// The future returned by calling `into_future` on the builder.
52+
pub type DeleteDatabase =
53+
futures::future::BoxFuture<'static, crate::Result<DeleteDatabaseResponse>>;
5254

5355
#[cfg(feature = "into_future")]
5456
impl std::future::IntoFuture for DeleteDatabaseBuilder {

sdk/data_cosmos/src/operations/delete_document.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ impl DeleteDocumentBuilder {
6767
}
6868
}
6969

70-
type DeleteDocument = futures::future::BoxFuture<'static, crate::Result<DeleteDocumentResponse>>;
70+
/// The future returned by calling `into_future` on the builder.
71+
pub type DeleteDocument =
72+
futures::future::BoxFuture<'static, crate::Result<DeleteDocumentResponse>>;
7173

7274
#[cfg(feature = "into_future")]
7375
impl std::future::IntoFuture for DeleteDocumentBuilder {

0 commit comments

Comments
 (0)