本文整理汇总了Java中com.microsoft.azure.storage.core.SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法的典型用法代码示例。如果您正苦于以下问题:Java SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法的具体用法?Java SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile怎么用?Java SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.azure.storage.core.SharedAccessSignatureHelper
的用法示例。
在下文中一共展示了SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSharedAccessSignature
import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //导入方法依赖的package包/类
/**
* Returns a shared access signature for the share. Note this does not contain the leading "?".
*
* @param policy
* An {@link SharedAccessFilePolicy} object that represents the access policy for the
* shared access signature.
* @param groupPolicyIdentifier
* A <code>String</code> which represents the share-level access policy.
* @param ipRange
* A {@link IPRange} object containing the range of allowed IP addresses.
* @param protocols
* A {@link SharedAccessProtocols} representing the allowed Internet protocols.
*
* @return A <code>String</code> which represents a shared access signature for the share.
*
* @throws StorageException
* If a storage service error occurred.
* @throws InvalidKeyException
* If the key is invalid.
*/
public String generateSharedAccessSignature(
final SharedAccessFilePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
final SharedAccessProtocols protocols)
throws InvalidKeyException, StorageException {
if (!StorageCredentialsHelper.canCredentialsSignRequest(this.fileServiceClient.getCredentials())) {
final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
throw new IllegalArgumentException(errorMessage);
}
final String resourceName = this.getSharedAccessCanonicalName();
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, resourceName,
ipRange, protocols, this.fileServiceClient);
final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, "s", ipRange, protocols, signature);
return builder.toString();
}
示例2: generateSharedAccessSignature
import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //导入方法依赖的package包/类
/**
* Returns a shared access signature for the container. Note this does not contain the leading "?".
*
* @param policy
* An {@link SharedAccessBlobPolicy} object that represents the access policy for the shared access
* signature.
* @param groupPolicyIdentifier
* A <code>String</code> which represents the container-level access policy.
* @param ipRange
* A {@link IPRange} object containing the range of allowed IP addresses.
* @param protocols
* A {@link SharedAccessProtocols} representing the allowed Internet protocols.
*
* @return A <code>String</code> which represents a shared access signature for the container.
*
* @throws StorageException
* If a storage service error occurred.
* @throws InvalidKeyException
* If the key is invalid.
*/
public String generateSharedAccessSignature(final SharedAccessBlobPolicy policy,
final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols)
throws InvalidKeyException, StorageException {
if (!StorageCredentialsHelper.canCredentialsSignRequest(this.blobServiceClient.getCredentials())) {
final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
throw new IllegalArgumentException(errorMessage);
}
final String resourceName = this.getSharedAccessCanonicalName();
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
policy, null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, resourceName,
ipRange, protocols, this.blobServiceClient);
final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(policy,
null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, "c", ipRange, protocols, signature);
return builder.toString();
}
示例3: generateSharedAccessSignature
import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //导入方法依赖的package包/类
/**
* Returns a shared access signature for the blob using the specified group policy identifier and operation context.
* Note this does not contain the leading "?".
*
* @param policy
* A <code>{@link SharedAccessPolicy}</code> object that represents the access policy for the shared
* access signature.
* @param headers
* A <code>{@link SharedAccessBlobHeaders}</code> object that represents the optional header values to
* set for a blob accessed with this shared access signature.
* @param groupPolicyIdentifier
* A <code>String</code> that represents the container-level access policy.
* @param ipRange
* A {@link IPRange} object containing the range of allowed IP addresses.
* @param protocols
* A {@link SharedAccessProtocols} representing the allowed Internet protocols.
*
* @return A <code>String</code> that represents the shared access signature.
*
* @throws IllegalArgumentException
* If the credentials are invalid or the blob is a snapshot.
* @throws InvalidKeyException
* If the credentials are invalid.
* @throws StorageException
* If a storage service error occurred.
*/
public String generateSharedAccessSignature(
final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers,
final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols)
throws InvalidKeyException, StorageException {
if (!StorageCredentialsHelper.canCredentialsSignRequest(this.blobServiceClient.getCredentials())) {
throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
}
if (this.isSnapshot()) {
throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_FOR_SNAPSHOTS);
}
final String resourceName = this.getCanonicalName(true);
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
policy, headers, groupPolicyIdentifier, resourceName, ipRange, protocols, this.blobServiceClient);
final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
policy, headers, groupPolicyIdentifier, "b", ipRange, protocols, signature);
return builder.toString();
}
示例4: generateSharedAccessSignature
import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //导入方法依赖的package包/类
/**
* Returns a shared access signature for the file using the specified group policy identifier and
* shared access file headers. Note this does not contain the leading "?".
*
* @param policy
* A <code>{@link SharedAccessFilePolicy}</code> object that represents the access policy for the shared
* access signature.
* @param headers
* A <code>{@link SharedAccessFileHeaders}</code> object that represents the optional header values to
* set for a file accessed with this shared access signature.
* @param groupPolicyIdentifier
* A <code>String</code> that represents the share-level access policy.
* @param ipRange
* A {@link IPRange} object containing the range of allowed IP addresses.
* @param protocols
* A {@link SharedAccessProtocols} representing the allowed Internet protocols.
*
* @return A <code>String</code> that represents the shared access signature.
*
* @throws IllegalArgumentException
* If the credentials are invalid.
* @throws InvalidKeyException
* If the credentials are invalid.
* @throws StorageException
* If a storage service error occurred.
*/
public String generateSharedAccessSignature(
final SharedAccessFilePolicy policy, final SharedAccessFileHeaders headers,
final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols)
throws InvalidKeyException, StorageException {
if (!StorageCredentialsHelper.canCredentialsSignRequest(this.fileServiceClient.getCredentials())) {
throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
}
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
policy, headers, groupPolicyIdentifier, this.getCanonicalName(),
ipRange, protocols, this.fileServiceClient);
final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
policy, headers, groupPolicyIdentifier, "f", ipRange, protocols, signature);
return builder.toString();
}