Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue, File and Datalake Sas #6709

Merged
merged 27 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e89a324
blob Sas
gapra-msft Nov 18, 2019
a5c133c
Added some java doc and deprecation notices
gapra-msft Nov 22, 2019
bad7d1a
added test recordings + more tests
gapra-msft Nov 25, 2019
b4adb50
Added more code snippets and comments
gapra-msft Nov 25, 2019
7aa07d0
Merge branch 'master' into storage/SAS
gapra-msft Nov 25, 2019
617c3db
fixing test java 11 issue
gapra-msft Nov 25, 2019
cd2bf81
removed unused imports
gapra-msft Nov 25, 2019
8db1537
fixing code snippets
gapra-msft Nov 25, 2019
d2b69ad
added code for queue sas
gapra-msft Nov 25, 2019
486b7f6
Addressed CR comments
gapra-msft Nov 25, 2019
0598087
removed imports
gapra-msft Nov 25, 2019
0953260
Updated javadoc
gapra-msft Nov 27, 2019
ca10662
Added Sas test, changed a few javadocs
gapra-msft Nov 27, 2019
11f7082
Removed new lines
gapra-msft Nov 27, 2019
cf69e8b
removed unnecessary java doc snippets class
gapra-msft Nov 27, 2019
d42398f
Merge branch 'master' into storage/SAS
gapra-msft Dec 2, 2019
3bbdc6b
Removed unused imports
gapra-msft Dec 2, 2019
89aacb4
Merge branch 'storage/SAS' into storage/queueSAS
gapra-msft Dec 2, 2019
6a539de
Added queue and file SAS
gapra-msft Dec 3, 2019
dc6518e
added datalake sas
gapra-msft Dec 3, 2019
2622325
Merge branch 'master' into storage/queueFileSas
gapra-msft Dec 9, 2019
fe1a32f
reverted two changes
gapra-msft Dec 9, 2019
7f4723b
added deprecagtion notices to sas query parameters
gapra-msft Dec 9, 2019
901602b
rewrote datalake sas test
gapra-msft Dec 9, 2019
6817dad
rewrote string to sign tests in datalake
gapra-msft Dec 9, 2019
936b932
added missed recording
gapra-msft Dec 9, 2019
f108539
Added java doc comment about storagesharedkeycredential
gapra-msft Dec 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobContainerAsyncClient;
import com.azure.storage.blob.specialized.BlockBlobAsyncClient;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.common.Utility;
import com.azure.storage.common.implementation.StorageImplUtils;
import com.azure.storage.file.datalake.implementation.DataLakeStorageClientBuilder;
Expand All @@ -29,9 +30,12 @@
import com.azure.storage.file.datalake.models.PathHttpHeaders;
import com.azure.storage.file.datalake.models.PathItem;
import com.azure.storage.file.datalake.models.PublicAccessType;
import com.azure.storage.file.datalake.models.UserDelegationKey;
import com.azure.storage.file.datalake.sas.DataLakeServiceSasSignatureValues;
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -710,4 +714,45 @@ public Mono<Response<FileSystemAccessPolicies>> getAccessPolicyWithResponse(Stri
BlobContainerAsyncClient getBlobContainerAsyncClient() {
return blobContainerAsyncClient;
}

/**
* Generates a user delegation SAS for the file system using the specified
* {@link DataLakeServiceSasSignatureValues}.
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a user delegation SAS.
* </p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakeFileSystemAsyncClient.generateUserDelegationSas#DataLakeServiceSasSignatureValues-UserDelegationKey}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
* @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values.
* @see DataLakeServiceAsyncClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how
* to get a user delegation key.
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues,
UserDelegationKey userDelegationKey) {
return blobContainerAsyncClient.generateUserDelegationSas(
Transforms.toBlobSasValues(dataLakeServiceSasSignatureValues),
Transforms.toBlobUserDelegationKey(userDelegationKey));
}

/**
* Generates a service SAS for the file system using the specified {@link DataLakeServiceSasSignatureValues}
* Note : The client must be authenticated via {@link StorageSharedKeyCredential}
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a service SAS.</p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakeFileSystemAsyncClient.generateSas#DataLakeServiceSasSignatureValues}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues) {
return blobContainerAsyncClient.generateSas(Transforms.toBlobSasValues(dataLakeServiceSasSignatureValues));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.models.BlobContainerAccessPolicies;
import com.azure.storage.blob.models.BlobContainerProperties;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.file.datalake.models.DataLakeRequestConditions;
import com.azure.storage.file.datalake.models.DataLakeSignedIdentifier;
import com.azure.storage.file.datalake.models.FileSystemAccessPolicies;
Expand All @@ -21,8 +22,11 @@
import com.azure.storage.file.datalake.models.PathHttpHeaders;
import com.azure.storage.file.datalake.models.PathItem;
import com.azure.storage.file.datalake.models.PublicAccessType;
import com.azure.storage.file.datalake.models.UserDelegationKey;
import com.azure.storage.file.datalake.sas.DataLakeServiceSasSignatureValues;

import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -581,4 +585,44 @@ BlobContainerClient getBlobContainerClient() {
return blobContainerClient;
}

/**
* Generates a user delegation SAS for the file system using the specified
* {@link DataLakeServiceSasSignatureValues}.
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a user delegation SAS.
* </p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakeFileSystemAsyncClient.generateUserDelegationSas#DataLakeServiceSasSignatureValues-UserDelegationKey}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
* @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values.
* @see DataLakeServiceClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how to
* get a user delegation key.
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues,
UserDelegationKey userDelegationKey) {
return dataLakeFileSystemAsyncClient.generateUserDelegationSas(dataLakeServiceSasSignatureValues,
userDelegationKey);
}

/**
* Generates a service SAS for the file system using the specified {@link DataLakeServiceSasSignatureValues}
* Note : The client must be authenticated via {@link StorageSharedKeyCredential}
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a service SAS.</p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakeFileSystemClient.generateSas#DataLakeServiceSasSignatureValues}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues) {
return dataLakeFileSystemAsyncClient.generateSas(dataLakeServiceSasSignatureValues);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.azure.storage.blob.BlobUrlParts;
import com.azure.storage.blob.specialized.BlockBlobAsyncClient;
import com.azure.storage.blob.specialized.SpecializedBlobClientBuilder;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.common.Utility;
import com.azure.storage.file.datalake.implementation.DataLakeStorageClientBuilder;
import com.azure.storage.file.datalake.implementation.DataLakeStorageClientImpl;
Expand All @@ -33,9 +34,12 @@
import com.azure.storage.file.datalake.models.PathItem;
import com.azure.storage.file.datalake.models.PathPermissions;
import com.azure.storage.file.datalake.models.PathProperties;
import com.azure.storage.file.datalake.models.UserDelegationKey;
import com.azure.storage.file.datalake.sas.DataLakeServiceSasSignatureValues;
import reactor.core.publisher.Mono;

import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.Base64;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -686,4 +690,44 @@ SpecializedBlobClientBuilder prepareBuilderReplacePath(String destinationPath) {
BlockBlobAsyncClient getBlockBlobAsyncClient() {
return this.blockBlobAsyncClient;
}

/**
* Generates a user delegation SAS for the path using the specified {@link DataLakeServiceSasSignatureValues}.
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a user delegation SAS.
* </p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakePathAsyncClient.generateUserDelegationSas#DataLakeServiceSasSignatureValues-UserDelegationKey}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
* @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values.
* @see DataLakeServiceAsyncClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how
* to get a user delegation key.
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues,
UserDelegationKey userDelegationKey) {
return blockBlobAsyncClient.generateUserDelegationSas(
Transforms.toBlobSasValues(dataLakeServiceSasSignatureValues),
Transforms.toBlobUserDelegationKey(userDelegationKey));
}

/**
* Generates a service SAS for the path using the specified {@link DataLakeServiceSasSignatureValues}
* Note : The client must be authenticated via {@link StorageSharedKeyCredential}
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a service SAS.</p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakePathAsyncClient.generateSas#DataLakeServiceSasSignatureValues}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues) {
return blockBlobAsyncClient.generateSas(Transforms.toBlobSasValues(dataLakeServiceSasSignatureValues));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.models.BlobProperties;
import com.azure.storage.blob.specialized.BlockBlobClient;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.common.implementation.StorageImplUtils;
import com.azure.storage.file.datalake.implementation.models.LeaseAccessConditions;
import com.azure.storage.file.datalake.implementation.models.ModifiedAccessConditions;
Expand All @@ -22,9 +23,12 @@
import com.azure.storage.file.datalake.models.PathInfo;
import com.azure.storage.file.datalake.models.PathPermissions;
import com.azure.storage.file.datalake.models.PathProperties;
import com.azure.storage.file.datalake.models.UserDelegationKey;
import com.azure.storage.file.datalake.sas.DataLakeServiceSasSignatureValues;
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -456,4 +460,42 @@ BlockBlobClient getBlockBlobClient() {
return blockBlobClient;
}

/**
* Generates a user delegation SAS for the path using the specified {@link DataLakeServiceSasSignatureValues}.
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a user delegation SAS.
* </p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakePathClient.generateUserDelegationSas#DataLakeServiceSasSignatureValues-UserDelegationKey}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
* @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values.
* @see DataLakeServiceClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how to
* get a user delegation key.
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateUserDelegationSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues,
UserDelegationKey userDelegationKey) {
return dataLakePathAsyncClient.generateUserDelegationSas(dataLakeServiceSasSignatureValues, userDelegationKey);
}

/**
* Generates a service SAS for the path using the specified {@link DataLakeServiceSasSignatureValues}
* Note : The client must be authenticated via {@link StorageSharedKeyCredential}
* <p>See {@link DataLakeServiceSasSignatureValues} for more information on how to construct a service SAS.</p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.file.datalake.DataLakePathClient.generateSas#DataLakeServiceSasSignatureValues}
*
* @param dataLakeServiceSasSignatureValues {@link DataLakeServiceSasSignatureValues}
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSignatureValues) {
return dataLakePathAsyncClient.generateSas(dataLakeServiceSasSignatureValues);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobServiceAsyncClient;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.common.Utility;
import com.azure.storage.common.implementation.StorageImplUtils;
import com.azure.storage.common.sas.AccountSasSignatureValues;
import com.azure.storage.file.datalake.implementation.DataLakeStorageClientBuilder;
import com.azure.storage.file.datalake.implementation.DataLakeStorageClientImpl;
import com.azure.storage.file.datalake.models.DataLakeRequestConditions;
Expand Down Expand Up @@ -317,4 +319,21 @@ public String getAccountName() {
return this.accountName;
}

/**
* Generates an account SAS for the Azure Storage account using the specified {@link AccountSasSignatureValues}.
* Note : The client must be authenticated via {@link StorageSharedKeyCredential}
* <p>See {@link AccountSasSignatureValues} for more information on how to construct an account SAS.</p>
*
* <p>The snippet below generates a SAS that lasts for two days and gives the user read and list access to file
* systems and file shares.</p>
* {@codesnippet com.azure.storage.file.datalake.DataLakeServiceAsyncClient.generateAccountSas#AccountSasSignatureValues}
*
* @param accountSasSignatureValues {@link AccountSasSignatureValues}
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateAccountSas(AccountSasSignatureValues accountSasSignatureValues) {
return blobServiceAsyncClient.generateAccountSas(accountSasSignatureValues);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.storage.blob.BlobServiceClient;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.common.sas.AccountSasSignatureValues;
import com.azure.storage.file.datalake.models.DataLakeRequestConditions;
import com.azure.storage.file.datalake.models.FileSystemItem;
import com.azure.storage.file.datalake.models.ListFileSystemsOptions;
Expand Down Expand Up @@ -246,4 +248,21 @@ public Response<UserDelegationKey> getUserDelegationKeyWithResponse(OffsetDateTi
public String getAccountName() {
return this.dataLakeServiceAsyncClient.getAccountName();
}

/**
* Generates an account SAS for the Azure Storage account using the specified {@link AccountSasSignatureValues}.
* Note : The client must be authenticated via {@link StorageSharedKeyCredential}
* <p>See {@link AccountSasSignatureValues} for more information on how to construct an account SAS.</p>
*
* <p>The snippet below generates a SAS that lasts for two days and gives the user read and list access to file
* systems and file shares.</p>
* {@codesnippet com.azure.storage.file.datalake.DataLakeServiceClient.generateAccountSas#AccountSasSignatureValues}
*
* @param accountSasSignatureValues {@link AccountSasSignatureValues}
*
* @return A {@code String} representing all SAS query parameters.
*/
public String generateAccountSas(AccountSasSignatureValues accountSasSignatureValues) {
return dataLakeServiceAsyncClient.generateAccountSas(accountSasSignatureValues);
}
}
Loading