Skip to content

Commit 55a96ce

Browse files
authored
Premium file bandwidth limits (Azure#25073)
* Added service version. Updated sas recordings * Updated datalake version conversion * Updated customizations * Generated off swagger * Added support for feature * Added test * Removed unused import * Fixed broken recording * Recorded one of the tests * Added other recordings * Re-added annotation to test * Reverted to main swagger
1 parent 696999a commit 55a96ce

File tree

16 files changed

+246
-227
lines changed

16 files changed

+246
-227
lines changed

sdk/storage/azure-storage-file-share/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## 12.12.0-beta.2 (Unreleased)
44

55
### Features Added
6+
- Added support for the 2021-02-12 service version.
7+
- Added support for new bandwidth limits.
68

79
### Breaking Changes
810

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ private Response<ShareProperties> mapGetPropertiesResponse(SharesGetPropertiesRe
15591559
.setNextAllowedQuotaDowngradeTime(headers.getXMsShareNextAllowedQuotaDowngradeTime())
15601560
.setProvisionedEgressMBps(headers.getXMsShareProvisionedEgressMbps())
15611561
.setProvisionedIngressMBps(headers.getXMsShareProvisionedIngressMbps())
1562+
.setProvisionedBandwidthMiBps(headers.getXMsShareProvisionedBandwidthMibps())
15621563
.setProvisionedIops(headers.getXMsShareProvisionedIops())
15631564
.setLeaseDuration(headers.getXMsLeaseDuration())
15641565
.setLeaseState(headers.getXMsLeaseState())

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/AzureFileStorageImplBuilder.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66

77
import com.azure.core.annotation.ServiceClientBuilder;
88
import com.azure.core.http.HttpClient;
9+
import com.azure.core.http.HttpHeaders;
910
import com.azure.core.http.HttpPipeline;
1011
import com.azure.core.http.HttpPipelineBuilder;
12+
import com.azure.core.http.policy.AddHeadersPolicy;
1113
import com.azure.core.http.policy.CookiePolicy;
1214
import com.azure.core.http.policy.HttpLogOptions;
1315
import com.azure.core.http.policy.HttpLoggingPolicy;
1416
import com.azure.core.http.policy.HttpPipelinePolicy;
1517
import com.azure.core.http.policy.HttpPolicyProviders;
1618
import com.azure.core.http.policy.RetryPolicy;
1719
import com.azure.core.http.policy.UserAgentPolicy;
20+
import com.azure.core.util.ClientOptions;
1821
import com.azure.core.util.Configuration;
22+
import com.azure.core.util.CoreUtils;
1923
import com.azure.core.util.serializer.JacksonAdapter;
2024
import com.azure.core.util.serializer.SerializerAdapter;
2125
import java.util.ArrayList;
@@ -173,6 +177,23 @@ public AzureFileStorageImplBuilder retryPolicy(RetryPolicy retryPolicy) {
173177
*/
174178
private final List<HttpPipelinePolicy> pipelinePolicies;
175179

180+
/*
181+
* The client options such as application ID and custom headers to set on a
182+
* request.
183+
*/
184+
private ClientOptions clientOptions;
185+
186+
/**
187+
* Sets The client options such as application ID and custom headers to set on a request.
188+
*
189+
* @param clientOptions the clientOptions value.
190+
* @return the AzureFileStorageImplBuilder.
191+
*/
192+
public AzureFileStorageImplBuilder clientOptions(ClientOptions clientOptions) {
193+
this.clientOptions = clientOptions;
194+
return this;
195+
}
196+
176197
/**
177198
* Adds a custom Http pipeline policy.
178199
*
@@ -209,11 +230,19 @@ private HttpPipeline createHttpPipeline() {
209230
if (httpLogOptions == null) {
210231
httpLogOptions = new HttpLogOptions();
211232
}
233+
if (clientOptions == null) {
234+
clientOptions = new ClientOptions();
235+
}
212236
List<HttpPipelinePolicy> policies = new ArrayList<>();
213237
String clientName = properties.getOrDefault(SDK_NAME, "UnknownName");
214238
String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion");
215-
policies.add(
216-
new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, buildConfiguration));
239+
String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions);
240+
policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
241+
HttpHeaders headers = new HttpHeaders();
242+
clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue()));
243+
if (headers.getSize() > 0) {
244+
policies.add(new AddHeadersPolicy(headers));
245+
}
217246
HttpPolicyProviders.addBeforeRetryPolicies(policies);
218247
policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy);
219248
policies.add(new CookiePolicy());

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public final class SharePropertiesInternal {
5555
@JsonProperty(value = "ProvisionedEgressMBps")
5656
private Integer provisionedEgressMBps;
5757

58+
/*
59+
* The ProvisionedBandwidthMiBps property.
60+
*/
61+
@JsonProperty(value = "ProvisionedBandwidthMiBps")
62+
private Integer provisionedBandwidthMiBps;
63+
5864
/*
5965
* The NextAllowedQuotaDowngradeTime property.
6066
*/
@@ -255,6 +261,26 @@ public SharePropertiesInternal setProvisionedEgressMBps(Integer provisionedEgres
255261
return this;
256262
}
257263

264+
/**
265+
* Get the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
266+
*
267+
* @return the provisionedBandwidthMiBps value.
268+
*/
269+
public Integer getProvisionedBandwidthMiBps() {
270+
return this.provisionedBandwidthMiBps;
271+
}
272+
273+
/**
274+
* Set the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
275+
*
276+
* @param provisionedBandwidthMiBps the provisionedBandwidthMiBps value to set.
277+
* @return the SharePropertiesInternal object itself.
278+
*/
279+
public SharePropertiesInternal setProvisionedBandwidthMiBps(Integer provisionedBandwidthMiBps) {
280+
this.provisionedBandwidthMiBps = provisionedBandwidthMiBps;
281+
return this;
282+
}
283+
258284
/**
259285
* Get the nextAllowedQuotaDowngradeTime property: The NextAllowedQuotaDowngradeTime property.
260286
*

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ public final class SharesGetPropertiesHeaders {
8080
@JsonProperty(value = "x-ms-share-provisioned-ingress-mbps")
8181
private Integer xMsShareProvisionedIngressMbps;
8282

83+
/*
84+
* The x-ms-share-provisioned-bandwidth-mibps property.
85+
*/
86+
@JsonProperty(value = "x-ms-share-provisioned-bandwidth-mibps")
87+
private Integer xMsShareProvisionedBandwidthMibps;
88+
8389
/*
8490
* The x-ms-share-quota property.
8591
*/
@@ -355,6 +361,26 @@ public SharesGetPropertiesHeaders setXMsShareProvisionedIngressMbps(Integer xMsS
355361
return this;
356362
}
357363

364+
/**
365+
* Get the xMsShareProvisionedBandwidthMibps property: The x-ms-share-provisioned-bandwidth-mibps property.
366+
*
367+
* @return the xMsShareProvisionedBandwidthMibps value.
368+
*/
369+
public Integer getXMsShareProvisionedBandwidthMibps() {
370+
return this.xMsShareProvisionedBandwidthMibps;
371+
}
372+
373+
/**
374+
* Set the xMsShareProvisionedBandwidthMibps property: The x-ms-share-provisioned-bandwidth-mibps property.
375+
*
376+
* @param xMsShareProvisionedBandwidthMibps the xMsShareProvisionedBandwidthMibps value to set.
377+
* @return the SharesGetPropertiesHeaders object itself.
378+
*/
379+
public SharesGetPropertiesHeaders setXMsShareProvisionedBandwidthMibps(Integer xMsShareProvisionedBandwidthMibps) {
380+
this.xMsShareProvisionedBandwidthMibps = xMsShareProvisionedBandwidthMibps;
381+
return this;
382+
}
383+
358384
/**
359385
* Get the xMsShareQuota property: The x-ms-share-quota property.
360386
*

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public static ShareProperties populateShareProperties(SharePropertiesInternal sh
139139
properties.setProtocols(parseShareProtocols(sharePropertiesInternal.getEnabledProtocols()));
140140
properties.setRootSquash(sharePropertiesInternal.getRootSquash());
141141
properties.setMetadata(sharePropertiesInternal.getMetadata());
142+
properties.setProvisionedBandwidthMiBps(sharePropertiesInternal.getProvisionedBandwidthMiBps());
142143

143144
return properties;
144145
}

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ public final class ShareProperties {
126126
@JsonProperty(value = "Metadata")
127127
private Map<String, String> metadata;
128128

129+
/*
130+
* The provisioned bandwidth.
131+
*/
132+
private Integer provisionedBandwidthMiBps;
133+
129134
/**
130135
* Get the lastModified property: The lastModified property.
131136
*
@@ -257,6 +262,26 @@ public ShareProperties setProvisionedEgressMBps(Integer provisionedEgressMBps) {
257262
return this;
258263
}
259264

265+
/**
266+
* Get the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
267+
*
268+
* @return the provisionedBandwidthMiBps value.
269+
*/
270+
public Integer getProvisionedBandwidthMiBps() {
271+
return this.provisionedBandwidthMiBps;
272+
}
273+
274+
/**
275+
* Set the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
276+
*
277+
* @param provisionedBandwidthMiBps the provisionedBandwidthMiBps value to set.
278+
* @return the ShareProperties object itself.
279+
*/
280+
public ShareProperties setProvisionedBandwidthMiBps(Integer provisionedBandwidthMiBps) {
281+
this.provisionedBandwidthMiBps = provisionedBandwidthMiBps;
282+
return this;
283+
}
284+
260285
/**
261286
* Get the nextAllowedQuotaDowngradeTime property: The
262287
* nextAllowedQuotaDowngradeTime property.

sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
package com.azure.storage.file.share
55

66
import com.azure.core.util.Context
7+
import com.azure.storage.blob.BlobContainerClient
8+
import com.azure.storage.blob.BlobServiceVersion
9+
import com.azure.storage.blob.models.BlobAnalyticsLogging
10+
import com.azure.storage.blob.models.BlobContainerListDetails
11+
import com.azure.storage.blob.models.BlobRetentionPolicy
12+
import com.azure.storage.blob.models.BlobServiceProperties
13+
import com.azure.storage.blob.models.ListBlobContainersOptions
714
import com.azure.storage.common.StorageSharedKeyCredential
815
import com.azure.storage.common.test.shared.extensions.PlaybackOnly
916
import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion
@@ -244,6 +251,7 @@ class FileServiceAPITests extends APISpec {
244251
item.getProperties().getAccessTierTransitionState() == "pending-from-hot"
245252
}
246253

254+
@RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "V2021_02_12")
247255
def "List shares with premium share"() {
248256
setup:
249257
def premiumShareName = generateShareName()
@@ -262,6 +270,7 @@ class FileServiceAPITests extends APISpec {
262270
shareItem.getProperties().getProvisionedEgressMBps()
263271
shareItem.getProperties().getProvisionedIngressMBps()
264272
shareItem.getProperties().getProvisionedIops()
273+
shareItem.getProperties().getProvisionedBandwidthMiBps()
265274
}
266275
}
267276
}

sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAPITests.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ class ShareAPITests extends APISpec {
348348
shareProperties.getProvisionedEgressMBps()
349349
shareProperties.getProvisionedIngressMBps()
350350
shareProperties.getProvisionedIops()
351+
shareProperties.getProvisionedBandwidthMiBps()
351352
shareProperties.getProtocols().toString() == enabledProtocol.toString()
352353
shareProperties.getRootSquash() == rootSquash
353354

0 commit comments

Comments
 (0)