@@ -7,7 +7,7 @@ author: pauljewellmsft
7
7
8
8
ms.service : storage
9
9
ms.topic : how-to
10
- ms.date : 02/03 /2023
10
+ ms.date : 02/08 /2023
11
11
ms.author : pauljewell
12
12
ms.subservice : blobs
13
13
ms.devlang : csharp, java, javascript, python
@@ -70,7 +70,7 @@ The following examples show how to create a `BlobServiceClient` object:
70
70
71
71
## [ .NET] ( #tab/dotnet )
72
72
73
- Add the following using statements :
73
+ Add the following ` using ` directives :
74
74
75
75
``` csharp
76
76
using Azure .Identity ;
@@ -80,10 +80,10 @@ using Azure.Storage.Blobs;
80
80
Add the following code to create the client object:
81
81
82
82
``` csharp
83
- BlobServiceClient GetBlobServiceClient (string accountName )
83
+ public BlobServiceClient GetBlobServiceClient (string accountName )
84
84
{
85
- BlobServiceClient client = new (
86
- new Uri (" https://{accountName}.blob.core.windows.net" ),
85
+ BlobServiceClient client = new (
86
+ new Uri ($ " https://{accountName }.blob.core.windows.net" ),
87
87
new DefaultAzureCredential ());
88
88
89
89
return client ;
@@ -92,7 +92,7 @@ BlobServiceClient GetBlobServiceClient(string accountName)
92
92
93
93
## [ Java] ( #tab/java )
94
94
95
- Add the following import directives:
95
+ Add the following ` import ` directives:
96
96
97
97
``` java
98
98
import com.azure.identity.* ;
@@ -102,7 +102,7 @@ import com.azure.storage.blob.*;
102
102
Add the following code to create the client object:
103
103
104
104
``` java
105
- public static BlobServiceClient GetBlobServiceClient(String accountName) {
105
+ public BlobServiceClient GetBlobServiceClient(String accountName) {
106
106
String endpointString = String . format(" https://%s.blob.core.windows.net" , accountName);
107
107
BlobServiceClient client = new BlobServiceClientBuilder ()
108
108
.endpoint(endpointString)
@@ -115,7 +115,7 @@ public static BlobServiceClient GetBlobServiceClient(String accountName) {
115
115
116
116
## [ JavaScript] ( #tab/javascript )
117
117
118
- Add the following require statements:
118
+ Add the following ` require ` statements:
119
119
120
120
``` javascript
121
121
const { BlobServiceClient } = require (' @azure/storage-blob' );
@@ -135,7 +135,7 @@ const blobServiceClient = new BlobServiceClient(
135
135
136
136
## [ Python] ( #tab/python )
137
137
138
- Add the following import statements:
138
+ Add the following ` import ` statements:
139
139
140
140
``` python
141
141
from azure.identity import DefaultAzureCredential
@@ -166,7 +166,9 @@ The following examples show how to create a container client from a `BlobService
166
166
## [ .NET] ( #tab/dotnet )
167
167
168
168
``` csharp
169
- BlobContainerClient GetBlobContainerClient (BlobServiceClient blobServiceClient , string containerName )
169
+ public BlobContainerClient GetBlobContainerClient (
170
+ BlobServiceClient blobServiceClient ,
171
+ string containerName )
170
172
{
171
173
// Create the container client using the service client object
172
174
BlobContainerClient client = blobServiceClient .GetBlobContainerClient (containerName );
@@ -177,7 +179,9 @@ BlobContainerClient GetBlobContainerClient(BlobServiceClient blobServiceClient,
177
179
## [ Java] ( #tab/java )
178
180
179
181
``` java
180
- public BlobContainerClient getBlobContainerClient(BlobServiceClient blobServiceClient, String containerName) {
182
+ public BlobContainerClient getBlobContainerClient(
183
+ BlobServiceClient blobServiceClient,
184
+ String containerName) {
181
185
// Create the container client using the service client object
182
186
BlobContainerClient client = blobServiceClient. getBlobContainerClient(containerName);
183
187
return client;
@@ -208,11 +212,14 @@ The following examples show how to create a container client directly *without*
208
212
## [ .NET] ( #tab/dotnet )
209
213
210
214
``` csharp
211
- BlobContainerClient GetBlobContainerClient (string containerName , BlobClientOptions clientOptions )
215
+ public BlobContainerClient GetBlobContainerClient (
216
+ string accountName ,
217
+ string containerName ,
218
+ BlobClientOptions clientOptions )
212
219
{
213
- // Append the container name to the URI
220
+ // Append the container name to the end of the URI
214
221
BlobContainerClient client = new (
215
- new Uri (" https://{accountName}.blob.core.windows.net/{containerName}" ),
222
+ new Uri ($ " https://{accountName }.blob.core.windows.net/{containerName }" ),
216
223
new DefaultAzureCredential (),
217
224
clientOptions );
218
225
@@ -223,15 +230,18 @@ BlobContainerClient GetBlobContainerClient(string containerName, BlobClientOptio
223
230
## [ Java] ( #tab/java )
224
231
225
232
``` java
226
- public BlobContainerClient getBlobContainerClient(String accountName, String containerName) {
233
+ public BlobContainerClient getBlobContainerClient(
234
+ String accountName,
235
+ String containerName) {
227
236
// Append the container name to the URI
228
- String endpointString = String . format(" https://%s.blob.core.windows.net/%s" , accountName, containerName);
237
+ String endpointString = String . format(" https://%s.blob.core.windows.net/%s" ,
238
+ accountName, containerName);
229
239
230
240
BlobContainerClient client = new BlobContainerClientBuilder ()
231
241
.endpoint(endpointString)
232
242
.credential(new DefaultAzureCredentialBuilder (). build())
233
243
.buildClient();
234
-
244
+
235
245
return client;
236
246
}
237
247
```
@@ -273,18 +283,24 @@ The following examples show how to create a blob client to interact with a speci
273
283
## [.NET](#tab/dotnet)
274
284
275
285
` ` ` csharp
276
- BlobClient GetBlobClient (BlobServiceClient blobServiceClient, string containerName, string blobName)
286
+ BlobClient GetBlobClient (
287
+ BlobServiceClient blobServiceClient,
288
+ string containerName,
289
+ string blobName)
277
290
{
278
- // Create a blob client using the service client object
279
- BlobClient client = blobServiceClient .GetBlobContainerClient (containerName).GetBlobClient (blobName);
291
+ BlobClient client =
292
+ blobServiceClient .GetBlobContainerClient (containerName).GetBlobClient (blobName);
280
293
return client;
281
294
}
282
295
` ` `
283
296
284
297
## [Java](#tab/java)
285
298
286
299
` ` ` java
287
- public BlobClient getBlobClient (BlobServiceClient blobServiceClient , String containerName , String blobName ) {
300
+ public BlobClient getBlobClient (
301
+ BlobServiceClient blobServiceClient,
302
+ String containerName,
303
+ String blobName) {
288
304
// Create a blob client using the service client object
289
305
BlobClient client = blobServiceClient .getBlobContainerClient (containerName).getBlobClient (blobName);
290
306
return client;
0 commit comments