Skip to content

Commit 94ab068

Browse files
authored
drop as_ prefix from as_X_client from storage crates (#847)
1 parent 8586a66 commit 94ab068

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+221
-221
lines changed

sdk/data_tables/examples/table_00.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ async fn main() -> azure_core::Result<()> {
3030
StorageAccountClient::new_access_key(http_client.clone(), &account, &access_key);
3131

3232
let table_service = storage_account_client
33-
.as_storage_client()
34-
.as_table_service_client()?;
33+
.storage_client()
34+
.table_service_client()?;
3535

36-
let table_client = table_service.as_table_client(table_name);
36+
let table_client = table_service.table_client(table_name);
3737
let response = table_client.create().execute().await?;
3838
println!("response = {:?}\n", response);
3939

@@ -43,7 +43,7 @@ async fn main() -> azure_core::Result<()> {
4343
surname: "Cogno".to_owned(),
4444
};
4545

46-
let partition_key_client = table_client.as_partition_key_client(&entity.city);
46+
let partition_key_client = table_client.partition_key_client(&entity.city);
4747

4848
let mut transaction = Transaction::default();
4949

@@ -56,7 +56,7 @@ async fn main() -> azure_core::Result<()> {
5656
transaction.add(table_client.insert().to_transaction_operation(&entity)?);
5757

5858
entity.surname = "Potter".to_owned();
59-
let entity_client = partition_key_client.as_entity_client(&entity.surname)?;
59+
let entity_client = partition_key_client.entity_client(&entity.surname)?;
6060
transaction.add(
6161
entity_client
6262
.insert_or_replace()
@@ -94,8 +94,8 @@ async fn main() -> azure_core::Result<()> {
9494
println!("response = {:?}\n", response);
9595

9696
let entity_client = table_client
97-
.as_partition_key_client(&entity.city)
98-
.as_entity_client(&entity.surname)?;
97+
.partition_key_client(&entity.city)
98+
.entity_client(&entity.surname)?;
9999
// update the name passing the Etag received from the previous call.
100100
entity.name = "Ryan".to_owned();
101101
let response = entity_client

sdk/data_tables/src/clients/entity_client.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ use std::sync::Arc;
99
use url::Url;
1010

1111
pub trait AsEntityClient<RK: Into<String>> {
12-
fn as_entity_client(&self, row_key: RK) -> azure_core::Result<Arc<EntityClient>>;
12+
fn entity_client(&self, row_key: RK) -> azure_core::Result<Arc<EntityClient>>;
1313
}
1414

1515
impl<RK: Into<String>> AsEntityClient<RK> for Arc<PartitionKeyClient> {
16-
fn as_entity_client(&self, row_key: RK) -> azure_core::Result<Arc<EntityClient>> {
16+
fn entity_client(&self, row_key: RK) -> azure_core::Result<Arc<EntityClient>> {
1717
EntityClient::new(self.clone(), row_key)
1818
}
1919
}
@@ -137,17 +137,17 @@ mod integration_tests {
137137
}
138138

139139
fn get_emulator_client() -> Arc<TableServiceClient> {
140-
let storage_account = StorageAccountClient::new_emulator_default().as_storage_client();
140+
let storage_account = StorageAccountClient::new_emulator_default().storage_client();
141141
storage_account
142-
.as_table_service_client()
142+
.table_service_client()
143143
.expect("a table service client")
144144
}
145145

146146
#[tokio::test]
147147
async fn test_update() {
148148
let table_client = get_emulator_client();
149149

150-
let table = table_client.as_table_client("EntityClientUpdate");
150+
let table = table_client.table_client("EntityClientUpdate");
151151

152152
println!("Delete the table (if it exists)");
153153
match table.delete().execute().await {
@@ -168,8 +168,8 @@ mod integration_tests {
168168
};
169169

170170
let entity_client = table
171-
.as_partition_key_client(&entity.city)
172-
.as_entity_client(&entity.surname)
171+
.partition_key_client(&entity.city)
172+
.entity_client(&entity.surname)
173173
.expect("an entity client");
174174

175175
entity_client
@@ -199,7 +199,7 @@ mod integration_tests {
199199
async fn test_merge() {
200200
let table_client = get_emulator_client();
201201

202-
let table = table_client.as_table_client("EntityClientMerge");
202+
let table = table_client.table_client("EntityClientMerge");
203203

204204
println!("Delete the table (if it exists)");
205205
match table.delete().execute().await {
@@ -226,8 +226,8 @@ mod integration_tests {
226226
};
227227

228228
let entity_client = table
229-
.as_partition_key_client(&entity.city)
230-
.as_entity_client(&entity.surname)
229+
.partition_key_client(&entity.city)
230+
.entity_client(&entity.surname)
231231
.expect("an entity client");
232232

233233
entity_client
@@ -257,7 +257,7 @@ mod integration_tests {
257257
async fn test_insert_or_replace() {
258258
let table_client = get_emulator_client();
259259

260-
let table = table_client.as_table_client("EntityClientInsertOrReplace");
260+
let table = table_client.table_client("EntityClientInsertOrReplace");
261261

262262
println!("Delete the table (if it exists)");
263263
match table.delete().execute().await {
@@ -278,8 +278,8 @@ mod integration_tests {
278278
};
279279

280280
let entity_client = table
281-
.as_partition_key_client(&entity.city)
282-
.as_entity_client(&entity.surname)
281+
.partition_key_client(&entity.city)
282+
.entity_client(&entity.surname)
283283
.expect("an entity client");
284284
entity_client
285285
.insert_or_replace()
@@ -303,7 +303,7 @@ mod integration_tests {
303303
async fn test_insert_or_merge() {
304304
let table_client = get_emulator_client();
305305

306-
let table = table_client.as_table_client("EntityClientInsertOrMerge");
306+
let table = table_client.table_client("EntityClientInsertOrMerge");
307307

308308
println!("Delete the table (if it exists)");
309309
match table.delete().execute().await {
@@ -324,8 +324,8 @@ mod integration_tests {
324324
};
325325

326326
let entity_client = table
327-
.as_partition_key_client(&entity.city)
328-
.as_entity_client(&entity.surname)
327+
.partition_key_client(&entity.city)
328+
.entity_client(&entity.surname)
329329
.expect("an entity client");
330330
entity_client
331331
.insert_or_merge()

sdk/data_tables/src/clients/partition_key_client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use http::method::Method;
77
use std::sync::Arc;
88

99
pub trait AsPartitionKeyClient<PK: Into<String>> {
10-
fn as_partition_key_client(&self, partition_key: PK) -> Arc<PartitionKeyClient>;
10+
fn partition_key_client(&self, partition_key: PK) -> Arc<PartitionKeyClient>;
1111
}
1212

1313
impl<PK: Into<String>> AsPartitionKeyClient<PK> for Arc<TableClient> {
14-
fn as_partition_key_client(&self, partition_key: PK) -> Arc<PartitionKeyClient> {
14+
fn partition_key_client(&self, partition_key: PK) -> Arc<PartitionKeyClient> {
1515
PartitionKeyClient::new(self.clone(), partition_key)
1616
}
1717
}
@@ -83,17 +83,17 @@ mod integration_tests {
8383
}
8484

8585
fn get_emulator_client() -> Arc<TableServiceClient> {
86-
let storage_account = StorageAccountClient::new_emulator_default().as_storage_client();
86+
let storage_account = StorageAccountClient::new_emulator_default().storage_client();
8787
storage_account
88-
.as_table_service_client()
88+
.table_service_client()
8989
.expect("a table service client")
9090
}
9191

9292
#[ignore = "enable test once transactions are working in Azurite #297"]
9393
#[tokio::test]
9494
async fn test_transaction() {
9595
let table_service = get_emulator_client();
96-
let table = table_service.as_table_client("PartitionKeyClientTransaction");
96+
let table = table_service.table_client("PartitionKeyClientTransaction");
9797

9898
println!("Delete the table (if it exists)");
9999
match table.delete().execute().await {
@@ -107,7 +107,7 @@ mod integration_tests {
107107
.await
108108
.expect("the table should be created");
109109

110-
let partition_client = table.as_partition_key_client("Milan");
110+
let partition_client = table.partition_key_client("Milan");
111111

112112
println!("Create the transaction");
113113
let mut transaction = Transaction::default();

sdk/data_tables/src/clients/table_client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use http::method::Method;
66
use std::sync::Arc;
77

88
pub trait AsTableClient<S: Into<String>> {
9-
fn as_table_client(&self, s: S) -> Arc<TableClient>;
9+
fn table_client(&self, s: S) -> Arc<TableClient>;
1010
}
1111

1212
impl<S: Into<String>> AsTableClient<S> for Arc<TableServiceClient> {
13-
fn as_table_client(&self, s: S) -> Arc<TableClient> {
13+
fn table_client(&self, s: S) -> Arc<TableClient> {
1414
TableClient::new(self.clone(), s)
1515
}
1616
}
@@ -95,16 +95,16 @@ mod integration_tests {
9595
}
9696

9797
fn get_emulator_client() -> Arc<TableServiceClient> {
98-
let storage_account = StorageAccountClient::new_emulator_default().as_storage_client();
98+
let storage_account = StorageAccountClient::new_emulator_default().storage_client();
9999
storage_account
100-
.as_table_service_client()
100+
.table_service_client()
101101
.expect("a table service client")
102102
}
103103

104104
#[tokio::test]
105105
async fn test_create_delete() {
106106
let table_client = get_emulator_client();
107-
let table = table_client.as_table_client("TableClientCreateDelete");
107+
let table = table_client.table_client("TableClientCreateDelete");
108108

109109
assert_eq!(
110110
table.table_name(),
@@ -155,7 +155,7 @@ mod integration_tests {
155155
async fn test_insert() {
156156
let table_client = get_emulator_client();
157157

158-
let table = table_client.as_table_client("TableClientInsert");
158+
let table = table_client.table_client("TableClientInsert");
159159
assert_eq!(
160160
table.table_name(),
161161
"TableClientInsert",

sdk/data_tables/src/clients/table_service_client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use std::sync::Arc;
88
use url::Url;
99

1010
pub trait AsTableServiceClient {
11-
fn as_table_service_client(&self) -> azure_core::Result<Arc<TableServiceClient>>;
11+
fn table_service_client(&self) -> azure_core::Result<Arc<TableServiceClient>>;
1212
}
1313

1414
impl AsTableServiceClient for Arc<StorageClient> {
15-
fn as_table_service_client(&self) -> azure_core::Result<Arc<TableServiceClient>> {
15+
fn table_service_client(&self) -> azure_core::Result<Arc<TableServiceClient>> {
1616
TableServiceClient::new(self.clone())
1717
}
1818
}
@@ -81,18 +81,18 @@ mod integration_tests {
8181
use futures::StreamExt;
8282

8383
fn get_emulator_client() -> Arc<StorageClient> {
84-
StorageAccountClient::new_emulator_default().as_storage_client()
84+
StorageAccountClient::new_emulator_default().storage_client()
8585
}
8686

8787
#[tokio::test]
8888
async fn test_list() {
8989
let storage_account = get_emulator_client();
9090
let table_client = storage_account
91-
.as_table_service_client()
91+
.table_service_client()
9292
.expect("a table service client");
9393

9494
println!("Create a table in the storage account");
95-
let table = table_client.as_table_client("TableServiceClientList");
95+
let table = table_client.table_client("TableServiceClientList");
9696
match table.create().execute().await {
9797
_ => {}
9898
}

sdk/storage/examples/account00.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async fn main() -> azure_core::Result<()> {
1212

1313
let storage_client =
1414
StorageAccountClient::new_access_key(http_client.clone(), &account, &access_key)
15-
.as_storage_client();
15+
.storage_client();
1616

1717
let response = storage_client
1818
.get_account_information()

sdk/storage/src/core/clients/storage_client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ use http::method::Method;
99
use std::sync::Arc;
1010

1111
pub trait AsStorageClient {
12-
fn as_storage_client(&self) -> Arc<StorageClient>;
12+
fn storage_client(&self) -> Arc<StorageClient>;
1313
}
1414

1515
impl AsStorageClient for Arc<StorageAccountClient> {
16-
fn as_storage_client(&self) -> Arc<StorageClient> {
16+
fn storage_client(&self) -> Arc<StorageClient> {
1717
StorageClient::new(self.clone())
1818
}
1919
}

sdk/storage/tests/account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async fn get_account_information() {
1212

1313
let storage_client =
1414
StorageAccountClient::new_access_key(http_client.clone(), &account, &access_key)
15-
.as_storage_client();
15+
.storage_client();
1616

1717
storage_client
1818
.get_account_information()

sdk/storage_blobs/examples/blob_00.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ async fn main() -> azure_core::Result<()> {
2828
// let storage_account_client = StorageAccountClient::new_sas_token(http_client.clone(), &account,
2929
// "sv=2018-11-09&ss=b&srt=o&se=2021-01-15T12%3A09%3A01Z&sp=r&st=2021-01-15T11%3A09%3A01Z&spr=http,https&sig=some_signature")?;
3030

31-
let storage_client = storage_account_client.as_storage_client();
31+
let storage_client = storage_account_client.storage_client();
3232
let blob_client = storage_client
33-
.as_container_client(&container)
34-
.as_blob_client(&blob);
33+
.container_client(&container)
34+
.blob_client(&blob);
3535

3636
trace!("Requesting blob");
3737

sdk/storage_blobs/examples/blob_01.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ async fn main() -> azure_core::Result<()> {
1919
let http_client = azure_core::new_http_client();
2020
let storage_client =
2121
StorageAccountClient::new_access_key(http_client.clone(), &account, &access_key)
22-
.as_storage_client();
23-
let container_client = storage_client.as_container_client(&container_name);
24-
let blob_client = container_client.as_blob_client("SorgeniaReorganizeRebuildIndexes.zip");
22+
.storage_client();
23+
let container_client = storage_client.container_client(&container_name);
24+
let blob_client = container_client.blob_client("SorgeniaReorganizeRebuildIndexes.zip");
2525

2626
// only get the first 8k chunk
2727
let result = Box::pin(blob_client.get().stream(1024 * 8))

0 commit comments

Comments
 (0)