Skip to content

Commit

Permalink
Premium file bandwidth limits (#25073)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rickle-msft authored Nov 8, 2021
1 parent 696999a commit 55a96ce
Show file tree
Hide file tree
Showing 16 changed files with 246 additions and 227 deletions.
2 changes: 2 additions & 0 deletions sdk/storage/azure-storage-file-share/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 12.12.0-beta.2 (Unreleased)

### Features Added
- Added support for the 2021-02-12 service version.
- Added support for new bandwidth limits.

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,7 @@ private Response<ShareProperties> mapGetPropertiesResponse(SharesGetPropertiesRe
.setNextAllowedQuotaDowngradeTime(headers.getXMsShareNextAllowedQuotaDowngradeTime())
.setProvisionedEgressMBps(headers.getXMsShareProvisionedEgressMbps())
.setProvisionedIngressMBps(headers.getXMsShareProvisionedIngressMbps())
.setProvisionedBandwidthMiBps(headers.getXMsShareProvisionedBandwidthMibps())
.setProvisionedIops(headers.getXMsShareProvisionedIops())
.setLeaseDuration(headers.getXMsLeaseDuration())
.setLeaseState(headers.getXMsLeaseState())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@

import com.azure.core.annotation.ServiceClientBuilder;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddHeadersPolicy;
import com.azure.core.http.policy.CookiePolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.util.ClientOptions;
import com.azure.core.util.Configuration;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.core.util.serializer.SerializerAdapter;
import java.util.ArrayList;
Expand Down Expand Up @@ -173,6 +177,23 @@ public AzureFileStorageImplBuilder retryPolicy(RetryPolicy retryPolicy) {
*/
private final List<HttpPipelinePolicy> pipelinePolicies;

/*
* The client options such as application ID and custom headers to set on a
* request.
*/
private ClientOptions clientOptions;

/**
* Sets The client options such as application ID and custom headers to set on a request.
*
* @param clientOptions the clientOptions value.
* @return the AzureFileStorageImplBuilder.
*/
public AzureFileStorageImplBuilder clientOptions(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
return this;
}

/**
* Adds a custom Http pipeline policy.
*
Expand Down Expand Up @@ -209,11 +230,19 @@ private HttpPipeline createHttpPipeline() {
if (httpLogOptions == null) {
httpLogOptions = new HttpLogOptions();
}
if (clientOptions == null) {
clientOptions = new ClientOptions();
}
List<HttpPipelinePolicy> policies = new ArrayList<>();
String clientName = properties.getOrDefault(SDK_NAME, "UnknownName");
String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion");
policies.add(
new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, buildConfiguration));
String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions);
policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
HttpHeaders headers = new HttpHeaders();
clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue()));
if (headers.getSize() > 0) {
policies.add(new AddHeadersPolicy(headers));
}
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy);
policies.add(new CookiePolicy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public final class SharePropertiesInternal {
@JsonProperty(value = "ProvisionedEgressMBps")
private Integer provisionedEgressMBps;

/*
* The ProvisionedBandwidthMiBps property.
*/
@JsonProperty(value = "ProvisionedBandwidthMiBps")
private Integer provisionedBandwidthMiBps;

/*
* The NextAllowedQuotaDowngradeTime property.
*/
Expand Down Expand Up @@ -255,6 +261,26 @@ public SharePropertiesInternal setProvisionedEgressMBps(Integer provisionedEgres
return this;
}

/**
* Get the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
*
* @return the provisionedBandwidthMiBps value.
*/
public Integer getProvisionedBandwidthMiBps() {
return this.provisionedBandwidthMiBps;
}

/**
* Set the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
*
* @param provisionedBandwidthMiBps the provisionedBandwidthMiBps value to set.
* @return the SharePropertiesInternal object itself.
*/
public SharePropertiesInternal setProvisionedBandwidthMiBps(Integer provisionedBandwidthMiBps) {
this.provisionedBandwidthMiBps = provisionedBandwidthMiBps;
return this;
}

/**
* Get the nextAllowedQuotaDowngradeTime property: The NextAllowedQuotaDowngradeTime property.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public final class SharesGetPropertiesHeaders {
@JsonProperty(value = "x-ms-share-provisioned-ingress-mbps")
private Integer xMsShareProvisionedIngressMbps;

/*
* The x-ms-share-provisioned-bandwidth-mibps property.
*/
@JsonProperty(value = "x-ms-share-provisioned-bandwidth-mibps")
private Integer xMsShareProvisionedBandwidthMibps;

/*
* The x-ms-share-quota property.
*/
Expand Down Expand Up @@ -355,6 +361,26 @@ public SharesGetPropertiesHeaders setXMsShareProvisionedIngressMbps(Integer xMsS
return this;
}

/**
* Get the xMsShareProvisionedBandwidthMibps property: The x-ms-share-provisioned-bandwidth-mibps property.
*
* @return the xMsShareProvisionedBandwidthMibps value.
*/
public Integer getXMsShareProvisionedBandwidthMibps() {
return this.xMsShareProvisionedBandwidthMibps;
}

/**
* Set the xMsShareProvisionedBandwidthMibps property: The x-ms-share-provisioned-bandwidth-mibps property.
*
* @param xMsShareProvisionedBandwidthMibps the xMsShareProvisionedBandwidthMibps value to set.
* @return the SharesGetPropertiesHeaders object itself.
*/
public SharesGetPropertiesHeaders setXMsShareProvisionedBandwidthMibps(Integer xMsShareProvisionedBandwidthMibps) {
this.xMsShareProvisionedBandwidthMibps = xMsShareProvisionedBandwidthMibps;
return this;
}

/**
* Get the xMsShareQuota property: The x-ms-share-quota property.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public static ShareProperties populateShareProperties(SharePropertiesInternal sh
properties.setProtocols(parseShareProtocols(sharePropertiesInternal.getEnabledProtocols()));
properties.setRootSquash(sharePropertiesInternal.getRootSquash());
properties.setMetadata(sharePropertiesInternal.getMetadata());
properties.setProvisionedBandwidthMiBps(sharePropertiesInternal.getProvisionedBandwidthMiBps());

return properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public final class ShareProperties {
@JsonProperty(value = "Metadata")
private Map<String, String> metadata;

/*
* The provisioned bandwidth.
*/
private Integer provisionedBandwidthMiBps;

/**
* Get the lastModified property: The lastModified property.
*
Expand Down Expand Up @@ -257,6 +262,26 @@ public ShareProperties setProvisionedEgressMBps(Integer provisionedEgressMBps) {
return this;
}

/**
* Get the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
*
* @return the provisionedBandwidthMiBps value.
*/
public Integer getProvisionedBandwidthMiBps() {
return this.provisionedBandwidthMiBps;
}

/**
* Set the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property.
*
* @param provisionedBandwidthMiBps the provisionedBandwidthMiBps value to set.
* @return the ShareProperties object itself.
*/
public ShareProperties setProvisionedBandwidthMiBps(Integer provisionedBandwidthMiBps) {
this.provisionedBandwidthMiBps = provisionedBandwidthMiBps;
return this;
}

/**
* Get the nextAllowedQuotaDowngradeTime property: The
* nextAllowedQuotaDowngradeTime property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
package com.azure.storage.file.share

import com.azure.core.util.Context
import com.azure.storage.blob.BlobContainerClient
import com.azure.storage.blob.BlobServiceVersion
import com.azure.storage.blob.models.BlobAnalyticsLogging
import com.azure.storage.blob.models.BlobContainerListDetails
import com.azure.storage.blob.models.BlobRetentionPolicy
import com.azure.storage.blob.models.BlobServiceProperties
import com.azure.storage.blob.models.ListBlobContainersOptions
import com.azure.storage.common.StorageSharedKeyCredential
import com.azure.storage.common.test.shared.extensions.PlaybackOnly
import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion
Expand Down Expand Up @@ -244,6 +251,7 @@ class FileServiceAPITests extends APISpec {
item.getProperties().getAccessTierTransitionState() == "pending-from-hot"
}

@RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "V2021_02_12")
def "List shares with premium share"() {
setup:
def premiumShareName = generateShareName()
Expand All @@ -262,6 +270,7 @@ class FileServiceAPITests extends APISpec {
shareItem.getProperties().getProvisionedEgressMBps()
shareItem.getProperties().getProvisionedIngressMBps()
shareItem.getProperties().getProvisionedIops()
shareItem.getProperties().getProvisionedBandwidthMiBps()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ class ShareAPITests extends APISpec {
shareProperties.getProvisionedEgressMBps()
shareProperties.getProvisionedIngressMBps()
shareProperties.getProvisionedIops()
shareProperties.getProvisionedBandwidthMiBps()
shareProperties.getProtocols().toString() == enabledProtocol.toString()
shareProperties.getRootSquash() == rootSquash

Expand Down
Loading

0 comments on commit 55a96ce

Please sign in to comment.